GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Port GC changes by Andarist · Pull Request #212 · replayio/node

Conversation

@Andarist

@Andarist Andarist commented Oct 30, 2026

Copy link
Copy Markdown
Member

Ports the GC parts of replayio/chromium-v8#354 and replayio/chromium-v8#364, plus the node platform support they need (worker threads that record nothing for GC jobs; the GC's main-thread tasks at the next event loop iteration). Cases: replayio/backend branch claude/node-gc-upstream-cases

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Andarist and others added 3 commits October 29, 2026 18:55
@Andarist @claude
Run V8's incremental marking and memory reducer as upstream when reco…
d8f7710
…rding/replaying

Port of the GC parts of replayio/chromium-v8#354 and of
replayio/chromium-v8#364, in the state they have on chromium-v8's master.

* Use incremental marking when replaying too, not only when recording.

* Tie the GC changes to the v8-flags-gc feature (gRecordReplayEnableGCFeatures).
  With it disabled, incremental marking is off when recording and replaying,
  and the old generation expands where incremental marking would have
  started, as when replaying before.

* Run V8's memory reducer when recording/replaying. Whether it asks for its
  timer depends on the GC's history, which differs between recording and
  replaying, and it often asks with events disallowed. The request is
  remembered and the timer posted at the next point which replays, if the
  recording had a request and no posted timer is pending: after the timer
  task, after a context disposal, or at a progress interrupt, which every
  request triggers when recording (nodejs#364; the driver side,
  replayio/backend#13594, is already in REPLAY_BACKEND_REV). The timer task
  runs with events disallowed, only acts when the reducer is waiting, and
  runs a full GC instead of starting idle incremental marking, whose tasks
  node's platform drops. It is no longer marked non-deterministic, so the
  platform runs it.

* Only run API interrupt callbacks at progress interrupts with the
  "interrupts" feature enabled, as the memory reducer triggers progress
  interrupts too.

The Sparkplug parts of nodejs#354 were ported as #206 and
#207. Concurrent and parallel GC stay disabled here: node's
platform can't run the GC's jobs yet (next commit).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@Andarist @claude
Use concurrent and parallel GC when recording/replaying
67b4f82
The rest of "Use concurrent, parallel and incremental GC when replaying"
from replayio/chromium-v8#354. Chromium's fork had them on when recording
already; node had them off in both, as its platform couldn't run the GC's
jobs: the GC posts them with events disallowed, at points which don't
replay, and DefaultJobState::NotifyConcurrencyIncrease dropped those.

Chromium's base runs tasks posted with events disallowed on a fixed-size
thread group whose threads run with events disallowed. NodePlatform gets
the same when recording/replaying: an unordered WorkerThreadsTaskRunner of
4 threads, on a task queue with a plain lock, which CallOnWorkerThread uses
while events are disallowed. Its threads are created at startup, where
creating threads replays (creating them with events disallowed calls
getrlimit with events disallowed, which fails the replay), disallow events
for their whole run, and are never joined.

A job created with events disallowed posts its workers with events
disallowed, so they go there too. Other jobs still don't add workers with
events disallowed.

With v8-flags-gc disabled, the flags stay off as before.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@Andarist @claude
Run the GC's foreground tasks at the next event loop iteration when r…
6a3927a
…ecording/replaying

V8 marks the tasks the GC posts to the isolate's thread (incremental
marking, scavenge and sweeping tasks) as non-deterministic: they are
posted at points which don't replay. Node's platform dropped them when
recording/replaying, so incremental marking only advanced as the program
allocated. One left running when a program went idle never finished, and
the memory reducer's timer then couldn't start its GC either ("waiting for
8000 ms" again, with 34 MB marked on background threads): with
--optimize-for-size, an idle recording's heap shrank in 3 of 4 runs.

Chromium's fork runs such tasks with its next task. Node's platform now
queues them and runs them with events disallowed at the next event loop
iteration, from a check handle, which happens at the same point when
replaying. The incremental marking and scavenge tasks are enabled again
with v8-flags-gc.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@Andarist Andarist mentioned this pull request Oct 30, 2026
Don't mark the memory reducer's timer task non-deterministic replayio/chromium-v8#376
Merged
Andarist added a commit to replayio/chromium-v8 that referenced this pull request Oct 30, 2026
@Andarist @claude
Don't mark the memory reducer's timer task non-deterministic (#376)
a2a070a
Since #364 the timer is only posted at points which
replay, and the task must run at one too: after it runs,
RecordReplayPostRequestedTimer records the next timer's delay, which it
skips with events disallowed. Chromium's platform never reads the mark,
so this changes nothing here; it matches the node port (replayio/node#212),
whose platform does read it and would stop the timer chain.

Co-authored-by: Claude Opus 5.5 <[email protected]>
@Andarist
Andarist merged commit 790e4fe into master Oct 30, 2026
2 of 3 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@Andarist
Andarist deleted the andarist/gc-upstream-when-recording branch October 30, 2026 15:35
Andarist added a commit to replayio/chromium that referenced this pull request Oct 31, 2026
@Andarist
Roll v8 a2e99099884e backend 90296fda8b3f (#1613)
728bdaf
* Roll V8 to a2e99099884e

V8: 60a0a8a680ff..a2e99099884e, which brings in:
- replayio/chromium-v8#376: the memory reducer's timer task is no longer
  marked non-deterministic (no change for Chromium, whose platform never
  reads the mark; matches replayio/node#212)
- replayio/chromium-v8#377: starting the CPU profiler invalidates the
  recording, so a page profiled through the DevTools Profiler domain no
  longer fails to replay at the profiler thread's pthread_kill

* Update REPLAY_BACKEND_REV to 90296fda8b3f
@Andarist Andarist mentioned this pull request Nov 2, 2026
Update REPLAY_BACKEND_REV to 65ef33b21a67 #219
Merged
Andarist added a commit that referenced this pull request Nov 2, 2026
@Andarist @claude
Update REPLAY_BACKEND_REV to 65ef33b21a67 (#219)
2de6548
Picks up replayio/backend#13690, which finds replay locks and answers
whether a mutex is ordered without taking a process-wide mutex on every
intercepted pthread lock call. With the parallel GC markers from #212,
replaying gc/long-full-gc-ephemeron-chain spent most of its time there and
took 32-36 s, past the case's 30 s budget; it now takes 20-22 s.

Co-authored-by: Claude Opus 5.5 <[email protected]>
bhackett1024 pushed a commit that referenced this pull request Nov 5, 2026
@Andarist
Enable old space GC when recording/replaying
04bde5f
Stop skipping mark-compact collections and forcing --never-compact, and
use incremental, concurrent and parallel GC on both sides, tied to the
v8-flags-gc feature. The GC, sweeping, memory pressure, teardown and
background allocation paths run with events disallowed; a background
allocation never triggers a GC while replaying; Managed<T> destructors
are deferred to Isolate::ReleaseSharedPtrs; WasmCode is kept alive
forever; and the eval cache is off while the compilation cache is only
used when recording, since major GCs age their entries out. The flags
record/replay forces are applied again after every
V8::SetFlagsFromString, and FlagList::Hash records its hash on first
read and replays it.

Node's platform gains an unordered worker runner of four threads which
run with events disallowed and are never joined, used by
CallOnWorkerThread while events are disallowed, so the GC's jobs can
run. Foreground tasks V8 marks non-deterministic are queued and run with
events disallowed from a check handle at the next event loop iteration,
a point which replays, and the memory reducer's timer request is
remembered and posted at the next such point.

Rebase note: every GC, sweeping and teardown entry point must run with
events disallowed, and nothing the GC posts may reach the recorded
thread at a point that doesn't replay: new non-deterministic tasks go to
the unordered runner or the check handle. Flags record/replay needs
belong in RecordReplayApplyFlagOverrides, which runs again after every
run-time flag change.

From #161 and #212.

Co-authored-by: Brian Hackett <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist added a commit that referenced this pull request Nov 6, 2026
@Andarist @bhackett1024 @claude
Enable old space GC when recording/replaying
70a04e9
Stop skipping mark-compact collections and forcing --never-compact, and
use incremental, concurrent and parallel GC on both sides, tied to the
v8-flags-gc feature. The GC, sweeping, memory pressure, teardown and
background allocation paths run with events disallowed; a background
allocation never triggers a GC while replaying; Managed<T> destructors
are deferred to Isolate::ReleaseSharedPtrs; WasmCode is kept alive
forever; and the eval cache is off while the compilation cache is only
used when recording, since major GCs age their entries out. The flags
record/replay forces are applied again after every
V8::SetFlagsFromString, and FlagList::Hash records its hash on first
read and replays it.

Node's platform gains an unordered worker runner of four threads which
run with events disallowed and are never joined, used by
CallOnWorkerThread while events are disallowed, so the GC's jobs can
run. Foreground tasks V8 marks non-deterministic are queued and run with
events disallowed from a check handle at the next event loop iteration,
a point which replays, and the memory reducer's timer request is
remembered and posted at the next such point.

Rebase note: every GC, sweeping and teardown entry point must run with
events disallowed, and nothing the GC posts may reach the recorded
thread at a point that doesn't replay: new non-deterministic tasks go to
the unordered runner or the check handle. Flags record/replay needs
belong in RecordReplayApplyFlagOverrides, which runs again after every
run-time flag change.

From #161 and #212.

Co-authored-by: Brian Hackett <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist added a commit that referenced this pull request Nov 6, 2026
@Andarist @bhackett1024 @claude
Enable old space GC when recording/replaying
89a8361
Stop skipping mark-compact collections and forcing --never-compact, and
use incremental, concurrent and parallel GC on both sides, tied to the
v8-flags-gc feature. The GC, sweeping, memory pressure, teardown and
background allocation paths run with events disallowed; a background
allocation never triggers a GC while replaying; Managed<T> destructors
are deferred to Isolate::ReleaseSharedPtrs; WasmCode is kept alive
forever; and the eval cache is off while the compilation cache is only
used when recording, since major GCs age their entries out. The flags
record/replay forces are applied again after every
V8::SetFlagsFromString, and FlagList::Hash records its hash on first
read and replays it.

Node's platform gains an unordered worker runner of four threads which
run with events disallowed and are never joined, used by
CallOnWorkerThread while events are disallowed, so the GC's jobs can
run. Foreground tasks V8 marks non-deterministic are queued and run with
events disallowed from a check handle at the next event loop iteration,
a point which replays, and the memory reducer's timer request is
remembered and posted at the next such point.

Rebase note: every GC, sweeping and teardown entry point must run with
events disallowed, and nothing the GC posts may reach the recorded
thread at a point that doesn't replay: new non-deterministic tasks go to
the unordered runner or the check handle. Flags record/replay needs
belong in RecordReplayApplyFlagOverrides, which runs again after every
run-time flag change.

From #161 and #212.

Co-authored-by: Brian Hackett <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist added a commit that referenced this pull request Nov 6, 2026
@Andarist @bhackett1024 @claude
Enable old space GC when recording/replaying
5c8f239
Stop skipping mark-compact collections and forcing --never-compact, and
use incremental, concurrent and parallel GC on both sides, tied to the
v8-flags-gc feature. The GC, sweeping, memory pressure, teardown and
background allocation paths run with events disallowed; a background
allocation never triggers a GC while replaying; Managed<T> destructors
are deferred to Isolate::ReleaseSharedPtrs; WasmCode is kept alive
forever; and the eval cache is off while the compilation cache is only
used when recording, since major GCs age their entries out. The flags
record/replay forces are applied again after every
V8::SetFlagsFromString, and FlagList::Hash records its hash on first
read and replays it.

Node's platform gains an unordered worker runner of four threads which
run with events disallowed and are never joined, used by
CallOnWorkerThread while events are disallowed, so the GC's jobs can
run. Foreground tasks V8 marks non-deterministic are queued and run with
events disallowed from a check handle at the next event loop iteration,
a point which replays, and the memory reducer's timer request is
remembered and posted at the next such point.

Rebase note: every GC, sweeping and teardown entry point must run with
events disallowed, and nothing the GC posts may reach the recorded
thread at a point that doesn't replay: new non-deterministic tasks go to
the unordered runner or the check handle. Flags record/replay needs
belong in RecordReplayApplyFlagOverrides, which runs again after every
run-time flag change.

From #161 and #212.

Co-authored-by: Brian Hackett <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist added a commit that referenced this pull request Nov 6, 2026
@Andarist
Enable old space GC when recording/replaying
5d7ab22
Stop skipping mark-compact collections and forcing --never-compact, and
use incremental, concurrent and parallel GC on both sides, tied to the
v8-flags-gc feature. The GC, sweeping, memory pressure, teardown and
background allocation paths run with events disallowed; a background
allocation never triggers a GC while replaying; Managed<T> destructors
are deferred to Isolate::ReleaseSharedPtrs; WasmCode is kept alive
forever; and the eval cache is off while the compilation cache is only
used when recording, since major GCs age their entries out. The flags
record/replay forces are applied again after every
V8::SetFlagsFromString, and FlagList::Hash records its hash on first
read and replays it.

Node's platform gains an unordered worker runner of four threads which
run with events disallowed and are never joined, used by
CallOnWorkerThread while events are disallowed, so the GC's jobs can
run. Foreground tasks V8 marks non-deterministic are queued and run with
events disallowed from a check handle at the next event loop iteration,
a point which replays, and the memory reducer's timer request is
remembered and posted at the next such point.

Rebase note: every GC, sweeping and teardown entry point must run with
events disallowed, and nothing the GC posts may reach the recorded
thread at a point that doesn't replay: new non-deterministic tasks go to
the unordered runner or the check handle. Flags record/replay needs
belong in RecordReplayApplyFlagOverrides, which runs again after every
run-time flag change.

From #161 and #212.

Co-authored-by: Brian Hackett <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist added a commit that referenced this pull request Nov 6, 2026
@Andarist
Enable old space GC when recording/replaying
25bd98e
Stop skipping mark-compact collections and forcing --never-compact, and
use incremental, concurrent and parallel GC on both sides, tied to the
v8-flags-gc feature. The GC, sweeping, memory pressure, teardown and
background allocation paths run with events disallowed; a background
allocation never triggers a GC while replaying; Managed<T> destructors
are deferred to Isolate::ReleaseSharedPtrs; WasmCode is kept alive
forever; and the eval cache is off while the compilation cache is only
used when recording, since major GCs age their entries out. The flags
record/replay forces are applied again after every
V8::SetFlagsFromString, and FlagList::Hash records its hash on first
read and replays it.

Node's platform gains an unordered worker runner of four threads which
run with events disallowed and are never joined, used by
CallOnWorkerThread while events are disallowed, so the GC's jobs can
run. Foreground tasks V8 marks non-deterministic are queued and run with
events disallowed from a check handle at the next event loop iteration,
a point which replays, and the memory reducer's timer request is
remembered and posted at the next such point.

Rebase note: every GC, sweeping and teardown entry point must run with
events disallowed, and nothing the GC posts may reach the recorded
thread at a point that doesn't replay: new non-deterministic tasks go to
the unordered runner or the check handle. Flags record/replay needs
belong in RecordReplayApplyFlagOverrides, which runs again after every
run-time flag change.

From #161 and #212.

Co-authored-by: Brian Hackett <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist added a commit that referenced this pull request Nov 6, 2026
@Andarist
Enable old space GC when recording/replaying
213fa18
Stop skipping mark-compact collections and forcing --never-compact, and
use incremental, concurrent and parallel GC on both sides, tied to the
v8-flags-gc feature. The GC, sweeping, memory pressure, teardown and
background allocation paths run with events disallowed; a background
allocation never triggers a GC while replaying; Managed<T> destructors
are deferred to Isolate::ReleaseSharedPtrs; WasmCode is kept alive
forever; and the eval cache is off while the compilation cache is only
used when recording, since major GCs age their entries out. The flags
record/replay forces are applied again after every
V8::SetFlagsFromString, and FlagList::Hash records its hash on first
read and replays it.

Node's platform gains an unordered worker runner of four threads which
run with events disallowed and are never joined, used by
CallOnWorkerThread while events are disallowed, so the GC's jobs can
run. Foreground tasks V8 marks non-deterministic are queued and run with
events disallowed from a check handle at the next event loop iteration,
a point which replays, and the memory reducer's timer request is
remembered and posted at the next such point.

Rebase note: every GC, sweeping and teardown entry point must run with
events disallowed, and nothing the GC posts may reach the recorded
thread at a point that doesn't replay: new non-deterministic tasks go to
the unordered runner or the check handle. Flags record/replay needs
belong in RecordReplayApplyFlagOverrides, which runs again after every
run-time flag change.

From #161 and #212.

Co-authored-by: Brian Hackett <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist added a commit that referenced this pull request Nov 6, 2026
@Andarist @bhackett1024 @claude
Enable old space GC when recording/replaying
b5aaff0
Stop skipping mark-compact collections and forcing --never-compact, and
use incremental, concurrent and parallel GC on both sides, tied to the
v8-flags-gc feature. The GC, sweeping, memory pressure, teardown and
background allocation paths run with events disallowed; a background
allocation never triggers a GC while replaying; Managed<T> destructors
are deferred to Isolate::ReleaseSharedPtrs; WasmCode is kept alive
forever; and the eval cache is off while the compilation cache is only
used when recording, since major GCs age their entries out. The flags
record/replay forces are applied again after every
V8::SetFlagsFromString, and FlagList::Hash records its hash on first
read and replays it.

Node's platform gains an unordered worker runner of four threads which
run with events disallowed and are never joined, used by
CallOnWorkerThread while events are disallowed, so the GC's jobs can
run. Foreground tasks V8 marks non-deterministic are queued and run with
events disallowed from a check handle at the next event loop iteration,
a point which replays, and the memory reducer's timer request is
remembered and posted at the next such point.

Rebase note: every GC, sweeping and teardown entry point must run with
events disallowed, and nothing the GC posts may reach the recorded
thread at a point that doesn't replay: new non-deterministic tasks go to
the unordered runner or the check handle. Flags record/replay needs
belong in RecordReplayApplyFlagOverrides, which runs again after every
run-time flag change.

From #161 and #212.

Co-authored-by: Brian Hackett <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist added a commit that referenced this pull request Nov 10, 2026
@Andarist @bhackett1024 @claude
Enable old space GC when recording/replaying
bca1515
Stop skipping mark-compact collections and forcing --never-compact, and
use incremental, concurrent and parallel GC on both sides, tied to the
v8-flags-gc feature. The GC, sweeping, memory pressure, teardown and
background allocation paths run with events disallowed; a background
allocation never triggers a GC while replaying; Managed<T> destructors
are deferred to Isolate::ReleaseSharedPtrs; WasmCode is kept alive
forever; and the eval cache is off while the compilation cache is only
used when recording, since major GCs age their entries out. The flags
record/replay forces are applied again after every
V8::SetFlagsFromString, and FlagList::Hash records its hash on first
read and replays it.

Node's platform gains an unordered worker runner of four threads which
run with events disallowed and are never joined, used by
CallOnWorkerThread while events are disallowed, so the GC's jobs can
run. Foreground tasks V8 marks non-deterministic are queued and run with
events disallowed from a check handle at the next event loop iteration,
a point which replays, and the memory reducer's timer request is
remembered and posted at the next such point.

Whether a {Managed}'s GC finalizer leaves its destructor to the isolate's
teardown is exposed as ManagedFinalizersDeferredWhenEventsDisallowed(), so
that code which depends on {Managed} destructors not running at GC time can
ask for it.

Rebase note: every GC, sweeping and teardown entry point must run with
events disallowed, and nothing the GC posts may reach the recorded
thread at a point that doesn't replay: new non-deterministic tasks go to
the unordered runner or the check handle. Flags record/replay needs
belong in RecordReplayApplyFlagOverrides, which runs again after every
run-time flag change.

From #161 and #212.

Co-authored-by: Brian Hackett <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist added a commit that referenced this pull request Nov 10, 2026
@Andarist @bhackett1024 @claude
Enable old space GC when recording/replaying
b96e2e6
Stop skipping mark-compact collections and forcing --never-compact, and
use incremental, concurrent and parallel GC on both sides, tied to the
v8-flags-gc feature. The GC, sweeping, memory pressure, teardown and
background allocation paths run with events disallowed; a background
allocation never triggers a GC while replaying; Managed<T> destructors
are deferred to Isolate::ReleaseSharedPtrs; WasmCode is kept alive
forever; and the eval cache is off while the compilation cache is only
used when recording, since major GCs age their entries out. The flags
record/replay forces are applied again after every
V8::SetFlagsFromString, and FlagList::Hash records its hash on first
read and replays it.

Node's platform gains an unordered worker runner of four threads which
run with events disallowed and are never joined, used by
CallOnWorkerThread while events are disallowed, so the GC's jobs can
run. Foreground tasks V8 marks non-deterministic are queued and run with
events disallowed from a check handle at the next event loop iteration,
a point which replays, and the memory reducer's timer request is
remembered and posted at the next such point.

Whether a {Managed}'s GC finalizer leaves its destructor to the isolate's
teardown is exposed as ManagedFinalizersDeferredWhenEventsDisallowed(), so
that code which depends on {Managed} destructors not running at GC time can
ask for it.

Starting incremental marking in V8 11.3 also starts tracing the C++ heap, and
cppgc posts its own marking, sweeping and deferred-collection tasks, where
V8 10.2 drove the embedder heap through the old tracer and posted nothing.
They are marked the way V8's own GC tasks are, so NodePlatform queues them on
the unordered runner: an unmarked task is recorded instead, and since a GC
task posts it with events disallowed, the recording died on
AssertWithEventsDisallowed in PerIsolatePlatformData::PostTask.

V8 11.3 also turned ComputeFlagListHash into a pure function and made
FlagList::Hash return its cached value early, so the fork's block that takes
the hash from the recording has to wrap upstream's new shape -- compute and
store as it does, then read the hash through the recording -- rather than sit
after that return, where it never ran and both sides hashed their own flags.

Rebase note: every GC, sweeping and teardown entry point must run with
events disallowed, and nothing the GC posts may reach the recorded
thread at a point that doesn't replay: new non-deterministic tasks go to
the unordered runner or the check handle. Flags record/replay needs
belong in RecordReplayApplyFlagOverrides, which runs again after every
run-time flag change.

From #161 and #212.

Co-authored-by: Brian Hackett <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist added a commit that referenced this pull request Nov 10, 2026
@Andarist
Enable old space GC when recording/replaying
47c708a
Stop skipping mark-compact collections and forcing --never-compact, and
use incremental, concurrent and parallel GC on both sides, tied to the
v8-flags-gc feature. The GC, sweeping, memory pressure, teardown and
background allocation paths run with events disallowed; a background
allocation never triggers a GC while replaying; Managed<T> destructors
are deferred to Isolate::ReleaseSharedPtrs; WasmCode is kept alive
forever; and the eval cache is off while the compilation cache is only
used when recording, since major GCs age their entries out. The flags
record/replay forces are applied again after every
V8::SetFlagsFromString, and FlagList::Hash records its hash on first
read and replays it.

Node's platform gains an unordered worker runner of four threads which
run with events disallowed and are never joined, used by
CallOnWorkerThread while events are disallowed, so the GC's jobs can
run. Foreground tasks V8 marks non-deterministic are queued and run with
events disallowed from a check handle at the next event loop iteration,
a point which replays, and the memory reducer's timer request is
remembered and posted at the next such point.

Whether a {Managed}'s GC finalizer leaves its destructor to the isolate's
teardown is exposed as ManagedFinalizersDeferredWhenEventsDisallowed(), so
that code which depends on {Managed} destructors not running at GC time can
ask for it.

Starting incremental marking in V8 11.3 also starts tracing the C++ heap, and
cppgc posts its own marking, sweeping and deferred-collection tasks, where
V8 10.2 drove the embedder heap through the old tracer and posted nothing.
They are marked the way V8's own GC tasks are, so NodePlatform queues them on
the unordered runner: an unmarked task is recorded instead, and since a GC
task posts it with events disallowed, the recording died on
AssertWithEventsDisallowed in PerIsolatePlatformData::PostTask.

V8 11.3 also turned ComputeFlagListHash into a pure function and made
FlagList::Hash return its cached value early, so the fork's block that takes
the hash from the recording has to wrap upstream's new shape -- compute and
store as it does, then read the hash through the recording -- rather than sit
after that return, where it never ran and both sides hashed their own flags.

Rebase note: every GC, sweeping and teardown entry point must run with
events disallowed, and nothing the GC posts may reach the recorded
thread at a point that doesn't replay: new non-deterministic tasks go to
the unordered runner or the check handle. Flags record/replay needs
belong in RecordReplayApplyFlagOverrides, which runs again after every
run-time flag change.

From #161 and #212.

Co-authored-by: Brian Hackett <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist added a commit that referenced this pull request Nov 10, 2026
@Andarist @bhackett1024 @claude
Enable old space GC when recording/replaying
99b7af4
Stop skipping mark-compact collections and forcing --never-compact, and
use incremental, concurrent and parallel GC on both sides, tied to the
v8-flags-gc feature. The GC, sweeping, memory pressure, teardown and
background allocation paths run with events disallowed; a background
allocation never triggers a GC while replaying; Managed<T> destructors
are deferred to Isolate::ReleaseSharedPtrs; WasmCode is kept alive
forever; and the eval cache is off while the compilation cache is only
used when recording, since major GCs age their entries out. The flags
record/replay forces are applied again after every
V8::SetFlagsFromString, and FlagList::Hash records its hash on first
read and replays it.

Node's platform gains an unordered worker runner of four threads which
run with events disallowed and are never joined, used by
CallOnWorkerThread while events are disallowed, so the GC's jobs can
run. Foreground tasks V8 marks non-deterministic are queued and run with
events disallowed from a check handle at the next event loop iteration,
a point which replays, and the memory reducer's timer request is
remembered and posted at the next such point.

Whether a {Managed}'s GC finalizer leaves its destructor to the isolate's
teardown is exposed as ManagedFinalizersDeferredWhenEventsDisallowed(), so
that code which depends on {Managed} destructors not running at GC time can
ask for it.

Starting incremental marking in V8 11.3 also starts tracing the C++ heap, and
cppgc posts its own marking, sweeping and deferred-collection tasks, where
V8 10.2 drove the embedder heap through the old tracer and posted nothing.
They are marked the way V8's own GC tasks are, so NodePlatform queues them on
the unordered runner: an unmarked task is recorded instead, and since a GC
task posts it with events disallowed, the recording died on
AssertWithEventsDisallowed in PerIsolatePlatformData::PostTask.

V8 11.3 also turned ComputeFlagListHash into a pure function and made
FlagList::Hash return its cached value early, so the fork's block that takes
the hash from the recording has to wrap upstream's new shape -- compute and
store as it does, then read the hash through the recording -- rather than sit
after that return, where it never ran and both sides hashed their own flags.

Node 24's V8 adds more non-deterministic posts for the unordered runner -- a
released page pool and a collected inspector context each post a task -- and
two compiler flags belong with the GC's: concurrent_sparkplug, which V8 13.6
turns on by default and whose batch compiler posts from whichever point fills
a batch, and concurrent_recompilation, whose CompileTurbofan_Concurrent CHECKs
that it is never reached while recording or replaying. Scope infos from
previous compiles are not reused when replaying either, since which compile
produced one is not ordered.

Rebase note: every GC, sweeping and teardown entry point must run with
events disallowed, and nothing the GC posts may reach the recorded
thread at a point that doesn't replay: new non-deterministic tasks go to
the unordered runner or the check handle. Flags record/replay needs
belong in RecordReplayApplyFlagOverrides, which runs again after every
run-time flag change.

From #161 and #212.

Co-authored-by: Brian Hackett <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist added a commit that referenced this pull request Nov 10, 2026
@Andarist @bhackett1024 @claude
Enable old space GC when recording/replaying
d76da68
Stop skipping mark-compact collections and forcing --never-compact, and
use incremental, concurrent and parallel GC on both sides, tied to the
v8-flags-gc feature. The GC, sweeping, memory pressure, teardown and
background allocation paths run with events disallowed; a background
allocation never triggers a GC while replaying; Managed<T> destructors
are deferred to Isolate::ReleaseSharedPtrs; WasmCode is kept alive
forever; and the eval cache is off while the compilation cache is only
used when recording, since major GCs age their entries out. The flags
record/replay forces are applied again after every
V8::SetFlagsFromString, and FlagList::Hash records its hash on first
read and replays it.

Node's platform gains an unordered worker runner of four threads which
run with events disallowed and are never joined, used by
CallOnWorkerThread while events are disallowed, so the GC's jobs can
run. Foreground tasks V8 marks non-deterministic are queued and run with
events disallowed from a check handle at the next event loop iteration,
a point which replays, and the memory reducer's timer request is
remembered and posted at the next such point.

Whether a {Managed}'s GC finalizer leaves its destructor to the isolate's
teardown is exposed as ManagedFinalizersDeferredWhenEventsDisallowed(), so
that code which depends on {Managed} destructors not running at GC time can
ask for it.

Starting incremental marking in V8 11.3 also starts tracing the C++ heap, and
cppgc posts its own marking, sweeping and deferred-collection tasks, where
V8 10.2 drove the embedder heap through the old tracer and posted nothing.
They are marked the way V8's own GC tasks are, so NodePlatform queues them on
the unordered runner: an unmarked task is recorded instead, and since a GC
task posts it with events disallowed, the recording died on
AssertWithEventsDisallowed in PerIsolatePlatformData::PostTask.

V8 11.3 also turned ComputeFlagListHash into a pure function and made
FlagList::Hash return its cached value early, so the fork's block that takes
the hash from the recording has to wrap upstream's new shape -- compute and
store as it does, then read the hash through the recording -- rather than sit
after that return, where it never ran and both sides hashed their own flags.

Node 24's V8 adds more non-deterministic posts for the unordered runner -- a
released page pool and a collected inspector context each post a task -- and
two compiler flags belong with the GC's: concurrent_sparkplug, which V8 13.6
turns on by default and whose batch compiler posts from whichever point fills
a batch, and concurrent_recompilation, whose CompileTurbofan_Concurrent CHECKs
that it is never reached while recording or replaying. Scope infos from
previous compiles are not reused when replaying either, since which compile
produced one is not ordered.

Node 26 adds three more of the same kind. Delayed worker tasks are posted
unordered when events are disallowed, since a GC that posts one must not take
the recorded path. Pooled pages are not released on a timer when recording,
because when the timer fires is not ordered. And only the major GC clears weak
references, as node 24's did: node 26 lets the minor GC clear them too, which
makes what is still alive depend on which collector ran.

Rebase note: every GC, sweeping and teardown entry point must run with
events disallowed, and nothing the GC posts may reach the recorded
thread at a point that doesn't replay: new non-deterministic tasks go to
the unordered runner or the check handle. Flags record/replay needs
belong in RecordReplayApplyFlagOverrides, which runs again after every
run-time flag change.

From #161 and #212.

Co-authored-by: Brian Hackett <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist added a commit that referenced this pull request Nov 10, 2026
@Andarist
Enable old space GC when recording/replaying
196c134
Stop skipping mark-compact collections and forcing --never-compact, and
use incremental, concurrent and parallel GC on both sides, tied to the
v8-flags-gc feature. The GC, sweeping, memory pressure, teardown and
background allocation paths run with events disallowed; a background
allocation never triggers a GC while replaying; Managed<T> destructors
are deferred to Isolate::ReleaseSharedPtrs; WasmCode is kept alive
forever; and the eval cache is off while the compilation cache is only
used when recording, since major GCs age their entries out. The flags
record/replay forces are applied again after every
V8::SetFlagsFromString, and FlagList::Hash records its hash on first
read and replays it.

Node's platform gains an unordered worker runner of four threads which
run with events disallowed and are never joined, used by
CallOnWorkerThread while events are disallowed, so the GC's jobs can
run. Foreground tasks V8 marks non-deterministic are queued and run with
events disallowed from a check handle at the next event loop iteration,
a point which replays, and the memory reducer's timer request is
remembered and posted at the next such point.

Whether a {Managed}'s GC finalizer leaves its destructor to the isolate's
teardown is exposed as ManagedFinalizersDeferredWhenEventsDisallowed(), so
that code which depends on {Managed} destructors not running at GC time can
ask for it.

Starting incremental marking in V8 11.3 also starts tracing the C++ heap, and
cppgc posts its own marking, sweeping and deferred-collection tasks, where
V8 10.2 drove the embedder heap through the old tracer and posted nothing.
They are marked the way V8's own GC tasks are, so NodePlatform queues them on
the unordered runner: an unmarked task is recorded instead, and since a GC
task posts it with events disallowed, the recording died on
AssertWithEventsDisallowed in PerIsolatePlatformData::PostTask.

V8 11.3 also turned ComputeFlagListHash into a pure function and made
FlagList::Hash return its cached value early, so the fork's block that takes
the hash from the recording has to wrap upstream's new shape -- compute and
store as it does, then read the hash through the recording -- rather than sit
after that return, where it never ran and both sides hashed their own flags.

Rebase note: every GC, sweeping and teardown entry point must run with
events disallowed, and nothing the GC posts may reach the recorded
thread at a point that doesn't replay: new non-deterministic tasks go to
the unordered runner or the check handle. Flags record/replay needs
belong in RecordReplayApplyFlagOverrides, which runs again after every
run-time flag change.

From #161 and #212.

Co-authored-by: Brian Hackett <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist added a commit that referenced this pull request Nov 10, 2026
@Andarist
Enable old space GC when recording/replaying
0bb0234
Stop skipping mark-compact collections and forcing --never-compact, and
use incremental, concurrent and parallel GC on both sides, tied to the
v8-flags-gc feature. The GC, sweeping, memory pressure, teardown and
background allocation paths run with events disallowed; a background
allocation never triggers a GC while replaying; Managed<T> destructors
are deferred to Isolate::ReleaseSharedPtrs; WasmCode is kept alive
forever; and the eval cache is off while the compilation cache is only
used when recording, since major GCs age their entries out. The flags
record/replay forces are applied again after every
V8::SetFlagsFromString, and FlagList::Hash records its hash on first
read and replays it.

Node's platform gains an unordered worker runner of four threads which
run with events disallowed and are never joined, used by
CallOnWorkerThread while events are disallowed, so the GC's jobs can
run. Foreground tasks V8 marks non-deterministic are queued and run with
events disallowed from a check handle at the next event loop iteration,
a point which replays, and the memory reducer's timer request is
remembered and posted at the next such point.

Whether a {Managed}'s GC finalizer leaves its destructor to the isolate's
teardown is exposed as ManagedFinalizersDeferredWhenEventsDisallowed(), so
that code which depends on {Managed} destructors not running at GC time can
ask for it.

Rebase note: every GC, sweeping and teardown entry point must run with
events disallowed, and nothing the GC posts may reach the recorded
thread at a point that doesn't replay: new non-deterministic tasks go to
the unordered runner or the check handle. Flags record/replay needs
belong in RecordReplayApplyFlagOverrides, which runs again after every
run-time flag change.

From #161 and #212.

Co-authored-by: Brian Hackett <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist added a commit that referenced this pull request Nov 10, 2026
@Andarist
Enable old space GC when recording/replaying
bcbc1db
Stop skipping mark-compact collections and forcing --never-compact, and
use incremental, concurrent and parallel GC on both sides, tied to the
v8-flags-gc feature. The GC, sweeping, memory pressure, teardown and
background allocation paths run with events disallowed; a background
allocation never triggers a GC while replaying; Managed<T> destructors
are deferred to Isolate::ReleaseSharedPtrs; WasmCode is kept alive
forever; and the eval cache is off while the compilation cache is only
used when recording, since major GCs age their entries out. The flags
record/replay forces are applied again after every
V8::SetFlagsFromString, and FlagList::Hash records its hash on first
read and replays it.

Node's platform gains an unordered worker runner of four threads which
run with events disallowed and are never joined, used by
CallOnWorkerThread while events are disallowed, so the GC's jobs can
run. Foreground tasks V8 marks non-deterministic are queued and run with
events disallowed from a check handle at the next event loop iteration,
a point which replays, and the memory reducer's timer request is
remembered and posted at the next such point.

Whether a {Managed}'s GC finalizer leaves its destructor to the isolate's
teardown is exposed as ManagedFinalizersDeferredWhenEventsDisallowed(), so
that code which depends on {Managed} destructors not running at GC time can
ask for it.

Starting incremental marking in V8 11.3 also starts tracing the C++ heap, and
cppgc posts its own marking, sweeping and deferred-collection tasks, where
V8 10.2 drove the embedder heap through the old tracer and posted nothing.
They are marked the way V8's own GC tasks are, so NodePlatform queues them on
the unordered runner: an unmarked task is recorded instead, and since a GC
task posts it with events disallowed, the recording died on
AssertWithEventsDisallowed in PerIsolatePlatformData::PostTask.

V8 11.3 also turned ComputeFlagListHash into a pure function and made
FlagList::Hash return its cached value early, so the fork's block that takes
the hash from the recording has to wrap upstream's new shape -- compute and
store as it does, then read the hash through the recording -- rather than sit
after that return, where it never ran and both sides hashed their own flags.

Rebase note: every GC, sweeping and teardown entry point must run with
events disallowed, and nothing the GC posts may reach the recorded
thread at a point that doesn't replay: new non-deterministic tasks go to
the unordered runner or the check handle. Flags record/replay needs
belong in RecordReplayApplyFlagOverrides, which runs again after every
run-time flag change.

From #161 and #212.

Co-authored-by: Brian Hackett <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist added a commit that referenced this pull request Nov 10, 2026
@Andarist
Enable old space GC when recording/replaying
8b27e6b
Stop skipping mark-compact collections and forcing --never-compact, and
use incremental, concurrent and parallel GC on both sides, tied to the
v8-flags-gc feature. The GC, sweeping, memory pressure, teardown and
background allocation paths run with events disallowed; a background
allocation never triggers a GC while replaying; Managed<T> destructors
are deferred to Isolate::ReleaseSharedPtrs; WasmCode is kept alive
forever; and the eval cache is off while the compilation cache is only
used when recording, since major GCs age their entries out. The flags
record/replay forces are applied again after every
V8::SetFlagsFromString, and FlagList::Hash records its hash on first
read and replays it.

Node's platform gains an unordered worker runner of four threads which
run with events disallowed and are never joined, used by
CallOnWorkerThread while events are disallowed, so the GC's jobs can
run. Foreground tasks V8 marks non-deterministic are queued and run with
events disallowed from a check handle at the next event loop iteration,
a point which replays, and the memory reducer's timer request is
remembered and posted at the next such point.

Whether a {Managed}'s GC finalizer leaves its destructor to the isolate's
teardown is exposed as ManagedFinalizersDeferredWhenEventsDisallowed(), so
that code which depends on {Managed} destructors not running at GC time can
ask for it.

Starting incremental marking in V8 11.3 also starts tracing the C++ heap, and
cppgc posts its own marking, sweeping and deferred-collection tasks, where
V8 10.2 drove the embedder heap through the old tracer and posted nothing.
They are marked the way V8's own GC tasks are, so NodePlatform queues them on
the unordered runner: an unmarked task is recorded instead, and since a GC
task posts it with events disallowed, the recording died on
AssertWithEventsDisallowed in PerIsolatePlatformData::PostTask.

V8 11.3 also turned ComputeFlagListHash into a pure function and made
FlagList::Hash return its cached value early, so the fork's block that takes
the hash from the recording has to wrap upstream's new shape -- compute and
store as it does, then read the hash through the recording -- rather than sit
after that return, where it never ran and both sides hashed their own flags.

Node 24's V8 adds more non-deterministic posts for the unordered runner -- a
released page pool and a collected inspector context each post a task -- and
two compiler flags belong with the GC's: concurrent_sparkplug, which V8 13.6
turns on by default and whose batch compiler posts from whichever point fills
a batch, and concurrent_recompilation, whose CompileTurbofan_Concurrent CHECKs
that it is never reached while recording or replaying. Scope infos from
previous compiles are not reused when replaying either, since which compile
produced one is not ordered.

Rebase note: every GC, sweeping and teardown entry point must run with
events disallowed, and nothing the GC posts may reach the recorded
thread at a point that doesn't replay: new non-deterministic tasks go to
the unordered runner or the check handle. Flags record/replay needs
belong in RecordReplayApplyFlagOverrides, which runs again after every
run-time flag change.

From #161 and #212.

Co-authored-by: Brian Hackett <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist added a commit that referenced this pull request Nov 10, 2026
@Andarist
Enable old space GC when recording/replaying
d0ecbc1
Stop skipping mark-compact collections and forcing --never-compact, and
use incremental, concurrent and parallel GC on both sides, tied to the
v8-flags-gc feature. The GC, sweeping, memory pressure, teardown and
background allocation paths run with events disallowed; a background
allocation never triggers a GC while replaying; Managed<T> destructors
are deferred to Isolate::ReleaseSharedPtrs; WasmCode is kept alive
forever; and the eval cache is off while the compilation cache is only
used when recording, since major GCs age their entries out. The flags
record/replay forces are applied again after every
V8::SetFlagsFromString, and FlagList::Hash records its hash on first
read and replays it.

Node's platform gains an unordered worker runner of four threads which
run with events disallowed and are never joined, used by
CallOnWorkerThread while events are disallowed, so the GC's jobs can
run. Foreground tasks V8 marks non-deterministic are queued and run with
events disallowed from a check handle at the next event loop iteration,
a point which replays, and the memory reducer's timer request is
remembered and posted at the next such point.

Whether a {Managed}'s GC finalizer leaves its destructor to the isolate's
teardown is exposed as ManagedFinalizersDeferredWhenEventsDisallowed(), so
that code which depends on {Managed} destructors not running at GC time can
ask for it.

Starting incremental marking in V8 11.3 also starts tracing the C++ heap, and
cppgc posts its own marking, sweeping and deferred-collection tasks, where
V8 10.2 drove the embedder heap through the old tracer and posted nothing.
They are marked the way V8's own GC tasks are, so NodePlatform queues them on
the unordered runner: an unmarked task is recorded instead, and since a GC
task posts it with events disallowed, the recording died on
AssertWithEventsDisallowed in PerIsolatePlatformData::PostTask.

V8 11.3 also turned ComputeFlagListHash into a pure function and made
FlagList::Hash return its cached value early, so the fork's block that takes
the hash from the recording has to wrap upstream's new shape -- compute and
store as it does, then read the hash through the recording -- rather than sit
after that return, where it never ran and both sides hashed their own flags.

Node 24's V8 adds more non-deterministic posts for the unordered runner -- a
released page pool and a collected inspector context each post a task -- and
two compiler flags belong with the GC's: concurrent_sparkplug, which V8 13.6
turns on by default and whose batch compiler posts from whichever point fills
a batch, and concurrent_recompilation, whose CompileTurbofan_Concurrent CHECKs
that it is never reached while recording or replaying. Scope infos from
previous compiles are not reused when replaying either, since which compile
produced one is not ordered.

Node 26 adds three more of the same kind. Delayed worker tasks are posted
unordered when events are disallowed, since a GC that posts one must not take
the recorded path. Pooled pages are not released on a timer when recording,
because when the timer fires is not ordered. And only the major GC clears weak
references, as node 24's did: node 26 lets the minor GC clear them too, which
makes what is still alive depend on which collector ran.

Rebase note: every GC, sweeping and teardown entry point must run with
events disallowed, and nothing the GC posts may reach the recorded
thread at a point that doesn't replay: new non-deterministic tasks go to
the unordered runner or the check handle. Flags record/replay needs
belong in RecordReplayApplyFlagOverrides, which runs again after every
run-time flag change.

From #161 and #212.

Co-authored-by: Brian Hackett <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist added a commit that referenced this pull request Nov 10, 2026
@Andarist
Enable old space GC when recording/replaying
40cb1be
Stop skipping mark-compact collections and forcing --never-compact, and
use incremental, concurrent and parallel GC on both sides, tied to the
v8-flags-gc feature. The GC, sweeping, memory pressure, teardown and
background allocation paths run with events disallowed; a background
allocation never triggers a GC while replaying; Managed<T> destructors
are deferred to Isolate::ReleaseSharedPtrs; WasmCode is kept alive
forever; and the eval cache is off while the compilation cache is only
used when recording, since major GCs age their entries out. The flags
record/replay forces are applied again after every
V8::SetFlagsFromString, and FlagList::Hash records its hash on first
read and replays it.

Node's platform gains an unordered worker runner of four threads which
run with events disallowed and are never joined, used by
CallOnWorkerThread while events are disallowed, so the GC's jobs can
run. Foreground tasks V8 marks non-deterministic are queued and run with
events disallowed from a check handle at the next event loop iteration,
a point which replays, and the memory reducer's timer request is
remembered and posted at the next such point.

Whether a {Managed}'s GC finalizer leaves its destructor to the isolate's
teardown is exposed as ManagedFinalizersDeferredWhenEventsDisallowed(), so
that code which depends on {Managed} destructors not running at GC time can
ask for it.

Starting incremental marking in V8 11.3 also starts tracing the C++ heap, and
cppgc posts its own marking, sweeping and deferred-collection tasks, where
V8 10.2 drove the embedder heap through the old tracer and posted nothing.
They are marked the way V8's own GC tasks are, so NodePlatform queues them on
the unordered runner: an unmarked task is recorded instead, and since a GC
task posts it with events disallowed, the recording died on
AssertWithEventsDisallowed in PerIsolatePlatformData::PostTask.

V8 11.3 also turned ComputeFlagListHash into a pure function and made
FlagList::Hash return its cached value early, so the fork's block that takes
the hash from the recording has to wrap upstream's new shape -- compute and
store as it does, then read the hash through the recording -- rather than sit
after that return, where it never ran and both sides hashed their own flags.

Rebase note: every GC, sweeping and teardown entry point must run with
events disallowed, and nothing the GC posts may reach the recorded
thread at a point that doesn't replay: new non-deterministic tasks go to
the unordered runner or the check handle. Flags record/replay needs
belong in RecordReplayApplyFlagOverrides, which runs again after every
run-time flag change.

From #161 and #212.

Co-authored-by: Brian Hackett <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist added a commit that referenced this pull request Nov 10, 2026
@Andarist
Enable old space GC when recording/replaying
681e80b
Stop skipping mark-compact collections and forcing --never-compact, and
use incremental, concurrent and parallel GC on both sides, tied to the
v8-flags-gc feature. The GC, sweeping, memory pressure, teardown and
background allocation paths run with events disallowed; a background
allocation never triggers a GC while replaying; Managed<T> destructors
are deferred to Isolate::ReleaseSharedPtrs; WasmCode is kept alive
forever; and the eval cache is off while the compilation cache is only
used when recording, since major GCs age their entries out. The flags
record/replay forces are applied again after every
V8::SetFlagsFromString, and FlagList::Hash records its hash on first
read and replays it.

Node's platform gains an unordered worker runner of four threads which
run with events disallowed and are never joined, used by
CallOnWorkerThread while events are disallowed, so the GC's jobs can
run. Foreground tasks V8 marks non-deterministic are queued and run with
events disallowed from a check handle at the next event loop iteration,
a point which replays, and the memory reducer's timer request is
remembered and posted at the next such point.

Whether a {Managed}'s GC finalizer leaves its destructor to the isolate's
teardown is exposed as ManagedFinalizersDeferredWhenEventsDisallowed(), so
that code which depends on {Managed} destructors not running at GC time can
ask for it.

Starting incremental marking in V8 11.3 also starts tracing the C++ heap, and
cppgc posts its own marking, sweeping and deferred-collection tasks, where
V8 10.2 drove the embedder heap through the old tracer and posted nothing.
They are marked the way V8's own GC tasks are, so NodePlatform queues them on
the unordered runner: an unmarked task is recorded instead, and since a GC
task posts it with events disallowed, the recording died on
AssertWithEventsDisallowed in PerIsolatePlatformData::PostTask.

V8 11.3 also turned ComputeFlagListHash into a pure function and made
FlagList::Hash return its cached value early, so the fork's block that takes
the hash from the recording has to wrap upstream's new shape -- compute and
store as it does, then read the hash through the recording -- rather than sit
after that return, where it never ran and both sides hashed their own flags.

Rebase note: every GC, sweeping and teardown entry point must run with
events disallowed, and nothing the GC posts may reach the recorded
thread at a point that doesn't replay: new non-deterministic tasks go to
the unordered runner or the check handle. Flags record/replay needs
belong in RecordReplayApplyFlagOverrides, which runs again after every
run-time flag change.

From #161 and #212.

Co-authored-by: Brian Hackett <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist added a commit that referenced this pull request Nov 10, 2026
@Andarist
Enable old space GC when recording/replaying
cbef4f0
Stop skipping mark-compact collections and forcing --never-compact, and
use incremental, concurrent and parallel GC on both sides, tied to the
v8-flags-gc feature. The GC, sweeping, memory pressure, teardown and
background allocation paths run with events disallowed; a background
allocation never triggers a GC while replaying; Managed<T> destructors
are deferred to Isolate::ReleaseSharedPtrs; WasmCode is kept alive
forever; and the eval cache is off while the compilation cache is only
used when recording, since major GCs age their entries out. The flags
record/replay forces are applied again after every
V8::SetFlagsFromString, and FlagList::Hash records its hash on first
read and replays it.

Node's platform gains an unordered worker runner of four threads which
run with events disallowed and are never joined, used by
CallOnWorkerThread while events are disallowed, so the GC's jobs can
run. Foreground tasks V8 marks non-deterministic are queued and run with
events disallowed from a check handle at the next event loop iteration,
a point which replays, and the memory reducer's timer request is
remembered and posted at the next such point.

Whether a {Managed}'s GC finalizer leaves its destructor to the isolate's
teardown is exposed as ManagedFinalizersDeferredWhenEventsDisallowed(), so
that code which depends on {Managed} destructors not running at GC time can
ask for it.

Starting incremental marking in V8 11.3 also starts tracing the C++ heap, and
cppgc posts its own marking, sweeping and deferred-collection tasks, where
V8 10.2 drove the embedder heap through the old tracer and posted nothing.
They are marked the way V8's own GC tasks are, so NodePlatform queues them on
the unordered runner: an unmarked task is recorded instead, and since a GC
task posts it with events disallowed, the recording died on
AssertWithEventsDisallowed in PerIsolatePlatformData::PostTask.

V8 11.3 also turned ComputeFlagListHash into a pure function and made
FlagList::Hash return its cached value early, so the fork's block that takes
the hash from the recording has to wrap upstream's new shape -- compute and
store as it does, then read the hash through the recording -- rather than sit
after that return, where it never ran and both sides hashed their own flags.

Node 24's V8 adds more non-deterministic posts for the unordered runner -- a
released page pool and a collected inspector context each post a task -- and
two compiler flags belong with the GC's: concurrent_sparkplug, which V8 13.6
turns on by default and whose batch compiler posts from whichever point fills
a batch, and concurrent_recompilation, whose CompileTurbofan_Concurrent CHECKs
that it is never reached while recording or replaying. Scope infos from
previous compiles are not reused when replaying either, since which compile
produced one is not ordered.

Rebase note: every GC, sweeping and teardown entry point must run with
events disallowed, and nothing the GC posts may reach the recorded
thread at a point that doesn't replay: new non-deterministic tasks go to
the unordered runner or the check handle. Flags record/replay needs
belong in RecordReplayApplyFlagOverrides, which runs again after every
run-time flag change.

From #161 and #212.

Co-authored-by: Brian Hackett <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist added a commit that referenced this pull request Nov 10, 2026
@Andarist
Enable old space GC when recording/replaying
97f80f4
Stop skipping mark-compact collections and forcing --never-compact, and
use incremental, concurrent and parallel GC on both sides, tied to the
v8-flags-gc feature. The GC, sweeping, memory pressure, teardown and
background allocation paths run with events disallowed; a background
allocation never triggers a GC while replaying; Managed<T> destructors
are deferred to Isolate::ReleaseSharedPtrs; WasmCode is kept alive
forever; and the eval cache is off while the compilation cache is only
used when recording, since major GCs age their entries out. The flags
record/replay forces are applied again after every
V8::SetFlagsFromString, and FlagList::Hash records its hash on first
read and replays it.

Node's platform gains an unordered worker runner of four threads which
run with events disallowed and are never joined, used by
CallOnWorkerThread while events are disallowed, so the GC's jobs can
run. Foreground tasks V8 marks non-deterministic are queued and run with
events disallowed from a check handle at the next event loop iteration,
a point which replays, and the memory reducer's timer request is
remembered and posted at the next such point.

Whether a {Managed}'s GC finalizer leaves its destructor to the isolate's
teardown is exposed as ManagedFinalizersDeferredWhenEventsDisallowed(), so
that code which depends on {Managed} destructors not running at GC time can
ask for it.

Starting incremental marking in V8 11.3 also starts tracing the C++ heap, and
cppgc posts its own marking, sweeping and deferred-collection tasks, where
V8 10.2 drove the embedder heap through the old tracer and posted nothing.
They are marked the way V8's own GC tasks are, so NodePlatform queues them on
the unordered runner: an unmarked task is recorded instead, and since a GC
task posts it with events disallowed, the recording died on
AssertWithEventsDisallowed in PerIsolatePlatformData::PostTask.

V8 11.3 also turned ComputeFlagListHash into a pure function and made
FlagList::Hash return its cached value early, so the fork's block that takes
the hash from the recording has to wrap upstream's new shape -- compute and
store as it does, then read the hash through the recording -- rather than sit
after that return, where it never ran and both sides hashed their own flags.

Node 24's V8 adds more non-deterministic posts for the unordered runner -- a
released page pool and a collected inspector context each post a task -- and
two compiler flags belong with the GC's: concurrent_sparkplug, which V8 13.6
turns on by default and whose batch compiler posts from whichever point fills
a batch, and concurrent_recompilation, whose CompileTurbofan_Concurrent CHECKs
that it is never reached while recording or replaying. Scope infos from
previous compiles are not reused when replaying either, since which compile
produced one is not ordered.

Node 26 adds three more of the same kind. Delayed worker tasks are posted
unordered when events are disallowed, since a GC that posts one must not take
the recorded path. Pooled pages are not released on a timer when recording,
because when the timer fires is not ordered. And only the major GC clears weak
references, as node 24's did: node 26 lets the minor GC clear them too, which
makes what is still alive depend on which collector ran.

Rebase note: every GC, sweeping and teardown entry point must run with
events disallowed, and nothing the GC posts may reach the recorded
thread at a point that doesn't replay: new non-deterministic tasks go to
the unordered runner or the check handle. Flags record/replay needs
belong in RecordReplayApplyFlagOverrides, which runs again after every
run-time flag change.

From #161 and #212.

Co-authored-by: Brian Hackett <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist added a commit that referenced this pull request Nov 10, 2026
@Andarist
Enable old space GC when recording/replaying
39a71ba
Stop skipping mark-compact collections and forcing --never-compact, and
use incremental, concurrent and parallel GC on both sides, tied to the
v8-flags-gc feature. The GC, sweeping, memory pressure, teardown and
background allocation paths run with events disallowed; a background
allocation never triggers a GC while replaying; Managed<T> destructors
are deferred to Isolate::ReleaseSharedPtrs; WasmCode is kept alive
forever; and the eval cache is off while the compilation cache is only
used when recording, since major GCs age their entries out. The flags
record/replay forces are applied again after every
V8::SetFlagsFromString, and FlagList::Hash records its hash on first
read and replays it.

Node's platform gains an unordered worker runner of four threads which
run with events disallowed and are never joined, used by
CallOnWorkerThread while events are disallowed, so the GC's jobs can
run. Foreground tasks V8 marks non-deterministic are queued and run with
events disallowed from a check handle at the next event loop iteration,
a point which replays, and the memory reducer's timer request is
remembered and posted at the next such point.

Whether a {Managed}'s GC finalizer leaves its destructor to the isolate's
teardown is exposed as ManagedFinalizersDeferredWhenEventsDisallowed(), so
that code which depends on {Managed} destructors not running at GC time can
ask for it.

Starting incremental marking in V8 11.3 also starts tracing the C++ heap, and
cppgc posts its own marking, sweeping and deferred-collection tasks, where
V8 10.2 drove the embedder heap through the old tracer and posted nothing.
They are marked the way V8's own GC tasks are, so NodePlatform queues them on
the unordered runner: an unmarked task is recorded instead, and since a GC
task posts it with events disallowed, the recording died on
AssertWithEventsDisallowed in PerIsolatePlatformData::PostTask.

V8 11.3 also turned ComputeFlagListHash into a pure function and made
FlagList::Hash return its cached value early, so the fork's block that takes
the hash from the recording has to wrap upstream's new shape -- compute and
store as it does, then read the hash through the recording -- rather than sit
after that return, where it never ran and both sides hashed their own flags.

Node 24's V8 adds more non-deterministic posts for the unordered runner -- a
released page pool and a collected inspector context each post a task -- and
two compiler flags belong with the GC's: concurrent_sparkplug, which V8 13.6
turns on by default and whose batch compiler posts from whichever point fills
a batch, and concurrent_recompilation, whose CompileTurbofan_Concurrent CHECKs
that it is never reached while recording or replaying. Scope infos from
previous compiles are not reused when replaying either, since which compile
produced one is not ordered.

Node 26 adds three more of the same kind. Delayed worker tasks are posted
unordered when events are disallowed, since a GC that posts one must not take
the recorded path. Pooled pages are not released on a timer when recording,
because when the timer fires is not ordered. And only the major GC clears weak
references, as node 24's did: node 26 lets the minor GC clear them too, which
makes what is still alive depend on which collector ran.

Rebase note: every GC, sweeping and teardown entry point must run with
events disallowed, and nothing the GC posts may reach the recorded
thread at a point that doesn't replay: new non-deterministic tasks go to
the unordered runner or the check handle. Flags record/replay needs
belong in RecordReplayApplyFlagOverrides, which runs again after every
run-time flag change.

From #161 and #212.

Co-authored-by: Brian Hackett <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist added a commit that referenced this pull request Nov 10, 2026
@Andarist
Enable old space GC when recording/replaying
e7843e4
Stop skipping mark-compact collections and forcing --never-compact, and
use incremental, concurrent and parallel GC on both sides, tied to the
v8-flags-gc feature. The GC, sweeping, memory pressure, teardown and
background allocation paths run with events disallowed; a background
allocation never triggers a GC while replaying; Managed<T> destructors
are deferred to Isolate::ReleaseSharedPtrs; WasmCode is kept alive
forever; and the eval cache is off while the compilation cache is only
used when recording, since major GCs age their entries out. The flags
record/replay forces are applied again after every
V8::SetFlagsFromString, and FlagList::Hash records its hash on first
read and replays it.

Node's platform gains an unordered worker runner of four threads which
run with events disallowed and are never joined, used by
CallOnWorkerThread while events are disallowed, so the GC's jobs can
run. Foreground tasks V8 marks non-deterministic are queued and run with
events disallowed from a check handle at the next event loop iteration,
a point which replays, and the memory reducer's timer request is
remembered and posted at the next such point.

Whether a {Managed}'s GC finalizer leaves its destructor to the isolate's
teardown is exposed as ManagedFinalizersDeferredWhenEventsDisallowed(), so
that code which depends on {Managed} destructors not running at GC time can
ask for it.

Starting incremental marking in V8 11.3 also starts tracing the C++ heap, and
cppgc posts its own marking, sweeping and deferred-collection tasks, where
V8 10.2 drove the embedder heap through the old tracer and posted nothing.
They are marked the way V8's own GC tasks are, so NodePlatform queues them on
the unordered runner: an unmarked task is recorded instead, and since a GC
task posts it with events disallowed, the recording died on
AssertWithEventsDisallowed in PerIsolatePlatformData::PostTask.

V8 11.3 also turned ComputeFlagListHash into a pure function and made
FlagList::Hash return its cached value early, so the fork's block that takes
the hash from the recording has to wrap upstream's new shape -- compute and
store as it does, then read the hash through the recording -- rather than sit
after that return, where it never ran and both sides hashed their own flags.

Node 24's V8 adds more non-deterministic posts for the unordered runner -- a
released page pool and a collected inspector context each post a task -- and
two compiler flags belong with the GC's: concurrent_sparkplug, which V8 13.6
turns on by default and whose batch compiler posts from whichever point fills
a batch, and concurrent_recompilation, whose CompileTurbofan_Concurrent CHECKs
that it is never reached while recording or replaying. Scope infos from
previous compiles are not reused when replaying either, since which compile
produced one is not ordered.

Node 26 adds three more of the same kind. Delayed worker tasks are posted
unordered when events are disallowed, since a GC that posts one must not take
the recorded path. Pooled pages are not released on a timer when recording,
because when the timer fires is not ordered. And only the major GC clears weak
references, as node 24's did: node 26 lets the minor GC clear them too, which
makes what is still alive depend on which collector ran.

Rebase note: every GC, sweeping and teardown entry point must run with
events disallowed, and nothing the GC posts may reach the recorded
thread at a point that doesn't replay: new non-deterministic tasks go to
the unordered runner or the check handle. Flags record/replay needs
belong in RecordReplayApplyFlagOverrides, which runs again after every
run-time flag change.

From #161 and #212.

Co-authored-by: Brian Hackett <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist added a commit that referenced this pull request Nov 10, 2026
@Andarist
Enable old space GC when recording/replaying
626549b
Stop skipping mark-compact collections and forcing --never-compact, and
use incremental, concurrent and parallel GC on both sides, tied to the
v8-flags-gc feature. The GC, sweeping, memory pressure, teardown and
background allocation paths run with events disallowed; a background
allocation never triggers a GC while replaying; Managed<T> destructors
are deferred to Isolate::ReleaseSharedPtrs; WasmCode is kept alive
forever; and the eval cache is off while the compilation cache is only
used when recording, since major GCs age their entries out. The flags
record/replay forces are applied again after every
V8::SetFlagsFromString, and FlagList::Hash records its hash on first
read and replays it.

Node's platform gains an unordered worker runner of four threads which
run with events disallowed and are never joined, used by
CallOnWorkerThread while events are disallowed, so the GC's jobs can
run. Foreground tasks V8 marks non-deterministic are queued and run with
events disallowed from a check handle at the next event loop iteration,
a point which replays, and the memory reducer's timer request is
remembered and posted at the next such point.

Whether a {Managed}'s GC finalizer leaves its destructor to the isolate's
teardown is exposed as ManagedFinalizersDeferredWhenEventsDisallowed(), so
that code which depends on {Managed} destructors not running at GC time can
ask for it.

Starting incremental marking in V8 11.3 also starts tracing the C++ heap, and
cppgc posts its own marking, sweeping and deferred-collection tasks, where
V8 10.2 drove the embedder heap through the old tracer and posted nothing.
They are marked the way V8's own GC tasks are, so NodePlatform queues them on
the unordered runner: an unmarked task is recorded instead, and since a GC
task posts it with events disallowed, the recording died on
AssertWithEventsDisallowed in PerIsolatePlatformData::PostTask.

V8 11.3 also turned ComputeFlagListHash into a pure function and made
FlagList::Hash return its cached value early, so the fork's block that takes
the hash from the recording has to wrap upstream's new shape -- compute and
store as it does, then read the hash through the recording -- rather than sit
after that return, where it never ran and both sides hashed their own flags.

Node 24's V8 adds more non-deterministic posts for the unordered runner -- a
released page pool and a collected inspector context each post a task -- and
two compiler flags belong with the GC's: concurrent_sparkplug, which V8 13.6
turns on by default and whose batch compiler posts from whichever point fills
a batch, and concurrent_recompilation, whose CompileTurbofan_Concurrent CHECKs
that it is never reached while recording or replaying. Scope infos from
previous compiles are not reused when replaying either, since which compile
produced one is not ordered.

Rebase note: every GC, sweeping and teardown entry point must run with
events disallowed, and nothing the GC posts may reach the recorded
thread at a point that doesn't replay: new non-deterministic tasks go to
the unordered runner or the check handle. Flags record/replay needs
belong in RecordReplayApplyFlagOverrides, which runs again after every
run-time flag change.

From #161 and #212.

Co-authored-by: Brian Hackett <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist added a commit that referenced this pull request Nov 10, 2026
@Andarist
Enable old space GC when recording/replaying
40c657a
Stop skipping mark-compact collections and forcing --never-compact, and
use incremental, concurrent and parallel GC on both sides, tied to the
v8-flags-gc feature. The GC, sweeping, memory pressure, teardown and
background allocation paths run with events disallowed; a background
allocation never triggers a GC while replaying; Managed<T> destructors
are deferred to Isolate::ReleaseSharedPtrs; WasmCode is kept alive
forever; and the eval cache is off while the compilation cache is only
used when recording, since major GCs age their entries out. The flags
record/replay forces are applied again after every
V8::SetFlagsFromString, and FlagList::Hash records its hash on first
read and replays it.

Node's platform gains an unordered worker runner of four threads which
run with events disallowed and are never joined, used by
CallOnWorkerThread while events are disallowed, so the GC's jobs can
run. Foreground tasks V8 marks non-deterministic are queued and run with
events disallowed from a check handle at the next event loop iteration,
a point which replays, and the memory reducer's timer request is
remembered and posted at the next such point.

Whether a {Managed}'s GC finalizer leaves its destructor to the isolate's
teardown is exposed as ManagedFinalizersDeferredWhenEventsDisallowed(), so
that code which depends on {Managed} destructors not running at GC time can
ask for it.

Starting incremental marking in V8 11.3 also starts tracing the C++ heap, and
cppgc posts its own marking, sweeping and deferred-collection tasks, where
V8 10.2 drove the embedder heap through the old tracer and posted nothing.
They are marked the way V8's own GC tasks are, so NodePlatform queues them on
the unordered runner: an unmarked task is recorded instead, and since a GC
task posts it with events disallowed, the recording died on
AssertWithEventsDisallowed in PerIsolatePlatformData::PostTask.

V8 11.3 also turned ComputeFlagListHash into a pure function and made
FlagList::Hash return its cached value early, so the fork's block that takes
the hash from the recording has to wrap upstream's new shape -- compute and
store as it does, then read the hash through the recording -- rather than sit
after that return, where it never ran and both sides hashed their own flags.

Rebase note: every GC, sweeping and teardown entry point must run with
events disallowed, and nothing the GC posts may reach the recorded
thread at a point that doesn't replay: new non-deterministic tasks go to
the unordered runner or the check handle. Flags record/replay needs
belong in RecordReplayApplyFlagOverrides, which runs again after every
run-time flag change.

From #161 and #212.

Co-authored-by: Brian Hackett <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist added a commit that referenced this pull request Nov 10, 2026
@Andarist
Enable old space GC when recording/replaying
0f52c16
Stop skipping mark-compact collections and forcing --never-compact, and
use incremental, concurrent and parallel GC on both sides, tied to the
v8-flags-gc feature. The GC, sweeping, memory pressure, teardown and
background allocation paths run with events disallowed; a background
allocation never triggers a GC while replaying; Managed<T> destructors
are deferred to Isolate::ReleaseSharedPtrs; WasmCode is kept alive
forever; and the eval cache is off while the compilation cache is only
used when recording, since major GCs age their entries out. The flags
record/replay forces are applied again after every
V8::SetFlagsFromString, and FlagList::Hash records its hash on first
read and replays it.

Node's platform gains an unordered worker runner of four threads which
run with events disallowed and are never joined, used by
CallOnWorkerThread while events are disallowed, so the GC's jobs can
run. Foreground tasks V8 marks non-deterministic are queued and run with
events disallowed from a check handle at the next event loop iteration,
a point which replays, and the memory reducer's timer request is
remembered and posted at the next such point.

Whether a {Managed}'s GC finalizer leaves its destructor to the isolate's
teardown is exposed as ManagedFinalizersDeferredWhenEventsDisallowed(), so
that code which depends on {Managed} destructors not running at GC time can
ask for it.

Starting incremental marking in V8 11.3 also starts tracing the C++ heap, and
cppgc posts its own marking, sweeping and deferred-collection tasks, where
V8 10.2 drove the embedder heap through the old tracer and posted nothing.
They are marked the way V8's own GC tasks are, so NodePlatform queues them on
the unordered runner: an unmarked task is recorded instead, and since a GC
task posts it with events disallowed, the recording died on
AssertWithEventsDisallowed in PerIsolatePlatformData::PostTask.

V8 11.3 also turned ComputeFlagListHash into a pure function and made
FlagList::Hash return its cached value early, so the fork's block that takes
the hash from the recording has to wrap upstream's new shape -- compute and
store as it does, then read the hash through the recording -- rather than sit
after that return, where it never ran and both sides hashed their own flags.

Rebase note: every GC, sweeping and teardown entry point must run with
events disallowed, and nothing the GC posts may reach the recorded
thread at a point that doesn't replay: new non-deterministic tasks go to
the unordered runner or the check handle. Flags record/replay needs
belong in RecordReplayApplyFlagOverrides, which runs again after every
run-time flag change.

From #161 and #212.

Co-authored-by: Brian Hackett <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist added a commit that referenced this pull request Nov 11, 2026
@Andarist
Enable old space GC when recording/replaying
e2e2638
Stop skipping mark-compact collections and forcing --never-compact, and
use incremental, concurrent and parallel GC on both sides, tied to the
v8-flags-gc feature. The GC, sweeping, memory pressure, teardown and
background allocation paths run with events disallowed; a background
allocation never triggers a GC while replaying; Managed<T> destructors
are deferred to Isolate::ReleaseSharedPtrs; WasmCode is kept alive
forever; and the eval cache is off while the compilation cache is only
used when recording, since major GCs age their entries out. The flags
record/replay forces are applied again after every
V8::SetFlagsFromString, and FlagList::Hash records its hash on first
read and replays it.

Node's platform gains an unordered worker runner of four threads which
run with events disallowed and are never joined, used by
CallOnWorkerThread while events are disallowed, so the GC's jobs can
run. Foreground tasks V8 marks non-deterministic are queued and run with
events disallowed from a check handle at the next event loop iteration,
a point which replays, and the memory reducer's timer request is
remembered and posted at the next such point.

Whether a {Managed}'s GC finalizer leaves its destructor to the isolate's
teardown is exposed as ManagedFinalizersDeferredWhenEventsDisallowed(), so
that code which depends on {Managed} destructors not running at GC time can
ask for it.

Starting incremental marking in V8 11.3 also starts tracing the C++ heap, and
cppgc posts its own marking, sweeping and deferred-collection tasks, where
V8 10.2 drove the embedder heap through the old tracer and posted nothing.
They are marked the way V8's own GC tasks are, so NodePlatform queues them on
the unordered runner: an unmarked task is recorded instead, and since a GC
task posts it with events disallowed, the recording died on
AssertWithEventsDisallowed in PerIsolatePlatformData::PostTask.

V8 11.3 also turned ComputeFlagListHash into a pure function and made
FlagList::Hash return its cached value early, so the fork's block that takes
the hash from the recording has to wrap upstream's new shape -- compute and
store as it does, then read the hash through the recording -- rather than sit
after that return, where it never ran and both sides hashed their own flags.

Node 24's V8 adds more non-deterministic posts for the unordered runner -- a
released page pool and a collected inspector context each post a task -- and
two compiler flags belong with the GC's: concurrent_sparkplug, which V8 13.6
turns on by default and whose batch compiler posts from whichever point fills
a batch, and concurrent_recompilation, whose CompileTurbofan_Concurrent CHECKs
that it is never reached while recording or replaying. Scope infos from
previous compiles are not reused when replaying either, since which compile
produced one is not ordered.

Node 26 adds three more of the same kind. Delayed worker tasks are posted
unordered when events are disallowed, since a GC that posts one must not take
the recorded path. Pooled pages are not released on a timer when recording,
because when the timer fires is not ordered. And only the major GC clears weak
references, as node 24's did: node 26 lets the minor GC clear them too, which
makes what is still alive depend on which collector ran.

Rebase note: every GC, sweeping and teardown entry point must run with
events disallowed, and nothing the GC posts may reach the recorded
thread at a point that doesn't replay: new non-deterministic tasks go to
the unordered runner or the check handle. Flags record/replay needs
belong in RecordReplayApplyFlagOverrides, which runs again after every
run-time flag change.

From #161 and #212.

Co-authored-by: Brian Hackett <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist added a commit that referenced this pull request Nov 11, 2026
@Andarist @bhackett1024 @claude
Enable old space GC when recording/replaying
b604bd7
Stop skipping mark-compact collections and forcing --never-compact, and
use incremental, concurrent and parallel GC on both sides, tied to the
v8-flags-gc feature. The GC, sweeping, memory pressure, teardown and
background allocation paths run with events disallowed; a background
allocation never triggers a GC while replaying; Managed<T> destructors
are deferred to Isolate::ReleaseSharedPtrs; WasmCode is kept alive
forever; and the eval cache is off while the compilation cache is only
used when recording, since major GCs age their entries out. The flags
record/replay forces are applied again after every
V8::SetFlagsFromString, and FlagList::Hash records its hash on first
read and replays it.

Node's platform gains an unordered worker runner of four threads which
run with events disallowed and are never joined, used by
CallOnWorkerThread while events are disallowed, so the GC's jobs can
run. Foreground tasks V8 marks non-deterministic are queued and run with
events disallowed from a check handle at the next event loop iteration,
a point which replays, and the memory reducer's timer request is
remembered and posted at the next such point.

Whether a {Managed}'s GC finalizer leaves its destructor to the isolate's
teardown is exposed as ManagedFinalizersDeferredWhenEventsDisallowed(), so
that code which depends on {Managed} destructors not running at GC time can
ask for it.

Starting incremental marking in V8 11.3 also starts tracing the C++ heap, and
cppgc posts its own marking, sweeping and deferred-collection tasks, where
V8 10.2 drove the embedder heap through the old tracer and posted nothing.
They are marked the way V8's own GC tasks are, so NodePlatform queues them on
the unordered runner: an unmarked task is recorded instead, and since a GC
task posts it with events disallowed, the recording died on
AssertWithEventsDisallowed in PerIsolatePlatformData::PostTask.

V8 11.3 also turned ComputeFlagListHash into a pure function and made
FlagList::Hash return its cached value early, so the fork's block that takes
the hash from the recording has to wrap upstream's new shape -- compute and
store as it does, then read the hash through the recording -- rather than sit
after that return, where it never ran and both sides hashed their own flags.

Node 24's V8 adds more non-deterministic posts for the unordered runner -- a
released page pool and a collected inspector context each post a task -- and
two compiler flags belong with the GC's: concurrent_sparkplug, which V8 13.6
turns on by default and whose batch compiler posts from whichever point fills
a batch, and concurrent_recompilation, whose CompileTurbofan_Concurrent CHECKs
that it is never reached while recording or replaying. Scope infos from
previous compiles are not reused when replaying either, since which compile
produced one is not ordered.

Node 26 adds three more of the same kind. Delayed worker tasks are posted
unordered when events are disallowed, since a GC that posts one must not take
the recorded path. Pooled pages are not released on a timer when recording,
because when the timer fires is not ordered. And only the major GC clears weak
references, as node 24's did: node 26 lets the minor GC clear them too, which
makes what is still alive depend on which collector ran.

Rebase note: every GC, sweeping and teardown entry point must run with
events disallowed, and nothing the GC posts may reach the recorded
thread at a point that doesn't replay: new non-deterministic tasks go to
the unordered runner or the check handle. Flags record/replay needs
belong in RecordReplayApplyFlagOverrides, which runs again after every
run-time flag change.

From #161 and #212.

Co-authored-by: Brian Hackett <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist added a commit that referenced this pull request Nov 11, 2026
@Andarist @bhackett1024 @claude
Enable old space GC when recording/replaying
62a1d27
Stop skipping mark-compact collections and forcing --never-compact, and
use incremental, concurrent and parallel GC on both sides, tied to the
v8-flags-gc feature. The GC, sweeping, memory pressure, teardown and
background allocation paths run with events disallowed; a background
allocation never triggers a GC while replaying; Managed<T> destructors
are deferred to Isolate::ReleaseSharedPtrs; WasmCode is kept alive
forever; and the eval cache is off while the compilation cache is only
used when recording, since major GCs age their entries out. The flags
record/replay forces are applied again after every
V8::SetFlagsFromString, and FlagList::Hash records its hash on first
read and replays it.

Node's platform gains an unordered worker runner of four threads which
run with events disallowed and are never joined, used by
CallOnWorkerThread while events are disallowed, so the GC's jobs can
run. Foreground tasks V8 marks non-deterministic are queued and run with
events disallowed from a check handle at the next event loop iteration,
a point which replays, and the memory reducer's timer request is
remembered and posted at the next such point.

Whether a {Managed}'s GC finalizer leaves its destructor to the isolate's
teardown is exposed as ManagedFinalizersDeferredWhenEventsDisallowed(), so
that code which depends on {Managed} destructors not running at GC time can
ask for it.

Starting incremental marking in V8 11.3 also starts tracing the C++ heap, and
cppgc posts its own marking, sweeping and deferred-collection tasks, where
V8 10.2 drove the embedder heap through the old tracer and posted nothing.
They are marked the way V8's own GC tasks are, so NodePlatform queues them on
the unordered runner: an unmarked task is recorded instead, and since a GC
task posts it with events disallowed, the recording died on
AssertWithEventsDisallowed in PerIsolatePlatformData::PostTask.

V8 11.3 also turned ComputeFlagListHash into a pure function and made
FlagList::Hash return its cached value early, so the fork's block that takes
the hash from the recording has to wrap upstream's new shape -- compute and
store as it does, then read the hash through the recording -- rather than sit
after that return, where it never ran and both sides hashed their own flags.

Node 24's V8 adds more non-deterministic posts for the unordered runner -- a
released page pool and a collected inspector context each post a task -- and
two compiler flags belong with the GC's: concurrent_sparkplug, which V8 13.6
turns on by default and whose batch compiler posts from whichever point fills
a batch, and concurrent_recompilation, whose CompileTurbofan_Concurrent CHECKs
that it is never reached while recording or replaying. Scope infos from
previous compiles are not reused when replaying either, since which compile
produced one is not ordered.

Node 26 adds three more of the same kind. Delayed worker tasks are posted
unordered when events are disallowed, since a GC that posts one must not take
the recorded path. Pooled pages are not released on a timer when recording,
because when the timer fires is not ordered. And only the major GC clears weak
references, as node 24's did: node 26 lets the minor GC clear them too, which
makes what is still alive depend on which collector ran.

Rebase note: every GC, sweeping and teardown entry point must run with
events disallowed, and nothing the GC posts may reach the recorded
thread at a point that doesn't replay: new non-deterministic tasks go to
the unordered runner or the check handle. Flags record/replay needs
belong in RecordReplayApplyFlagOverrides, which runs again after every
run-time flag change.

From #161 and #212.

Co-authored-by: Brian Hackett <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist added a commit that referenced this pull request Nov 12, 2026
@Andarist @bhackett1024 @claude
Enable old space GC when recording/replaying
a12a095
Stop skipping mark-compact collections and forcing --never-compact, and
use incremental, concurrent and parallel GC on both sides, tied to the
v8-flags-gc feature. The GC, sweeping, memory pressure, teardown and
background allocation paths run with events disallowed; a background
allocation never triggers a GC while replaying; Managed<T> destructors
are deferred to Isolate::ReleaseSharedPtrs; WasmCode is kept alive
forever; and the eval cache is off while the compilation cache is only
used when recording, since major GCs age their entries out. The flags
record/replay forces are applied again after every
V8::SetFlagsFromString, and FlagList::Hash records its hash on first
read and replays it.

Node's platform gains an unordered worker runner of four threads which
run with events disallowed and are never joined, used by
CallOnWorkerThread while events are disallowed, so the GC's jobs can
run. Foreground tasks V8 marks non-deterministic are queued and run with
events disallowed from a check handle at the next event loop iteration,
a point which replays, and the memory reducer's timer request is
remembered and posted at the next such point.

Whether a {Managed}'s GC finalizer leaves its destructor to the isolate's
teardown is exposed as ManagedFinalizersDeferredWhenEventsDisallowed(), so
that code which depends on {Managed} destructors not running at GC time can
ask for it.

Starting incremental marking in V8 11.3 also starts tracing the C++ heap, and
cppgc posts its own marking, sweeping and deferred-collection tasks, where
V8 10.2 drove the embedder heap through the old tracer and posted nothing.
They are marked the way V8's own GC tasks are, so NodePlatform queues them on
the unordered runner: an unmarked task is recorded instead, and since a GC
task posts it with events disallowed, the recording died on
AssertWithEventsDisallowed in PerIsolatePlatformData::PostTask.

V8 11.3 also turned ComputeFlagListHash into a pure function and made
FlagList::Hash return its cached value early, so the fork's block that takes
the hash from the recording has to wrap upstream's new shape -- compute and
store as it does, then read the hash through the recording -- rather than sit
after that return, where it never ran and both sides hashed their own flags.

Node 24's V8 adds more non-deterministic posts for the unordered runner -- a
released page pool and a collected inspector context each post a task -- and
two compiler flags belong with the GC's: concurrent_sparkplug, which V8 13.6
turns on by default and whose batch compiler posts from whichever point fills
a batch, and concurrent_recompilation, whose CompileTurbofan_Concurrent CHECKs
that it is never reached while recording or replaying. Scope infos from
previous compiles are not reused when replaying either, since which compile
produced one is not ordered.

Node 26 adds three more of the same kind. Delayed worker tasks are posted
unordered when events are disallowed, since a GC that posts one must not take
the recorded path. Pooled pages are not released on a timer when recording,
because when the timer fires is not ordered. And only the major GC clears weak
references, as node 24's did: node 26 lets the minor GC clear them too, which
makes what is still alive depend on which collector ran.

Rebase note: every GC, sweeping and teardown entry point must run with
events disallowed, and nothing the GC posts may reach the recorded
thread at a point that doesn't replay: new non-deterministic tasks go to
the unordered runner or the check handle. Flags record/replay needs
belong in RecordReplayApplyFlagOverrides, which runs again after every
run-time flag change.

From #161 and #212.

Co-authored-by: Brian Hackett <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

1 participant

@Andarist
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.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.