[master] RFR: Load Klass* from header, C2 implementation [v3]

Roman Kennke rkennke at openjdk.java.net
Thu Feb 10 15:01:11 UTC 2022


On Wed, 9 Feb 2022 17:07:39 GMT, Roman Kennke <rkennke at openjdk.org> wrote:

>> src/hotspot/share/opto/macro.cpp line 1676:
>> 
>>> 1674:   rawmem = make_store(control, rawmem, object, oopDesc::mark_offset_in_bytes(), mark_node, TypeX_X->basic_type());
>>> 1675:   rawmem = make_store(control, rawmem, object, oopDesc::nklass_offset_in_bytes(), klass_node, T_METADATA);
>>> 1676:   rawmem = make_store(control, rawmem, object, oopDesc::klass_offset_in_bytes(), klass_node, T_METADATA);
>> 
>> This looks patently weird. What do we store to, `nklass` or `klass`? Why both here?
>
> The Klass* will be eliminated in the subsequent PR. Until then, we have to keep both.

I believe I can safely remove the store to the nklass_offset. The narrow Klass* in the header is already initialized by storing the initial mark word. I only put the store to nklass_offset there to set-up a memory edge to subsequent load-klass. However, the initializer should always emit a membar, which provides the required memory ordering between the initializing store of the narrowKlass* and subsequent loads.

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

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


More information about the lilliput-dev mailing list