[master] RFR: Load narrowKlass from header, AArch64 assembler implementation
Aleksey Shipilev
shade at openjdk.java.net
Thu Jan 27 12:13:06 UTC 2022
On Wed, 26 Jan 2022 10:57:46 GMT, Roman Kennke <rkennke at openjdk.org> wrote:
> This implements MacroAssembler::load_klass() to load the (narrow)Klass* from object header. Just like the x86_64 implementation, it checks whether it can take the fast path (object unlocked -> load from upper 32bits of header), or else calls the runtime to get a stable header and load from that.
>
> It adds a runtime call stub, which will also be used in the C2 implementation. It also adds nklass_offset_in_bytes() which will also be used in C2 impl. The part in generate_verify_oop() is a little nasty, I added a comment that explains what's going on.
>
> Testing:
> - [x] tier1 (aarch64)
> - [x] tier2 (aarch64)
> - [x] tier3 (aarch64)
I'll defer to Andrew to examine AArch64 code, but I have two quick comments.
src/hotspot/cpu/aarch64/stubGenerator_aarch64.cpp line 596:
> 594: // we have lock pointer bits in the upper 32bits. We can't get a false
> 595: // negative.
> 596: __ ldrw(r0, Address(r0, oopDesc::nklass_offset_in_bytes())); // get klass
Something should assert that `oopDesc::nklass_offset_in_bytes()` does not break the alignment. Probably assert that `oopDesc::nklass_offset_in_bytes()` is a multiple of 4?
src/hotspot/share/oops/oop.hpp line 311:
> 309: static int mark_offset_in_bytes() { return offset_of(oopDesc, _mark); }
> 310: #ifdef _LP64
> 311: static int nklass_offset_in_bytes() { return mark_offset_in_bytes() + markWord::klass_shift / 8; }
Ew. Need to assert that `markWord::klass_shift` is actually a multiple of 8.
-------------
PR: https://git.openjdk.java.net/lilliput/pull/36
More information about the lilliput-dev
mailing list