On Sat, 4 Jul 2026 07:55:25 GMT, Daisuke Yamazaki <[email protected]> wrote:

>> When `left == right` is known at code generation time, the operands are 
>> necessarily the same oop, so we can jump directly to `L_oops_equal`. 
>> This patch changes both x86 and aarch65 to do that.
>> 
>> I also considered emitting `equal_result` and returning early in that case.
>> I decided not to do that because `LIR_OpSubstitutabilityCheck::emit_code()` 
>> still appends the slow-path stub after `emit_opSubstitutabilityCheck()` 
>> returns.
>> An early return here would skip binding `op->stub()->continuation()`, 
>> leaving the appended stub with an unbound continuation label. 
>> 
>> ---------
>> - [x] I confirm that I make this contribution in accordance with the 
>> [OpenJDK Interim AI Policy](https://openjdk.org/legal/ai).
>
> Daisuke Yamazaki has updated the pull request incrementally with one 
> additional commit since the last revision:
> 
>   Fix emitting the unreachable klass check for identical operands

src/hotspot/cpu/x86/c1_LIRAssembler_x86.cpp line 1598:

> 1596:   Register right = op->right()->as_register();
> 1597: 
> 1598:   if (left == right) {

Thanks for picking this up. I have a general question about this patch: 
Couldn't we already check whether `left.result()` and `right.result()` refer to 
the same LIR operand earlier in `LIRGenerator::substitutability_check_common()` 
before creating `LIR_OpSubstitutabilityCheck`?
https://github.com/openjdk/valhalla/blob/a918cc9f5f8dcc35f4f73ed19b439a033fb39883/src/hotspot/share/c1/c1_LIRGenerator.cpp#L3379-L3381

-------------

PR Review Comment: 
https://git.openjdk.org/valhalla/pull/2628#discussion_r3527311655

Reply via email to