[pypy-commit] stmgc marker: Move this into macros. Should allow future optimizations or
arigo
noreply at buildbot.pypy.org
Fri Apr 18 12:26:14 CEST 2014
Author: Armin Rigo <arigo at tunes.org>
Branch: marker
Changeset: r1166:79b97025b1ba
Date: 2014-04-18 12:25 +0200
http://bitbucket.org/pypy/stmgc/changeset/79b97025b1ba/
Log: Move this into macros. Should allow future optimizations or pushing
in some other stack etc.
diff --git a/c7/demo/demo2.c b/c7/demo/demo2.c
--- a/c7/demo/demo2.c
+++ b/c7/demo/demo2.c
@@ -210,13 +210,11 @@
while (check_sorted() == -1) {
- STM_PUSH_ROOT(stm_thread_local, (uintptr_t)(2 * loops + 1));
- STM_PUSH_ROOT(stm_thread_local, NULL);
+ STM_PUSH_MARKER(stm_thread_local, 2 * loops + 1, NULL);
bubble_run();
- STM_POP_ROOT_RET(stm_thread_local);
- STM_POP_ROOT_RET(stm_thread_local);
+ STM_POP_MARKER(stm_thread_local);
loops++;
}
diff --git a/c7/stmgc.h b/c7/stmgc.h
--- a/c7/stmgc.h
+++ b/c7/stmgc.h
@@ -274,6 +274,19 @@
#define STM_STACK_MARKER_NEW 2
#define STM_STACK_MARKER_OLD 6
+#define STM_PUSH_MARKER(tl, odd_num, p) do { \
+ uintptr_t _odd_num = (odd_num); \
+ assert(_odd_num & 1); \
+ STM_PUSH_ROOT(tl, _odd_num); \
+ STM_PUSH_ROOT(tl, p); \
+} while (0)
+
+#define STM_POP_MARKER(tl) ({ \
+ object_t *_popped = STM_POP_ROOT_RET(tl); \
+ STM_POP_ROOT_RET(tl); \
+ _popped; \
+})
+
/* Every thread needs to have a corresponding stm_thread_local_t
structure. It may be a "__thread" global variable or something else.
More information about the pypy-commit
mailing list