summaryrefslogtreecommitdiff
path: root/darwin_stop_world.c
diff options
context:
space:
mode:
authorIvan Maidanski <ivmai@mail.ru>2023-04-06 09:12:20 +0300
committerIvan Maidanski <ivmai@mail.ru>2023-04-06 13:17:41 +0300
commit30b3f419d3eea97ceda2465ea1ef0267752e2f5f (patch)
treec3f5fc6105eadfe693ef2eff1f15ffc600d60e3a /darwin_stop_world.c
parentfa2cc313eb64cff42a0e1724aee0122be2f034a8 (diff)
downloadbdwgc-30b3f419d3eea97ceda2465ea1ef0267752e2f5f.tar.gz
Add assertion to verify GC_threads hash table entries are chained properly
(refactoring) * darwin_stop_world.c (GC_push_all_stacks): Add assertion that thread entry is located in the proper hash table chain (by id). * pthread_stop_world.c (GC_push_all_stacks): Likewise. * win32_threads.c (GC_push_all_stacks): Likewise.
Diffstat (limited to 'darwin_stop_world.c')
-rw-r--r--darwin_stop_world.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/darwin_stop_world.c b/darwin_stop_world.c
index 76b1e98b..18bbc025 100644
--- a/darwin_stop_world.c
+++ b/darwin_stop_world.c
@@ -401,7 +401,8 @@ GC_INNER void GC_push_all_stacks(void)
for (i = 0; i < THREAD_TABLE_SZ; i++) {
GC_thread p;
- for (p = GC_threads[i]; p != NULL; p = p -> tm.next)
+ for (p = GC_threads[i]; p != NULL; p = p -> tm.next) {
+ GC_ASSERT(THREAD_TABLE_INDEX(p -> id) == i);
if (!KNOWN_FINISHED(p)) {
thread_act_t thread = (thread_act_t)(p -> mach_thread);
ptr_t lo = GC_stack_range_for(&hi, thread, p, my_thread,
@@ -418,6 +419,7 @@ GC_INNER void GC_push_all_stacks(void)
}
nthreads++;
}
+ }
} /* for (i=0; ...) */
}