< prev index next >

src/hotspot/share/runtime/vframe.hpp

Print this page

 42 // us to unfold a frame as a stack of vframes.
 43 // A cVFrame represents an activation of a non-java method.
 44 
 45 // The vframe inheritance hierarchy:
 46 // - vframe
 47 //   - javaVFrame
 48 //     - interpretedVFrame
 49 //     - compiledVFrame     ; (used for both compiled Java methods and native stubs)
 50 //   - externalVFrame
 51 //     - entryVFrame        ; special frame created when calling Java from C
 52 
 53 // - BasicLock
 54 
 55 class StackFrameStream;
 56 
 57 class vframe: public ResourceObj {
 58  protected:
 59   frame        _fr;      // Raw frame behind the virtual frame.
 60   RegisterMap  _reg_map; // Register map for the raw frame (used to handle callee-saved registers).
 61   JavaThread*  _thread;  // The thread owning the raw frame.

 62 
 63   vframe(const frame* fr, const RegisterMap* reg_map, JavaThread* thread);
 64   vframe(const frame* fr, JavaThread* thread);

 65  public:
 66   // Factory methods for creating vframes
 67   static vframe* new_vframe(const frame* f, const RegisterMap *reg_map, JavaThread* thread);
 68   static vframe* new_vframe(StackFrameStream& fst, JavaThread* thread);
 69 
 70   // Accessors
 71   frame              fr()           const { return _fr;       }
 72   CodeBlob*          cb()         const { return _fr.cb();  }
 73   CompiledMethod*   nm()         const {
 74       assert( cb() != NULL && cb()->is_compiled(), "usage");
 75       return (CompiledMethod*) cb();
 76   }
 77 
 78 // ???? Does this need to be a copy?
 79   frame*             frame_pointer() { return &_fr;       }
 80   const RegisterMap* register_map() const { return &_reg_map; }
 81   JavaThread*        thread()       const { return _thread;   }


 82 
 83   // Returns the sender vframe
 84   virtual vframe* sender() const;
 85 
 86   // Returns the next javaVFrame on the stack (skipping all other kinds of frame)
 87   javaVFrame *java_sender() const;
 88 



 89   // Answers if the this is the top vframe in the frame, i.e., if the sender vframe
 90   // is in the caller frame
 91   virtual bool is_top() const { return true; }
 92 
 93   // Returns top vframe within same frame (see is_top())
 94   virtual vframe* top() const;
 95 
 96   // Type testing operations
 97   virtual bool is_entry_frame()       const { return false; }
 98   virtual bool is_java_frame()        const { return false; }
 99   virtual bool is_interpreted_frame() const { return false; }
100   virtual bool is_compiled_frame()    const { return false; }
101 
102 #ifndef PRODUCT
103   // printing operations
104   virtual void print_value() const;
105   virtual void print();
106 #endif
107 };
108 

