comparison src/share/vm/code/scopeDesc.cpp @ 7046:b6a8f2d23057

VM support for deferred reads and writes: ScopeDesc, DebugInfo, DebugInfoRecorder
author Lukas Stadler <lukas.stadler@jku.at>
date Tue, 27 Nov 2012 13:43:04 +0100
parents e522a00b91aa
children d4e6c82cd6a1
comparison
equal deleted inserted replaced
7039:adf5c101bc4b 7046:b6a8f2d23057
71 _method = _code->method(); 71 _method = _code->method();
72 _bci = InvocationEntryBci; 72 _bci = InvocationEntryBci;
73 _locals_decode_offset = DebugInformationRecorder::serialized_null; 73 _locals_decode_offset = DebugInformationRecorder::serialized_null;
74 _expressions_decode_offset = DebugInformationRecorder::serialized_null; 74 _expressions_decode_offset = DebugInformationRecorder::serialized_null;
75 _monitors_decode_offset = DebugInformationRecorder::serialized_null; 75 _monitors_decode_offset = DebugInformationRecorder::serialized_null;
76 #ifdef GRAAL
77 _deferred_writes_decode_offset = DebugInformationRecorder::serialized_null;
78 #endif // GRAAL
76 } else { 79 } else {
77 // decode header 80 // decode header
78 DebugInfoReadStream* stream = stream_at(decode_offset()); 81 DebugInfoReadStream* stream = stream_at(decode_offset());
79 82
80 _sender_decode_offset = stream->read_int(); 83 _sender_decode_offset = stream->read_int();
83 86
84 // decode offsets for body and sender 87 // decode offsets for body and sender
85 _locals_decode_offset = stream->read_int(); 88 _locals_decode_offset = stream->read_int();
86 _expressions_decode_offset = stream->read_int(); 89 _expressions_decode_offset = stream->read_int();
87 _monitors_decode_offset = stream->read_int(); 90 _monitors_decode_offset = stream->read_int();
91 #ifdef GRAAL
92 _deferred_writes_decode_offset = stream->read_int();
93 #endif // GRAAL
88 } 94 }
89 } 95 }
90 96
91 97
92 GrowableArray<ScopeValue*>* ScopeDesc::decode_scope_values(int decode_offset) { 98 GrowableArray<ScopeValue*>* ScopeDesc::decode_scope_values(int decode_offset) {
123 for (int index = 0; index < length; index++) { 129 for (int index = 0; index < length; index++) {
124 result->push(new MonitorValue(stream)); 130 result->push(new MonitorValue(stream));
125 } 131 }
126 return result; 132 return result;
127 } 133 }
134
135 #ifdef GRAAL
136
137 GrowableArray<DeferredWriteValue*>* ScopeDesc::decode_deferred_writes(int decode_offset) {
138 if (decode_offset == DebugInformationRecorder::serialized_null) return NULL;
139 DebugInfoReadStream* stream = stream_at(decode_offset);
140 int length = stream->read_int();
141 GrowableArray<DeferredWriteValue*>* result = new GrowableArray<DeferredWriteValue*> (length);
142 for (int index = 0; index < length; index++) {
143 result->push(new DeferredWriteValue(stream));
144 }
145 return result;
146 }
147
148 GrowableArray<DeferredWriteValue*>* ScopeDesc::deferred_writes() {
149 return decode_deferred_writes(_deferred_writes_decode_offset);
150 }
151
152 #endif // GRAAL
128 153
129 DebugInfoReadStream* ScopeDesc::stream_at(int decode_offset) const { 154 DebugInfoReadStream* ScopeDesc::stream_at(int decode_offset) const {
130 return new DebugInfoReadStream(_code, decode_offset, _objects); 155 return new DebugInfoReadStream(_code, decode_offset, _objects);
131 } 156 }
132 157
223 st->cr(); 248 st->cr();
224 } 249 }
225 } 250 }
226 } 251 }
227 252
228 #ifdef COMPILER2 253 #if defined(COMPILER2) || defined(GRAAL)
229 if (DoEscapeAnalysis && is_top() && _objects != NULL) { 254 if (NOT_GRAAL(DoEscapeAnalysis &&) is_top() && _objects != NULL) {
230 tty->print_cr("Objects"); 255 tty->print_cr("Objects");
231 for (int i = 0; i < _objects->length(); i++) { 256 for (int i = 0; i < _objects->length(); i++) {
232 ObjectValue* sv = (ObjectValue*) _objects->at(i); 257 ObjectValue* sv = (ObjectValue*) _objects->at(i);
233 tty->print(" - %d: ", sv->id()); 258 tty->print(" - %d: ", sv->id());
234 sv->print_fields_on(tty); 259 sv->print_fields_on(tty);
235 tty->cr(); 260 tty->cr();
236 } 261 }
237 } 262 }
238 #endif // COMPILER2 263 #endif // COMPILER2 || GRAAL
264 #ifdef GRAAL
265 // deferred writes
266 { GrowableArray<DeferredWriteValue*>* l = ((ScopeDesc*) this)->deferred_writes();
267 if (l != NULL) {
268 st->print_cr(" Deferred writes");
269 for (int index = 0; index < l->length(); index++) {
270 st->print(" - @%d: ", index);
271 l->at(index)->print_on(st);
272 st->cr();
273 }
274 }
275 }
276 #endif
239 } 277 }
240 278
241 #endif 279 #endif
242 280
243 void ScopeDesc::verify() { 281 void ScopeDesc::verify() {