From 7015529bf56c31a3fbb73ab968fe421c05339a15 Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Tue, 13 Jun 2006 13:54:28 +0000 Subject: [PATCH] avoid wasted stack space for threads svn: r3346 --- src/mzscheme/src/jit.c | 12 +++++++----- src/mzscheme/src/setjmpup.c | 9 --------- src/mzscheme/src/thread.c | 7 +++++-- 3 files changed, 12 insertions(+), 16 deletions(-) diff --git a/src/mzscheme/src/jit.c b/src/mzscheme/src/jit.c index c550954a36..54226dbdaa 100644 --- a/src/mzscheme/src/jit.c +++ b/src/mzscheme/src/jit.c @@ -4835,11 +4835,13 @@ static int do_generate_closure(mz_jit_state *jitter, void *_data) code_end = jit_get_ip().ptr; - gdata->code = code; - gdata->tail_code = tail_code; - gdata->max_extra = jitter->max_extra_pushed; - gdata->max_depth = jitter->max_depth; - gdata->code_end = code_end; + if (jitter->retain_start) { + gdata->code = code; + gdata->tail_code = tail_code; + gdata->max_extra = jitter->max_extra_pushed; + gdata->max_depth = jitter->max_depth; + gdata->code_end = code_end; + } return 1; } diff --git a/src/mzscheme/src/setjmpup.c b/src/mzscheme/src/setjmpup.c index 9b874f427b..a4b4292225 100644 --- a/src/mzscheme/src/setjmpup.c +++ b/src/mzscheme/src/setjmpup.c @@ -38,10 +38,6 @@ #endif #endif -#ifdef memcpy -#undef memcpy -#endif - #ifdef MZ_PRECISE_GC void *(*scheme_get_external_stack_val)(void); void (*scheme_set_external_stack_val)(void *); @@ -245,11 +241,6 @@ END_XFORM_SKIP; /**********************************************************************/ -#define memcpy(dd, ss, ll) \ -{ stack_val *d, *s; long l; \ - l = ll / sizeof(stack_val); d = (stack_val *)dd; s = (stack_val *)ss; \ - while (l--) { *(d++) = *(s++);} } - #ifdef MZ_PRECISE_GC # define GC_VAR_STACK_ARG_DECL , void *gc_var_stack_in # define GC_VAR_STACK_ARG , __gc_var_stack__ diff --git a/src/mzscheme/src/thread.c b/src/mzscheme/src/thread.c index c93efc7fbe..8438fd6e10 100644 --- a/src/mzscheme/src/thread.c +++ b/src/mzscheme/src/thread.c @@ -2680,7 +2680,10 @@ static int is_stack_too_shallow2(void) return s[THREAD_STACK_SPACE]; } -static int is_stack_too_shallow(void) +int scheme_is_stack_too_shallow(void) +/* Make sure this function insn't inlined, mainly because + is_stack_too_shallow2() can get inlined, and it adds a lot + to the stack. */ { # include "mzstkchk.h" { @@ -2743,7 +2746,7 @@ Scheme_Object *scheme_thread_w_details(Scheme_Object *thunk, #ifdef DO_STACK_CHECK /* Make sure the thread starts out with a reasonable stack size, so it doesn't thrash right away: */ - if (is_stack_too_shallow()) { + if (scheme_is_stack_too_shallow()) { Scheme_Thread *p = scheme_current_thread; /* Don't mangle the stack if we're in atomic mode, because that