aboutsummaryrefslogtreecommitdiffstats
path: root/core/module.c
diff options
context:
space:
mode:
Diffstat (limited to 'core/module.c')
-rw-r--r--core/module.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/core/module.c b/core/module.c
index a01a411..bc9fb8f 100644
--- a/core/module.c
+++ b/core/module.c
@@ -3064,6 +3064,21 @@ int pure_run_item(Frame *frame, uint32_t pc) {
return step(frame, op, pc, &next);
}
+int pure_run_rest(Frame *frame, uint32_t pc) {
+ unsigned depth = frame->depth;
+ for (;;) {
+ if (frame->depth < depth) return STEP_SKIP; /* it left the loop (BREAK) */
+ if (pc >= frame->end) { /* a loop's block ran: the compiled code's, done; one opened here, its iteration */
+ if (frame->depth == depth) return STEP_NEXT;
+ int how = iterate(frame, &pc);
+ if (how != STEP_NEXT) return how;
+ continue;
+ }
+ int how = step(frame, &frame->m->code[pc], pc, &pc);
+ if (how != STEP_NEXT) return how;
+ }
+}
+
int pure_run_iterate(Frame *frame) {
uint32_t next = UINT32_MAX;
int how = iterate(frame, &next);