RFR: 8277417: C1 LIR instruction for load-klass [v2]

Andrew Haley aph at openjdk.java.net
Mon Nov 22 10:58:14 UTC 2021


On Fri, 19 Nov 2021 18:22:37 GMT, Roman Kennke <rkennke at openjdk.org> wrote:

>> In C1, the load of a Klass* out of an object is currently identified by a load of type T_ADDRESS with offset oopDest::klass_offset_in_bytes(). When encountering such load, this may be decoded when +CompressedClassPointers. This is problematic and ugly: if we ever emit a T_ADDRESS load with offset 8 or 4 (== klass_offset_in_bytes) that is not a Klass*, we would attempt to decode the result. We have been lucky so far.
>> 
>> Also, in Lilliput, we want to do something entirely different there, and need to be able to emit more complex code, possibly including runtime call.
>> 
>> The change introduces a new C1 LIR opcode OpLoadKlass, and refactors the implementations in c1_LIRAssembler_xyz.cpp to emit the code there, instead of mem2reg(). Notice that I could not test anything but x86, all other platforms only received very basic testing via GHA. It would be nice if respective maintainers could give it a try.
>> 
>> Testing:
>>  - [x] tier1 (x86_64)
>>  - [x] tier2 (x86_64)
>>  - [x] tier3 (x86_64)
>
> Roman Kennke has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Fix null-check on PPC

Thanks, a very welcome fix. I wish I had done something like this at the time of the AArch64 port, but I was neither brave enough nor knew enough

src/hotspot/cpu/aarch64/c1_LIRAssembler_aarch64.cpp line 991:

> 989:       // FIXME: OMG this is a horrible kludge.  Any offset from an
> 990:       // address that matches klass_offset_in_bytes() will be loaded
> 991:       // as a word, not a long.

Ha! I am so glad to see this horrible kludge removed.

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

Marked as reviewed by aph (Reviewer).

PR: https://git.openjdk.java.net/jdk/pull/6464


More information about the hotspot-dev mailing list