From: Alastair Bridgewater Date: Thu, 10 Nov 2011 20:37:40 +0000 (-0500) Subject: Move control-stack scavenging to gc-common.c. X-Git-Url: http://repo.macrolet.net/gitweb/?a=commitdiff_plain;h=aab1cd8a9dc69450a046d4f176ec5b9fde43c42c;p=sbcl.git Move control-stack scavenging to gc-common.c. * Instead of having slightly-divergent copies of the control stack scavenging logic for both GENCGC and CHENEYGC, move the GENCGC version (which is a separate function) to gc-common.c, and alter CHENEYGC to use it instead of doing its own thing inline. --- diff --git a/src/runtime/cheneygc.c b/src/runtime/cheneygc.c index 10b4d4a..a4c72a4 100644 --- a/src/runtime/cheneygc.c +++ b/src/runtime/cheneygc.c @@ -149,16 +149,10 @@ collect_garbage(generation_index_t ignore) scavenge((lispobj *) interrupt_handlers, sizeof(interrupt_handlers) / sizeof(lispobj)); - /* _size quantities are in units of sizeof(lispobj) - i.e. 4 */ - control_stack_size = - current_control_stack_pointer- - (lispobj *)th->control_stack_start; #ifdef PRINTNOISE - printf("Scavenging the control stack at %p (%ld words) ...\n", - ((lispobj *)th->control_stack_start), - control_stack_size); + printf("Scavenging the control stack ...\n"); #endif - scavenge(((lispobj *)th->control_stack_start), control_stack_size); + scavenge_control_stack(th); binding_stack_size = diff --git a/src/runtime/gc-common.c b/src/runtime/gc-common.c index 81ffae4..6c24c27 100644 --- a/src/runtime/gc-common.c +++ b/src/runtime/gc-common.c @@ -2780,6 +2780,17 @@ scrub_control_stack(void) #if !defined(LISP_FEATURE_X86) && !defined(LISP_FEATURE_X86_64) +void +scavenge_control_stack(struct thread *th) +{ + lispobj *control_stack = + (lispobj *)(th->control_stack_start); + unsigned long control_stack_size = + access_control_stack_pointer(th) - control_stack; + + scavenge(control_stack, control_stack_size); +} + /* Scavenging Interrupt Contexts */ static int boxed_registers[] = BOXED_REGISTERS; diff --git a/src/runtime/gc-internal.h b/src/runtime/gc-internal.h index 5439df9..3d0bfb7 100644 --- a/src/runtime/gc-internal.h +++ b/src/runtime/gc-internal.h @@ -132,6 +132,7 @@ lispobj *gc_search_space(lispobj *start, size_t words, lispobj *pointer); extern int looks_like_valid_lisp_pointer_p(lispobj pointer, lispobj *start_addr); +extern void scavenge_control_stack(struct thread *th); extern void scrub_control_stack(); #include "fixnump.h" diff --git a/src/runtime/gencgc.c b/src/runtime/gencgc.c index c143054..19e7683 100644 --- a/src/runtime/gencgc.c +++ b/src/runtime/gencgc.c @@ -3316,19 +3316,6 @@ write_protect_generation_pages(generation_index_t generation) } } -#if !defined(LISP_FEATURE_X86) && !defined(LISP_FEATURE_X86_64) -static void -scavenge_control_stack(struct thread *th) -{ - lispobj *control_stack = - (lispobj *)(th->control_stack_start); - unsigned long control_stack_size = - access_control_stack_pointer(th) - control_stack; - - scavenge(control_stack, control_stack_size); -} -#endif - #if defined(LISP_FEATURE_SB_THREAD) && (defined(LISP_FEATURE_X86) || defined(LISP_FEATURE_X86_64)) static void preserve_context_registers (os_context_t *c)