提交 262bc1e1 编写于 作者: V vlivanov

8028159: C2: compiler stack overflow during inlining of @ForceInline methods

Reviewed-by: roland, kvn
上级 2c557adb
...@@ -341,9 +341,6 @@ ...@@ -341,9 +341,6 @@
diagnostic(bool, C1PatchInvokeDynamic, true, \ diagnostic(bool, C1PatchInvokeDynamic, true, \
"Patch invokedynamic appendix not known at compile time") \ "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 // Read default values for c1 globals
......
...@@ -389,6 +389,10 @@ bool InlineTree::try_to_inline(ciMethod* callee_method, ciMethod* caller_method, ...@@ -389,6 +389,10 @@ bool InlineTree::try_to_inline(ciMethod* callee_method, ciMethod* caller_method,
return false; return false;
} }
if (inline_level() > _max_inline_level) { 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) { if (!callee_method->force_inline() || !IncrementalInline) {
set_msg("inlining too deep"); set_msg("inlining too deep");
return false; return false;
......
...@@ -776,7 +776,7 @@ CallGenerator* CallGenerator::for_method_handle_inline(JVMState* jvms, ciMethod* ...@@ -776,7 +776,7 @@ CallGenerator* CallGenerator::for_method_handle_inline(JVMState* jvms, ciMethod*
guarantee(!target->is_method_handle_intrinsic(), "should not happen"); // XXX remove guarantee(!target->is_method_handle_intrinsic(), "should not happen"); // XXX remove
const int vtable_index = Method::invalid_vtable_index; const int vtable_index = Method::invalid_vtable_index;
CallGenerator* cg = C->call_generator(target, vtable_index, false, jvms, true, PROB_ALWAYS, NULL, true, true); 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()) if (cg != NULL && cg->is_inline())
return cg; return cg;
} }
...@@ -846,7 +846,7 @@ CallGenerator* CallGenerator::for_method_handle_inline(JVMState* jvms, ciMethod* ...@@ -846,7 +846,7 @@ CallGenerator* CallGenerator::for_method_handle_inline(JVMState* jvms, ciMethod*
} }
CallGenerator* cg = C->call_generator(target, vtable_index, call_does_dispatch, jvms, true, PROB_ALWAYS, speculative_receiver_type, true, true); 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()) if (cg != NULL && cg->is_inline())
return cg; return cg;
} }
......
...@@ -2954,6 +2954,9 @@ class CommandLineFlags { ...@@ -2954,6 +2954,9 @@ class CommandLineFlags {
product(intx, MaxRecursiveInlineLevel, 1, \ product(intx, MaxRecursiveInlineLevel, 1, \
"maximum number of nested recursive calls that are inlined") \ "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, \ product_pd(intx, InlineSmallCode, \
"Only inline already compiled methods if their code size is " \ "Only inline already compiled methods if their code size is " \
"less than this") \ "less than this") \
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册