Skip to content

[GR-18266] Add UseKill annotation to replace the Use+Temp trick.#13162

Open
graalvmbot wants to merge 1 commit intomasterfrom
yz/GR-18266
Open

[GR-18266] Add UseKill annotation to replace the Use+Temp trick.#13162
graalvmbot wants to merge 1 commit intomasterfrom
yz/GR-18266

Conversation

@graalvmbot
Copy link
Collaborator

This PR introduces the new @UseKill operand annotation to the LIR and Graal compiler codebase, replacing the previous practice of using @Use+@Temp (the "Use+Temp trick") for denoting operands that are both read and then killed (i.e., whose register may be reused after the instruction). The change improves register allocation logic by making operand liveness semantics explicit and easier to reason about, and extends support throughout register allocation, stack slot allocation, verification, and various architecture-specific LIR instructions.

Key Changes:

  • Added the @UseKill annotation and OperandMode.USE_KILL to LIRInstruction, including new API methods (forEachUseKill, visitEachUseKill) and related wiring in LIRInstructionClass.
  • Implemented the UseKillMoveInjectionPhase, a pre-allocation LIR phase that lowers @UseKill operands on variables to explicit moves, ensuring correct semantics for variables marked as killed.
  • Replaced all manual use of @Use+@Temp with the new @UseKill, including in key LIR instructions such as AMD64ArrayEqualsOp, AMD64VectorizedMismatchOp, and AMD64ArrayRegionCompareToOp.
  • Updated register allocation (LinearScanLifetimeAnalysisPhase, LinearScanAssignLocationsPhase, RegisterVerifier), stack slot allocation (LSStackSlotAllocator, SimpleStackSlotAllocator, FixPointIntervalBuilder), economy and full pre-allocation LIR phases to include the new lowering phase.
  • Modified verification, codegen, optimization, and marking/logging utilities (SSAVerifier, LocationMarker, HotSpotZapRegistersPhase, etc.) to consistently handle USE_KILL wherever operand modes are enumerated.
  • Backward-compatible handling of cast values (e.g., SimpleVirtualStackSlotAlias) with USE_KILL mode checks.
  • Extended operand walking throughout all relevant code locations to include visitEachUseKill and forEachUseKill.

@oracle-contributor-agreement oracle-contributor-agreement bot added the OCA Verified All contributors have signed the Oracle Contributor Agreement. label Mar 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

OCA Verified All contributors have signed the Oracle Contributor Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants