镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

Keep Promise reactions in the 256-byte GC slab with async context snapshots #1114

Open

Description

@chrisbbreuer

Related: #480 (memory footprint), #496 (frontend/runtime work), #1113 (blocked full integration gate).

Executed regression

The unchanged full unit gate on 1c4e0428 fails gc.test.Promise fits the 256-byte GC slab: the production invariant is a Promise payload at most 224 bytes, plus the 32-byte collector header, with the existing 256-byte slab selection.

An isolated declared-source-package witness confirms the failure on pristine 1c4e0428, independently of #1113's allocator changes:

  • Promise: 240 bytes; Reaction: 80 bytes; ReactionPair: 160 bytes; optional pair: 168 bytes.
  • Collector request: 272 bytes; selected slab: 512 bytes.
  • The unchanged payload assertion fails with exit 1.

The pristine parent 7bb37833 before async-context commit 9285179f passes with Promise 224 bytes, Reaction 72 bytes, pair 144 bytes, collector request 256 bytes and selected slab 256 bytes. The added Reaction.async_context snapshot must remain supported. Fresh inspected main 00f387110bd18fb42685a6b3436f49d9d6818e68 has no Promise/GC source difference addressing the regression. Historical #1026 and #1030 are closed and cover earlier footprint/rounding work.

Required fix

  • Restore the existing 224-byte payload / 256-byte slab invariant without changing slab sizes or relaxing the test.
  • Preserve async-context snapshot capture, propagation, tracing and relocation.
  • Preserve absent extra callback argument versus an explicitly supplied undefined value, including the actual argument count delivered to native callbacks.
  • Preserve ordinary, detached and private-host Promise reactions, existing handler-domain semantics, transactional publication, and no-GIL locking.
  • Retain regressions for layout, callback argument semantics and extra argument retention across collection/compaction; run focused Promise/GC/private-host checks and the full integration gate.

A compact representation for extra_argument is a candidate: a Value plus explicit presence state can use the existing flag padding and retain the distinction currently represented by ?Value, without adding allocations or dropping async context. Validate its actual layout before adopting it. Do not change handler absence to an undefined sentinel: that is a different representation/semantics question and is unnecessary here.

The issue records a collector allocation-class regression, not evidence of a cell overwrite. Source witnesses, hashes and logs are retained for implementation. Package publication and downstream adoption remain separate gates.

Activity

  1. chrisbbreuer commented on Nov 10, 2026

    @chrisbbreuer
    MemberAuthor

    Published the owning fix in e5002806. Reaction argument presence uses existing padding while retaining the full Value and async-context snapshot. The actual Promise payload returns to 224 bytes and selected slab to 256 bytes. Explicit undefined native arity, moving inline/overflow/queued arguments and owner insertion barriers have executed regressions.

    Combined validation on the exact published source:

    • Full canonical unit suite: 2,859 passed, one skipped, zero failed and zero leaked (2,860 accounted).
    • Exact before/after affected test262 comparison: 2,059/2,059 in both binaries across 18 Object/reflection/Proxy/JSON/for-in/Promise subtrees, zero regressions and zero flips. Corpus 4249661388e5d3f92a85186213da140a6481490f.
    • Home private ABI: all 538 symbols classified, 392/392 linked, runtime matrix passes in Debug and ReleaseSafe.
    • Focused instrumented TSan evidence is retained for the allocator, Promise and own-key regressions, with no selected suppressions.
    • Canonical documentation manifest generation and checked build pass with CI-pinned Bun 1.3.14 and BunPress 226414.

    Validated file hashes match after rebasing onto the current upstream CI-only promotion. Hosted CI is running at https://github.com/zig-utils/zig-js/actions/runs/42724498723 . The ticket remains open pending its hosted gates. Complete native game acceptance remains tracked separately in #1116 and stacksjs/the-settlers-iii-remake#244; no downstream package or native-presentation qualification is claimed here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions