Permalink
Browse files

Make ASSERT_NOT_FROMSPACE check all fromspaces.

Not just that of the calling thread. Makes it able to catch quite a
lot more issues in multi-threaded programs.
  • Loading branch information...
1 parent c63d649 commit 3736562a902c9f856bfa960b1373a0e7ef2e81bf @jnthn jnthn committed Nov 30, 2016
Showing with 9 additions and 4 deletions.
  1. +9 −4 src/gc/debug.h
View
@@ -2,8 +2,13 @@
#define MVM_GC_DEBUG 0
#define MVM_ASSERT_NOT_FROMSPACE(tc, c) do { \
- if (tc->nursery_fromspace && \
- (char *)(c) >= (char *)tc->nursery_fromspace && \
- (char *)(c) < (char *)tc->nursery_fromspace + MVM_NURSERY_SIZE) \
- MVM_panic(1, "Collectable %p in fromspace accessed", c); \
+ MVMThread *cur_thread = tc->instance->threads; \
+ while (cur_thread) { \
+ MVMThreadContext *thread_tc = cur_thread->body.tc; \
+ if (thread_tc && thread_tc->nursery_fromspace && \
+ (char *)(c) >= (char *)thread_tc->nursery_fromspace && \
+ (char *)(c) < (char *)thread_tc->nursery_fromspace + MVM_NURSERY_SIZE) \
+ MVM_panic(1, "Collectable %p in fromspace accessed", c); \
+ cur_thread = cur_thread->body.next; \
+ } \
} while (0)

0 comments on commit 3736562

Please sign in to comment.