From 717ae5f43045b1e2d6f95c52fbd81c54ebf50977 Mon Sep 17 00:00:00 2001 Date: Fri, 16 Sep 2022 01:12:20 +0000 Subject: 8159720: Failure of C2 compilation with tiered prevents some C1 compilations. --- hotspot/src/share/vm/opto/compile.cpp | 2 +- hotspot/src/share/vm/opto/compile.hpp | 10 +++------- hotspot/src/share/vm/opto/matcher.cpp | 8 ++++---- hotspot/src/share/vm/opto/parse1.cpp | 4 ++-- 4 files changed, 10 insertions(+), 14 deletions(-) diff --git a/hotspot/src/share/vm/opto/compile.cpp b/hotspot/src/share/vm/opto/compile.cpp index 5a42422e1..4a32e8a9f 100644 --- a/hotspot/src/share/vm/opto/compile.cpp +++ b/hotspot/src/share/vm/opto/compile.cpp @@ -791,7 +791,7 @@ Compile::Compile( ciEnv* ci_env, C2Compiler* compiler, ciMethod* target, int osr } if (failing()) return; if (cg == NULL) { - record_method_not_compilable_all_tiers("cannot parse method"); + record_method_not_compilable("cannot parse method"); return; } JVMState* jvms = build_start_state(start(), tf()); diff --git a/hotspot/src/share/vm/opto/compile.hpp b/hotspot/src/share/vm/opto/compile.hpp index 1150fd549..fb12b6874 100644 --- a/hotspot/src/share/vm/opto/compile.hpp +++ b/hotspot/src/share/vm/opto/compile.hpp @@ -742,16 +742,12 @@ class Compile : public Phase { bool failure_reason_is(const char* r) { return (r==_failure_reason) || (r!=NULL && _failure_reason!=NULL && strcmp(r, _failure_reason)==0); } void record_failure(const char* reason); - void record_method_not_compilable(const char* reason, bool all_tiers = false) { - // All bailouts cover "all_tiers" when TieredCompilation is off. - if (!TieredCompilation) all_tiers = true; - env()->record_method_not_compilable(reason, all_tiers); + void record_method_not_compilable(const char* reason) { + // Bailouts cover "all_tiers" when TieredCompilation is off. + env()->record_method_not_compilable(reason, !TieredCompilation); // Record failure reason. record_failure(reason); } - void record_method_not_compilable_all_tiers(const char* reason) { - record_method_not_compilable(reason, true); - } bool check_node_count(uint margin, const char* reason) { if (live_nodes() + margin > max_node_limit()) { record_method_not_compilable(reason); diff --git a/hotspot/src/share/vm/opto/matcher.cpp b/hotspot/src/share/vm/opto/matcher.cpp index 07b8ee4c6..b26015ce6 100644 --- a/hotspot/src/share/vm/opto/matcher.cpp +++ b/hotspot/src/share/vm/opto/matcher.cpp @@ -137,7 +137,7 @@ OptoReg::Name Matcher::warp_incoming_stk_arg( VMReg reg ) { _in_arg_limit = OptoReg::add(warped, 1); // Bump max stack slot seen if (!RegMask::can_represent_arg(warped)) { // the compiler cannot represent this method's calling sequence - C->record_method_not_compilable_all_tiers("unsupported incoming calling sequence"); + C->record_method_not_compilable("unsupported incoming calling sequence"); return OptoReg::Bad; } return warped; @@ -1148,7 +1148,7 @@ OptoReg::Name Matcher::warp_outgoing_stk_arg( VMReg reg, OptoReg::Name begin_out if( warped >= out_arg_limit_per_call ) out_arg_limit_per_call = OptoReg::add(warped,1); if (!RegMask::can_represent_arg(warped)) { - C->record_method_not_compilable_all_tiers("unsupported calling sequence"); + C->record_method_not_compilable("unsupported calling sequence"); return OptoReg::Bad; } return warped; @@ -1327,7 +1327,7 @@ MachNode *Matcher::match_sfpt( SafePointNode *sfpt ) { uint r_cnt = mcall->tf()->range()->cnt(); MachProjNode *proj = new (C) MachProjNode( mcall, r_cnt+10000, RegMask::Empty, MachProjNode::fat_proj ); if (!RegMask::can_represent_arg(OptoReg::Name(out_arg_limit_per_call-1))) { - C->record_method_not_compilable_all_tiers("unsupported outgoing calling sequence"); + C->record_method_not_compilable("unsupported outgoing calling sequence"); } else { for (int i = begin_out_arg_area; i < out_arg_limit_per_call; i++) proj->_rout.Insert(OptoReg::Name(i)); @@ -1515,7 +1515,7 @@ Node *Matcher::Label_Root( const Node *n, State *svec, Node *control, const Node // out of stack space. See bugs 6272980 & 6227033 for more info. LabelRootDepth++; if (LabelRootDepth > MaxLabelRootDepth) { - C->record_method_not_compilable_all_tiers("Out of stack space, increase MaxLabelRootDepth"); + C->record_method_not_compilable("Out of stack space, increase MaxLabelRootDepth"); return NULL; } uint care = 0; // Edges matcher cares about diff --git a/hotspot/src/share/vm/opto/parse1.cpp b/hotspot/src/share/vm/opto/parse1.cpp index a9ef4f910..4fcd58cb4 100644 --- a/hotspot/src/share/vm/opto/parse1.cpp +++ b/hotspot/src/share/vm/opto/parse1.cpp @@ -415,7 +415,7 @@ Parse::Parse(JVMState* caller, ciMethod* parse_method, float expected_uses) _iter.reset_to_method(method()); _flow = method()->get_flow_analysis(); if (_flow->failing()) { - C->record_method_not_compilable_all_tiers(_flow->failure_reason()); + C->record_method_not_compilable(_flow->failure_reason()); } #ifndef PRODUCT @@ -1088,7 +1088,7 @@ SafePointNode* Parse::create_entry_map() { // Check for really stupid bail-out cases. uint len = TypeFunc::Parms + method()->max_locals() + method()->max_stack(); if (len >= 32760) { - C->record_method_not_compilable_all_tiers("too many local variables"); + C->record_method_not_compilable("too many local variables"); return NULL; } -- 2.18.0.huawei.25