Repository navigation
Format AutoAssertMaybeEventsDisallowed's message only when asserting - #190
Merged
Andarist merged 1 commit intoOct 23, 2026
Merged
Conversation
The scope formatted its message into a heap-allocated string even when not recording or replaying, where it never asserts, so every Atomics.wait and Atomics.waitAsync paid for a vsnprintf and an allocation. It now returns before formatting when there are no asserts; whether there are is fixed once recording or replaying starts, so the destructor still asserts exactly when the constructor did. Not recording, a million not-equal Atomics.wait calls on the main thread went from 2196 to 1476 user-space instructions per call (perf stat), and Atomics.waitAsync from 5414 to 4693.
Andarist
added a commit
that referenced
this pull request
Nov 6, 2026
Add the v8::recordreplay public API class with methods for recording state, event control, pointer registration, ordered locks, and the C API bridge functions and driver symbol loading in api.cc. Add include/replayio.h with RAII helpers (AutoPassThroughEvents, AutoDisallowEvents with an optional label, AutoMarkReplayCode) and include/replayio-macros.h with REPLAY_ASSERT macros usable from C. Asserts are skipped when the driver disables them, warnings go through RecordReplayWarning, and progress notifications are ignored while events are disallowed. When JS progress asserts are enabled, progress data is handed to the recorder through its assert data callbacks. The driver can disable individual features at runtime, so IsRecordingOrReplaying() takes an optional feature name and FeatureEnabled() asks the driver, with the check skipped entirely when nothing is disabled. replayio-macros.h also declares RecordReplayWarningField, the driver's layout for one typed detail of a warning (a string, integer, double or bool under a key), and the V8RecordReplayWarning entry point that takes a warning kind plus an array of those fields. The scope helpers and the rest of the C++ surface live here too: AutoAssertMaybeEventsDisallowed, which asserts its message on entry and exit so the recording orders the scope unless events are disallowed, AutoOrderedLock, and AreEventsPassedThrough(), each defined next to the driver symbol it calls. Rebase note: these headers mirror the driver's ABI. Every driver function is looked up by name in api.cc, so a new recordreplay:: method needs its symbol loaded there, and RecordReplayWarningField's layout and the V8RecordReplay* signatures have to match the driver that REPLAY_BACKEND_REV pins. Includes later changes from #128, #129, #132, #137, #159, #161, #162, #170, #173, #190, #191 and #202. Co-authored-by: Domi <Domiii@users.noreply.github.com> Co-authored-by: Mateusz Burzyński <mateuszburzynski@gmail.com> Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Andarist
added a commit
that referenced
this pull request
Nov 6, 2026
Add the v8::recordreplay public API class with methods for recording state, event control, pointer registration, ordered locks, and the C API bridge functions and driver symbol loading in api.cc. Add include/replayio.h with RAII helpers (AutoPassThroughEvents, AutoDisallowEvents with an optional label, AutoMarkReplayCode) and include/replayio-macros.h with REPLAY_ASSERT macros usable from C. Asserts are skipped when the driver disables them, warnings go through RecordReplayWarning, and progress notifications are ignored while events are disallowed. When JS progress asserts are enabled, progress data is handed to the recorder through its assert data callbacks. The driver can disable individual features at runtime, so IsRecordingOrReplaying() takes an optional feature name and FeatureEnabled() asks the driver, with the check skipped entirely when nothing is disabled. replayio-macros.h also declares RecordReplayWarningField, the driver's layout for one typed detail of a warning (a string, integer, double or bool under a key), and the V8RecordReplayWarning entry point that takes a warning kind plus an array of those fields. The scope helpers and the rest of the C++ surface live here too: AutoAssertMaybeEventsDisallowed, which asserts its message on entry and exit so the recording orders the scope unless events are disallowed, AutoOrderedLock, and AreEventsPassedThrough(), each defined next to the driver symbol it calls. Rebase note: these headers mirror the driver's ABI. Every driver function is looked up by name in api.cc, so a new recordreplay:: method needs its symbol loaded there, and RecordReplayWarningField's layout and the V8RecordReplay* signatures have to match the driver that REPLAY_BACKEND_REV pins. Includes later changes from #128, #129, #132, #137, #159, #161, #162, #170, #173, #190, #191 and #202. Co-authored-by: Domi <Domiii@users.noreply.github.com> Co-authored-by: Mateusz Burzyński <mateuszburzynski@gmail.com> Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Andarist
pushed a commit
that referenced
this pull request
Nov 6, 2026
Add the v8::recordreplay public API class with methods for recording state, event control, pointer registration, ordered locks, and the C API bridge functions and driver symbol loading in api.cc. Add include/replayio.h with RAII helpers (AutoPassThroughEvents, AutoDisallowEvents with an optional label, AutoMarkReplayCode) and include/replayio-macros.h with REPLAY_ASSERT macros usable from C. Asserts are skipped when the driver disables them, warnings go through RecordReplayWarning, and progress notifications are ignored while events are disallowed. When JS progress asserts are enabled, progress data is handed to the recorder through its assert data callbacks. The driver can disable individual features at runtime, so IsRecordingOrReplaying() takes an optional feature name and FeatureEnabled() asks the driver, with the check skipped entirely when nothing is disabled. replayio-macros.h also declares RecordReplayWarningField, the driver's layout for one typed detail of a warning (a string, integer, double or bool under a key), and the V8RecordReplayWarning entry point that takes a warning kind plus an array of those fields. The scope helpers and the rest of the C++ surface live here too: AutoAssertMaybeEventsDisallowed, which asserts its message on entry and exit so the recording orders the scope unless events are disallowed, AutoOrderedLock, and AreEventsPassedThrough(), each defined next to the driver symbol it calls. Rebase note: these headers mirror the driver's ABI. Every driver function is looked up by name in api.cc, so a new recordreplay:: method needs its symbol loaded there, and RecordReplayWarningField's layout and the V8RecordReplay* signatures have to match the driver that REPLAY_BACKEND_REV pins. Includes later changes from #128, #129, #132, #137, #159, #161, #162, #170, #173, #190, #191 and #202. Co-authored-by: Domi <Domiii@users.noreply.github.com> Co-authored-by: Mateusz Burzyński <mateuszburzynski@gmail.com> Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Andarist
pushed a commit
that referenced
this pull request
Nov 6, 2026
Add the v8::recordreplay public API class with methods for recording state, event control, pointer registration, ordered locks, and the C API bridge functions and driver symbol loading in api.cc. Add include/replayio.h with RAII helpers (AutoPassThroughEvents, AutoDisallowEvents with an optional label, AutoMarkReplayCode) and include/replayio-macros.h with REPLAY_ASSERT macros usable from C. Asserts are skipped when the driver disables them, warnings go through RecordReplayWarning, and progress notifications are ignored while events are disallowed. When JS progress asserts are enabled, progress data is handed to the recorder through its assert data callbacks. The driver can disable individual features at runtime, so IsRecordingOrReplaying() takes an optional feature name and FeatureEnabled() asks the driver, with the check skipped entirely when nothing is disabled. replayio-macros.h also declares RecordReplayWarningField, the driver's layout for one typed detail of a warning (a string, integer, double or bool under a key), and the V8RecordReplayWarning entry point that takes a warning kind plus an array of those fields. The scope helpers and the rest of the C++ surface live here too: AutoAssertMaybeEventsDisallowed, which asserts its message on entry and exit so the recording orders the scope unless events are disallowed, AutoOrderedLock, and AreEventsPassedThrough(), each defined next to the driver symbol it calls. Rebase note: these headers mirror the driver's ABI. Every driver function is looked up by name in api.cc, so a new recordreplay:: method needs its symbol loaded there, and RecordReplayWarningField's layout and the V8RecordReplay* signatures have to match the driver that REPLAY_BACKEND_REV pins. Includes later changes from #128, #129, #132, #137, #159, #161, #162, #170, #173, #190, #191 and #202. Co-authored-by: Domi <Domiii@users.noreply.github.com> Co-authored-by: Mateusz Burzyński <mateuszburzynski@gmail.com> Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The scope formatted its message into a heap-allocated string even when not recording or replaying, where it never asserts, so every Atomics.wait and Atomics.waitAsync paid for a vsnprintf and an allocation. It now returns before formatting when there are no asserts; whether there are is fixed once recording or replaying starts, so the destructor still asserts exactly when the constructor did.
Not recording, a million not-equal Atomics.wait calls on the main thread went from 2196 to 1476 user-space instructions per call (perf stat), and Atomics.waitAsync from 5414 to 4693.