128 ObjectValue(int id)
129 : _id(id)
130 , _klass(NULL)
131 , _field_values()
132 , _value()
133 , _visited(false) {}
134
135 // Accessors
136 bool is_object() const { return true; }
137 int id() const { return _id; }
138 ScopeValue* klass() const { return _klass; }
139 GrowableArray<ScopeValue*>* field_values() { return &_field_values; }
140 ScopeValue* field_at(int i) const { return _field_values.at(i); }
141 int field_size() { return _field_values.length(); }
142 Handle value() const { return _value; }
143 bool is_visited() const { return _visited; }
144
145 void set_value(oop value);
146 void set_visited(bool visited) { _visited = false; }
147
148 // Serialization of debugging information
149 void read_object(DebugInfoReadStream* stream);
150 void write_on(DebugInfoWriteStream* stream);
151
152 // Printing
153 void print_on(outputStream* st) const;
154 void print_fields_on(outputStream* st) const;
155 };
156
157 class AutoBoxObjectValue : public ObjectValue {
158 bool _cached;
159 public:
160 bool is_auto_box() const { return true; }
161 bool is_cached() const { return _cached; }
162 void set_cached(bool cached) { _cached = cached; }
163 AutoBoxObjectValue(int id, ScopeValue* klass) : ObjectValue(id, klass), _cached(false) { }
164 AutoBoxObjectValue(int id) : ObjectValue(id), _cached(false) { }
165 };
166
167
168 // A ConstantIntValue describes a constant int; i.e., the corresponding logical entity
169 // is either a source constant or its computation has been constant-folded.
170
171 class ConstantIntValue: public ScopeValue {
172 private:
173 jint _value;
174 public:
175 ConstantIntValue(jint value) { _value = value; }
176 jint value() const { return _value; }
177 bool is_constant_int() const { return true; }
178 bool equals(ScopeValue* other) const { return false; }
179
180 // Serialization of debugging information
181 ConstantIntValue(DebugInfoReadStream* stream);
182 void write_on(DebugInfoWriteStream* stream);
183
184 // Printing
185 void print_on(outputStream* st) const;
186 };
187
188 class ConstantLongValue: public ScopeValue {
189 private:
190 jlong _value;
191 public:
192 ConstantLongValue(jlong value) { _value = value; }
193 jlong value() const { return _value; }
194 bool is_constant_long() const { return true; }
195 bool equals(ScopeValue* other) const { return false; }
196
197 // Serialization of debugging information
198 ConstantLongValue(DebugInfoReadStream* stream);
199 void write_on(DebugInfoWriteStream* stream);
200
201 // Printing
202 void print_on(outputStream* st) const;
203 };
204
205 class ConstantDoubleValue: public ScopeValue {
206 private:
207 jdouble _value;
287 class DebugInfoReadStream : public CompressedReadStream {
288 private:
289 const CompiledMethod* _code;
290 const CompiledMethod* code() const { return _code; }
291 GrowableArray<ScopeValue*>* _obj_pool;
292 public:
293 DebugInfoReadStream(const CompiledMethod* code, int offset, GrowableArray<ScopeValue*>* obj_pool = NULL) :
294 CompressedReadStream(code->scopes_data_begin(), offset) {
295 _code = code;
296 _obj_pool = obj_pool;
297
298 } ;
299
300 oop read_oop();
301 Method* read_method() {
302 Method* o = (Method*)(code()->metadata_at(read_int()));
303 // is_metadata() is a faster check than is_metaspace_object()
304 assert(o == NULL || o->is_metadata(), "meta data only");
305 return o;
306 }
307 ScopeValue* read_object_value(bool is_auto_box);
308 ScopeValue* get_cached_object();
309 // BCI encoding is mostly unsigned, but -1 is a distinguished value
310 int read_bci() { return read_int() + InvocationEntryBci; }
311 };
312
313 // DebugInfoWriteStream specializes CompressedWriteStream for
314 // writing debugging information. Used by ScopeDescRecorder.
315
316 class DebugInfoWriteStream : public CompressedWriteStream {
317 private:
318 DebugInformationRecorder* _recorder;
319 DebugInformationRecorder* recorder() const { return _recorder; }
320 public:
321 DebugInfoWriteStream(DebugInformationRecorder* recorder, int initial_size);
322 void write_handle(jobject h);
323 void write_bci(int bci) { write_int(bci - InvocationEntryBci); }
324
325 void write_metadata(Metadata* m);
326 };
327
|
128 ObjectValue(int id)
129 : _id(id)
130 , _klass(NULL)
131 , _field_values()
132 , _value()
133 , _visited(false) {}
134
135 // Accessors
136 bool is_object() const { return true; }
137 int id() const { return _id; }
138 ScopeValue* klass() const { return _klass; }
139 GrowableArray<ScopeValue*>* field_values() { return &_field_values; }
140 ScopeValue* field_at(int i) const { return _field_values.at(i); }
141 int field_size() { return _field_values.length(); }
142 Handle value() const { return _value; }
143 bool is_visited() const { return _visited; }
144
145 void set_value(oop value);
146 void set_visited(bool visited) { _visited = false; }
147
148 virtual bool is_stack_object() { return false; }
149
150 // Serialization of debugging information
151 virtual void read_object(DebugInfoReadStream* stream);
152 void write_on(DebugInfoWriteStream* stream);
153
154 // Printing
155 void print_on(outputStream* st) const;
156 void print_fields_on(outputStream* st) const;
157 };
158
159 class AutoBoxObjectValue : public ObjectValue {
160 bool _cached;
161 public:
162 bool is_auto_box() const { return true; }
163 bool is_cached() const { return _cached; }
164 void set_cached(bool cached) { _cached = cached; }
165 AutoBoxObjectValue(int id, ScopeValue* klass) : ObjectValue(id, klass), _cached(false) { }
166 AutoBoxObjectValue(int id) : ObjectValue(id), _cached(false) { }
167 };
168
169
170 // A ConstantIntValue describes a constant int; i.e., the corresponding logical entity
171 // is either a source constant or its computation has been constant-folded.
172
173 class ConstantIntValue: public ScopeValue {
174 private:
175 jint _value;
176 public:
177 ConstantIntValue(jint value) { _value = value; }
178 jint value() const { return _value; }
179 bool is_constant_int() const { return true; }
180 bool equals(ScopeValue* other) const { return false; }
181
182 // Serialization of debugging information
183 ConstantIntValue(DebugInfoReadStream* stream);
184 void write_on(DebugInfoWriteStream* stream);
185
186 // Printing
187 void print_on(outputStream* st) const;
188 };
189
190 class StackObjectValue: public ObjectValue {
191 private:
192 Location _location;
193 ConstantIntValue *_field_length;
194 public:
195 StackObjectValue(int id, ScopeValue* klass, Location location, ConstantIntValue *field_length);
196 StackObjectValue(int id) : ObjectValue(id), _location(), _field_length(NULL) { }
197
198 Location get_stack_location() { return _location; }
199 ConstantIntValue* get_field_length() { return _field_length; }
200
201 bool is_stack_object(){ return true; }
202
203 // Serialization of debugging information
204 void read_object(DebugInfoReadStream* stream);
205 void write_on(DebugInfoWriteStream* stream);
206 };
207
208
209 class ConstantLongValue: public ScopeValue {
210 private:
211 jlong _value;
212 public:
213 ConstantLongValue(jlong value) { _value = value; }
214 jlong value() const { return _value; }
215 bool is_constant_long() const { return true; }
216 bool equals(ScopeValue* other) const { return false; }
217
218 // Serialization of debugging information
219 ConstantLongValue(DebugInfoReadStream* stream);
220 void write_on(DebugInfoWriteStream* stream);
221
222 // Printing
223 void print_on(outputStream* st) const;
224 };
225
226 class ConstantDoubleValue: public ScopeValue {
227 private:
228 jdouble _value;
308 class DebugInfoReadStream : public CompressedReadStream {
309 private:
310 const CompiledMethod* _code;
311 const CompiledMethod* code() const { return _code; }
312 GrowableArray<ScopeValue*>* _obj_pool;
313 public:
314 DebugInfoReadStream(const CompiledMethod* code, int offset, GrowableArray<ScopeValue*>* obj_pool = NULL) :
315 CompressedReadStream(code->scopes_data_begin(), offset) {
316 _code = code;
317 _obj_pool = obj_pool;
318
319 } ;
320
321 oop read_oop();
322 Method* read_method() {
323 Method* o = (Method*)(code()->metadata_at(read_int()));
324 // is_metadata() is a faster check than is_metaspace_object()
325 assert(o == NULL || o->is_metadata(), "meta data only");
326 return o;
327 }
328 ScopeValue* read_object_value(int type);
329 ScopeValue* get_cached_object();
330 // BCI encoding is mostly unsigned, but -1 is a distinguished value
331 int read_bci() { return read_int() + InvocationEntryBci; }
332 };
333
334 // DebugInfoWriteStream specializes CompressedWriteStream for
335 // writing debugging information. Used by ScopeDescRecorder.
336
337 class DebugInfoWriteStream : public CompressedWriteStream {
338 private:
339 DebugInformationRecorder* _recorder;
340 DebugInformationRecorder* recorder() const { return _recorder; }
341 public:
342 DebugInfoWriteStream(DebugInformationRecorder* recorder, int initial_size);
343 void write_handle(jobject h);
344 void write_bci(int bci) { write_int(bci - InvocationEntryBci); }
345
346 void write_metadata(Metadata* m);
347 };
348
|