8028159: C2: compiler stack overflow during inlining of @ForceInline methods
Reviewed-by: roland, kvn
--- a/hotspot/src/share/vm/c1/c1_globals.hpp Wed Nov 13 13:45:50 2013 +0100
+++ b/hotspot/src/share/vm/c1/c1_globals.hpp Thu Nov 14 09:14:39 2013 -0800
@@ -341,9 +341,6 @@
diagnostic(bool, C1PatchInvokeDynamic, true, \
"Patch invokedynamic appendix not known at compile time") \
\
- develop(intx, MaxForceInlineLevel, 100, \
- "maximum number of nested @ForceInline calls that are inlined") \
- \
// Read default values for c1 globals
--- a/hotspot/src/share/vm/opto/bytecodeInfo.cpp Wed Nov 13 13:45:50 2013 +0100
+++ b/hotspot/src/share/vm/opto/bytecodeInfo.cpp Thu Nov 14 09:14:39 2013 -0800
@@ -389,6 +389,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/hotspot/src/share/vm/opto/callGenerator.cpp Wed Nov 13 13:45:50 2013 +0100
+++ b/hotspot/src/share/vm/opto/callGenerator.cpp Thu Nov 14 09:14:39 2013 -0800
@@ -776,7 +776,7 @@
guarantee(!target->is_method_handle_intrinsic(), "should not happen"); // XXX remove
const int vtable_index = Method::invalid_vtable_index;
CallGenerator* cg = C->call_generator(target, vtable_index, false, jvms, true, PROB_ALWAYS, NULL, 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;
}
@@ -846,7 +846,7 @@
}
CallGenerator* cg = C->call_generator(target, vtable_index, call_does_dispatch, jvms, true, PROB_ALWAYS, speculative_receiver_type, 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/hotspot/src/share/vm/runtime/globals.hpp Wed Nov 13 13:45:50 2013 +0100
+++ b/hotspot/src/share/vm/runtime/globals.hpp Thu Nov 14 09:14:39 2013 -0800
@@ -2954,6 +2954,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") \