annotate src/share/vm/code/scopeDesc.hpp @ 7046:b6a8f2d23057

VM support for deferred reads and writes: ScopeDesc, DebugInfo, DebugInfoRecorder
author Lukas Stadler <lukas.stadler@jku.at>
date Tue, 27 Nov 2012 13:43:04 +0100
parents e522a00b91aa
children d4e6c82cd6a1
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1 /*
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 1972
diff changeset
2 * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
0
a61af66fc99e Initial load
duke
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
a61af66fc99e Initial load
duke
parents:
diff changeset
4 *
a61af66fc99e Initial load
duke
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
a61af66fc99e Initial load
duke
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
a61af66fc99e Initial load
duke
parents:
diff changeset
7 * published by the Free Software Foundation.
a61af66fc99e Initial load
duke
parents:
diff changeset
8 *
a61af66fc99e Initial load
duke
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
a61af66fc99e Initial load
duke
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
a61af66fc99e Initial load
duke
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
a61af66fc99e Initial load
duke
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
a61af66fc99e Initial load
duke
parents:
diff changeset
13 * accompanied this code).
a61af66fc99e Initial load
duke
parents:
diff changeset
14 *
a61af66fc99e Initial load
duke
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
a61af66fc99e Initial load
duke
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
a61af66fc99e Initial load
duke
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
a61af66fc99e Initial load
duke
parents:
diff changeset
18 *
1552
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1253
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1253
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1253
diff changeset
21 * questions.
0
a61af66fc99e Initial load
duke
parents:
diff changeset
22 *
a61af66fc99e Initial load
duke
parents:
diff changeset
23 */
a61af66fc99e Initial load
duke
parents:
diff changeset
24
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
25 #ifndef SHARE_VM_CODE_SCOPEDESC_HPP
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
26 #define SHARE_VM_CODE_SCOPEDESC_HPP
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
27
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
28 #include "code/debugInfo.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
29 #include "code/pcDesc.hpp"
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 1972
diff changeset
30 #include "oops/method.hpp"
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
31 #include "utilities/growableArray.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
32
0
a61af66fc99e Initial load
duke
parents:
diff changeset
33 // SimpleScopeDesc is used when all you need to extract from
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 1972
diff changeset
34 // a given pc,nmethod pair is a Method* and a bci. This is
0
a61af66fc99e Initial load
duke
parents:
diff changeset
35 // quite a bit faster than allocating a full ScopeDesc, but
a61af66fc99e Initial load
duke
parents:
diff changeset
36 // very limited in abilities.
a61af66fc99e Initial load
duke
parents:
diff changeset
37
a61af66fc99e Initial load
duke
parents:
diff changeset
38 class SimpleScopeDesc : public StackObj {
a61af66fc99e Initial load
duke
parents:
diff changeset
39 private:
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 1972
diff changeset
40 Method* _method;
0
a61af66fc99e Initial load
duke
parents:
diff changeset
41 int _bci;
a61af66fc99e Initial load
duke
parents:
diff changeset
42
a61af66fc99e Initial load
duke
parents:
diff changeset
43 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
44 SimpleScopeDesc(nmethod* code,address pc) {
a61af66fc99e Initial load
duke
parents:
diff changeset
45 PcDesc* pc_desc = code->pc_desc_at(pc);
a61af66fc99e Initial load
duke
parents:
diff changeset
46 assert(pc_desc != NULL, "Must be able to find matching PcDesc");
a61af66fc99e Initial load
duke
parents:
diff changeset
47 DebugInfoReadStream buffer(code, pc_desc->scope_decode_offset());
a61af66fc99e Initial load
duke
parents:
diff changeset
48 int ignore_sender = buffer.read_int();
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 1972
diff changeset
49 _method = buffer.read_method();
931
72088be4b386 6873116: Modify reexecute implementation to use pcDesc to record the reexecute bit
cfang
parents: 900
diff changeset
50 _bci = buffer.read_bci();
0
a61af66fc99e Initial load
duke
parents:
diff changeset
51 }
a61af66fc99e Initial load
duke
parents:
diff changeset
52
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 1972
diff changeset
53 Method* method() { return _method; }
0
a61af66fc99e Initial load
duke
parents:
diff changeset
54 int bci() { return _bci; }
a61af66fc99e Initial load
duke
parents:
diff changeset
55 };
a61af66fc99e Initial load
duke
parents:
diff changeset
56
a61af66fc99e Initial load
duke
parents:
diff changeset
57 // ScopeDescs contain the information that makes source-level debugging of
a61af66fc99e Initial load
duke
parents:
diff changeset
58 // nmethods possible; each scopeDesc describes a method activation
a61af66fc99e Initial load
duke
parents:
diff changeset
59
a61af66fc99e Initial load
duke
parents:
diff changeset
60 class ScopeDesc : public ResourceObj {
a61af66fc99e Initial load
duke
parents:
diff changeset
61 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
62 // Constructor
3018
5857923e563c Fixed an issue with frame states in exception dispatch chains (now we are correctly rethrowing the exception immediately at entering the interpreter).
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 1972
diff changeset
63 ScopeDesc(const nmethod* code, int decode_offset, int obj_decode_offset, bool reexecute, bool rethrow_exception, bool return_oop);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
64
a61af66fc99e Initial load
duke
parents:
diff changeset
65 // Calls above, giving default value of "serialized_null" to the
a61af66fc99e Initial load
duke
parents:
diff changeset
66 // "obj_decode_offset" argument. (We don't use a default argument to
a61af66fc99e Initial load
duke
parents:
diff changeset
67 // avoid a .hpp-.hpp dependency.)
3018
5857923e563c Fixed an issue with frame states in exception dispatch chains (now we are correctly rethrowing the exception immediately at entering the interpreter).
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 1972
diff changeset
68 ScopeDesc(const nmethod* code, int decode_offset, bool reexecute, bool rethrow_exception, bool return_oop);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
69
a61af66fc99e Initial load
duke
parents:
diff changeset
70 // JVM state
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 1972
diff changeset
71 Method* method() const { return _method; }
900
9987d9d5eb0e 6833129: specjvm98 fails with NullPointerException in the compiler with -XX:DeoptimizeALot
cfang
parents: 0
diff changeset
72 int bci() const { return _bci; }
9987d9d5eb0e 6833129: specjvm98 fails with NullPointerException in the compiler with -XX:DeoptimizeALot
cfang
parents: 0
diff changeset
73 bool should_reexecute() const { return _reexecute; }
3018
5857923e563c Fixed an issue with frame states in exception dispatch chains (now we are correctly rethrowing the exception immediately at entering the interpreter).
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 1972
diff changeset
74 bool rethrow_exception() const { return _rethrow_exception; }
1253
f70b0d9ab095 6910618: C2: Error: assert(d->is_oop(),"JVM_ArrayCopy: dst not an oop")
kvn
parents: 931
diff changeset
75 bool return_oop() const { return _return_oop; }
0
a61af66fc99e Initial load
duke
parents:
diff changeset
76
a61af66fc99e Initial load
duke
parents:
diff changeset
77 GrowableArray<ScopeValue*>* locals();
a61af66fc99e Initial load
duke
parents:
diff changeset
78 GrowableArray<ScopeValue*>* expressions();
a61af66fc99e Initial load
duke
parents:
diff changeset
79 GrowableArray<MonitorValue*>* monitors();
a61af66fc99e Initial load
duke
parents:
diff changeset
80 GrowableArray<ScopeValue*>* objects();
7046
b6a8f2d23057 VM support for deferred reads and writes: ScopeDesc, DebugInfo, DebugInfoRecorder
Lukas Stadler <lukas.stadler@jku.at>
parents: 6948
diff changeset
81 #ifdef GRAAL
b6a8f2d23057 VM support for deferred reads and writes: ScopeDesc, DebugInfo, DebugInfoRecorder
Lukas Stadler <lukas.stadler@jku.at>
parents: 6948
diff changeset
82 GrowableArray<DeferredWriteValue*>* deferred_writes();
b6a8f2d23057 VM support for deferred reads and writes: ScopeDesc, DebugInfo, DebugInfoRecorder
Lukas Stadler <lukas.stadler@jku.at>
parents: 6948
diff changeset
83 #endif // GRAAL
0
a61af66fc99e Initial load
duke
parents:
diff changeset
84
a61af66fc99e Initial load
duke
parents:
diff changeset
85 // Stack walking, returns NULL if this is the outer most scope.
a61af66fc99e Initial load
duke
parents:
diff changeset
86 ScopeDesc* sender() const;
a61af66fc99e Initial load
duke
parents:
diff changeset
87
a61af66fc99e Initial load
duke
parents:
diff changeset
88 // Returns where the scope was decoded
a61af66fc99e Initial load
duke
parents:
diff changeset
89 int decode_offset() const { return _decode_offset; }
a61af66fc99e Initial load
duke
parents:
diff changeset
90
a61af66fc99e Initial load
duke
parents:
diff changeset
91 // Tells whether sender() returns NULL
a61af66fc99e Initial load
duke
parents:
diff changeset
92 bool is_top() const;
a61af66fc99e Initial load
duke
parents:
diff changeset
93 // Tells whether sd is equal to this
a61af66fc99e Initial load
duke
parents:
diff changeset
94 bool is_equal(ScopeDesc* sd) const;
a61af66fc99e Initial load
duke
parents:
diff changeset
95
a61af66fc99e Initial load
duke
parents:
diff changeset
96 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
97 // Alternative constructor
a61af66fc99e Initial load
duke
parents:
diff changeset
98 ScopeDesc(const ScopeDesc* parent);
a61af66fc99e Initial load
duke
parents:
diff changeset
99
a61af66fc99e Initial load
duke
parents:
diff changeset
100 // JVM state
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 1972
diff changeset
101 Method* _method;
0
a61af66fc99e Initial load
duke
parents:
diff changeset
102 int _bci;
900
9987d9d5eb0e 6833129: specjvm98 fails with NullPointerException in the compiler with -XX:DeoptimizeALot
cfang
parents: 0
diff changeset
103 bool _reexecute;
3018
5857923e563c Fixed an issue with frame states in exception dispatch chains (now we are correctly rethrowing the exception immediately at entering the interpreter).
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 1972
diff changeset
104 bool _rethrow_exception;
1253
f70b0d9ab095 6910618: C2: Error: assert(d->is_oop(),"JVM_ArrayCopy: dst not an oop")
kvn
parents: 931
diff changeset
105 bool _return_oop;
0
a61af66fc99e Initial load
duke
parents:
diff changeset
106
a61af66fc99e Initial load
duke
parents:
diff changeset
107 // Decoding offsets
a61af66fc99e Initial load
duke
parents:
diff changeset
108 int _decode_offset;
a61af66fc99e Initial load
duke
parents:
diff changeset
109 int _sender_decode_offset;
a61af66fc99e Initial load
duke
parents:
diff changeset
110 int _locals_decode_offset;
a61af66fc99e Initial load
duke
parents:
diff changeset
111 int _expressions_decode_offset;
a61af66fc99e Initial load
duke
parents:
diff changeset
112 int _monitors_decode_offset;
7046
b6a8f2d23057 VM support for deferred reads and writes: ScopeDesc, DebugInfo, DebugInfoRecorder
Lukas Stadler <lukas.stadler@jku.at>
parents: 6948
diff changeset
113 #ifdef GRAAL
b6a8f2d23057 VM support for deferred reads and writes: ScopeDesc, DebugInfo, DebugInfoRecorder
Lukas Stadler <lukas.stadler@jku.at>
parents: 6948
diff changeset
114 int _deferred_writes_decode_offset;
b6a8f2d23057 VM support for deferred reads and writes: ScopeDesc, DebugInfo, DebugInfoRecorder
Lukas Stadler <lukas.stadler@jku.at>
parents: 6948
diff changeset
115 #endif // GRAAL
0
a61af66fc99e Initial load
duke
parents:
diff changeset
116
a61af66fc99e Initial load
duke
parents:
diff changeset
117 // Object pool
a61af66fc99e Initial load
duke
parents:
diff changeset
118 GrowableArray<ScopeValue*>* _objects;
a61af66fc99e Initial load
duke
parents:
diff changeset
119
a61af66fc99e Initial load
duke
parents:
diff changeset
120 // Nmethod information
a61af66fc99e Initial load
duke
parents:
diff changeset
121 const nmethod* _code;
a61af66fc99e Initial load
duke
parents:
diff changeset
122
a61af66fc99e Initial load
duke
parents:
diff changeset
123 // Decoding operations
a61af66fc99e Initial load
duke
parents:
diff changeset
124 void decode_body();
a61af66fc99e Initial load
duke
parents:
diff changeset
125 GrowableArray<ScopeValue*>* decode_scope_values(int decode_offset);
a61af66fc99e Initial load
duke
parents:
diff changeset
126 GrowableArray<MonitorValue*>* decode_monitor_values(int decode_offset);
a61af66fc99e Initial load
duke
parents:
diff changeset
127 GrowableArray<ScopeValue*>* decode_object_values(int decode_offset);
7046
b6a8f2d23057 VM support for deferred reads and writes: ScopeDesc, DebugInfo, DebugInfoRecorder
Lukas Stadler <lukas.stadler@jku.at>
parents: 6948
diff changeset
128 #ifdef GRAAL
b6a8f2d23057 VM support for deferred reads and writes: ScopeDesc, DebugInfo, DebugInfoRecorder
Lukas Stadler <lukas.stadler@jku.at>
parents: 6948
diff changeset
129 GrowableArray<DeferredWriteValue*>* decode_deferred_writes(int decode_offset);
b6a8f2d23057 VM support for deferred reads and writes: ScopeDesc, DebugInfo, DebugInfoRecorder
Lukas Stadler <lukas.stadler@jku.at>
parents: 6948
diff changeset
130 #endif // GRAAL
0
a61af66fc99e Initial load
duke
parents:
diff changeset
131
a61af66fc99e Initial load
duke
parents:
diff changeset
132 DebugInfoReadStream* stream_at(int decode_offset) const;
a61af66fc99e Initial load
duke
parents:
diff changeset
133
a61af66fc99e Initial load
duke
parents:
diff changeset
134
a61af66fc99e Initial load
duke
parents:
diff changeset
135 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
136 // Verification
a61af66fc99e Initial load
duke
parents:
diff changeset
137 void verify();
a61af66fc99e Initial load
duke
parents:
diff changeset
138
a61af66fc99e Initial load
duke
parents:
diff changeset
139 #ifndef PRODUCT
a61af66fc99e Initial load
duke
parents:
diff changeset
140 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
141 // Printing support
a61af66fc99e Initial load
duke
parents:
diff changeset
142 void print_on(outputStream* st) const;
a61af66fc99e Initial load
duke
parents:
diff changeset
143 void print_on(outputStream* st, PcDesc* pd) const;
a61af66fc99e Initial load
duke
parents:
diff changeset
144 void print_value_on(outputStream* st) const;
a61af66fc99e Initial load
duke
parents:
diff changeset
145 #endif
a61af66fc99e Initial load
duke
parents:
diff changeset
146 };
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
147
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
148 #endif // SHARE_VM_CODE_SCOPEDESC_HPP