mirror of
https://gitlab.com/embeddable-common-lisp/ecl.git
synced 2025-12-06 02:40:26 -08:00
core: move the first environment initialization before symbols
Also split init_alloc in two passes like init_unixint, so we don't invoke directly GC_enable. The first pass leaves GC explicitly disabled.
This commit is contained in:
parent
0f4e9b1e17
commit
72af2d38b0
3 changed files with 39 additions and 31 deletions
|
|
@ -746,13 +746,13 @@ extern void (*GC_push_other_roots)();
|
|||
static void (*old_GC_push_other_roots)();
|
||||
static void stacks_scanner();
|
||||
|
||||
static int alloc_initialized = FALSE;
|
||||
|
||||
void
|
||||
init_alloc(void)
|
||||
init_alloc(int pass)
|
||||
{
|
||||
if (alloc_initialized) return;
|
||||
alloc_initialized = TRUE;
|
||||
if (pass == 1) {
|
||||
GC_enable();
|
||||
return;
|
||||
}
|
||||
/*
|
||||
* Garbage collector restrictions: we set up the garbage collector
|
||||
* library to work as follows
|
||||
|
|
@ -813,7 +813,6 @@ init_alloc(void)
|
|||
GC_set_java_finalization(1);
|
||||
GC_set_oom_fn(out_of_memory);
|
||||
GC_set_warn_proc(no_warnings);
|
||||
GC_enable();
|
||||
}
|
||||
|
||||
/**********************************************************
|
||||
|
|
|
|||
57
src/c/main.d
57
src/c/main.d
|
|
@ -189,6 +189,26 @@ init_env_aux(cl_env_ptr env)
|
|||
env->slot_cache = ecl_make_cache(3, 4096);
|
||||
}
|
||||
|
||||
void
|
||||
ecl_init_first_env(cl_env_ptr env)
|
||||
{
|
||||
#ifdef ECL_THREADS
|
||||
init_threads();
|
||||
#endif
|
||||
#ifdef ECL_THREADS
|
||||
env->bindings_array = si_make_vector(ECL_T, ecl_make_fixnum(1024),
|
||||
ECL_NIL, ECL_NIL, ECL_NIL, ECL_NIL);
|
||||
si_fill_array_with_elt(env->bindings_array, ECL_NO_TL_BINDING, ecl_make_fixnum(0), ECL_NIL);
|
||||
env->thread_local_bindings_size = env->bindings_array->vector.dim;
|
||||
env->thread_local_bindings = env->bindings_array->vector.self.t;
|
||||
#endif
|
||||
init_env_mp(env);
|
||||
init_env_int(env);
|
||||
init_env_aux(env);
|
||||
init_env_ffi(env);
|
||||
init_stacks(env);
|
||||
}
|
||||
|
||||
void
|
||||
ecl_init_env(cl_env_ptr env)
|
||||
{
|
||||
|
|
@ -490,12 +510,18 @@ cl_boot(int argc, char **argv)
|
|||
ecl_self = argv[0];
|
||||
|
||||
init_unixint(0);
|
||||
init_alloc();
|
||||
GC_disable();
|
||||
init_alloc(0);
|
||||
init_big();
|
||||
|
||||
/*
|
||||
* Initialize the per-thread data.
|
||||
* This cannot come later, because we need to be able to bind
|
||||
* ext::*interrupts-enabled* while creating packages.
|
||||
*/
|
||||
|
||||
env = cl_core.first_env;
|
||||
#ifdef ECL_THREADS
|
||||
init_threads();
|
||||
#endif
|
||||
ecl_init_first_env(env);
|
||||
ecl_cs_set_org(env);
|
||||
|
||||
/*
|
||||
* 1) Initialize symbols and packages
|
||||
|
|
@ -539,23 +565,6 @@ cl_boot(int argc, char **argv)
|
|||
cl_core.path_max = MAXPATHLEN;
|
||||
#endif
|
||||
|
||||
#ifdef ECL_THREADS
|
||||
env->bindings_array = si_make_vector(ECL_T, ecl_make_fixnum(1024),
|
||||
ECL_NIL, ECL_NIL, ECL_NIL, ECL_NIL);
|
||||
si_fill_array_with_elt(env->bindings_array, ECL_NO_TL_BINDING, ecl_make_fixnum(0), ECL_NIL);
|
||||
env->thread_local_bindings_size = env->bindings_array->vector.dim;
|
||||
env->thread_local_bindings = env->bindings_array->vector.self.t;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Initialize the per-thread data.
|
||||
* This cannot come later, because we need to be able to bind
|
||||
* ext::*interrupts-enabled* while creating packages.
|
||||
*/
|
||||
init_big();
|
||||
ecl_init_env(env);
|
||||
ecl_cs_set_org(env);
|
||||
|
||||
cl_core.lisp_package =
|
||||
ecl_make_package(str_common_lisp,
|
||||
cl_list(1, str_cl),
|
||||
|
|
@ -622,8 +631,8 @@ cl_boot(int argc, char **argv)
|
|||
/* These must come _after_ the packages and NIL/T have been created */
|
||||
init_all_symbols();
|
||||
|
||||
/* We need this because a lot of stuff is to be created */
|
||||
GC_enable();
|
||||
/* We need to enable GC because a lot of stuff is to be created */
|
||||
init_alloc(1);
|
||||
|
||||
/*
|
||||
* Set *default-pathname-defaults* to a temporary fake value. We
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ extern "C" {
|
|||
|
||||
/* booting */
|
||||
extern void init_all_symbols(void);
|
||||
extern void init_alloc(void);
|
||||
extern void init_alloc(int pass);
|
||||
extern void init_backq(void);
|
||||
extern void init_big();
|
||||
extern void init_clos(void);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue