[Quipu-dev] quipu/quipu: Generalize continuation passing semantics

Zurück zum Archiv-Index

scmno****@osdn***** scmno****@osdn*****
Tue Jun 19 13:17:20 JST 2018


changeset aac0a6b9274b in quipu/quipu
details: http://hg.osdn.jp/view/quipu/quipu?cmd=changeset;node=aac0a6b9274b
user: Agustina Arzille <avarz****@riseu*****>
date: Tue Jun 19 04:17:04 2018 +0000
description: Generalize continuation passing semantics

diffstat:

 compiler.cpp     |  5 +++--
 continuation.cpp |  5 +++--
 2 files changed, 6 insertions(+), 4 deletions(-)

diffs (39 lines):

diff -r e43e6126839f -r aac0a6b9274b compiler.cpp
--- a/compiler.cpp	Tue Jun 19 03:57:33 2018 +0000
+++ b/compiler.cpp	Tue Jun 19 04:17:04 2018 +0000
@@ -2196,7 +2196,7 @@
 
   if (cdp != 0)
     { // Restored from a caught exception.
-      top_frame = cont != UNBOUND ? 0 : cdp->topf;
+      top_frame = cdp->topf;
       nargs = as_int (stack[interp->cur_frame - 3]);
       bp = interp->cur_frame - interpreter::frame_size - nargs;
       fn = stack[bp - 1];
@@ -2206,7 +2206,8 @@
   else if (cont != UNBOUND)
     { // Continuation-passing style.
       continuation *cnp = as_continuation (cont);
-      lastf = cnp->sframes[0], top_frame = 0;
+      lastf = cnp->sframes[0];
+      interp->cur_frame = cnp->sframes[1];
       nargs = as_int (stack[lastf - 3]);
       bp = 1, fn = stack[bp - 1];
       ip = as_bvector(fct_bcode (fn))->data + cnp->ip_offset;
diff -r e43e6126839f -r aac0a6b9274b continuation.cpp
--- a/continuation.cpp	Tue Jun 19 03:57:33 2018 +0000
+++ b/continuation.cpp	Tue Jun 19 04:17:04 2018 +0000
@@ -73,10 +73,11 @@
 
   cont_state state (interp);
   continuation *cnp = as_continuation (cn);
+
   interp->stkobj = cnp->argv;
   interp->stack = &xaref(interp->stkobj, 0);
-  interp->cur_frame = cnp->sframes[1];
-  interp->stkend = interp->stack + interp->cur_frame + cnp->sp_diff;
+  interp->cur_frame = 0;
+  interp->stkend = interp->stack + cnp->sframes[1] + cnp->sp_diff;
   object ret = call_continuation (interp, cn);
   qp_return (continuation_p (ret) ? ret : NIL);
 }




More information about the Quipu-dev mailing list
Zurück zum Archiv-Index