void
ecl_init_env(cl_env_ptr env)
{
- char i;
-
env->c_env = NULL;
env->string_pool = Cnil;
env->indent_stack = ecl_alloc_atomic(ECL_PPRINT_INDENTATION_STACK_SIZE * sizeof(short));
env->fmt_aux_stream = ecl_make_string_output_stream(64, 1);
#endif
-#if !defined(GBC_BOEHM)
-# if defined(THREADS)
-# error "No means to mark the stack of a thread :-/"
-# else
- /* Rough estimate. Not very safe. We assume that cl_boot()
- * is invoked from the main() routine of the program.
- */
- env->cs_org = (char*)(&env);
-# endif /* THREADS */
-#endif /* !GBC_BOEHM */
-
#ifdef HAVE_LIBFFI
env->ffi_args_limit = 0;
env->ffi_types = 0;
#endif
env->pending_interrupt = Cnil;
- init_stacks(env, &i);
+ init_stacks(env);
{
int i;
*/
init_big();
ecl_init_env(env);
+ ecl_cs_set_org(env);
#if !defined(GBC_BOEHM)
/* We need this because a lot of stuff is to be created */
init_GC();
cs_set_size(env, size);
}
+void
+ecl_cs_set_org(cl_env_ptr env)
+{
+ /* Rough estimate. Not very safe. We assume that cl_boot()
+ * is invoked from the main() routine of the program.
+ */
+ env->cs_org = (char*)(&env);
+ env->cs_barrier = env->cs_org;
+#if defined(HAVE_SYS_RESOURCE_H) && defined(RLIMIT_STACK)
+ {
+ struct rlimit rl;
+ cl_index size;
+ getrlimit(RLIMIT_STACK, &rl);
+ if (rl.rlim_cur != RLIM_INFINITY) {
+ size = rl.rlim_cur / 2;
+ if (size > (cl_index)ecl_get_option(ECL_OPT_C_STACK_SIZE))
+ ecl_set_option(ECL_OPT_C_STACK_SIZE, size);
+#ifdef ECL_DOWN_STACK
+ env->cs_barrier = env->cs_org - rl.rlim_cur - 1024;
+#else
+ env->cs_barrier = env->cs_org + rl.rlim_cur + 1024;
+#endif
+ }
+ }
+#endif
+ cs_set_size(env, ecl_get_option(ECL_OPT_C_STACK_SIZE));
+}
+
/********************* BINDING STACK ************************/
}
void
-init_stacks(cl_env_ptr env, char *new_cs_org)
+init_stacks(cl_env_ptr env)
{
static struct ihs_frame ihs_org = { NULL, NULL, NULL, 0};
cl_index size, margin;
ihs_org.lex_env = Cnil;
ihs_org.index = 0;
- env->cs_org = new_cs_org;
- env->cs_barrier = new_cs_org;
-#if defined(HAVE_SYS_RESOURCE_H) && defined(RLIMIT_STACK)
- {
- struct rlimit rl;
- cl_index size;
- getrlimit(RLIMIT_STACK, &rl);
- if (rl.rlim_cur != RLIM_INFINITY) {
- size = rl.rlim_cur / 2;
- if (size > (cl_index)ecl_get_option(ECL_OPT_C_STACK_SIZE))
- ecl_set_option(ECL_OPT_C_STACK_SIZE, size);
-#ifdef ECL_DOWN_STACK
- env->cs_barrier = env->cs_org - rl.rlim_cur - 1024;
-#else
- env->cs_barrier = env->cs_org + rl.rlim_cur + 1024;
-#endif
- }
- }
-#endif
- cs_set_size(env, ecl_get_option(ECL_OPT_C_STACK_SIZE));
-
#if 0 /* defined(HAVE_SIGPROCMASK) && defined(SA_SIGINFO) && defined(SA_ONSTACK) */
if (ecl_get_option(ECL_OPT_SIGALTSTACK_SIZE)) {
stack_t new_stack;
extern void init_macros(void);
extern void init_number(void);
extern void init_read(void);
-extern void init_stacks(cl_env_ptr, char *);
+extern void init_stacks(cl_env_ptr);
extern void init_unixint(int pass);
extern void init_unixtime(void);
#ifdef mingw32