diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-13 09:28:38 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-13 09:28:38 -0300 |
| commit | 5c0230ea5a77f85de77ad4354788cd6c27aa1ef6 (patch) | |
| tree | e01a903bdee092965b86e118dfaab85c3bd60004 /gui/bench/RESULTS.md | |
| parent | 5a40dca5adb6e9e650f55f3ec6f254a13bf50493 (diff) | |
| download | computeranim-5c0230ea5a77f85de77ad4354788cd6c27aa1ef6.tar.gz computeranim-5c0230ea5a77f85de77ad4354788cd6c27aa1ef6.zip | |
debugger: follow natural V8 deoptimization with adaptive live views
Diffstat (limited to 'gui/bench/RESULTS.md')
| -rw-r--r-- | gui/bench/RESULTS.md | 210 |
1 files changed, 105 insertions, 105 deletions
diff --git a/gui/bench/RESULTS.md b/gui/bench/RESULTS.md index 89f0d78..0426dce 100644 --- a/gui/bench/RESULTS.md +++ b/gui/bench/RESULTS.md @@ -1,134 +1,134 @@ -# Debug V8 versus a small C target +# Natural V8 deoptimization and stepping measurements -Measured locally on 2026-11-13, Linux 7.2.11-arch1-1, Intel i7-11700, -Zig 0.17.0, ReleaseFast controller. The targets were a `cc -g -O0` C loop -and **unoptimized debug V8**, not release d8. Both used the same controller: -512 stack bytes, 24 disassembled instructions and telescope depth 2, with a -recording flush at every stop. No syscall tracing and no continuous stepping -while the user has selected Continue. - -Final controller run: +Measured 2026-11-13 on Linux 7.2.11-arch1-1, Intel i7-11700, Zig 0.17.0, +ReleaseFast debugger; targets are `cc -g -O0` C and unoptimized debug V8. +Source is loaded for both. Capture settings are 512 stack bytes, 24 instructions, +telescope depth 2, mapping refresh and recording flush at every stop. Continue +runs normally between breakpoints; no continuous instruction tracing occurs. ```sh -python3 gui/bench/steps.py \ - --d8 /tmp/computeranim-v8-debug-remote/d8 \ - --ztrace zig-out/bin/ztrace \ - --out /tmp/ztrace-step-bench-ui +python3 gui/bench/steps.py --d8 /tmp/computeranim-v8-debug-remote/d8 \ + --source /tmp/computeranim-v8-source --out /tmp/ztrace-natural-bench-final ``` -| 1,000 instruction steps | C | Debug V8 / generated JS | +| 1,000 steady instruction steps | C | Debug V8 / TurboFan JS | | --- | ---: | ---: | -| Capture + flush, median | 37.48 µs | 38.43 µs | -| Capture + flush, p95 | 54.37 µs | 52.48 µs | -| Controller round trip, median | 49.49 µs | 49.48 µs | -| Controller round trip, p95 | 72.46 µs | 68.31 µs | -| Controller round trip, maximum | 553.21 µs | 364.10 µs | -| Launch through first requested breakpoint | 5.98 ms | 938.49 ms | - -This supports comparable steady instruction-step cost for these workloads. -It does not claim that V8 starts as quickly as a small program, or that all C++ -source/DWARF operations have this cost. The previous 1,000-step run measured -35.73 / 38.47 µs capture medians and 46.94 / 49.53 µs round-trip medians for -C / V8. Scheduling and cache state affect these microsecond measurements; no -CPU isolation or filesystem-cache dropping was used. GUI presentation is not -included in the controller timings. +| Capture + flush, median | 48.16 µs | 133.16 µs | +| Capture + flush, p95 | 75.98 µs | 153.33 µs | +| Entire command, median | 55.00 µs | 140.00 µs | +| Controller round trip, median | 68.88 µs | 154.44 µs | +| Controller round trip, p95 | 105.64 µs | 208.51 µs | +| Controller round trip, maximum | 567.93 µs | 539.92 µs | -The V8 fixture compiles `jitWork` with TurboFan, traps in the native runtime, -then installs an actual software breakpoint at `addl r8,r11` inside the -optimized loop. The harness asserts the returned RIP equals that address and -lies in an anonymous executable mapping. It then tests source-step fallback -without JIT source lines, records the instruction-step sample, and checks that -the recording no longer reports the previous native source line. The loop -address is read from V8's own output; the harness fails rather than guesses if -a different V8 compiler allocates different registers. +`capture_ns` covers reporting state plus recording flush. `elapsed_ns` covers the +whole command, including execution/wait and capture. Round trip additionally +includes pipes and the Python driver. Neither includes GUI presentation. +Launch through first generated stop and JIT source import took 1,288.73 ms. +No CPU isolation or filesystem-cache dropping was used. These are workload +measurements, not a release-V8 performance comparison. Per-stop mapping refresh +and natural tiering differ from the earlier forced-optimization demonstration; +its old figures are not directly comparable. -The raw records, logs and JSON results are in `/tmp/ztrace-step-bench-ui`. -The script is the durable reproducer; `/tmp` artifacts are not permanent. +## Verified transition -With JIT source information loaded, the final 1,000-step run remained comparable: +The ordinary fixture naturally compiled through Maglev and TurboFan. After +warming `jitWork` on `{value:7}`, `{extra:1,value:9}` hit its TurboFan wrong-map +guard. The generated exit's return PC matched the `rdx` origin argument at +`Deoptimizer::New`; unrelated outer-loop bailouts were ignored. Native source +resolved at both Deoptimizer::New (`deoptimizer.cc:290`) and +Runtime_NotifyDeoptimized (`runtime-compiler.cc`). The guard mapped to JS line 3, +`let sum = object.value`. Its shared exit stub mapped to a different JS line, so +origin context deliberately uses the guard. -| Source-enabled run | C | Debug V8 / generated JS | +| Transition stop | Capture + flush | Entire command | | --- | ---: | ---: | -| Capture + flush, median | 36.60 µs | 37.76 µs | -| Capture + flush, p95 | 46.78 µs | 46.35 µs | -| Controller round trip, median | 48.04 µs | 48.84 µs | -| Controller round trip, p95 | 60.97 µs | 63.83 µs | +| generated wrong-map exit | 372.09 µs | 1192.34 µs | +| Deoptimizer::New | 202.01 µs | 214.16 µs | +| Runtime_NotifyDeoptimized | 265.13 µs | 1086.31 µs | +| InterpreterEnterAtBytecode | 445.40 µs | 752.09 µs | +| Ignition property bytecode handler | 15163.99 µs | 15474.67 µs | -Reproduce with `--jit-source --out /tmp/ztrace-step-bench-source` added to the -command above. This run imports the real JIT ELF before sampling and checks the -final recording retains JavaScript source information. The initial import is -excluded from steady stepping, just as executable startup is excluded. +The immediate fallback was **Ignition**, confirmed by stopping at +`Builtins_InterpreterEnterAtBytecode` and stepping into +`Builtins_GetNamedPropertyHandler`. This is actual interpreter dispatch, +not an inference from the deoptimizer's frame-reconstruction log. The first +handler capture incurred additional symbol/function work, which is why transition +costs are reported separately from warmed stepping. The script completed with +`mismatch 499509` and `fallback 499507`. Default tiers remain enabled; this does +not imply that other V8 builds always resume Ignition. -## V8 provenance +Raw logs, recordings and JSON are in `/tmp/ztrace-natural-bench-final`; the +checked-in scripts are the durable reproducer. Addresses/PIDs in those files are +session-specific and `/tmp` artifacts are not permanent. -The user's remote Arch build host (`chaincli-box`) has the existing checkout at -`/home/goblin/v8-research/v8`. Ninja verified the compatible debug build up to date -(`ninja: no work to do`). No V8 compilation was performed on the workstation. -The complete runtime artifacts were copied to `/tmp/computeranim-v8-debug-remote` -and smoke-tested locally. +## Source and build provenance +- Remote: `chaincli-box`, `/home/goblin/v8-research/v8`. - Revision: `84703f702dca525edd469f3a98d784faa46a02f8`. -- d8 version: `15.2.0 (candidate)`. -- Output: `out/x64.debug-vuln` (historical directory name). -- Existing unrelated local `BUILD.gn` change to the `v8_fuzzer` source list was - preserved; the checkout was not reset or updated. +- d8: `15.2.0 (candidate)`, existing `out/x64.debug-vuln`. - `is_debug=true`, `v8_optimized_debug=false`, `symbol_level=2`, `v8_symbol_level=2`, `use_debug_fission=true`, `target_cpu="x64"`. - Disassembler, object printing, heap verification, slow DCHECKs and backtraces enabled; `use_remoteexec=false`, `use_siso=false`. -- Component build: d8 plus its shared libraries (including the large debug - libv8.so), snapshots and ICU data. Split `.dwo` files were not copied, so this - run is not a validation of complete C++ local-variable/source debugging. +- Existing remote `BUILD.gn` edits and untracked files were preserved. No engine + patch, rebuild, checkout reset or workstation V8 compilation was needed. + +The component runtime (d8, shared libraries, snapshots and ICU data) is at +`/tmp/computeranim-v8-debug-remote`. Matching `src/` and all 2,328 `.dwo` files +were copied from the same checkout to `/tmp/computeranim-v8-source` (about 1.9 GiB +combined). To retrieve again after verifying the same revision: + +```sh +rsync -a -e 'ssh -F ~/.ssh/config -o BatchMode=yes' \ + chaincli-box:/home/goblin/v8-research/v8/src/ /tmp/computeranim-v8-source/src/ +rsync -a --include='*/' --include='*.dwo' --exclude='*' \ + -e 'ssh -F ~/.ssh/config -o BatchMode=yes' \ + chaincli-box:/home/goblin/v8-research/v8/out/x64.debug-vuln/obj/ \ + /tmp/computeranim-v8-source/out/x64.debug-vuln/obj/ +``` -## Checks +This build's skeleton line tables use comp_dir `.` and stripped `../../src` +paths. `source-map ../../src /tmp/computeranim-v8-source/src` resolves them +through the shared debugger source-prefix interface. Native line resolution was +verified; full split-DWARF C++ local-variable inspection was not implemented. -The GUI's real-target script exercises launch, a named breakpoint through the -Vim command bar, continue, keyboard and mouse instruction stepping, source -stepping, pause during execution and browsing history back to live. It also -checks fractional scrolling, pane histories, Mouse4/5 through the actual -pointer handler, semantic right-clicks, minimap dragging and animated lenses. -Native-window checks cover keyboard stepping, pane focus, scrolling and command -entry. Raw hardware Mouse4/5 injection was not performed. +## Verification -`gui/test/inspection.py` checks bounded read-only code/memory inspection against -C and debug V8: RIP stays unchanged, invalid counts are rejected, and subsequent -stepping still works. With `--d8`, it imports V8's real GDB JIT ELF and asserts -that source line 6 of the JavaScript fixture appears in the recorded instruction -metadata. The line mapping comes from V8's DWARF line program. +`gui/test/inspection.py --d8 /tmp/computeranim-v8-debug-remote/d8` passes bounded +read-only inspection, unchanged RIP, invalid-count rejection, source-prefix +replacement, natural optimization, matching JIT ELF import, native deoptimization +stops and actual fallback dispatch. -The root suite had two failures before this work; they remain in the existing -loader/syscall formatting and watch/string assertions. The new debugger tests -pass (86/88 in the full root suite; 25/27 debugger tests, with those same two -failures). No assertion was -weakened to hide them. +GUI tests cover live stepping/pause/history, source stepping, semantic address +navigation, minimap dragging, changed-state animation and lenses. Adaptive tests +use 2240×1260, 1440×900 and 800×700 at 60%, 100% and 200%: full 4 GiB mapping +navigation with single-row precision, per-pane segment history, pinned refresh at +repeated same-PC stops, graph/dim controls and font reset. Independent visual +review additionally checks PC/source alignment, pointer hit targets, compact +minimaps, lens cycles/collapse and native interaction. -## Rich GUI verification +The shared renderer/gallery suite passes. The root suite has 87/89 passing tests; +the same two pre-existing loader/syscall-format and watch/string assertions fail +(25/27 debugger tests). No assertions were weakened. The canvas still lacks a +native accessibility tree, and raw hardware Mouse4/5 injection was not tested. -A separate UI agent compared rendered C and V8 frames against the existing -animation design, checked strike/highlight/settled frames, and approved the -final native window. The checked-in GUI test asserts that the stack highlight -changes between strike and settled screenshots, as well as exercising controls. +## Final interactive stop -At 2240×1260, an approximate headless redraw measurement was **3.55 ms/frame -for C and 4.28 ms/frame for V8**, including source/disassembly, registers, -stack, memory and cached content minimaps. `gui/bench/redraw.py` subtracts the -median elapsed time of 30-frame runs from 330-frame runs (three repeats each), -then divides by 300. Both opened their corresponding source-enabled 1,000-step recording; -this is a whole-view cost, not an equal-row renderer comparison. It excludes -live trace reopening and display presentation latency. Raw timings are in -`/tmp/ztrace-gui-redraw-source.json`. The previous, smaller 1920×1080 view measured -1.23 / 2.41 ms/frame for C / V8. +The native GUI remains open with d8 PID 2639255 in Linux tracing-stop state at +`Deoptimizer::New+4`, RIP `0x7fa19dbe3f74`, on native source line 290. +Its `rdx = 0x7fa1e0000ffa` matches the normal `jitWork` TurboFan wrong-map exit's +return PC exactly. The retained JS context is the guard at `0x7fa1e0000c14`, +`jit.js:3`, not the shared exit stub's line 5. -The complete animation gallery and shared renderer tests passed after the -library changes. Existing applications retain their organization: the GUI uses -shared source preparation/alignment, row drawing, address hit geometry and -minimap drawing instead of maintaining a second renderer. +GUI PID 2639214; recording +`/tmp/ztrace-gui-2639214-392301809642450.ztrace`, moment 8. +This session used ordinary default tiering and symbolic native breakpoints. +The complete fallback transition was verified separately by the benchmark above, +so the interactive target can remain at the requested deoptimization entry. -The final native window was independently approved with debug d8 PID 2536162 -in Linux tracing-stop state at breakpoint 1, RIP `0x7f6ee00001a2`: `jbe`, offset -`0x162` inside TurboFan-generated `jitWork`, mapped by V8's line table to the -body at `gui/targets/jit.js:6`. Both the source-to-PC and branch-to-target arrows -are visible. The GUI remains open. The recording is -`/tmp/ztrace-gui-2536121-364024192152453.ztrace`; the screenshot is -`/tmp/ztrace-v8-final-reviewed.png`. Addresses and PIDs identify this session -only. Other test windows were closed. +The independent native review passed after exercising graph/source toggling, +all four opacity settings, and Follow. It restored source/live/follow at 100% +without executing the target. Screenshot: +`/tmp/ztrace-ui-review/native-final-reviewed.jpg`. Native font-shortcut injection +was unavailable through the automation tool's punctuation grammar; the actual +headless key handler passed the nine size/zoom combinations. |
