236 if (objects != NULL) {
237 JRT_BLOCK
238 realloc_failures = realloc_objects(thread, &deoptee, &map, objects, THREAD);
239 JRT_END
240 bool skip_internal = (cm != NULL) && !cm->is_compiled_by_jvmci();
241 reassign_fields(&deoptee, &map, objects, realloc_failures, skip_internal);
242 #ifndef PRODUCT
243 if (TraceDeoptimization) {
244 ttyLocker ttyl;
245 tty->print_cr("REALLOC OBJECTS in thread " INTPTR_FORMAT, p2i(thread));
246 print_objects(objects, realloc_failures);
247 }
248 #endif
249 }
250 if (save_oop_result) {
251 // Restore result.
252 deoptee.set_saved_oop_result(&map, return_value());
253 }
254 #if !INCLUDE_JVMCI
255 }
256 if (EliminateLocks) {
257 #endif // INCLUDE_JVMCI
258 #ifndef PRODUCT
259 bool first = true;
260 #endif
261 for (int i = 0; i < chunk->length(); i++) {
262 compiledVFrame* cvf = chunk->at(i);
263 assert (cvf->scope() != NULL,"expect only compiled java frames");
264 GrowableArray<MonitorInfo*>* monitors = cvf->monitors();
265 if (monitors->is_nonempty()) {
266 relock_objects(monitors, thread, realloc_failures);
267 #ifndef PRODUCT
268 if (PrintDeoptimizationDetails) {
269 ttyLocker ttyl;
270 for (int j = 0; j < monitors->length(); j++) {
271 MonitorInfo* mi = monitors->at(j);
272 if (mi->eliminated()) {
273 if (first) {
274 first = false;
275 tty->print_cr("RELOCK OBJECTS in thread " INTPTR_FORMAT, p2i(thread));
276 }
277 if (mi->owner_is_scalar_replaced()) {
278 Klass* k = java_lang_Class::as_Klass(mi->owner_klass());
279 tty->print_cr(" failed reallocation for klass %s", k->external_name());
280 } else {
281 tty->print_cr(" object <" INTPTR_FORMAT "> locked", p2i(mi->owner()));
282 }
283 }
284 }
285 }
286 #endif // !PRODUCT
287 }
288 }
289 #if !INCLUDE_JVMCI
290 }
291 }
292 #endif // INCLUDE_JVMCI
293 #endif // COMPILER2_OR_JVMCI
294
295 ScopeDesc* trap_scope = chunk->at(0)->scope();
296 Handle exceptionObject;
297 if (trap_scope->rethrow_exception()) {
298 if (PrintDeoptimizationDetails) {
299 tty->print_cr("Exception to be rethrown in the interpreter for method %s::%s at bci %d", trap_scope->method()->method_holder()->name()->as_C_string(), trap_scope->method()->name()->as_C_string(), trap_scope->bci());
300 }
301 GrowableArray<ScopeValue*>* expressions = trap_scope->expressions();
302 guarantee(expressions != NULL && expressions->length() > 0, "must have exception to throw");
303 ScopeValue* topOfStack = expressions->top();
304 exceptionObject = StackValue::create_stack_value(&deoptee, &map, topOfStack)->get_obj();
305 guarantee(exceptionObject() != NULL, "exception oop can not be null");
306 }
307
308 // Ensure that no safepoint is taken after pointers have been stored
309 // in fields of rematerialized objects. If a safepoint occurs from here on
310 // out the java state residing in the vframeArray will be missed.
763 tty->print_cr(" %s (bci %d)", el->method()->name_and_sig_as_C_string(), el->bci());
764 }
765 cur_array->print_on_2(tty);
766 } // release tty lock before calling guarantee
767 guarantee(false, "wrong number of expression stack elements during deopt");
768 }
769 VerifyOopClosure verify;
770 iframe->oops_interpreted_do(&verify, &rm, false);
771 callee_size_of_parameters = mh->size_of_parameters();
772 callee_max_locals = mh->max_locals();
773 is_top_frame = false;
774 }
775 }
776 #endif /* !PRODUCT */
777
778
779 return bt;
780 JRT_END
781
782 class DeoptimizeMarkedTC : public ThreadClosure {
783 bool _in_handshake;
784 public:
785 DeoptimizeMarkedTC(bool in_handshake) : _in_handshake(in_handshake) {}
786 virtual void do_thread(Thread* thread) {
787 assert(thread->is_Java_thread(), "must be");
788 JavaThread* jt = (JavaThread*)thread;
789 jt->deoptimize_marked_methods(_in_handshake);
790 }
791 };
792
793 void Deoptimization::deoptimize_all_marked() {
794 ResourceMark rm;
795 DeoptimizationMarker dm;
796
797 if (SafepointSynchronize::is_at_safepoint()) {
798 DeoptimizeMarkedTC deopt(false);
799 // Make the dependent methods not entrant
800 CodeCache::make_marked_nmethods_not_entrant();
801 Threads::java_threads_do(&deopt);
802 } else {
803 // Make the dependent methods not entrant
804 {
805 MutexLocker mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
806 CodeCache::make_marked_nmethods_not_entrant();
807 }
808 DeoptimizeMarkedTC deopt(true);
809 Handshake::execute(&deopt);
810 }
811 }
812
813 Deoptimization::DeoptAction Deoptimization::_unloaded_action
814 = Deoptimization::Action_reinterpret;
815
816
817
818 #if INCLUDE_JVMCI || INCLUDE_AOT
819 template<typename CacheType>
820 class BoxCacheBase : public CHeapObj<mtCompiler> {
821 protected:
822 static InstanceKlass* find_cache_klass(Symbol* klass_name, TRAPS) {
823 ResourceMark rm;
824 char* klass_name_str = klass_name->as_C_string();
825 Klass* k = SystemDictionary::find(klass_name, Handle(), Handle(), THREAD);
826 guarantee(k != NULL, "%s must be loaded", klass_name_str);
827 InstanceKlass* ik = InstanceKlass::cast(k);
828 guarantee(ik->is_initialized(), "%s must be initialized", klass_name_str);
1431 bool found = false;
1432 while (!found && !sfs.is_done()) {
1433 frame* cur = sfs.current();
1434 sfs.next();
1435 found = cur->id() == fr.id();
1436 }
1437 assert(found, "frame to be deoptimized not found on target thread's stack");
1438 map = sfs.register_map();
1439 }
1440
1441 vframe* vf = vframe::new_vframe(&fr, map, thread);
1442 compiledVFrame* cvf = compiledVFrame::cast(vf);
1443 // Revoke monitors' biases in all scopes
1444 while (!cvf->is_top()) {
1445 collect_monitors(cvf, objects_to_revoke);
1446 cvf = compiledVFrame::cast(cvf->sender());
1447 }
1448 collect_monitors(cvf, objects_to_revoke);
1449 }
1450
1451 void Deoptimization::revoke_using_safepoint(JavaThread* thread, frame fr, RegisterMap* map) {
1452 if (!UseBiasedLocking) {
1453 return;
1454 }
1455 GrowableArray<Handle>* objects_to_revoke = new GrowableArray<Handle>();
1456 get_monitors_from_stack(objects_to_revoke, thread, fr, map);
1457
1458 if (SafepointSynchronize::is_at_safepoint()) {
1459 BiasedLocking::revoke_at_safepoint(objects_to_revoke);
1460 } else {
1461 BiasedLocking::revoke(objects_to_revoke, thread);
1462 }
1463 }
1464
1465 void Deoptimization::revoke_using_handshake(JavaThread* thread, frame fr, RegisterMap* map) {
1466 if (!UseBiasedLocking) {
1467 return;
1468 }
1469 GrowableArray<Handle>* objects_to_revoke = new GrowableArray<Handle>();
1470 get_monitors_from_stack(objects_to_revoke, thread, fr, map);
1471
1472 int len = objects_to_revoke->length();
1473 for (int i = 0; i < len; i++) {
1474 oop obj = (objects_to_revoke->at(i))();
1475 BiasedLocking::revoke_own_locks(objects_to_revoke->at(i), thread);
1476 assert(!obj->mark().has_bias_pattern(), "biases should be revoked by now");
1477 }
1478 }
1479
1480
1481 void Deoptimization::deoptimize_single_frame(JavaThread* thread, frame fr, Deoptimization::DeoptReason reason) {
1482 assert(fr.can_be_deoptimized(), "checking frame type");
1483
1484 gather_statistics(reason, Action_none, Bytecodes::_illegal);
1485
1488 assert(cm != NULL, "only compiled methods can deopt");
1489
1490 ttyLocker ttyl;
1491 xtty->begin_head("deoptimized thread='" UINTX_FORMAT "' reason='%s' pc='" INTPTR_FORMAT "'",(uintx)thread->osthread()->thread_id(), trap_reason_name(reason), p2i(fr.pc()));
1492 cm->log_identity(xtty);
1493 xtty->end_head();
1494 for (ScopeDesc* sd = cm->scope_desc_at(fr.pc()); ; sd = sd->sender()) {
1495 xtty->begin_elem("jvms bci='%d'", sd->bci());
1496 xtty->method(sd->method());
1497 xtty->end_elem();
1498 if (sd->is_top()) break;
1499 }
1500 xtty->tail("deoptimized");
1501 }
1502
1503 // Patch the compiled method so that when execution returns to it we will
1504 // deopt the execution state and return to the interpreter.
1505 fr.deoptimize(thread);
1506 }
1507
1508 void Deoptimization::deoptimize(JavaThread* thread, frame fr, RegisterMap *map, bool in_handshake) {
1509 deopt_thread(in_handshake, thread, fr, map, Reason_constraint);
1510 }
1511
1512 void Deoptimization::deoptimize(JavaThread* thread, frame fr, RegisterMap *map, DeoptReason reason) {
1513 deopt_thread(false, thread, fr, map, reason);
1514 }
1515
1516 void Deoptimization::deopt_thread(bool in_handshake, JavaThread* thread,
1517 frame fr, RegisterMap *map, DeoptReason reason) {
1518 // Deoptimize only if the frame comes from compile code.
1519 // Do not deoptimize the frame which is already patched
1520 // during the execution of the loops below.
1521 if (!fr.is_compiled_frame() || fr.is_deoptimized_frame()) {
1522 return;
1523 }
1524 ResourceMark rm;
1525 DeoptimizationMarker dm;
1526 if (UseBiasedLocking) {
1527 if (in_handshake) {
1528 revoke_using_handshake(thread, fr, map);
1529 } else {
1530 revoke_using_safepoint(thread, fr, map);
1531 }
1532 }
1533 deoptimize_single_frame(thread, fr, reason);
1534
1535 }
1536
1537 #if INCLUDE_JVMCI
1538 address Deoptimization::deoptimize_for_missing_exception_handler(CompiledMethod* cm) {
1539 // there is no exception handler for this pc => deoptimize
1540 cm->make_not_entrant();
1541
1542 // Use Deoptimization::deoptimize for all of its side-effects:
1543 // revoking biases of monitors, gathering traps statistics, logging...
1544 // it also patches the return pc but we do not care about that
1545 // since we return a continuation to the deopt_blob below.
1546 JavaThread* thread = JavaThread::current();
1547 RegisterMap reg_map(thread, UseBiasedLocking);
1548 frame runtime_frame = thread->last_frame();
1549 frame caller_frame = runtime_frame.sender(®_map);
1550 assert(caller_frame.cb()->as_compiled_method_or_null() == cm, "expect top frame compiled method");
1551 Deoptimization::deoptimize(thread, caller_frame, ®_map, Deoptimization::Reason_not_compiled_exception_handler);
1552
1553 MethodData* trap_mdo = get_method_data(thread, cm->method(), true);
1554 if (trap_mdo != NULL) {
1674
1675 // We need to update the map if we have biased locking.
1676 #if INCLUDE_JVMCI
1677 // JVMCI might need to get an exception from the stack, which in turn requires the register map to be valid
1678 RegisterMap reg_map(thread, true);
1679 #else
1680 RegisterMap reg_map(thread, UseBiasedLocking);
1681 #endif
1682 frame stub_frame = thread->last_frame();
1683 frame fr = stub_frame.sender(®_map);
1684 // Make sure the calling nmethod is not getting deoptimized and removed
1685 // before we are done with it.
1686 nmethodLocker nl(fr.pc());
1687
1688 // Log a message
1689 Events::log_deopt_message(thread, "Uncommon trap: trap_request=" PTR32_FORMAT " fr.pc=" INTPTR_FORMAT " relative=" INTPTR_FORMAT,
1690 trap_request, p2i(fr.pc()), fr.pc() - fr.cb()->code_begin());
1691
1692 {
1693 ResourceMark rm;
1694
1695 // Revoke biases of any monitors in the frame to ensure we can migrate them
1696 revoke_biases_of_monitors(thread, fr, ®_map);
1697
1698 DeoptReason reason = trap_request_reason(trap_request);
1699 DeoptAction action = trap_request_action(trap_request);
1700 #if INCLUDE_JVMCI
1701 int debug_id = trap_request_debug_id(trap_request);
1702 #endif
1703 jint unloaded_class_index = trap_request_index(trap_request); // CP idx or -1
1704
1705 vframe* vf = vframe::new_vframe(&fr, ®_map, thread);
1706 compiledVFrame* cvf = compiledVFrame::cast(vf);
1707
1708 CompiledMethod* nm = cvf->code();
1709
1710 ScopeDesc* trap_scope = cvf->scope();
1711
1712 if (TraceDeoptimization) {
1713 ttyLocker ttyl;
1714 tty->print_cr(" bci=%d pc=" INTPTR_FORMAT ", relative_pc=" INTPTR_FORMAT ", method=%s" JVMCI_ONLY(", debug_id=%d"), trap_scope->bci(), p2i(fr.pc()), fr.pc() - nm->code_begin(), trap_scope->method()->name_and_sig_as_C_string()
1715 #if INCLUDE_JVMCI
1716 , debug_id
|
236 if (objects != NULL) {
237 JRT_BLOCK
238 realloc_failures = realloc_objects(thread, &deoptee, &map, objects, THREAD);
239 JRT_END
240 bool skip_internal = (cm != NULL) && !cm->is_compiled_by_jvmci();
241 reassign_fields(&deoptee, &map, objects, realloc_failures, skip_internal);
242 #ifndef PRODUCT
243 if (TraceDeoptimization) {
244 ttyLocker ttyl;
245 tty->print_cr("REALLOC OBJECTS in thread " INTPTR_FORMAT, p2i(thread));
246 print_objects(objects, realloc_failures);
247 }
248 #endif
249 }
250 if (save_oop_result) {
251 // Restore result.
252 deoptee.set_saved_oop_result(&map, return_value());
253 }
254 #if !INCLUDE_JVMCI
255 }
256 // Revoke biases, done with in java state.
257 revoke_from_deopt_handler(thread, deoptee, &map);
258 if (EliminateLocks) {
259 #else
260 // Revoke biases, done with in java state.
261 revoke_from_deopt_handler(thread, deoptee, &map);
262 #endif // INCLUDE_JVMCI
263 #ifndef PRODUCT
264 bool first = true;
265 #endif
266 for (int i = 0; i < chunk->length(); i++) {
267 compiledVFrame* cvf = chunk->at(i);
268 assert (cvf->scope() != NULL,"expect only compiled java frames");
269 GrowableArray<MonitorInfo*>* monitors = cvf->monitors();
270 if (monitors->is_nonempty()) {
271 relock_objects(monitors, thread, realloc_failures);
272 #ifndef PRODUCT
273 if (PrintDeoptimizationDetails) {
274 ttyLocker ttyl;
275 for (int j = 0; j < monitors->length(); j++) {
276 MonitorInfo* mi = monitors->at(j);
277 if (mi->eliminated()) {
278 if (first) {
279 first = false;
280 tty->print_cr("RELOCK OBJECTS in thread " INTPTR_FORMAT, p2i(thread));
281 }
282 if (mi->owner_is_scalar_replaced()) {
283 Klass* k = java_lang_Class::as_Klass(mi->owner_klass());
284 tty->print_cr(" failed reallocation for klass %s", k->external_name());
285 } else {
286 tty->print_cr(" object <" INTPTR_FORMAT "> locked", p2i(mi->owner()));
287 }
288 }
289 }
290 }
291 #endif // !PRODUCT
292 }
293 }
294 #if !INCLUDE_JVMCI
295 }
296 } else {
297 // Revoke biases, done with in java state.
298 revoke_from_deopt_handler(thread, deoptee, &map);
299 }
300 #endif // INCLUDE_JVMCI
301 #endif // COMPILER2_OR_JVMCI
302
303 ScopeDesc* trap_scope = chunk->at(0)->scope();
304 Handle exceptionObject;
305 if (trap_scope->rethrow_exception()) {
306 if (PrintDeoptimizationDetails) {
307 tty->print_cr("Exception to be rethrown in the interpreter for method %s::%s at bci %d", trap_scope->method()->method_holder()->name()->as_C_string(), trap_scope->method()->name()->as_C_string(), trap_scope->bci());
308 }
309 GrowableArray<ScopeValue*>* expressions = trap_scope->expressions();
310 guarantee(expressions != NULL && expressions->length() > 0, "must have exception to throw");
311 ScopeValue* topOfStack = expressions->top();
312 exceptionObject = StackValue::create_stack_value(&deoptee, &map, topOfStack)->get_obj();
313 guarantee(exceptionObject() != NULL, "exception oop can not be null");
314 }
315
316 // Ensure that no safepoint is taken after pointers have been stored
317 // in fields of rematerialized objects. If a safepoint occurs from here on
318 // out the java state residing in the vframeArray will be missed.
771 tty->print_cr(" %s (bci %d)", el->method()->name_and_sig_as_C_string(), el->bci());
772 }
773 cur_array->print_on_2(tty);
774 } // release tty lock before calling guarantee
775 guarantee(false, "wrong number of expression stack elements during deopt");
776 }
777 VerifyOopClosure verify;
778 iframe->oops_interpreted_do(&verify, &rm, false);
779 callee_size_of_parameters = mh->size_of_parameters();
780 callee_max_locals = mh->max_locals();
781 is_top_frame = false;
782 }
783 }
784 #endif /* !PRODUCT */
785
786
787 return bt;
788 JRT_END
789
790 class DeoptimizeMarkedTC : public ThreadClosure {
791 public:
792 virtual void do_thread(Thread* thread) {
793 assert(thread->is_Java_thread(), "must be");
794 JavaThread* jt = (JavaThread*)thread;
795 jt->deoptimize_marked_methods();
796 }
797 };
798
799 void Deoptimization::deoptimize_all_marked() {
800 ResourceMark rm;
801 DeoptimizationMarker dm;
802
803 if (SafepointSynchronize::is_at_safepoint()) {
804 DeoptimizeMarkedTC deopt;
805 // Make the dependent methods not entrant
806 CodeCache::make_marked_nmethods_not_entrant();
807 Threads::java_threads_do(&deopt);
808 } else {
809 // Make the dependent methods not entrant
810 {
811 MutexLocker mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
812 CodeCache::make_marked_nmethods_not_entrant();
813 }
814 DeoptimizeMarkedTC deopt;
815 Handshake::execute(&deopt);
816 }
817 }
818
819 Deoptimization::DeoptAction Deoptimization::_unloaded_action
820 = Deoptimization::Action_reinterpret;
821
822
823
824 #if INCLUDE_JVMCI || INCLUDE_AOT
825 template<typename CacheType>
826 class BoxCacheBase : public CHeapObj<mtCompiler> {
827 protected:
828 static InstanceKlass* find_cache_klass(Symbol* klass_name, TRAPS) {
829 ResourceMark rm;
830 char* klass_name_str = klass_name->as_C_string();
831 Klass* k = SystemDictionary::find(klass_name, Handle(), Handle(), THREAD);
832 guarantee(k != NULL, "%s must be loaded", klass_name_str);
833 InstanceKlass* ik = InstanceKlass::cast(k);
834 guarantee(ik->is_initialized(), "%s must be initialized", klass_name_str);
1437 bool found = false;
1438 while (!found && !sfs.is_done()) {
1439 frame* cur = sfs.current();
1440 sfs.next();
1441 found = cur->id() == fr.id();
1442 }
1443 assert(found, "frame to be deoptimized not found on target thread's stack");
1444 map = sfs.register_map();
1445 }
1446
1447 vframe* vf = vframe::new_vframe(&fr, map, thread);
1448 compiledVFrame* cvf = compiledVFrame::cast(vf);
1449 // Revoke monitors' biases in all scopes
1450 while (!cvf->is_top()) {
1451 collect_monitors(cvf, objects_to_revoke);
1452 cvf = compiledVFrame::cast(cvf->sender());
1453 }
1454 collect_monitors(cvf, objects_to_revoke);
1455 }
1456
1457 void Deoptimization::revoke_from_deopt_handler(JavaThread* thread, frame fr, RegisterMap* map) {
1458 if (!UseBiasedLocking) {
1459 return;
1460 }
1461 GrowableArray<Handle>* objects_to_revoke = new GrowableArray<Handle>();
1462 get_monitors_from_stack(objects_to_revoke, thread, fr, map);
1463
1464 int len = objects_to_revoke->length();
1465 for (int i = 0; i < len; i++) {
1466 oop obj = (objects_to_revoke->at(i))();
1467 BiasedLocking::revoke_own_locks(objects_to_revoke->at(i), thread);
1468 assert(!obj->mark().has_bias_pattern(), "biases should be revoked by now");
1469 }
1470 }
1471
1472
1473 void Deoptimization::deoptimize_single_frame(JavaThread* thread, frame fr, Deoptimization::DeoptReason reason) {
1474 assert(fr.can_be_deoptimized(), "checking frame type");
1475
1476 gather_statistics(reason, Action_none, Bytecodes::_illegal);
1477
1480 assert(cm != NULL, "only compiled methods can deopt");
1481
1482 ttyLocker ttyl;
1483 xtty->begin_head("deoptimized thread='" UINTX_FORMAT "' reason='%s' pc='" INTPTR_FORMAT "'",(uintx)thread->osthread()->thread_id(), trap_reason_name(reason), p2i(fr.pc()));
1484 cm->log_identity(xtty);
1485 xtty->end_head();
1486 for (ScopeDesc* sd = cm->scope_desc_at(fr.pc()); ; sd = sd->sender()) {
1487 xtty->begin_elem("jvms bci='%d'", sd->bci());
1488 xtty->method(sd->method());
1489 xtty->end_elem();
1490 if (sd->is_top()) break;
1491 }
1492 xtty->tail("deoptimized");
1493 }
1494
1495 // Patch the compiled method so that when execution returns to it we will
1496 // deopt the execution state and return to the interpreter.
1497 fr.deoptimize(thread);
1498 }
1499
1500 void Deoptimization::deoptimize(JavaThread* thread, frame fr, RegisterMap *map, DeoptReason reason) {
1501 // Deoptimize only if the frame comes from compile code.
1502 // Do not deoptimize the frame which is already patched
1503 // during the execution of the loops below.
1504 if (!fr.is_compiled_frame() || fr.is_deoptimized_frame()) {
1505 return;
1506 }
1507 ResourceMark rm;
1508 DeoptimizationMarker dm;
1509 deoptimize_single_frame(thread, fr, reason);
1510 }
1511
1512 #if INCLUDE_JVMCI
1513 address Deoptimization::deoptimize_for_missing_exception_handler(CompiledMethod* cm) {
1514 // there is no exception handler for this pc => deoptimize
1515 cm->make_not_entrant();
1516
1517 // Use Deoptimization::deoptimize for all of its side-effects:
1518 // revoking biases of monitors, gathering traps statistics, logging...
1519 // it also patches the return pc but we do not care about that
1520 // since we return a continuation to the deopt_blob below.
1521 JavaThread* thread = JavaThread::current();
1522 RegisterMap reg_map(thread, UseBiasedLocking);
1523 frame runtime_frame = thread->last_frame();
1524 frame caller_frame = runtime_frame.sender(®_map);
1525 assert(caller_frame.cb()->as_compiled_method_or_null() == cm, "expect top frame compiled method");
1526 Deoptimization::deoptimize(thread, caller_frame, ®_map, Deoptimization::Reason_not_compiled_exception_handler);
1527
1528 MethodData* trap_mdo = get_method_data(thread, cm->method(), true);
1529 if (trap_mdo != NULL) {
1649
1650 // We need to update the map if we have biased locking.
1651 #if INCLUDE_JVMCI
1652 // JVMCI might need to get an exception from the stack, which in turn requires the register map to be valid
1653 RegisterMap reg_map(thread, true);
1654 #else
1655 RegisterMap reg_map(thread, UseBiasedLocking);
1656 #endif
1657 frame stub_frame = thread->last_frame();
1658 frame fr = stub_frame.sender(®_map);
1659 // Make sure the calling nmethod is not getting deoptimized and removed
1660 // before we are done with it.
1661 nmethodLocker nl(fr.pc());
1662
1663 // Log a message
1664 Events::log_deopt_message(thread, "Uncommon trap: trap_request=" PTR32_FORMAT " fr.pc=" INTPTR_FORMAT " relative=" INTPTR_FORMAT,
1665 trap_request, p2i(fr.pc()), fr.pc() - fr.cb()->code_begin());
1666
1667 {
1668 ResourceMark rm;
1669
1670 DeoptReason reason = trap_request_reason(trap_request);
1671 DeoptAction action = trap_request_action(trap_request);
1672 #if INCLUDE_JVMCI
1673 int debug_id = trap_request_debug_id(trap_request);
1674 #endif
1675 jint unloaded_class_index = trap_request_index(trap_request); // CP idx or -1
1676
1677 vframe* vf = vframe::new_vframe(&fr, ®_map, thread);
1678 compiledVFrame* cvf = compiledVFrame::cast(vf);
1679
1680 CompiledMethod* nm = cvf->code();
1681
1682 ScopeDesc* trap_scope = cvf->scope();
1683
1684 if (TraceDeoptimization) {
1685 ttyLocker ttyl;
1686 tty->print_cr(" bci=%d pc=" INTPTR_FORMAT ", relative_pc=" INTPTR_FORMAT ", method=%s" JVMCI_ONLY(", debug_id=%d"), trap_scope->bci(), p2i(fr.pc()), fr.pc() - nm->code_begin(), trap_scope->method()->name_and_sig_as_C_string()
1687 #if INCLUDE_JVMCI
1688 , debug_id
|