254  public:
255   // Constructor
256   MonitorInfo(oop owner, BasicLock* lock, bool eliminated, bool owner_is_scalar_replaced);
257   // Accessors
258   oop owner() const {
259     assert(!_owner_is_scalar_replaced, "should not be called for scalar replaced object");
260     return _owner();
261   }
262   oop owner_klass() const {
263     assert(_owner_is_scalar_replaced, "should not be called for not scalar replaced object");
264     return _owner_klass();
265   }
266   BasicLock* lock()  const { return _lock;  }
267   bool eliminated()  const { return _eliminated; }
268   bool owner_is_scalar_replaced()  const { return _owner_is_scalar_replaced; }
269 };
270 
271 class vframeStreamCommon : StackObj {
272  protected:
273   // common
274   frame        _prev_frame;
275   frame        _frame;
276   JavaThread*  _thread;
277   RegisterMap  _reg_map;
278   enum { interpreted_mode, compiled_mode, at_end_mode } _mode;
279 
280   // For compiled_mode
281   int _decode_offset;
282   int _sender_decode_offset;
283   int _vframe_id;
284 
285   // Cached information
286   Method* _method;
287   int       _bci;

288 
289   // Should VM activations be ignored or not
290   bool _stop_at_java_call_stub;

291 
292   bool fill_in_compiled_inlined_sender();
293   void fill_from_compiled_frame(int decode_offset);
294   void fill_from_compiled_native_frame();
295 
296   void fill_from_interpreter_frame();
297   bool fill_from_frame();
298 
299   // Helper routine for security_get_caller_frame
300   void skip_prefixed_method_and_wrappers();
301 
302   DEBUG_ONLY(void found_bad_method_frame() const;)
303 
304  public:
305   // Constructor
306   inline vframeStreamCommon(JavaThread* thread, bool process_frames);
307 
308   // Accessors
309   Method* method() const { return _method; }
310   int bci() const { return _bci; }
311   inline intptr_t* frame_id() const;
312   address frame_pc() const { return _frame.pc(); }
313   inline int vframe_id() const;
314   inline int decode_offset() const;

315 
316   CodeBlob*          cb()         const { return _frame.cb();  }
317   CompiledMethod*   nm()         const {
318       assert( cb() != NULL && cb()->is_compiled(), "usage");
319       return (CompiledMethod*) cb();
320   }
321 


322   javaVFrame* asJavaVFrame();
323 
324   // Frame type
325   inline bool is_interpreted_frame() const;
326   inline bool is_entry_frame() const;
327 
328   // Iteration
329   inline void next();
330   void security_next();
331 
332   bool at_end() const { return _mode == at_end_mode; }
333 
334   // Implements security traversal. Skips depth no. of frame including
335   // special security frames and prefixed native methods
336   void security_get_caller_frame(int depth);
337 };
338 
339 class vframeStream : public vframeStreamCommon {
340  public:
341   // Constructors
342   vframeStream(JavaThread* thread, bool stop_at_java_call_stub = false, bool process_frames = true);


343 
344   // top_frame may not be at safepoint, start with sender
345   vframeStream(JavaThread* thread, frame top_frame, bool stop_at_java_call_stub = false);


346 };
347 
348 #endif // SHARE_RUNTIME_VFRAME_HPP

 42 // us to unfold a frame as a stack of vframes.
 43 // A cVFrame represents an activation of a non-java method.
 44 
 45 // The vframe inheritance hierarchy:
 46 // - vframe
 47 //   - javaVFrame
 48 //     - interpretedVFrame
 49 //     - compiledVFrame     ; (used for both compiled Java methods and native stubs)
 50 //   - externalVFrame
 51 //     - entryVFrame        ; special frame created when calling Java from C
 52 
 53 // - BasicLock
 54 
 55 class StackFrameStream;
 56 
 57 class vframe: public ResourceObj {
 58  protected:
 59   frame        _fr;      // Raw frame behind the virtual frame.
 60   RegisterMap  _reg_map; // Register map for the raw frame (used to handle callee-saved registers).
 61   JavaThread*  _thread;  // The thread owning the raw frame.
 62   stackChunkHandle _chunk;
 63 
 64   vframe(const frame* fr, const RegisterMap* reg_map, JavaThread* thread);
 65   vframe(const frame* fr, JavaThread* thread);
 66 
 67  public:
 68   // Factory methods for creating vframes
 69   static vframe* new_vframe(const frame* f, const RegisterMap *reg_map, JavaThread* thread);
 70   static vframe* new_vframe(StackFrameStream& fst, JavaThread* thread);
 71 
 72   // Accessors
 73   frame             fr() const { return _fr;       }
 74   CodeBlob*         cb() const { return _fr.cb();  }
 75   CompiledMethod*   nm() const {
 76       assert( cb() != NULL && cb()->is_compiled(), "usage");
 77       return (CompiledMethod*) cb();
 78   }
 79 
 80 // ???? Does this need to be a copy?
 81   frame*             frame_pointer() { return &_fr;       }
 82   const RegisterMap* register_map() const { return &_reg_map; }
 83   JavaThread*        thread()       const { return _thread;   }
 84   stackChunkOop      stack_chunk()  const { return _chunk(); /*_reg_map.stack_chunk();*/ }
 85   oop                continuation() const { return stack_chunk() != NULL ? stack_chunk()->cont() : (oop)NULL; }
 86 
 87   // Returns the sender vframe
 88   virtual vframe* sender() const;
 89 
 90   // Returns the next javaVFrame on the stack (skipping all other kinds of frame)
 91   javaVFrame *java_sender() const;
 92 
 93   // Call when resuming a walk (calling [java_]sender) on a frame we'e already walked past
 94   void restore_register_map() const;
 95 
 96   // Answers if the this is the top vframe in the frame, i.e., if the sender vframe
 97   // is in the caller frame
 98   virtual bool is_top() const { return true; }
 99 
100   // Returns top vframe within same frame (see is_top())
101   virtual vframe* top() const;
102 
103   // Type testing operations
104   virtual bool is_entry_frame()       const { return false; }
105   virtual bool is_java_frame()        const { return false; }
106   virtual bool is_interpreted_frame() const { return false; }
107   virtual bool is_compiled_frame()    const { return false; }
108 
109 #ifndef PRODUCT
110   // printing operations
111   virtual void print_value() const;
112   virtual void print();
113 #endif
114 };
115 

