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_scalar_replaced; // Whether this ObjectValue describes an object scalar replaced or just
137 // an object (possibly null) participating in an allocation merge.
138 bool _is_root; // Will be true if this object is referred to
139 // as a local/expression/monitor in the JVMs.
140 // Otherwise false, meaning it's just a candidate
141 // in an object allocation merge.
142 public:
143 ObjectValue(int id, ScopeValue* klass = nullptr, bool is_scalar_replaced = true)
144 : _id(id)
145 , _klass(klass)
146 , _field_values()
147 , _value()
148 , _visited(false)
149 , _is_scalar_replaced(is_scalar_replaced)
150 , _is_root(true) {
151 assert(klass == nullptr || klass->is_constant_oop(), "should be constant java mirror oop");
152 }
153
154 // Accessors
155 bool is_object() const { return true; }
156 int id() const { return _id; }
157 virtual ScopeValue* klass() const { return _klass; }
158 virtual GrowableArray<ScopeValue*>* field_values() { return &_field_values; }
159 virtual ScopeValue* field_at(int i) const { return _field_values.at(i); }
160 virtual int field_size() { return _field_values.length(); }
161 virtual Handle value() const { return _value; }
162 bool is_visited() const { return _visited; }
163 bool is_scalar_replaced() const { return _is_scalar_replaced; }
164 bool is_root() const { return _is_root; }
165
166 void set_id(int id) { _id = id; }
167 virtual void set_value(oop value);
168 void set_visited(bool visited) { _visited = visited; }
169 void set_is_scalar_replaced(bool scd) { _is_scalar_replaced = scd; }
170 void set_root(bool root) { _is_root = root; }
171
172 // Serialization of debugging information
173 void read_object(DebugInfoReadStream* stream);
174 void write_on(DebugInfoWriteStream* stream);
175
176 // Printing
177 void print_on(outputStream* st) const;
178 void print_fields_on(outputStream* st) const;
179 };
180
181 // An ObjectMergeValue describes objects that were inputs to a Phi in C2 and at
182 // least one of them was scalar replaced.
183 // '_selector' is an integer value that will be '-1' if during the execution of
184 // the C2 compiled code the path taken was that of the Phi input that was NOT
|
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_scalar_replaced; // Whether this ObjectValue describes an object scalar replaced or just
138 // an object (possibly null) participating in an allocation merge.
139 bool _is_root; // Will be true if this object is referred to
140 // as a local/expression/monitor in the JVMs.
141 // Otherwise false, meaning it's just a candidate
142 // in an object allocation merge.
143 public:
144 ObjectValue(int id, ScopeValue* klass = nullptr, bool is_scalar_replaced = true, ScopeValue* is_init = nullptr)
145 : _id(id)
146 , _klass(klass)
147 , _is_init((is_init == nullptr) ? new MarkerValue() : is_init)
148 , _field_values()
149 , _value()
150 , _visited(false)
151 , _is_scalar_replaced(is_scalar_replaced)
152 , _is_root(true) {
153 assert(klass == nullptr || klass->is_constant_oop(), "should be constant java mirror oop");
154 }
155
156 // Accessors
157 bool is_object() const { return true; }
158 int id() const { return _id; }
159 virtual ScopeValue* klass() const { return _klass; }
160 virtual ScopeValue* is_init() const { return _is_init; }
161 virtual GrowableArray<ScopeValue*>* field_values() { return &_field_values; }
162 virtual ScopeValue* field_at(int i) const { return _field_values.at(i); }
163 virtual int field_size() { return _field_values.length(); }
164 virtual Handle value() const { return _value; }
165 bool is_visited() const { return _visited; }
166 bool is_scalar_replaced() const { return _is_scalar_replaced; }
167 bool is_root() const { return _is_root; }
168 bool maybe_null() const { return !_is_init->is_marker(); }
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_is_scalar_replaced(bool scd) { _is_scalar_replaced = scd; }
174 void set_root(bool root) { _is_root = root; }
175
176 // Serialization of debugging information
177 void read_object(DebugInfoReadStream* stream);
178 void write_on(DebugInfoWriteStream* stream);
179
180 // Printing
181 void print_on(outputStream* st) const;
182 void print_fields_on(outputStream* st) const;
183 };
184
185 // An ObjectMergeValue describes objects that were inputs to a Phi in C2 and at
186 // least one of them was scalar replaced.
187 // '_selector' is an integer value that will be '-1' if during the execution of
188 // the C2 compiled code the path taken was that of the Phi input that was NOT
|