Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/hotspot/share/opto/escape.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2819,14 +2819,14 @@ int ConnectionGraph::find_init_values_null(JavaObjectNode* pta, PhaseValues* pha
offsets_worklist.append(offset);
Node* value = nullptr;
if (ini != nullptr) {
// StoreP::memory_type() == T_ADDRESS
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The value of this comment is debatable, but I think it is best to not remove it in this RFE (just rename memory_type to value_basic_type), to preserve the original scope of the RFE.

// StoreP::value_basic_type() == T_ADDRESS
BasicType ft = UseCompressedOops ? T_NARROWOOP : T_ADDRESS;
Node* store = ini->find_captured_store(offset, type2aelembytes(ft, true), phase);
// Make sure initializing store has the same type as this AddP.
// This AddP may reference non existing field because it is on a
// dead branch of bimorphic call which is not eliminated yet.
if (store != nullptr && store->is_Store() &&
store->as_Store()->memory_type() == ft) {
store->as_Store()->value_basic_type() == ft) {
value = store->in(MemNode::ValueIn);
#ifdef ASSERT
if (VerifyConnectionGraph) {
Expand Down
8 changes: 4 additions & 4 deletions src/hotspot/share/opto/memnode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1213,12 +1213,12 @@ Node* MemNode::can_see_stored_value(Node* st, PhaseValues* phase) const {
// (This is one of the few places where a generic PhaseTransform
// can create new nodes. Think of it as lazily manifesting
// virtually pre-existing constants.)
if (memory_type() != T_VOID) {
if (value_basic_type() != T_VOID) {
if (ReduceBulkZeroing || find_array_copy_clone(ld_alloc, in(MemNode::Memory)) == nullptr) {
// If ReduceBulkZeroing is disabled, we need to check if the allocation does not belong to an
// ArrayCopyNode clone. If it does, then we cannot assume zero since the initialization is done
// by the ArrayCopyNode.
return phase->zerocon(memory_type());
return phase->zerocon(value_basic_type());
}
} else {
// TODO: materialize all-zero vector constant
Expand Down Expand Up @@ -2047,7 +2047,7 @@ const Type* LoadNode::Value(PhaseGVN* phase) const {
int stable_dimension = (ary->stable_dimension() > 0 ? ary->stable_dimension() - 1 : 0);
const Type* con_type = Type::make_constant_from_array_element(aobj->as_array(), off,
stable_dimension,
memory_type(), is_unsigned());
value_basic_type(), is_unsigned());
if (con_type != nullptr) {
return con_type;
}
Expand Down Expand Up @@ -2115,7 +2115,7 @@ const Type* LoadNode::Value(PhaseGVN* phase) const {
const TypeInstPtr* tinst = tp->is_instptr();
ciObject* const_oop = tinst->const_oop();
if (!is_mismatched_access() && off != Type::OffsetBot && const_oop != nullptr && const_oop->is_instance()) {
const Type* con_type = Type::make_constant_from_field(const_oop->as_instance(), off, is_unsigned(), memory_type());
const Type* con_type = Type::make_constant_from_field(const_oop->as_instance(), off, is_unsigned(), value_basic_type());
if (con_type != nullptr) {
return con_type;
}
Expand Down
50 changes: 27 additions & 23 deletions src/hotspot/share/opto/memnode.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,12 +134,16 @@ class MemNode : public Node {
virtual int store_Opcode() const { return -1; }

// What is the type of the value in memory? (T_VOID mean "unspecified".)
virtual BasicType memory_type() const = 0;
// The returned type is a property of the value that is loaded/stored and
// not the memory that is accessed. For mismatched memory accesses
// they might differ. For instance, a value of type 'short' may be stored
// into an array of elements of type 'long'.
virtual BasicType value_basic_type() const = 0;
virtual int memory_size() const {
#ifdef ASSERT
return type2aelembytes(memory_type(), true);
return type2aelembytes(value_basic_type(), true);
#else
return type2aelembytes(memory_type());
return type2aelembytes(value_basic_type());
#endif
}

Expand Down Expand Up @@ -337,7 +341,7 @@ class LoadBNode : public LoadNode {
virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
virtual const Type* Value(PhaseGVN* phase) const;
virtual int store_Opcode() const { return Op_StoreB; }
virtual BasicType memory_type() const { return T_BYTE; }
virtual BasicType value_basic_type() const { return T_BYTE; }
};

//------------------------------LoadUBNode-------------------------------------
Expand All @@ -351,7 +355,7 @@ class LoadUBNode : public LoadNode {
virtual Node* Ideal(PhaseGVN *phase, bool can_reshape);
virtual const Type* Value(PhaseGVN* phase) const;
virtual int store_Opcode() const { return Op_StoreB; }
virtual BasicType memory_type() const { return T_BYTE; }
virtual BasicType value_basic_type() const { return T_BYTE; }
};

//------------------------------LoadUSNode-------------------------------------
Expand All @@ -365,7 +369,7 @@ class LoadUSNode : public LoadNode {
virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
virtual const Type* Value(PhaseGVN* phase) const;
virtual int store_Opcode() const { return Op_StoreC; }
virtual BasicType memory_type() const { return T_CHAR; }
virtual BasicType value_basic_type() const { return T_CHAR; }
};

//------------------------------LoadSNode--------------------------------------
Expand All @@ -379,7 +383,7 @@ class LoadSNode : public LoadNode {
virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
virtual const Type* Value(PhaseGVN* phase) const;
virtual int store_Opcode() const { return Op_StoreC; }
virtual BasicType memory_type() const { return T_SHORT; }
virtual BasicType value_basic_type() const { return T_SHORT; }
};

//------------------------------LoadINode--------------------------------------
Expand All @@ -391,7 +395,7 @@ class LoadINode : public LoadNode {
virtual int Opcode() const;
virtual uint ideal_reg() const { return Op_RegI; }
virtual int store_Opcode() const { return Op_StoreI; }
virtual BasicType memory_type() const { return T_INT; }
virtual BasicType value_basic_type() const { return T_INT; }
};

//------------------------------LoadRangeNode----------------------------------
Expand Down Expand Up @@ -424,7 +428,7 @@ class LoadLNode : public LoadNode {
virtual int Opcode() const;
virtual uint ideal_reg() const { return Op_RegL; }
virtual int store_Opcode() const { return Op_StoreL; }
virtual BasicType memory_type() const { return T_LONG; }
virtual BasicType value_basic_type() const { return T_LONG; }
bool require_atomic_access() const { return _require_atomic_access; }

#ifndef PRODUCT
Expand Down Expand Up @@ -453,7 +457,7 @@ class LoadFNode : public LoadNode {
virtual int Opcode() const;
virtual uint ideal_reg() const { return Op_RegF; }
virtual int store_Opcode() const { return Op_StoreF; }
virtual BasicType memory_type() const { return T_FLOAT; }
virtual BasicType value_basic_type() const { return T_FLOAT; }
};

//------------------------------LoadDNode--------------------------------------
Expand All @@ -474,7 +478,7 @@ class LoadDNode : public LoadNode {
virtual int Opcode() const;
virtual uint ideal_reg() const { return Op_RegD; }
virtual int store_Opcode() const { return Op_StoreD; }
virtual BasicType memory_type() const { return T_DOUBLE; }
virtual BasicType value_basic_type() const { return T_DOUBLE; }
bool require_atomic_access() const { return _require_atomic_access; }

#ifndef PRODUCT
Expand Down Expand Up @@ -503,7 +507,7 @@ class LoadPNode : public LoadNode {
virtual int Opcode() const;
virtual uint ideal_reg() const { return Op_RegP; }
virtual int store_Opcode() const { return Op_StoreP; }
virtual BasicType memory_type() const { return T_ADDRESS; }
virtual BasicType value_basic_type() const { return T_ADDRESS; }
};


Expand All @@ -516,7 +520,7 @@ class LoadNNode : public LoadNode {
virtual int Opcode() const;
virtual uint ideal_reg() const { return Op_RegN; }
virtual int store_Opcode() const { return Op_StoreN; }
virtual BasicType memory_type() const { return T_NARROWOOP; }
virtual BasicType value_basic_type() const { return T_NARROWOOP; }
};

//------------------------------LoadKlassNode----------------------------------
Expand Down Expand Up @@ -555,7 +559,7 @@ class LoadNKlassNode : public LoadNNode {
virtual int Opcode() const;
virtual uint ideal_reg() const { return Op_RegN; }
virtual int store_Opcode() const { return Op_StoreNKlass; }
virtual BasicType memory_type() const { return T_NARROWKLASS; }
virtual BasicType value_basic_type() const { return T_NARROWKLASS; }

virtual const Type* Value(PhaseGVN* phase) const;
virtual Node* Identity(PhaseGVN* phase);
Expand Down Expand Up @@ -666,7 +670,7 @@ class StoreBNode : public StoreNode {
: StoreNode(c, mem, adr, at, val, mo) {}
virtual int Opcode() const;
virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
virtual BasicType memory_type() const { return T_BYTE; }
virtual BasicType value_basic_type() const { return T_BYTE; }
};

//------------------------------StoreCNode-------------------------------------
Expand All @@ -677,7 +681,7 @@ class StoreCNode : public StoreNode {
: StoreNode(c, mem, adr, at, val, mo) {}
virtual int Opcode() const;
virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
virtual BasicType memory_type() const { return T_CHAR; }
virtual BasicType value_basic_type() const { return T_CHAR; }
};

//------------------------------StoreINode-------------------------------------
Expand All @@ -687,7 +691,7 @@ class StoreINode : public StoreNode {
StoreINode(Node *c, Node *mem, Node *adr, const TypePtr* at, Node *val, MemOrd mo)
: StoreNode(c, mem, adr, at, val, mo) {}
virtual int Opcode() const;
virtual BasicType memory_type() const { return T_INT; }
virtual BasicType value_basic_type() const { return T_INT; }
};

//------------------------------StoreLNode-------------------------------------
Expand All @@ -705,7 +709,7 @@ class StoreLNode : public StoreNode {
StoreLNode(Node *c, Node *mem, Node *adr, const TypePtr* at, Node *val, MemOrd mo, bool require_atomic_access = false)
: StoreNode(c, mem, adr, at, val, mo), _require_atomic_access(require_atomic_access) {}
virtual int Opcode() const;
virtual BasicType memory_type() const { return T_LONG; }
virtual BasicType value_basic_type() const { return T_LONG; }
bool require_atomic_access() const { return _require_atomic_access; }

#ifndef PRODUCT
Expand All @@ -723,7 +727,7 @@ class StoreFNode : public StoreNode {
StoreFNode(Node *c, Node *mem, Node *adr, const TypePtr* at, Node *val, MemOrd mo)
: StoreNode(c, mem, adr, at, val, mo) {}
virtual int Opcode() const;
virtual BasicType memory_type() const { return T_FLOAT; }
virtual BasicType value_basic_type() const { return T_FLOAT; }
};

//------------------------------StoreDNode-------------------------------------
Expand All @@ -741,7 +745,7 @@ class StoreDNode : public StoreNode {
MemOrd mo, bool require_atomic_access = false)
: StoreNode(c, mem, adr, at, val, mo), _require_atomic_access(require_atomic_access) {}
virtual int Opcode() const;
virtual BasicType memory_type() const { return T_DOUBLE; }
virtual BasicType value_basic_type() const { return T_DOUBLE; }
bool require_atomic_access() const { return _require_atomic_access; }

#ifndef PRODUCT
Expand All @@ -760,7 +764,7 @@ class StorePNode : public StoreNode {
StorePNode(Node *c, Node *mem, Node *adr, const TypePtr* at, Node *val, MemOrd mo)
: StoreNode(c, mem, adr, at, val, mo) {}
virtual int Opcode() const;
virtual BasicType memory_type() const { return T_ADDRESS; }
virtual BasicType value_basic_type() const { return T_ADDRESS; }
};

//------------------------------StoreNNode-------------------------------------
Expand All @@ -770,7 +774,7 @@ class StoreNNode : public StoreNode {
StoreNNode(Node *c, Node *mem, Node *adr, const TypePtr* at, Node *val, MemOrd mo)
: StoreNode(c, mem, adr, at, val, mo) {}
virtual int Opcode() const;
virtual BasicType memory_type() const { return T_NARROWOOP; }
virtual BasicType value_basic_type() const { return T_NARROWOOP; }
};

//------------------------------StoreNKlassNode--------------------------------------
Expand All @@ -780,7 +784,7 @@ class StoreNKlassNode : public StoreNNode {
StoreNKlassNode(Node *c, Node *mem, Node *adr, const TypePtr* at, Node *val, MemOrd mo)
: StoreNNode(c, mem, adr, at, val, mo) {}
virtual int Opcode() const;
virtual BasicType memory_type() const { return T_NARROWKLASS; }
virtual BasicType value_basic_type() const { return T_NARROWKLASS; }
};

//------------------------------SCMemProjNode---------------------------------------
Expand Down
12 changes: 6 additions & 6 deletions src/hotspot/share/opto/superword.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ void SuperWord::unrolling_analysis(const VLoop &vloop, int &local_loop_unroll_fa
// Ignore nodes with non-primitive type.
BasicType bt;
if (n->is_Mem()) {
bt = n->as_Mem()->memory_type();
bt = n->as_Mem()->value_basic_type();
} else {
bt = n->bottom_type()->basic_type();
}
Expand Down Expand Up @@ -191,7 +191,7 @@ void SuperWord::unrolling_analysis(const VLoop &vloop, int &local_loop_unroll_fa
BasicType bt;
Node* n = lpt->_body.at(i);
if (n->is_Mem()) {
bt = n->as_Mem()->memory_type();
bt = n->as_Mem()->value_basic_type();
} else {
bt = n->bottom_type()->basic_type();
}
Expand Down Expand Up @@ -564,7 +564,7 @@ void SuperWord::collect_valid_memops(GrowableArray<MemOp>& memops) const {
const VPointer& p = vpointer(mem);
if (p.is_valid() &&
!mem->is_LoadStore() &&
is_java_primitive(mem->memory_type())) {
is_java_primitive(mem->value_basic_type())) {
memops.append(MemOp(mem, &p, original_index++));
}
});
Expand Down Expand Up @@ -764,8 +764,8 @@ bool SuperWord::are_adjacent_refs(Node* s1, Node* s2) const {
if (!in_bb(s1) || !in_bb(s2)) return false;

// Do not use superword for non-primitives
if (!is_java_primitive(s1->as_Mem()->memory_type()) ||
!is_java_primitive(s2->as_Mem()->memory_type())) {
if (!is_java_primitive(s1->as_Mem()->value_basic_type()) ||
!is_java_primitive(s2->as_Mem()->value_basic_type())) {
return false;
}

Expand Down Expand Up @@ -2592,7 +2592,7 @@ void VLoopTypes::compute_vector_element_type() {
// Smallest type containing range of values
const Type* VLoopTypes::container_type(Node* n) const {
if (n->is_Mem()) {
BasicType bt = n->as_Mem()->memory_type();
BasicType bt = n->as_Mem()->value_basic_type();
if (n->is_Store() && (bt == T_CHAR)) {
// Use T_SHORT type instead of T_CHAR for stored values because any
// preceding arithmetic operation extends values to signed Int.
Expand Down
4 changes: 2 additions & 2 deletions src/hotspot/share/opto/vectornode.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1017,7 +1017,7 @@ class LoadVectorNode : public LoadNode {
virtual int Opcode() const;

virtual uint ideal_reg() const { return Matcher::vector_ideal_reg(memory_size()); }
virtual BasicType memory_type() const { return T_VOID; }
virtual BasicType value_basic_type() const { return T_VOID; }
virtual int memory_size() const { return vect_type()->length_in_bytes(); }
virtual Node* Ideal(PhaseGVN* phase, bool can_reshape);

Expand Down Expand Up @@ -1090,7 +1090,7 @@ class StoreVectorNode : public StoreNode {
virtual int Opcode() const;

virtual uint ideal_reg() const { return Matcher::vector_ideal_reg(memory_size()); }
virtual BasicType memory_type() const { return T_VOID; }
virtual BasicType value_basic_type() const { return T_VOID; }
virtual int memory_size() const { return vect_type()->length_in_bytes(); }
virtual Node* Ideal(PhaseGVN* phase, bool can_reshape);

Expand Down