diff --git a/src/c/mem_nogc.d b/src/c/mem_nogc.d new file mode 100644 index 000000000..f729ec421 --- /dev/null +++ b/src/c/mem_nogc.d @@ -0,0 +1,68 @@ +/* -*- Mode: C; c-basic-offset: 2; indent-tabs-mode: nil -*- */ +/* vim: set filetype=c tabstop=2 shiftwidth=2 expandtab: */ + +/* mem_nogc.d - this is a reference of what GC should minimally implement */ + +/* -- imports ---------------------------------------------------------------- */ + +#include +#include +#include +#include + +/* -- implementation --------------------------------------------------------- */ + +void _ecl_set_max_heap_size(size_t new_size) {} +void ecl_register_root(cl_object *p) {} +void ecl_set_finalizer_unprotected(cl_object o, cl_object f) {} + +cl_object +si_gc(cl_narg narg, ...) +{ + const cl_env_ptr the_env = ecl_process_env(); + ecl_return0(the_env); +} + +cl_object +si_get_finalizer(cl_object o) +{ + const cl_env_ptr the_env = ecl_process_env(); + ecl_return0(the_env); +} + +cl_object +si_set_finalizer(cl_object o, cl_object f) +{ + const cl_env_ptr the_env = ecl_process_env(); + ecl_return0(the_env); +} + +cl_object +si_make_weak_pointer(cl_object o) +{ + const cl_env_ptr the_env = ecl_process_env(); + ecl_return1(the_env, ECL_NIL); +} + +cl_object +si_weak_pointer_value(cl_object o) +{ + const cl_env_ptr the_env = ecl_process_env(); + ecl_return2(the_env, ECL_NIL, ECL_NIL); +} + +ecl_def_ct_base_string(str_gc, "NO-GC", 5, static, const); + +static struct ecl_module module_gc = { + .name = str_gc, + .create = ecl_module_no_op, + .enable = ecl_module_no_op, + .init_env = ecl_module_no_op_env, + .init_cpu = ecl_module_no_op_cpu, + .free_cpu = ecl_module_no_op_cpu, + .free_env = ecl_module_no_op_env, + .disable = ecl_module_no_op, + .destroy = ecl_module_no_op +}; + +cl_object ecl_module_gc = (cl_object)&module_gc; diff --git a/src/c/unixint.d b/src/c/unixint.d index 0ae2a53c0..dcb56a1bc 100644 --- a/src/c/unixint.d +++ b/src/c/unixint.d @@ -610,8 +610,10 @@ asynchronous_signal_servicing_thread() interrupt_signal = ecl_option_values[ECL_OPT_THREAD_INTERRUPT_SIGNAL]; sigdelset(&handled_set, interrupt_signal); +#ifdef GBC_BOEHM sigdelset(&handled_set, GC_get_suspend_signal()); sigdelset(&handled_set, GC_get_thr_restart_signal()); +#endif /* GBC_BOEHM */ sigdelset(&handled_set, SIGSEGV); sigdelset(&handled_set, SIGBUS); } diff --git a/src/configure b/src/configure index ed5309951..a50f3ed23 100755 --- a/src/configure +++ b/src/configure @@ -7214,7 +7214,7 @@ if test "${enable_threads}" = "yes" ; then as_fn_error $? "Threads aren't supported on this system." "$LINENO" 5 else LIBS="${THREAD_LIBS} ${LIBS}" - CFLAGS="${CFLAGS} ${THREAD_CFLAGS} -DGC_NO_THREAD_REDIRECTS" + CFLAGS="${CFLAGS} ${THREAD_CFLAGS}" ac_fn_c_check_func "$LINENO" "pthread_rwlock_init" "ac_cv_func_pthread_rwlock_init" if test "x$ac_cv_func_pthread_rwlock_init" = xyes @@ -7271,7 +7271,12 @@ else fi if test ${enable_boehm} = "no" ; then - as_fn_error $? "Boehm GC library is currently needed to build ECL" "$LINENO" 5; + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: Building ECL without Boehm GC library" >&5 +printf "%s\n" "$as_me: WARNING: Building ECL without Boehm GC library" >&2;}; + +LSP_FEATURES="${LSP_FEATURES} :dummy-gc" + + EXTRA_OBJS="${EXTRA_OBJS} mem_nogc.${OBJEXT}" else diff --git a/src/configure.ac b/src/configure.ac index 13bc956a1..eba80325a 100644 --- a/src/configure.ac +++ b/src/configure.ac @@ -602,7 +602,9 @@ fi dnl ---------------------------------------------------------------------- dnl Boehm-Weiser garbage collector if test ${enable_boehm} = "no" ; then - AC_MSG_ERROR([Boehm GC library is currently needed to build ECL]); + AC_MSG_WARN([Building ECL without Boehm GC library]); + ECL_ADD_FEATURE(dummy-gc) + EXTRA_OBJS="${EXTRA_OBJS} mem_nogc.${OBJEXT}" else ECL_BOEHM_GC ECL_ADD_FEATURE(boehm-gc) diff --git a/src/h/external.h b/src/h/external.h index 56c2a2d8a..b4e1f6dd3 100755 --- a/src/h/external.h +++ b/src/h/external.h @@ -798,14 +798,12 @@ extern ECL_API cl_object cl_format _ECL_ARGS((cl_narg narg, cl_object stream, cl #define GC_enabled() !GC_is_disabled() #define GC_enable() GC_enable() #define GC_disable() GC_disable() -extern ECL_API void ecl_register_root(cl_object *p); -extern ECL_API cl_object si_gc(cl_narg narg, ...); extern ECL_API cl_object si_gc_dump(void); extern ECL_API cl_object si_gc_stats(cl_object enable); -#else -# error "IMPLEMENT ME!" #endif /* GBC_BOEHM */ +extern ECL_API void ecl_register_root(cl_object *p); +extern ECL_API cl_object si_gc(cl_narg narg, ...); /* gfun.c */ diff --git a/src/h/internal.h b/src/h/internal.h index 90d4b41c0..573351dde 100755 --- a/src/h/internal.h +++ b/src/h/internal.h @@ -59,9 +59,7 @@ extern void _ecl_dealloc_env(cl_env_ptr); /* mem_bdwgc.d */ -#ifdef GBC_BOEHM #define ECL_COMPACT_OBJECT_EXTRA(x) ((void*)((x)->array.displaced)) -#endif extern void _ecl_set_max_heap_size(size_t new_size); extern cl_object ecl_alloc_bytecodes(cl_index data_size, cl_index code_size); extern cl_index ecl_object_byte_size(cl_type t); diff --git a/src/lsp/config.lsp.in b/src/lsp/config.lsp.in index cf10865b4..3f04ac6d0 100644 --- a/src/lsp/config.lsp.in +++ b/src/lsp/config.lsp.in @@ -109,14 +109,6 @@ Returns, as a string, the version of the software under which ECL runs." aux nil)))) -;; -;; * Set up some room -;; -#-boehm-gc -(progn - (sys::allocate 'CONS 200) - (sys::allocate 'BASE-STRING 40)) - ;; ;; * Set configuration pathnames. Notice the trailing slash! ;; Otherwise it would not be a directory.