Mercurial > hg > truffle
annotate src/share/vm/code/debugInfo.cpp @ 7090:05ce1defa4f9
Common out some parts of UnsafeLoad/Store in UnsafeAccess
author | Gilles Duboscq <duboscq@ssw.jku.at> |
---|---|
date | Thu, 29 Nov 2012 13:24:08 +0100 |
parents | b6a8f2d23057 |
children | b8f261ba79c6 |
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:
196
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
196
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:
196
diff
changeset
|
21 * questions. |
0 | 22 * |
23 */ | |
24 | |
1972 | 25 #include "precompiled.hpp" |
26 #include "code/debugInfo.hpp" | |
27 #include "code/debugInfoRec.hpp" | |
28 #include "code/nmethod.hpp" | |
29 #include "runtime/handles.inline.hpp" | |
0 | 30 |
31 // Comstructors | |
32 | |
33 DebugInfoWriteStream::DebugInfoWriteStream(DebugInformationRecorder* recorder, int initial_size) | |
34 : CompressedWriteStream(initial_size) { | |
35 _recorder = recorder; | |
36 } | |
37 | |
38 // Serializing oops | |
39 | |
40 void DebugInfoWriteStream::write_handle(jobject h) { | |
41 write_int(recorder()->oop_recorder()->find_index(h)); | |
42 } | |
43 | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
1972
diff
changeset
|
44 void DebugInfoWriteStream::write_metadata(Metadata* h) { |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
1972
diff
changeset
|
45 write_int(recorder()->oop_recorder()->find_index(h)); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
1972
diff
changeset
|
46 } |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
1972
diff
changeset
|
47 |
0 | 48 ScopeValue* DebugInfoReadStream::read_object_value() { |
49 int id = read_int(); | |
50 #ifdef ASSERT | |
51 assert(_obj_pool != NULL, "object pool does not exist"); | |
52 for (int i = _obj_pool->length() - 1; i >= 0; i--) { | |
53 assert(((ObjectValue*) _obj_pool->at(i))->id() != id, "should not be read twice"); | |
54 } | |
55 #endif | |
56 ObjectValue* result = new ObjectValue(id); | |
44
52fed2ec0afb
6667620: (Escape Analysis) fix deoptimization for scalar replaced objects
kvn
parents:
0
diff
changeset
|
57 // Cache the object since an object field could reference it. |
52fed2ec0afb
6667620: (Escape Analysis) fix deoptimization for scalar replaced objects
kvn
parents:
0
diff
changeset
|
58 _obj_pool->push(result); |
0 | 59 result->read_object(this); |
60 return result; | |
61 } | |
62 | |
63 ScopeValue* DebugInfoReadStream::get_cached_object() { | |
64 int id = read_int(); | |
65 assert(_obj_pool != NULL, "object pool does not exist"); | |
66 for (int i = _obj_pool->length() - 1; i >= 0; i--) { | |
44
52fed2ec0afb
6667620: (Escape Analysis) fix deoptimization for scalar replaced objects
kvn
parents:
0
diff
changeset
|
67 ObjectValue* ov = (ObjectValue*) _obj_pool->at(i); |
52fed2ec0afb
6667620: (Escape Analysis) fix deoptimization for scalar replaced objects
kvn
parents:
0
diff
changeset
|
68 if (ov->id() == id) { |
52fed2ec0afb
6667620: (Escape Analysis) fix deoptimization for scalar replaced objects
kvn
parents:
0
diff
changeset
|
69 return ov; |
0 | 70 } |
71 } | |
72 ShouldNotReachHere(); | |
73 return NULL; | |
74 } | |
75 | |
76 // Serializing scope values | |
77 | |
78 enum { LOCATION_CODE = 0, CONSTANT_INT_CODE = 1, CONSTANT_OOP_CODE = 2, | |
79 CONSTANT_LONG_CODE = 3, CONSTANT_DOUBLE_CODE = 4, | |
7046
b6a8f2d23057
VM support for deferred reads and writes: ScopeDesc, DebugInfo, DebugInfoRecorder
Lukas Stadler <lukas.stadler@jku.at>
parents:
6725
diff
changeset
|
80 OBJECT_CODE = 5, OBJECT_ID_CODE = 6, |
b6a8f2d23057
VM support for deferred reads and writes: ScopeDesc, DebugInfo, DebugInfoRecorder
Lukas Stadler <lukas.stadler@jku.at>
parents:
6725
diff
changeset
|
81 #ifdef GRAAL |
b6a8f2d23057
VM support for deferred reads and writes: ScopeDesc, DebugInfo, DebugInfoRecorder
Lukas Stadler <lukas.stadler@jku.at>
parents:
6725
diff
changeset
|
82 DEFERRED_READ_CODE = 7, DEFERRED_WRITE_CODE = 8 |
b6a8f2d23057
VM support for deferred reads and writes: ScopeDesc, DebugInfo, DebugInfoRecorder
Lukas Stadler <lukas.stadler@jku.at>
parents:
6725
diff
changeset
|
83 #endif // GRAAL |
b6a8f2d23057
VM support for deferred reads and writes: ScopeDesc, DebugInfo, DebugInfoRecorder
Lukas Stadler <lukas.stadler@jku.at>
parents:
6725
diff
changeset
|
84 }; |
0 | 85 |
86 ScopeValue* ScopeValue::read_from(DebugInfoReadStream* stream) { | |
87 ScopeValue* result = NULL; | |
88 switch(stream->read_int()) { | |
89 case LOCATION_CODE: result = new LocationValue(stream); break; | |
90 case CONSTANT_INT_CODE: result = new ConstantIntValue(stream); break; | |
91 case CONSTANT_OOP_CODE: result = new ConstantOopReadValue(stream); break; | |
92 case CONSTANT_LONG_CODE: result = new ConstantLongValue(stream); break; | |
93 case CONSTANT_DOUBLE_CODE: result = new ConstantDoubleValue(stream); break; | |
94 case OBJECT_CODE: result = stream->read_object_value(); break; | |
95 case OBJECT_ID_CODE: result = stream->get_cached_object(); break; | |
7046
b6a8f2d23057
VM support for deferred reads and writes: ScopeDesc, DebugInfo, DebugInfoRecorder
Lukas Stadler <lukas.stadler@jku.at>
parents:
6725
diff
changeset
|
96 #ifdef GRAAL |
b6a8f2d23057
VM support for deferred reads and writes: ScopeDesc, DebugInfo, DebugInfoRecorder
Lukas Stadler <lukas.stadler@jku.at>
parents:
6725
diff
changeset
|
97 case DEFERRED_READ_CODE: result = new DeferredReadValue(stream); break; |
b6a8f2d23057
VM support for deferred reads and writes: ScopeDesc, DebugInfo, DebugInfoRecorder
Lukas Stadler <lukas.stadler@jku.at>
parents:
6725
diff
changeset
|
98 case DEFERRED_WRITE_CODE: result = new DeferredWriteValue(stream); break; |
b6a8f2d23057
VM support for deferred reads and writes: ScopeDesc, DebugInfo, DebugInfoRecorder
Lukas Stadler <lukas.stadler@jku.at>
parents:
6725
diff
changeset
|
99 #endif // GRAAL |
0 | 100 default: ShouldNotReachHere(); |
101 } | |
102 return result; | |
103 } | |
104 | |
105 // LocationValue | |
106 | |
107 LocationValue::LocationValue(DebugInfoReadStream* stream) { | |
108 _location = Location(stream); | |
109 } | |
110 | |
111 void LocationValue::write_on(DebugInfoWriteStream* stream) { | |
112 stream->write_int(LOCATION_CODE); | |
113 location().write_on(stream); | |
114 } | |
115 | |
116 void LocationValue::print_on(outputStream* st) const { | |
117 location().print_on(st); | |
118 } | |
119 | |
7046
b6a8f2d23057
VM support for deferred reads and writes: ScopeDesc, DebugInfo, DebugInfoRecorder
Lukas Stadler <lukas.stadler@jku.at>
parents:
6725
diff
changeset
|
120 #ifdef GRAAL |
b6a8f2d23057
VM support for deferred reads and writes: ScopeDesc, DebugInfo, DebugInfoRecorder
Lukas Stadler <lukas.stadler@jku.at>
parents:
6725
diff
changeset
|
121 |
b6a8f2d23057
VM support for deferred reads and writes: ScopeDesc, DebugInfo, DebugInfoRecorder
Lukas Stadler <lukas.stadler@jku.at>
parents:
6725
diff
changeset
|
122 // DeferredLocationValue |
b6a8f2d23057
VM support for deferred reads and writes: ScopeDesc, DebugInfo, DebugInfoRecorder
Lukas Stadler <lukas.stadler@jku.at>
parents:
6725
diff
changeset
|
123 |
b6a8f2d23057
VM support for deferred reads and writes: ScopeDesc, DebugInfo, DebugInfoRecorder
Lukas Stadler <lukas.stadler@jku.at>
parents:
6725
diff
changeset
|
124 DeferredLocationValue::DeferredLocationValue(DebugInfoReadStream* stream) { |
b6a8f2d23057
VM support for deferred reads and writes: ScopeDesc, DebugInfo, DebugInfoRecorder
Lukas Stadler <lukas.stadler@jku.at>
parents:
6725
diff
changeset
|
125 _base = read_from(stream); |
b6a8f2d23057
VM support for deferred reads and writes: ScopeDesc, DebugInfo, DebugInfoRecorder
Lukas Stadler <lukas.stadler@jku.at>
parents:
6725
diff
changeset
|
126 _index = read_from(stream); |
b6a8f2d23057
VM support for deferred reads and writes: ScopeDesc, DebugInfo, DebugInfoRecorder
Lukas Stadler <lukas.stadler@jku.at>
parents:
6725
diff
changeset
|
127 _scale = stream->read_int(); |
b6a8f2d23057
VM support for deferred reads and writes: ScopeDesc, DebugInfo, DebugInfoRecorder
Lukas Stadler <lukas.stadler@jku.at>
parents:
6725
diff
changeset
|
128 _disp = stream->read_long(); |
b6a8f2d23057
VM support for deferred reads and writes: ScopeDesc, DebugInfo, DebugInfoRecorder
Lukas Stadler <lukas.stadler@jku.at>
parents:
6725
diff
changeset
|
129 } |
b6a8f2d23057
VM support for deferred reads and writes: ScopeDesc, DebugInfo, DebugInfoRecorder
Lukas Stadler <lukas.stadler@jku.at>
parents:
6725
diff
changeset
|
130 |
b6a8f2d23057
VM support for deferred reads and writes: ScopeDesc, DebugInfo, DebugInfoRecorder
Lukas Stadler <lukas.stadler@jku.at>
parents:
6725
diff
changeset
|
131 void DeferredLocationValue::write_on(DebugInfoWriteStream* stream) { |
b6a8f2d23057
VM support for deferred reads and writes: ScopeDesc, DebugInfo, DebugInfoRecorder
Lukas Stadler <lukas.stadler@jku.at>
parents:
6725
diff
changeset
|
132 _base->write_on(stream); |
b6a8f2d23057
VM support for deferred reads and writes: ScopeDesc, DebugInfo, DebugInfoRecorder
Lukas Stadler <lukas.stadler@jku.at>
parents:
6725
diff
changeset
|
133 _index->write_on(stream); |
b6a8f2d23057
VM support for deferred reads and writes: ScopeDesc, DebugInfo, DebugInfoRecorder
Lukas Stadler <lukas.stadler@jku.at>
parents:
6725
diff
changeset
|
134 stream->write_int(_scale); |
b6a8f2d23057
VM support for deferred reads and writes: ScopeDesc, DebugInfo, DebugInfoRecorder
Lukas Stadler <lukas.stadler@jku.at>
parents:
6725
diff
changeset
|
135 stream->write_long(_disp); |
b6a8f2d23057
VM support for deferred reads and writes: ScopeDesc, DebugInfo, DebugInfoRecorder
Lukas Stadler <lukas.stadler@jku.at>
parents:
6725
diff
changeset
|
136 } |
b6a8f2d23057
VM support for deferred reads and writes: ScopeDesc, DebugInfo, DebugInfoRecorder
Lukas Stadler <lukas.stadler@jku.at>
parents:
6725
diff
changeset
|
137 |
b6a8f2d23057
VM support for deferred reads and writes: ScopeDesc, DebugInfo, DebugInfoRecorder
Lukas Stadler <lukas.stadler@jku.at>
parents:
6725
diff
changeset
|
138 void DeferredLocationValue::print_on(outputStream* st) const { |
b6a8f2d23057
VM support for deferred reads and writes: ScopeDesc, DebugInfo, DebugInfoRecorder
Lukas Stadler <lukas.stadler@jku.at>
parents:
6725
diff
changeset
|
139 _base->print_on(st); |
b6a8f2d23057
VM support for deferred reads and writes: ScopeDesc, DebugInfo, DebugInfoRecorder
Lukas Stadler <lukas.stadler@jku.at>
parents:
6725
diff
changeset
|
140 _index->print_on(st); |
b6a8f2d23057
VM support for deferred reads and writes: ScopeDesc, DebugInfo, DebugInfoRecorder
Lukas Stadler <lukas.stadler@jku.at>
parents:
6725
diff
changeset
|
141 st->print("%i %i", _scale, _disp); |
b6a8f2d23057
VM support for deferred reads and writes: ScopeDesc, DebugInfo, DebugInfoRecorder
Lukas Stadler <lukas.stadler@jku.at>
parents:
6725
diff
changeset
|
142 } |
b6a8f2d23057
VM support for deferred reads and writes: ScopeDesc, DebugInfo, DebugInfoRecorder
Lukas Stadler <lukas.stadler@jku.at>
parents:
6725
diff
changeset
|
143 |
b6a8f2d23057
VM support for deferred reads and writes: ScopeDesc, DebugInfo, DebugInfoRecorder
Lukas Stadler <lukas.stadler@jku.at>
parents:
6725
diff
changeset
|
144 // DeferredReadValue |
b6a8f2d23057
VM support for deferred reads and writes: ScopeDesc, DebugInfo, DebugInfoRecorder
Lukas Stadler <lukas.stadler@jku.at>
parents:
6725
diff
changeset
|
145 |
b6a8f2d23057
VM support for deferred reads and writes: ScopeDesc, DebugInfo, DebugInfoRecorder
Lukas Stadler <lukas.stadler@jku.at>
parents:
6725
diff
changeset
|
146 DeferredReadValue::DeferredReadValue(DebugInfoReadStream* stream) |
b6a8f2d23057
VM support for deferred reads and writes: ScopeDesc, DebugInfo, DebugInfoRecorder
Lukas Stadler <lukas.stadler@jku.at>
parents:
6725
diff
changeset
|
147 : DeferredLocationValue(stream) { |
b6a8f2d23057
VM support for deferred reads and writes: ScopeDesc, DebugInfo, DebugInfoRecorder
Lukas Stadler <lukas.stadler@jku.at>
parents:
6725
diff
changeset
|
148 } |
b6a8f2d23057
VM support for deferred reads and writes: ScopeDesc, DebugInfo, DebugInfoRecorder
Lukas Stadler <lukas.stadler@jku.at>
parents:
6725
diff
changeset
|
149 |
b6a8f2d23057
VM support for deferred reads and writes: ScopeDesc, DebugInfo, DebugInfoRecorder
Lukas Stadler <lukas.stadler@jku.at>
parents:
6725
diff
changeset
|
150 void DeferredReadValue::write_on(DebugInfoWriteStream* st) { |
b6a8f2d23057
VM support for deferred reads and writes: ScopeDesc, DebugInfo, DebugInfoRecorder
Lukas Stadler <lukas.stadler@jku.at>
parents:
6725
diff
changeset
|
151 DeferredLocationValue::write_on(st); |
b6a8f2d23057
VM support for deferred reads and writes: ScopeDesc, DebugInfo, DebugInfoRecorder
Lukas Stadler <lukas.stadler@jku.at>
parents:
6725
diff
changeset
|
152 } |
b6a8f2d23057
VM support for deferred reads and writes: ScopeDesc, DebugInfo, DebugInfoRecorder
Lukas Stadler <lukas.stadler@jku.at>
parents:
6725
diff
changeset
|
153 |
b6a8f2d23057
VM support for deferred reads and writes: ScopeDesc, DebugInfo, DebugInfoRecorder
Lukas Stadler <lukas.stadler@jku.at>
parents:
6725
diff
changeset
|
154 void DeferredReadValue::print_on(outputStream* st) const { |
b6a8f2d23057
VM support for deferred reads and writes: ScopeDesc, DebugInfo, DebugInfoRecorder
Lukas Stadler <lukas.stadler@jku.at>
parents:
6725
diff
changeset
|
155 DeferredLocationValue::print_on(st); |
b6a8f2d23057
VM support for deferred reads and writes: ScopeDesc, DebugInfo, DebugInfoRecorder
Lukas Stadler <lukas.stadler@jku.at>
parents:
6725
diff
changeset
|
156 } |
b6a8f2d23057
VM support for deferred reads and writes: ScopeDesc, DebugInfo, DebugInfoRecorder
Lukas Stadler <lukas.stadler@jku.at>
parents:
6725
diff
changeset
|
157 |
b6a8f2d23057
VM support for deferred reads and writes: ScopeDesc, DebugInfo, DebugInfoRecorder
Lukas Stadler <lukas.stadler@jku.at>
parents:
6725
diff
changeset
|
158 // DeferredWriteValue |
b6a8f2d23057
VM support for deferred reads and writes: ScopeDesc, DebugInfo, DebugInfoRecorder
Lukas Stadler <lukas.stadler@jku.at>
parents:
6725
diff
changeset
|
159 |
b6a8f2d23057
VM support for deferred reads and writes: ScopeDesc, DebugInfo, DebugInfoRecorder
Lukas Stadler <lukas.stadler@jku.at>
parents:
6725
diff
changeset
|
160 DeferredWriteValue::DeferredWriteValue(DebugInfoReadStream* stream) |
b6a8f2d23057
VM support for deferred reads and writes: ScopeDesc, DebugInfo, DebugInfoRecorder
Lukas Stadler <lukas.stadler@jku.at>
parents:
6725
diff
changeset
|
161 : DeferredLocationValue(stream) { |
b6a8f2d23057
VM support for deferred reads and writes: ScopeDesc, DebugInfo, DebugInfoRecorder
Lukas Stadler <lukas.stadler@jku.at>
parents:
6725
diff
changeset
|
162 _value = read_from(stream); |
b6a8f2d23057
VM support for deferred reads and writes: ScopeDesc, DebugInfo, DebugInfoRecorder
Lukas Stadler <lukas.stadler@jku.at>
parents:
6725
diff
changeset
|
163 } |
b6a8f2d23057
VM support for deferred reads and writes: ScopeDesc, DebugInfo, DebugInfoRecorder
Lukas Stadler <lukas.stadler@jku.at>
parents:
6725
diff
changeset
|
164 |
b6a8f2d23057
VM support for deferred reads and writes: ScopeDesc, DebugInfo, DebugInfoRecorder
Lukas Stadler <lukas.stadler@jku.at>
parents:
6725
diff
changeset
|
165 void DeferredWriteValue::write_on(DebugInfoWriteStream* st) { |
b6a8f2d23057
VM support for deferred reads and writes: ScopeDesc, DebugInfo, DebugInfoRecorder
Lukas Stadler <lukas.stadler@jku.at>
parents:
6725
diff
changeset
|
166 DeferredLocationValue::write_on(st); |
b6a8f2d23057
VM support for deferred reads and writes: ScopeDesc, DebugInfo, DebugInfoRecorder
Lukas Stadler <lukas.stadler@jku.at>
parents:
6725
diff
changeset
|
167 _value->write_on(st); |
b6a8f2d23057
VM support for deferred reads and writes: ScopeDesc, DebugInfo, DebugInfoRecorder
Lukas Stadler <lukas.stadler@jku.at>
parents:
6725
diff
changeset
|
168 } |
b6a8f2d23057
VM support for deferred reads and writes: ScopeDesc, DebugInfo, DebugInfoRecorder
Lukas Stadler <lukas.stadler@jku.at>
parents:
6725
diff
changeset
|
169 |
b6a8f2d23057
VM support for deferred reads and writes: ScopeDesc, DebugInfo, DebugInfoRecorder
Lukas Stadler <lukas.stadler@jku.at>
parents:
6725
diff
changeset
|
170 void DeferredWriteValue::print_on(outputStream* st) const { |
b6a8f2d23057
VM support for deferred reads and writes: ScopeDesc, DebugInfo, DebugInfoRecorder
Lukas Stadler <lukas.stadler@jku.at>
parents:
6725
diff
changeset
|
171 DeferredLocationValue::print_on(st); |
b6a8f2d23057
VM support for deferred reads and writes: ScopeDesc, DebugInfo, DebugInfoRecorder
Lukas Stadler <lukas.stadler@jku.at>
parents:
6725
diff
changeset
|
172 _value->print_on(st); |
b6a8f2d23057
VM support for deferred reads and writes: ScopeDesc, DebugInfo, DebugInfoRecorder
Lukas Stadler <lukas.stadler@jku.at>
parents:
6725
diff
changeset
|
173 } |
b6a8f2d23057
VM support for deferred reads and writes: ScopeDesc, DebugInfo, DebugInfoRecorder
Lukas Stadler <lukas.stadler@jku.at>
parents:
6725
diff
changeset
|
174 |
b6a8f2d23057
VM support for deferred reads and writes: ScopeDesc, DebugInfo, DebugInfoRecorder
Lukas Stadler <lukas.stadler@jku.at>
parents:
6725
diff
changeset
|
175 #endif // GRAAL |
b6a8f2d23057
VM support for deferred reads and writes: ScopeDesc, DebugInfo, DebugInfoRecorder
Lukas Stadler <lukas.stadler@jku.at>
parents:
6725
diff
changeset
|
176 |
0 | 177 // ObjectValue |
178 | |
179 void ObjectValue::read_object(DebugInfoReadStream* stream) { | |
180 _klass = read_from(stream); | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
1972
diff
changeset
|
181 assert(_klass->is_constant_oop(), "should be constant java mirror oop"); |
0 | 182 int length = stream->read_int(); |
183 for (int i = 0; i < length; i++) { | |
184 ScopeValue* val = read_from(stream); | |
185 _field_values.append(val); | |
186 } | |
187 } | |
188 | |
189 void ObjectValue::write_on(DebugInfoWriteStream* stream) { | |
190 if (_visited) { | |
191 stream->write_int(OBJECT_ID_CODE); | |
192 stream->write_int(_id); | |
193 } else { | |
194 _visited = true; | |
195 stream->write_int(OBJECT_CODE); | |
196 stream->write_int(_id); | |
197 _klass->write_on(stream); | |
198 int length = _field_values.length(); | |
199 stream->write_int(length); | |
200 for (int i = 0; i < length; i++) { | |
201 _field_values.at(i)->write_on(stream); | |
202 } | |
203 } | |
204 } | |
205 | |
206 void ObjectValue::print_on(outputStream* st) const { | |
207 st->print("obj[%d]", _id); | |
208 } | |
209 | |
210 void ObjectValue::print_fields_on(outputStream* st) const { | |
211 #ifndef PRODUCT | |
212 if (_field_values.length() > 0) { | |
213 _field_values.at(0)->print_on(st); | |
214 } | |
215 for (int i = 1; i < _field_values.length(); i++) { | |
216 st->print(", "); | |
217 _field_values.at(i)->print_on(st); | |
218 } | |
219 #endif | |
220 } | |
221 | |
222 // ConstantIntValue | |
223 | |
224 ConstantIntValue::ConstantIntValue(DebugInfoReadStream* stream) { | |
225 _value = stream->read_signed_int(); | |
226 } | |
227 | |
228 void ConstantIntValue::write_on(DebugInfoWriteStream* stream) { | |
229 stream->write_int(CONSTANT_INT_CODE); | |
230 stream->write_signed_int(value()); | |
231 } | |
232 | |
233 void ConstantIntValue::print_on(outputStream* st) const { | |
234 st->print("%d", value()); | |
235 } | |
236 | |
237 // ConstantLongValue | |
238 | |
239 ConstantLongValue::ConstantLongValue(DebugInfoReadStream* stream) { | |
240 _value = stream->read_long(); | |
241 } | |
242 | |
243 void ConstantLongValue::write_on(DebugInfoWriteStream* stream) { | |
244 stream->write_int(CONSTANT_LONG_CODE); | |
245 stream->write_long(value()); | |
246 } | |
247 | |
248 void ConstantLongValue::print_on(outputStream* st) const { | |
249 st->print(INT64_FORMAT, value()); | |
250 } | |
251 | |
252 // ConstantDoubleValue | |
253 | |
254 ConstantDoubleValue::ConstantDoubleValue(DebugInfoReadStream* stream) { | |
255 _value = stream->read_double(); | |
256 } | |
257 | |
258 void ConstantDoubleValue::write_on(DebugInfoWriteStream* stream) { | |
259 stream->write_int(CONSTANT_DOUBLE_CODE); | |
260 stream->write_double(value()); | |
261 } | |
262 | |
263 void ConstantDoubleValue::print_on(outputStream* st) const { | |
264 st->print("%f", value()); | |
265 } | |
266 | |
267 // ConstantOopWriteValue | |
268 | |
269 void ConstantOopWriteValue::write_on(DebugInfoWriteStream* stream) { | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
1972
diff
changeset
|
270 assert(JNIHandles::resolve(value()) == NULL || |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
1972
diff
changeset
|
271 Universe::heap()->is_in_reserved(JNIHandles::resolve(value())), |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
1972
diff
changeset
|
272 "Should be in heap"); |
0 | 273 stream->write_int(CONSTANT_OOP_CODE); |
274 stream->write_handle(value()); | |
275 } | |
276 | |
277 void ConstantOopWriteValue::print_on(outputStream* st) const { | |
278 JNIHandles::resolve(value())->print_value_on(st); | |
279 } | |
280 | |
281 | |
282 // ConstantOopReadValue | |
283 | |
284 ConstantOopReadValue::ConstantOopReadValue(DebugInfoReadStream* stream) { | |
285 _value = Handle(stream->read_oop()); | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
1972
diff
changeset
|
286 assert(_value() == NULL || |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
1972
diff
changeset
|
287 Universe::heap()->is_in_reserved(_value()), "Should be in heap"); |
0 | 288 } |
289 | |
290 void ConstantOopReadValue::write_on(DebugInfoWriteStream* stream) { | |
291 ShouldNotReachHere(); | |
292 } | |
293 | |
294 void ConstantOopReadValue::print_on(outputStream* st) const { | |
295 value()()->print_value_on(st); | |
296 } | |
297 | |
298 | |
299 // MonitorValue | |
300 | |
301 MonitorValue::MonitorValue(ScopeValue* owner, Location basic_lock, bool eliminated) { | |
302 _owner = owner; | |
303 _basic_lock = basic_lock; | |
304 _eliminated = eliminated; | |
305 } | |
306 | |
307 MonitorValue::MonitorValue(DebugInfoReadStream* stream) { | |
308 _basic_lock = Location(stream); | |
309 _owner = ScopeValue::read_from(stream); | |
310 _eliminated = (stream->read_bool() != 0); | |
311 } | |
312 | |
313 void MonitorValue::write_on(DebugInfoWriteStream* stream) { | |
314 _basic_lock.write_on(stream); | |
315 _owner->write_on(stream); | |
316 stream->write_bool(_eliminated); | |
317 } | |
318 | |
319 #ifndef PRODUCT | |
320 void MonitorValue::print_on(outputStream* st) const { | |
321 st->print("monitor{"); | |
322 owner()->print_on(st); | |
323 st->print(","); | |
324 basic_lock().print_on(st); | |
325 st->print("}"); | |
326 if (_eliminated) { | |
327 st->print(" (eliminated)"); | |
328 } | |
329 } | |
330 #endif |