From 425335f57026e38b2228e4c754aedf1f1cf49e76 Mon Sep 17 00:00:00 2001 From: jjgarcia Date: Mon, 11 Jul 2005 12:27:54 +0000 Subject: [PATCH] Reduce the set of static roots by allocating the stacks with cl_alloc_atomic(). Ensure that the list of libraries is also marked as atomic, so as to allow garbage collection of FASL files --- src/c/interpreter.d | 2 +- src/c/load.d | 5 ++++- src/c/main.d | 2 +- src/c/stacks.d | 4 ++-- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/c/interpreter.d b/src/c/interpreter.d index 5f4c9179a..88b73fe89 100644 --- a/src/c/interpreter.d +++ b/src/c/interpreter.d @@ -37,7 +37,7 @@ cl_stack_set_size(cl_index new_size) start_critical_section(); - new_stack = (cl_object *)cl_alloc(new_size * sizeof(cl_object)); + new_stack = (cl_object *)cl_alloc_atomic(new_size * sizeof(cl_object)); memcpy(new_stack, cl_env.stack, cl_env.stack_size * sizeof(cl_object)); #ifdef BOEHM_GBC diff --git a/src/c/load.d b/src/c/load.d index ae0a217f5..9f9ea3682 100644 --- a/src/c/load.d +++ b/src/c/load.d @@ -76,7 +76,10 @@ ecl_library_open(cl_object filename) { if (libraries->vector.fillp == libraries->vector.dim) { cl_object nvector = cl_alloc_object(t_vector); nvector->vector = libraries->vector; - libraries->vector.dim *= 2; + if (libraries->vector.dim == 0) + libraries->vector.dim = 16; + else + libraries->vector.dim *= 2; libraries->vector.self.t = cl_alloc_atomic(libraries->vector.dim * sizeof(cl_object)); diff --git a/src/c/main.d b/src/c/main.d index d2018c092..01a7c04f8 100644 --- a/src/c/main.d +++ b/src/c/main.d @@ -285,7 +285,7 @@ cl_boot(int argc, char **argv) cl_core.gentemp_prefix = make_constant_string("T"); cl_core.gentemp_counter = MAKE_FIXNUM(0); - cl_core.libraries = si_make_vector(@'t', MAKE_FIXNUM(128), + cl_core.libraries = si_make_vector(@'t', MAKE_FIXNUM(0), @'nil', MAKE_FIXNUM(0), @'nil', @'nil'); diff --git a/src/c/stacks.d b/src/c/stacks.d index 0188e3ac3..e6ba2293d 100644 --- a/src/c/stacks.d +++ b/src/c/stacks.d @@ -403,11 +403,11 @@ init_stacks(int *new_cs_org) cl_index size; cl_env.frs_size = size = FRSSIZE + 2*FRSGETA; - cl_env.frs_org = (ecl_frame_ptr)cl_alloc(size * sizeof(*cl_env.frs_org)); + cl_env.frs_org = (ecl_frame_ptr)cl_alloc_atomic(size * sizeof(*cl_env.frs_org)); cl_env.frs_top = cl_env.frs_org-1; cl_env.frs_limit = &cl_env.frs_org[size - 2*FRSGETA]; cl_env.bds_size = size = BDSSIZE + 2*BDSGETA; - cl_env.bds_org = (bds_ptr)cl_alloc(size * sizeof(*cl_env.bds_org)); + cl_env.bds_org = (bds_ptr)cl_alloc_atomic(size * sizeof(*cl_env.bds_org)); cl_env.bds_top = cl_env.bds_org-1; cl_env.bds_limit = &cl_env.bds_org[size - 2*BDSGETA];