Skip to content

fix: wasm32 runtime ABI table and setter-site offset after #11784/#11786 - #11800

Merged
proggeramlug merged 2 commits into
mainfrom
fix/main-wasm-abi-and-setter-offset
Oct 3, 2026
Merged

proggeramlug merged 2 commits into
mainfrom
fix/main-wasm-abi-and-setter-offset

Conversation

@proggeramlug

@proggeramlug proggeramlug commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

After #11784 and #11786 landed, main had two wasm32 breakages.

  1. crates/perry-codegen/src/wasm32/runtime_abi.tsv was stale (wasi-check: "regenerate with scripts/runtime_abi_check.py --emit-wasm-abi"). Regenerated.
  2. setter_site.rs asserts offset_of!(Entry, slot) == abi::SETTER_SITE_SLOT_OFFSET, but the entry holds usize address fields, so on wasm32 the offsets are 12/16/20, not 16/24/32 (E0080). perry-abi now derives the offsets from the pointer width (setter_site_layout), and the runtime assertions stay and check the native-width constants. Codegen asks for the layout of the target it emits for and loads the address fields as i32 + zext on ILP32. The LP64 constants and emitted IR are unchanged.

Checked: cargo fmt --check, --check-wasm-abi, --check-native, scripts/wasi_check.sh (perry-runtime builds for wasm32-wasip2), native cargo check of perry-codegen and perry-runtime, and the setter-site runtime test.

Summary by CodeRabbit

  • Bug Fixes
    • Corrected setter-site record handling on both 32-bit and 64-bit targets, including proper field alignment and address handling.

@coderabbitai

coderabbitai Bot commented Oct 3, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 77d004bc-ea6c-4363-950d-7344bbd5a620
📥 Commits

Reviewing files that changed from the base of the PR and between 334217b and 409234b.

⛔ Files ignored due to path filters (1)
  • crates/perry-codegen/src/wasm32/runtime_abi.tsv is excluded by !**/*.tsv
📒 Files selected for processing (2)
  • crates/perry-abi/src/lib.rs
  • crates/perry-codegen/src/expr/put_value_store_ic/setter_arm.rs

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 6 remain after this review.


📝 Walkthrough

Walkthrough

The ABI now provides setter-site offsets for a supplied pointer width. Codegen selects the target-width layout when reading setter-site records and widens 32-bit address fields.

Changes

Setter-site layout

Layer / File(s) Summary
Define setter-site layout
crates/perry-abi/src/lib.rs
Adds a public layout record and helper, derives native offset constants from the host pointer width, and checks offsets for 32-bit and 64-bit pointers.
Read target-width setter-site fields
crates/perry-codegen/src/expr/put_value_store_ic/setter_arm.rs
Selects setter-site offsets for the target pointer width. On ILP32 targets, loads pointer fields as 32-bit values and zero-extends them to 64 bits.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Merge Risk: ⚪ Minimal · up to 40923

No actionable issue is established for the setter-site layout change; it is mergeable after normal checks.

Security Architecture Review

Security architecture risk: 🔵 Low · up to 40923

The change aligns setter-record reads with the compilation target’s pointer width while preserving existing validation before calling setters. Risk is low, with remaining uncertainty around end-to-end 32-bit execution.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The supported security-sensitive scope is setter dispatch within the executing program: incorrect record interpretation could affect memory reads and indirect calls. The inspected change repairs 32-bit interpretation without adding a caller or weakening the existing dispatch controls.

Trust Boundaries and Controls

  • observed — Guest property writes reach a runtime-produced setter record rather than supplying its raw call target directly. Candidate creation and runtime validation constrain receiver, key, holder and accessor-pair identity; generated calls retain the shape, lane, worker and value checks present before this change.

Resilience and Maintainability Implications

  • observed — The existing lifecycle permits publication only under the primary-agent/no-workers protocol, reuses or retains allocated entries, and rewrites key, holder and pair roots during collection. Generated dispatch records callback deoptimization before executing user code. The PR changes field interpretation, not these ownership and recovery mechanisms; broader deletion or shutdown cleanup was not established.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 2 files.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly identifies the wasm32 ABI table and setter-site offset fixes, which are the main changes.
Description check ✅ Passed The description explains both wasm32 fixes and lists verification steps. It does not use the template headings or include the checklist, but it provides the key change and test information.
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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 merged commit 6820067 into main Oct 3, 2026
22 of 25 checks passed
@proggeramlug
proggeramlug deleted the fix/main-wasm-abi-and-setter-offset branch October 3, 2026 12:56
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