perf(vm): a cheaper attached run of the debugger #298
Loading…
Reference in a new issue
No description provided.
Delete branch "loop/43-cheaper-attached-run"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #43
Two commits:
test(debugger): measure the attached run in CI-tools/debug-cost.shat the end of tier B:torb run --vm, the run lowered for the debugger, andtorb debugattached without and with a breakpoint, best / median of 7 interleaved runs ofbenchmarks/debug/*.perf(vm): write a loop's record only where a call back begins, test breakpoints by a bit:executeof a debugged run notes chunk, pc, base, depth and statement in plain fields ofDebugger. ALoopRecordis pushed only inbeginLoopwhen anexecuteis already running, which is where a call back begins, and popped infinishLoop.framesOfreads the live position, then the records below it.List<Bool>with a bit for every statement of every chunk, indexed by chunk start plus statement index.Debugger.setBreakpointsmakes the table anew, so a replaced set leaves no stale bit. A run with no breakpoints skips the table entirely.codeStartsOfis gone.verified,line, moved to the next line that has a statement), now to(chunk, statement index)pairs.Numbers (forge
linux-x64, tier B)Before: run 732, tier B. After: run 754, tier B, commit
8eb9b956, whose VM code is the same as the head (since then: docs, formatting and a rebase onto main).Decision rule: the change stays if the attached fibonacci run is at least 10% faster. Its best went from 2017 to 1179 ms, 42% faster (2.34x to 1.43x of
run --vm), so the change stays.torb run/torb testcode is unchanged, and the numbers are within noise. This is reported, not a gate. The numbers are recorded in DEBUGGER.md section 19, and sections 7, 8 and 20 are updated.Tests
tests/debug/callback(new session): a breakpoint inKey.hash, which aSetcalls back through the runtime, and itsstackTracethrough the call back down to the caller's line. It also coversstepOutto the caller's next line,stepInfrom there into the next call back, and a panic inside a call back, stopped with its frames.compiler/tests/debugger.test.trb:.expectedfiles are unchanged.Stays draft: the VM change (second commit) is not pushed yet; owner is the torbscript loop worker (re-claimed on #43 at 2026-10-10 08:02Z). Head also needs a rebase onto main (not mergeable) and tier A on the baseline commit failed after 5h28m, to be checked with the next push.
124b9f77788eb9b956a28eb9b956a2becffc08acWIP: perf(vm): a cheaper attached run of the debuggerto perf(vm): a cheaper attached run of the debuggerbecffc08ac6ffd6cc5daChecklist (head
6ffd6cc, CI success incl. tier A/B, pdisc, gates):tests/debug/callback(+.expected) and ten new cases incompiler/tests/debugger.test.trb(first/last statement, two chunks, exact bit table, replaced set leaves no bit, replacement at a stop, shared line closure/caller, frames of every loop below for breakpoint/step out/pause/stopOnEntry). Existing sessions unchanged.body.statements.length()before the append inemit.trb, so (chunk, statement index) matches the new bit table.beginLooppushes the outer position only when anexecuteis already running,finishLooprestores it,framesOfreads the live position and then the records below. A chunk appended while running is handled byhasBreakpointAt.executeLoop/executeininterpret.trbneed no change.tools/debug-cost.shalways exits 0; the CI step is a measurement, not a gate.Non-blocking:
gates.ymlhas nopermissions:key (pre-existing; this PR only adds one step to tier B, which ran).