diff --git a/src/hotspot/share/opto/inlinetypenode.cpp b/src/hotspot/share/opto/inlinetypenode.cpp index b6e62c85a50..1b2486de731 100644 --- a/src/hotspot/share/opto/inlinetypenode.cpp +++ b/src/hotspot/share/opto/inlinetypenode.cpp @@ -301,22 +301,9 @@ bool InlineTypeNode::field_is_null_free(uint index) const { return field->is_null_free(); } -static bool is_vector_payload(ciKlass* klass) { - return klass->is_subclass_of(ciEnv::current()->vector_VectorPayload_klass()); -} - -static bool is_vector_payload_mf(ciKlass* klass) { - return klass->is_subclass_of(ciEnv::current()->vector_VectorPayloadMF_klass()); -} - void InlineTypeNode::make_scalar_in_safepoint(PhaseIterGVN* igvn, Unique_Node_List& worklist, SafePointNode* sfpt) { ciInlineKlass* vk = inline_klass(); uint nfields = vk->nof_nonstatic_fields(); - if (is_vector_payload_mf(vk)) { - assert(field_count() == nfields, ""); - } else if (is_vector_payload(vk)) { - assert(field_value(0)->as_InlineType()->field_count() == nfields, ""); - } JVMState* jvms = sfpt->jvms(); // Replace safepoint edge by SafePointScalarObjectNode and add field values assert(jvms != nullptr, "missing JVMS"); diff --git a/src/hotspot/share/opto/macro.cpp b/src/hotspot/share/opto/macro.cpp index 82a9df55b00..e9315f0152d 100644 --- a/src/hotspot/share/opto/macro.cpp +++ b/src/hotspot/share/opto/macro.cpp @@ -853,6 +853,12 @@ SafePointScalarObjectNode* PhaseMacroExpand::create_scalarized_object_descriptio sobj->init_req(0, C->root()); transform_later(sobj); + if (iklass && iklass->is_inlinetype()) { + // Value object has two additional inputs before the non-static fields + sfpt->add_req(_igvn.intcon(1)); + sfpt->add_req(_igvn.intcon(alloc->_larval ? 1 : 0)); + } + // Scan object's fields adding an input to the safepoint for each field. for (int j = 0; j < nfields; j++) { intptr_t offset; diff --git a/src/hotspot/share/opto/memnode.cpp b/src/hotspot/share/opto/memnode.cpp index b0f4c8fd638..d88ff398e6a 100644 --- a/src/hotspot/share/opto/memnode.cpp +++ b/src/hotspot/share/opto/memnode.cpp @@ -1251,7 +1251,7 @@ Node* LoadNode::Identity(PhaseGVN* phase) { offset > oopDesc::klass_offset_in_bytes()) { Node* value = base->as_InlineType()->field_value_by_offset((int)offset, true); if (value != nullptr) { - if (Opcode() == Op_LoadN) { + if (Opcode() == Op_LoadN && !base->is_VectorBox()) { // Encode oop value if we are loading a narrow oop assert(!phase->type(value)->isa_narrowoop(), "should already be decoded"); value = phase->transform(new EncodePNode(value, bottom_type())); diff --git a/src/hotspot/share/opto/vector.cpp b/src/hotspot/share/opto/vector.cpp index bd35b19d7de..d6bac02c2f3 100644 --- a/src/hotspot/share/opto/vector.cpp +++ b/src/hotspot/share/opto/vector.cpp @@ -319,17 +319,24 @@ Node* PhaseVector::expand_vbox_alloc_node(VectorBoxAllocateNode* vbox_alloc, // Re-generate an InlineTypeNode to represent the payload field. This is necessary // in case the input "vect" is not the original vector value when creating the // VectorBox (e.g. original vector value is a PhiNode). - ciInlineKlass* payload = vk->declared_nonstatic_field_at(0)->type()->as_inline_klass(); - Node* payload_value = InlineTypeNode::make_uninitialized(gvn, payload, true); - payload_value->as_InlineType()->set_field_value(0, vect); - payload_value = gvn.transform(payload_value); + ciField* payload_field = vk->declared_nonstatic_field_at(0); + ciInlineKlass* payload = payload_field->type()->as_inline_klass(); + InlineTypeNode* payload_value = InlineTypeNode::make_uninitialized(gvn, payload, true); + payload_value->set_field_value(0, vect); + // Allocate a buffer and store the vector value to it if the payload is not flattened. + if (!payload_field->is_flat()) { + Node* payload_klass = kit.makecon(TypeKlassPtr::make(payload)); + Node* payload_oop = kit.new_instance(payload_klass, nullptr, nullptr, true); + payload_value->store(&kit, payload_oop, payload_oop, payload); + payload_value->set_oop(payload_oop); + } + payload_value = gvn.transform(payload_value)->as_InlineType(); // Re-generate an InlineTypeNode to represent the vector object. New a buffer // and save its field value to the buffer. InlineTypeNode* vector = InlineTypeNode::make_uninitialized(gvn, vk, false); vector->set_field_value(0, payload_value); vector = gvn.transform(vector)->as_InlineType(); - Node* klass_node = kit.makecon(TypeKlassPtr::make(vk)); Node* alloc_oop = kit.new_instance(klass_node, NULL, NULL, /* deoptimize_on_exception */ true); vector->store(&kit, alloc_oop, alloc_oop, vk);