comparison src/share/vm/runtime/deoptimization.cpp @ 13641:5a9afbf72714

Add a speculation oop for uncommon trap deoptimization. Save it in the SpeculationLog during deoptimization.
author Gilles Duboscq <duboscq@ssw.jku.at>
date Thu, 12 Dec 2013 15:13:02 +0100
parents 2b43fcc68add
children 10f943c778f6
comparison
equal deleted inserted replaced
13640:bfe7a8c8c3c6 13641:5a9afbf72714
1345 revoke_biases_of_monitors(thread, fr, &reg_map); 1345 revoke_biases_of_monitors(thread, fr, &reg_map);
1346 1346
1347 DeoptReason reason = trap_request_reason(trap_request); 1347 DeoptReason reason = trap_request_reason(trap_request);
1348 DeoptAction action = trap_request_action(trap_request); 1348 DeoptAction action = trap_request_action(trap_request);
1349 #ifdef GRAAL 1349 #ifdef GRAAL
1350 short speculation_id = trap_request_speculation_id(trap_request); 1350 short debug_id = trap_request_debug_id(trap_request);
1351 #endif 1351 #endif
1352 jint unloaded_class_index = trap_request_index(trap_request); // CP idx or -1 1352 jint unloaded_class_index = trap_request_index(trap_request); // CP idx or -1
1353 1353
1354 vframe* vf = vframe::new_vframe(&fr, &reg_map, thread); 1354 vframe* vf = vframe::new_vframe(&fr, &reg_map, thread);
1355 compiledVFrame* cvf = compiledVFrame::cast(vf); 1355 compiledVFrame* cvf = compiledVFrame::cast(vf);
1359 ScopeDesc* trap_scope = cvf->scope(); 1359 ScopeDesc* trap_scope = cvf->scope();
1360 1360
1361 if (TraceDeoptimization) { 1361 if (TraceDeoptimization) {
1362 tty->print_cr(" bci=%d pc=%d, relative_pc=%d, method=%s" GRAAL_ONLY(", speculation=%d"), trap_scope->bci(), fr.pc(), fr.pc() - nm->code_begin(), trap_scope->method()->name()->as_C_string() 1362 tty->print_cr(" bci=%d pc=%d, relative_pc=%d, method=%s" GRAAL_ONLY(", speculation=%d"), trap_scope->bci(), fr.pc(), fr.pc() - nm->code_begin(), trap_scope->method()->name()->as_C_string()
1363 #ifdef GRAAL 1363 #ifdef GRAAL
1364 , speculation_id 1364 , debug_id
1365 #endif 1365 #endif
1366 ); 1366 );
1367 } 1367 }
1368 1368
1369 methodHandle trap_method = trap_scope->method(); 1369 methodHandle trap_method = trap_scope->method();
1370 int trap_bci = trap_scope->bci(); 1370 int trap_bci = trap_scope->bci();
1371 #ifdef GRAAL 1371 #ifdef GRAAL
1372 oop speculation = thread->pending_failed_speculation();
1373 if (speculation != NULL) {
1374 oop speculation_log = nm->speculation_log();
1375 if (speculation_log != NULL) {
1376 SpeculationLog::set_lastFailed(speculation_log, speculation);
1377 }
1378 thread->set_pending_failed_speculation(NULL);
1379 }
1380
1372 if (trap_bci == SynchronizationEntryBCI) { 1381 if (trap_bci == SynchronizationEntryBCI) {
1373 trap_bci = 0; 1382 trap_bci = 0;
1374 Thread::current()->set_pending_monitorenter(true); 1383 Thread::current()->set_pending_monitorenter(true);
1375 } 1384 }
1376 #endif 1385 #endif
1481 os::current_thread_id(), 1490 os::current_thread_id(),
1482 trap_reason_name(reason), 1491 trap_reason_name(reason),
1483 trap_action_name(action), 1492 trap_action_name(action),
1484 unloaded_class_index 1493 unloaded_class_index
1485 #ifdef GRAAL 1494 #ifdef GRAAL
1486 , speculation_id 1495 , debug_id
1487 #endif 1496 #endif
1488 ); 1497 );
1489 if (class_name != NULL) { 1498 if (class_name != NULL) {
1490 tty->print(unresolved ? " unresolved class: " : " symbol: "); 1499 tty->print(unresolved ? " unresolved class: " : " symbol: ");
1491 class_name->print_symbol_on(tty); 1500 class_name->print_symbol_on(tty);
2005 int trap_request) { 2014 int trap_request) {
2006 jint unloaded_class_index = trap_request_index(trap_request); 2015 jint unloaded_class_index = trap_request_index(trap_request);
2007 const char* reason = trap_reason_name(trap_request_reason(trap_request)); 2016 const char* reason = trap_reason_name(trap_request_reason(trap_request));
2008 const char* action = trap_action_name(trap_request_action(trap_request)); 2017 const char* action = trap_action_name(trap_request_action(trap_request));
2009 #ifdef GRAAL 2018 #ifdef GRAAL
2010 short speculation_id = trap_request_speculation_id(trap_request); 2019 short debug_id = trap_request_debug_id(trap_request);
2011 #endif 2020 #endif
2012 size_t len; 2021 size_t len;
2013 if (unloaded_class_index < 0) { 2022 if (unloaded_class_index < 0) {
2014 len = jio_snprintf(buf, buflen, "reason='%s' action='%s'" GRAAL_ONLY(" speculation='%d'"), 2023 len = jio_snprintf(buf, buflen, "reason='%s' action='%s'" GRAAL_ONLY(" speculation='%d'"),
2015 reason, action 2024 reason, action
2016 #ifdef GRAAL 2025 #ifdef GRAAL
2017 ,speculation_id 2026 ,debug_id
2018 #endif 2027 #endif
2019 ); 2028 );
2020 } else { 2029 } else {
2021 len = jio_snprintf(buf, buflen, "reason='%s' action='%s' index='%d'" GRAAL_ONLY(" speculation='%d'"), 2030 len = jio_snprintf(buf, buflen, "reason='%s' action='%s' index='%d'" GRAAL_ONLY(" speculation='%d'"),
2022 reason, action, unloaded_class_index 2031 reason, action, unloaded_class_index
2023 #ifdef GRAAL 2032 #ifdef GRAAL
2024 ,speculation_id 2033 ,debug_id
2025 #endif 2034 #endif
2026 ); 2035 );
2027 } 2036 }
2028 if (len >= buflen) 2037 if (len >= buflen)
2029 buf[buflen-1] = '\0'; 2038 buf[buflen-1] = '\0';