Mercurial > hg > graal-compiler
annotate src/share/vm/code/debugInfo.hpp @ 8151:b8f261ba79c6
Minimize diff to plain HotSpot version.
author | Thomas Wuerthinger <thomas.wuerthinger@oracle.com> |
---|---|
date | Thu, 07 Mar 2013 21:00:29 +0100 |
parents | b6a8f2d23057 |
children | c5ff08c22458 |
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) 1997, 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:
931
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
931
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:
931
diff
changeset
|
21 * questions. |
0 | 22 * |
23 */ | |
24 | |
1972 | 25 #ifndef SHARE_VM_CODE_DEBUGINFO_HPP |
26 #define SHARE_VM_CODE_DEBUGINFO_HPP | |
27 | |
28 #include "code/compressedStream.hpp" | |
29 #include "code/location.hpp" | |
30 #include "code/nmethod.hpp" | |
31 #include "code/oopRecorder.hpp" | |
32 #include "runtime/stackValue.hpp" | |
33 #include "utilities/growableArray.hpp" | |
34 | |
0 | 35 // Classes used for serializing debugging information. |
36 // These abstractions are introducted to provide symmetric | |
37 // read and write operations. | |
38 | |
39 // ScopeValue describes the value of a variable/expression in a scope | |
40 // - LocationValue describes a value in a given location (in frame or register) | |
41 // - ConstantValue describes a constant | |
42 | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
1972
diff
changeset
|
43 class ConstantOopReadValue; |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
1972
diff
changeset
|
44 |
0 | 45 class ScopeValue: public ResourceObj { |
46 public: | |
47 // Testers | |
48 virtual bool is_location() const { return false; } | |
49 virtual bool is_object() const { return false; } | |
50 virtual bool is_constant_int() const { return false; } | |
51 virtual bool is_constant_double() const { return false; } | |
52 virtual bool is_constant_long() const { return false; } | |
53 virtual bool is_constant_oop() const { return false; } | |
54 virtual bool equals(ScopeValue* other) const { return false; } | |
55 | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
1972
diff
changeset
|
56 ConstantOopReadValue* as_ConstantOopReadValue() { |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
1972
diff
changeset
|
57 assert(is_constant_oop(), "must be"); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
1972
diff
changeset
|
58 return (ConstantOopReadValue*) this; |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
1972
diff
changeset
|
59 } |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
1972
diff
changeset
|
60 |
0 | 61 // Serialization of debugging information |
62 virtual void write_on(DebugInfoWriteStream* stream) = 0; | |
63 static ScopeValue* read_from(DebugInfoReadStream* stream); | |
7046
b6a8f2d23057
VM support for deferred reads and writes: ScopeDesc, DebugInfo, DebugInfoRecorder
Lukas Stadler <lukas.stadler@jku.at>
parents:
6725
diff
changeset
|
64 |
b6a8f2d23057
VM support for deferred reads and writes: ScopeDesc, DebugInfo, DebugInfoRecorder
Lukas Stadler <lukas.stadler@jku.at>
parents:
6725
diff
changeset
|
65 #ifdef GRAAL |
b6a8f2d23057
VM support for deferred reads and writes: ScopeDesc, DebugInfo, DebugInfoRecorder
Lukas Stadler <lukas.stadler@jku.at>
parents:
6725
diff
changeset
|
66 // Printing |
b6a8f2d23057
VM support for deferred reads and writes: ScopeDesc, DebugInfo, DebugInfoRecorder
Lukas Stadler <lukas.stadler@jku.at>
parents:
6725
diff
changeset
|
67 virtual void print_on(outputStream* st) const = 0; |
b6a8f2d23057
VM support for deferred reads and writes: ScopeDesc, DebugInfo, DebugInfoRecorder
Lukas Stadler <lukas.stadler@jku.at>
parents:
6725
diff
changeset
|
68 #endif // GRAAL |
0 | 69 }; |
70 | |
71 | |
72 // A Location value describes a value in a given location; i.e. the corresponding | |
73 // logical entity (e.g., a method temporary) lives in this location. | |
74 | |
75 class LocationValue: public ScopeValue { | |
76 private: | |
77 Location _location; | |
78 public: | |
79 LocationValue(Location location) { _location = location; } | |
80 bool is_location() const { return true; } | |
81 Location location() const { return _location; } | |
82 | |
83 // Serialization of debugging information | |
84 LocationValue(DebugInfoReadStream* stream); | |
85 void write_on(DebugInfoWriteStream* stream); | |
86 | |
87 // Printing | |
88 void print_on(outputStream* st) const; | |
89 }; | |
90 | |
91 | |
92 // An ObjectValue describes an object eliminated by escape analysis. | |
93 | |
94 class ObjectValue: public ScopeValue { | |
95 private: | |
96 int _id; | |
97 ScopeValue* _klass; | |
98 GrowableArray<ScopeValue*> _field_values; | |
99 Handle _value; | |
100 bool _visited; | |
101 | |
102 public: | |
103 ObjectValue(int id, ScopeValue* klass) | |
104 : _id(id) | |
105 , _klass(klass) | |
106 , _field_values() | |
107 , _value() | |
108 , _visited(false) { | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
1972
diff
changeset
|
109 assert(klass->is_constant_oop(), "should be constant java mirror oop"); |
0 | 110 } |
111 | |
112 ObjectValue(int id) | |
113 : _id(id) | |
114 , _klass(NULL) | |
115 , _field_values() | |
116 , _value() | |
117 , _visited(false) {} | |
118 | |
119 // Accessors | |
120 bool is_object() const { return true; } | |
121 int id() const { return _id; } | |
122 ScopeValue* klass() const { return _klass; } | |
123 GrowableArray<ScopeValue*>* field_values() { return &_field_values; } | |
124 ScopeValue* field_at(int i) const { return _field_values.at(i); } | |
125 int field_size() { return _field_values.length(); } | |
126 Handle value() const { return _value; } | |
127 bool is_visited() const { return _visited; } | |
128 | |
129 void set_value(oop value) { _value = Handle(value); } | |
130 void set_visited(bool visited) { _visited = false; } | |
131 | |
132 // Serialization of debugging information | |
133 void read_object(DebugInfoReadStream* stream); | |
134 void write_on(DebugInfoWriteStream* stream); | |
135 | |
136 // Printing | |
137 void print_on(outputStream* st) const; | |
138 void print_fields_on(outputStream* st) const; | |
139 }; | |
140 | |
141 | |
142 // A ConstantIntValue describes a constant int; i.e., the corresponding logical entity | |
143 // is either a source constant or its computation has been constant-folded. | |
144 | |
145 class ConstantIntValue: public ScopeValue { | |
146 private: | |
147 jint _value; | |
148 public: | |
149 ConstantIntValue(jint value) { _value = value; } | |
150 jint value() const { return _value; } | |
151 bool is_constant_int() const { return true; } | |
152 bool equals(ScopeValue* other) const { return false; } | |
153 | |
154 // Serialization of debugging information | |
155 ConstantIntValue(DebugInfoReadStream* stream); | |
156 void write_on(DebugInfoWriteStream* stream); | |
157 | |
158 // Printing | |
159 void print_on(outputStream* st) const; | |
160 }; | |
161 | |
162 class ConstantLongValue: public ScopeValue { | |
163 private: | |
164 jlong _value; | |
165 public: | |
166 ConstantLongValue(jlong value) { _value = value; } | |
167 jlong value() const { return _value; } | |
168 bool is_constant_long() const { return true; } | |
169 bool equals(ScopeValue* other) const { return false; } | |
170 | |
171 // Serialization of debugging information | |
172 ConstantLongValue(DebugInfoReadStream* stream); | |
173 void write_on(DebugInfoWriteStream* stream); | |
174 | |
175 // Printing | |
176 void print_on(outputStream* st) const; | |
177 }; | |
178 | |
179 class ConstantDoubleValue: public ScopeValue { | |
180 private: | |
181 jdouble _value; | |
182 public: | |
183 ConstantDoubleValue(jdouble value) { _value = value; } | |
184 jdouble value() const { return _value; } | |
185 bool is_constant_double() const { return true; } | |
186 bool equals(ScopeValue* other) const { return false; } | |
187 | |
188 // Serialization of debugging information | |
189 ConstantDoubleValue(DebugInfoReadStream* stream); | |
190 void write_on(DebugInfoWriteStream* stream); | |
191 | |
192 // Printing | |
193 void print_on(outputStream* st) const; | |
194 }; | |
195 | |
196 // A ConstantOopWriteValue is created by the compiler to | |
197 // be written as debugging information. | |
198 | |
199 class ConstantOopWriteValue: public ScopeValue { | |
200 private: | |
201 jobject _value; | |
202 public: | |
203 ConstantOopWriteValue(jobject value) { _value = value; } | |
204 jobject value() const { return _value; } | |
205 bool is_constant_oop() const { return true; } | |
206 bool equals(ScopeValue* other) const { return false; } | |
207 | |
208 // Serialization of debugging information | |
209 void write_on(DebugInfoWriteStream* stream); | |
210 | |
211 // Printing | |
212 void print_on(outputStream* st) const; | |
213 }; | |
214 | |
215 // A ConstantOopReadValue is created by the VM when reading | |
216 // debug information | |
217 | |
218 class ConstantOopReadValue: public ScopeValue { | |
219 private: | |
220 Handle _value; | |
221 public: | |
222 Handle value() const { return _value; } | |
223 bool is_constant_oop() const { return true; } | |
224 bool equals(ScopeValue* other) const { return false; } | |
225 | |
226 // Serialization of debugging information | |
227 ConstantOopReadValue(DebugInfoReadStream* stream); | |
228 void write_on(DebugInfoWriteStream* stream); | |
229 | |
230 // Printing | |
231 void print_on(outputStream* st) const; | |
232 }; | |
233 | |
234 // MonitorValue describes the pair used for monitor_enter and monitor_exit. | |
235 | |
236 class MonitorValue: public ResourceObj { | |
237 private: | |
238 ScopeValue* _owner; | |
239 Location _basic_lock; | |
240 bool _eliminated; | |
241 public: | |
242 // Constructor | |
243 MonitorValue(ScopeValue* owner, Location basic_lock, bool eliminated = false); | |
244 | |
245 // Accessors | |
246 ScopeValue* owner() const { return _owner; } | |
247 Location basic_lock() const { return _basic_lock; } | |
248 bool eliminated() const { return _eliminated; } | |
249 | |
250 // Serialization of debugging information | |
251 MonitorValue(DebugInfoReadStream* stream); | |
252 void write_on(DebugInfoWriteStream* stream); | |
253 | |
254 // Printing | |
255 void print_on(outputStream* st) const; | |
256 }; | |
257 | |
258 // DebugInfoReadStream specializes CompressedReadStream for reading | |
259 // debugging information. Used by ScopeDesc. | |
260 | |
261 class DebugInfoReadStream : public CompressedReadStream { | |
262 private: | |
263 const nmethod* _code; | |
264 const nmethod* code() const { return _code; } | |
265 GrowableArray<ScopeValue*>* _obj_pool; | |
266 public: | |
267 DebugInfoReadStream(const nmethod* code, int offset, GrowableArray<ScopeValue*>* obj_pool = NULL) : | |
268 CompressedReadStream(code->scopes_data_begin(), offset) { | |
269 _code = code; | |
270 _obj_pool = obj_pool; | |
271 | |
272 } ; | |
273 | |
274 oop read_oop() { | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
1972
diff
changeset
|
275 oop o = code()->oop_at(read_int()); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
1972
diff
changeset
|
276 assert(o == NULL || o->is_oop(), "oop only"); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
1972
diff
changeset
|
277 return o; |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
1972
diff
changeset
|
278 } |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
1972
diff
changeset
|
279 Method* read_method() { |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
1972
diff
changeset
|
280 Method* o = (Method*)(code()->metadata_at(read_int())); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
1972
diff
changeset
|
281 assert(o == NULL || |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
1972
diff
changeset
|
282 o->is_metadata(), "meta data only"); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
1972
diff
changeset
|
283 return o; |
0 | 284 } |
285 ScopeValue* read_object_value(); | |
286 ScopeValue* get_cached_object(); | |
287 // BCI encoding is mostly unsigned, but -1 is a distinguished value | |
931
72088be4b386
6873116: Modify reexecute implementation to use pcDesc to record the reexecute bit
cfang
parents:
900
diff
changeset
|
288 int read_bci() { return read_int() + InvocationEntryBci; } |
0 | 289 }; |
290 | |
291 // DebugInfoWriteStream specializes CompressedWriteStream for | |
292 // writing debugging information. Used by ScopeDescRecorder. | |
293 | |
294 class DebugInfoWriteStream : public CompressedWriteStream { | |
295 private: | |
296 DebugInformationRecorder* _recorder; | |
297 DebugInformationRecorder* recorder() const { return _recorder; } | |
298 public: | |
299 DebugInfoWriteStream(DebugInformationRecorder* recorder, int initial_size); | |
300 void write_handle(jobject h); | |
931
72088be4b386
6873116: Modify reexecute implementation to use pcDesc to record the reexecute bit
cfang
parents:
900
diff
changeset
|
301 void write_bci(int bci) { write_int(bci - InvocationEntryBci); } |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
1972
diff
changeset
|
302 |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
1972
diff
changeset
|
303 void write_metadata(Metadata* m); |
0 | 304 }; |
1972 | 305 |
306 #endif // SHARE_VM_CODE_DEBUGINFO_HPP |