diff --git a/include/chibi/features.h b/include/chibi/features.h index f5f9cc89..aad53596 100644 --- a/include/chibi/features.h +++ b/include/chibi/features.h @@ -444,8 +444,12 @@ #define SEXP_INIT_BCODE_SIZE 128 #endif #ifndef SEXP_INIT_STACK_SIZE +#if SEXP_USE_CHECK_STACK +#define SEXP_INIT_STACK_SIZE 1024 +#else #define SEXP_INIT_STACK_SIZE 8192 #endif +#endif #ifndef SEXP_MAX_STACK_SIZE #define SEXP_MAX_STACK_SIZE SEXP_INIT_STACK_SIZE*1000 #endif diff --git a/vm.c b/vm.c index 5b760680..bac26447 100644 --- a/vm.c +++ b/vm.c @@ -482,24 +482,6 @@ static sexp make_opcode_procedure (sexp ctx, sexp op, sexp_uint_t i) { /*********************** the virtual machine **************************/ -static sexp sexp_save_stack (sexp ctx, sexp *stack, sexp_uint_t to) { - sexp res, *data; - sexp_uint_t i; - res = sexp_make_vector(ctx, sexp_make_fixnum(to), SEXP_VOID); - data = sexp_vector_data(res); - for (i=0; i= sexp_stack_length(sexp_context_stack(ctx))) + && !sexp_grow_stack(ctx)) + return sexp_global(ctx, SEXP_G_OOS_ERROR); +#endif + to = sexp_stack_data(sexp_context_stack(ctx)); + for (i=0; i