diff --git a/GNUmakefile b/GNUmakefile index ee72c6a3..3a2317db 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -98,6 +98,7 @@ module/mes/read-0.mo: module/mes/read-0.mes mes dump: module/mes/read-0.mo +mes-32: gc.c lib.c math.c posix.c vector.c mes-32: mes.c lib.c rm -f mes mes.o guix environment --system=i686-linux --ad-hoc gcc-toolchain -- bash -c 'make mes CC=i686-unknown-linux-gnu-gcc LIBRARY_PATH=$${PATH%%/bin:*}/lib' @@ -130,6 +131,7 @@ mescc-check: t-check mini-mes: mini-mes.h mini-mes.i mini-mes.environment.i mini-mes.symbols.i mini-mes: vector.c +mini-mes: gc.c mini-mes: mlibc.c mstart.c mini-mes: GNUmakefile mini-mes: module/mes/read-0-32.mo diff --git a/gc.c b/gc.c index d257541d..2f197eda 100644 --- a/gc.c +++ b/gc.c @@ -21,12 +21,29 @@ SCM gc_up_arena () ///((internal)) { +#if _POSIX_SOURCE ARENA_SIZE *= 2; void *p = realloc (g_cells-1, 2*ARENA_SIZE*sizeof(struct scm)); +#else + ARENA_SIZE = ARENA_SIZE * 2; + //p = realloc (g_cells-1, 2*ARENA_SIZE*sizeof(struct scm)); + int size = ARENA_SIZE * 2; + size = size * 12; + char *p = size; + p = realloc (g_cells-1, size); + g_cells = p; +#endif + +#if _POSIX_SOURCE if (!p) error (cell_symbol_system_error, cons (MAKE_STRING (cstring_to_list (strerror (errno))), MAKE_NUMBER (g_free))); g_cells = (struct scm*)p; g_cells++; +#else + //assert (p); + //g_cells = (struct scm*)p; +#endif gc_init_news (); + return 0; } SCM @@ -35,7 +52,16 @@ gc_flip () ///((internal)) struct scm *cells = g_cells; g_cells = g_news; g_news = cells; +#if _POSIX_SOURCE if (g_debug) fprintf (stderr, " => jam[%d]\n", g_free); +#else + if (g_debug) + { + eputs (" => jam["); + eputs (itoa (g_free)); + eputs ("]\n"); + } +#endif return g_stack; } @@ -47,12 +73,12 @@ gc_copy (SCM old) ///((internal)) g_news[new] = g_cells[old]; if (NTYPE (new) == TVECTOR) { - g_news[new].vector = g_free; + NVECTOR (new) = g_free; for (int i=0; i