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

Roland Westrelin rwestrel at redhat.com
Fri Sep 14 14:59:52 UTC 2018


Hi Tobias,

> http://cr.openjdk.java.net/~thartmann/8210659/webrev.00/

Looks good.

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?

Roland.


More information about the valhalla-dev mailing list