Mercurial > hg > truffle
annotate src/share/vm/code/debugInfo.hpp @ 1721:413ad0331a0c
6977924: Changes for 6975078 produce build error with certain gcc versions
Summary: The changes introduced for 6975078 assign badHeapOopVal to the _allocation field in the ResourceObj class. In 32 bit linux builds with certain versions of gcc this assignment will be flagged as an error while compiling allocation.cpp. In 32 bit builds the constant value badHeapOopVal (which is cast to an intptr_t) is negative. The _allocation field is typed as an unsigned intptr_t and gcc catches this as an error.
Reviewed-by: jcoomes, ysr, phh
author | johnc |
---|---|
date | Wed, 18 Aug 2010 10:59:06 -0700 |
parents | c18cbe5936b8 |
children | f95d63e2154a |
rev | line source |
---|---|
0 | 1 /* |
1552
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
931
diff
changeset
|
2 * Copyright (c) 1997, 2009, 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 | |
25 // Classes used for serializing debugging information. | |
26 // These abstractions are introducted to provide symmetric | |
27 // read and write operations. | |
28 | |
29 // ScopeValue describes the value of a variable/expression in a scope | |
30 // - LocationValue describes a value in a given location (in frame or register) | |
31 // - ConstantValue describes a constant | |
32 | |
33 class ScopeValue: public ResourceObj { | |
34 public: | |
35 // Testers | |
36 virtual bool is_location() const { return false; } | |
37 virtual bool is_object() const { return false; } | |
38 virtual bool is_constant_int() const { return false; } | |
39 virtual bool is_constant_double() const { return false; } | |
40 virtual bool is_constant_long() const { return false; } | |
41 virtual bool is_constant_oop() const { return false; } | |
42 virtual bool equals(ScopeValue* other) const { return false; } | |
43 | |
44 // Serialization of debugging information | |
45 virtual void write_on(DebugInfoWriteStream* stream) = 0; | |
46 static ScopeValue* read_from(DebugInfoReadStream* stream); | |
47 }; | |
48 | |
49 | |
50 // A Location value describes a value in a given location; i.e. the corresponding | |
51 // logical entity (e.g., a method temporary) lives in this location. | |
52 | |
53 class LocationValue: public ScopeValue { | |
54 private: | |
55 Location _location; | |
56 public: | |
57 LocationValue(Location location) { _location = location; } | |
58 bool is_location() const { return true; } | |
59 Location location() const { return _location; } | |
60 | |
61 // Serialization of debugging information | |
62 LocationValue(DebugInfoReadStream* stream); | |
63 void write_on(DebugInfoWriteStream* stream); | |
64 | |
65 // Printing | |
66 void print_on(outputStream* st) const; | |
67 }; | |
68 | |
69 | |
70 // An ObjectValue describes an object eliminated by escape analysis. | |
71 | |
72 class ObjectValue: public ScopeValue { | |
73 private: | |
74 int _id; | |
75 ScopeValue* _klass; | |
76 GrowableArray<ScopeValue*> _field_values; | |
77 Handle _value; | |
78 bool _visited; | |
79 | |
80 public: | |
81 ObjectValue(int id, ScopeValue* klass) | |
82 : _id(id) | |
83 , _klass(klass) | |
84 , _field_values() | |
85 , _value() | |
86 , _visited(false) { | |
87 assert(klass->is_constant_oop(), "should be constant klass oop"); | |
88 } | |
89 | |
90 ObjectValue(int id) | |
91 : _id(id) | |
92 , _klass(NULL) | |
93 , _field_values() | |
94 , _value() | |
95 , _visited(false) {} | |
96 | |
97 // Accessors | |
98 bool is_object() const { return true; } | |
99 int id() const { return _id; } | |
100 ScopeValue* klass() const { return _klass; } | |
101 GrowableArray<ScopeValue*>* field_values() { return &_field_values; } | |
102 ScopeValue* field_at(int i) const { return _field_values.at(i); } | |
103 int field_size() { return _field_values.length(); } | |
104 Handle value() const { return _value; } | |
105 bool is_visited() const { return _visited; } | |
106 | |
107 void set_value(oop value) { _value = Handle(value); } | |
108 void set_visited(bool visited) { _visited = false; } | |
109 | |
110 // Serialization of debugging information | |
111 void read_object(DebugInfoReadStream* stream); | |
112 void write_on(DebugInfoWriteStream* stream); | |
113 | |
114 // Printing | |
115 void print_on(outputStream* st) const; | |
116 void print_fields_on(outputStream* st) const; | |
117 }; | |
118 | |
119 | |
120 // A ConstantIntValue describes a constant int; i.e., the corresponding logical entity | |
121 // is either a source constant or its computation has been constant-folded. | |
122 | |
123 class ConstantIntValue: public ScopeValue { | |
124 private: | |
125 jint _value; | |
126 public: | |
127 ConstantIntValue(jint value) { _value = value; } | |
128 jint value() const { return _value; } | |
129 bool is_constant_int() const { return true; } | |
130 bool equals(ScopeValue* other) const { return false; } | |
131 | |
132 // Serialization of debugging information | |
133 ConstantIntValue(DebugInfoReadStream* stream); | |
134 void write_on(DebugInfoWriteStream* stream); | |
135 | |
136 // Printing | |
137 void print_on(outputStream* st) const; | |
138 }; | |
139 | |
140 class ConstantLongValue: public ScopeValue { | |
141 private: | |
142 jlong _value; | |
143 public: | |
144 ConstantLongValue(jlong value) { _value = value; } | |
145 jlong value() const { return _value; } | |
146 bool is_constant_long() const { return true; } | |
147 bool equals(ScopeValue* other) const { return false; } | |
148 | |
149 // Serialization of debugging information | |
150 ConstantLongValue(DebugInfoReadStream* stream); | |
151 void write_on(DebugInfoWriteStream* stream); | |
152 | |
153 // Printing | |
154 void print_on(outputStream* st) const; | |
155 }; | |
156 | |
157 class ConstantDoubleValue: public ScopeValue { | |
158 private: | |
159 jdouble _value; | |
160 public: | |
161 ConstantDoubleValue(jdouble value) { _value = value; } | |
162 jdouble value() const { return _value; } | |
163 bool is_constant_double() const { return true; } | |
164 bool equals(ScopeValue* other) const { return false; } | |
165 | |
166 // Serialization of debugging information | |
167 ConstantDoubleValue(DebugInfoReadStream* stream); | |
168 void write_on(DebugInfoWriteStream* stream); | |
169 | |
170 // Printing | |
171 void print_on(outputStream* st) const; | |
172 }; | |
173 | |
174 // A ConstantOopWriteValue is created by the compiler to | |
175 // be written as debugging information. | |
176 | |
177 class ConstantOopWriteValue: public ScopeValue { | |
178 private: | |
179 jobject _value; | |
180 public: | |
181 ConstantOopWriteValue(jobject value) { _value = value; } | |
182 jobject value() const { return _value; } | |
183 bool is_constant_oop() const { return true; } | |
184 bool equals(ScopeValue* other) const { return false; } | |
185 | |
186 // Serialization of debugging information | |
187 void write_on(DebugInfoWriteStream* stream); | |
188 | |
189 // Printing | |
190 void print_on(outputStream* st) const; | |
191 }; | |
192 | |
193 // A ConstantOopReadValue is created by the VM when reading | |
194 // debug information | |
195 | |
196 class ConstantOopReadValue: public ScopeValue { | |
197 private: | |
198 Handle _value; | |
199 public: | |
200 Handle value() const { return _value; } | |
201 bool is_constant_oop() const { return true; } | |
202 bool equals(ScopeValue* other) const { return false; } | |
203 | |
204 // Serialization of debugging information | |
205 ConstantOopReadValue(DebugInfoReadStream* stream); | |
206 void write_on(DebugInfoWriteStream* stream); | |
207 | |
208 // Printing | |
209 void print_on(outputStream* st) const; | |
210 }; | |
211 | |
212 // MonitorValue describes the pair used for monitor_enter and monitor_exit. | |
213 | |
214 class MonitorValue: public ResourceObj { | |
215 private: | |
216 ScopeValue* _owner; | |
217 Location _basic_lock; | |
218 bool _eliminated; | |
219 public: | |
220 // Constructor | |
221 MonitorValue(ScopeValue* owner, Location basic_lock, bool eliminated = false); | |
222 | |
223 // Accessors | |
224 ScopeValue* owner() const { return _owner; } | |
225 Location basic_lock() const { return _basic_lock; } | |
226 bool eliminated() const { return _eliminated; } | |
227 | |
228 // Serialization of debugging information | |
229 MonitorValue(DebugInfoReadStream* stream); | |
230 void write_on(DebugInfoWriteStream* stream); | |
231 | |
232 // Printing | |
233 void print_on(outputStream* st) const; | |
234 }; | |
235 | |
236 // DebugInfoReadStream specializes CompressedReadStream for reading | |
237 // debugging information. Used by ScopeDesc. | |
238 | |
239 class DebugInfoReadStream : public CompressedReadStream { | |
240 private: | |
241 const nmethod* _code; | |
242 const nmethod* code() const { return _code; } | |
243 GrowableArray<ScopeValue*>* _obj_pool; | |
244 public: | |
245 DebugInfoReadStream(const nmethod* code, int offset, GrowableArray<ScopeValue*>* obj_pool = NULL) : | |
246 CompressedReadStream(code->scopes_data_begin(), offset) { | |
247 _code = code; | |
248 _obj_pool = obj_pool; | |
249 | |
250 } ; | |
251 | |
252 oop read_oop() { | |
253 return code()->oop_at(read_int()); | |
254 } | |
255 ScopeValue* read_object_value(); | |
256 ScopeValue* get_cached_object(); | |
257 // 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
|
258 int read_bci() { return read_int() + InvocationEntryBci; } |
0 | 259 }; |
260 | |
261 // DebugInfoWriteStream specializes CompressedWriteStream for | |
262 // writing debugging information. Used by ScopeDescRecorder. | |
263 | |
264 class DebugInfoWriteStream : public CompressedWriteStream { | |
265 private: | |
266 DebugInformationRecorder* _recorder; | |
267 DebugInformationRecorder* recorder() const { return _recorder; } | |
268 public: | |
269 DebugInfoWriteStream(DebugInformationRecorder* recorder, int initial_size); | |
270 void write_handle(jobject h); | |
931
72088be4b386
6873116: Modify reexecute implementation to use pcDesc to record the reexecute bit
cfang
parents:
900
diff
changeset
|
271 void write_bci(int bci) { write_int(bci - InvocationEntryBci); } |
0 | 272 }; |