[Quipu-dev] quipu/quipu: Correct 'let' frame generation

Back to archive index

scmno****@osdn***** scmno****@osdn*****
Fri Jun 15 06:25:07 JST 2018


changeset f896a868038c in quipu/quipu
details: http://hg.osdn.jp/view/quipu/quipu?cmd=changeset;node=f896a868038c
user: Agustina Arzille <avarz****@riseu*****>
date: Thu Jun 14 18:24:56 2018 -0300
description: Correct 'let' frame generation

diffstat:

 compiler.cpp |   5 +++--
 interp.cpp   |  13 ++++---------
 tree.cpp     |   6 ++----
 3 files changed, 9 insertions(+), 15 deletions(-)

diffs (73 lines):

diff -r a54af9e55584 -r f896a868038c compiler.cpp
--- a/compiler.cpp	Thu Jun 14 12:49:39 2018 -0300
+++ b/compiler.cpp	Thu Jun 14 18:24:56 2018 -0300
@@ -2731,8 +2731,9 @@
     OP_(MKFRAMEL):
       sx = !bcode_long_p (*(ip - 1)) ? (int8_t)*ip++ : (int32_t)fetch32 (ip);
 
-      interp->stkend += sx + 1;
-      r_stkend(sx + 1) = fn | EXTRA_BIT;
+      *interp->stkend++ = fn | EXTRA_BIT;
+      for (int32_t si = 0; si < sx; ++si)
+        *interp->stkend++ = UNBOUND;
 
       if (interp->dynframe_captured ())
         { // Capture environment.
diff -r a54af9e55584 -r f896a868038c interp.cpp
--- a/interp.cpp	Thu Jun 14 12:49:39 2018 -0300
+++ b/interp.cpp	Thu Jun 14 18:24:56 2018 -0300
@@ -519,14 +519,6 @@
     atomic_add (&this->npendev, 1);
 }
 
-static void
-handle_ev (interpreter *interp, unsigned int ev)
-{
-  object fn = get_evhandler (interp, ev);
-  if (fn != UNBOUND)
-    (void)call_fct (interp, fn, intobj (ev));
-}
-
 void interpreter::handle_evs ()
 {
   if (qp_likely (!this->npendev))
@@ -541,7 +533,10 @@
             {
               atomic_and (&this->pendev_mask[i / ATOMIC_BITS], ~bit);
               atomic_add (&this->npendev, -1);
-              handle_ev (this, i + 1);
+
+              object fn = get_evhandler (this, i + 1);
+              if (fn != UNBOUND)
+                (void)call_fct (this, fn, intobj (i + 1));
             }
         }
     }
diff -r a54af9e55584 -r f896a868038c tree.cpp
--- a/tree.cpp	Thu Jun 14 12:49:39 2018 -0300
+++ b/tree.cpp	Thu Jun 14 18:24:56 2018 -0300
@@ -295,14 +295,12 @@
 tree_put_mt (interpreter *interp, tree *tp,
   tree_args& ap, object key)
 {
-  object nval = UNBOUND;
 retry:
   int n = rand_levels (interp, tp);
   if (find_preds_mt (interp, tp, ap, n, key, UNLINK_ASSIST) != UNBOUND)
     return (false);
 
-  if (nval == UNBOUND)
-    nval = make_node (interp, n, key);
+  object nval = make_node (interp, n, key);
 
   ap.next = node_next (nval, 0) = *ap.l_succs;
   for (int lvl = 1; lvl < n; ++lvl)
@@ -408,7 +406,7 @@
   object key, object dfl)
 {
   if (dfl != UNBOUND)
-    interp->raise_nargs ("tree:get", 2, 2, 3);
+    interp->raise_nargs ("get:tree", 2, 2, 3);
 
   qp_return (tree_get (interp, tr, key, !singlethr_p ()));
 }




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