From 86c10c72afc6ac0750915749b9edd1dc519eea0d Mon Sep 17 00:00:00 2001 From: ivmai Date: Tue, 12 Oct 2010 05:46:27 +0000 Subject: [PATCH] 2010-10-12 Ivan Maidanski * darwin_stop_world.c (GC_push_all_stacks): Fix "my_task" local variable initialization (always call current_task()). * pthread_support.c (GC_thr_init, GC_register_my_thread_inner): Don't set thread's stop_info.stack_ptr value for Darwin. --- ChangeLog | 18 ++++++++++++++---- darwin_stop_world.c | 5 ++--- include/private/darwin_stop_world.h | 2 +- pthread_support.c | 6 ++++-- 4 files changed, 21 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6cfe39f8..af072bb0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2010-10-12 Ivan Maidanski + + * darwin_stop_world.c (GC_push_all_stacks): Fix "my_task" local + variable initialization (always call current_task()). + * pthread_support.c (GC_thr_init, GC_register_my_thread_inner): + Don't set thread's stop_info.stack_ptr value for Darwin. + 2010-10-10 Ivan Maidanski * darwin_stop_world.c (GC_push_all_stacks): Rename "r", "me" local @@ -3448,7 +3455,8 @@ * win32_threads.c (GC_Thread_Rep.tm_in_use, GC_attached_thread, DllMain): Don't define if GC_NO_DLLMAIN. * win32_threads.c (GC_stop_world): Declare "i" and "max" local - vars only if not GC_NO_DLLMAIN (to suppress compiler warning). + variables only if not GC_NO_DLLMAIN (to suppress compiler + warning). * win32_threads.c (GC_mark_thread, start_mark_threads): Use CreateThread() instead of _beginthreadex() for WinCE. * win32_threads.c (MARK_THREAD_STACK_SIZE, WINCE_MAIN_STACK_SIZE): @@ -3813,7 +3821,8 @@ (define as "strtoul" for most targets except for LLP64/Win64). * misc.c (GC_init_inner): Use STRTOULL instead of atoi/atol() (cast the result to word type) to decode values of "GC_TRACE", - "GC_INITIAL_HEAP_SIZE", "GC_MAXIMUM_HEAP_SIZE" environment vars. + "GC_INITIAL_HEAP_SIZE", "GC_MAXIMUM_HEAP_SIZE" environment + variables. 2009-06-12 Hans Boehm (Really mostly George Talbot) @@ -4350,7 +4359,7 @@ corresponding compiler warning. * ptr_chck.c (GC_is_visible): cast int const to word type to prevent left shift overflow. - * os_dep.c: change the type of GC_mem_top_down global var + * os_dep.c: change the type of GC_mem_top_down global variable (containing a flag) to DWORD. * include/gc_config_macros.h: define GC_SOLARIS_THREADS if GC_THREADS is defined on SunOS x86_64. @@ -4361,7 +4370,8 @@ * backgraph.c: cast GC_gc_no value to unsigned short when assigned/compared to height_gc_no field of back_edges. * os_dep.c (GC_remove_protection): Add ARGSUSED. - * win32_threads.c (GC_thread_exit_proc): Remove unused local var. + * win32_threads.c (GC_thread_exit_proc): Remove unused local + variable. * mark.c (GC_check_dirty): Move declaration out of func body. 2008-11-06 Hans Boehm diff --git a/darwin_stop_world.c b/darwin_stop_world.c index 0b6830f6..a915d5f7 100644 --- a/darwin_stop_world.c +++ b/darwin_stop_world.c @@ -102,12 +102,12 @@ GC_INNER void GC_push_all_stacks(void) int i; kern_return_t kern_return; ptr_t lo, hi; - word total_size = 0; + task_t my_task = current_task(); mach_port_t my_thread = mach_thread_self(); GC_bool found_me = FALSE; int nthreads = 0; + word total_size = 0; mach_msg_type_number_t listcount = (mach_msg_type_number_t)THREAD_TABLE_SZ; - task_t my_task = 0; /* initialized to prevent a warning */ thread_act_array_t act_list = 0; if (!GC_thr_initialized) @@ -115,7 +115,6 @@ GC_INNER void GC_push_all_stacks(void) if (GC_query_task_threads) { /* Obtain the list of the threads from the kernel. */ - my_task = current_task(); kern_return = task_threads(my_task, &act_list, &listcount); if (kern_return != KERN_SUCCESS) ABORT("task_threads failed"); diff --git a/include/private/darwin_stop_world.h b/include/private/darwin_stop_world.h index 787c357d..ee601144 100644 --- a/include/private/darwin_stop_world.h +++ b/include/private/darwin_stop_world.h @@ -27,7 +27,7 @@ struct thread_stop_info { mach_port_t mach_thread; - ptr_t stack_ptr; /* Valid only when stopped. */ + ptr_t stack_ptr; /* Valid only when thread is in a "blocked" state. */ }; #endif diff --git a/pthread_support.c b/pthread_support.c index f7da1727..c28afc8e 100644 --- a/pthread_support.c +++ b/pthread_support.c @@ -879,8 +879,9 @@ GC_INNER void GC_thr_init(void) GC_thread t = GC_new_thread(pthread_self()); # ifdef GC_DARWIN_THREADS t -> stop_info.mach_thread = mach_thread_self(); +# else + t -> stop_info.stack_ptr = (ptr_t)(&dummy); # endif - t -> stop_info.stack_ptr = (ptr_t)(&dummy); t -> flags = DETACHED | MAIN_THREAD; } @@ -1284,8 +1285,9 @@ STATIC GC_thread GC_register_my_thread_inner(const struct GC_stack_base *sb, ABORT("Failed to allocate memory for thread registering."); # ifdef GC_DARWIN_THREADS me -> stop_info.mach_thread = mach_thread_self(); +# else + me -> stop_info.stack_ptr = sb -> mem_base; # endif - me -> stop_info.stack_ptr = sb -> mem_base; me -> stack_end = sb -> mem_base; if (me -> stack_end == NULL) ABORT("Bad stack base in GC_register_my_thread"); -- 2.40.0