Mercurial > hg > truffle
annotate src/share/vm/code/debugInfoRec.hpp @ 16016:a1b9340534bf
made UseGraalCompilationQueue false by default to see if perf. issue(s) still exist
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Wed, 04 Jun 2014 15:59:26 +0200 |
parents | b8f261ba79c6 |
children | b888ded3ee42 |
rev | line source |
---|---|
0 | 1 /* |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
1972
diff
changeset
|
2 * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved. |
0 | 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 * | |
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 | 22 * |
23 */ | |
24 | |
1972 | 25 #ifndef SHARE_VM_CODE_DEBUGINFOREC_HPP |
26 #define SHARE_VM_CODE_DEBUGINFOREC_HPP | |
27 | |
28 #include "ci/ciClassList.hpp" | |
29 #include "ci/ciInstanceKlass.hpp" | |
30 #include "ci/ciMethod.hpp" | |
31 #include "code/debugInfo.hpp" | |
32 #include "code/location.hpp" | |
33 #include "code/pcDesc.hpp" | |
34 #include "compiler/oopMap.hpp" | |
35 #include "oops/oop.hpp" | |
36 #include "utilities/growableArray.hpp" | |
37 | |
0 | 38 //** The DebugInformationRecorder collects debugging information |
39 // for a compiled method. | |
40 // Debugging information is used for: | |
41 // - garbage collecting compiled frames | |
42 // - stack tracing across compiled frames | |
43 // - deoptimizating compiled frames | |
44 // | |
45 // The implementation requires the compiler to use the recorder | |
46 // in the following order: | |
47 // 1) Describe debug information for safepoints at increasing addresses. | |
48 // a) Add safepoint entry (use add_safepoint or add_non_safepoint) | |
49 // b) Describe scopes for that safepoint | |
50 // - create locals if needed (use create_scope_values) | |
51 // - create expressions if needed (use create_scope_values) | |
52 // - create monitor stack if needed (use create_monitor_values) | |
53 // - describe scope (use describe_scope) | |
54 // "repeat last four steps for all scopes" | |
55 // "outer most scope first and inner most scope last" | |
56 // NB: nodes from create_scope_values and create_locations | |
57 // can be reused for simple sharing. | |
58 // - mark the end of the scopes (end_safepoint or end_non_safepoint) | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
1972
diff
changeset
|
59 // 2) Use oop_size, metadata_size, data_size, pcs_size to create the nmethod |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
1972
diff
changeset
|
60 // and finally migrate the debugging information into the nmethod |
0 | 61 // by calling copy_to. |
62 | |
63 class DebugToken; // Opaque datatype for stored: | |
64 // - GrowableArray<ScopeValue*> | |
65 // - GrowableArray<MonitorValue*> | |
66 | |
67 // Alias for InvocationEntryBci. | |
68 // Both constants are used for a pseudo-BCI which refers | |
69 // to the state just _before_ a method is entered. | |
70 // SynchronizationEntryBCI is used where the emphasis | |
71 // is on the implicit monitorenter of a synchronized method. | |
72 const int SynchronizationEntryBCI = InvocationEntryBci; | |
73 | |
74 class DIR_Chunk; // private class, a nugget of collected information | |
75 | |
76 class DebugInformationRecorder: public ResourceObj { | |
77 public: | |
78 // constructor | |
79 DebugInformationRecorder(OopRecorder* oop_recorder); | |
80 | |
81 // adds an oopmap at a specific offset | |
82 void add_oopmap(int pc_offset, OopMap* map); | |
83 | |
84 // adds a jvm mapping at pc-offset, for a safepoint only | |
7660
0b646334c5f7
keep track of leafGraphIds only at the StructuredGraph level (see GRAAL-60)
Lukas Stadler <lukas.stadler@jku.at>
parents:
7046
diff
changeset
|
85 void add_safepoint(int pc_offset, OopMap* map); |
0 | 86 |
87 // adds a jvm mapping at pc-offset, for a non-safepoint (profile point) | |
88 void add_non_safepoint(int pc_offset); | |
89 | |
90 // Describes debugging information for a scope at the given pc_offset. | |
91 // Calls must be in non-decreasing order of pc_offset. | |
92 // If there are several calls at a single pc_offset, | |
93 // then they occur in the same order as they were performed by the JVM, | |
94 // with the most recent (innermost) call being described last. | |
95 // For a safepoint, the pc_offset must have been mentioned | |
96 // previously by add_safepoint. | |
97 // Otherwise, the pc_offset must have been mentioned previously | |
98 // by add_non_safepoint, and the locals, expressions, and monitors | |
99 // must all be null. | |
100 void describe_scope(int pc_offset, | |
4583
597bc897257d
Made DebugInformationRecorder::describe_scope() take both a methodHandle _and_ a ciMethod* parameter to avoid creating handles in scopes where it is not allowed.
Doug Simon <doug.simon@oracle.com>
parents:
4417
diff
changeset
|
101 methodHandle methodH, |
0 | 102 ciMethod* method, |
103 int bci, | |
900
9987d9d5eb0e
6833129: specjvm98 fails with NullPointerException in the compiler with -XX:DeoptimizeALot
cfang
parents:
0
diff
changeset
|
104 bool reexecute, |
4417
648a7873cea2
Made it possible to build and run the client and server VM with a new '--vm' option to 'mx build' and a global option of the same name.
Doug Simon <doug.simon@oracle.com>
parents:
3650
diff
changeset
|
105 bool rethrow_exception = false, |
1135
e66fd840cb6b
6893081: method handle & invokedynamic code needs additional cleanup (post 6815692, 6858164)
twisti
parents:
948
diff
changeset
|
106 bool is_method_handle_invoke = false, |
1253
f70b0d9ab095
6910618: C2: Error: assert(d->is_oop(),"JVM_ArrayCopy: dst not an oop")
kvn
parents:
1135
diff
changeset
|
107 bool return_oop = false, |
0 | 108 DebugToken* locals = NULL, |
109 DebugToken* expressions = NULL, | |
8151
b8f261ba79c6
Minimize diff to plain HotSpot version.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7933
diff
changeset
|
110 DebugToken* monitors = NULL); |
0 | 111 |
112 | |
113 void dump_object_pool(GrowableArray<ScopeValue*>* objects); | |
114 | |
115 // This call must follow every add_safepoint, | |
116 // after any intervening describe_scope calls. | |
117 void end_safepoint(int pc_offset) { end_scopes(pc_offset, true); } | |
118 void end_non_safepoint(int pc_offset) { end_scopes(pc_offset, false); } | |
119 | |
120 // helper fuctions for describe_scope to enable sharing | |
121 DebugToken* create_scope_values(GrowableArray<ScopeValue*>* values); | |
122 DebugToken* create_monitor_values(GrowableArray<MonitorValue*>* monitors); | |
123 | |
124 // returns the size of the generated scopeDescs. | |
125 int data_size(); | |
126 int pcs_size(); | |
127 int oop_size() { return oop_recorder()->oop_size(); } | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
1972
diff
changeset
|
128 int metadata_size() { return oop_recorder()->metadata_size(); } |
0 | 129 |
130 // copy the generated debugging information to nmethod | |
131 void copy_to(nmethod* nm); | |
132 | |
133 // verifies the debug information | |
134 void verify(const nmethod* code); | |
135 | |
136 static void print_statistics() PRODUCT_RETURN; | |
137 | |
138 // Method for setting oopmaps to temporarily preserve old handling of oopmaps | |
139 OopMapSet *_oopmaps; | |
140 void set_oopmaps(OopMapSet *oopmaps) { _oopmaps = oopmaps; } | |
141 | |
142 OopRecorder* oop_recorder() { return _oop_recorder; } | |
143 | |
144 int last_pc_offset() { return last_pc()->pc_offset(); } | |
145 | |
146 bool recording_non_safepoints() { return _recording_non_safepoints; } | |
147 | |
148 private: | |
149 friend class ScopeDesc; | |
150 friend class vframeStreamCommon; | |
151 friend class DIR_Chunk; | |
152 | |
153 // True if we are recording non-safepoint scopes. | |
154 // This flag is set if DebugNonSafepoints is true, or if | |
155 // JVMTI post_compiled_method_load events are enabled. | |
156 const bool _recording_non_safepoints; | |
157 | |
158 DebugInfoWriteStream* _stream; | |
159 | |
160 DebugInfoWriteStream* stream() const { return _stream; } | |
161 | |
162 OopRecorder* _oop_recorder; | |
163 | |
164 // Scopes that have been described so far. | |
165 GrowableArray<DIR_Chunk*>* _all_chunks; | |
166 GrowableArray<DIR_Chunk*>* _shared_chunks; | |
167 DIR_Chunk* _next_chunk; | |
168 DIR_Chunk* _next_chunk_limit; | |
169 | |
170 #ifdef ASSERT | |
171 enum { rs_null, rs_safepoint, rs_non_safepoint }; | |
172 int _recording_state; | |
173 #endif | |
174 | |
175 PcDesc* _pcs; | |
176 int _pcs_size; | |
177 int _pcs_length; | |
178 // Note: Would use GrowableArray<PcDesc>, but structs are not supported. | |
179 | |
180 // PC of most recent real safepoint before the current one, | |
181 // updated after end_scopes. | |
182 int _prev_safepoint_pc; | |
183 | |
184 PcDesc* last_pc() { | |
185 guarantee(_pcs_length > 0, "a safepoint must be declared already"); | |
186 return &_pcs[_pcs_length-1]; | |
187 } | |
188 PcDesc* prev_pc() { | |
189 guarantee(_pcs_length > 1, "a safepoint must be declared already"); | |
190 return &_pcs[_pcs_length-2]; | |
191 } | |
7660
0b646334c5f7
keep track of leafGraphIds only at the StructuredGraph level (see GRAAL-60)
Lukas Stadler <lukas.stadler@jku.at>
parents:
7046
diff
changeset
|
192 void add_new_pc_offset(int pc_offset); |
0 | 193 void end_scopes(int pc_offset, bool is_safepoint); |
194 | |
195 int serialize_monitor_values(GrowableArray<MonitorValue*>* monitors); | |
196 int serialize_scope_values(GrowableArray<ScopeValue*>* values); | |
197 int find_sharable_decode_offset(int stream_offset); | |
198 | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
1972
diff
changeset
|
199 #ifndef PRODUCT |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
1972
diff
changeset
|
200 bool recorders_frozen(); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
1972
diff
changeset
|
201 void mark_recorders_frozen(); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
1972
diff
changeset
|
202 #endif // PRODUCT |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
1972
diff
changeset
|
203 |
0 | 204 public: |
205 enum { serialized_null = 0 }; | |
206 }; | |
1972 | 207 |
208 #endif // SHARE_VM_CODE_DEBUGINFOREC_HPP |