summaryrefslogtreecommitdiff
path: root/gui/bench/RESULTS.md
blob: af161758eed885c91530ca302bd209c0a6fa9136 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
# Natural V8 deoptimization and stepping measurements

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 \
  --source /tmp/computeranim-v8-source --out /tmp/ztrace-natural-bench-final
```

| 1,000 steady instruction steps | C | Debug V8 / TurboFan JS |
| --- | ---: | ---: |
| 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 |

`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.

## Verified transition

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.

| Transition stop | Capture + flush | Entire command |
| --- | ---: | ---: |
| 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 |

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.

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.

## Source and build provenance

- Remote: `chaincli-box`, `/home/goblin/v8-research/v8`.
- Revision: `84703f702dca525edd469f3a98d784faa46a02f8`.
- 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`.
- 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/
```

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.

## Verification

`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.

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.

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.

## Final interactive stop

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.

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 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.

## Native zoom and restart follow-up

The original headless size tests missed a native resize feedback loop: `canvas()`
also changes the window dimensions. Dividing the window size by font zoom and
passing it back to `canvas()` repeatedly enlarged the window when zoomed out.
The GUI now keeps the canvas at the actual window size and scales drawing,
clipping and pointer coordinates independently. No renderer-library changes were
needed. `test/restart.py --native` verifies the actual SDL window/backing stays
800×700 through 60–200% zoom and repeated zoom key presses, including scaled
button hits and tiny-overlay lens close controls. Headless checks run in the GUI
suite; native checks are explicit because they require a display.

Restart is available through the toolbar arrow, Shift-r, and `restart`. Tests
cover exited, running and stopped targets; each launch creates a fresh recording,
retains the same executable/arguments, and leaves no previous target running.
Breakpoints and JIT symbols reset because process addresses may change.

The reboot cleared the historical `/tmp` artifacts listed above. The same V8
revision's runtime, source and all split DWARF artifacts have been restored into
`.ws/v8-debug/`, an ignored persistent workspace cache. Historical timing results
remain as reported; the fresh UI regression does not remeasure V8 stepping cost.

## Executable lenses, memory formats and popup rendering

Executable mappings now open shared disassembly rows in lenses. Wheel browsing
keeps the original focus bright and surrounding rows dim; Shift-wheel scrolls
the chain. Live lenses fetch bounded windows; historical lenses never request
current bytes. Right-click sends stack mappings to stack and other addresses to
memory. Memory controls render little-endian 1/2/4/8-byte values in hexadecimal,
unsigned, signed and floating-point forms. Matching addresses use shared,
staggered background highlights instead of cross-pane arrows.

Native review caught two issues before completion: the backdrop initially ran
only in headless capture, and full-precision 64-bit floats exceeded their column
width. The shared host now uses a native GPU canvas plus one reused lens snapshot;
float columns reserve enough room for extreme positive and negative values.
The final popup keeps an opaque reading surface and limits refraction to a
16-pixel edge band, following the user's readability feedback.

Verification: GUI suite (including `test/lenses.py`), shared-renderer suite,
independent native lens/format review, native restart tests and repeated 60–200%
zoom with open lenses. Window/backing sizes stayed fixed. The native review used
DBL_MAX/DBL_MIN and signed/unsigned 64-bit extrema, not only small sample values.
The renderer dependency is Sketchbook `409c1ac`; unrelated pending work in that
checkout was preserved. V8 stepping/capture timings were not remeasured for these
rendering-only changes.

Final live session after the opaque-popup change: GUI PID17379, d8 PID17420,
recording `/tmp/ztrace-gui-17379-8471380224093.ztrace`. Generated wrong-map exit
`0x7f4c80c01fb6` was captured before continuing to `Deoptimizer::New+4` at
`0x7f4ce1be3f74` (`deoptimizer.cc:290`). Its `rdx` was exactly
`0x7f4c80c01fba`, the printed wrong-map return for the naturally optimized
`jitWork`. Origin context and the executable lens use guard `0x7f4c80c01bd4`.
The target remains stopped; lens inspection only captures bytes and instructions.

Hexdump pointer follow-up: shared byte/grouped-integer rows now expose the full
pointer span to both mouse buttons, including 8-bit display and zero padding.
Native/headless checks cover 8/16/32/64-bit groups, recursive byte-view lenses,
and a stack pointer stored in data. GUI and shared-renderer suites pass.
The updated native session (GUI20122, d8 20207) remains at `Deoptimizer::New+4`
`0x7f24dbbe3f74`, with wrong-map origin `0x7f247ac00ffa` and JS guard
`0x7f247ac00c14`; recording `/tmp/ztrace-gui-20122-9224949592653.ztrace`.
A native 8-bit hexdump click opened the saved-stack-pointer lens successfully.

Stack offsets now expose their storage addresses to the shared hover/click path.
Hex bytes no longer have persistent group backgrounds. Disassembly brackets link
simple 64-bit effective addresses, including LEA, only from registers at the
selected moment's PC; RIP-relative and absolute addresses also work on other rows.
The shared renderer suppresses links when the complete bracket is not displayed.
Native and headless checks cover hover, both buttons, indexed operands, future
register operands staying inactive, and historical inspection. The GUI suite
passes with `-j1`; the shared-renderer suite exits successfully, including gallery
comparisons (its usual headless Vulkan warnings remain). Independent code and
screenshot review found no blocking issues. V8 timings were not remeasured.

Reloaded live session: GUI25666, d8 25705, recording
`/tmp/ztrace-gui-25666-14341833166407.ztrace`. The target is stopped at
`Deoptimizer::New+4`, `0x7f99e5be3f74`, on `deoptimizer.cc:290`.
`rdx = 0x7f9984c00ffa` exactly matches the naturally optimized `jitWork` wrong-map
exit return; originating JS context uses guard `0x7f9984c00c14` at `jit.js:3`.