RFR(S): 8210659: [lworld] ValueTypeNode::load_default_oop() should return constant for known value klass

Tobias Hartmann tobias.hartmann at oracle.com
Fri Sep 14 15:10:30 UTC 2018

Thanks Roland.

On 14.09.2018 16:59, Roland Westrelin wrote:
> A related issue is: if a default value is loaded for a value type of
> unknown klass, that is that code from GraphKit::new_array() code when
> allocating through reflection:
>     Node* adr_fixed_block_addr = basic_plus_adr(elem_klass, in_bytes(InstanceKlass::adr_valueklass_fixed_block_offset()));
>     Node* adr_fixed_block = make_load(control(), adr_fixed_block_addr, TypeRawPtr::NOTNULL, T_ADDRESS, MemNode::unordered);
>     Node* default_value_offset_addr = basic_plus_adr(adr_fixed_block, in_bytes(ValueKlass::default_value_offset_offset()));
>     Node* default_value_offset = make_load(control(), default_value_offset_addr, TypeInt::INT, T_INT, MemNode::unordered);
>     Node* elem_mirror = load_mirror_from_klass(elem_klass);
>     Node* default_value_addr = basic_plus_adr(elem_mirror, ConvI2X(default_value_offset));
>     const TypePtr* adr_type = _gvn.type(default_value_addr)->is_ptr();
>     Node* val = access_load_at(elem_mirror, default_value_addr, adr_type, TypeInstPtr::BOTTOM, T_OBJECT, IN_HEAP);
> If during optimization, the klass's type becomes known, does this all
> folds to a constant?

It's probably not optimized. We should add a corresponding LoadNode::Value transformation similar to
what we have for a java mirror load:

I've filed:

Best regards,

More information about the valhalla-dev mailing list