1485
1486 assert(mirror != NULL, "should null-check on mirror before calling");
1487 Klass* k = java_lang_Class::as_Klass(mirror);
1488 return (k != NULL && obj != NULL && obj->is_a(k)) ? 1 : 0;
1489 JRT_END
1490
1491 JRT_ENTRY(void, Runtime1::predicate_failed_trap(JavaThread* thread))
1492 ResourceMark rm;
1493
1494 assert(!TieredCompilation, "incompatible with tiered compilation");
1495
1496 RegisterMap reg_map(thread, false);
1497 frame runtime_frame = thread->last_frame();
1498 frame caller_frame = runtime_frame.sender(®_map);
1499
1500 nmethod* nm = CodeCache::find_nmethod(caller_frame.pc());
1501 assert (nm != NULL, "no more nmethod?");
1502 nm->make_not_entrant();
1503
1504 methodHandle m(nm->method());
1505 MethodData* mdo = m->method_data();
1506
1507 if (mdo == NULL && !HAS_PENDING_EXCEPTION) {
1508 // Build an MDO. Ignore errors like OutOfMemory;
1509 // that simply means we won't have an MDO to update.
1510 Method::build_interpreter_method_data(m, THREAD);
1511 if (HAS_PENDING_EXCEPTION) {
1512 assert((PENDING_EXCEPTION->is_a(SystemDictionary::OutOfMemoryError_klass())), "we expect only an OOM error here");
1513 CLEAR_PENDING_EXCEPTION;
1514 }
1515 mdo = m->method_data();
1516 }
1517
1518 if (mdo != NULL) {
1519 mdo->inc_trap_count(Deoptimization::Reason_none);
1520 }
1521
1522 if (TracePredicateFailedTraps) {
1523 stringStream ss1, ss2;
1524 vframeStream vfst(thread);
1525 methodHandle inlinee = methodHandle(vfst.method());
1526 inlinee->print_short_name(&ss1);
1527 m->print_short_name(&ss2);
1528 tty->print_cr("Predicate failed trap in method %s at bci %d inlined in %s at pc " INTPTR_FORMAT, ss1.as_string(), vfst.bci(), ss2.as_string(), p2i(caller_frame.pc()));
1529 }
1530
1531
1532 Deoptimization::deoptimize_frame(thread, caller_frame.id());
1533
1534 JRT_END
1535
1536 #ifndef PRODUCT
1537 void Runtime1::print_statistics() {
1538 tty->print_cr("C1 Runtime statistics:");
1539 tty->print_cr(" _resolve_invoke_virtual_cnt: %d", SharedRuntime::_resolve_virtual_ctr);
1540 tty->print_cr(" _resolve_invoke_opt_virtual_cnt: %d", SharedRuntime::_resolve_opt_virtual_ctr);
|
1485
1486 assert(mirror != NULL, "should null-check on mirror before calling");
1487 Klass* k = java_lang_Class::as_Klass(mirror);
1488 return (k != NULL && obj != NULL && obj->is_a(k)) ? 1 : 0;
1489 JRT_END
1490
1491 JRT_ENTRY(void, Runtime1::predicate_failed_trap(JavaThread* thread))
1492 ResourceMark rm;
1493
1494 assert(!TieredCompilation, "incompatible with tiered compilation");
1495
1496 RegisterMap reg_map(thread, false);
1497 frame runtime_frame = thread->last_frame();
1498 frame caller_frame = runtime_frame.sender(®_map);
1499
1500 nmethod* nm = CodeCache::find_nmethod(caller_frame.pc());
1501 assert (nm != NULL, "no more nmethod?");
1502 nm->make_not_entrant();
1503
1504 methodHandle m(nm->method());
1505 if (ProfileInterpreter) {
1506 MethodData* mdo = m->method_data();
1507
1508 if (mdo == NULL && !HAS_PENDING_EXCEPTION) {
1509 // Build an MDO. Ignore errors like OutOfMemory;
1510 // that simply means we won't have an MDO to update.
1511 Method::build_interpreter_method_data(m, THREAD);
1512 if (HAS_PENDING_EXCEPTION) {
1513 assert((PENDING_EXCEPTION->is_a(SystemDictionary::OutOfMemoryError_klass())), "we expect only an OOM error here");
1514 CLEAR_PENDING_EXCEPTION;
1515 }
1516 mdo = m->method_data();
1517 }
1518
1519 if (mdo != NULL) {
1520 mdo->inc_trap_count(Deoptimization::Reason_none);
1521 }
1522 }
1523
1524 if (TracePredicateFailedTraps) {
1525 stringStream ss1, ss2;
1526 vframeStream vfst(thread);
1527 methodHandle inlinee = methodHandle(vfst.method());
1528 inlinee->print_short_name(&ss1);
1529 m->print_short_name(&ss2);
1530 tty->print_cr("Predicate failed trap in method %s at bci %d inlined in %s at pc " INTPTR_FORMAT, ss1.as_string(), vfst.bci(), ss2.as_string(), p2i(caller_frame.pc()));
1531 }
1532
1533
1534 Deoptimization::deoptimize_frame(thread, caller_frame.id());
1535
1536 JRT_END
1537
1538 #ifndef PRODUCT
1539 void Runtime1::print_statistics() {
1540 tty->print_cr("C1 Runtime statistics:");
1541 tty->print_cr(" _resolve_invoke_virtual_cnt: %d", SharedRuntime::_resolve_virtual_ctr);
1542 tty->print_cr(" _resolve_invoke_opt_virtual_cnt: %d", SharedRuntime::_resolve_opt_virtual_ctr);
|