You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
perf(jit): read each native exit through a pointer - #317
settle reads the exit as &entered.Exits[ctx.Exit()]; every interp consumer (callout, bridge, box, materialize, reenter, replay, nests, callee, target, the deopt closures, feedback.record) takes *jit.Exit.
The per-exit metric label (Kind.String()) is built only when a profiler is attached; metric already returned early without one.
Why
pprof of string-build (jit): native code is 11% of the time; settle copying the ~240-byte jit.Exit per exit (160 ms flat at the load, 110 ms at the callout argument) plus the label (90 ms) were ~10% of 3.45 s. string-build takes ~5100 exits per Run.
Safety
A Code's Exits is filled once from slices.Clone at build (internal/jit/code.go) and never written afterwards; no consumer mutated its copy. Retire/invalidate/recompile swaps *Code, never edits its exits. -gcflags=-m: no new heap moves. Independent Opus review: no findings.
Evidence
Local interleaved A/B (M4 Pro, 6 rounds, base 4eb0da7): string-build -23.8% (p=0.009), fannkuch -10.6% (p=0.041), binary-trees and allocation-graph ~. B/op and allocs/op unchanged. Local spread is wide; CI A/B decides.
Validation
go test ./interp ./internal/...
make check, git diff --check (pre-commit)
No docs change: no documented contract names the exit's passing convention.
Improved the consistency of JIT exit handling and aligned exit metric reporting with profiler availability. These changes do not alter user-facing functionality.
settle copied the ~240-byte jit.Exit on every native exit and copied it
again into callout, bridge, box and the deopt closures. string-build
takes about 5100 exits per Run, and pprof put the copies at ~8% of its
time. Every consumer only reads the exit, and a Code's Exits are never
written after it is built, so they now take *jit.Exit.
The per-exit metric also built its label (Kind.String) with no profiler
attached; it is now built only when one is.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This repository does not receive automatic reviews because it has fewer than 10 stars.
Run configuration
Source mode: Auto
Repository: Unavailable
Branch: Unavailable
File: No configuration file from this repository applied
Commit: Unavailable
Layers: defaults
Review profile: CHILL
Plan: Advanced
Run ID: e559cd66-2972-474a-bd53-b84194202021
No actionable comments were generated in the recent review.
Walkthrough
JIT exit-handling callbacks and helpers now accept *jit.Exit pointers instead of values. Feedback recording also accepts an exit pointer. The settle path records exit metrics only when an interpreter profiler is present.
JIT exits are read through pointers, and metric labels are skipped without a profiler. No merge-blocking issue was identified.
Pre-merge checks: 5
Check name
Status
Explanation
Title check
The title clearly and concisely describes the main change: reading each native JIT exit through a pointer.
Description check
The description explains the changes, rationale, safety considerations, performance evidence, and validation. It does not use the template headings or include a related-issues section, but it is mostl…
Docstring Coverage
Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Full details: Description check
Explanation
The description explains the changes, rationale, safety considerations, performance evidence, and validation. It does not use the template headings or include a related-issues section, but it is mostly complete.
Full details: Docstring Coverage
Explanation
Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 1 functions across 2 files.
Finishing Touches
Generate docstrings
Commit to this branch
Create a new PR
Generate unit tests (beta)
Commit to this branch
Create a new PR
Autofix · 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.
File: No configuration file from this repository applied
Commit: Unavailable
Layers: defaults
Review profile: CHILL
Plan: Advanced
Run ID: 44fe4679-ee16-4b14-b75a-a888c226b137
Commits
Reviewing files that changed from the base of the PR and between 4eb0da7 and f851822.
Files selected for processing: 2
interp/feedback.go
interp/jit.go
Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
settlereads the exit as&entered.Exits[ctx.Exit()]; every interp consumer (callout,bridge,box,materialize,reenter,replay,nests,callee,target, the deopt closures,feedback.record) takes*jit.Exit.Kind.String()) is built only when a profiler is attached;metricalready returned early without one.Why
pprof of string-build (jit): native code is 11% of the time;
settlecopying the ~240-bytejit.Exitper exit (160 ms flat at the load, 110 ms at thecalloutargument) plus the label (90 ms) were ~10% of 3.45 s. string-build takes ~5100 exits per Run.Safety
A
Code'sExitsis filled once fromslices.Cloneat build (internal/jit/code.go) and never written afterwards; no consumer mutated its copy. Retire/invalidate/recompile swaps*Code, never edits its exits.-gcflags=-m: no new heap moves. Independent Opus review: no findings.Evidence
Local interleaved A/B (M4 Pro, 6 rounds, base 4eb0da7): string-build -23.8% (p=0.009), fannkuch -10.6% (p=0.041), binary-trees and allocation-graph ~. B/op and allocs/op unchanged. Local spread is wide; CI A/B decides.
Validation
go test ./interp ./internal/...make check,git diff --check(pre-commit)No docs change: no documented contract names the exit's passing convention.
🤖 Generated with Claude Code
Summary by CodeRabbit