1 /*
2 * Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
43 public:
44 SimpleScopeDesc(CompiledMethod* 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 CompiledMethod* 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 CompiledMethod* code, int decode_offset, bool reexecute, bool rethrow_exception, bool return_oop);
69
70 // Direct access to scope
71 ScopeDesc* at_offset(int decode_offset) { return new ScopeDesc(this, decode_offset); }
72
73 // JVM state
74 Method* method() const { return _method; }
75 int bci() const { return _bci; }
76 bool should_reexecute() const { return _reexecute; }
77 bool rethrow_exception() const { return _rethrow_exception; }
78 bool return_oop() const { return _return_oop; }
79
80 GrowableArray<ScopeValue*>* locals();
81 GrowableArray<ScopeValue*>* expressions();
82 GrowableArray<MonitorValue*>* monitors();
83 GrowableArray<ScopeValue*>* objects();
84
85 // Stack walking, returns NULL if this is the outer most scope.
86 ScopeDesc* sender() const;
87
88 // Returns where the scope was decoded
89 int decode_offset() const { return _decode_offset; }
90
91 int sender_decode_offset() const { return _sender_decode_offset; }
92
93 // Tells whether sender() returns NULL
94 bool is_top() const;
95
96 private:
97 void initialize(const ScopeDesc* parent, int decode_offset);
98 // Alternative constructors
99 ScopeDesc(const ScopeDesc* parent);
100 ScopeDesc(const ScopeDesc* parent, int decode_offset);
101
102 // JVM state
103 Method* _method;
104 int _bci;
105 bool _reexecute;
106 bool _rethrow_exception;
107 bool _return_oop;
108
109 // Decoding offsets
110 int _decode_offset;
111 int _sender_decode_offset;
112 int _locals_decode_offset;
113 int _expressions_decode_offset;
114 int _monitors_decode_offset;
115
116 // Object pool
117 GrowableArray<ScopeValue*>* _objects;
118
119 // Nmethod information
120 const CompiledMethod* _code;
121
122 // Decoding operations
123 void decode_body();
124 GrowableArray<ScopeValue*>* decode_scope_values(int decode_offset);
125 GrowableArray<MonitorValue*>* decode_monitor_values(int decode_offset);
126 GrowableArray<ScopeValue*>* decode_object_values(int decode_offset);
127
|
1 /*
2 * Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
43 public:
44 SimpleScopeDesc(CompiledMethod* 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 CompiledMethod* code, PcDesc* pd, bool ignore_objects = false);
64
65 // Direct access to scope
66 ScopeDesc* at_offset(int decode_offset) { return new ScopeDesc(this, decode_offset); }
67
68 // JVM state
69 Method* method() const { return _method; }
70 int bci() const { return _bci; }
71 bool should_reexecute() const { return _reexecute; }
72 bool rethrow_exception() const { return _rethrow_exception; }
73 bool return_oop() const { return _return_oop; }
74 // Returns true if one or more NoEscape or ArgEscape objects exist in
75 // any of the scopes at compiled pc.
76 bool has_ea_local_in_scope() const { return _has_ea_local_in_scope; }
77 bool arg_escape() const { return _arg_escape; }
78
79 GrowableArray<ScopeValue*>* locals();
80 GrowableArray<ScopeValue*>* expressions();
81 GrowableArray<MonitorValue*>* monitors();
82 GrowableArray<ScopeValue*>* objects();
83
84 // Stack walking, returns NULL if this is the outer most scope.
85 ScopeDesc* sender() const;
86
87 // Returns where the scope was decoded
88 int decode_offset() const { return _decode_offset; }
89
90 int sender_decode_offset() const { return _sender_decode_offset; }
91
92 // Tells whether sender() returns NULL
93 bool is_top() const;
94
95 private:
96 void initialize(const ScopeDesc* parent, int decode_offset);
97 // Alternative constructors
98 ScopeDesc(const ScopeDesc* parent);
99 ScopeDesc(const ScopeDesc* parent, int decode_offset);
100
101 // JVM state
102 Method* _method;
103 int _bci;
104 bool _reexecute;
105 bool _rethrow_exception;
106 bool _return_oop;
107 bool _has_ea_local_in_scope; // One or more NoEscape or ArgEscape objects exist in
108 // any of the scopes at compiled pc.
109 bool _arg_escape; // Compiled Java call in youngest scope passes ArgEscape
110
111 // Decoding offsets
112 int _decode_offset;
113 int _sender_decode_offset;
114 int _locals_decode_offset;
115 int _expressions_decode_offset;
116 int _monitors_decode_offset;
117
118 // Object pool
119 GrowableArray<ScopeValue*>* _objects;
120
121 // Nmethod information
122 const CompiledMethod* _code;
123
124 // Decoding operations
125 void decode_body();
126 GrowableArray<ScopeValue*>* decode_scope_values(int decode_offset);
127 GrowableArray<MonitorValue*>* decode_monitor_values(int decode_offset);
128 GrowableArray<ScopeValue*>* decode_object_values(int decode_offset);
129
|