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