diff --git a/TODO.FACTOR.txt b/TODO.FACTOR.txt index 10418257aa..84793b3f91 100644 --- a/TODO.FACTOR.txt +++ b/TODO.FACTOR.txt @@ -11,7 +11,6 @@ ] - prettier printing of hashtable literals, alists, cond, ... - alien-indirect -- handle code heap exhaustion with a critical error - more compact relocation info - problem if major gc happens during relocation - in fact relocation should not cons at all diff --git a/vm/compiler.c b/vm/compiler.c index df0317eb45..bdd1490eba 100644 --- a/vm/compiler.c +++ b/vm/compiler.c @@ -225,6 +225,12 @@ CELL add_compiled_block(CELL code_format, F_VECTOR *code, CELL literal_length = untag_fixnum_fast(literals->top) * CELLS; CELL words_length = untag_fixnum_fast(words->top) * CELLS; + CELL total_length = sizeof(F_COMPILED) + code_length + rel_length + + literal_length + words_length; + + if(compiling.here + total_length >= compiling.limit) + critical_error("Code heap exhausted",compiling.limit); + /* compiled header */ F_COMPILED header; header.code_length = code_length;