Skip to content

refactor(interp): share the heap payload read and the overwrite release - #199

Merged
siyul-park merged 1 commit into
mainfrom
refactor/jit-heap-handlers
Aug 16, 2026
Merged

siyul-park merged 1 commit into
mainfrom
refactor/jit-heap-handlers

Conversation

@siyul-park

Copy link
Copy Markdown
Owner

Stage 3 (first half) of the JIT lowering rework. Stacked on #198.

Net -60 lines in interp/jit_arm64.go, no behavior change.

errorGet / coroValue → payloadGet

These were the same 66 lines twice, differing only in which itab they guard and which payload word they read — same guard sequence, same four-way kind switch, same exclusive-owner check on the ref case, same three stack rewrites. Both are now one-line wrappers over payloadGet.

The merged version also documents why the exclusive-owner guard exists: it protects a release-triggered free, so a borrowed handle — which has no release to follow — skips it. That was a comment in one copy and absent from the other.

releaseOverwritten

The overwrite release appeared verbatim at five sites — localSet, globalSet, upvalSet, arraySet, structSet — as a five-line branch choosing between releaseBox and releaseBoxExcept on an unexplained condition.

The helper names the rule: the outgoing and incoming values may be the same address, and releasing first would free a value the store is about to publish — but only an owned incoming value can alias that way, because a deferred one still borrows its own backing slot's retain. So the aliasing check is needed exactly when the incoming value is not deferred. That invariant was previously implicit in five copies.

Still outstanding in this area

Not done here, and worth its own change: the kind → (itab, base, scale, raw) element-shape mapping is still written out longhand in six places (arrayGet, arraySet, arrayLen, arrayGetKnown, hoistable, arrayKind), and arrayGet/arraySet plus structGet/structSet still each carry their own copy of the guard preamble.

Test plan

  • go test -race ./...
  • make lint, make check-generated

Refs #164

🤖 Generated with Claude Code

@coderabbitai

coderabbitai Bot commented Aug 16, 2026 •

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

@siyul-park, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 21 minutes

Limit details: You’ve used all 1 included review currently available under your plan.

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

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: e25b7d05-b78e-4b67-9d59-93f1a669b6e1

📥 Commits

Reviewing files that changed from the base of the PR and between 05b50f5 and 08bb211.

📒 Files selected for processing (1)
  • interp/jit_arm64.go

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.

errorGet and coroValue were the same 66 lines twice, differing only in which
itab they guard and which payload word they read: the same guard sequence, the
same four-way kind switch, the same exclusive-owner check on the ref case, the
same three stack rewrites. They now call one payloadGet.

The overwrite release appeared verbatim at five sites - localSet, globalSet,
upvalSet, arraySet, structSet - as a five-line branch choosing between
releaseBox and releaseBoxExcept. releaseOverwritten names the rule instead: the
outgoing and incoming values may be the same address, and only an owned
incoming value can alias that way, because a deferred one still borrows its own
backing slot's retain. That is why the aliasing check is needed exactly when
the incoming value is not deferred - a fact that was previously implicit in
five copies of an unexplained condition.

No behavior change.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@siyul-park
siyul-park force-pushed the refactor/jit-heap-handlers branch from daa922c to 08bb211 Compare August 16, 2026 06:11
@siyul-park
siyul-park changed the base branch from refactor/instr-opcode-facets to main August 16, 2026 06:11
@siyul-park
siyul-park merged commit 81bc93a into main Aug 16, 2026
2 of 3 checks passed
@siyul-park
siyul-park deleted the refactor/jit-heap-handlers branch November 7, 2026 10:21
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