< prev index next >

src/hotspot/share/runtime/sharedRuntime.cpp


1261   // make sure caller is not getting deoptimized                                                                                     
1262   // and removed before we are done with it.                                                                                         
1263   // CLEANUP - with lazy deopt shouldn't need this lock                                                                              
1264   nmethodLocker caller_lock(caller_nm);                                                                                              
1265 
1266   // determine call info & receiver                                                                                                  
1267   // note: a) receiver is NULL for static calls                                                                                      
1268   //       b) an exception is thrown if receiver is NULL for non-static calls                                                        
1269   CallInfo call_info;                                                                                                                
1270   Bytecodes::Code invoke_code = Bytecodes::_illegal;                                                                                 
1271   Handle receiver = find_callee_info(thread, invoke_code,                                                                            
1272                                      call_info, CHECK_(methodHandle()));                                                             
1273   methodHandle callee_method = call_info.selected_method();                                                                          
1274 
1275   assert((!is_virtual && invoke_code == Bytecodes::_invokestatic ) ||                                                                
1276          (!is_virtual && invoke_code == Bytecodes::_invokespecial) ||                                                                
1277          (!is_virtual && invoke_code == Bytecodes::_invokehandle ) ||                                                                
1278          (!is_virtual && invoke_code == Bytecodes::_invokedynamic) ||                                                                
1279          ( is_virtual && invoke_code != Bytecodes::_invokestatic ), "inconsistent bytecode");                                        
1280 
1281   assert(caller_nm->is_alive(), "It should be alive");                                                                               
1282 
1283 #ifndef PRODUCT                                                                                                                      
1284   // tracing/debugging/statistics                                                                                                    
1285   int *addr = (is_optimized) ? (&_resolve_opt_virtual_ctr) :                                                                         
1286                 (is_virtual) ? (&_resolve_virtual_ctr) :                                                                             
1287                                (&_resolve_static_ctr);                                                                               
1288   Atomic::inc(addr);                                                                                                                 
1289 
1290   if (TraceCallFixup) {                                                                                                              
1291     ResourceMark rm(thread);                                                                                                         
1292     tty->print("resolving %s%s (%s) call to",                                                                                        
1293       (is_optimized) ? "optimized " : "", (is_virtual) ? "virtual" : "static",                                                       
1294       Bytecodes::name(invoke_code));                                                                                                 
1295     callee_method->print_short_name(tty);                                                                                            
1296     tty->print_cr(" at pc: " INTPTR_FORMAT " to code: " INTPTR_FORMAT,                                                               
1297                   p2i(caller_frame.pc()), p2i(callee_method->code()));                                                               
1298   }                                                                                                                                  
1299 #endif                                                                                                                               
1300 

1261   // make sure caller is not getting deoptimized
1262   // and removed before we are done with it.
1263   // CLEANUP - with lazy deopt shouldn't need this lock
1264   nmethodLocker caller_lock(caller_nm);
1265 
1266   // determine call info & receiver
1267   // note: a) receiver is NULL for static calls
1268   //       b) an exception is thrown if receiver is NULL for non-static calls
1269   CallInfo call_info;
1270   Bytecodes::Code invoke_code = Bytecodes::_illegal;
1271   Handle receiver = find_callee_info(thread, invoke_code,
1272                                      call_info, CHECK_(methodHandle()));
1273   methodHandle callee_method = call_info.selected_method();
1274 
1275   assert((!is_virtual && invoke_code == Bytecodes::_invokestatic ) ||
1276          (!is_virtual && invoke_code == Bytecodes::_invokespecial) ||
1277          (!is_virtual && invoke_code == Bytecodes::_invokehandle ) ||
1278          (!is_virtual && invoke_code == Bytecodes::_invokedynamic) ||
1279          ( is_virtual && invoke_code != Bytecodes::_invokestatic ), "inconsistent bytecode");
1280 
1281   assert(caller_nm->is_alive() && !caller_nm->is_unloading(), "It should be alive");
1282 
1283 #ifndef PRODUCT
1284   // tracing/debugging/statistics
1285   int *addr = (is_optimized) ? (&_resolve_opt_virtual_ctr) :
1286                 (is_virtual) ? (&_resolve_virtual_ctr) :
1287                                (&_resolve_static_ctr);
1288   Atomic::inc(addr);
1289 
1290   if (TraceCallFixup) {
1291     ResourceMark rm(thread);
1292     tty->print("resolving %s%s (%s) call to",
1293       (is_optimized) ? "optimized " : "", (is_virtual) ? "virtual" : "static",
1294       Bytecodes::name(invoke_code));
1295     callee_method->print_short_name(tty);
1296     tty->print_cr(" at pc: " INTPTR_FORMAT " to code: " INTPTR_FORMAT,
1297                   p2i(caller_frame.pc()), p2i(callee_method->code()));
1298   }
1299 #endif
1300 

