summaryrefslogtreecommitdiff
path: root/darwin_stop_world.c
diff options
context:
space:
mode:
authorivmai <ivmai>2010-10-10 17:31:33 +0000
committerIvan Maidanski <ivmai@mail.ru>2011-07-26 21:06:55 +0400
commite14def4c718743dd1f7e5cf9075f48e8f3691110 (patch)
tree1e272c9eb3b7773a93709ae0c665f6b9c4078682 /darwin_stop_world.c
parente8b0c281fced017d9d7d2860e248e59eca130c75 (diff)
downloadbdwgc-e14def4c718743dd1f7e5cf9075f48e8f3691110.tar.gz
2010-10-10 Ivan Maidanski <ivmai@mail.ru>
* 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.
Diffstat (limited to 'darwin_stop_world.c')
-rw-r--r--darwin_stop_world.c27
1 files changed, 14 insertions, 13 deletions
diff --git a/darwin_stop_world.c b/darwin_stop_world.c
index 0124dc7b..0b6830f6 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 */