Mercurial > hg > truffle
comparison src/share/vm/code/debugInfoRec.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 | 0b646334c5f7 |
comparison
equal
deleted
inserted
replaced
7039:adf5c101bc4b | 7046:b6a8f2d23057 |
---|---|
211 } | 211 } |
212 | 212 |
213 return result; | 213 return result; |
214 } | 214 } |
215 | 215 |
216 #ifdef GRAAL | |
217 | |
218 int DebugInformationRecorder::serialize_deferred_writes(GrowableArray<DeferredWriteValue*>* deferred_writes) { | |
219 if (deferred_writes == NULL || deferred_writes->is_empty()) return DebugInformationRecorder::serialized_null; | |
220 assert(_recording_state == rs_safepoint, "must be recording a safepoint"); | |
221 int result = stream()->position(); | |
222 assert(result != serialized_null, "sanity"); | |
223 stream()->write_int(deferred_writes->length()); | |
224 for (int index = 0; index < deferred_writes->length(); index++) { | |
225 deferred_writes->at(index)->write_on(stream()); | |
226 } | |
227 | |
228 // (See comment below on DebugInformationRecorder::describe_scope.) | |
229 int shared_result = find_sharable_decode_offset(result); | |
230 if (shared_result != serialized_null) { | |
231 stream()->set_position(result); | |
232 result = shared_result; | |
233 } | |
234 | |
235 return result; | |
236 } | |
237 | |
238 #endif // GRAAL | |
216 | 239 |
217 #ifndef PRODUCT | 240 #ifndef PRODUCT |
218 // These variables are put into one block to reduce relocations | 241 // These variables are put into one block to reduce relocations |
219 // and make it simpler to print from the debugger. | 242 // and make it simpler to print from the debugger. |
220 static | 243 static |
287 bool rethrow_exception, | 310 bool rethrow_exception, |
288 bool is_method_handle_invoke, | 311 bool is_method_handle_invoke, |
289 bool return_oop, | 312 bool return_oop, |
290 DebugToken* locals, | 313 DebugToken* locals, |
291 DebugToken* expressions, | 314 DebugToken* expressions, |
292 DebugToken* monitors) { | 315 DebugToken* monitors |
316 #ifdef GRAAL | |
317 , DebugToken* deferred_writes | |
318 #endif // GRAAL | |
319 ) { | |
293 assert(_recording_state != rs_null, "nesting of recording calls"); | 320 assert(_recording_state != rs_null, "nesting of recording calls"); |
294 PcDesc* last_pd = last_pc(); | 321 PcDesc* last_pd = last_pc(); |
295 assert(last_pd->pc_offset() == pc_offset, "must be last pc"); | 322 assert(last_pd->pc_offset() == pc_offset, "must be last pc"); |
296 int sender_stream_offset = last_pd->scope_decode_offset(); | 323 int sender_stream_offset = last_pd->scope_decode_offset(); |
297 // update the stream offset of current pc desc | 324 // update the stream offset of current pc desc |
326 | 353 |
327 // serialize the locals/expressions/monitors | 354 // serialize the locals/expressions/monitors |
328 stream()->write_int((intptr_t) locals); | 355 stream()->write_int((intptr_t) locals); |
329 stream()->write_int((intptr_t) expressions); | 356 stream()->write_int((intptr_t) expressions); |
330 stream()->write_int((intptr_t) monitors); | 357 stream()->write_int((intptr_t) monitors); |
358 #ifdef GRAAL | |
359 stream()->write_int((intptr_t) deferred_writes); | |
360 #endif // GRAAL | |
331 | 361 |
332 // Here's a tricky bit. We just wrote some bytes. | 362 // Here's a tricky bit. We just wrote some bytes. |
333 // Wouldn't it be nice to find that we had already | 363 // Wouldn't it be nice to find that we had already |
334 // written those same bytes somewhere else? | 364 // written those same bytes somewhere else? |
335 // If we get lucky this way, reset the stream | 365 // If we get lucky this way, reset the stream |
407 DebugToken* DebugInformationRecorder::create_monitor_values(GrowableArray<MonitorValue*>* monitors) { | 437 DebugToken* DebugInformationRecorder::create_monitor_values(GrowableArray<MonitorValue*>* monitors) { |
408 assert(!recorders_frozen(), "not frozen yet"); | 438 assert(!recorders_frozen(), "not frozen yet"); |
409 return (DebugToken*) (intptr_t) serialize_monitor_values(monitors); | 439 return (DebugToken*) (intptr_t) serialize_monitor_values(monitors); |
410 } | 440 } |
411 | 441 |
442 #ifdef GRAAL | |
443 | |
444 DebugToken* DebugInformationRecorder::create_deferred_writes(GrowableArray<DeferredWriteValue*>* deferred_writes) { | |
445 assert(!recorders_frozen(), "not frozen yet"); | |
446 return (DebugToken*) (intptr_t) serialize_deferred_writes(deferred_writes); | |
447 } | |
448 | |
449 #endif // GRAAL | |
412 | 450 |
413 int DebugInformationRecorder::data_size() { | 451 int DebugInformationRecorder::data_size() { |
414 debug_only(mark_recorders_frozen()); // mark it "frozen" for asserts | 452 debug_only(mark_recorders_frozen()); // mark it "frozen" for asserts |
415 return _stream->position(); | 453 return _stream->position(); |
416 } | 454 } |