From: ivmai Date: Tue, 8 Dec 2009 10:31:50 +0000 (+0000) Subject: 2009-12-08 Ivan Maidanski X-Git-Tag: gc7_2alpha5-20110107~84 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=197742f24da7b83431132559f8e306d5da5df8f0;p=gc 2009-12-08 Ivan Maidanski * darwin_stop_world.c (GC_push_all_stacks): Fix a bug (call GC_push_all_stack() instead of GC_push_all_stack_frames()). * include/private/gc_priv.h (GC_push_all_stack_frames, GC_push_all_register_frames): Rename to GC_push_all_stack_sections and GC_push_all_register_sections, respectively. * mark_rts.c (GC_push_all_stack_frames, GC_push_all_register_frames, GC_push_all_stack_part_eager_frames, GC_push_current_stack): Ditto. * pthread_stop_world.c (GC_push_all_stacks): Ditto. * win32_threads.c (GC_push_stack_for): Ditto. * misc.c (GC_call_with_gc_active): Rename "frame" local variable to "stacksect". * pthread_support.c (GC_call_with_gc_active): Ditto. * win32_threads.c (GC_call_with_gc_active): Ditto. * pthread_support.c (GC_call_with_gc_active): Update FIXME for Darwin. * win32_threads.c (GC_Thread_Rep): Update the comment for traced_stack_sect. --- diff --git a/ChangeLog b/ChangeLog index 799adb11..0e70cdea 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,25 @@ +2009-12-08 Ivan Maidanski + + * darwin_stop_world.c (GC_push_all_stacks): Fix a bug (call + GC_push_all_stack() instead of GC_push_all_stack_frames()). + * include/private/gc_priv.h (GC_push_all_stack_frames, + GC_push_all_register_frames): Rename to + GC_push_all_stack_sections and GC_push_all_register_sections, + respectively. + * mark_rts.c (GC_push_all_stack_frames, + GC_push_all_register_frames, GC_push_all_stack_part_eager_frames, + GC_push_current_stack): Ditto. + * pthread_stop_world.c (GC_push_all_stacks): Ditto. + * win32_threads.c (GC_push_stack_for): Ditto. + * misc.c (GC_call_with_gc_active): Rename "frame" local variable + to "stacksect". + * pthread_support.c (GC_call_with_gc_active): Ditto. + * win32_threads.c (GC_call_with_gc_active): Ditto. + * pthread_support.c (GC_call_with_gc_active): Update FIXME for + Darwin. + * win32_threads.c (GC_Thread_Rep): Update the comment for + traced_stack_sect. + 2009-12-08 Ivan Maidanski (really mostly Hans Boehm) * darwin_stop_world.c (GC_push_all_stacks): Rename diff --git a/darwin_stop_world.c b/darwin_stop_world.c index 3b4acb09..224a7895 100644 --- a/darwin_stop_world.c +++ b/darwin_stop_world.c @@ -177,7 +177,10 @@ GC_INNER void GC_push_all_stacks(void) GC_printf("Darwin: Stack for thread 0x%lx = [%p,%p)\n", (unsigned long) p -> id, lo, hi); # endif - GC_push_all_stack_frames(lo, hi, p -> traced_stack_sect); + /* FIXME: It is impossible to use GC_push_all_stack_sections() */ + /* here while GC_do_blocking_inner() and GC_call_with_gc_active() */ + /* contain unimplemented code for Darwin. */ + GC_push_all_stack(lo, hi); total_size += hi - lo; /* lo <= hi */ } /* for(p=GC_threads[i]...) */ } /* for(i=0;ibacking_store_end) cold_gc_bs_pointer = GC_traced_stack_sect->backing_store_end; - GC_push_all_register_frames(BACKING_STORE_BASE, + GC_push_all_register_sections(BACKING_STORE_BASE, cold_gc_bs_pointer, FALSE, GC_traced_stack_sect); GC_push_all_eager(cold_gc_bs_pointer, bsp); } else { - GC_push_all_register_frames(BACKING_STORE_BASE, bsp, + GC_push_all_register_sections(BACKING_STORE_BASE, bsp, TRUE /* eager */, GC_traced_stack_sect); } /* All values should be sufficiently aligned that we */ diff --git a/misc.c b/misc.c index 1c8d00ae..7fa58995 100644 --- a/misc.c +++ b/misc.c @@ -1487,43 +1487,43 @@ GC_INNER struct GC_traced_stack_sect_s *GC_traced_stack_sect = NULL; GC_API void * GC_CALL GC_call_with_gc_active(GC_fn_type fn, void * client_data) { - struct GC_traced_stack_sect_s frame; + struct GC_traced_stack_sect_s stacksect; GC_ASSERT(GC_is_initialized); /* Adjust our stack base value (this could happen if */ /* GC_get_main_stack_base() is unimplemented or broken for */ /* the platform). */ - if (GC_stackbottom HOTTER_THAN (ptr_t)(&frame)) - GC_stackbottom = (ptr_t)(&frame); + if (GC_stackbottom HOTTER_THAN (ptr_t)(&stacksect)) + GC_stackbottom = (ptr_t)(&stacksect); if (GC_blocked_sp == NULL) { /* We are not inside GC_do_blocking() - do nothing more. */ return fn(client_data); } - /* Setup new "frame". */ - frame.saved_stack_ptr = GC_blocked_sp; + /* Setup new "stack section". */ + stacksect.saved_stack_ptr = GC_blocked_sp; # ifdef IA64 /* This is the same as in GC_call_with_stack_base(). */ - frame.backing_store_end = GC_save_regs_in_stack(); + stacksect.backing_store_end = GC_save_regs_in_stack(); /* Unnecessarily flushes register stack, */ /* but that probably doesn't hurt. */ - frame.saved_backing_store_ptr = GC_blocked_register_sp; + stacksect.saved_backing_store_ptr = GC_blocked_register_sp; # endif - frame.prev = GC_traced_stack_sect; + stacksect.prev = GC_traced_stack_sect; GC_blocked_sp = NULL; - GC_traced_stack_sect = &frame; + GC_traced_stack_sect = &stacksect; client_data = fn(client_data); GC_ASSERT(GC_blocked_sp == NULL); - GC_ASSERT(GC_traced_stack_sect == &frame); + GC_ASSERT(GC_traced_stack_sect == &stacksect); - /* Restore original "frame". */ - GC_traced_stack_sect = frame.prev; + /* Restore original "stack section". */ + GC_traced_stack_sect = stacksect.prev; # ifdef IA64 - GC_blocked_register_sp = frame.saved_backing_store_ptr; + GC_blocked_register_sp = stacksect.saved_backing_store_ptr; # endif - GC_blocked_sp = frame.saved_stack_ptr; + GC_blocked_sp = stacksect.saved_stack_ptr; return client_data; /* result */ } diff --git a/pthread_stop_world.c b/pthread_stop_world.c index cde37124..cf9b8237 100644 --- a/pthread_stop_world.c +++ b/pthread_stop_world.c @@ -325,7 +325,7 @@ GC_INNER void GC_push_all_stacks(void) (unsigned)(p -> id), lo, hi); # endif if (0 == lo) ABORT("GC_push_all_stacks: sp not set!"); - GC_push_all_stack_frames(lo, hi, p -> traced_stack_sect); + GC_push_all_stack_sections(lo, hi, p -> traced_stack_sect); # ifdef STACK_GROWS_UP total_size += lo - hi; # else @@ -338,8 +338,9 @@ GC_INNER void GC_push_all_stacks(void) # endif /* FIXME: This (if p->id==me) may add an unbounded number of */ /* entries, and hence overflow the mark stack, which is bad. */ - GC_push_all_register_frames(bs_lo, bs_hi, THREAD_EQUAL(p -> id, me), - p -> traced_stack_sect); + GC_push_all_register_sections(bs_lo, bs_hi, + THREAD_EQUAL(p -> id, me), + p -> traced_stack_sect); total_size += bs_hi - bs_lo; /* bs_lo <= bs_hi */ # endif } diff --git a/pthread_support.c b/pthread_support.c index 741806fd..bb95e194 100644 --- a/pthread_support.c +++ b/pthread_support.c @@ -963,7 +963,7 @@ GC_INNER void GC_do_blocking_inner(ptr_t data, void * context) GC_API void * GC_CALL GC_call_with_gc_active(GC_fn_type fn, void * client_data) { - struct GC_traced_stack_sect_s frame; + struct GC_traced_stack_sect_s stacksect; GC_thread me; LOCK(); /* This will block if the world is stopped. */ me = GC_lookup_thread(pthread_self()); @@ -972,12 +972,12 @@ GC_API void * GC_CALL GC_call_with_gc_active(GC_fn_type fn, /* GC_get_stack_base() was used which returned GC_SUCCESS). */ if ((me -> flags & MAIN_THREAD) == 0) { GC_ASSERT(me -> stack_end != NULL); - if (me -> stack_end HOTTER_THAN (ptr_t)(&frame)) - me -> stack_end = (ptr_t)(&frame); + if (me -> stack_end HOTTER_THAN (ptr_t)(&stacksect)) + me -> stack_end = (ptr_t)(&stacksect); } else { /* The original stack. */ - if (GC_stackbottom HOTTER_THAN (ptr_t)(&frame)) - GC_stackbottom = (ptr_t)(&frame); + if (GC_stackbottom HOTTER_THAN (ptr_t)(&stacksect)) + GC_stackbottom = (ptr_t)(&stacksect); } if (me -> thread_blocked == FALSE) { @@ -986,37 +986,37 @@ GC_API void * GC_CALL GC_call_with_gc_active(GC_fn_type fn, return fn(client_data); } - /* Setup new "frame". */ + /* Setup new "stack section". */ # ifdef GC_DARWIN_THREADS - /* FIXME: Implement it for Darwin ("frames" are ignored at present). */ + /* FIXME: Implement it (and GC_do_blocking_inner) for Darwin. */ # else - frame.saved_stack_ptr = me -> stop_info.stack_ptr; + stacksect.saved_stack_ptr = me -> stop_info.stack_ptr; # endif # ifdef IA64 /* This is the same as in GC_call_with_stack_base(). */ - frame.backing_store_end = GC_save_regs_in_stack(); + stacksect.backing_store_end = GC_save_regs_in_stack(); /* Unnecessarily flushes register stack, */ /* but that probably doesn't hurt. */ - frame.saved_backing_store_ptr = me -> backing_store_ptr; + stacksect.saved_backing_store_ptr = me -> backing_store_ptr; # endif - frame.prev = me -> traced_stack_sect; + stacksect.prev = me -> traced_stack_sect; me -> thread_blocked = FALSE; - me -> traced_stack_sect = &frame; + me -> traced_stack_sect = &stacksect; UNLOCK(); client_data = fn(client_data); GC_ASSERT(me -> thread_blocked == FALSE); - GC_ASSERT(me -> traced_stack_sect == &frame); + GC_ASSERT(me -> traced_stack_sect == &stacksect); - /* Restore original "frame". */ + /* Restore original "stack section". */ LOCK(); - me -> traced_stack_sect = frame.prev; + me -> traced_stack_sect = stacksect.prev; # ifdef IA64 - me -> backing_store_ptr = frame.saved_backing_store_ptr; + me -> backing_store_ptr = stacksect.saved_backing_store_ptr; # endif me -> thread_blocked = TRUE; # ifndef GC_DARWIN_THREADS - me -> stop_info.stack_ptr = frame.saved_stack_ptr; + me -> stop_info.stack_ptr = stacksect.saved_stack_ptr; # endif UNLOCK(); diff --git a/win32_threads.c b/win32_threads.c index bd988c3a..82d1d539 100644 --- a/win32_threads.c +++ b/win32_threads.c @@ -219,9 +219,10 @@ struct GC_Thread_Rep { /* not need to stop this thread. */ struct GC_traced_stack_sect_s *traced_stack_sect; - /* Points to the "frame" data held in stack by */ - /* the innermost GC_call_with_gc_active() of */ - /* this thread. May be NULL. */ + /* Points to the "stack section" data */ + /* held in stack by the innermost */ + /* GC_call_with_gc_active() of this */ + /* thread. May be NULL. */ unsigned finalizer_nested; unsigned finalizer_skipped; /* Used by GC_check_finalizer_nested() */ @@ -776,7 +777,7 @@ GC_INNER void GC_do_blocking_inner(ptr_t data, void * context) GC_API void * GC_CALL GC_call_with_gc_active(GC_fn_type fn, void * client_data) { - struct GC_traced_stack_sect_s frame; + struct GC_traced_stack_sect_s stacksect; GC_thread me; LOCK(); /* This will block if the world is stopped. */ me = GC_lookup_thread_inner(GetCurrentThreadId()); @@ -784,8 +785,8 @@ GC_API void * GC_CALL GC_call_with_gc_active(GC_fn_type fn, /* Adjust our stack base value (this could happen unless */ /* GC_get_stack_base() was used which returned GC_SUCCESS). */ GC_ASSERT(me -> stack_base != NULL); - if (me -> stack_base < (ptr_t)(&frame)) - me -> stack_base = (ptr_t)(&frame); + if (me -> stack_base < (ptr_t)(&stacksect)) + me -> stack_base = (ptr_t)(&stacksect); if (me -> thread_blocked_sp == NULL) { /* We are not inside GC_do_blocking() - do nothing more. */ @@ -793,31 +794,31 @@ GC_API void * GC_CALL GC_call_with_gc_active(GC_fn_type fn, return fn(client_data); } - /* Setup new "frame". */ - frame.saved_stack_ptr = me -> thread_blocked_sp; + /* Setup new "stack section". */ + stacksect.saved_stack_ptr = me -> thread_blocked_sp; # ifdef IA64 /* This is the same as in GC_call_with_stack_base(). */ - frame.backing_store_end = GC_save_regs_in_stack(); + stacksect.backing_store_end = GC_save_regs_in_stack(); /* Unnecessarily flushes register stack, */ /* but that probably doesn't hurt. */ - frame.saved_backing_store_ptr = me -> backing_store_ptr; + stacksect.saved_backing_store_ptr = me -> backing_store_ptr; # endif - frame.prev = me -> traced_stack_sect; + stacksect.prev = me -> traced_stack_sect; me -> thread_blocked_sp = NULL; - me -> traced_stack_sect = &frame; + me -> traced_stack_sect = &stacksect; UNLOCK(); client_data = fn(client_data); GC_ASSERT(me -> thread_blocked_sp == NULL); - GC_ASSERT(me -> traced_stack_sect == &frame); + GC_ASSERT(me -> traced_stack_sect == &stacksect); - /* Restore original "frame". */ + /* Restore original "stack section". */ LOCK(); - me -> traced_stack_sect = frame.prev; + me -> traced_stack_sect = stacksect.prev; # ifdef IA64 - me -> backing_store_ptr = frame.saved_backing_store_ptr; + me -> backing_store_ptr = stacksect.saved_backing_store_ptr; # endif - me -> thread_blocked_sp = frame.saved_stack_ptr; + me -> thread_blocked_sp = stacksect.saved_stack_ptr; UNLOCK(); return client_data; /* result */ @@ -1257,7 +1258,7 @@ STATIC word GC_push_stack_for(GC_thread thread, DWORD me) GC_printf("Pushing stack for 0x%x from sp %p to %p from 0x%x\n", (int)thread -> id, sp, thread -> stack_base, (int)me); # endif - GC_push_all_stack_frames(sp, thread->stack_base, traced_stack_sect); + GC_push_all_stack_sections(sp, thread->stack_base, traced_stack_sect); } else { /* If not current thread then it is possible for sp to point to */ /* the guarded (untouched yet) page just below the current */