Skip to content

[codex] support BigInt typed-array Atomics#4278

Draft
andrewtdiz wants to merge 1 commit into
PerryTS:mainfrom
andrewtdiz:codex/node-compat-atomics-bigint
Draft

[codex] support BigInt typed-array Atomics#4278
andrewtdiz wants to merge 1 commit into
PerryTS:mainfrom
andrewtdiz:codex/node-compat-atomics-bigint

Conversation

@andrewtdiz
Copy link
Copy Markdown
Contributor

@andrewtdiz andrewtdiz commented Jun 3, 2026

Summary

Part of #2876.

This adds BigInt typed-array support to the deterministic Atomics operations that already route through the runtime: load, store, add, sub, and, or, xor, exchange, and compareExchange.

  • accepts BigInt64Array and BigUint64Array views in the Atomics receiver validator
  • reads/writes raw 64-bit lanes so signed and unsigned BigInt views preserve Node-style wrapping and return types
  • applies Atomics ToBigInt operand behavior, including rejecting Number operands while still accepting booleans and strings
  • keeps numeric integer typed-array behavior on the existing numeric path
  • adds a Node parity fixture for signed/unsigned wrap, bitwise operations, compareExchange, and BigInt/Number coercion errors

Non-goals

  • blocking Atomics.wait / waitAsync / notify behavior for BigInt views
  • true inter-thread atomicity beyond Perry's current deterministic single-thread runtime behavior
  • broader SharedArrayBuffer memory-model validation outside this Atomics operation slice
  • unrelated numeric typed-array return-value nuances

Validation

  • CARGO_TARGET_DIR=/tmp/perry-atomics-bigint-check cargo check -p perry-runtime -p perry-codegen -p perry-hir
  • cargo fmt --all -- --check
  • CARGO_TARGET_DIR=/tmp/perry-atomics-bigint-build cargo build --release --quiet -p perry -p perry-runtime -p perry-stdlib
  • npm exec --yes --package=node@26 -- node --experimental-strip-types test-parity/node-suite/globals/atomics-bigint.ts
  • PERRY_NO_AUTO_OPTIMIZE=1 /tmp/perry-atomics-bigint-build/release/perry test-parity/node-suite/globals/atomics-bigint.ts -o /tmp/perry_atomics_bigint && /tmp/perry_atomics_bigint
  • PERRY_NO_AUTO_OPTIMIZE=1 CARGO_TARGET_DIR=/tmp/perry-atomics-bigint-build npm exec --yes --package=node@26 -- bash -lc './run_parity_tests.sh --suite node-suite --module globals --filter atomics'
  • git diff --check
  • ./scripts/check_file_size.sh

@andrewtdiz andrewtdiz changed the title [codex] Add BigInt typed-array Atomics [codex] support BigInt typed-array Atomics Jun 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant