aboutsummaryrefslogtreecommitdiffstats
path: root/core/module.c
diff options
context:
space:
mode:
authoreunhhu <[email protected]>2026-10-05 12:25:27 +0100
committereunhhu <[email protected]>2026-10-05 12:25:27 +0100
commit89f45e11fc5d6a8c6f5a556195dc2f363239568f (patch)
treeb6db59631e6fcfffdaae4e6d05dde686602330e7 /core/module.c
parent2c0dc0ed32ab0d88f985aadbb6541591bdef5461 (diff)
downloadpure-89f45e11fc5d6a8c6f5a556195dc2f363239568f.tar.gz
pure-89f45e11fc5d6a8c6f5a556195dc2f363239568f.zip
Compile each nest of loops twice, the second with whole numbers as integers (narrow columns, counts, their arithmetic within 2^53), giving up to the executor for the rest of a round when that fails: BFS core 14.9 to 13.4 ms (022)
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);