Thu, 14 Nov 2013 09:14:39 -0800
8028159: C2: compiler stack overflow during inlining of @ForceInline methods
Reviewed-by: roland, kvn
1.1 --- a/src/share/vm/c1/c1_globals.hpp Wed Nov 13 13:45:50 2013 +0100 1.2 +++ b/src/share/vm/c1/c1_globals.hpp Thu Nov 14 09:14:39 2013 -0800 1.3 @@ -341,9 +341,6 @@ 1.4 diagnostic(bool, C1PatchInvokeDynamic, true, \ 1.5 "Patch invokedynamic appendix not known at compile time") \ 1.6 \ 1.7 - develop(intx, MaxForceInlineLevel, 100, \ 1.8 - "maximum number of nested @ForceInline calls that are inlined") \ 1.9 - \ 1.10 1.11 1.12 // Read default values for c1 globals
2.1 --- a/src/share/vm/opto/bytecodeInfo.cpp Wed Nov 13 13:45:50 2013 +0100 2.2 +++ b/src/share/vm/opto/bytecodeInfo.cpp Thu Nov 14 09:14:39 2013 -0800 2.3 @@ -389,6 +389,10 @@ 2.4 return false; 2.5 } 2.6 if (inline_level() > _max_inline_level) { 2.7 + if (callee_method->force_inline() && inline_level() > MaxForceInlineLevel) { 2.8 + set_msg("MaxForceInlineLevel"); 2.9 + return false; 2.10 + } 2.11 if (!callee_method->force_inline() || !IncrementalInline) { 2.12 set_msg("inlining too deep"); 2.13 return false;
3.1 --- a/src/share/vm/opto/callGenerator.cpp Wed Nov 13 13:45:50 2013 +0100 3.2 +++ b/src/share/vm/opto/callGenerator.cpp Thu Nov 14 09:14:39 2013 -0800 3.3 @@ -776,7 +776,7 @@ 3.4 guarantee(!target->is_method_handle_intrinsic(), "should not happen"); // XXX remove 3.5 const int vtable_index = Method::invalid_vtable_index; 3.6 CallGenerator* cg = C->call_generator(target, vtable_index, false, jvms, true, PROB_ALWAYS, NULL, true, true); 3.7 - assert(!cg->is_late_inline() || cg->is_mh_late_inline(), "no late inline here"); 3.8 + assert(cg == NULL || !cg->is_late_inline() || cg->is_mh_late_inline(), "no late inline here"); 3.9 if (cg != NULL && cg->is_inline()) 3.10 return cg; 3.11 } 3.12 @@ -846,7 +846,7 @@ 3.13 } 3.14 3.15 CallGenerator* cg = C->call_generator(target, vtable_index, call_does_dispatch, jvms, true, PROB_ALWAYS, speculative_receiver_type, true, true); 3.16 - assert(!cg->is_late_inline() || cg->is_mh_late_inline(), "no late inline here"); 3.17 + assert(cg == NULL || !cg->is_late_inline() || cg->is_mh_late_inline(), "no late inline here"); 3.18 if (cg != NULL && cg->is_inline()) 3.19 return cg; 3.20 }
4.1 --- a/src/share/vm/runtime/globals.hpp Wed Nov 13 13:45:50 2013 +0100 4.2 +++ b/src/share/vm/runtime/globals.hpp Thu Nov 14 09:14:39 2013 -0800 4.3 @@ -2954,6 +2954,9 @@ 4.4 product(intx, MaxRecursiveInlineLevel, 1, \ 4.5 "maximum number of nested recursive calls that are inlined") \ 4.6 \ 4.7 + develop(intx, MaxForceInlineLevel, 100, \ 4.8 + "maximum number of nested @ForceInline calls that are inlined") \ 4.9 + \ 4.10 product_pd(intx, InlineSmallCode, \ 4.11 "Only inline already compiled methods if their code size is " \ 4.12 "less than this") \