From e9f53dc8a56ddca0855213da4355f39a69306c07 Mon Sep 17 00:00:00 2001 From: eunhhu Date: Mon, 19 Oct 2026 00:40:55 +0100 Subject: 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 --- core/module-jit.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'core/module-jit.c') 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; -- cgit v1.2.3