diff options
-rw-r--r-- | libguile/vm-engine.c | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/libguile/vm-engine.c b/libguile/vm-engine.c index 272370289..76c00d772 100644 --- a/libguile/vm-engine.c +++ b/libguile/vm-engine.c @@ -1586,15 +1586,24 @@ RTL_VM_NAME (SCM vm, SCM program, SCM *argv, size_t nargs_) SCM_UNPACK_RTL_24 (op, dst); nargs = FRAME_LOCALS_COUNT (); - while (nargs-- > dst) + if (nargs <= dst) { - rest = scm_cons (LOCAL_REF (nargs), rest); - LOCAL_SET (nargs, SCM_UNDEFINED); + ALLOC_FRAME (dst + 1); + while (nargs < dst) + LOCAL_SET (nargs++, SCM_UNDEFINED); } + else + { + while (nargs-- > dst) + { + rest = scm_cons (LOCAL_REF (nargs), rest); + LOCAL_SET (nargs, SCM_UNDEFINED); + } - LOCAL_SET (dst, rest); + RESET_FRAME (dst + 1); + } - RESET_FRAME (dst + 1); + LOCAL_SET (dst, rest); NEXT (1); } |