7060619: C1 should respect inline and dontinline directives from CompilerOracle

Thu, 28 Jul 2011 13:03:39 -0700

author
never
date
Thu, 28 Jul 2011 13:03:39 -0700
changeset 3042
ce3e1d4dc416
parent 3041
d17bd0b18663
child 3043
c96c3eb1efae

7060619: C1 should respect inline and dontinline directives from CompilerOracle
Reviewed-by: kvn, iveresov

src/share/vm/c1/c1_GraphBuilder.cpp file | annotate | diff | comparison | revisions
     1.1 --- a/src/share/vm/c1/c1_GraphBuilder.cpp	Thu Jul 28 02:14:44 2011 -0700
     1.2 +++ b/src/share/vm/c1/c1_GraphBuilder.cpp	Thu Jul 28 13:03:39 2011 -0700
     1.3 @@ -3033,6 +3033,9 @@
     1.4    if (callee->should_exclude()) {
     1.5      // callee is excluded
     1.6      INLINE_BAILOUT("excluded by CompilerOracle")
     1.7 +  } else if (callee->should_not_inline()) {
     1.8 +    // callee is excluded
     1.9 +    INLINE_BAILOUT("disallowed by CompilerOracle")
    1.10    } else if (!callee->can_be_compiled()) {
    1.11      // callee is not compilable (prob. has breakpoints)
    1.12      INLINE_BAILOUT("not compilable")
    1.13 @@ -3410,24 +3413,6 @@
    1.14    // Proper inlining of methods with jsrs requires a little more work.
    1.15    if (callee->has_jsrs()                 ) INLINE_BAILOUT("jsrs not handled properly by inliner yet");
    1.16  
    1.17 -  // now perform tests that are based on flag settings
    1.18 -  if (inline_level() > MaxInlineLevel                         ) INLINE_BAILOUT("too-deep inlining");
    1.19 -  if (recursive_inline_level(callee) > MaxRecursiveInlineLevel) INLINE_BAILOUT("too-deep recursive inlining");
    1.20 -  if (callee->code_size() > max_inline_size()                 ) INLINE_BAILOUT("callee is too large");
    1.21 -
    1.22 -  // don't inline throwable methods unless the inlining tree is rooted in a throwable class
    1.23 -  if (callee->name() == ciSymbol::object_initializer_name() &&
    1.24 -      callee->holder()->is_subclass_of(ciEnv::current()->Throwable_klass())) {
    1.25 -    // Throwable constructor call
    1.26 -    IRScope* top = scope();
    1.27 -    while (top->caller() != NULL) {
    1.28 -      top = top->caller();
    1.29 -    }
    1.30 -    if (!top->method()->holder()->is_subclass_of(ciEnv::current()->Throwable_klass())) {
    1.31 -      INLINE_BAILOUT("don't inline Throwable constructors");
    1.32 -    }
    1.33 -  }
    1.34 -
    1.35    // When SSE2 is used on intel, then no special handling is needed
    1.36    // for strictfp because the enum-constant is fixed at compile time,
    1.37    // the check for UseSSE2 is needed here
    1.38 @@ -3435,13 +3420,36 @@
    1.39      INLINE_BAILOUT("caller and callee have different strict fp requirements");
    1.40    }
    1.41  
    1.42 -  if (compilation()->env()->num_inlined_bytecodes() > DesiredMethodLimit) {
    1.43 -    INLINE_BAILOUT("total inlining greater than DesiredMethodLimit");
    1.44 -  }
    1.45 -
    1.46    if (is_profiling() && !callee->ensure_method_data()) {
    1.47      INLINE_BAILOUT("mdo allocation failed");
    1.48    }
    1.49 +
    1.50 +  // now perform tests that are based on flag settings
    1.51 +  if (callee->should_inline()) {
    1.52 +    // ignore heuristic controls on inlining
    1.53 +  } else {
    1.54 +    if (inline_level() > MaxInlineLevel                         ) INLINE_BAILOUT("too-deep inlining");
    1.55 +    if (recursive_inline_level(callee) > MaxRecursiveInlineLevel) INLINE_BAILOUT("too-deep recursive inlining");
    1.56 +    if (callee->code_size() > max_inline_size()                 ) INLINE_BAILOUT("callee is too large");
    1.57 +
    1.58 +    // don't inline throwable methods unless the inlining tree is rooted in a throwable class
    1.59 +    if (callee->name() == ciSymbol::object_initializer_name() &&
    1.60 +        callee->holder()->is_subclass_of(ciEnv::current()->Throwable_klass())) {
    1.61 +      // Throwable constructor call
    1.62 +      IRScope* top = scope();
    1.63 +      while (top->caller() != NULL) {
    1.64 +        top = top->caller();
    1.65 +      }
    1.66 +      if (!top->method()->holder()->is_subclass_of(ciEnv::current()->Throwable_klass())) {
    1.67 +        INLINE_BAILOUT("don't inline Throwable constructors");
    1.68 +      }
    1.69 +    }
    1.70 +
    1.71 +    if (compilation()->env()->num_inlined_bytecodes() > DesiredMethodLimit) {
    1.72 +      INLINE_BAILOUT("total inlining greater than DesiredMethodLimit");
    1.73 +    }
    1.74 +  }
    1.75 +
    1.76  #ifndef PRODUCT
    1.77        // printing
    1.78    if (PrintInlining) {

mercurial