< prev index next >

src/hotspot/share/c1/c1_Runtime1.cpp

Print this page




1405   // the return value as a boolean true.
1406 
1407   assert(mirror != NULL, "should null-check on mirror before calling");
1408   Klass* k = java_lang_Class::as_Klass(mirror);
1409   return (k != NULL && obj != NULL && obj->is_a(k)) ? 1 : 0;
1410 JRT_END
1411 
1412 JRT_ENTRY(void, Runtime1::predicate_failed_trap(JavaThread* thread))
1413   ResourceMark rm;
1414 
1415   assert(!TieredCompilation, "incompatible with tiered compilation");
1416 
1417   RegisterMap reg_map(thread, false);
1418   frame runtime_frame = thread->last_frame();
1419   frame caller_frame = runtime_frame.sender(&reg_map);
1420 
1421   nmethod* nm = CodeCache::find_nmethod(caller_frame.pc());
1422   assert (nm != NULL, "no more nmethod?");
1423   nm->make_not_entrant();
1424 
1425   methodHandle m(nm->method());
1426   MethodData* mdo = m->method_data();
1427 
1428   if (mdo == NULL && !HAS_PENDING_EXCEPTION) {
1429     // Build an MDO.  Ignore errors like OutOfMemory;
1430     // that simply means we won't have an MDO to update.
1431     Method::build_interpreter_method_data(m, THREAD);
1432     if (HAS_PENDING_EXCEPTION) {
1433       assert((PENDING_EXCEPTION->is_a(SystemDictionary::OutOfMemoryError_klass())), "we expect only an OOM error here");
1434       CLEAR_PENDING_EXCEPTION;
1435     }
1436     mdo = m->method_data();
1437   }
1438 
1439   if (mdo != NULL) {
1440     mdo->inc_trap_count(Deoptimization::Reason_none);
1441   }
1442 
1443   if (TracePredicateFailedTraps) {
1444     stringStream ss1, ss2;
1445     vframeStream vfst(thread);
1446     methodHandle inlinee = methodHandle(vfst.method());
1447     inlinee->print_short_name(&ss1);
1448     m->print_short_name(&ss2);
1449     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()));
1450   }
1451 
1452 
1453   Deoptimization::deoptimize_frame(thread, caller_frame.id());
1454 
1455 JRT_END
1456 
1457 #ifndef PRODUCT
1458 void Runtime1::print_statistics() {
1459   tty->print_cr("C1 Runtime statistics:");
1460   tty->print_cr(" _resolve_invoke_virtual_cnt:     %d", SharedRuntime::_resolve_virtual_ctr);
1461   tty->print_cr(" _resolve_invoke_opt_virtual_cnt: %d", SharedRuntime::_resolve_opt_virtual_ctr);
1462   tty->print_cr(" _resolve_invoke_static_cnt:      %d", SharedRuntime::_resolve_static_ctr);
1463   tty->print_cr(" _handle_wrong_method_cnt:        %d", SharedRuntime::_wrong_method_ctr);
1464   tty->print_cr(" _ic_miss_cnt:                    %d", SharedRuntime::_ic_miss_ctr);
1465   tty->print_cr(" _generic_arraycopy_cnt:          %d", _generic_arraycopy_cnt);
1466   tty->print_cr(" _generic_arraycopystub_cnt:      %d", _generic_arraycopystub_cnt);




1405   // the return value as a boolean true.
1406 
1407   assert(mirror != NULL, "should null-check on mirror before calling");
1408   Klass* k = java_lang_Class::as_Klass(mirror);
1409   return (k != NULL && obj != NULL && obj->is_a(k)) ? 1 : 0;
1410 JRT_END
1411 
1412 JRT_ENTRY(void, Runtime1::predicate_failed_trap(JavaThread* thread))
1413   ResourceMark rm;
1414 
1415   assert(!TieredCompilation, "incompatible with tiered compilation");
1416 
1417   RegisterMap reg_map(thread, false);
1418   frame runtime_frame = thread->last_frame();
1419   frame caller_frame = runtime_frame.sender(&reg_map);
1420 
1421   nmethod* nm = CodeCache::find_nmethod(caller_frame.pc());
1422   assert (nm != NULL, "no more nmethod?");
1423   nm->make_not_entrant();
1424 
1425   methodHandle m(thread, nm->method());
1426   MethodData* mdo = m->method_data();
1427 
1428   if (mdo == NULL && !HAS_PENDING_EXCEPTION) {
1429     // Build an MDO.  Ignore errors like OutOfMemory;
1430     // that simply means we won't have an MDO to update.
1431     Method::build_interpreter_method_data(m, THREAD);
1432     if (HAS_PENDING_EXCEPTION) {
1433       assert((PENDING_EXCEPTION->is_a(SystemDictionary::OutOfMemoryError_klass())), "we expect only an OOM error here");
1434       CLEAR_PENDING_EXCEPTION;
1435     }
1436     mdo = m->method_data();
1437   }
1438 
1439   if (mdo != NULL) {
1440     mdo->inc_trap_count(Deoptimization::Reason_none);
1441   }
1442 
1443   if (TracePredicateFailedTraps) {
1444     stringStream ss1, ss2;
1445     vframeStream vfst(thread);
1446     Method* inlinee = vfst.method();
1447     inlinee->print_short_name(&ss1);
1448     m->print_short_name(&ss2);
1449     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()));
1450   }
1451 
1452 
1453   Deoptimization::deoptimize_frame(thread, caller_frame.id());
1454 
1455 JRT_END
1456 
1457 #ifndef PRODUCT
1458 void Runtime1::print_statistics() {
1459   tty->print_cr("C1 Runtime statistics:");
1460   tty->print_cr(" _resolve_invoke_virtual_cnt:     %d", SharedRuntime::_resolve_virtual_ctr);
1461   tty->print_cr(" _resolve_invoke_opt_virtual_cnt: %d", SharedRuntime::_resolve_opt_virtual_ctr);
1462   tty->print_cr(" _resolve_invoke_static_cnt:      %d", SharedRuntime::_resolve_static_ctr);
1463   tty->print_cr(" _handle_wrong_method_cnt:        %d", SharedRuntime::_wrong_method_ctr);
1464   tty->print_cr(" _ic_miss_cnt:                    %d", SharedRuntime::_ic_miss_ctr);
1465   tty->print_cr(" _generic_arraycopy_cnt:          %d", _generic_arraycopy_cnt);
1466   tty->print_cr(" _generic_arraycopystub_cnt:      %d", _generic_arraycopystub_cnt);


< prev index next >