166 RegisterMap map(thread, true); |
166 RegisterMap map(thread, true); |
167 RegisterMap dummy_map(thread, false); |
167 RegisterMap dummy_map(thread, false); |
168 // Now get the deoptee with a valid map |
168 // Now get the deoptee with a valid map |
169 frame deoptee = stub_frame.sender(&map); |
169 frame deoptee = stub_frame.sender(&map); |
170 // Set the deoptee nmethod |
170 // Set the deoptee nmethod |
171 assert(thread->deopt_nmethod() == NULL, "Pending deopt!"); |
171 assert(thread->deopt_compiled_method() == NULL, "Pending deopt!"); |
172 thread->set_deopt_nmethod(deoptee.cb()->as_nmethod_or_null()); |
172 CompiledMethod* cm = deoptee.cb()->as_compiled_method_or_null(); |
173 bool skip_internal = thread->deopt_nmethod() != NULL && !thread->deopt_nmethod()->compiler()->is_jvmci(); |
173 thread->set_deopt_compiled_method(cm); |
|
174 bool skip_internal = (cm != NULL) && !cm->is_compiled_by_jvmci(); |
174 |
175 |
175 if (VerifyStack) { |
176 if (VerifyStack) { |
176 thread->validate_frame_layout(); |
177 thread->validate_frame_layout(); |
177 } |
178 } |
178 |
179 |
546 // Deallocate any resource creating in this routine and any ResourceObjs allocated |
547 // Deallocate any resource creating in this routine and any ResourceObjs allocated |
547 // inside the vframeArray (StackValueCollections) |
548 // inside the vframeArray (StackValueCollections) |
548 |
549 |
549 delete thread->deopt_mark(); |
550 delete thread->deopt_mark(); |
550 thread->set_deopt_mark(NULL); |
551 thread->set_deopt_mark(NULL); |
551 thread->set_deopt_nmethod(NULL); |
552 thread->set_deopt_compiled_method(NULL); |
552 |
553 |
553 |
554 |
554 if (JvmtiExport::can_pop_frame()) { |
555 if (JvmtiExport::can_pop_frame()) { |
555 #ifndef CC_INTERP |
556 #ifndef CC_INTERP |
556 // Regardless of whether we entered this routine with the pending |
557 // Regardless of whether we entered this routine with the pending |
1290 assert(fr.can_be_deoptimized(), "checking frame type"); |
1291 assert(fr.can_be_deoptimized(), "checking frame type"); |
1291 |
1292 |
1292 gather_statistics(reason, Action_none, Bytecodes::_illegal); |
1293 gather_statistics(reason, Action_none, Bytecodes::_illegal); |
1293 |
1294 |
1294 if (LogCompilation && xtty != NULL) { |
1295 if (LogCompilation && xtty != NULL) { |
1295 nmethod* nm = fr.cb()->as_nmethod_or_null(); |
1296 CompiledMethod* cm = fr.cb()->as_compiled_method_or_null(); |
1296 assert(nm != NULL, "only compiled methods can deopt"); |
1297 assert(cm != NULL, "only compiled methods can deopt"); |
1297 |
1298 |
1298 ttyLocker ttyl; |
1299 ttyLocker ttyl; |
1299 xtty->begin_head("deoptimized thread='" UINTX_FORMAT "'", (uintx)thread->osthread()->thread_id()); |
1300 xtty->begin_head("deoptimized thread='" UINTX_FORMAT "'", (uintx)thread->osthread()->thread_id()); |
1300 nm->log_identity(xtty); |
1301 cm->log_identity(xtty); |
1301 xtty->end_head(); |
1302 xtty->end_head(); |
1302 for (ScopeDesc* sd = nm->scope_desc_at(fr.pc()); ; sd = sd->sender()) { |
1303 for (ScopeDesc* sd = cm->scope_desc_at(fr.pc()); ; sd = sd->sender()) { |
1303 xtty->begin_elem("jvms bci='%d'", sd->bci()); |
1304 xtty->begin_elem("jvms bci='%d'", sd->bci()); |
1304 xtty->method(sd->method()); |
1305 xtty->method(sd->method()); |
1305 xtty->end_elem(); |
1306 xtty->end_elem(); |
1306 if (sd->is_top()) break; |
1307 if (sd->is_top()) break; |
1307 } |
1308 } |
1478 jint unloaded_class_index = trap_request_index(trap_request); // CP idx or -1 |
1479 jint unloaded_class_index = trap_request_index(trap_request); // CP idx or -1 |
1479 |
1480 |
1480 vframe* vf = vframe::new_vframe(&fr, ®_map, thread); |
1481 vframe* vf = vframe::new_vframe(&fr, ®_map, thread); |
1481 compiledVFrame* cvf = compiledVFrame::cast(vf); |
1482 compiledVFrame* cvf = compiledVFrame::cast(vf); |
1482 |
1483 |
1483 nmethod* nm = cvf->code(); |
1484 CompiledMethod* nm = cvf->code(); |
1484 |
1485 |
1485 ScopeDesc* trap_scope = cvf->scope(); |
1486 ScopeDesc* trap_scope = cvf->scope(); |
1486 |
1487 |
1487 if (TraceDeoptimization) { |
1488 if (TraceDeoptimization) { |
1488 ttyLocker ttyl; |
1489 ttyLocker ttyl; |
1497 int trap_bci = trap_scope->bci(); |
1498 int trap_bci = trap_scope->bci(); |
1498 #if INCLUDE_JVMCI |
1499 #if INCLUDE_JVMCI |
1499 oop speculation = thread->pending_failed_speculation(); |
1500 oop speculation = thread->pending_failed_speculation(); |
1500 if (nm->is_compiled_by_jvmci()) { |
1501 if (nm->is_compiled_by_jvmci()) { |
1501 if (speculation != NULL) { |
1502 if (speculation != NULL) { |
1502 oop speculation_log = nm->speculation_log(); |
1503 oop speculation_log = nm->as_nmethod()->speculation_log(); |
1503 if (speculation_log != NULL) { |
1504 if (speculation_log != NULL) { |
1504 if (TraceDeoptimization || TraceUncollectedSpeculations) { |
1505 if (TraceDeoptimization || TraceUncollectedSpeculations) { |
1505 if (HotSpotSpeculationLog::lastFailed(speculation_log) != NULL) { |
1506 if (HotSpotSpeculationLog::lastFailed(speculation_log) != NULL) { |
1506 tty->print_cr("A speculation that was not collected by the compiler is being overwritten"); |
1507 tty->print_cr("A speculation that was not collected by the compiler is being overwritten"); |
1507 } |
1508 } |
1613 if (TraceDeoptimization) { // make noise on the tty |
1614 if (TraceDeoptimization) { // make noise on the tty |
1614 tty->print("Uncommon trap occurred in"); |
1615 tty->print("Uncommon trap occurred in"); |
1615 nm->method()->print_short_name(tty); |
1616 nm->method()->print_short_name(tty); |
1616 tty->print(" compiler=%s compile_id=%d", nm->compiler() == NULL ? "" : nm->compiler()->name(), nm->compile_id()); |
1617 tty->print(" compiler=%s compile_id=%d", nm->compiler() == NULL ? "" : nm->compiler()->name(), nm->compile_id()); |
1617 #if INCLUDE_JVMCI |
1618 #if INCLUDE_JVMCI |
1618 oop installedCode = nm->jvmci_installed_code(); |
1619 if (nm->is_nmethod()) { |
1619 if (installedCode != NULL) { |
1620 oop installedCode = nm->as_nmethod()->jvmci_installed_code(); |
1620 oop installedCodeName = NULL; |
1621 if (installedCode != NULL) { |
1621 if (installedCode->is_a(InstalledCode::klass())) { |
1622 oop installedCodeName = NULL; |
1622 installedCodeName = InstalledCode::name(installedCode); |
1623 if (installedCode->is_a(InstalledCode::klass())) { |
|
1624 installedCodeName = InstalledCode::name(installedCode); |
|
1625 } |
|
1626 if (installedCodeName != NULL) { |
|
1627 tty->print(" (JVMCI: installedCodeName=%s) ", java_lang_String::as_utf8_string(installedCodeName)); |
|
1628 } else { |
|
1629 tty->print(" (JVMCI: installed code has no name) "); |
|
1630 } |
|
1631 } else if (nm->is_compiled_by_jvmci()) { |
|
1632 tty->print(" (JVMCI: no installed code) "); |
1623 } |
1633 } |
1624 if (installedCodeName != NULL) { |
|
1625 tty->print(" (JVMCI: installedCodeName=%s) ", java_lang_String::as_utf8_string(installedCodeName)); |
|
1626 } else { |
|
1627 tty->print(" (JVMCI: installed code has no name) "); |
|
1628 } |
|
1629 } else if (nm->is_compiled_by_jvmci()) { |
|
1630 tty->print(" (JVMCI: no installed code) "); |
|
1631 } |
1634 } |
1632 #endif |
1635 #endif |
1633 tty->print(" (@" INTPTR_FORMAT ") thread=" UINTX_FORMAT " reason=%s action=%s unloaded_class_index=%d" JVMCI_ONLY(" debug_id=%d"), |
1636 tty->print(" (@" INTPTR_FORMAT ") thread=" UINTX_FORMAT " reason=%s action=%s unloaded_class_index=%d" JVMCI_ONLY(" debug_id=%d"), |
1634 p2i(fr.pc()), |
1637 p2i(fr.pc()), |
1635 os::current_thread_id(), |
1638 os::current_thread_id(), |
1865 // Restart collecting RTM locking abort statistic if the method |
1868 // Restart collecting RTM locking abort statistic if the method |
1866 // is recompiled for a reason other than RTM state change. |
1869 // is recompiled for a reason other than RTM state change. |
1867 // Assume that in new recompiled code the statistic could be different, |
1870 // Assume that in new recompiled code the statistic could be different, |
1868 // for example, due to different inlining. |
1871 // for example, due to different inlining. |
1869 if ((reason != Reason_rtm_state_change) && (trap_mdo != NULL) && |
1872 if ((reason != Reason_rtm_state_change) && (trap_mdo != NULL) && |
1870 UseRTMDeopt && (nm->rtm_state() != ProfileRTM)) { |
1873 UseRTMDeopt && (nm->as_nmethod()->rtm_state() != ProfileRTM)) { |
1871 trap_mdo->atomic_set_rtm_state(ProfileRTM); |
1874 trap_mdo->atomic_set_rtm_state(ProfileRTM); |
1872 } |
1875 } |
1873 #endif |
1876 #endif |
1874 // For code aging we count traps separately here, using make_not_entrant() |
1877 // For code aging we count traps separately here, using make_not_entrant() |
1875 // as a guard against simultaneous deopts in multiple threads. |
1878 // as a guard against simultaneous deopts in multiple threads. |