diff options
author | Andy Wingo <wingo@pobox.com> | 2019-06-06 17:39:53 +0200 |
---|---|---|
committer | Andy Wingo <wingo@pobox.com> | 2019-06-06 17:39:53 +0200 |
commit | f07fadc72e148d13bb4b42a3d9ecde6ab7a2296c (patch) | |
tree | a63fdbad6a8e8d007ff4f0f44d0586dc3caf2a1a /libguile/vm-engine.c | |
parent | c86758c298fdd06456939d16d604f9ff9a6c7b10 (diff) | |
download | guile-f07fadc72e148d13bb4b42a3d9ecde6ab7a2296c.tar.gz |
VM does not initialize stack frames
* libguile/jit.c (compile_alloc_frame): Stop initializing locals.
(compile_bind_rest): Use emit_alloc_frame.
* libguile/vm-engine.c (assert_nargs_ee_locals, allocate_frame): Don't
initialize locals.
(bind_rest): Don't initialize locals, and assert that the locals count
has a minimum.
Diffstat (limited to 'libguile/vm-engine.c')
-rw-r--r-- | libguile/vm-engine.c | 27 |
1 files changed, 8 insertions, 19 deletions
diff --git a/libguile/vm-engine.c b/libguile/vm-engine.c index a2e4be57a..5596dab02 100644 --- a/libguile/vm-engine.c +++ b/libguile/vm-engine.c @@ -649,8 +649,6 @@ VM_NAME (scm_thread *thread) VM_ASSERT (FRAME_LOCALS_COUNT () == expected, CALL_INTRINSIC (error_wrong_num_args, (thread))); ALLOC_FRAME (expected + nlocals); - while (nlocals--) - SP_SET (nlocals, SCM_UNDEFINED); NEXT (1); } @@ -773,53 +771,44 @@ VM_NAME (scm_thread *thread) VM_DEFINE_OP (17, bind_rest, "bind-rest", DOP1 (X8_F24)) { uint32_t dst, nargs; - SCM rest = SCM_EOL; UNPACK_24 (op, dst); nargs = FRAME_LOCALS_COUNT (); if (nargs <= dst) { + VM_ASSERT (nargs == dst, abort ()); ALLOC_FRAME (dst + 1); - while (nargs < dst) - FP_SET (nargs++, SCM_UNDEFINED); + SP_SET (0, SCM_EOL); } else { SYNC_IP (); - rest = CALL_INTRINSIC (cons_rest, (thread, dst)); + SCM rest = CALL_INTRINSIC (cons_rest, (thread, dst)); RESET_FRAME (dst + 1); + SP_SET (0, rest); } - FP_SET (dst, rest); - NEXT (1); } /* alloc-frame nlocals:24 * * Ensure that there is space on the stack for NLOCALS local variables. - * setting any new stack slots to SCM_UNDEFINED. */ VM_DEFINE_OP (18, alloc_frame, "alloc-frame", OP1 (X8_C24)) { - uint32_t nlocals, nargs; + uint32_t nlocals; UNPACK_24 (op, nlocals); - - nargs = FRAME_LOCALS_COUNT (); ALLOC_FRAME (nlocals); - while (nlocals-- > nargs) - FP_SET (nlocals, SCM_UNDEFINED); - NEXT (1); } /* reset-frame nlocals:24 * - * Like alloc-frame, but doesn't check that the stack is big enough, - * and doesn't reset stack slots to SCM_UNDEFINED. Used to reset the - * frame size to something less than the size that was previously set - * via alloc-frame. + * Like alloc-frame, but doesn't check that the stack is big enough. + * Used to reset the frame size to something less than the size that + * was previously set via alloc-frame. */ VM_DEFINE_OP (19, reset_frame, "reset-frame", OP1 (X8_C24)) { |