113 // A placeholder value that has no concrete meaning other than helping constructing
114 // other values.
115
116 class MarkerValue: public ScopeValue {
117 public:
118 bool is_marker() const { return true; }
119
120 // Serialization of debugging information
121 void write_on(DebugInfoWriteStream* stream);
122
123 // Printing
124 void print_on(outputStream* st) const;
125 };
126
127 // An ObjectValue describes an object eliminated by escape analysis.
128
129 class ObjectValue: public ScopeValue {
130 protected:
131 int _id;
132 ScopeValue* _klass;
133 GrowableArray<ScopeValue*> _field_values;
134 Handle _value;
135 bool _visited;
136 bool _is_root; // Will be true if this object is referred to
137 // as a local/expression/monitor in the JVMs.
138 // Otherwise false, meaning it's just a candidate
139 // in an object allocation merge.
140 public:
141 ObjectValue(int id, ScopeValue* klass)
142 : _id(id)
143 , _klass(klass)
144 , _field_values()
145 , _value()
146 , _visited(false)
147 , _is_root(true) {
148 assert(klass->is_constant_oop(), "should be constant java mirror oop");
149 }
150
151 ObjectValue(int id)
152 : _id(id)
153 , _klass(nullptr)
154 , _field_values()
155 , _value()
156 , _visited(false)
157 , _is_root(true) {}
158
159 // Accessors
160 bool is_object() const { return true; }
161 int id() const { return _id; }
162 virtual ScopeValue* klass() const { return _klass; }
163 virtual GrowableArray<ScopeValue*>* field_values() { return &_field_values; }
164 virtual ScopeValue* field_at(int i) const { return _field_values.at(i); }
165 virtual int field_size() { return _field_values.length(); }
166 virtual Handle value() const { return _value; }
167 bool is_visited() const { return _visited; }
168 bool is_root() const { return _is_root; }
169
170 void set_id(int id) { _id = id; }
171 virtual void set_value(oop value);
172 void set_visited(bool visited) { _visited = visited; }
173 void set_root(bool root) { _is_root = root; }
174
175 // Serialization of debugging information
176 void read_object(DebugInfoReadStream* stream);
177 void write_on(DebugInfoWriteStream* stream);
178
179 // Printing
180 void print_on(outputStream* st) const;
181 void print_fields_on(outputStream* st) const;
182 };
183
184 // An ObjectMergeValue describes objects that were inputs to a Phi in C2 and at
185 // least one of them was scalar replaced.
186 // '_selector' is an integer value that will be '-1' if during the execution of
187 // the C2 compiled code the path taken was that of the Phi input that was NOT
188 // scalar replaced. In that case '_merge_pointer' is a pointer to an already
|
113 // A placeholder value that has no concrete meaning other than helping constructing
114 // other values.
115
116 class MarkerValue: public ScopeValue {
117 public:
118 bool is_marker() const { return true; }
119
120 // Serialization of debugging information
121 void write_on(DebugInfoWriteStream* stream);
122
123 // Printing
124 void print_on(outputStream* st) const;
125 };
126
127 // An ObjectValue describes an object eliminated by escape analysis.
128
129 class ObjectValue: public ScopeValue {
130 protected:
131 int _id;
132 ScopeValue* _klass;
133 ScopeValue* _is_init;
134 GrowableArray<ScopeValue*> _field_values;
135 Handle _value;
136 bool _visited;
137 bool _is_root; // Will be true if this object is referred to
138 // as a local/expression/monitor in the JVMs.
139 // Otherwise false, meaning it's just a candidate
140 // in an object allocation merge.
141 public:
142 ObjectValue(int id, ScopeValue* klass, ScopeValue* is_init = nullptr)
143 : _id(id)
144 , _klass(klass)
145 , _is_init(is_init)
146 , _field_values()
147 , _value()
148 , _visited(false)
149 , _is_root(true) {
150 assert(klass->is_constant_oop(), "should be constant java mirror oop");
151 }
152
153 ObjectValue(int id)
154 : _id(id)
155 , _klass(nullptr)
156 , _is_init(new MarkerValue())
157 , _field_values()
158 , _value()
159 , _visited(false)
160 , _is_root(true) {}
161
162 // Accessors
163 bool is_object() const { return true; }
164 int id() const { return _id; }
165 virtual ScopeValue* klass() const { return _klass; }
166 virtual ScopeValue* is_init() const { return _is_init; }
167 virtual GrowableArray<ScopeValue*>* field_values() { return &_field_values; }
168 virtual ScopeValue* field_at(int i) const { return _field_values.at(i); }
169 virtual int field_size() { return _field_values.length(); }
170 virtual Handle value() const { return _value; }
171 bool is_visited() const { return _visited; }
172 bool is_root() const { return _is_root; }
173 bool maybe_null() const { return !_is_init->is_marker(); }
174
175 void set_id(int id) { _id = id; }
176 virtual void set_value(oop value);
177 void set_visited(bool visited) { _visited = visited; }
178 void set_root(bool root) { _is_root = root; }
179
180 // Serialization of debugging information
181 void read_object(DebugInfoReadStream* stream);
182 void write_on(DebugInfoWriteStream* stream);
183
184 // Printing
185 void print_on(outputStream* st) const;
186 void print_fields_on(outputStream* st) const;
187 };
188
189 // An ObjectMergeValue describes objects that were inputs to a Phi in C2 and at
190 // least one of them was scalar replaced.
191 // '_selector' is an integer value that will be '-1' if during the execution of
192 // the C2 compiled code the path taken was that of the Phi input that was NOT
193 // scalar replaced. In that case '_merge_pointer' is a pointer to an already
|