Skip to content

refactor(compile): decide signature facts once and narrow Lower and NewCode - #350

Merged
siyul-park merged 2 commits into
mainfrom
refactor/lower-unit
Nov 19, 2026
Merged

siyul-park merged 2 commits into
mainfrom
refactor/lower-unit

Conversation

@siyul-park

@siyul-park siyul-park commented Nov 19, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • build recomputed the register-convention arguments (gated on !OSR), results, and the completion count for jit.NewCode, while Lower had already decided the same values for the Layout it hands Machine.Prologue/Enter. Lower now keeps that one Layout and records its Arguments/Registers plus completion(f) in jit.Assembly; jit.NewCode(address, ip, osr, tier, a) takes them from there (was 8 positional args).
  • Lower/newLowering took five values that are Unit fields or derived from them (Function, Module.Objects, Address, OSR, and count = Tier == Baseline && !OSR); they now take the Unit: Lower(f, u, m).
  • Test callers (compile, arm64, jit) name compile.Unit fields instead of positional booleans.

Fifth of the pipeline structural cleanups (after #346–#349).

Evidence

  • No golden or expected output changed.
  • make benchmark-diff base=af77c18 (interleaved, n=6): geomean +0.04%; the only significant jit row is xorshift-i64 +1.08% (p=0.039), whose generated code this PR leaves byte-identical — noise.

Test plan

  • go test ./internal/... ./interp ./optimize
  • make check
  • git diff --check

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Refactor
    • JIT compilation now keeps generated code and its calling-convention metadata together, with compilation inputs handled consistently.
    • Existing compilation behavior and validation remain unchanged; no user-facing changes are included.

…ewCode

build recomputed the register-convention arguments and results and the
completion count for jit.NewCode, while Lower had already decided the
same values for the Layout it hands Prologue. Lower now records them in
jit.Assembly from that one Layout, and NewCode takes them from there:
NewCode(address, ip, osr, tier, a).

Lower and newLowering took five values that are Unit fields or derived
from them (Function, Module.Objects, Address, OSR, and count from Tier);
they now take the Unit: Lower(f, u, m).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Warning

Review limit reached

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

Next included review available in 50 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

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: 95528514-e37a-4ad2-8f16-873e60a3133e
Commits

Reviewing files that changed from the base of the PR and between acf4501 and f57b7bb.

Files selected for processing: 8

  • docs/benchmarks.md
  • internal/jit/arm64/machine_test.go
  • internal/jit/cache_test.go
  • internal/jit/code.go
  • internal/jit/code_test.go
  • internal/jit/compile/compile.go
  • internal/jit/compile/compile_test.go
  • internal/jit/compile/unit.go
  • 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.

Share

@siyul-park
siyul-park merged commit 6b27823 into main Nov 19, 2026
1 check passed
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