src/share/vm/opto/doCall.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File 6934604 Sdiff src/share/vm/opto

src/share/vm/opto/doCall.cpp

Print this page




 159         float site_invoke_ratio = prof_factor;
 160         // Note:  ilt is for the root of this parse, not the present call site.
 161         ilt = new InlineTree(this, jvms->method(), jvms->caller(), site_invoke_ratio, MaxInlineLevel);
 162       }
 163       WarmCallInfo scratch_ci;
 164       if (!UseOldInlining)
 165         scratch_ci.init(jvms, callee, profile, prof_factor);
 166       bool should_delay = false;
 167       WarmCallInfo* ci = ilt->ok_to_inline(callee, jvms, profile, &scratch_ci, should_delay);
 168       assert(ci != &scratch_ci, "do not let this pointer escape");
 169       bool allow_inline   = (ci != NULL && !ci->is_cold());
 170       bool require_inline = (allow_inline && ci->is_hot());
 171 
 172       if (allow_inline) {
 173         CallGenerator* cg = CallGenerator::for_inline(callee, expected_uses);
 174 
 175         if (require_inline && cg != NULL) {
 176           // Delay the inlining of this method to give us the
 177           // opportunity to perform some high level optimizations
 178           // first.
 179           if (should_delay_inlining(callee, jvms)) {
 180             assert(!delayed_forbidden, "strange");
 181             return CallGenerator::for_string_late_inline(callee, cg);



 182           } else if ((should_delay || AlwaysIncrementalInline) && !delayed_forbidden) {
 183             return CallGenerator::for_late_inline(callee, cg);
 184           }
 185         }
 186         if (cg == NULL || should_delay) {
 187           // Fall through.
 188         } else if (require_inline || !InlineWarmCalls) {
 189           return cg;
 190         } else {
 191           CallGenerator* cold_cg = call_generator(callee, vtable_index, call_does_dispatch, jvms, false, prof_factor);
 192           return CallGenerator::for_warm_call(ci, cold_cg, cg);
 193         }
 194       }
 195     }
 196 
 197     // Try using the type profile.
 198     if (call_does_dispatch && site_count > 0 && receiver_count > 0) {
 199       // The major receiver's count >= TypeProfileMajorReceiverPercent of site_count.
 200       bool have_major_receiver = (100.*profile.receiver_prob(0) >= (float)TypeProfileMajorReceiverPercent);
 201       ciMethod* receiver_method = NULL;


 259             }
 260           }
 261         }
 262       }
 263     }
 264   }
 265 
 266   // There was no special inlining tactic, or it bailed out.
 267   // Use a more generic tactic, like a simple call.
 268   if (call_does_dispatch) {
 269     return CallGenerator::for_virtual_call(callee, vtable_index);
 270   } else {
 271     // Class Hierarchy Analysis or Type Profile reveals a unique target,
 272     // or it is a static or special call.
 273     return CallGenerator::for_direct_call(callee, should_delay_inlining(callee, jvms));
 274   }
 275 }
 276 
 277 // Return true for methods that shouldn't be inlined early so that
 278 // they are easier to analyze and optimize as intrinsics.
 279 bool Compile::should_delay_inlining(ciMethod* call_method, JVMState* jvms) {
 280   if (has_stringbuilder()) {
 281 
 282     if ((call_method->holder() == C->env()->StringBuilder_klass() ||
 283          call_method->holder() == C->env()->StringBuffer_klass()) &&
 284         (jvms->method()->holder() == C->env()->StringBuilder_klass() ||
 285          jvms->method()->holder() == C->env()->StringBuffer_klass())) {
 286       // Delay SB calls only when called from non-SB code
 287       return false;
 288     }
 289 
 290     switch (call_method->intrinsic_id()) {
 291       case vmIntrinsics::_StringBuilder_void:
 292       case vmIntrinsics::_StringBuilder_int:
 293       case vmIntrinsics::_StringBuilder_String:
 294       case vmIntrinsics::_StringBuilder_append_char:
 295       case vmIntrinsics::_StringBuilder_append_int:
 296       case vmIntrinsics::_StringBuilder_append_String:
 297       case vmIntrinsics::_StringBuilder_toString:
 298       case vmIntrinsics::_StringBuffer_void:
 299       case vmIntrinsics::_StringBuffer_int:


 310           Node* receiver = jvms->map()->in(jvms->argoff() + 1);
 311           if (receiver->is_Proj() && receiver->in(0)->is_CallStaticJava()) {
 312             CallStaticJavaNode* csj = receiver->in(0)->as_CallStaticJava();
 313             ciMethod* m = csj->method();
 314             if (m != NULL &&
 315                 (m->intrinsic_id() == vmIntrinsics::_StringBuffer_toString ||
 316                  m->intrinsic_id() == vmIntrinsics::_StringBuilder_toString))
 317               // Delay String.<init>(new SB())
 318               return true;
 319           }
 320           return false;
 321         }
 322 
 323       default:
 324         return false;
 325     }
 326   }
 327   return false;
 328 }
 329 







 330 
 331 // uncommon-trap call-sites where callee is unloaded, uninitialized or will not link
 332 bool Parse::can_not_compile_call_site(ciMethod *dest_method, ciInstanceKlass* klass) {
 333   // Additional inputs to consider...
 334   // bc      = bc()
 335   // caller  = method()
 336   // iter().get_method_holder_index()
 337   assert( dest_method->is_loaded(), "ciTypeFlow should not let us get here" );
 338   // Interface classes can be loaded & linked and never get around to
 339   // being initialized.  Uncommon-trap for not-initialized static or
 340   // v-calls.  Let interface calls happen.
 341   ciInstanceKlass* holder_klass = dest_method->holder();
 342   if (!holder_klass->is_being_initialized() &&
 343       !holder_klass->is_initialized() &&
 344       !holder_klass->is_interface()) {
 345     uncommon_trap(Deoptimization::Reason_uninitialized,
 346                   Deoptimization::Action_reinterpret,
 347                   holder_klass);
 348     return true;
 349   }




 159         float site_invoke_ratio = prof_factor;
 160         // Note:  ilt is for the root of this parse, not the present call site.
 161         ilt = new InlineTree(this, jvms->method(), jvms->caller(), site_invoke_ratio, MaxInlineLevel);
 162       }
 163       WarmCallInfo scratch_ci;
 164       if (!UseOldInlining)
 165         scratch_ci.init(jvms, callee, profile, prof_factor);
 166       bool should_delay = false;
 167       WarmCallInfo* ci = ilt->ok_to_inline(callee, jvms, profile, &scratch_ci, should_delay);
 168       assert(ci != &scratch_ci, "do not let this pointer escape");
 169       bool allow_inline   = (ci != NULL && !ci->is_cold());
 170       bool require_inline = (allow_inline && ci->is_hot());
 171 
 172       if (allow_inline) {
 173         CallGenerator* cg = CallGenerator::for_inline(callee, expected_uses);
 174 
 175         if (require_inline && cg != NULL) {
 176           // Delay the inlining of this method to give us the
 177           // opportunity to perform some high level optimizations
 178           // first.
 179           if (should_delay_string_inlining(callee, jvms)) {
 180             assert(!delayed_forbidden, "strange");
 181             return CallGenerator::for_string_late_inline(callee, cg);
 182           } else if (should_delay_boxing_inlining(callee, jvms)) {
 183             assert(!delayed_forbidden, "strange");
 184             return CallGenerator::for_boxing_late_inline(callee, cg);
 185           } else if ((should_delay || AlwaysIncrementalInline) && !delayed_forbidden) {
 186             return CallGenerator::for_late_inline(callee, cg);
 187           }
 188         }
 189         if (cg == NULL || should_delay) {
 190           // Fall through.
 191         } else if (require_inline || !InlineWarmCalls) {
 192           return cg;
 193         } else {
 194           CallGenerator* cold_cg = call_generator(callee, vtable_index, call_does_dispatch, jvms, false, prof_factor);
 195           return CallGenerator::for_warm_call(ci, cold_cg, cg);
 196         }
 197       }
 198     }
 199 
 200     // Try using the type profile.
 201     if (call_does_dispatch && site_count > 0 && receiver_count > 0) {
 202       // The major receiver's count >= TypeProfileMajorReceiverPercent of site_count.
 203       bool have_major_receiver = (100.*profile.receiver_prob(0) >= (float)TypeProfileMajorReceiverPercent);
 204       ciMethod* receiver_method = NULL;


 262             }
 263           }
 264         }
 265       }
 266     }
 267   }
 268 
 269   // There was no special inlining tactic, or it bailed out.
 270   // Use a more generic tactic, like a simple call.
 271   if (call_does_dispatch) {
 272     return CallGenerator::for_virtual_call(callee, vtable_index);
 273   } else {
 274     // Class Hierarchy Analysis or Type Profile reveals a unique target,
 275     // or it is a static or special call.
 276     return CallGenerator::for_direct_call(callee, should_delay_inlining(callee, jvms));
 277   }
 278 }
 279 
 280 // Return true for methods that shouldn't be inlined early so that
 281 // they are easier to analyze and optimize as intrinsics.
 282 bool Compile::should_delay_string_inlining(ciMethod* call_method, JVMState* jvms) {
 283   if (has_stringbuilder()) {
 284 
 285     if ((call_method->holder() == C->env()->StringBuilder_klass() ||
 286          call_method->holder() == C->env()->StringBuffer_klass()) &&
 287         (jvms->method()->holder() == C->env()->StringBuilder_klass() ||
 288          jvms->method()->holder() == C->env()->StringBuffer_klass())) {
 289       // Delay SB calls only when called from non-SB code
 290       return false;
 291     }
 292 
 293     switch (call_method->intrinsic_id()) {
 294       case vmIntrinsics::_StringBuilder_void:
 295       case vmIntrinsics::_StringBuilder_int:
 296       case vmIntrinsics::_StringBuilder_String:
 297       case vmIntrinsics::_StringBuilder_append_char:
 298       case vmIntrinsics::_StringBuilder_append_int:
 299       case vmIntrinsics::_StringBuilder_append_String:
 300       case vmIntrinsics::_StringBuilder_toString:
 301       case vmIntrinsics::_StringBuffer_void:
 302       case vmIntrinsics::_StringBuffer_int:


 313           Node* receiver = jvms->map()->in(jvms->argoff() + 1);
 314           if (receiver->is_Proj() && receiver->in(0)->is_CallStaticJava()) {
 315             CallStaticJavaNode* csj = receiver->in(0)->as_CallStaticJava();
 316             ciMethod* m = csj->method();
 317             if (m != NULL &&
 318                 (m->intrinsic_id() == vmIntrinsics::_StringBuffer_toString ||
 319                  m->intrinsic_id() == vmIntrinsics::_StringBuilder_toString))
 320               // Delay String.<init>(new SB())
 321               return true;
 322           }
 323           return false;
 324         }
 325 
 326       default:
 327         return false;
 328     }
 329   }
 330   return false;
 331 }
 332 
 333 bool Compile::should_delay_boxing_inlining(ciMethod* call_method, JVMState* jvms) {
 334   if (eliminate_autobox() && call_method->is_boxing_method()) {
 335     set_has_boxed_value(true);
 336     return true;
 337   }
 338   return false;
 339 }
 340 
 341 // uncommon-trap call-sites where callee is unloaded, uninitialized or will not link
 342 bool Parse::can_not_compile_call_site(ciMethod *dest_method, ciInstanceKlass* klass) {
 343   // Additional inputs to consider...
 344   // bc      = bc()
 345   // caller  = method()
 346   // iter().get_method_holder_index()
 347   assert( dest_method->is_loaded(), "ciTypeFlow should not let us get here" );
 348   // Interface classes can be loaded & linked and never get around to
 349   // being initialized.  Uncommon-trap for not-initialized static or
 350   // v-calls.  Let interface calls happen.
 351   ciInstanceKlass* holder_klass = dest_method->holder();
 352   if (!holder_klass->is_being_initialized() &&
 353       !holder_klass->is_initialized() &&
 354       !holder_klass->is_interface()) {
 355     uncommon_trap(Deoptimization::Reason_uninitialized,
 356                   Deoptimization::Action_reinterpret,
 357                   holder_klass);
 358     return true;
 359   }


src/share/vm/opto/doCall.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File