1588     RegisterMap reg_map(thread, false);                                                                                              
1589     frame caller_frame = thread->last_frame().sender(&reg_map);                                                                      
1590     CodeBlob* cb = caller_frame.cb();                                                                                                
1591     CompiledMethod* caller_nm = cb->as_compiled_method_or_null();                                                                    
1592     CompiledICLocker ml(caller_nm);                                                                                                  
1593 
1594     if (cb->is_compiled()) {                                                                                                         
1595       CompiledIC* inline_cache = CompiledIC_before(((CompiledMethod*)cb), caller_frame.pc());                                        
1596       bool should_be_mono = false;                                                                                                   
1597       if (inline_cache->is_optimized()) {                                                                                            
1598         if (TraceCallFixup) {                                                                                                        
1599           ResourceMark rm(thread);                                                                                                   
1600           tty->print("OPTIMIZED IC miss (%s) call to", Bytecodes::name(bc));                                                         
1601           callee_method->print_short_name(tty);                                                                                      
1602           tty->print_cr(" code: " INTPTR_FORMAT, p2i(callee_method->code()));                                                        
1603         }                                                                                                                            
1604         should_be_mono = true;                                                                                                       
1605       } else if (inline_cache->is_icholder_call()) {                                                                                 
1606         CompiledICHolder* ic_oop = inline_cache->cached_icholder();                                                                  
1607         if (ic_oop != NULL) {                                                                                                        
1608                                                                                                                                      
1609           if (receiver()->klass() == ic_oop->holder_klass()) {                                                                       
                                                                                                                                     
                                                                                                                                     
1610             // This isn't a real miss. We must have seen that compiled code                                                          
1611             // is now available and we want the call site converted to a                                                             
1612             // monomorphic compiled call site.                                                                                       
1613             // We can't assert for callee_method->code() != NULL because it                                                          
1614             // could have been deoptimized in the meantime                                                                           
1615             if (TraceCallFixup) {                                                                                                    
1616               ResourceMark rm(thread);                                                                                               
1617               tty->print("FALSE IC miss (%s) converting to compiled call to", Bytecodes::name(bc));                                  
1618               callee_method->print_short_name(tty);                                                                                  
1619               tty->print_cr(" code: " INTPTR_FORMAT, p2i(callee_method->code()));                                                    
1620             }                                                                                                                        
1621             should_be_mono = true;                                                                                                   
1622           }                                                                                                                          
1623         }                                                                                                                            
1624       }                                                                                                                              
1625 
1626       if (should_be_mono) {                                                                                                          
1627 
1628         // We have a path that was monomorphic but was going interpreted                                                             

1588     RegisterMap reg_map(thread, false);
1589     frame caller_frame = thread->last_frame().sender(&reg_map);
1590     CodeBlob* cb = caller_frame.cb();
1591     CompiledMethod* caller_nm = cb->as_compiled_method_or_null();
1592     CompiledICLocker ml(caller_nm);
1593 
1594     if (cb->is_compiled()) {
1595       CompiledIC* inline_cache = CompiledIC_before(((CompiledMethod*)cb), caller_frame.pc());
1596       bool should_be_mono = false;
1597       if (inline_cache->is_optimized()) {
1598         if (TraceCallFixup) {
1599           ResourceMark rm(thread);
1600           tty->print("OPTIMIZED IC miss (%s) call to", Bytecodes::name(bc));
1601           callee_method->print_short_name(tty);
1602           tty->print_cr(" code: " INTPTR_FORMAT, p2i(callee_method->code()));
1603         }
1604         should_be_mono = true;
1605       } else if (inline_cache->is_icholder_call()) {
1606         CompiledICHolder* ic_oop = inline_cache->cached_icholder();
1607         if (ic_oop != NULL) {
1608           if (!ic_oop->is_loader_alive()) {
1609             // Deferred IC cleaning due to concurrent class unloading
1610             inline_cache->set_to_clean();
1611           } else if (receiver()->klass() == ic_oop->holder_klass()) {
1612             // This isn't a real miss. We must have seen that compiled code
1613             // is now available and we want the call site converted to a
1614             // monomorphic compiled call site.
1615             // We can't assert for callee_method->code() != NULL because it
1616             // could have been deoptimized in the meantime
1617             if (TraceCallFixup) {
1618               ResourceMark rm(thread);
1619               tty->print("FALSE IC miss (%s) converting to compiled call to", Bytecodes::name(bc));
1620               callee_method->print_short_name(tty);
1621               tty->print_cr(" code: " INTPTR_FORMAT, p2i(callee_method->code()));
1622             }
1623             should_be_mono = true;
1624           }
1625         }
1626       }
1627 
1628       if (should_be_mono) {
1629 
1630         // We have a path that was monomorphic but was going interpreted
< prev index next >