37 ValueTypeNode(const TypeValueType* t, Node* oop)
38 : TypeNode(t, Values + t->value_klass()->param_count()) {
39 init_class_id(Class_ValueType);
40 init_req(Oop, oop);
41 }
42
43 // Get the klass defining the field layout of the value type
44 ciValueKlass* get_value_klass() const { return type()->is_valuetype()->value_klass(); }
45 // Initialize the value type by loading its field values from memory
46 void load_values(PhaseGVN& gvn, Node* mem, ciInstanceKlass* holder, Node* base, int base_offset = 0);
47 // Store the field values to memory
48 void store_values(GraphKit* kit, ciInstanceKlass* holder, Node* base, int base_offset = 0) const;
49
50 enum { Control, // Control input
51 Oop, // Oop of TypeValueTypePtr
52 Values // Nodes corresponding to field values
53 };
54
55 public:
56 // Create a new ValueTypeNode with uninitialized values
57 static Node* make(PhaseGVN& gvn, ciValueKlass* klass);
58 // Create a new ValueTypeNode and load its values from an oop
59 static Node* make(PhaseGVN& gvn, Node* mem, Node* oop);
60 // Create a new ValueTypeNode and load its values from a flattened value type field
61 static Node* make(PhaseGVN& gvn, ciValueKlass* klass, Node* mem, ciInstanceKlass* holder, Node* obj, int field_offset);
62
63 // Support for control flow merges
64 ValueTypeNode* clone_with_phis(PhaseGVN& gvn, Node* region);
65 Node* merge_with(GraphKit* kit, const ValueTypeNode* other, int pnum);
66
67 // Store the value type to memory if not yet allocated and returns the oop
68 Node* store_to_memory(GraphKit* kit);
69 // Store the value type in a field of an object
70 void store_to_field(GraphKit* kit, ciInstanceKlass* holder, Node* obj, int field_offset) const;
71
72 // Get oop for heap allocated value type (may be TypePtr::NULL_PTR)
73 Node* get_oop() const { return in(Oop); }
74 void set_oop(Node* oop) { set_req(Oop, oop); }
75
76 // Value type fields
77 uint field_count() const { return req() - Values; }
78 Node* get_field_value(uint index) const;
79 Node* get_field_value_by_offset(int offset, bool recursive = false) const;
80 void set_field_value(uint index, Node* value);
81 int get_field_offset(uint index) const;
82 ciType* get_field_type(uint index) const;
83
84 // Replace ValueTypeNodes in debug info at safepoints with SafePointScalarObjectNodes
85 void make_scalar_in_safepoints(Compile* C);
86
87 virtual Node* Ideal(PhaseGVN* phase, bool can_reshape);
88 virtual int Opcode() const;
89
90 #ifndef PRODUCT
91 virtual void dump_spec(outputStream* st) const;
92 #endif
93 };
94
95 #endif // SHARE_VM_OPTO_VALUETYPENODE_HPP
|
37 ValueTypeNode(const TypeValueType* t, Node* oop)
38 : TypeNode(t, Values + t->value_klass()->param_count()) {
39 init_class_id(Class_ValueType);
40 init_req(Oop, oop);
41 }
42
43 // Get the klass defining the field layout of the value type
44 ciValueKlass* get_value_klass() const { return type()->is_valuetype()->value_klass(); }
45 // Initialize the value type by loading its field values from memory
46 void load_values(PhaseGVN& gvn, Node* mem, ciInstanceKlass* holder, Node* base, int base_offset = 0);
47 // Store the field values to memory
48 void store_values(GraphKit* kit, ciInstanceKlass* holder, Node* base, int base_offset = 0) const;
49
50 enum { Control, // Control input
51 Oop, // Oop of TypeValueTypePtr
52 Values // Nodes corresponding to field values
53 };
54
55 public:
56 // Create a new ValueTypeNode with uninitialized values
57 static ValueTypeNode* make(PhaseGVN& gvn, ciValueKlass* klass);
58 // Create a new ValueTypeNode and load its values from an oop
59 static Node* make(PhaseGVN& gvn, Node* mem, Node* oop);
60 // Create a new ValueTypeNode and load its values from a flattened value type field
61 static Node* make(PhaseGVN& gvn, ciValueKlass* klass, Node* mem, ciInstanceKlass* holder, Node* obj, int field_offset);
62
63 // Support for control flow merges
64 ValueTypeNode* clone_with_phis(PhaseGVN& gvn, Node* region);
65 Node* merge_with(GraphKit* kit, const ValueTypeNode* other, int pnum);
66
67 // Store the value type to memory if not yet allocated and returns the oop
68 Node* store_to_memory(GraphKit* kit);
69 // Store the value type in a field of an object
70 void store_to_field(GraphKit* kit, ciInstanceKlass* holder, Node* obj, int field_offset) const;
71
72 // Get oop for heap allocated value type (may be TypePtr::NULL_PTR)
73 Node* get_oop() const { return in(Oop); }
74 void set_oop(Node* oop) { set_req(Oop, oop); }
75
76 // Value type fields
77 uint field_count() const { return req() - Values; }
78 Node* get_field_value(uint index) const;
79 Node* get_field_value_by_offset(int offset, bool recursive = false) const;
80 void set_field_value(uint index, Node* value);
81 int get_field_offset(uint index) const;
82 ciType* get_field_type(uint index) const;
83
84 // Replace ValueTypeNodes in debug info at safepoints with SafePointScalarObjectNodes
85 void make_scalar_in_safepoints(Compile* C);
86 uint set_arguments_for_java_call(CallJavaNode* call, int base_input, const GraphKit& kit, ciValueKlass* base_vk = NULL, int base_offset = 0);
87 virtual Node* Ideal(PhaseGVN* phase, bool can_reshape);
88 virtual int Opcode() const;
89
90 #ifndef PRODUCT
91 virtual void dump_spec(outputStream* st) const;
92 #endif
93 };
94
95 #endif // SHARE_VM_OPTO_VALUETYPENODE_HPP
|