src/share/vm/code/scopeDesc.hpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File hotspot Sdiff src/share/vm/code

src/share/vm/code/scopeDesc.hpp

Print this page




  24 
  25 #ifndef SHARE_VM_CODE_SCOPEDESC_HPP
  26 #define SHARE_VM_CODE_SCOPEDESC_HPP
  27 
  28 #include "code/debugInfo.hpp"
  29 #include "code/pcDesc.hpp"
  30 #include "oops/method.hpp"
  31 #include "utilities/growableArray.hpp"
  32 
  33 // SimpleScopeDesc is used when all you need to extract from
  34 // a given pc,nmethod pair is a Method* and a bci. This is
  35 // quite a bit faster than allocating a full ScopeDesc, but
  36 // very limited in abilities.
  37 
  38 class SimpleScopeDesc : public StackObj {
  39  private:
  40   Method* _method;
  41   int _bci;
  42 
  43  public:
  44   SimpleScopeDesc(nmethod* code,address pc) {
  45     PcDesc* pc_desc = code->pc_desc_at(pc);
  46     assert(pc_desc != NULL, "Must be able to find matching PcDesc");
  47     DebugInfoReadStream buffer(code, pc_desc->scope_decode_offset());
  48     int ignore_sender = buffer.read_int();
  49     _method           = buffer.read_method();
  50     _bci              = buffer.read_bci();
  51   }
  52 
  53   Method* method() { return _method; }
  54   int bci() { return _bci; }
  55 };
  56 
  57 // ScopeDescs contain the information that makes source-level debugging of
  58 // nmethods possible; each scopeDesc describes a method activation
  59 
  60 class ScopeDesc : public ResourceObj {
  61  public:
  62   // Constructor
  63   ScopeDesc(const nmethod* code, int decode_offset, int obj_decode_offset, bool reexecute, bool return_oop);
  64 
  65   // Calls above, giving default value of "serialized_null" to the
  66   // "obj_decode_offset" argument.  (We don't use a default argument to
  67   // avoid a .hpp-.hpp dependency.)
  68   ScopeDesc(const nmethod* code, int decode_offset, bool reexecute, bool return_oop);
  69 
  70   // JVM state
  71   Method* method()      const { return _method; }
  72   int          bci()      const { return _bci;    }
  73   bool should_reexecute() const { return _reexecute; }

  74   bool return_oop()       const { return _return_oop; }
  75 
  76   GrowableArray<ScopeValue*>*   locals();
  77   GrowableArray<ScopeValue*>*   expressions();
  78   GrowableArray<MonitorValue*>* monitors();
  79   GrowableArray<ScopeValue*>*   objects();
  80 
  81   // Stack walking, returns NULL if this is the outer most scope.
  82   ScopeDesc* sender() const;
  83 
  84   // Returns where the scope was decoded
  85   int decode_offset() const { return _decode_offset; }
  86 
  87   // Tells whether sender() returns NULL
  88   bool is_top() const;
  89 
  90  private:
  91   // Alternative constructor
  92   ScopeDesc(const ScopeDesc* parent);
  93 
  94   // JVM state
  95   Method*       _method;
  96   int           _bci;
  97   bool          _reexecute;

  98   bool          _return_oop;
  99 
 100   // Decoding offsets
 101   int _decode_offset;
 102   int _sender_decode_offset;
 103   int _locals_decode_offset;
 104   int _expressions_decode_offset;
 105   int _monitors_decode_offset;
 106 
 107   // Object pool
 108   GrowableArray<ScopeValue*>* _objects;
 109 
 110   // Nmethod information
 111   const nmethod* _code;
 112 
 113   // Decoding operations
 114   void decode_body();
 115   GrowableArray<ScopeValue*>* decode_scope_values(int decode_offset);
 116   GrowableArray<MonitorValue*>* decode_monitor_values(int decode_offset);
 117   GrowableArray<ScopeValue*>* decode_object_values(int decode_offset);


  24 
  25 #ifndef SHARE_VM_CODE_SCOPEDESC_HPP
  26 #define SHARE_VM_CODE_SCOPEDESC_HPP
  27 
  28 #include "code/debugInfo.hpp"
  29 #include "code/pcDesc.hpp"
  30 #include "oops/method.hpp"
  31 #include "utilities/growableArray.hpp"
  32 
  33 // SimpleScopeDesc is used when all you need to extract from
  34 // a given pc,nmethod pair is a Method* and a bci. This is
  35 // quite a bit faster than allocating a full ScopeDesc, but
  36 // very limited in abilities.
  37 
  38 class SimpleScopeDesc : public StackObj {
  39  private:
  40   Method* _method;
  41   int _bci;
  42 
  43  public:
  44   SimpleScopeDesc(nmethod* code, address pc) {
  45     PcDesc* pc_desc = code->pc_desc_at(pc);
  46     assert(pc_desc != NULL, "Must be able to find matching PcDesc");
  47     DebugInfoReadStream buffer(code, pc_desc->scope_decode_offset());
  48     int ignore_sender = buffer.read_int();
  49     _method           = buffer.read_method();
  50     _bci              = buffer.read_bci();
  51   }
  52 
  53   Method* method() { return _method; }
  54   int bci() { return _bci; }
  55 };
  56 
  57 // ScopeDescs contain the information that makes source-level debugging of
  58 // nmethods possible; each scopeDesc describes a method activation
  59 
  60 class ScopeDesc : public ResourceObj {
  61  public:
  62   // Constructor
  63   ScopeDesc(const nmethod* code, int decode_offset, int obj_decode_offset, bool reexecute, bool rethrow_exception, bool return_oop);
  64 
  65   // Calls above, giving default value of "serialized_null" to the
  66   // "obj_decode_offset" argument.  (We don't use a default argument to
  67   // avoid a .hpp-.hpp dependency.)
  68   ScopeDesc(const nmethod* code, int decode_offset, bool reexecute, bool rethrow_exception, bool return_oop);
  69 
  70   // JVM state
  71   Method* method()      const { return _method; }
  72   int          bci()      const { return _bci;    }
  73   bool should_reexecute() const { return _reexecute; }
  74   bool rethrow_exception() const { return _rethrow_exception; }
  75   bool return_oop()       const { return _return_oop; }
  76 
  77   GrowableArray<ScopeValue*>*   locals();
  78   GrowableArray<ScopeValue*>*   expressions();
  79   GrowableArray<MonitorValue*>* monitors();
  80   GrowableArray<ScopeValue*>*   objects();
  81 
  82   // Stack walking, returns NULL if this is the outer most scope.
  83   ScopeDesc* sender() const;
  84 
  85   // Returns where the scope was decoded
  86   int decode_offset() const { return _decode_offset; }
  87 
  88   // Tells whether sender() returns NULL
  89   bool is_top() const;
  90 
  91  private:
  92   // Alternative constructor
  93   ScopeDesc(const ScopeDesc* parent);
  94 
  95   // JVM state
  96   Method*       _method;
  97   int           _bci;
  98   bool          _reexecute;
  99   bool          _rethrow_exception;
 100   bool          _return_oop;
 101 
 102   // Decoding offsets
 103   int _decode_offset;
 104   int _sender_decode_offset;
 105   int _locals_decode_offset;
 106   int _expressions_decode_offset;
 107   int _monitors_decode_offset;
 108 
 109   // Object pool
 110   GrowableArray<ScopeValue*>* _objects;
 111 
 112   // Nmethod information
 113   const nmethod* _code;
 114 
 115   // Decoding operations
 116   void decode_body();
 117   GrowableArray<ScopeValue*>* decode_scope_values(int decode_offset);
 118   GrowableArray<MonitorValue*>* decode_monitor_values(int decode_offset);
 119   GrowableArray<ScopeValue*>* decode_object_values(int decode_offset);
src/share/vm/code/scopeDesc.hpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File