changeset 5243:c02c67eb03ae

8028159: C2: compiler stack overflow during inlining of @ForceInline methods Reviewed-by: kvn, sgabdura
author vkempik
date Wed, 24 Sep 2014 13:49:01 +0400
parents 96d116f870b0
children 40459e83f8c9
files src/share/vm/c1/c1_globals.hpp src/share/vm/opto/bytecodeInfo.cpp src/share/vm/opto/callGenerator.cpp src/share/vm/runtime/globals.hpp
diffstat 4 files changed, 9 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/vm/c1/c1_globals.hpp	Wed Sep 24 13:47:43 2014 +0400
+++ b/src/share/vm/c1/c1_globals.hpp	Wed Sep 24 13:49:01 2014 +0400
@@ -320,9 +320,6 @@
   develop(bool, PrintCFGToFile, false,                                      \
           "print control flow graph to a separate file during compilation") \
                                                                             \
-  develop(intx, MaxForceInlineLevel, 100,                                   \
-          "maximum number of nested @ForceInline calls that are inlined")   \
-                                                                            \
 
 
 // Read default values for c1 globals
--- a/src/share/vm/opto/bytecodeInfo.cpp	Wed Sep 24 13:47:43 2014 +0400
+++ b/src/share/vm/opto/bytecodeInfo.cpp	Wed Sep 24 13:49:01 2014 +0400
@@ -365,6 +365,10 @@
     return false;
   }
   if (inline_level() > _max_inline_level) {
+    if (callee_method->force_inline() && inline_level() > MaxForceInlineLevel) {
+      set_msg("MaxForceInlineLevel");
+      return false;
+    }
     if (!callee_method->force_inline() || !IncrementalInline) {
       set_msg("inlining too deep");
       return false;
--- a/src/share/vm/opto/callGenerator.cpp	Wed Sep 24 13:47:43 2014 +0400
+++ b/src/share/vm/opto/callGenerator.cpp	Wed Sep 24 13:49:01 2014 +0400
@@ -742,7 +742,7 @@
         guarantee(!target->is_method_handle_intrinsic(), "should not happen");  // XXX remove
         const int vtable_index = methodOopDesc::invalid_vtable_index;
         CallGenerator* cg = C->call_generator(target, vtable_index, false, jvms, true, PROB_ALWAYS, true, true);
-        assert(!cg->is_late_inline() || cg->is_mh_late_inline(), "no late inline here");
+        assert(cg == NULL || !cg->is_late_inline() || cg->is_mh_late_inline(), "no late inline here");
         if (cg != NULL && cg->is_inline())
           return cg;
       }
@@ -808,7 +808,7 @@
         }
 
         CallGenerator* cg = C->call_generator(target, vtable_index, call_does_dispatch, jvms, true, PROB_ALWAYS, true, true);
-        assert(!cg->is_late_inline() || cg->is_mh_late_inline(), "no late inline here");
+        assert(cg == NULL || !cg->is_late_inline() || cg->is_mh_late_inline(), "no late inline here");
         if (cg != NULL && cg->is_inline())
           return cg;
       }
--- a/src/share/vm/runtime/globals.hpp	Wed Sep 24 13:47:43 2014 +0400
+++ b/src/share/vm/runtime/globals.hpp	Wed Sep 24 13:49:01 2014 +0400
@@ -2864,6 +2864,9 @@
   product(intx, MaxRecursiveInlineLevel, 1,                                 \
           "maximum number of nested recursive calls that are inlined")      \
                                                                             \
+  develop(intx, MaxForceInlineLevel, 100,                                   \
+          "maximum number of nested @ForceInline calls that are inlined")   \
+                                                                            \
   product_pd(intx, InlineSmallCode,                                         \
           "Only inline already compiled methods if their code size is "     \
           "less than this")                                                 \