core: Fixes for garbage collector/jam scraper.

* src/gc.c (gc_loop): Do not relocate car of TCLOSURE, TCONTINUATION.
  Check for TBROKEN_HEART.
* src/mes.c (make_closure_): Set car to 0.
  (check_apply): Check for TBROKEN_HEART.  Fixes reporting artificial
  out-of-memory error.
  (eval_apply): Likewise.
* src/vector.c (vector_entry): Only copy TCHAR and TNUMBER.
This commit is contained in:
Jan Nieuwenhuizen 2018-04-21 13:31:12 +02:00
parent 0be441446e
commit 833fe991cb
No known key found for this signature in database
GPG Key ID: F3C1A0D9C1D65273
3 changed files with 11 additions and 5 deletions

View File

@ -96,9 +96,9 @@ gc_loop (SCM scan) ///((internal))
SCM cdr;
while (scan < g_free)
{
if (NTYPE (scan) == TCLOSURE
|| NTYPE (scan) == TCONTINUATION
|| NTYPE (scan) == TFUNCTION
if (NTYPE (scan) == TBROKEN_HEART)
error (cell_symbol_system_error, cell_gc);
if (NTYPE (scan) == TFUNCTION
|| NTYPE (scan) == TKEYWORD
|| NTYPE (scan) == TMACRO
|| NTYPE (scan) == TPAIR

View File

@ -579,6 +579,8 @@ check_apply (SCM f, SCM e) ///((internal))
type = "number";
if (TYPE (f) == TSTRING)
type = "string";
if (TYPE (f) == TBROKEN_HEART)
type = "<3";
if (type)
{
@ -771,7 +773,7 @@ call_lambda (SCM e, SCM x, SCM aa, SCM a) ///((internal))
SCM
make_closure_ (SCM args, SCM body, SCM a) ///((internal))
{
return make_cell__ (TCLOSURE, cell_f, cons (cons (cell_circular, a), cons (args, body)));
return make_cell__ (TCLOSURE, 0, cons (cons (cell_circular, a), cons (args, body)));
}
SCM
@ -1256,6 +1258,10 @@ eval_apply ()
r1 = CDR (VARIABLE (r1));
goto vm_return;
}
case TBROKEN_HEART:
{
error (cell_symbol_system_error, r1);
}
default: goto vm_return;
}

View File

@ -59,7 +59,7 @@ vector_ref (SCM x, SCM i)
SCM
vector_entry (SCM x)
{
if (TYPE (x) == TPAIR || TYPE (x) == TSPECIAL || TYPE (x) == TSTRING || TYPE (x) == TSYMBOL || TYPE (x) == TVECTOR)
if (TYPE (x) != TCHAR && TYPE (x) != TNUMBER)
x = MAKE_REF (x);
return x;
}