From: ivmai Date: Sun, 10 Oct 2010 17:31:33 +0000 (+0000) Subject: 2010-10-10 Ivan Maidanski X-Git-Tag: gc7_2alpha5-20110107~16 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e14def4c718743dd1f7e5cf9075f48e8f3691110;p=platform%2Fupstream%2Flibgc.git 2010-10-10 Ivan Maidanski * darwin_stop_world.c (GC_push_all_stacks): Rename "r", "me" local variables to "kern_return" and "my_thread" ones, respectively; call mach_port_deallocate() unconditionally. * darwin_stop_world.c (GC_stop_world): Don't call mach_thread_self if DEBUG_THREADS. --- diff --git a/ChangeLog b/ChangeLog index 95836fa..6cfe39f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2010-10-10 Ivan Maidanski + + * darwin_stop_world.c (GC_push_all_stacks): Rename "r", "me" local + variables to "kern_return" and "my_thread" ones, respectively; + call mach_port_deallocate() unconditionally. + * darwin_stop_world.c (GC_stop_world): Don't call mach_thread_self + if DEBUG_THREADS. + 2010-10-09 Ivan Maidanski * darwin_stop_world.c (GC_mach_thread): Move from diff --git a/darwin_stop_world.c b/darwin_stop_world.c index 0124dc7..0b6830f 100644 --- a/darwin_stop_world.c +++ b/darwin_stop_world.c @@ -19,7 +19,7 @@ /* This probably needs more porting work to ppc64. */ -# if defined(GC_DARWIN_THREADS) +#if defined(GC_DARWIN_THREADS) /* From "Inside Mac OS X - Mach-O Runtime Architecture" published by Apple Page 49: @@ -100,10 +100,10 @@ GC_INNER ptr_t GC_FindTopOfStack(unsigned long stack_start) GC_INNER void GC_push_all_stacks(void) { int i; - kern_return_t r; + kern_return_t kern_return; ptr_t lo, hi; word total_size = 0; - mach_port_t me = mach_thread_self(); + mach_port_t my_thread = mach_thread_self(); GC_bool found_me = FALSE; int nthreads = 0; mach_msg_type_number_t listcount = (mach_msg_type_number_t)THREAD_TABLE_SZ; @@ -116,8 +116,8 @@ 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(); - r = task_threads(my_task, &act_list, &listcount); - if (r != KERN_SUCCESS) + kern_return = task_threads(my_task, &act_list, &listcount); + if (kern_return != KERN_SUCCESS) ABORT("task_threads failed"); } @@ -137,7 +137,7 @@ GC_INNER void GC_push_all_stacks(void) } nthreads++; - if (thread == me) { + if (thread == my_thread) { GC_ASSERT(!thread_blocked); lo = GC_approx_sp(); # ifndef DARWIN_DONT_PARSE_STACK @@ -159,12 +159,13 @@ GC_INNER void GC_push_all_stacks(void) GC_THREAD_STATE_T state; /* Get the thread state (registers, etc) */ - r = thread_get_state(thread, GC_MACH_THREAD_STATE, - (natural_t *)&state, &thread_state_count); + kern_return = thread_get_state(thread, GC_MACH_THREAD_STATE, + (natural_t *)&state, + &thread_state_count); # ifdef DEBUG_THREADS - GC_printf("thread_get_state return value = %d\n", r); + GC_printf("thread_get_state return value = %d\n", kern_return); # endif - if (r != KERN_SUCCESS) + if (kern_return != KERN_SUCCESS) ABORT("thread_get_state failed"); # if defined(I386) @@ -265,7 +266,7 @@ GC_INNER void GC_push_all_stacks(void) # else # error FIXME for non-x86 || ppc || arm architectures # endif - } /* thread != me */ + } /* thread != my_thread */ # ifdef DARWIN_DONT_PARSE_STACK /* p is non-NULL since GC_query_task_threads is FALSE */ @@ -286,10 +287,10 @@ GC_INNER void GC_push_all_stacks(void) } /* for (i=0; ...) */ if (GC_query_task_threads) { - mach_port_deallocate(my_task, me); vm_deallocate(my_task, (vm_address_t)act_list, sizeof(thread_t) * listcount); } + mach_port_deallocate(my_task, my_thread); if (GC_print_stats == VERBOSE) GC_log_printf("Pushed %d thread stacks\n", nthreads); @@ -445,7 +446,7 @@ GC_INNER void GC_stop_world(void) # ifdef DEBUG_THREADS GC_printf("Stopping the world from thread 0x%lx\n", - (unsigned long)mach_thread_self()); + (unsigned long)my_thread); # endif /* clear out the mach threads list table */