diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2017-09-01 02:23:45 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2017-09-01 02:23:45 -0700 |
commit | 03d673bb2509f5809633c9560d20c1143b0af1d1 (patch) | |
tree | 137d0063b7a6aab8d834b9b84fdde41454899a11 | |
parent | 4856c70107738b2cb14541c6c470eeeda1bf6b55 (diff) | |
download | mu-03d673bb2509f5809633c9560d20c1143b0af1d1.tar.gz |
3989
-rw-r--r-- | 076continuation.cc | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/076continuation.cc b/076continuation.cc index e67838bd..a52e6465 100644 --- a/076continuation.cc +++ b/076continuation.cc @@ -166,23 +166,23 @@ call_stack::iterator find_base_of_continuation(call_stack& c) { //: overload 'call' for continuations :(after "Begin Call") - if (current_instruction().ingredients.at(0).type->atom - && current_instruction().ingredients.at(0).type->name == "continuation") { - // copy multiple calls on to current call stack - assert(scalar(ingredients.at(0))); - if (Delimited_continuation.find(ingredients.at(0).at(0)) == Delimited_continuation.end()) - raise << maybe(current_recipe_name()) << "no such delimited continuation " << current_instruction().ingredients.at(0).original_string << '\n' << end(); - const call_stack& new_calls = Delimited_continuation[ingredients.at(0).at(0)]; - const call& caller = (SIZE(new_calls) > 1) ? *++new_calls.begin() : Current_routine->calls.front(); - for (call_stack::const_reverse_iterator p = new_calls.rbegin(); p != new_calls.rend(); ++p) - Current_routine->calls.push_front(*p); - if (Trace_stream) { - Trace_stream->callstack_depth += SIZE(new_calls); - trace("trace") << "calling delimited continuation; growing callstack depth to " << Trace_stream->callstack_depth << end(); - assert(Trace_stream->callstack_depth < 9000); // 9998-101 plus cushion - } - ++current_step_index(); // skip past the reply-delimited-continuation - ingredients.erase(ingredients.begin()); // drop the callee - finish_call_housekeeping(to_instruction(caller), ingredients); - continue; +if (current_instruction().ingredients.at(0).type->atom + && current_instruction().ingredients.at(0).type->name == "continuation") { + // copy multiple calls on to current call stack + assert(scalar(ingredients.at(0))); + if (Delimited_continuation.find(ingredients.at(0).at(0)) == Delimited_continuation.end()) + raise << maybe(current_recipe_name()) << "no such delimited continuation " << current_instruction().ingredients.at(0).original_string << '\n' << end(); + const call_stack& new_calls = Delimited_continuation[ingredients.at(0).at(0)]; + const call& caller = (SIZE(new_calls) > 1) ? *++new_calls.begin() : Current_routine->calls.front(); + for (call_stack::const_reverse_iterator p = new_calls.rbegin(); p != new_calls.rend(); ++p) + Current_routine->calls.push_front(*p); + if (Trace_stream) { + Trace_stream->callstack_depth += SIZE(new_calls); + trace("trace") << "calling delimited continuation; growing callstack depth to " << Trace_stream->callstack_depth << end(); + assert(Trace_stream->callstack_depth < 9000); // 9998-101 plus cushion } + ++current_step_index(); // skip past the reply-delimited-continuation + ingredients.erase(ingredients.begin()); // drop the callee + finish_call_housekeeping(to_instruction(caller), ingredients); + continue; +} |