diff --git a/src/mzscheme/gc2/newgc.c b/src/mzscheme/gc2/newgc.c index db35dd7fb1..7d6ee0186f 100644 --- a/src/mzscheme/gc2/newgc.c +++ b/src/mzscheme/gc2/newgc.c @@ -1985,8 +1985,6 @@ long GC_get_memory_use(void *o) one that we export out, and it does a metric crapload of work. The second we use internally, and it doesn't do nearly as much. */ -void *watch_for; /* REMOVEME */ - /* This is the first mark routine. It's a bit complicated. */ void GC_mark(const void *const_p) { @@ -1998,10 +1996,6 @@ void GC_mark(const void *const_p) return; } - if (watch_for && (p == watch_for)) { - GCPRINT(GCOUTF, "Found it\n"); - } - if((page = find_page(p))) { /* toss this over to the BTC mark routine if we're doing accounting */ if(doing_memory_accounting) { memory_account_mark(page,p); return; } @@ -2409,7 +2403,7 @@ int GC_is_tagged(void *p) int GC_is_tagged_start(void *p) { - return 1; /* REMOVEME */ + return 0; } void *GC_next_tagged_start(void *p) diff --git a/src/mzscheme/src/schpriv.h b/src/mzscheme/src/schpriv.h index 6706c40c0c..2edee3afd7 100644 --- a/src/mzscheme/src/schpriv.h +++ b/src/mzscheme/src/schpriv.h @@ -358,7 +358,7 @@ extern int scheme_overflow_count; struct Scheme_Custodian { Scheme_Object so; - short shut_down; + char shut_down, has_limit; int count, alloc; Scheme_Object ***boxes; Scheme_Custodian_Reference **mrefs; diff --git a/src/mzscheme/src/thread.c b/src/mzscheme/src/thread.c index f74d81ab76..10a36bb24c 100644 --- a/src/mzscheme/src/thread.c +++ b/src/mzscheme/src/thread.c @@ -175,6 +175,7 @@ MZ_MARK_POS_TYPE scheme_current_cont_mark_pos; static Scheme_Custodian *main_custodian; static Scheme_Custodian *last_custodian; +static Scheme_Hash_Table *limited_custodians = NULL; /* On swap, put target in a static variable, instead of on the stack, so that the swapped-out thread is less likely to have a pointer @@ -935,6 +936,15 @@ static Scheme_Object *custodian_limit_mem(int argc, Scheme_Object *args[]) } } + if (!limited_custodians) + limited_custodians = scheme_make_hash_table(SCHEME_hash_ptr); + scheme_hash_set(limited_custodians, args[0], scheme_true); + ((Scheme_Custodian *)args[0])->has_limit = 1; + if (argc > 2) { + scheme_hash_set(limited_custodians, args[2], scheme_true); + ((Scheme_Custodian *)args[2])->has_limit = 1; + } + #ifdef MZ_PRECISE_GC if (GC_set_account_hook(MZACCT_LIMIT, args[0], lim, (argc > 2) ? args[2] : args[0])) return scheme_void; @@ -1423,6 +1433,10 @@ Scheme_Thread *scheme_do_close_managed(Scheme_Custodian *m, Scheme_Exit_Closer_F /* Remove this custodian from its parent */ adjust_custodian_family(m, m); + if (m->has_limit) { + scheme_hash_set(limited_custodians, (Scheme_Object *)m, NULL); + } + m = next_m; } @@ -6075,6 +6089,7 @@ static void make_initial_config(Scheme_Thread *p) REGISTER_SO(main_custodian); REGISTER_SO(last_custodian); + REGISTER_SO(limited_custodians); main_custodian = scheme_make_custodian(NULL); last_custodian = main_custodian; init_param(cells, paramz, MZCONFIG_CUSTODIAN, (Scheme_Object *)main_custodian);