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'
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
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
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;
}
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<LENGTH (old); i++)
g_news[g_free++] = g_cells[VECTOR (old)+i];
}
- g_cells[old].type = TBROKEN_HEART;
- g_cells[old].car = new;
+ TYPE (old) = TBROKEN_HEART;
+ CAR (old) = new;
return new;
}
SCM
gc ()
{
+#if _POSIX_SOURCE
if (g_debug) fprintf (stderr, "***gc[%d]...", g_free);
+#else
+ if (g_debug)
+ {
+ eputs ("***gc[");
+ eputs (itoa (g_free));
+ eputs ("]...");
+ }
+#endif
g_free = 1;
if (g_cells < g_news && ARENA_SIZE < MAX_ARENA_SIZE) gc_up_arena ();
for (int i=g_free; i<g_symbol_max; i++)
make_tmps (g_news);
g_symbols = gc_copy (g_symbols);
SCM new = gc_copy (g_stack);
- if (g_debug) fprintf (stderr, "new=%d\n", new, g_stack);
+#if _POSIX_SOURCE
+ if (g_debug) fprintf (stderr, "new=%d\n", new);
+#else
+ if (g_debug)
+ {
+ eputs ("new=");
+ eputs (itoa (new));
+ eputs ("\n");
+ }
+#endif
g_stack = new;
return gc_loop (1);
}
#define VALUE(x) g_cells[x].value
#define VECTOR(x) g_cells[x].vector
#define FUNCTION(x) g_functions[g_cells[x].function]
-#define NCAR(x) g_news[x].car
+
#define NTYPE(x) g_news[x].type
+#define NCAR(x) g_news[x].car
+#define NLENGTH(x) g_news[x].length
+
+#define NCDR(x) g_news[x].cdr
+#define NVALUE(x) g_news[x].value
+#define NVECTOR(x) g_news[x].vector
+
+
#define CAAR(x) CAR (CAR (x))
#define CADR(x) CAR (CDR (x))
#define CDAR(x) CDR (CAR (x))
{
#include "mes.i"
+// Do not sort: Order of these includes define builtins
#include "posix.i"
#include "math.i"
#include "lib.i"