diff --git a/src/CHANGELOG b/src/CHANGELOG index 933777408..d2904f037 100644 --- a/src/CHANGELOG +++ b/src/CHANGELOG @@ -146,6 +146,10 @@ ECL 0.9i - The slot GENERIC-FUNCTION of a method is initially set to NIL instead of left unbound. + - The old conservative garbage collector works again. It now supports 64-bit + architectures, though the memory is still limited to 32Mb of lisp data. In + any case, this collector is only intended for small setups and OpenBSD. + * Documentation: - The HTML manuals now use CSS for a more appealing look. diff --git a/src/Makefile.in b/src/Makefile.in index 7aa5969cd..dfa4f8bc7 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -132,8 +132,10 @@ install-base: $(mkinstalldirs) $(DESTDIR)$(includedir)/ecl/gc/private sed '/-CUT-/,$$d' ./ecl/config.h > ./ecl/config-install.h $(INSTALL_DATA) ./ecl/*.h $(DESTDIR)$(includedir)/ecl - $(INSTALL_DATA) ./ecl/gc/*.h $(DESTDIR)$(includedir)/ecl/gc - $(INSTALL_DATA) ./ecl/gc/private/*.h $(DESTDIR)$(includedir)/ecl/gc/private + if (echo $(SUBDIRS) | grep gc); then \ + $(INSTALL_DATA) ./ecl/gc/*.h $(DESTDIR)$(includedir)/ecl/gc; \ + $(INSTALL_DATA) ./ecl/gc/private/*.h $(DESTDIR)$(includedir)/ecl/gc/private; \ + fi rm $(DESTDIR)$(includedir)/ecl/config.h mv $(DESTDIR)$(includedir)/ecl/config-install.h $(DESTDIR)$(includedir)/ecl/config.h $(INSTALL_SCRIPT) bin/ecl-config $(DESTDIR)$(bindir) diff --git a/src/c/alloc.d b/src/c/alloc.d index beac20b0f..f5e23b735 100644 --- a/src/c/alloc.d +++ b/src/c/alloc.d @@ -155,7 +155,7 @@ cl_resize_hole(cl_index n) holepage = 0; e = sbrk(n * LISP_PAGESIZE + (data_end - e)); } - if ((int)e < 0) + if ((cl_fixnum)e < 0) error("Can't allocate. Good-bye!"); data_end = e; holepage += n; @@ -604,6 +604,11 @@ init_tm(cl_type t, const char *name, cl_index elsize, cl_index maxpage) int i, j; struct typemanager *tm = &tm_table[(int)t]; + if (elsize < 2*sizeof(cl_index)) { + // A free list cell does not fit into this type + elsize = 2*sizeof(cl_index); + } + tm->tm_name = name; for (i = (int)t_start, j = i-1; i < (int)t_end; i++) if (tm_table[i].tm_size >= elsize && diff --git a/src/c/gbc.d b/src/c/gbc.d index 4a3258001..fd91e2667 100644 --- a/src/c/gbc.d +++ b/src/c/gbc.d @@ -375,6 +375,13 @@ BEGIN: mark_object(x->cblock.name); mark_object(x->cblock.next); mark_object(x->cblock.links); + p = x->cblock.temp_data; + if (p) { + i = x->cblock.temp_data_size; + mark_contblock(p, i * sizeof(cl_object)); + while (i-- > 0) + mark_object(p[i]); + } i = x->cblock.data_size; p = x->cblock.data; goto MARK_DATA; @@ -700,6 +707,8 @@ ecl_gc(cl_type t) if (!GC_enabled()) return; + GC_disable(); + CL_NEWENV_BEGIN { if (SYM_VAL(@'si::*gc-verbose*') != Cnil) { printf("\n[GC .."); @@ -745,7 +754,7 @@ ecl_gc(cl_type t) */ int mark_table_size = maxpage * (LISP_PAGESIZE / 32); extern void cl_resize_hole(cl_index); - + if (holepage < mark_table_size*sizeof(int)/LISP_PAGESIZE + 1) new_holepage = mark_table_size*sizeof(int)/LISP_PAGESIZE + 1; if (new_holepage < HOLEPAGE) @@ -785,7 +794,7 @@ ecl_gc(cl_type t) if (debug) printf("contblock sweep ended (%d)\n", ecl_runtime() - tm); } - + if (debug) { for (i = 0, j = 0; i < (int)t_end; i++) { if (tm_table[i].tm_type == (cl_type)i) { @@ -814,6 +823,8 @@ ecl_gc(cl_type t) } CL_NEWENV_END; + GC_enable(); + #ifdef THREADS #error "We need to activate all other threads again" #endif /* THREADS */ diff --git a/src/c/main.d b/src/c/main.d index 876a6c1c9..a40ff9ff0 100644 --- a/src/c/main.d +++ b/src/c/main.d @@ -244,12 +244,6 @@ cl_boot(int argc, char **argv) /* These must come _after_ the packages and NIL/T have been created */ init_all_symbols(); - GC_enable(); - -#if !defined(GBC_BOEHM) - /* We need this because a lot of stuff is to be created */ - init_GC(); -#endif /* * 2) Initialize constants (strings, numbers and time). @@ -306,6 +300,12 @@ cl_boot(int argc, char **argv) * frame stack immediately (for instance SI:PATHNAME-TRANSLATIONS). */ ecl_init_env(&cl_env); +#if !defined(GBC_BOEHM) + /* We need this because a lot of stuff is to be created */ + init_GC(); +#endif + GC_enable(); + #ifdef ECL_THREADS cl_env.bindings_hash = cl__make_hash_table(@'eq', MAKE_FIXNUM(1024), make_shortfloat(1.5f), diff --git a/src/c/read.d b/src/c/read.d index 8010b4176..2467d81df 100644 --- a/src/c/read.d +++ b/src/c/read.d @@ -1984,9 +1984,12 @@ read_VV(cl_object block, void (*entry_point)(cl_object)) #else VV = block->cblock.data; #endif + memset(VV, 0, perm_len * sizeof(*VV)); + if ((len == 0) || (block->cblock.data_text == 0)) goto NO_DATA_LABEL; - VVtemp = temp_len? (cl_object *)cl_alloc(temp_len * sizeof(cl_object)) : NULL; - block->cblock.temp_data = VVtemp; + + VVtemp = block->cblock.temp_data = temp_len? (cl_object *)cl_alloc(temp_len * sizeof(cl_object)) : NULL; + memset(VVtemp, 0, temp_len * sizeof(*VVtemp)); /* Read all data for the library */ in=ecl_make_string_input_stream(make_constant_string(block->cblock.data_text), diff --git a/src/h/config.h.in b/src/h/config.h.in index 1f8b17b7d..21321d173 100644 --- a/src/h/config.h.in +++ b/src/h/config.h.in @@ -236,7 +236,7 @@ typedef unsigned @CL_FIXNUM_TYPE@ cl_hashkey; * Memory limits for the old garbage collector. */ #define LISP_PAGESIZE 2048 /* Page size in bytes */ -#define MAXPAGE 16384 /* Maximum Memory Size */ +#define MAXPAGE 65536 /* Maximum Memory Size */ /* * The lisp environment has several stacks. These are their limits: