# HG changeset patch # User vlivanov # Date 1384449279 28800 # Node ID e74074c343125000ec5c75871018f012783fbc12 # Parent 6e1826d5c23e2d604f1de1c870b15e56edbdcb13 8028159: C2: compiler stack overflow during inlining of @ForceInline methods Reviewed-by: roland, kvn diff -r 6e1826d5c23e -r e74074c34312 src/share/vm/c1/c1_globals.hpp --- a/src/share/vm/c1/c1_globals.hpp Wed Nov 13 13:45:50 2013 +0100 +++ b/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 diff -r 6e1826d5c23e -r e74074c34312 src/share/vm/opto/bytecodeInfo.cpp --- a/src/share/vm/opto/bytecodeInfo.cpp Wed Nov 13 13:45:50 2013 +0100 +++ b/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; diff -r 6e1826d5c23e -r e74074c34312 src/share/vm/opto/callGenerator.cpp --- a/src/share/vm/opto/callGenerator.cpp Wed Nov 13 13:45:50 2013 +0100 +++ b/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; } diff -r 6e1826d5c23e -r e74074c34312 src/share/vm/runtime/globals.hpp --- a/src/share/vm/runtime/globals.hpp Wed Nov 13 13:45:50 2013 +0100 +++ b/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") \