diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2015-05-23 16:43:41 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2015-05-23 16:43:41 -0700 |
commit | e00ddbeb372f9b92e3c9a430818ee8a0d0848064 (patch) | |
tree | 9f08c65779f349d0aa9a3c3845a4719f06e04fbc | |
parent | e5d9a7f2f38e91e5cb675f9e4199e2f822b2f28e (diff) | |
download | mu-e00ddbeb372f9b92e3c9a430818ee8a0d0848064.tar.gz |
1443 - bugfix in continuation support
Thanks Anthony Di Franco (http://dfko.net)
-rw-r--r-- | 048continuation.cc | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/048continuation.cc b/048continuation.cc index 87cf12e3..3cd61fda 100644 --- a/048continuation.cc +++ b/048continuation.cc @@ -23,10 +23,14 @@ CURRENT_CONTINUATION, Recipe_number["current-continuation"] = CURRENT_CONTINUATION; :(before "End Primitive Recipe Implementations") case CURRENT_CONTINUATION: { + // copy the current call stack Continuation[Next_continuation_id] = Current_routine->calls; // deep copy because calls have no pointers + // make sure calling the copy doesn't spawn the same continuation again + ++Continuation[Next_continuation_id].front().running_step_index; products.resize(1); products.at(0).push_back(Next_continuation_id); ++Next_continuation_id; + trace("current-continuation") << "new continuation " << Next_continuation_id; break; } @@ -61,6 +65,8 @@ recipe main [ +mem: storing 2 in location 1 +mem: storing 3 in location 1 -mem: storing 4 in location 1 +# ensure every iteration doesn't copy the stack over and over +$current-continuation: 1 :(scenario continuation_inside_caller) recipe main [ |