diff options
author | Ivan Maidanski <ivmai@mail.ru> | 2022-10-05 07:32:54 +0300 |
---|---|---|
committer | Ivan Maidanski <ivmai@mail.ru> | 2022-10-06 15:23:14 +0300 |
commit | 73bd122b9fe44f94b9f85652ecfb5644d6020590 (patch) | |
tree | 2bb8865d305853b4d96d3023524f0bc627ebb4f5 /darwin_stop_world.c | |
parent | 708e31623ad52e295e036fdcbcbe5c866bca894d (diff) | |
download | bdwgc-73bd122b9fe44f94b9f85652ecfb5644d6020590.tar.gz |
Change GC_Thread_Rep in pthread_support.h to match that of win32_threads.c
(refactoring)
* darwin_stop_world.c (GC_stack_range_for, GC_push_all_stacks,
GC_stop_world, GC_start_world): Remove "stop_info." prefix.
* pthread_stop_world.c (GC_store_stack_ptr, GC_suspend_handler_inner,
GC_push_all_stacks, GC_suspend_all, GC_stop_world): Likewise.
* pthread_support.c [GC_ENABLE_SUSPEND_THREAD] (GC_suspend_self_inner,
GC_suspend_thread, GC_resume_thread, GC_is_thread_suspended,
GC_suspend_self_blocked): Likewise.
* pthread_support.c (GC_restart_all, GC_delete_thread,
GC_delete_gc_thread, GC_remove_all_threads_but_me, GC_thr_init,
do_blocking_enter, GC_do_blocking_inner, GC_call_with_gc_active,
GC_record_stack_base, GC_register_my_thread_inner): Likewise.
* darwin_stop_world.c (GC_push_all_stacks, GC_stop_world,
GC_start_world): Replace p->next to p->tm.next.
* pthread_stop_world.c [THREAD_SANITIZER] (GC_lookup_thread_async):
Likewise.
* pthread_stop_world.c (GC_suspend_all, GC_restart_all): Likewise.
* pthread_support.c (GC_mark_thread_local_free_lists, GC_check_tls,
GC_count_threads, GC_new_thread, GC_delete_thread, GC_delete_gc_thread,
GC_lookup_thread, GC_remove_all_threads_but_me,
GC_segment_is_thread_stack, GC_greatest_stack_base_below): Likewise.
* darwin_stop_world.c (GC_push_all_stacks): Replace p->flags&FINISHED
to KNOWN_FINISHED(p).
* pthread_stop_world.c (GC_push_all_stacks): Likewise.
* pthread_support.c (GC_mark_thread_local_free_lists, GC_check_tls,
GC_count_threads, GC_remove_all_threads_but_me, GC_set_stackbottom,
GC_unregister_my_thread_inner, pthread_join, pthread_detach,
GC_register_my_thread_inner): Likewise.
* include/private/pthread_support.h [GC_DARWIN_THREADS
|| PTHREAD_STOP_WORLD_IMPL] (thread_stop_info): Remove struct.
* include/private/pthread_support.h [GC_DARWIN_THREADS]
(GC_FindTopOfStack, GC_is_mach_marker): Move declaration down.
* include/private/pthread_support.h [PTHREAD_STOP_WORLD_IMPL]
(GC_stop_init): Likewise.
* include/private/pthread_support.h (thread_id_t): New type.
* include/private/pthread_support.h (GC_Thread_Rep): Refine comment.
* include/private/pthread_support.h (GC_Thread_Rep.next): Put field
into union tm.
* include/private/pthread_support.h (GC_Thread_Rep.id): Change type
from pthread_t to thread_id_t.
* pthread_support.c (main_pthread_id): Likewise.
* include/private/pthread_support.h (GC_Thread_Rep.stack_end): Move
field upper.
* include/private/pthread_support.h [GC_DARWIN_THREADS
&& !DARWIN_DONT_PARSE_STACK] (GC_Thread_Rep.topOfStack): Likewise.
* include/private/pthread_support.h (GC_Thread_Rep.stop_info): Replace
with stack_ptr, mach_thread (if GC_DARWIN_THREADS), last_stop_count (if
SIGNAL_BASED_STOP_WORLD), ext_suspend_cnt (if SIGNAL_BASED_STOP_WORLD
and GC_ENABLE_SUSPEND_THREAD).
* include/private/pthread_support.h [!GC_NO_FINALIZATION]
(finalizer_skipped, finalizer_nested): Move fields upper (to be right
before flags one).
* include/private/pthread_support.h (KNOWN_FINISHED): New macro (copied
from win32_threads.c).
* include/private/pthread_support.h [NACL] (NACL_GC_REG_STORAGE_SIZE,
GC_Thread_Rep.reg_storage, GC_Thread_Rep.registers): Move from
stop_info.
* include/private/pthread_support.h (GC_lookup_thread): Change argument
type from pthread_t to thread_id_t.
* pthread_stop_world.c [THREAD_SANITIZER] (GC_lookup_thread_async):
Likewise.
* pthread_support.c (GC_delete_thread, GC_lookup_thread): Likewise.
* pthread_support.c (GC_new_thread): Do not set id field (to match that
in win32_threads.c); update comment.
* pthread_support.c (GC_delete_gc_thread, GC_thread_is_registered,
GC_register_altstack, GC_remove_all_threads_but_me, GC_thr_init,
GC_get_stackbottom, GC_call_with_gc_active, GC_unregister_my_thread):
Change type of id local variable from pthread_t to thread_id_t.
* pthread_support.c (GC_lookup_thread): Refine comment.
* pthread_support.c (do_blocking_enter): Rename stack_ptr local
variable to bs_hi.
* pthread_support.c (GC_register_my_thread_inner): Rename my_pthread
argument to self.
Diffstat (limited to 'darwin_stop_world.c')
-rw-r--r-- | darwin_stop_world.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/darwin_stop_world.c b/darwin_stop_world.c index 190b3c92..c1dfe7cf 100644 --- a/darwin_stop_world.c +++ b/darwin_stop_world.c @@ -152,9 +152,9 @@ STATIC ptr_t GC_stack_range_for(ptr_t *phi, thread_act_t thread, GC_thread p, # endif *pfound_me = TRUE; } else if (p != NULL && (p -> flags & DO_BLOCKING) != 0) { - lo = p->stop_info.stack_ptr; + lo = p -> stack_ptr; # ifndef DARWIN_DONT_PARSE_STACK - *phi = p->topOfStack; + *phi = p -> topOfStack; # endif } else { @@ -395,9 +395,9 @@ 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 -> next) - if ((p -> flags & FINISHED) == 0) { - thread_act_t thread = (thread_act_t)p->stop_info.mach_thread; + for (p = GC_threads[i]; p != NULL; p = p -> tm.next) + 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, &altstack_lo, &altstack_hi, &found_me); @@ -618,19 +618,19 @@ GC_INNER void GC_stop_world(void) for (i = 0; i < THREAD_TABLE_SZ; i++) { GC_thread p; - for (p = GC_threads[i]; p != NULL; p = p -> next) { + for (p = GC_threads[i]; p != NULL; p = p -> tm.next) { if ((p -> flags & (FINISHED | DO_BLOCKING)) == 0 - && p -> stop_info.mach_thread != my_thread) { + && p -> mach_thread != my_thread) { GC_acquire_dirty_lock(); do { - kern_result = thread_suspend(p->stop_info.mach_thread); + kern_result = thread_suspend(p -> mach_thread); } while (kern_result == KERN_ABORTED); GC_release_dirty_lock(); if (kern_result != KERN_SUCCESS) ABORT("thread_suspend failed"); if (GC_on_thread_event) GC_on_thread_event(GC_EVENT_THREAD_SUSPENDED, - (void *)(word)p->stop_info.mach_thread); + (void *)(word)(p -> mach_thread)); } } } @@ -754,10 +754,10 @@ GC_INNER void GC_start_world(void) for (i = 0; i < THREAD_TABLE_SZ; i++) { GC_thread p; - for (p = GC_threads[i]; p != NULL; p = p -> next) { + for (p = GC_threads[i]; p != NULL; p = p -> tm.next) { if ((p -> flags & (FINISHED | DO_BLOCKING)) == 0 - && p -> stop_info.mach_thread != my_thread) - GC_thread_resume(p->stop_info.mach_thread); + && p -> mach_thread != my_thread) + GC_thread_resume(p -> mach_thread); } } |