261  public:
262   // Constructor
263   MonitorInfo(oop owner, BasicLock* lock, bool eliminated, bool owner_is_scalar_replaced);
264   // Accessors
265   oop owner() const {
266     assert(!_owner_is_scalar_replaced, "should not be called for scalar replaced object");
267     return _owner();
268   }
269   oop owner_klass() const {
270     assert(_owner_is_scalar_replaced, "should not be called for not scalar replaced object");
271     return _owner_klass();
272   }
273   BasicLock* lock()  const { return _lock;  }
274   bool eliminated()  const { return _eliminated; }
275   bool owner_is_scalar_replaced()  const { return _owner_is_scalar_replaced; }
276 };
277 
278 class vframeStreamCommon : StackObj {
279  protected:
280   // common

281   frame        _frame;
282   JavaThread*  _thread;
283   RegisterMap  _reg_map;
284   enum { interpreted_mode, compiled_mode, at_end_mode } _mode;
285 
286   // For compiled_mode
287   int _decode_offset;
288   int _sender_decode_offset;
289   int _vframe_id;
290 
291   // Cached information
292   Method* _method;
293   int       _bci;
294   ContinuationEntry* _cont;
295 
296   // Should VM activations be ignored or not
297   bool _stop_at_java_call_stub;
298   Handle _continuation_scope; // stop at bottom of continuation with this scope
299 
300   bool fill_in_compiled_inlined_sender();
301   void fill_from_compiled_frame(int decode_offset);
302   void fill_from_compiled_native_frame();
303 
304   void fill_from_interpreter_frame();
305   bool fill_from_frame();
306 
307   // Helper routine for security_get_caller_frame
308   void skip_prefixed_method_and_wrappers();
309 
310   DEBUG_ONLY(void found_bad_method_frame() const;)
311 
312  public:
313   // Constructor
314   inline vframeStreamCommon(RegisterMap reg_map);
315 
316   // Accessors
317   Method* method() const { return _method; }
318   int bci() const { return _bci; }
319   inline intptr_t* frame_id() const;
320   address frame_pc() const { return _frame.pc(); }
321   inline int vframe_id() const;
322   inline int decode_offset() const;
323   inline oop continuation() const;
324 
325   CodeBlob*         cb()         const { return _frame.cb();  }
326   CompiledMethod*   nm()         const {
327       assert( cb() != NULL && cb()->is_compiled(), "usage");
328       return (CompiledMethod*) cb();
329   }
330 
331   const RegisterMap* reg_map() { return &_reg_map; }
332 
333   javaVFrame* asJavaVFrame();
334 
335   // Frame type
336   inline bool is_interpreted_frame() const;
337   inline bool is_entry_frame() const;
338 
339   // Iteration
340   inline void next();
341   void security_next();
342 
343   bool at_end() const { return _mode == at_end_mode; }
344 
345   // Implements security traversal. Skips depth no. of frame including
346   // special security frames and prefixed native methods
347   void security_get_caller_frame(int depth);
348 };
349 
350 class vframeStream : public vframeStreamCommon {
351  public:
352   // Constructors
353   vframeStream(JavaThread* thread, bool stop_at_java_call_stub = false, bool process_frames = true, bool vthread_carrier = false);
354 
355   vframeStream(JavaThread* thread, Handle continuation_scope, bool stop_at_java_call_stub = false);
356 
357   // top_frame may not be at safepoint, start with sender
358   vframeStream(JavaThread* thread, frame top_frame, bool stop_at_java_call_stub = false);
359 
360   vframeStream(oop continuation, Handle continuation_scope = Handle());
361 };
362 
363 #endif // SHARE_RUNTIME_VFRAME_HPP
< prev index next >