Browse documentation

Goccia.build.gcStress follows the run-time GC-stress switches

Date: 2026-12-02 Area: runtime, testing, gc Related: ADR 0155 (refined), #2554

Context

ADR 0155 made Goccia.build.gcStress true in a GC-stress build, fixed at compile time by the define GOCCIA_GC_STRESS, so a test that builds thousands of objects shrinks N under stress, or skips a case whose point is a size past an engine bound, while its small cases still run there.

The engine has no stress build. Its binaries collect at every allocation under --gc-stress, verify the heap after each collection under --gc-verify (the test262 host reads GOCCIA_GC_VERIFY for the same switch), and take a small nursery from GOCCIA_NURSERY_KB. No build defines GOCCIA_GC_STRESS, so the flag was false in every run and no test shrank. The GC-stress workflow runs every tests/ file with a 16 KB nursery and --gc-verify; on run 46722843206 five deep-chain files under tests/built-ins/Goccia/gc and one generator test ran past its 600-second limit. A file past the limit is reported as TIMEOUT and not checked, so the workflow checked none of their cases.

Decision

Goccia.build.gcStress is true while the engine runs under --gc-stress or --gc-verify, and false otherwise. It is still an enumerable, read-only boolean beside os, arch and date; the host reads the engine's GCStress and GCVerify switches when it builds Goccia.build, so an embedder that sets either before creating an engine sees it too. The test262 host also reads GOCCIA_GC_VERIFY for the switch, but installs no Goccia object. A small nursery alone does not set it: it collects more often but checks nothing, and the stress sweep always pairs it with --gc-verify. This replaces ADR 0155's compile-time source; its use by tests stands.

The stress sweep compares a file's two runs on its passed and skipped tests together. A case a file skips under stress counts as passed in the plain run and as skipped in the stressed one; scripts/engine/gcstress-tests.py still reports a file whose failures, total or suite errors differ, so a setup hook that fails only under stress, which skips its suite's tests, is still a finding.

Consequences

  • The tests that read the flag shrink or skip their large cases under the stress sweep, and the deep-chain files finish in under a second there instead of passing 600 seconds; the GC-stress workflow checks them again.
  • A run with --gc-stress or --gc-verify runs the shrunk inputs, so a missing root that only a large input reaches is not looked for there; a case meant to reach one under stress does not read the flag.
  • IsGCStressBuild and the GOCCIA_GC_STRESS define are gone.