Skip to content

Global linear-scan register allocation for ZJIT SSA values#7

Draft
Copilot wants to merge 4 commits intomasterfrom
copilot/global-register-allocator
Draft

Global linear-scan register allocation for ZJIT SSA values#7
Copilot wants to merge 4 commits intomasterfrom
copilot/global-register-allocator

Conversation

Copy link

Copilot AI commented Feb 7, 2026

ZJIT’s register allocator was block-local, preventing SSA values from spanning dominating blocks despite a CFG. This change makes allocation global with CFG liveness/intervals and preserves existing split/out-of-SSA passes.

  • Global liveness + intervals

    • Add CFG live-in/live-out dataflow and derive VReg live ranges across block boundaries.
    • Extend BitSet with union/subtract/iteration utilities to support the analysis.
  • Out-of-SSA parameter handling

    • Materialize explicit VReg block parameters for non-entry blocks.
    • Use per-block parameters in branch ParallelMov expansion.
  • Validation + tests

    • Drop block-local SSA validation from validate() while keeping the helper for tests.
    • Add dominance-friendly validation and a cross-block allocator smoke test.
let param_opnd = gen_param(&mut asm, idx, is_entry_block);
if !is_entry_block {
    asm.current_block().add_parameter(param_opnd);
}
jit.opnds[insn_id.0] = Some(param_opnd);

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Co-authored-by: tekknolagi <401167+tekknolagi@users.noreply.github.com>
Copilot AI changed the title [WIP] Update register allocator to support global allocation Implement global liveness-based register allocation for ZJIT Feb 7, 2026
Copilot AI requested a review from tekknolagi February 7, 2026 04:10
@tekknolagi
Copy link
Owner

gave you more internet access. have fun

Co-authored-by: tekknolagi <401167+tekknolagi@users.noreply.github.com>
Copilot AI changed the title Implement global liveness-based register allocation for ZJIT Global linear-scan register allocation for ZJIT Feb 7, 2026
Co-authored-by: tekknolagi <401167+tekknolagi@users.noreply.github.com>
Copilot AI changed the title Global linear-scan register allocation for ZJIT Global linear-scan register allocation for ZJIT SSA values Feb 7, 2026
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.

2 participants