diff options
author | Zoltan Varga <vargaz@gmail.com> | 2012-05-22 03:02:05 +0400 |
---|---|---|
committer | Zoltan Varga <vargaz@gmail.com> | 2012-05-22 03:02:27 +0400 |
commit | e7f3bbad80fe04bea1a055e870d856a22003d34d (patch) | |
tree | 47331d7dc31f24c64a92516004cb249b4a2e85df /libgc/darwin_stop_world.c | |
parent | 9755d7fdb23c5bae33a85835083834fef57748ff (diff) |
Fix altstack support in libgc by registering the bounds of the normal stack and the altstack with it.
Diffstat (limited to 'libgc/darwin_stop_world.c')
-rw-r--r-- | libgc/darwin_stop_world.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/libgc/darwin_stop_world.c b/libgc/darwin_stop_world.c index 516b12c94c0..a1051f5ac4e 100644 --- a/libgc/darwin_stop_world.c +++ b/libgc/darwin_stop_world.c @@ -79,7 +79,7 @@ void GC_push_all_stacks() { kern_return_t r; GC_thread p; pthread_t me; - ptr_t lo, hi; + ptr_t lo, hi, altstack_lo, altstack_hi; #if defined(POWERPC) ppc_thread_state_t state; mach_msg_type_number_t thread_state_count = PPC_THREAD_STATE_COUNT; @@ -252,6 +252,16 @@ void GC_push_all_stacks() { hi = GC_stackbottom; else hi = p->stack_end; + + if (p->altstack && lo >= p->altstack && lo <= p->altstack + p->altstack_size) { + altstack_lo = lo; + altstack_hi = p->altstack + p->altstack_size; + lo = (char*)p->stack; + hi = (char*)p->stack + p->stack_size; + } else { + altstack_lo = NULL; + } + #if DEBUG_THREADS GC_printf3("Darwin: Stack for thread 0x%lx = [%lx,%lx)\n", (unsigned long) p -> id, @@ -259,7 +269,10 @@ void GC_push_all_stacks() { (unsigned long) hi ); #endif - GC_push_all_stack(lo,hi); + if (lo) + GC_push_all_stack(lo,hi); + if (altstack_lo) + GC_push_all_stack(altstack_lo,altstack_hi); } /* for(p=GC_threads[i]...) */ } /* for(i=0;i<THREAD_TABLE_SZ...) */ } |