1 /*
2 * Copyright (c) 1997, 2009, 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 *
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
108 void decode_body();
109 GrowableArray<ScopeValue*>* decode_scope_values(int decode_offset);
110 GrowableArray<MonitorValue*>* decode_monitor_values(int decode_offset);
111 GrowableArray<ScopeValue*>* decode_object_values(int decode_offset);
112
113 DebugInfoReadStream* stream_at(int decode_offset) const;
114
115
116 public:
117 // Verification
118 void verify();
119
120 #ifndef PRODUCT
121 public:
122 // Printing support
123 void print_on(outputStream* st) const;
124 void print_on(outputStream* st, PcDesc* pd) const;
125 void print_value_on(outputStream* st) const;
126 #endif
127 };
|
1 /*
2 * Copyright (c) 1997, 2010, 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 *
23 */
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/methodOop.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 methodOop 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 methodOop _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 = methodOop(buffer.read_oop());
50 _bci = buffer.read_bci();
51 }
52
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);
120
121 DebugInfoReadStream* stream_at(int decode_offset) const;
122
123
124 public:
125 // Verification
126 void verify();
127
128 #ifndef PRODUCT
129 public:
130 // Printing support
131 void print_on(outputStream* st) const;
132 void print_on(outputStream* st, PcDesc* pd) const;
133 void print_value_on(outputStream* st) const;
134 #endif
135 };
136
137 #endif // SHARE_VM_CODE_SCOPEDESC_HPP
|