mescc: Run module/base-0.mes.
* gc.c: New file.
* vector.c: New file.
* mes.c: Remove vector and gc functions, include vector.c, gc.c.
* GNUmakefile (mes.o): Add gc, vector dependencies.
* scaffold/mini-mes.c (eval_apply): Support primitive-load through
read_input_file.
(getenv_, open_input_file, current_input_port,
set_current_input_port force_output, exit_, values, arity_, xassq,
is_p, minus, plus, divide, modulo multiply, logior, ash): New function.
(mes_symbols): Add symbols %gnuc, %mesc.
* scaffold/mini-mes.c (): New functions.
* scaffold/b-0.mes: New file.
* scaffold/t-0.mes: New file.
2017-03-26 19:13:01 +00:00
|
|
|
/* -*-comment-start: "//";comment-end:""-*-
|
2018-07-22 12:24:36 +00:00
|
|
|
* GNU Mes --- Maxwell Equations of Software
|
2020-04-19 11:23:47 +00:00
|
|
|
* Copyright © 2016,2017,2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
|
mescc: Run module/base-0.mes.
* gc.c: New file.
* vector.c: New file.
* mes.c: Remove vector and gc functions, include vector.c, gc.c.
* GNUmakefile (mes.o): Add gc, vector dependencies.
* scaffold/mini-mes.c (eval_apply): Support primitive-load through
read_input_file.
(getenv_, open_input_file, current_input_port,
set_current_input_port force_output, exit_, values, arity_, xassq,
is_p, minus, plus, divide, modulo multiply, logior, ash): New function.
(mes_symbols): Add symbols %gnuc, %mesc.
* scaffold/mini-mes.c (): New functions.
* scaffold/b-0.mes: New file.
* scaffold/t-0.mes: New file.
2017-03-26 19:13:01 +00:00
|
|
|
*
|
2018-07-22 12:24:36 +00:00
|
|
|
* This file is part of GNU Mes.
|
mescc: Run module/base-0.mes.
* gc.c: New file.
* vector.c: New file.
* mes.c: Remove vector and gc functions, include vector.c, gc.c.
* GNUmakefile (mes.o): Add gc, vector dependencies.
* scaffold/mini-mes.c (eval_apply): Support primitive-load through
read_input_file.
(getenv_, open_input_file, current_input_port,
set_current_input_port force_output, exit_, values, arity_, xassq,
is_p, minus, plus, divide, modulo multiply, logior, ash): New function.
(mes_symbols): Add symbols %gnuc, %mesc.
* scaffold/mini-mes.c (): New functions.
* scaffold/b-0.mes: New file.
* scaffold/t-0.mes: New file.
2017-03-26 19:13:01 +00:00
|
|
|
*
|
2018-07-22 12:24:36 +00:00
|
|
|
* GNU Mes is free software; you can redistribute it and/or modify it
|
mescc: Run module/base-0.mes.
* gc.c: New file.
* vector.c: New file.
* mes.c: Remove vector and gc functions, include vector.c, gc.c.
* GNUmakefile (mes.o): Add gc, vector dependencies.
* scaffold/mini-mes.c (eval_apply): Support primitive-load through
read_input_file.
(getenv_, open_input_file, current_input_port,
set_current_input_port force_output, exit_, values, arity_, xassq,
is_p, minus, plus, divide, modulo multiply, logior, ash): New function.
(mes_symbols): Add symbols %gnuc, %mesc.
* scaffold/mini-mes.c (): New functions.
* scaffold/b-0.mes: New file.
* scaffold/t-0.mes: New file.
2017-03-26 19:13:01 +00:00
|
|
|
* under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 3 of the License, or (at
|
|
|
|
* your option) any later version.
|
|
|
|
*
|
2018-07-22 12:24:36 +00:00
|
|
|
* GNU Mes is distributed in the hope that it will be useful, but
|
mescc: Run module/base-0.mes.
* gc.c: New file.
* vector.c: New file.
* mes.c: Remove vector and gc functions, include vector.c, gc.c.
* GNUmakefile (mes.o): Add gc, vector dependencies.
* scaffold/mini-mes.c (eval_apply): Support primitive-load through
read_input_file.
(getenv_, open_input_file, current_input_port,
set_current_input_port force_output, exit_, values, arity_, xassq,
is_p, minus, plus, divide, modulo multiply, logior, ash): New function.
(mes_symbols): Add symbols %gnuc, %mesc.
* scaffold/mini-mes.c (): New functions.
* scaffold/b-0.mes: New file.
* scaffold/t-0.mes: New file.
2017-03-26 19:13:01 +00:00
|
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
2018-07-22 12:24:36 +00:00
|
|
|
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
|
mescc: Run module/base-0.mes.
* gc.c: New file.
* vector.c: New file.
* mes.c: Remove vector and gc functions, include vector.c, gc.c.
* GNUmakefile (mes.o): Add gc, vector dependencies.
* scaffold/mini-mes.c (eval_apply): Support primitive-load through
read_input_file.
(getenv_, open_input_file, current_input_port,
set_current_input_port force_output, exit_, values, arity_, xassq,
is_p, minus, plus, divide, modulo multiply, logior, ash): New function.
(mes_symbols): Add symbols %gnuc, %mesc.
* scaffold/mini-mes.c (): New functions.
* scaffold/b-0.mes: New file.
* scaffold/t-0.mes: New file.
2017-03-26 19:13:01 +00:00
|
|
|
*/
|
|
|
|
|
2019-06-08 13:36:22 +00:00
|
|
|
#include "mes/lib.h"
|
|
|
|
#include "mes/mes.h"
|
|
|
|
|
2017-05-02 21:30:46 +00:00
|
|
|
#include <errno.h>
|
2019-06-08 13:36:22 +00:00
|
|
|
#include <string.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
|
|
|
SCM
|
2020-04-19 11:23:47 +00:00
|
|
|
gc_init () /*:((internal)) */
|
2019-06-08 13:36:22 +00:00
|
|
|
{
|
|
|
|
#if SYSTEM_LIBC
|
2020-04-19 11:23:47 +00:00
|
|
|
ARENA_SIZE = 100000000; /* 2.3GiB */
|
2019-06-08 13:36:22 +00:00
|
|
|
#else
|
2020-04-19 11:23:47 +00:00
|
|
|
ARENA_SIZE = 300000; /* 32b: 3MiB, 64b: 6 MiB */
|
2019-06-08 13:36:22 +00:00
|
|
|
#endif
|
|
|
|
MAX_ARENA_SIZE = 100000000;
|
|
|
|
STACK_SIZE = 20000;
|
|
|
|
|
|
|
|
JAM_SIZE = 20000;
|
|
|
|
GC_SAFETY = 2000;
|
|
|
|
MAX_STRING = 524288;
|
|
|
|
|
|
|
|
char *p;
|
|
|
|
if (p = getenv ("MES_MAX_ARENA"))
|
|
|
|
MAX_ARENA_SIZE = atoi (p);
|
|
|
|
if (p = getenv ("MES_ARENA"))
|
|
|
|
ARENA_SIZE = atoi (p);
|
|
|
|
JAM_SIZE = ARENA_SIZE / 10;
|
|
|
|
if (p = getenv ("MES_JAM"))
|
|
|
|
JAM_SIZE = atoi (p);
|
|
|
|
GC_SAFETY = ARENA_SIZE / 100;
|
|
|
|
if (p = getenv ("MES_SAFETY"))
|
|
|
|
GC_SAFETY = atoi (p);
|
|
|
|
if (p = getenv ("MES_STACK"))
|
|
|
|
STACK_SIZE = atoi (p);
|
|
|
|
if (p = getenv ("MES_MAX_STRING"))
|
|
|
|
MAX_STRING = atoi (p);
|
|
|
|
|
|
|
|
long arena_bytes = (ARENA_SIZE + JAM_SIZE) * sizeof (struct scm);
|
|
|
|
void *a = malloc (arena_bytes + STACK_SIZE * sizeof (SCM));
|
2020-04-19 11:23:47 +00:00
|
|
|
g_cells = a;
|
|
|
|
g_stack_array = a + arena_bytes;
|
2019-06-08 13:36:22 +00:00
|
|
|
|
|
|
|
TYPE (0) = TVECTOR;
|
|
|
|
LENGTH (0) = 1000;
|
|
|
|
VECTOR (0) = 0;
|
2020-04-19 11:23:47 +00:00
|
|
|
g_cells = g_cells + 1;
|
2019-06-08 13:36:22 +00:00
|
|
|
TYPE (0) = TCHAR;
|
|
|
|
VALUE (0) = 'c';
|
|
|
|
|
2020-04-19 11:23:47 +00:00
|
|
|
/* FIXME: remove MES_MAX_STRING, grow dynamically */
|
|
|
|
g_buf = malloc (MAX_STRING);
|
2017-05-02 21:30:46 +00:00
|
|
|
|
2019-06-08 13:36:22 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
SCM
|
2020-04-19 11:23:47 +00:00
|
|
|
gc_init_news () /*:((internal)) */
|
2019-06-08 13:36:22 +00:00
|
|
|
{
|
|
|
|
g_news = g_cells + g_free;
|
|
|
|
NTYPE (0) = TVECTOR;
|
|
|
|
NLENGTH (0) = 1000;
|
|
|
|
NVECTOR (0) = 0;
|
2020-04-19 11:23:47 +00:00
|
|
|
g_news = g_news + 1;
|
2019-06-08 13:36:22 +00:00
|
|
|
NTYPE (0) = TCHAR;
|
|
|
|
NVALUE (0) = 'n';
|
|
|
|
return 0;
|
|
|
|
}
|
2018-11-11 15:25:36 +00:00
|
|
|
|
mescc: Run module/base-0.mes.
* gc.c: New file.
* vector.c: New file.
* mes.c: Remove vector and gc functions, include vector.c, gc.c.
* GNUmakefile (mes.o): Add gc, vector dependencies.
* scaffold/mini-mes.c (eval_apply): Support primitive-load through
read_input_file.
(getenv_, open_input_file, current_input_port,
set_current_input_port force_output, exit_, values, arity_, xassq,
is_p, minus, plus, divide, modulo multiply, logior, ash): New function.
(mes_symbols): Add symbols %gnuc, %mesc.
* scaffold/mini-mes.c (): New functions.
* scaffold/b-0.mes: New file.
* scaffold/t-0.mes: New file.
2017-03-26 19:13:01 +00:00
|
|
|
SCM
|
2020-04-19 11:23:47 +00:00
|
|
|
gc_up_arena () /*:((internal)) */
|
mescc: Run module/base-0.mes.
* gc.c: New file.
* vector.c: New file.
* mes.c: Remove vector and gc functions, include vector.c, gc.c.
* GNUmakefile (mes.o): Add gc, vector dependencies.
* scaffold/mini-mes.c (eval_apply): Support primitive-load through
read_input_file.
(getenv_, open_input_file, current_input_port,
set_current_input_port force_output, exit_, values, arity_, xassq,
is_p, minus, plus, divide, modulo multiply, logior, ash): New function.
(mes_symbols): Add symbols %gnuc, %mesc.
* scaffold/mini-mes.c (): New functions.
* scaffold/b-0.mes: New file.
* scaffold/t-0.mes: New file.
2017-03-26 19:13:01 +00:00
|
|
|
{
|
2019-05-18 11:27:42 +00:00
|
|
|
long old_arena_bytes = (ARENA_SIZE + JAM_SIZE) * sizeof (struct scm);
|
2018-04-25 06:35:05 +00:00
|
|
|
if (ARENA_SIZE >> 1 < MAX_ARENA_SIZE >> 2)
|
|
|
|
{
|
2020-04-19 11:23:47 +00:00
|
|
|
ARENA_SIZE = ARENA_SIZE << 1;
|
|
|
|
JAM_SIZE = JAM_SIZE << 1;
|
|
|
|
GC_SAFETY = GC_SAFETY << 1;
|
2018-04-25 06:35:05 +00:00
|
|
|
}
|
|
|
|
else
|
2019-05-18 11:27:42 +00:00
|
|
|
ARENA_SIZE = MAX_ARENA_SIZE - JAM_SIZE;
|
|
|
|
long arena_bytes = (ARENA_SIZE + JAM_SIZE) * sizeof (struct scm);
|
|
|
|
void *p = realloc (g_cells - 1, arena_bytes + STACK_SIZE * sizeof (SCM));
|
2020-04-19 11:23:47 +00:00
|
|
|
if (p == 0)
|
2018-04-14 06:15:49 +00:00
|
|
|
{
|
|
|
|
eputs ("realloc failed, g_free=");
|
|
|
|
eputs (itoa (g_free));
|
|
|
|
eputs (":");
|
|
|
|
eputs (itoa (ARENA_SIZE - g_free));
|
|
|
|
eputs ("\n");
|
2020-05-17 14:07:04 +00:00
|
|
|
assert_msg (0, "0");
|
2018-04-14 06:15:49 +00:00
|
|
|
exit (1);
|
|
|
|
}
|
2020-04-19 11:23:47 +00:00
|
|
|
g_cells = p;
|
2019-05-18 11:27:42 +00:00
|
|
|
memcpy (p + arena_bytes, p + old_arena_bytes, STACK_SIZE * sizeof (SCM));
|
2020-04-19 11:23:47 +00:00
|
|
|
g_cells = g_cells + 1;
|
2018-04-14 06:15:49 +00:00
|
|
|
|
core: Prepare gc.c for mescc, non-POSIX_SOURCE.
* mes.c (NLENGTH, NVALUE, NVECTOR): New macros.
(mes_builtins): Add comment on .i include order.
* module/language/c99/compiler.mes (mescc): Add define _POSIX_SOURCE=0.
* gc.c (gc_up_arena, gc_flip, gc_loop, gc)[!_POSIX_SOURCE]: Use eputs
rather than fprintf.
(gc_loop): Use CAR, TYPE, NVECTOR rather than .car, .type, .vector.
* gc.c (gc_up_arena)[!_POSIX_SOURCE]: Add non-POSIX mlib.c
implementation.
2017-03-26 13:55:12 +00:00
|
|
|
return 0;
|
mescc: Run module/base-0.mes.
* gc.c: New file.
* vector.c: New file.
* mes.c: Remove vector and gc functions, include vector.c, gc.c.
* GNUmakefile (mes.o): Add gc, vector dependencies.
* scaffold/mini-mes.c (eval_apply): Support primitive-load through
read_input_file.
(getenv_, open_input_file, current_input_port,
set_current_input_port force_output, exit_, values, arity_, xassq,
is_p, minus, plus, divide, modulo multiply, logior, ash): New function.
(mes_symbols): Add symbols %gnuc, %mesc.
* scaffold/mini-mes.c (): New functions.
* scaffold/b-0.mes: New file.
* scaffold/t-0.mes: New file.
2017-03-26 19:13:01 +00:00
|
|
|
}
|
|
|
|
|
2017-12-14 06:05:53 +00:00
|
|
|
void
|
2020-04-19 11:23:47 +00:00
|
|
|
gc_flip () /*:((internal)) */
|
mescc: Run module/base-0.mes.
* gc.c: New file.
* vector.c: New file.
* mes.c: Remove vector and gc functions, include vector.c, gc.c.
* GNUmakefile (mes.o): Add gc, vector dependencies.
* scaffold/mini-mes.c (eval_apply): Support primitive-load through
read_input_file.
(getenv_, open_input_file, current_input_port,
set_current_input_port force_output, exit_, values, arity_, xassq,
is_p, minus, plus, divide, modulo multiply, logior, ash): New function.
(mes_symbols): Add symbols %gnuc, %mesc.
* scaffold/mini-mes.c (): New functions.
* scaffold/b-0.mes: New file.
* scaffold/t-0.mes: New file.
2017-03-26 19:13:01 +00:00
|
|
|
{
|
2018-04-09 05:12:38 +00:00
|
|
|
if (g_debug > 2)
|
core: Prepare gc.c for mescc, non-POSIX_SOURCE.
* mes.c (NLENGTH, NVALUE, NVECTOR): New macros.
(mes_builtins): Add comment on .i include order.
* module/language/c99/compiler.mes (mescc): Add define _POSIX_SOURCE=0.
* gc.c (gc_up_arena, gc_flip, gc_loop, gc)[!_POSIX_SOURCE]: Use eputs
rather than fprintf.
(gc_loop): Use CAR, TYPE, NVECTOR rather than .car, .type, .vector.
* gc.c (gc_up_arena)[!_POSIX_SOURCE]: Add non-POSIX mlib.c
implementation.
2017-03-26 13:55:12 +00:00
|
|
|
{
|
2017-04-01 17:10:28 +00:00
|
|
|
eputs (";;; => jam[");
|
core: Prepare gc.c for mescc, non-POSIX_SOURCE.
* mes.c (NLENGTH, NVALUE, NVECTOR): New macros.
(mes_builtins): Add comment on .i include order.
* module/language/c99/compiler.mes (mescc): Add define _POSIX_SOURCE=0.
* gc.c (gc_up_arena, gc_flip, gc_loop, gc)[!_POSIX_SOURCE]: Use eputs
rather than fprintf.
(gc_loop): Use CAR, TYPE, NVECTOR rather than .car, .type, .vector.
* gc.c (gc_up_arena)[!_POSIX_SOURCE]: Add non-POSIX mlib.c
implementation.
2017-03-26 13:55:12 +00:00
|
|
|
eputs (itoa (g_free));
|
|
|
|
eputs ("]\n");
|
|
|
|
}
|
2018-04-25 06:35:05 +00:00
|
|
|
if (g_free > JAM_SIZE)
|
|
|
|
JAM_SIZE = g_free + g_free / 2;
|
2019-05-18 11:27:42 +00:00
|
|
|
memcpy (g_cells - 1, g_news - 1, (g_free + 2) * sizeof (struct scm));
|
mescc: Run module/base-0.mes.
* gc.c: New file.
* vector.c: New file.
* mes.c: Remove vector and gc functions, include vector.c, gc.c.
* GNUmakefile (mes.o): Add gc, vector dependencies.
* scaffold/mini-mes.c (eval_apply): Support primitive-load through
read_input_file.
(getenv_, open_input_file, current_input_port,
set_current_input_port force_output, exit_, values, arity_, xassq,
is_p, minus, plus, divide, modulo multiply, logior, ash): New function.
(mes_symbols): Add symbols %gnuc, %mesc.
* scaffold/mini-mes.c (): New functions.
* scaffold/b-0.mes: New file.
* scaffold/t-0.mes: New file.
2017-03-26 19:13:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
SCM
|
2020-04-19 11:23:47 +00:00
|
|
|
gc_copy (SCM old) /*:((internal)) */
|
mescc: Run module/base-0.mes.
* gc.c: New file.
* vector.c: New file.
* mes.c: Remove vector and gc functions, include vector.c, gc.c.
* GNUmakefile (mes.o): Add gc, vector dependencies.
* scaffold/mini-mes.c (eval_apply): Support primitive-load through
read_input_file.
(getenv_, open_input_file, current_input_port,
set_current_input_port force_output, exit_, values, arity_, xassq,
is_p, minus, plus, divide, modulo multiply, logior, ash): New function.
(mes_symbols): Add symbols %gnuc, %mesc.
* scaffold/mini-mes.c (): New functions.
* scaffold/b-0.mes: New file.
* scaffold/t-0.mes: New file.
2017-03-26 19:13:01 +00:00
|
|
|
{
|
2018-04-05 19:35:31 +00:00
|
|
|
if (TYPE (old) == TBROKEN_HEART)
|
2020-04-19 11:23:47 +00:00
|
|
|
return CAR (old);
|
|
|
|
SCM new = g_free;
|
|
|
|
g_free = g_free + 1;
|
mescc: Run module/base-0.mes.
* gc.c: New file.
* vector.c: New file.
* mes.c: Remove vector and gc functions, include vector.c, gc.c.
* GNUmakefile (mes.o): Add gc, vector dependencies.
* scaffold/mini-mes.c (eval_apply): Support primitive-load through
read_input_file.
(getenv_, open_input_file, current_input_port,
set_current_input_port force_output, exit_, values, arity_, xassq,
is_p, minus, plus, divide, modulo multiply, logior, ash): New function.
(mes_symbols): Add symbols %gnuc, %mesc.
* scaffold/mini-mes.c (): New functions.
* scaffold/b-0.mes: New file.
* scaffold/t-0.mes: New file.
2017-03-26 19:13:01 +00:00
|
|
|
g_news[new] = g_cells[old];
|
2019-05-18 11:27:42 +00:00
|
|
|
if (NTYPE (new) == TSTRUCT || NTYPE (new) == TVECTOR)
|
mescc: Run module/base-0.mes.
* gc.c: New file.
* vector.c: New file.
* mes.c: Remove vector and gc functions, include vector.c, gc.c.
* GNUmakefile (mes.o): Add gc, vector dependencies.
* scaffold/mini-mes.c (eval_apply): Support primitive-load through
read_input_file.
(getenv_, open_input_file, current_input_port,
set_current_input_port force_output, exit_, values, arity_, xassq,
is_p, minus, plus, divide, modulo multiply, logior, ash): New function.
(mes_symbols): Add symbols %gnuc, %mesc.
* scaffold/mini-mes.c (): New functions.
* scaffold/b-0.mes: New file.
* scaffold/t-0.mes: New file.
2017-03-26 19:13:01 +00:00
|
|
|
{
|
core: Prepare gc.c for mescc, non-POSIX_SOURCE.
* mes.c (NLENGTH, NVALUE, NVECTOR): New macros.
(mes_builtins): Add comment on .i include order.
* module/language/c99/compiler.mes (mescc): Add define _POSIX_SOURCE=0.
* gc.c (gc_up_arena, gc_flip, gc_loop, gc)[!_POSIX_SOURCE]: Use eputs
rather than fprintf.
(gc_loop): Use CAR, TYPE, NVECTOR rather than .car, .type, .vector.
* gc.c (gc_up_arena)[!_POSIX_SOURCE]: Add non-POSIX mlib.c
implementation.
2017-03-26 13:55:12 +00:00
|
|
|
NVECTOR (new) = g_free;
|
2020-04-19 11:23:47 +00:00
|
|
|
long i;
|
|
|
|
for (i = 0; i < LENGTH (old); i = i + 1)
|
|
|
|
{
|
|
|
|
g_news[g_free] = g_cells[VECTOR (old) + i];
|
|
|
|
g_free = g_free + 1;
|
|
|
|
}
|
mescc: Run module/base-0.mes.
* gc.c: New file.
* vector.c: New file.
* mes.c: Remove vector and gc functions, include vector.c, gc.c.
* GNUmakefile (mes.o): Add gc, vector dependencies.
* scaffold/mini-mes.c (eval_apply): Support primitive-load through
read_input_file.
(getenv_, open_input_file, current_input_port,
set_current_input_port force_output, exit_, values, arity_, xassq,
is_p, minus, plus, divide, modulo multiply, logior, ash): New function.
(mes_symbols): Add symbols %gnuc, %mesc.
* scaffold/mini-mes.c (): New functions.
* scaffold/b-0.mes: New file.
* scaffold/t-0.mes: New file.
2017-03-26 19:13:01 +00:00
|
|
|
}
|
2018-11-11 15:25:36 +00:00
|
|
|
else if (NTYPE (new) == TBYTES)
|
|
|
|
{
|
|
|
|
char const *src = CBYTES (old);
|
|
|
|
char *dest = NCBYTES (new);
|
|
|
|
size_t length = NLENGTH (new);
|
|
|
|
memcpy (dest, src, length + 1);
|
2020-04-19 11:23:47 +00:00
|
|
|
g_free = g_free + bytes_cells (length) - 1;
|
2018-11-11 15:25:36 +00:00
|
|
|
|
|
|
|
if (g_debug > 4)
|
|
|
|
{
|
2019-05-18 11:27:42 +00:00
|
|
|
eputs ("gc copy bytes: ");
|
|
|
|
eputs (src);
|
|
|
|
eputs ("\n");
|
|
|
|
eputs (" length: ");
|
|
|
|
eputs (itoa (LENGTH (old)));
|
|
|
|
eputs ("\n");
|
|
|
|
eputs (" nlength: ");
|
|
|
|
eputs (itoa (NLENGTH (new)));
|
|
|
|
eputs ("\n");
|
|
|
|
eputs (" ==> ");
|
|
|
|
eputs (dest);
|
|
|
|
eputs ("\n");
|
2018-11-11 15:25:36 +00:00
|
|
|
}
|
|
|
|
}
|
core: Prepare gc.c for mescc, non-POSIX_SOURCE.
* mes.c (NLENGTH, NVALUE, NVECTOR): New macros.
(mes_builtins): Add comment on .i include order.
* module/language/c99/compiler.mes (mescc): Add define _POSIX_SOURCE=0.
* gc.c (gc_up_arena, gc_flip, gc_loop, gc)[!_POSIX_SOURCE]: Use eputs
rather than fprintf.
(gc_loop): Use CAR, TYPE, NVECTOR rather than .car, .type, .vector.
* gc.c (gc_up_arena)[!_POSIX_SOURCE]: Add non-POSIX mlib.c
implementation.
2017-03-26 13:55:12 +00:00
|
|
|
TYPE (old) = TBROKEN_HEART;
|
|
|
|
CAR (old) = new;
|
mescc: Run module/base-0.mes.
* gc.c: New file.
* vector.c: New file.
* mes.c: Remove vector and gc functions, include vector.c, gc.c.
* GNUmakefile (mes.o): Add gc, vector dependencies.
* scaffold/mini-mes.c (eval_apply): Support primitive-load through
read_input_file.
(getenv_, open_input_file, current_input_port,
set_current_input_port force_output, exit_, values, arity_, xassq,
is_p, minus, plus, divide, modulo multiply, logior, ash): New function.
(mes_symbols): Add symbols %gnuc, %mesc.
* scaffold/mini-mes.c (): New functions.
* scaffold/b-0.mes: New file.
* scaffold/t-0.mes: New file.
2017-03-26 19:13:01 +00:00
|
|
|
return new;
|
|
|
|
}
|
|
|
|
|
|
|
|
SCM
|
2020-04-19 11:23:47 +00:00
|
|
|
gc_relocate_car (SCM new, SCM car) /*:((internal)) */
|
mescc: Run module/base-0.mes.
* gc.c: New file.
* vector.c: New file.
* mes.c: Remove vector and gc functions, include vector.c, gc.c.
* GNUmakefile (mes.o): Add gc, vector dependencies.
* scaffold/mini-mes.c (eval_apply): Support primitive-load through
read_input_file.
(getenv_, open_input_file, current_input_port,
set_current_input_port force_output, exit_, values, arity_, xassq,
is_p, minus, plus, divide, modulo multiply, logior, ash): New function.
(mes_symbols): Add symbols %gnuc, %mesc.
* scaffold/mini-mes.c (): New functions.
* scaffold/b-0.mes: New file.
* scaffold/t-0.mes: New file.
2017-03-26 19:13:01 +00:00
|
|
|
{
|
2020-04-19 11:23:47 +00:00
|
|
|
NCAR (new) = car;
|
mescc: Run module/base-0.mes.
* gc.c: New file.
* vector.c: New file.
* mes.c: Remove vector and gc functions, include vector.c, gc.c.
* GNUmakefile (mes.o): Add gc, vector dependencies.
* scaffold/mini-mes.c (eval_apply): Support primitive-load through
read_input_file.
(getenv_, open_input_file, current_input_port,
set_current_input_port force_output, exit_, values, arity_, xassq,
is_p, minus, plus, divide, modulo multiply, logior, ash): New function.
(mes_symbols): Add symbols %gnuc, %mesc.
* scaffold/mini-mes.c (): New functions.
* scaffold/b-0.mes: New file.
* scaffold/t-0.mes: New file.
2017-03-26 19:13:01 +00:00
|
|
|
return cell_unspecified;
|
|
|
|
}
|
|
|
|
|
|
|
|
SCM
|
2020-04-19 11:23:47 +00:00
|
|
|
gc_relocate_cdr (SCM new, SCM cdr) /*:((internal)) */
|
mescc: Run module/base-0.mes.
* gc.c: New file.
* vector.c: New file.
* mes.c: Remove vector and gc functions, include vector.c, gc.c.
* GNUmakefile (mes.o): Add gc, vector dependencies.
* scaffold/mini-mes.c (eval_apply): Support primitive-load through
read_input_file.
(getenv_, open_input_file, current_input_port,
set_current_input_port force_output, exit_, values, arity_, xassq,
is_p, minus, plus, divide, modulo multiply, logior, ash): New function.
(mes_symbols): Add symbols %gnuc, %mesc.
* scaffold/mini-mes.c (): New functions.
* scaffold/b-0.mes: New file.
* scaffold/t-0.mes: New file.
2017-03-26 19:13:01 +00:00
|
|
|
{
|
2020-04-19 11:23:47 +00:00
|
|
|
NCDR (new) = cdr;
|
mescc: Run module/base-0.mes.
* gc.c: New file.
* vector.c: New file.
* mes.c: Remove vector and gc functions, include vector.c, gc.c.
* GNUmakefile (mes.o): Add gc, vector dependencies.
* scaffold/mini-mes.c (eval_apply): Support primitive-load through
read_input_file.
(getenv_, open_input_file, current_input_port,
set_current_input_port force_output, exit_, values, arity_, xassq,
is_p, minus, plus, divide, modulo multiply, logior, ash): New function.
(mes_symbols): Add symbols %gnuc, %mesc.
* scaffold/mini-mes.c (): New functions.
* scaffold/b-0.mes: New file.
* scaffold/t-0.mes: New file.
2017-03-26 19:13:01 +00:00
|
|
|
return cell_unspecified;
|
|
|
|
}
|
|
|
|
|
2017-12-14 06:05:53 +00:00
|
|
|
void
|
2020-04-19 11:23:47 +00:00
|
|
|
gc_loop (SCM scan) /*:((internal)) */
|
mescc: Run module/base-0.mes.
* gc.c: New file.
* vector.c: New file.
* mes.c: Remove vector and gc functions, include vector.c, gc.c.
* GNUmakefile (mes.o): Add gc, vector dependencies.
* scaffold/mini-mes.c (eval_apply): Support primitive-load through
read_input_file.
(getenv_, open_input_file, current_input_port,
set_current_input_port force_output, exit_, values, arity_, xassq,
is_p, minus, plus, divide, modulo multiply, logior, ash): New function.
(mes_symbols): Add symbols %gnuc, %mesc.
* scaffold/mini-mes.c (): New functions.
* scaffold/b-0.mes: New file.
* scaffold/t-0.mes: New file.
2017-03-26 19:13:01 +00:00
|
|
|
{
|
2018-04-12 19:33:38 +00:00
|
|
|
SCM car;
|
|
|
|
SCM cdr;
|
mescc: Run module/base-0.mes.
* gc.c: New file.
* vector.c: New file.
* mes.c: Remove vector and gc functions, include vector.c, gc.c.
* GNUmakefile (mes.o): Add gc, vector dependencies.
* scaffold/mini-mes.c (eval_apply): Support primitive-load through
read_input_file.
(getenv_, open_input_file, current_input_port,
set_current_input_port force_output, exit_, values, arity_, xassq,
is_p, minus, plus, divide, modulo multiply, logior, ash): New function.
(mes_symbols): Add symbols %gnuc, %mesc.
* scaffold/mini-mes.c (): New functions.
* scaffold/b-0.mes: New file.
* scaffold/t-0.mes: New file.
2017-03-26 19:13:01 +00:00
|
|
|
while (scan < g_free)
|
|
|
|
{
|
2018-04-21 11:31:12 +00:00
|
|
|
if (NTYPE (scan) == TBROKEN_HEART)
|
2019-05-18 11:27:42 +00:00
|
|
|
error (cell_symbol_system_error, cstring_to_symbol ("gc"));
|
2020-04-19 11:23:47 +00:00
|
|
|
if (NTYPE (scan) == TMACRO || NTYPE (scan) == TPAIR || NTYPE (scan) == TREF || scan == 1 /* null */
|
2017-12-09 07:33:50 +00:00
|
|
|
|| NTYPE (scan) == TVARIABLE)
|
mescc: Run module/base-0.mes.
* gc.c: New file.
* vector.c: New file.
* mes.c: Remove vector and gc functions, include vector.c, gc.c.
* GNUmakefile (mes.o): Add gc, vector dependencies.
* scaffold/mini-mes.c (eval_apply): Support primitive-load through
read_input_file.
(getenv_, open_input_file, current_input_port,
set_current_input_port force_output, exit_, values, arity_, xassq,
is_p, minus, plus, divide, modulo multiply, logior, ash): New function.
(mes_symbols): Add symbols %gnuc, %mesc.
* scaffold/mini-mes.c (): New functions.
* scaffold/b-0.mes: New file.
* scaffold/t-0.mes: New file.
2017-03-26 19:13:01 +00:00
|
|
|
{
|
2020-04-19 11:23:47 +00:00
|
|
|
car = gc_copy (NCAR (scan));
|
mescc: Run module/base-0.mes.
* gc.c: New file.
* vector.c: New file.
* mes.c: Remove vector and gc functions, include vector.c, gc.c.
* GNUmakefile (mes.o): Add gc, vector dependencies.
* scaffold/mini-mes.c (eval_apply): Support primitive-load through
read_input_file.
(getenv_, open_input_file, current_input_port,
set_current_input_port force_output, exit_, values, arity_, xassq,
is_p, minus, plus, divide, modulo multiply, logior, ash): New function.
(mes_symbols): Add symbols %gnuc, %mesc.
* scaffold/mini-mes.c (): New functions.
* scaffold/b-0.mes: New file.
* scaffold/t-0.mes: New file.
2017-03-26 19:13:01 +00:00
|
|
|
gc_relocate_car (scan, car);
|
|
|
|
}
|
2020-04-19 11:23:47 +00:00
|
|
|
if ((NTYPE (scan) == TCLOSURE || NTYPE (scan) == TCONTINUATION || NTYPE (scan) == TKEYWORD || NTYPE (scan) == TMACRO || NTYPE (scan) == TPAIR || NTYPE (scan) == TPORT || NTYPE (scan) == TSPECIAL || NTYPE (scan) == TSTRING || NTYPE (scan) == TSYMBOL || scan == 1 /* null */
|
|
|
|
|| NTYPE (scan) == TVALUES)
|
|
|
|
&& NCDR (scan)) /* allow for 0 terminated list of symbols */
|
mescc: Run module/base-0.mes.
* gc.c: New file.
* vector.c: New file.
* mes.c: Remove vector and gc functions, include vector.c, gc.c.
* GNUmakefile (mes.o): Add gc, vector dependencies.
* scaffold/mini-mes.c (eval_apply): Support primitive-load through
read_input_file.
(getenv_, open_input_file, current_input_port,
set_current_input_port force_output, exit_, values, arity_, xassq,
is_p, minus, plus, divide, modulo multiply, logior, ash): New function.
(mes_symbols): Add symbols %gnuc, %mesc.
* scaffold/mini-mes.c (): New functions.
* scaffold/b-0.mes: New file.
* scaffold/t-0.mes: New file.
2017-03-26 19:13:01 +00:00
|
|
|
{
|
2020-04-19 11:23:47 +00:00
|
|
|
cdr = gc_copy (NCDR (scan));
|
mescc: Run module/base-0.mes.
* gc.c: New file.
* vector.c: New file.
* mes.c: Remove vector and gc functions, include vector.c, gc.c.
* GNUmakefile (mes.o): Add gc, vector dependencies.
* scaffold/mini-mes.c (eval_apply): Support primitive-load through
read_input_file.
(getenv_, open_input_file, current_input_port,
set_current_input_port force_output, exit_, values, arity_, xassq,
is_p, minus, plus, divide, modulo multiply, logior, ash): New function.
(mes_symbols): Add symbols %gnuc, %mesc.
* scaffold/mini-mes.c (): New functions.
* scaffold/b-0.mes: New file.
* scaffold/t-0.mes: New file.
2017-03-26 19:13:01 +00:00
|
|
|
gc_relocate_cdr (scan, cdr);
|
|
|
|
}
|
2018-11-11 15:25:36 +00:00
|
|
|
if (NTYPE (scan) == TBYTES)
|
2020-04-19 11:23:47 +00:00
|
|
|
scan = scan + bytes_cells (NLENGTH (scan)) - 1;
|
|
|
|
scan = scan + 1;
|
mescc: Run module/base-0.mes.
* gc.c: New file.
* vector.c: New file.
* mes.c: Remove vector and gc functions, include vector.c, gc.c.
* GNUmakefile (mes.o): Add gc, vector dependencies.
* scaffold/mini-mes.c (eval_apply): Support primitive-load through
read_input_file.
(getenv_, open_input_file, current_input_port,
set_current_input_port force_output, exit_, values, arity_, xassq,
is_p, minus, plus, divide, modulo multiply, logior, ash): New function.
(mes_symbols): Add symbols %gnuc, %mesc.
* scaffold/mini-mes.c (): New functions.
* scaffold/b-0.mes: New file.
* scaffold/t-0.mes: New file.
2017-03-26 19:13:01 +00:00
|
|
|
}
|
2017-12-14 06:05:53 +00:00
|
|
|
gc_flip ();
|
mescc: Run module/base-0.mes.
* gc.c: New file.
* vector.c: New file.
* mes.c: Remove vector and gc functions, include vector.c, gc.c.
* GNUmakefile (mes.o): Add gc, vector dependencies.
* scaffold/mini-mes.c (eval_apply): Support primitive-load through
read_input_file.
(getenv_, open_input_file, current_input_port,
set_current_input_port force_output, exit_, values, arity_, xassq,
is_p, minus, plus, divide, modulo multiply, logior, ash): New function.
(mes_symbols): Add symbols %gnuc, %mesc.
* scaffold/mini-mes.c (): New functions.
* scaffold/b-0.mes: New file.
* scaffold/t-0.mes: New file.
2017-03-26 19:13:01 +00:00
|
|
|
}
|
|
|
|
|
2017-04-01 21:00:50 +00:00
|
|
|
SCM
|
|
|
|
gc_check ()
|
|
|
|
{
|
|
|
|
if (g_free + GC_SAFETY > ARENA_SIZE)
|
2018-04-14 06:15:49 +00:00
|
|
|
gc ();
|
2017-04-01 21:00:50 +00:00
|
|
|
return cell_unspecified;
|
|
|
|
}
|
|
|
|
|
mescc: Run module/base-0.mes.
* gc.c: New file.
* vector.c: New file.
* mes.c: Remove vector and gc functions, include vector.c, gc.c.
* GNUmakefile (mes.o): Add gc, vector dependencies.
* scaffold/mini-mes.c (eval_apply): Support primitive-load through
read_input_file.
(getenv_, open_input_file, current_input_port,
set_current_input_port force_output, exit_, values, arity_, xassq,
is_p, minus, plus, divide, modulo multiply, logior, ash): New function.
(mes_symbols): Add symbols %gnuc, %mesc.
* scaffold/mini-mes.c (): New functions.
* scaffold/b-0.mes: New file.
* scaffold/t-0.mes: New file.
2017-03-26 19:13:01 +00:00
|
|
|
SCM
|
2020-04-19 11:23:47 +00:00
|
|
|
gc_ () /*:((internal)) */
|
mescc: Run module/base-0.mes.
* gc.c: New file.
* vector.c: New file.
* mes.c: Remove vector and gc functions, include vector.c, gc.c.
* GNUmakefile (mes.o): Add gc, vector dependencies.
* scaffold/mini-mes.c (eval_apply): Support primitive-load through
read_input_file.
(getenv_, open_input_file, current_input_port,
set_current_input_port force_output, exit_, values, arity_, xassq,
is_p, minus, plus, divide, modulo multiply, logior, ash): New function.
(mes_symbols): Add symbols %gnuc, %mesc.
* scaffold/mini-mes.c (): New functions.
* scaffold/b-0.mes: New file.
* scaffold/t-0.mes: New file.
2017-03-26 19:13:01 +00:00
|
|
|
{
|
2018-04-25 06:35:05 +00:00
|
|
|
gc_init_news ();
|
2018-04-09 05:12:38 +00:00
|
|
|
if (g_debug == 2)
|
2017-12-09 07:33:50 +00:00
|
|
|
eputs (".");
|
2018-04-09 05:12:38 +00:00
|
|
|
if (g_debug > 2)
|
core: Prepare gc.c for mescc, non-POSIX_SOURCE.
* mes.c (NLENGTH, NVALUE, NVECTOR): New macros.
(mes_builtins): Add comment on .i include order.
* module/language/c99/compiler.mes (mescc): Add define _POSIX_SOURCE=0.
* gc.c (gc_up_arena, gc_flip, gc_loop, gc)[!_POSIX_SOURCE]: Use eputs
rather than fprintf.
(gc_loop): Use CAR, TYPE, NVECTOR rather than .car, .type, .vector.
* gc.c (gc_up_arena)[!_POSIX_SOURCE]: Add non-POSIX mlib.c
implementation.
2017-03-26 13:55:12 +00:00
|
|
|
{
|
2017-04-01 17:10:28 +00:00
|
|
|
eputs (";;; gc[");
|
core: Prepare gc.c for mescc, non-POSIX_SOURCE.
* mes.c (NLENGTH, NVALUE, NVECTOR): New macros.
(mes_builtins): Add comment on .i include order.
* module/language/c99/compiler.mes (mescc): Add define _POSIX_SOURCE=0.
* gc.c (gc_up_arena, gc_flip, gc_loop, gc)[!_POSIX_SOURCE]: Use eputs
rather than fprintf.
(gc_loop): Use CAR, TYPE, NVECTOR rather than .car, .type, .vector.
* gc.c (gc_up_arena)[!_POSIX_SOURCE]: Add non-POSIX mlib.c
implementation.
2017-03-26 13:55:12 +00:00
|
|
|
eputs (itoa (g_free));
|
2017-04-01 17:10:28 +00:00
|
|
|
eputs (":");
|
|
|
|
eputs (itoa (ARENA_SIZE - g_free));
|
core: Prepare gc.c for mescc, non-POSIX_SOURCE.
* mes.c (NLENGTH, NVALUE, NVECTOR): New macros.
(mes_builtins): Add comment on .i include order.
* module/language/c99/compiler.mes (mescc): Add define _POSIX_SOURCE=0.
* gc.c (gc_up_arena, gc_flip, gc_loop, gc)[!_POSIX_SOURCE]: Use eputs
rather than fprintf.
(gc_loop): Use CAR, TYPE, NVECTOR rather than .car, .type, .vector.
* gc.c (gc_up_arena)[!_POSIX_SOURCE]: Add non-POSIX mlib.c
implementation.
2017-03-26 13:55:12 +00:00
|
|
|
eputs ("]...");
|
|
|
|
}
|
mescc: Run module/base-0.mes.
* gc.c: New file.
* vector.c: New file.
* mes.c: Remove vector and gc functions, include vector.c, gc.c.
* GNUmakefile (mes.o): Add gc, vector dependencies.
* scaffold/mini-mes.c (eval_apply): Support primitive-load through
read_input_file.
(getenv_, open_input_file, current_input_port,
set_current_input_port force_output, exit_, values, arity_, xassq,
is_p, minus, plus, divide, modulo multiply, logior, ash): New function.
(mes_symbols): Add symbols %gnuc, %mesc.
* scaffold/mini-mes.c (): New functions.
* scaffold/b-0.mes: New file.
* scaffold/t-0.mes: New file.
2017-03-26 19:13:01 +00:00
|
|
|
g_free = 1;
|
2018-04-14 06:15:49 +00:00
|
|
|
|
2018-04-29 10:04:18 +00:00
|
|
|
if (ARENA_SIZE < MAX_ARENA_SIZE && g_news > 0)
|
2018-04-14 06:15:49 +00:00
|
|
|
{
|
|
|
|
if (g_debug == 2)
|
|
|
|
eputs ("+");
|
|
|
|
if (g_debug > 2)
|
|
|
|
{
|
|
|
|
eputs (" up[");
|
2020-04-19 11:23:47 +00:00
|
|
|
eputs (itoa (g_cells));
|
2018-04-14 06:15:49 +00:00
|
|
|
eputs (",");
|
2020-04-19 11:23:47 +00:00
|
|
|
eputs (itoa (g_news));
|
2018-04-14 06:15:49 +00:00
|
|
|
eputs (":");
|
|
|
|
eputs (itoa (ARENA_SIZE));
|
|
|
|
eputs (",");
|
|
|
|
eputs (itoa (MAX_ARENA_SIZE));
|
|
|
|
eputs ("]...");
|
|
|
|
}
|
|
|
|
gc_up_arena ();
|
|
|
|
}
|
|
|
|
|
2020-04-19 11:23:47 +00:00
|
|
|
long i;
|
|
|
|
for (i = g_free; i < g_symbol_max; i = i + 1)
|
mescc: Run module/base-0.mes.
* gc.c: New file.
* vector.c: New file.
* mes.c: Remove vector and gc functions, include vector.c, gc.c.
* GNUmakefile (mes.o): Add gc, vector dependencies.
* scaffold/mini-mes.c (eval_apply): Support primitive-load through
read_input_file.
(getenv_, open_input_file, current_input_port,
set_current_input_port force_output, exit_, values, arity_, xassq,
is_p, minus, plus, divide, modulo multiply, logior, ash): New function.
(mes_symbols): Add symbols %gnuc, %mesc.
* scaffold/mini-mes.c (): New functions.
* scaffold/b-0.mes: New file.
* scaffold/t-0.mes: New file.
2017-03-26 19:13:01 +00:00
|
|
|
gc_copy (i);
|
|
|
|
g_symbols = gc_copy (g_symbols);
|
2017-12-09 07:33:50 +00:00
|
|
|
g_macros = gc_copy (g_macros);
|
2018-04-29 15:48:38 +00:00
|
|
|
g_ports = gc_copy (g_ports);
|
2020-05-17 20:32:53 +00:00
|
|
|
M0 = gc_copy (M0);
|
2020-04-19 11:23:47 +00:00
|
|
|
for (i = g_stack; i < STACK_SIZE; i = i + 1)
|
2019-05-18 11:27:42 +00:00
|
|
|
g_stack_array[i] = gc_copy (g_stack_array[i]);
|
2018-04-14 06:15:49 +00:00
|
|
|
gc_loop (1);
|
|
|
|
}
|
|
|
|
|
|
|
|
SCM
|
|
|
|
gc ()
|
|
|
|
{
|
2019-05-27 19:30:48 +00:00
|
|
|
if (g_debug > 5)
|
2018-04-14 06:15:49 +00:00
|
|
|
{
|
|
|
|
eputs ("symbols: ");
|
|
|
|
write_error_ (g_symbols);
|
|
|
|
eputs ("\n");
|
|
|
|
eputs ("R0: ");
|
2020-05-17 20:32:53 +00:00
|
|
|
write_error_ (R0);
|
2018-04-14 06:15:49 +00:00
|
|
|
eputs ("\n");
|
|
|
|
}
|
|
|
|
gc_push_frame ();
|
|
|
|
gc_ ();
|
|
|
|
gc_pop_frame ();
|
2019-05-27 19:30:48 +00:00
|
|
|
if (g_debug > 5)
|
2018-04-14 06:15:49 +00:00
|
|
|
{
|
|
|
|
eputs ("symbols: ");
|
|
|
|
write_error_ (g_symbols);
|
|
|
|
eputs ("\n");
|
|
|
|
eputs ("R0: ");
|
2020-05-17 20:32:53 +00:00
|
|
|
write_error_ (R0);
|
2018-04-14 06:15:49 +00:00
|
|
|
eputs ("\n");
|
|
|
|
}
|
mescc: Run module/base-0.mes.
* gc.c: New file.
* vector.c: New file.
* mes.c: Remove vector and gc functions, include vector.c, gc.c.
* GNUmakefile (mes.o): Add gc, vector dependencies.
* scaffold/mini-mes.c (eval_apply): Support primitive-load through
read_input_file.
(getenv_, open_input_file, current_input_port,
set_current_input_port force_output, exit_, values, arity_, xassq,
is_p, minus, plus, divide, modulo multiply, logior, ash): New function.
(mes_symbols): Add symbols %gnuc, %mesc.
* scaffold/mini-mes.c (): New functions.
* scaffold/b-0.mes: New file.
* scaffold/t-0.mes: New file.
2017-03-26 19:13:01 +00:00
|
|
|
}
|
2019-06-08 13:36:22 +00:00
|
|
|
|
|
|
|
SCM
|
2020-04-19 11:23:47 +00:00
|
|
|
gc_push_frame () /*:((internal)) */
|
2019-06-08 13:36:22 +00:00
|
|
|
{
|
|
|
|
if (g_stack < 5)
|
2020-05-17 14:07:04 +00:00
|
|
|
assert_msg (0, "STACK FULL");
|
2020-04-19 11:23:47 +00:00
|
|
|
g_stack_array[g_stack - 1] = cell_f;
|
2020-05-17 20:32:53 +00:00
|
|
|
g_stack_array[g_stack - 2] = R0;
|
|
|
|
g_stack_array[g_stack - 3] = R1;
|
|
|
|
g_stack_array[g_stack - 4] = R2;
|
|
|
|
g_stack_array[g_stack - 5] = R3;
|
2020-04-19 11:23:47 +00:00
|
|
|
g_stack = g_stack - 5;
|
2019-06-08 13:36:22 +00:00
|
|
|
return g_stack;
|
|
|
|
}
|
|
|
|
|
|
|
|
SCM
|
2020-04-19 11:23:47 +00:00
|
|
|
gc_peek_frame () /*:((internal)) */
|
2019-06-08 13:36:22 +00:00
|
|
|
{
|
2020-05-17 20:32:53 +00:00
|
|
|
R3 = g_stack_array[g_stack];
|
|
|
|
R2 = g_stack_array[g_stack + 1];
|
|
|
|
R1 = g_stack_array[g_stack + 2];
|
|
|
|
R0 = g_stack_array[g_stack + 3];
|
2019-06-08 13:36:22 +00:00
|
|
|
return g_stack_array[g_stack + FRAME_PROCEDURE];
|
|
|
|
}
|
|
|
|
|
|
|
|
SCM
|
2020-04-19 11:23:47 +00:00
|
|
|
gc_pop_frame () /*:((internal)) */
|
2019-06-08 13:36:22 +00:00
|
|
|
{
|
|
|
|
SCM x = gc_peek_frame ();
|
2020-04-19 11:23:47 +00:00
|
|
|
g_stack = g_stack + 5;
|
2019-06-08 13:36:22 +00:00
|
|
|
return x;
|
|
|
|
}
|