[master] RFR: Load narrowKlass from header, AArch64 assembler implementation [v3]

Roman Kennke rkennke at openjdk.java.net
Fri Jan 28 09:35:46 UTC 2022


On Fri, 28 Jan 2022 09:15:43 GMT, Andrew Haley <aph at openjdk.org> wrote:

>> Roman Kennke has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Aph's suggestions
>
> src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp line 3720:
> 
>> 3718:   eor(tmp, tmp, markWord::unlocked_value);
>> 3719:   tst(tmp, markWord::lock_mask_in_place);
>> 3720:   br(Assembler::NE, slow);
> 
> Suggestion:
> 
>   andr(dst, tmp, markWord::lock_mask_in_place);
>   cbnz(dst, Assembler::NE, slow);

I believe that wouldn't work either. The fast path that is following this code requires that the upper 32 bits (the narrowKlass) of tmp remain intact: it shifts them to the right by 32bits and decodes the narrowKlass.

> src/hotspot/cpu/aarch64/stubGenerator_aarch64.cpp line 6620:
> 
>> 6618:     __ enter();
>> 6619:     __ push_call_clobbered_registers_except(r0);
>> 6620:     __ call_VM_leaf(CAST_FROM_FN_PTR(address, oopDesc::load_nklass_runtime), 1);
> 
> I'm tempted to suggest saving flags here too. But I guess you've checked all the places that use `load_klass()`. At least the comment for `load_klass()` should advertise exactly what gets clobbered.

Hmm yeah, maybe. I found one instance where flags are live around this call, but could work around it:

https://github.com/rkennke/lilliput/blob/86c13e4dfc6c1e53c9c97fc686d299c4615fd28d/src/hotspot/cpu/aarch64/stubGenerator_aarch64.cpp#L587

Also, it's not only the stub that clobbers the condition flags, but the fast-path, too.

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

PR: https://git.openjdk.java.net/lilliput/pull/36


More information about the lilliput-dev mailing list