recovering gracefully from out-of-stack-space errors

This commit is contained in:
Alex Shinn 2009-12-12 17:29:54 +09:00
parent f4bb578d4d
commit 2ddafc2239
2 changed files with 6 additions and 3 deletions

6
eval.c
View file

@ -1313,8 +1313,10 @@ sexp sexp_vm (sexp ctx, sexp proc) {
goto make_call;
case OP_CALL:
#if USE_CHECK_STACK
if (top+16 >= SEXP_INIT_STACK_SIZE)
errx(70, "out of stack space at %ld", top);
if (top+16 >= SEXP_INIT_STACK_SIZE) {
_ARG1 = sexp_global(ctx, SEXP_G_OOS_ERROR);
goto end_loop;
}
#endif
i = sexp_unbox_fixnum(_WORD0);
tmp1 = _ARG1;

View file

@ -668,7 +668,8 @@ enum sexp_context_globals {
#if ! USE_GLOBAL_SYMBOLS
SEXP_G_SYMBOLS,
#endif
SEXP_G_OOM_ERROR,
SEXP_G_OOM_ERROR, /* out of memory exception object */
SEXP_G_OOS_ERROR, /* out of stack exception object */
SEXP_G_QUOTE_SYMBOL,
SEXP_G_QUASIQUOTE_SYMBOL,
SEXP_G_UNQUOTE_SYMBOL,