perf(intl): Segments view — one realm record for the test proof, fixed-slot cursor fields, no duplicate pointer validation - #9917
Conversation
|
Warning Review limit reachedNext included review available in 38 minutes. View limit detailsLimit details: You’ve used all 8 included reviews currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Review configuration: ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Team Run ID: 📒 Files selected for processing (6)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
jdalton
left a comment
There was a problem hiding this comment.
Review of 5b7c4fa94d879a1643fdcf0da4410b561a4edf04 (2026-09-07).
The direct cursor slots and one-time UTF-8 validation rely on a clear write-once input invariant. The runtime observability change deserves a follow-up before using this to validate #9843: report_segview_counters is removed, but product builds still increment the atomics under PERRY_SEGVIEW_DIAG; only #[cfg(test)] counters() reads a subset. Compiler rewrite counts do not prove that the runtime accepted a cursor rather than declining it. Please wire a runtime summary into the existing reporting path (with accepted/declined and next counts), or remove the product-only counter work and explicitly limit the claims to compile-time admission. An end-to-end liveness assertion should check that accepted opens and nexts are nonzero.
Validation scope: source/diff inspection; I have not run this PR's build or test suite locally.
5b7c4fa to
b737697
Compare
Stacked on #9893 (
perf/segview-levers@ f076656). Three runtime-only commits, written by codex from the segmenter lane's per-call read list, not yet compiled (the dev box was out of disk); gates and measurement run on perrymaster and will be appended here.What changes, per commit
5f6a21734— the recordedRegExp.prototype.testproof becomes oneCanonicalTestSiteTLS record (prototype pointer, canonical NaN-boxed closure, field index) instead of three TLS slots; both roots stay GC-visited (visit_atomic_i64_slot/visit_atomic_nanbox_u64_slot). The per-callmay_have_descriptor_entry(proto, "test", true)(registry probe +key_bytes_hash+ Bloom load) becomes one(*meta).accessor_key_bitsload against a compile-time FNV-1a mask;object_static_prototype_known_non_metareads theOBJECT_PROTOTYPES_NONEMPTYlatch first.b94c586a7—regexp_test_str_boundedno longer re-validates the regex pointer its only caller already validated.5b7c4fa94— the cursor's numeric fields are read through fixed slots (CursorFields, one base per entry) and_nextwrites slots 1–4 through a number-only store with no barrier.Unchanged by design:
with_input's per-entry re-derivation of the input (the §9a rooting contract) andutf16_len's second pass.Why
On the current best bundle (I7-view)
js_segments_view_regexp_testis 6.8 % of the thread inclusive, dominated by property loads (js_object_get_field2.3 %,object_static_prototype1.2 %) and TLS reads;js_object_set_fieldfor the cursor's four integers was 1.6 %. The match itself is 0.8 %.Tests (named; sabotage stated in each)
an_accessor_installed_after_recording_makes_the_next_call_decline,a_patched_prototype_test_declines_on_the_next_call,canonicality_proof_walks_once_per_realm_not_once_per_call,bounded_regex_test_does_not_repeat_entry_pointer_validation,cursor_position_fields_are_never_pointer_typed.Gates
Run: rustfmt,
git diff --check,scripts/gc_runtime_root_holders.py(pass),scripts/check_file_size.sh(pass). Not run (disk):cargo build --release -p perrydefault features,nmfor the exported symbols, the runtime suite, the five tests above. Draft until they run.Gate history
5b7c4fa94on perrymaster (archives stamped af9227369):cargo build --release -p perryrc=0; the archive feature set (--features perry-runtime/wasm-host) rc=0 withT js_regexp_testand the five view symbols present;RUST_TEST_THREADS=1 cargo test --release -p perry-runtime --lib -- --test-threads=1: 3230 passed, 0 failed, 4 ignored. Named tests green:an_accessor_installed_after_recording_makes_the_next_call_decline,a_patched_prototype_test_declines_on_the_next_call,canonicality_proof_walks_once_per_realm_not_once_per_call,bounded_regex_test_does_not_repeat_entry_pointer_validation,cursor_position_fields_are_never_pointer_typed, and the 13view_mode_tests. Next: the I8-view relink on I7-view's cache (identity byobjdumpcall-site counts 20/10), the probe compile, then rows vs I7-view. Stays draft until the rows are on this PR.Measured (perrymaster, quiet box load 1.1–1.3, 5-round paired rotation vs the best bundle I7-view; both arms in the same rotation)
3300-char turn CPU: −2.4 / −5.2 / −4.0 / −3.0 / −3.3 % (faster 5/5) — I7-view 2.97–3.06 s, this arm 2.88–2.92 s. 400-char turn: 0 / 0 %. Peak RSS within ±1 %; settled after idle +6 MB at 3300, +1 MB at 400. Identity from the artefact: view call sites next/open 20/10 on both arms (the fixed-slot reads change what the runtime does inside the same entry points).
Note: the rig's absolute times drifted ≈ +33 % between the earlier I7-view rows (2.23–2.35 s) and this rotation; the pair above is inside one rotation and holds, the absolutes are under investigation (mock home growth suspected).
Rebased onto main (2026-09-07)
The base PRs this branch was stacked on landed on main via merge train #9922, so the branch was rebased onto current main: head
5b7c4fa94→b73769735, replay patch-identical (only this branch's own commits remain above main). The measurements above were taken on the pre-rebase head with the same code; CI on this head is the remaining gate.Local gates on the rebased head (macOS arm64, 2026-09-09): perry-codegen tests 1,45x passed / 0 failed; runtime lib suite one thread 3,26x passed / 0 failed / 4 ignored;
cargo build --release -p perry-runtime --features wasm-hostok. Un-drafted under the local-verification rule (GitHub runners unavailable); the Linux ladder on perrymaster follows as confirmation.https://claude.ai/code/session_011dhBmdn4vGgNibjo3oZqTo