Repository navigation
perf(interp): admit ref returns on the native call boundary - #195
Conversation
|
Warning Review limit reached
Next review available in: 34 minutes 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 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 configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
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. Comment |
d169f94 to
7460f59
Compare
480d44c to
25079c8
Compare
7460f59 to
96f6b11
Compare
checkReturns rejected every non-scalar return kind, so a CALL to a function returning a ref rejected the whole plan - observed as a lowering rejection on opcode CALL for the StructTreeWalk and BinaryTrees kernels, which build a node and return it. Admit KindRef and push the result the way ARRAY_GET and STRUCT_GET already do, boxed (raw: false) and owning exactly one retain, so l.kinds cannot later mistake a ref for an unboxed payload. This widens lowering coverage; it does not move any kernel. StructTreeWalk and BinaryTrees still reject at their ref STRUCT_SET, which stays terminal, and AllocationGraph is bound by its per-iteration ARRAY_NEW_DEFAULT bridge rather than by any return. Measured on Apple M4 Pro, darwin/arm64, -benchtime=300ms -count=3: no kernel moved outside run-to-run drift. Also pins the ref container store rule that blocks those kernels. TestARM64_RefContainerStoreRemainsTerminal covers both ARRAY_SET and STRUCT_SET, because dropping the kind == KindRef disjunct was tried and reverted for each: a ref store whose native continuation is nested inside a native self-recursive call drives refcounts negative against a threaded twin from depth two upward, while depths zero and one pass, so the shallow tests that first accepted the change did not see it. The interaction is not yet root-caused, so the test exists to stop the same change being made a third time. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
96f6b11 to
31531d5
Compare
Split out of #191. Stacked on #191.
Change
checkReturnsrejected every non-scalar return kind, so aCALLto a function returning a ref rejected the whole plan — observed as a lowering rejection on opcodeCALLfor theStructTreeWalkandBinaryTreeskernels, which build a node and return it.This admits
KindRefand pushes the result the wayARRAY_GETandSTRUCT_GETalready do: boxed (raw: false), owning exactly one retain, sol.kinds' generic!v.rawcheck cannot later mistake a ref for an unboxed payload.This does not move any kernel
Stated plainly because the framing matters for review: this is lowering coverage, not a speedup.
StructTreeWalkandBinaryTreesstill reject at their refSTRUCT_SET, which stays terminalAllocationGraphis bound by its per-iterationARRAY_NEW_DEFAULTbridge, not by any returnMeasured on Apple M4 Pro, darwin/arm64,
-benchtime=300ms -count=3: no kernel moved outside run-to-run drift.Also pins the rule that actually blocks those kernels
TestARM64_RefContainerStoreRemainsTerminalcovers bothARRAY_SETandSTRUCT_SET. Dropping thekind == types.KindRefdisjunct from their terminal tails was tried and reverted for each: a ref store whose native continuation is nested inside a native self-recursive call drives refcounts negative against a threaded twin from recursion depth two upward, while depths zero and one pass — so the shallow tests that first accepted the change did not see it.The interaction is not yet root-caused. The test exists so the same change is not made a third time.
docs/jit-internals.mdrecords the cost of keeping the rule: a terminal store that is not its block's last step makesstepsreportok=false, rejecting the whole plan rather than truncating the block, so a ref store mid-loop-body keeps its entire function threaded.Test plan
TestARM64_RefReturngains a self-recursive sub-case throughselfCall; fails without theKindRefadmission withexpected native code to be installedTestARM64_RefContainerStoreRemainsTerminalat depths 0/1/2/3/5/8 for both container kindsgo test -race ./...,make check-generatedRefs #164
🤖 Generated with Claude Code