--- old/src/share/vm/opto/valuetypenode.hpp 2016-11-16 09:06:14.278498639 +0100 +++ new/src/share/vm/opto/valuetypenode.hpp 2016-11-16 09:06:14.210498637 +0100 @@ -30,15 +30,22 @@ class GraphKit; -// TODO add comment +//------------------------------ValueTypeNode------------------------------------- +// Node representing a value type in C2 IR class ValueTypeNode : public TypeNode { private: ValueTypeNode(const TypeValueType* t, Node* oop) - : TypeNode(t, Values + t->value_klass()->field_count()) { + : TypeNode(t, Values + t->value_klass()->param_count()) { init_class_id(Class_ValueType); init_req(Oop, oop); } + + // Get the klass defining the field layout of the value type ciValueKlass* get_value_klass() const { return type()->is_valuetype()->value_klass(); } + // Initialize the value type by loading its field values from memory + void load_values(PhaseGVN& gvn, Node* mem, ciInstanceKlass* holder, Node* base, int base_offset = 0); + // Store the field values to memory + void store_values(GraphKit* kit, ciInstanceKlass* holder, Node* base, int base_offset = 0) const; enum { Control, // Control input Oop, // Oop of TypeValueTypePtr @@ -48,23 +55,31 @@ public: // Create a new ValueTypeNode with uninitialized values static Node* make(PhaseGVN& gvn, ciValueKlass* klass); - // Create a new ValueTypeNode and load its values from memory + // Create a new ValueTypeNode and load its values from an oop static Node* make(PhaseGVN& gvn, Node* mem, Node* oop); + // Create a new ValueTypeNode and load its values from a flattened value type field + static Node* make(PhaseGVN& gvn, ciValueKlass* klass, Node* mem, ciInstanceKlass* holder, Node* obj, int field_offset); + + // Support for control flow merges + ValueTypeNode* clone_with_phis(PhaseGVN& gvn, Node* region); + Node* merge_with(GraphKit* kit, const ValueTypeNode* other, int pnum); - // Stores the value type to memory if not yet allocated and returns the oop + // Store the value type to memory if not yet allocated and returns the oop Node* store_to_memory(GraphKit* kit); + // Store the value type in a field of an object + void store_to_field(GraphKit* kit, ciInstanceKlass* holder, Node* obj, int field_offset) const; // Get oop for heap allocated value type (may be TypePtr::NULL_PTR) Node* get_oop() const { return in(Oop); } void set_oop(Node* oop) { set_req(Oop, oop); } // Value type fields - uint field_count() const { return req() - Values; } + uint field_count() const { return req() - Values; } Node* get_field_value(uint index) const; - Node* get_field_value_by_offset(int field_offset) const; + Node* get_field_value_by_offset(int offset, bool recursive = false) const; void set_field_value(uint index, Node* value); int get_field_offset(uint index) const; - BasicType get_field_type(uint index) const; + ciType* get_field_type(uint index) const; // Replace ValueTypeNodes in debug info at safepoints with SafePointScalarObjectNodes void make_scalar_in_safepoints(Compile* C);