< prev index next >

src/hotspot/share/runtime/vframe.cpp

Print this page

 33 #include "code/pcDesc.hpp"
 34 #include "code/scopeDesc.hpp"
 35 #include "interpreter/interpreter.hpp"
 36 #include "interpreter/oopMapCache.hpp"
 37 #include "memory/resourceArea.hpp"
 38 #include "oops/instanceKlass.hpp"
 39 #include "oops/method.inline.hpp"
 40 #include "oops/oop.inline.hpp"
 41 #include "oops/stackChunkOop.hpp"
 42 #include "prims/jvmtiExport.hpp"
 43 #include "runtime/frame.inline.hpp"
 44 #include "runtime/globals.hpp"
 45 #include "runtime/handles.inline.hpp"
 46 #include "runtime/javaThread.inline.hpp"
 47 #include "runtime/objectMonitor.hpp"
 48 #include "runtime/objectMonitor.inline.hpp"
 49 #include "runtime/osThread.hpp"
 50 #include "runtime/signature.hpp"
 51 #include "runtime/stackFrameStream.inline.hpp"
 52 #include "runtime/stubRoutines.hpp"
 53 #include "runtime/synchronizer.hpp"
 54 #include "runtime/vframe.inline.hpp"
 55 #include "runtime/vframeArray.hpp"
 56 #include "runtime/vframe_hp.hpp"
 57 
 58 vframe::vframe(const frame* fr, const RegisterMap* reg_map, JavaThread* thread)
 59 : _reg_map(reg_map), _thread(thread),
 60   _chunk(Thread::current(), reg_map->stack_chunk()()) {
 61   assert(fr != nullptr, "must have frame");
 62   _fr = *fr;
 63 }
 64 
 65 vframe* vframe::new_vframe(const frame* f, const RegisterMap* reg_map, JavaThread* thread) {
 66   // Interpreter frame
 67   if (f->is_interpreted_frame()) {
 68     return new interpretedVFrame(f, reg_map, thread);
 69   }
 70 
 71   // Compiled frame
 72   CodeBlob* cb = f->cb();
 73   if (cb != nullptr) {

229           Handle obj(current, monitor->owner());
230           if (obj() != nullptr) {
231             print_locked_object_class_name(st, obj, "eliminated");
232           }
233         }
234         continue;
235       }
236       if (monitor->owner() != nullptr) {
237         // the monitor is associated with an object, i.e., it is locked
238 
239         const char *lock_state = "locked"; // assume we have the monitor locked
240         if (!found_first_monitor && frame_count == 0) {
241           // If this is the first frame and we haven't found an owned
242           // monitor before, then we need to see if we have completed
243           // the lock or if we are blocked trying to acquire it. Only
244           // an inflated monitor that is first on the monitor list in
245           // the first frame can block us on a monitor enter.
246           markWord mark = monitor->owner()->mark();
247           // The first stage of async deflation does not affect any field
248           // used by this comparison so the ObjectMonitor* is usable here.
249           if (mark.has_monitor() &&
250               ( // we have marked ourself as pending on this monitor
251                 mark.monitor() == thread()->current_pending_monitor() ||



252                 // we are not the owner of this monitor
253                 !mark.monitor()->is_entered(thread())
254               )) {
255             lock_state = "waiting to lock";
256           }
257         }
258         print_locked_object_class_name(st, Handle(current, monitor->owner()), lock_state);
259 
260         found_first_monitor = true;
261       }
262     }
263   }
264 }
265 
266 // ------------- interpretedVFrame --------------
267 
268 u_char* interpretedVFrame::bcp() const {
269   return stack_chunk() == nullptr ? fr().interpreter_frame_bcp() : stack_chunk()->interpreter_frame_bcp(fr());
270 }
271 
272 intptr_t* interpretedVFrame::locals_addr_at(int offset) const {
273   assert(stack_chunk() == nullptr, "Not supported for heap frames"); // unsupported for now because seems to be unused
274   assert(fr().is_interpreted_frame(), "frame should be an interpreted frame");
275   return fr().interpreter_frame_local_at(offset);

 33 #include "code/pcDesc.hpp"
 34 #include "code/scopeDesc.hpp"
 35 #include "interpreter/interpreter.hpp"
 36 #include "interpreter/oopMapCache.hpp"
 37 #include "memory/resourceArea.hpp"
 38 #include "oops/instanceKlass.hpp"
 39 #include "oops/method.inline.hpp"
 40 #include "oops/oop.inline.hpp"
 41 #include "oops/stackChunkOop.hpp"
 42 #include "prims/jvmtiExport.hpp"
 43 #include "runtime/frame.inline.hpp"
 44 #include "runtime/globals.hpp"
 45 #include "runtime/handles.inline.hpp"
 46 #include "runtime/javaThread.inline.hpp"
 47 #include "runtime/objectMonitor.hpp"
 48 #include "runtime/objectMonitor.inline.hpp"
 49 #include "runtime/osThread.hpp"
 50 #include "runtime/signature.hpp"
 51 #include "runtime/stackFrameStream.inline.hpp"
 52 #include "runtime/stubRoutines.hpp"
 53 #include "runtime/synchronizer.inline.hpp"
 54 #include "runtime/vframe.inline.hpp"
 55 #include "runtime/vframeArray.hpp"
 56 #include "runtime/vframe_hp.hpp"
 57 
 58 vframe::vframe(const frame* fr, const RegisterMap* reg_map, JavaThread* thread)
 59 : _reg_map(reg_map), _thread(thread),
 60   _chunk(Thread::current(), reg_map->stack_chunk()()) {
 61   assert(fr != nullptr, "must have frame");
 62   _fr = *fr;
 63 }
 64 
 65 vframe* vframe::new_vframe(const frame* f, const RegisterMap* reg_map, JavaThread* thread) {
 66   // Interpreter frame
 67   if (f->is_interpreted_frame()) {
 68     return new interpretedVFrame(f, reg_map, thread);
 69   }
 70 
 71   // Compiled frame
 72   CodeBlob* cb = f->cb();
 73   if (cb != nullptr) {

229           Handle obj(current, monitor->owner());
230           if (obj() != nullptr) {
231             print_locked_object_class_name(st, obj, "eliminated");
232           }
233         }
234         continue;
235       }
236       if (monitor->owner() != nullptr) {
237         // the monitor is associated with an object, i.e., it is locked
238 
239         const char *lock_state = "locked"; // assume we have the monitor locked
240         if (!found_first_monitor && frame_count == 0) {
241           // If this is the first frame and we haven't found an owned
242           // monitor before, then we need to see if we have completed
243           // the lock or if we are blocked trying to acquire it. Only
244           // an inflated monitor that is first on the monitor list in
245           // the first frame can block us on a monitor enter.
246           markWord mark = monitor->owner()->mark();
247           // The first stage of async deflation does not affect any field
248           // used by this comparison so the ObjectMonitor* is usable here.
249           if (mark.has_monitor()) {
250             ObjectMonitor* mon = ObjectSynchronizer::read_monitor(current, monitor->owner(), mark);
251             if (// if the monitor is null we must be in the process of locking
252                 mon == nullptr ||
253                 // we have marked ourself as pending on this monitor
254                 mon == thread()->current_pending_monitor() ||
255                 // we are not the owner of this monitor
256                 !mon->is_entered(thread())) {
257               lock_state = "waiting to lock";
258             }
259           }
260         }
261         print_locked_object_class_name(st, Handle(current, monitor->owner()), lock_state);
262 
263         found_first_monitor = true;
264       }
265     }
266   }
267 }
268 
269 // ------------- interpretedVFrame --------------
270 
271 u_char* interpretedVFrame::bcp() const {
272   return stack_chunk() == nullptr ? fr().interpreter_frame_bcp() : stack_chunk()->interpreter_frame_bcp(fr());
273 }
274 
275 intptr_t* interpretedVFrame::locals_addr_at(int offset) const {
276   assert(stack_chunk() == nullptr, "Not supported for heap frames"); // unsupported for now because seems to be unused
277   assert(fr().is_interpreted_frame(), "frame should be an interpreted frame");
278   return fr().interpreter_frame_local_at(offset);
< prev index next >