aboutsummaryrefslogtreecommitdiffstats
path: root/core/module-jit.c
diff options
context:
space:
mode:
authoreunhhu <[email protected]>2026-10-19 00:40:55 +0100
committereunhhu <[email protected]>2026-10-19 00:40:55 +0100
commite9f53dc8a56ddca0855213da4355f39a69306c07 (patch)
tree81f76bc1dfabcc63f928523c945c7d64eea0de88 /core/module-jit.c
parent3cc6bc3d8a1d8827519decbf7e084e89110c93f9 (diff)
downloadpure-e9f53dc8a56ddca0855213da4355f39a69306c07.tar.gz
pure-e9f53dc8a56ddca0855213da4355f39a69306c07.zip
027's 4f-4: loops nested to any depth: the load counts a module's deepest nesting (nesting), a run keeping PURE_MODULE_NESTING (8) on its stack as before and a module nesting deeper running in the executor that calls, its loops in its app's room (PureApp.deep, grown to it), so run()'s hot path is as it was; the JIT compiles modules nesting 8 at most; a function's nesting counted without a cap (u32), its frame sized to it; unit test: 40 loops nested, run to their end (2^20 rounds) and stopped by the work budget (2^40), 8 still on the stack; counts: b42 against b41 with batches BFS -0.12%, without BFS +0.09%, the rest within 0.001%; the bank's queries (s41 and s42 in turns, six each) in_credit +1.04%, per_branch +0.60%, ranks +0.36%, the rest within 0.01% (their spread: the bank has no functions, so none runs the changed executor, and s42's in_credit is within s41's own earlier six); 008 and 027
Diffstat (limited to 'core/module-jit.c')
-rw-r--r--core/module-jit.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/core/module-jit.c b/core/module-jit.c
index 8208095..bd04361 100644
--- a/core/module-jit.c
+++ b/core/module-jit.c
@@ -5788,7 +5788,9 @@ struct PureJit *pure_jit_make(const PureModule *m) {
const char *enabled = getenv("PURE_JIT");
/* What it makes keeps its lists' and states' sets in a word each: a module of more states runs in the executor
* alone (027's 4f-2). */
- if ((enabled && !strcmp(enabled, "0")) || !m->height || !m->code_count || m->states > JIT_STATES) return NULL;
+ if ((enabled && !strcmp(enabled, "0")) || !m->height || !m->code_count || m->states > JIT_STATES ||
+ m->nesting > PURE_MODULE_NESTING) /* (its loops' tables hold PURE_MODULE_NESTING) */
+ return NULL;
Made *made = NULL;
size_t count = 0, room = 0;
bool ok = true;