[Quipu-dev] quipu/quipu: Fix return from let forms

Back to archive index

scmno****@osdn***** scmno****@osdn*****
Tue Jun 12 12:48:34 JST 2018


changeset e9096f643ded in quipu/quipu
details: http://hg.osdn.jp/view/quipu/quipu?cmd=changeset;node=e9096f643ded
user: Agustina Arzille <avarz****@riseu*****>
date: Tue Jun 12 03:48:19 2018 +0000
description: Fix return from let forms

diffstat:

 compiler.cpp |  16 ++++++++++------
 1 files changed, 10 insertions(+), 6 deletions(-)

diffs (51 lines):

diff -r 6cc8c962b06d -r e9096f643ded compiler.cpp
--- a/compiler.cpp	Mon Jun 11 17:20:10 2018 -0300
+++ b/compiler.cpp	Tue Jun 12 03:48:19 2018 +0000
@@ -84,8 +84,6 @@
       flg_emitted_captenv = 0x04
     };
 
-  typedef sorted_list<xcmp_call> ctable_t;
-
   class frame_data
     {
     public:
@@ -98,6 +96,8 @@
           acc (0), done (d) {}
     };
 
+  typedef sorted_list<xcmp_call> ctable_t;
+
   interpreter *interp;
   ctable_t ctable;
   std::vector<object> code;
@@ -2410,14 +2410,17 @@
 
       stkend = stack + lastf - (interpreter::frame_size +
         as_int (stack[lastf - 3]));
-      nargs = as_int (stack[interp->cur_frame - 3]);
-      bp = interp->cur_frame - (interpreter::frame_size + nargs);
+      fn = stack[interp->cur_frame - interpreter::frame_size -
+        as_int (stack[interp->cur_frame - 3]) - 1];
       r_stkend(1) = retval;
-      fn = stack[bp - 1];
+
+      // TODO: Improve for 'let' (use cur_frame - 3?)
+      set_lastf (interp, fn, lastf);
+      nargs = as_int (stack[lastf - 3]);
+      bp = lastf - (interpreter::frame_size + nargs);
 
       ip = as_bvector(fct_bcode (fn))->data +
         as_int (stack[interp->cur_frame - 2]);
-      set_lastf (interp, fn, lastf);
       NEXT_OP;
 
     OP_(IS):
@@ -2739,6 +2742,7 @@
 
       interp->stkend += sx + 1;
       r_stkend(sx + 1) = fn | EXTRA_BIT;
+
       if (interp->dynframe_captured ())
         { // Capture environment.
           array *ap = as_array (alloc_array (interp, sx + 1, NIL));




More information about the Quipu-dev mailing list
Back to archive index