1 /* |
1 /* |
2 * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
104 |
104 |
105 |
105 |
106 class javaVFrame: public vframe { |
106 class javaVFrame: public vframe { |
107 public: |
107 public: |
108 // JVM state |
108 // JVM state |
109 virtual methodOop method() const = 0; |
109 virtual Method* method() const = 0; |
110 virtual int bci() const = 0; |
110 virtual int bci() const = 0; |
111 virtual StackValueCollection* locals() const = 0; |
111 virtual StackValueCollection* locals() const = 0; |
112 virtual StackValueCollection* expressions() const = 0; |
112 virtual StackValueCollection* expressions() const = 0; |
113 // the order returned by monitors() is from oldest -> youngest#4418568 |
113 // the order returned by monitors() is from oldest -> youngest#4418568 |
114 virtual GrowableArray<MonitorInfo*>* monitors() const = 0; |
114 virtual GrowableArray<MonitorInfo*>* monitors() const = 0; |
156 }; |
156 }; |
157 |
157 |
158 class interpretedVFrame: public javaVFrame { |
158 class interpretedVFrame: public javaVFrame { |
159 public: |
159 public: |
160 // JVM state |
160 // JVM state |
161 methodOop method() const; |
161 Method* method() const; |
162 int bci() const; |
162 int bci() const; |
163 StackValueCollection* locals() const; |
163 StackValueCollection* locals() const; |
164 StackValueCollection* expressions() const; |
164 StackValueCollection* expressions() const; |
165 GrowableArray<MonitorInfo*>* monitors() const; |
165 GrowableArray<MonitorInfo*>* monitors() const; |
166 |
166 |
241 // 2) the monitor lock |
241 // 2) the monitor lock |
242 class MonitorInfo : public ResourceObj { |
242 class MonitorInfo : public ResourceObj { |
243 private: |
243 private: |
244 oop _owner; // the object owning the monitor |
244 oop _owner; // the object owning the monitor |
245 BasicLock* _lock; |
245 BasicLock* _lock; |
246 oop _owner_klass; // klass if owner was scalar replaced |
246 oop _owner_klass; // klass (mirror) if owner was scalar replaced |
247 bool _eliminated; |
247 bool _eliminated; |
248 bool _owner_is_scalar_replaced; |
248 bool _owner_is_scalar_replaced; |
249 public: |
249 public: |
250 // Constructor |
250 // Constructor |
251 MonitorInfo(oop owner, BasicLock* lock, bool eliminated, bool owner_is_scalar_replaced) { |
251 MonitorInfo(oop owner, BasicLock* lock, bool eliminated, bool owner_is_scalar_replaced) { |
264 // Accessors |
264 // Accessors |
265 oop owner() const { |
265 oop owner() const { |
266 assert(!_owner_is_scalar_replaced, "should not be called for scalar replaced object"); |
266 assert(!_owner_is_scalar_replaced, "should not be called for scalar replaced object"); |
267 return _owner; |
267 return _owner; |
268 } |
268 } |
269 klassOop owner_klass() const { |
269 oop owner_klass() const { |
270 assert(_owner_is_scalar_replaced, "should not be called for not scalar replaced object"); |
270 assert(_owner_is_scalar_replaced, "should not be called for not scalar replaced object"); |
271 return (klassOop)_owner_klass; |
271 return _owner_klass; |
272 } |
272 } |
273 BasicLock* lock() const { return _lock; } |
273 BasicLock* lock() const { return _lock; } |
274 bool eliminated() const { return _eliminated; } |
274 bool eliminated() const { return _eliminated; } |
275 bool owner_is_scalar_replaced() const { return _owner_is_scalar_replaced; } |
275 bool owner_is_scalar_replaced() const { return _owner_is_scalar_replaced; } |
276 }; |
276 }; |
284 enum { interpreted_mode, compiled_mode, at_end_mode } _mode; |
284 enum { interpreted_mode, compiled_mode, at_end_mode } _mode; |
285 |
285 |
286 int _sender_decode_offset; |
286 int _sender_decode_offset; |
287 |
287 |
288 // Cached information |
288 // Cached information |
289 methodOop _method; |
289 Method* _method; |
290 int _bci; |
290 int _bci; |
291 |
291 |
292 // Should VM activations be ignored or not |
292 // Should VM activations be ignored or not |
293 bool _stop_at_java_call_stub; |
293 bool _stop_at_java_call_stub; |
294 |
294 |
309 vframeStreamCommon(JavaThread* thread) : _reg_map(thread, false) { |
309 vframeStreamCommon(JavaThread* thread) : _reg_map(thread, false) { |
310 _thread = thread; |
310 _thread = thread; |
311 } |
311 } |
312 |
312 |
313 // Accessors |
313 // Accessors |
314 methodOop method() const { return _method; } |
314 Method* method() const { return _method; } |
315 int bci() const { return _bci; } |
315 int bci() const { return _bci; } |
316 intptr_t* frame_id() const { return _frame.id(); } |
316 intptr_t* frame_id() const { return _frame.id(); } |
317 address frame_pc() const { return _frame.pc(); } |
317 address frame_pc() const { return _frame.pc(); } |
318 |
318 |
319 CodeBlob* cb() const { return _frame.cb(); } |
319 CodeBlob* cb() const { return _frame.cb(); } |
412 } |
412 } |
413 |
413 |
414 // Decode first part of scopeDesc |
414 // Decode first part of scopeDesc |
415 DebugInfoReadStream buffer(nm(), decode_offset); |
415 DebugInfoReadStream buffer(nm(), decode_offset); |
416 _sender_decode_offset = buffer.read_int(); |
416 _sender_decode_offset = buffer.read_int(); |
417 _method = methodOop(buffer.read_oop()); |
417 _method = buffer.read_method(); |
418 _bci = buffer.read_bci(); |
418 _bci = buffer.read_bci(); |
419 |
419 |
420 assert(_method->is_method(), "checking type of decoded method"); |
420 assert(_method->is_method(), "checking type of decoded method"); |
421 } |
421 } |
422 |
422 |
507 return false; |
507 return false; |
508 } |
508 } |
509 |
509 |
510 |
510 |
511 inline void vframeStreamCommon::fill_from_interpreter_frame() { |
511 inline void vframeStreamCommon::fill_from_interpreter_frame() { |
512 methodOop method = _frame.interpreter_frame_method(); |
512 Method* method = _frame.interpreter_frame_method(); |
513 intptr_t bcx = _frame.interpreter_frame_bcx(); |
513 intptr_t bcx = _frame.interpreter_frame_bcx(); |
514 int bci = method->validate_bci_from_bcx(bcx); |
514 int bci = method->validate_bci_from_bcx(bcx); |
515 // 6379830 AsyncGetCallTrace sometimes feeds us wild frames. |
515 // 6379830 AsyncGetCallTrace sometimes feeds us wild frames. |
516 if (bci < 0) { |
516 if (bci < 0) { |
517 found_bad_method_frame(); |
517 found_bad_method_frame(); |