RTL: 'return-values' instruction assumes 'reset-frame' has been called.
authorMark H Weaver <mhw@netris.org>
Sat, 17 Aug 2013 10:38:53 +0000 (06:38 -0400)
committerAndy Wingo <wingo@pobox.com>
Sat, 24 Aug 2013 13:27:50 +0000 (15:27 +0200)
* libguile/vm-engine.c (return-values): Remove NVALUES operand.
  Don't reset the frame.

* test-suite/tests/rtl.test ("cached-toplevel-set!"): Adapt to the fact
  that 'return-values' has no operand now, and that 'reset-frame' must
  be done first.

libguile/vm-engine.c
test-suite/tests/rtl.test

index 0f8fed3..f2944e1 100644 (file)
@@ -1087,22 +1087,19 @@ RTL_VM_NAME (SCM vm, SCM program, SCM *argv, size_t nargs_)
       RETURN_ONE_VALUE (LOCAL_REF (src));
     }
 
-  /* return-values nvalues:24
+  /* return-values _:24
    *
    * Return a number of values from a call frame.  This opcode
    * corresponds to an application of `values' in tail position.  As
    * with tail calls, we expect that the values have already been
    * shuffled down to a contiguous array starting at slot 1.
+   * We also expect the frame has already been reset.
    */
-  VM_DEFINE_OP (6, return_values, "return-values", OP1 (U8_U24))
+  VM_DEFINE_OP (6, return_values, "return-values", OP1 (U8_X24))
     {
-      scm_t_uint32 nvalues;
+      scm_t_uint32 nvalues _GL_UNUSED = FRAME_LOCALS_COUNT();
       SCM *base = fp;
 
-      SCM_UNPACK_RTL_24 (op, nvalues);
-
-      RESET_FRAME (nvalues + 1);
-
       VM_HANDLE_INTERRUPTS;
       ip = SCM_FRAME_RTL_MV_RETURN_ADDRESS (fp);
       fp = vp->fp = SCM_FRAME_DYNAMIC_LINK (fp);
index 6f61f37..a6467ea 100644 (file)
                             (box-ref 2 1)
                             (add1 2 2)
                             (box-set! 1 2)
-                            (return-values 0)
+                            (reset-frame 1)
+                            (return-values)
                             (end-arity)
                             (end-program)))))
                     ((make-top-incrementor))