Skip to content

Migrate explicit ShutdownThreadRuntime cache clears into the thread-cleanup registry #893

Description

@frostney

Follow-up to #885 / #891.

PR #891 added Goccia.ThreadCleanupRegistry and routed the ~64 member-definition threadvars through it, but left the pre-existing per-thread cache clears as explicit calls inside Goccia.Threading.ShutdownThreadRuntime to avoid destabilising working teardown in that PR:

This leaves two cleanup idioms coexisting (explicit calls + registry drain). Migrate the explicit cache/memo clears into the registry so there is one mechanism, then drop them from ShutdownThreadRuntime (keeping the ordered object-lifecycle shutdowns — GC / CallStack / MicrotaskQueue — explicit).

Note the Atomics nuance: ShutdownThreadRuntime uses the per-thread ShutdownAtomicsWaitersForCurrentThread while the unit finalization uses the all-threads ShutdownAtomicsWaiters; preserve that distinction when migrating.

Acceptance criteria

  • ShutdownThreadRuntime contains no per-thread managed-cache/memo clear calls; they all register with Goccia.ThreadCleanupRegistry.
  • Each migrated unit drops its now-redundant explicit wiring; main-thread cleanup is preserved (via the registry finalization or the unit's own finalization).
  • Full JS suite (both modes) + Pascal Goccia.ThreadCleanupLeak.Test + Goccia.Threading.Test stay green.

Metadata

Metadata

Assignees

No one assigned

    Labels

    engineTGocciaEngine: language semantics, ECMAScript built-ins, parser, interpreter, bytecode VM

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions