Skip to content

Complete iterative bytecode dispatch loop#1

Draft
alexryndin wants to merge 1 commit into
masterfrom
complete-iterative-dispatch
Draft

Complete iterative bytecode dispatch loop#1
alexryndin wants to merge 1 commit into
masterfrom
complete-iterative-dispatch

Conversation

@alexryndin

Copy link
Copy Markdown
Contributor

Work in progress based on TODO-1. This draft temporarily contains a source-export workflow so the branch can be built and tested locally; it will be removed before review.

alexryndin added a commit that referenced this pull request Jul 19, 2026
P15.34a — eliminate bcConstToValue re-interning (#1 perf hotspot, ~12.4%):
- Add resolveProtoConstants: at first Proto execution, replace compile-time
  *LuaString (hash seed 0) with VM-interned pointers (per-VM seed)
- bcConstToValue returns string constants directly — no re-hashing on every
  GETTABUP/GETFIELD/SETFIELD execution
- Called from pushBytecodeExecFrame AND TAILCALL frame-reuse path
- Ownership: after resolution, string constants owned by VM intern table,
  not by Proto (matching PUC's TString ownership model)
- Results: global_arith -54%, field_access -59%, metamethod_add -13%

P15.34b — PUC-faithful reader fixes (latent bug fixes):
- Nil-fill missing parameters in pushBytecodeExecFrame (PUC luaD_precall)
- Bound debug.getlocal/setlocal temp-scan by live_reg_top[pc] instead of
  scanning entire register window (fixes phantom temporaries from stale
  values)
- Fix parked-coroutine GC scan: walk per-frame live_reg_top[fr.pc] instead
  of flat bytecode_stack[0..parked_top] scan (fixes SIGSEGV on
  coroutine.lua/cstack.lua)
- cloneStrippedProto now copies live_reg_top
- @Memset(regs, .Nil) kept as safety net: live_reg_top is per-statement
  high-water mark, not per-instruction after-boundary like PUC's L->top.
  Removal is a P15.35 prerequisite.

Parity: 28/31 (no regressions), 44/44 smoke tests pass.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant