1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-01 04:10:18 +02:00

Raise an exception upon VM stack overflows (fixes bug #29574).

* libguile/vm-engine.c (VM_NAME)[vm_error_stack_overflow]: Increase
  `vp->stack_limit' when possible.

* libguile/vm.c (VM_STACK_RESERVE_SIZE): New macro.

* test-suite/lib.scm (exception:vm-error): New variable.

* test-suite/tests/eval.test ("stack overflow"): New test prefix.
This commit is contained in:
Ludovic Courtès 2010-05-26 23:00:58 +02:00
parent 01fded8c77
commit f1046e6b78
4 changed files with 26 additions and 3 deletions

View file

@ -188,6 +188,10 @@ VM_NAME (SCM vm, SCM program, SCM *argv, int nargs)
vm_error_stack_overflow:
err_msg = scm_from_locale_string ("VM: Stack overflow");
finish_args = SCM_EOL;
if (stack_limit < vp->stack_base + vp->stack_size)
/* There are VM_STACK_RESERVE_SIZE bytes left. Make them available so
that `throw' below can run on this VM. */
vp->stack_limit = vp->stack_base + vp->stack_size;
goto vm_error;
vm_error_stack_underflow: