Mercurial > hg > truffle
annotate src/share/vm/code/debugInfoRec.hpp @ 948:89e0543e1737
6884624: Update copyright year
Summary: Update copyright for files that have been modified in 2009 through Septermber
Reviewed-by: tbell, ohair
author | xdono |
---|---|
date | Tue, 22 Sep 2009 14:06:10 -0700 |
parents | 9987d9d5eb0e |
children | e66fd840cb6b |
rev | line source |
---|---|
0 | 1 /* |
948 | 2 * Copyright 1998-2009 Sun Microsystems, Inc. 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 * | |
19 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, | |
20 * CA 95054 USA or visit www.sun.com if you need additional information or | |
21 * have any questions. | |
22 * | |
23 */ | |
24 | |
25 //** The DebugInformationRecorder collects debugging information | |
26 // for a compiled method. | |
27 // Debugging information is used for: | |
28 // - garbage collecting compiled frames | |
29 // - stack tracing across compiled frames | |
30 // - deoptimizating compiled frames | |
31 // | |
32 // The implementation requires the compiler to use the recorder | |
33 // in the following order: | |
34 // 1) Describe debug information for safepoints at increasing addresses. | |
35 // a) Add safepoint entry (use add_safepoint or add_non_safepoint) | |
36 // b) Describe scopes for that safepoint | |
37 // - create locals if needed (use create_scope_values) | |
38 // - create expressions if needed (use create_scope_values) | |
39 // - create monitor stack if needed (use create_monitor_values) | |
40 // - describe scope (use describe_scope) | |
41 // "repeat last four steps for all scopes" | |
42 // "outer most scope first and inner most scope last" | |
43 // NB: nodes from create_scope_values and create_locations | |
44 // can be reused for simple sharing. | |
45 // - mark the end of the scopes (end_safepoint or end_non_safepoint) | |
46 // 2) Use oop_size, data_size, pcs_size to create the nmethod and | |
47 // finally migrate the debugging information into the nmethod | |
48 // by calling copy_to. | |
49 | |
50 class DebugToken; // Opaque datatype for stored: | |
51 // - GrowableArray<ScopeValue*> | |
52 // - GrowableArray<MonitorValue*> | |
53 | |
54 // Alias for InvocationEntryBci. | |
55 // Both constants are used for a pseudo-BCI which refers | |
56 // to the state just _before_ a method is entered. | |
57 // SynchronizationEntryBCI is used where the emphasis | |
58 // is on the implicit monitorenter of a synchronized method. | |
59 const int SynchronizationEntryBCI = InvocationEntryBci; | |
60 | |
61 class DIR_Chunk; // private class, a nugget of collected information | |
62 | |
63 class DebugInformationRecorder: public ResourceObj { | |
64 public: | |
65 // constructor | |
66 DebugInformationRecorder(OopRecorder* oop_recorder); | |
67 | |
68 // adds an oopmap at a specific offset | |
69 void add_oopmap(int pc_offset, OopMap* map); | |
70 | |
71 // adds a jvm mapping at pc-offset, for a safepoint only | |
72 void add_safepoint(int pc_offset, OopMap* map); | |
73 | |
74 // adds a jvm mapping at pc-offset, for a non-safepoint (profile point) | |
75 void add_non_safepoint(int pc_offset); | |
76 | |
77 // Describes debugging information for a scope at the given pc_offset. | |
78 // Calls must be in non-decreasing order of pc_offset. | |
79 // If there are several calls at a single pc_offset, | |
80 // then they occur in the same order as they were performed by the JVM, | |
81 // with the most recent (innermost) call being described last. | |
82 // For a safepoint, the pc_offset must have been mentioned | |
83 // previously by add_safepoint. | |
84 // Otherwise, the pc_offset must have been mentioned previously | |
85 // by add_non_safepoint, and the locals, expressions, and monitors | |
86 // must all be null. | |
87 void describe_scope(int pc_offset, | |
88 ciMethod* method, | |
89 int bci, | |
900
9987d9d5eb0e
6833129: specjvm98 fails with NullPointerException in the compiler with -XX:DeoptimizeALot
cfang
parents:
0
diff
changeset
|
90 bool reexecute, |
0 | 91 DebugToken* locals = NULL, |
92 DebugToken* expressions = NULL, | |
93 DebugToken* monitors = NULL); | |
94 | |
95 | |
96 void dump_object_pool(GrowableArray<ScopeValue*>* objects); | |
97 | |
98 // This call must follow every add_safepoint, | |
99 // after any intervening describe_scope calls. | |
100 void end_safepoint(int pc_offset) { end_scopes(pc_offset, true); } | |
101 void end_non_safepoint(int pc_offset) { end_scopes(pc_offset, false); } | |
102 | |
103 // helper fuctions for describe_scope to enable sharing | |
104 DebugToken* create_scope_values(GrowableArray<ScopeValue*>* values); | |
105 DebugToken* create_monitor_values(GrowableArray<MonitorValue*>* monitors); | |
106 | |
107 // returns the size of the generated scopeDescs. | |
108 int data_size(); | |
109 int pcs_size(); | |
110 int oop_size() { return oop_recorder()->oop_size(); } | |
111 | |
112 // copy the generated debugging information to nmethod | |
113 void copy_to(nmethod* nm); | |
114 | |
115 // verifies the debug information | |
116 void verify(const nmethod* code); | |
117 | |
118 static void print_statistics() PRODUCT_RETURN; | |
119 | |
120 // Method for setting oopmaps to temporarily preserve old handling of oopmaps | |
121 OopMapSet *_oopmaps; | |
122 void set_oopmaps(OopMapSet *oopmaps) { _oopmaps = oopmaps; } | |
123 | |
124 OopRecorder* oop_recorder() { return _oop_recorder; } | |
125 | |
126 int last_pc_offset() { return last_pc()->pc_offset(); } | |
127 | |
128 bool recording_non_safepoints() { return _recording_non_safepoints; } | |
129 | |
130 private: | |
131 friend class ScopeDesc; | |
132 friend class vframeStreamCommon; | |
133 friend class DIR_Chunk; | |
134 | |
135 // True if we are recording non-safepoint scopes. | |
136 // This flag is set if DebugNonSafepoints is true, or if | |
137 // JVMTI post_compiled_method_load events are enabled. | |
138 const bool _recording_non_safepoints; | |
139 | |
140 DebugInfoWriteStream* _stream; | |
141 | |
142 DebugInfoWriteStream* stream() const { return _stream; } | |
143 | |
144 OopRecorder* _oop_recorder; | |
145 | |
146 // Scopes that have been described so far. | |
147 GrowableArray<DIR_Chunk*>* _all_chunks; | |
148 GrowableArray<DIR_Chunk*>* _shared_chunks; | |
149 DIR_Chunk* _next_chunk; | |
150 DIR_Chunk* _next_chunk_limit; | |
151 | |
152 #ifdef ASSERT | |
153 enum { rs_null, rs_safepoint, rs_non_safepoint }; | |
154 int _recording_state; | |
155 #endif | |
156 | |
157 PcDesc* _pcs; | |
158 int _pcs_size; | |
159 int _pcs_length; | |
160 // Note: Would use GrowableArray<PcDesc>, but structs are not supported. | |
161 | |
162 // PC of most recent real safepoint before the current one, | |
163 // updated after end_scopes. | |
164 int _prev_safepoint_pc; | |
165 | |
166 PcDesc* last_pc() { | |
167 guarantee(_pcs_length > 0, "a safepoint must be declared already"); | |
168 return &_pcs[_pcs_length-1]; | |
169 } | |
170 PcDesc* prev_pc() { | |
171 guarantee(_pcs_length > 1, "a safepoint must be declared already"); | |
172 return &_pcs[_pcs_length-2]; | |
173 } | |
174 void add_new_pc_offset(int pc_offset); | |
175 void end_scopes(int pc_offset, bool is_safepoint); | |
176 | |
177 int serialize_monitor_values(GrowableArray<MonitorValue*>* monitors); | |
178 int serialize_scope_values(GrowableArray<ScopeValue*>* values); | |
179 int find_sharable_decode_offset(int stream_offset); | |
180 | |
181 public: | |
182 enum { serialized_null = 0 }; | |
183 }; |