Skip to content

fix(runtime): accept low macOS length receivers - #11055

Closed
proggeramlug wants to merge 2 commits into
PerryTS:mainfrom
proggeramlug:fix/10271-macos-length-heap-floor
Closed

proggeramlug wants to merge 2 commits into
PerryTS:mainfrom
proggeramlug:fix/10271-macos-length-heap-floor

Conversation

@proggeramlug

Copy link
Copy Markdown
Contributor

Fixes #10271.

Summary

  • replace both duplicated .length heap windows with the canonical address classifier
  • keep small registry handles out of the dereference path
  • cover a live macOS mapping below the old 2 TiB floor through both POINTER_TAG and raw-bitcast typed-array length dispatch

Validation

  • RUST_TEST_THREADS=1 cargo test -p perry-runtime -- --test-threads=1 (4,298 passed, 4 ignored)
  • python3 scripts/addr_class_inventory.py --self-test
  • python3 scripts/addr_class_inventory.py
  • cargo fmt --all -- --check
  • ./scripts/check_file_size.sh
  • git diff --check

@coderabbitai

coderabbitai Bot commented Sep 22, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

Next included review available in 2 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 8 included reviews currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: c9cb3225-891d-406b-8fbf-5a6560dd198a

📥 Commits

Reviewing files that changed from the base of the PR and between f5cfbff and d2cbc75.

📒 Files selected for processing (2)
  • changelog.d/11055-macos-length-heap-floor.md
  • crates/perry-runtime/src/value/dynamic_object.rs

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@proggeramlug
proggeramlug marked this pull request as ready for review September 22, 2026 22:03
@proggeramlug

Copy link
Copy Markdown
Contributor Author

Held from merge train 259 by the GC store-site inventory gate:

GC store-site inventory failed; add nearby GC_STORE_AUDIT markers:
  crates/perry-runtime/src/value/dynamic_object.rs:822: raw slot write: std::ptr::write(

This PR is the only one in the train touching that file. The gate wants a marker classifying the write, in the accepted form // GC_STORE_AUDIT(BARRIERED): reason, with the class one of BARRIERED, EXTERNAL_BARRIERED, INIT, POINTER_FREE, ROOT, STACK — or a justified entry in scripts/gc_store_site_allowlist.txt.

Please pick the class deliberately rather than whichever one silences it: the classification is the documentation of why that raw write is safe, and a wrong class is worse than none. If the slot can hold a heap pointer and the write is not through a barrier, that's a real finding rather than a paperwork step.

Everything else about the PR was fine in the train — no conflict, and all other gates green. Ping me when it's marked and it rides the next train.

@proggeramlug

proggeramlug commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor Author

One required step is red, and it is deliberately asking you a question I should not answer for you:

lint :: GC store-site inventory

GC store-site inventory failed; add nearby GC_STORE_AUDIT markers:
  crates/perry-runtime/src/value/dynamic_object.rs:822: raw slot write: std::ptr::write(
Accepted marker form: // GC_STORE_AUDIT(BARRIERED): reason, with class one of
  BARRIERED, EXTERNAL_BARRIERED, INIT, POINTER_FREE, ROOT, STACK
Or add a justified entry to scripts/gc_store_site_allowlist.txt.

The gate's self-test passed in the same run, so the finding is trustworthy: it is the new raw std::ptr::write this PR introduces.

I am not going to pick the class for you, and I'd push back on anyone who did. Choosing between BARRIERED, INIT and POINTER_FREE is a claim about whether that slot can hold a GC pointer, and whether the write can happen after the object is already reachable by the collector. Getting it wrong does not fail anything — it produces a missing write barrier, which surfaces cycles later as TypeError: value is not a function in an unrelated function, and is invisible to every runtime GC probe. That is the most expensive bug class in this codebase.

So, for the write at crates/perry-runtime/src/value/dynamic_object.rs:822:

  • if the slot can hold a heap pointer and the object is already reachable → it needs a real barrier, and the marker is BARRIERED;
  • if this is part of initialising an object the collector cannot see yet → INIT;
  • if the value can never be a pointer → POINTER_FREE.

Whichever you pick, the marker carries a reason — write the one you would want to read in six months.

Everything else on this PR is green. python3 scripts/gc_store_site_inventory.py reproduces it locally in a couple of seconds, no build needed.

(Edited: my first version of this comment had three code spans eaten by shell expansion before posting.)

proggeramlug pushed a commit that referenced this pull request Sep 23, 2026
(cherry picked from commit 07a1c95)
@proggeramlug

Copy link
Copy Markdown
Contributor Author

Landed on main in merge train 268 (#11119), released as v0.5.1651 at 36892b7194.

Four of this train's seven PRs — including this one, if it is #11055, #11023, #11012 or #11014 — were repaired here because they were stuck: the fixes were cherry-picked from fix/<PR>-ci branches built in this session, which is also how fork-hosted heads get landed without their authors. CI on the assembled tree was 22/22 green, all 6 gap-suite shards.

A train rebase gives the commits new SHAs, so GitHub cannot auto-close the source PR; closing by hand. Nothing needed from you.

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.

macOS is missing from dynamic_object.rs's heap-floor platform list, so .length answers 0 below 2 TiB

1 participant