vile / bench / runtime / SCOPES-369.md
71 lines · 57 sloc · 6.74 KB · 76646891b77a3d5c6af4a1e42b122cd61dc1654b
Raw

Parameterized binding scopes and map entry (369)

Immediate nonempty let bindings use the existing compiler-owned scope-function/call instructions with a fixed argument count. Initializers retain their original enclosing scope and order. The VM reserves the destination activation through the existing API, copies parameters, then truncates operands. It avoids a temporary first-class procedure and the unnecessary escape mark that previously prevented reuse of enclosing locations. Actual closures, promises and continuations retain their existing escape and ownership rules.

The existing activation cache, allocation controls, frame checks, application charges, source positions and tail-parent cleanup remain authoritative. Zero-argument cleanup is preserved; denied parameterized entry preserves pending arguments and caller state. Native stack analysis and private binding lowering now account for scope arguments. No opcode, GC dependency, persistent borrowed pointer or new per-call allocation is added.

Map callbacks can reuse the existing checked ordinary closure-entry API. Hard-bounded and controlled execution retain full application; special procedure modes, rest/keyword formals, foreign owners, frame growth and active native scopes decline the shortcut. Compile-time caller specializations keep one V source body while preserving inlining in the ordinary dispatch loop. The selected GC disassembly has no out-of-line entry call; the rejected shared-call build does.

All 254 ordinary-interpreter cases and 150 native/fallback cases pass under ASan/UBSan and Boehm, plus CLI and default-build budget checks. Scope tests eagerly compile the reference and rewrite private calls back into closure/call instructions, asserting that conversion occurred. Additional comparisons use the bounded VM’s full callback application. Cases cover exact step/frame limits and errors, multishot initializer/map continuations, dynamic extents, fresh escaped locations, GC roots, borrowed host reentry, denial, both frontends, macros, records, promises and GOOPS ownership. The native callback test confirms three native hits and zero deoptimizations.

All 36 unchanged workloads are included: 24 runtime and 12 mock-WM, retained368 and candidate369 interpreters in GC and arena modes, plus Guile 3.0.10 with frozen guild-O2 wrappers and default JIT. Ten fresh processes per configuration/workload give nine retained samples. All 1800 rows pass their oracles and have zero Vile warmup/measured native execution, compilation and cache counters. Builds and tests ran separately from timings on the same idle Intel Mac mini using hash-verified snapshots. Prepared per-call medians exclude parsing, setup and first use; raw first-call and whole-process times remain available.

All eight 4-versus-400-call scaling groups pass with three repeats per count and at least 20x total-time growth. Fixtures, four-input oracles, batches and five warmup calls are unchanged. The initial scope-only and shared-map trials remain in validation/scope369-initial-trial and scope369-map-trial, including every loss. The inline-hint attempt is archived in scope369-inline-hint: its binaries were identical to the shared-map build, so no timing rerun was made. Compiler source was unchanged.

Suite GC gain vs368 Arena gain vs368 Guile advantage over GC Guile advantage over arena
wm 1.155x 1.199x 4.333x 4.417x
runtime 1.002x 1.023x 7.543x 7.558x
all36 1.050x 1.079x 6.270x 6.319x

Guile advantage is Vile time divided by Guile time: above one means Guile is faster. All 36 gives every workload equal weight. Guile still leads; the full 1.5x-faster goal is unmet and final 31-sample/full-objective verification remains outstanding. This report measures the interpreter; previous native-backend comparisons keep their own source snapshots.

Regressions over 5%: none. All losses remain in the tables and aggregates.

wm

Workload 368 GC ms 369 GC ms Guile ms GC gain Arena gain
wm-callback-chain 5.164687 4.695396 0.637750 1.100x 1.123x
wm-event-dispatch 3.966228 2.850916 0.214500 1.391x 1.478x
wm-focus-cycle 4.750527 4.141609 0.376500 1.147x 1.249x
wm-tiling-layout 2.724813 1.801957 0.109000 1.512x 1.525x
wm-workspace-move 1.494732 1.248995 0.175250 1.197x 1.306x
wm-keybindings 4.640379 4.369458 0.283250 1.062x 1.033x
wm-hooks 3.046099 2.834473 0.354500 1.075x 1.141x
wm-lifecycle 1.117994 0.994964 0.126000 1.124x 1.221x
wm-macro-config 4.510026 4.438782 5.273000 1.016x 1.021x
wm-config-load-tree 5.214308 5.094467 8.970500 1.024x 1.022x
wm-reload-live 8.244573 7.151291 8.115750 1.153x 1.222x
wm-session-replay 7.839276 6.809925 8.091750 1.151x 1.170x

runtime

Workload 368 GC ms 369 GC ms Guile ms GC gain Arena gain
tail-sum-10k 0.702698 0.706279 0.033630 0.995x 1.048x
fib-20 4.519319 4.688327 0.310600 0.964x 1.028x
closure-5k 0.542310 0.556527 0.015570 0.974x 1.041x
list-3k 0.899195 0.925522 0.060030 0.972x 0.994x
flonum-sum-2k 0.505682 0.478871 0.095750 1.056x 1.021x
bignum-fib-200 0.048720 0.048464 0.005417 1.005x 1.020x
rational-harmonic-80 0.095358 0.095042 0.049125 1.003x 1.000x
integer-divmod-5k 0.831139 0.829747 0.168333 1.002x 1.004x
list-map-1k 0.129729 0.124635 0.048333 1.041x 1.051x
list-reverse-2k 0.457894 0.475635 0.060500 0.963x 0.964x
vector-update-2k 0.378535 0.396142 0.016167 0.956x 1.006x
bytevector-fill-4k 0.783926 0.773297 0.086083 1.014x 1.011x
hashtable-count-1k 0.439607 0.439835 5.941500 0.999x 1.018x
string-build-1k 0.042582 0.041610 0.042667 1.023x 1.005x
string-scan-4k 0.651095 0.663676 0.043833 0.981x 0.984x
unicode-scan-1k 0.175587 0.178029 0.011750 0.986x 0.995x
datum-read-write-200 1.196563 1.222071 2.252500 0.979x 0.997x
closure-mutate-2k 0.291873 0.298570 0.008500 0.978x 1.024x
higher-order-2k 0.376191 0.388477 0.006333 0.968x 1.011x
callcc-escape-1k 0.072084 0.073101 0.006583 0.986x 1.051x
values-consumer-1k 0.616198 0.608420 0.004417 1.013x 1.014x
dynamic-wind-200 0.140398 0.141953 0.012583 0.989x 0.997x
goops-dispatch-1k 0.756676 0.751883 0.110500 1.006x 0.988x
goops-allocate-200 0.100561 0.082841 0.054500 1.214x 1.324x

Build snapshot: vile-resume.ktsvy_e4. Verification: vile-resume.52fl59cl. Measurement: vile-resume.llc1th34. Recovery: validation/interpreter369/.