hotspot/src/share/vm/c1/c1_GraphBuilder.cpp
changeset 10257 c633d62a88dc
parent 10014 a5c2141ee857
child 10506 575ad9bccff5
equal deleted inserted replaced
10256:8a0a9bbb6fa5 10257:c633d62a88dc
  3031   clear_inline_bailout();
  3031   clear_inline_bailout();
  3032 
  3032 
  3033   if (callee->should_exclude()) {
  3033   if (callee->should_exclude()) {
  3034     // callee is excluded
  3034     // callee is excluded
  3035     INLINE_BAILOUT("excluded by CompilerOracle")
  3035     INLINE_BAILOUT("excluded by CompilerOracle")
       
  3036   } else if (callee->should_not_inline()) {
       
  3037     // callee is excluded
       
  3038     INLINE_BAILOUT("disallowed by CompilerOracle")
  3036   } else if (!callee->can_be_compiled()) {
  3039   } else if (!callee->can_be_compiled()) {
  3037     // callee is not compilable (prob. has breakpoints)
  3040     // callee is not compilable (prob. has breakpoints)
  3038     INLINE_BAILOUT("not compilable")
  3041     INLINE_BAILOUT("not compilable")
  3039   } else if (callee->intrinsic_id() != vmIntrinsics::_none && try_inline_intrinsics(callee)) {
  3042   } else if (callee->intrinsic_id() != vmIntrinsics::_none && try_inline_intrinsics(callee)) {
  3040     // intrinsics can be native or not
  3043     // intrinsics can be native or not
  3408   if (!callee->has_balanced_monitors())    INLINE_BAILOUT("callee's monitors do not match");
  3411   if (!callee->has_balanced_monitors())    INLINE_BAILOUT("callee's monitors do not match");
  3409 
  3412 
  3410   // Proper inlining of methods with jsrs requires a little more work.
  3413   // Proper inlining of methods with jsrs requires a little more work.
  3411   if (callee->has_jsrs()                 ) INLINE_BAILOUT("jsrs not handled properly by inliner yet");
  3414   if (callee->has_jsrs()                 ) INLINE_BAILOUT("jsrs not handled properly by inliner yet");
  3412 
  3415 
  3413   // now perform tests that are based on flag settings
       
  3414   if (inline_level() > MaxInlineLevel                         ) INLINE_BAILOUT("too-deep inlining");
       
  3415   if (recursive_inline_level(callee) > MaxRecursiveInlineLevel) INLINE_BAILOUT("too-deep recursive inlining");
       
  3416   if (callee->code_size() > max_inline_size()                 ) INLINE_BAILOUT("callee is too large");
       
  3417 
       
  3418   // don't inline throwable methods unless the inlining tree is rooted in a throwable class
       
  3419   if (callee->name() == ciSymbol::object_initializer_name() &&
       
  3420       callee->holder()->is_subclass_of(ciEnv::current()->Throwable_klass())) {
       
  3421     // Throwable constructor call
       
  3422     IRScope* top = scope();
       
  3423     while (top->caller() != NULL) {
       
  3424       top = top->caller();
       
  3425     }
       
  3426     if (!top->method()->holder()->is_subclass_of(ciEnv::current()->Throwable_klass())) {
       
  3427       INLINE_BAILOUT("don't inline Throwable constructors");
       
  3428     }
       
  3429   }
       
  3430 
       
  3431   // When SSE2 is used on intel, then no special handling is needed
  3416   // When SSE2 is used on intel, then no special handling is needed
  3432   // for strictfp because the enum-constant is fixed at compile time,
  3417   // for strictfp because the enum-constant is fixed at compile time,
  3433   // the check for UseSSE2 is needed here
  3418   // the check for UseSSE2 is needed here
  3434   if (strict_fp_requires_explicit_rounding && UseSSE < 2 && method()->is_strict() != callee->is_strict()) {
  3419   if (strict_fp_requires_explicit_rounding && UseSSE < 2 && method()->is_strict() != callee->is_strict()) {
  3435     INLINE_BAILOUT("caller and callee have different strict fp requirements");
  3420     INLINE_BAILOUT("caller and callee have different strict fp requirements");
  3436   }
  3421   }
  3437 
  3422 
  3438   if (compilation()->env()->num_inlined_bytecodes() > DesiredMethodLimit) {
       
  3439     INLINE_BAILOUT("total inlining greater than DesiredMethodLimit");
       
  3440   }
       
  3441 
       
  3442   if (is_profiling() && !callee->ensure_method_data()) {
  3423   if (is_profiling() && !callee->ensure_method_data()) {
  3443     INLINE_BAILOUT("mdo allocation failed");
  3424     INLINE_BAILOUT("mdo allocation failed");
  3444   }
  3425   }
       
  3426 
       
  3427   // now perform tests that are based on flag settings
       
  3428   if (callee->should_inline()) {
       
  3429     // ignore heuristic controls on inlining
       
  3430   } else {
       
  3431     if (inline_level() > MaxInlineLevel                         ) INLINE_BAILOUT("too-deep inlining");
       
  3432     if (recursive_inline_level(callee) > MaxRecursiveInlineLevel) INLINE_BAILOUT("too-deep recursive inlining");
       
  3433     if (callee->code_size() > max_inline_size()                 ) INLINE_BAILOUT("callee is too large");
       
  3434 
       
  3435     // don't inline throwable methods unless the inlining tree is rooted in a throwable class
       
  3436     if (callee->name() == ciSymbol::object_initializer_name() &&
       
  3437         callee->holder()->is_subclass_of(ciEnv::current()->Throwable_klass())) {
       
  3438       // Throwable constructor call
       
  3439       IRScope* top = scope();
       
  3440       while (top->caller() != NULL) {
       
  3441         top = top->caller();
       
  3442       }
       
  3443       if (!top->method()->holder()->is_subclass_of(ciEnv::current()->Throwable_klass())) {
       
  3444         INLINE_BAILOUT("don't inline Throwable constructors");
       
  3445       }
       
  3446     }
       
  3447 
       
  3448     if (compilation()->env()->num_inlined_bytecodes() > DesiredMethodLimit) {
       
  3449       INLINE_BAILOUT("total inlining greater than DesiredMethodLimit");
       
  3450     }
       
  3451   }
       
  3452 
  3445 #ifndef PRODUCT
  3453 #ifndef PRODUCT
  3446       // printing
  3454       // printing
  3447   if (PrintInlining) {
  3455   if (PrintInlining) {
  3448     print_inline_result(callee, true);
  3456     print_inline_result(callee, true);
  3449   }
  3457   }