Skip to content

Commit 6e563e5

Browse files
y1yang0Paul Hohensee
authored and
Paul Hohensee
committedNov 9, 2022
8159720: Failure of C2 compilation with tiered prevents some C1 compilations
If C2 fails to compile a method with tiered compilation, then it should mark the method as not compileable on the C2 tier only. Reviewed-by: phh Backport-of: cc10eca0b07f03d4765713d86eae39959f555c1f
1 parent 01f7d1e commit 6e563e5

File tree

4 files changed

+10
-14
lines changed

4 files changed

+10
-14
lines changed
 

‎hotspot/src/share/vm/opto/compile.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -791,7 +791,7 @@ Compile::Compile( ciEnv* ci_env, C2Compiler* compiler, ciMethod* target, int osr
791791
}
792792
if (failing()) return;
793793
if (cg == NULL) {
794-
record_method_not_compilable_all_tiers("cannot parse method");
794+
record_method_not_compilable("cannot parse method");
795795
return;
796796
}
797797
JVMState* jvms = build_start_state(start(), tf());

‎hotspot/src/share/vm/opto/compile.hpp

+3-7
Original file line numberDiff line numberDiff line change
@@ -733,16 +733,12 @@ class Compile : public Phase {
733733
bool failure_reason_is(const char* r) { return (r==_failure_reason) || (r!=NULL && _failure_reason!=NULL && strcmp(r, _failure_reason)==0); }
734734

735735
void record_failure(const char* reason);
736-
void record_method_not_compilable(const char* reason, bool all_tiers = false) {
737-
// All bailouts cover "all_tiers" when TieredCompilation is off.
738-
if (!TieredCompilation) all_tiers = true;
739-
env()->record_method_not_compilable(reason, all_tiers);
736+
void record_method_not_compilable(const char* reason) {
737+
// Bailouts cover "all_tiers" when TieredCompilation is off.
738+
env()->record_method_not_compilable(reason, !TieredCompilation);
740739
// Record failure reason.
741740
record_failure(reason);
742741
}
743-
void record_method_not_compilable_all_tiers(const char* reason) {
744-
record_method_not_compilable(reason, true);
745-
}
746742
bool check_node_count(uint margin, const char* reason) {
747743
if (live_nodes() + margin > max_node_limit()) {
748744
record_method_not_compilable(reason);

‎hotspot/src/share/vm/opto/matcher.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ OptoReg::Name Matcher::warp_incoming_stk_arg( VMReg reg ) {
137137
_in_arg_limit = OptoReg::add(warped, 1); // Bump max stack slot seen
138138
if (!RegMask::can_represent_arg(warped)) {
139139
// the compiler cannot represent this method's calling sequence
140-
C->record_method_not_compilable_all_tiers("unsupported incoming calling sequence");
140+
C->record_method_not_compilable("unsupported incoming calling sequence");
141141
return OptoReg::Bad;
142142
}
143143
return warped;
@@ -1139,7 +1139,7 @@ OptoReg::Name Matcher::warp_outgoing_stk_arg( VMReg reg, OptoReg::Name begin_out
11391139
if( warped >= out_arg_limit_per_call )
11401140
out_arg_limit_per_call = OptoReg::add(warped,1);
11411141
if (!RegMask::can_represent_arg(warped)) {
1142-
C->record_method_not_compilable_all_tiers("unsupported calling sequence");
1142+
C->record_method_not_compilable("unsupported calling sequence");
11431143
return OptoReg::Bad;
11441144
}
11451145
return warped;
@@ -1318,7 +1318,7 @@ MachNode *Matcher::match_sfpt( SafePointNode *sfpt ) {
13181318
uint r_cnt = mcall->tf()->range()->cnt();
13191319
MachProjNode *proj = new (C) MachProjNode( mcall, r_cnt+10000, RegMask::Empty, MachProjNode::fat_proj );
13201320
if (!RegMask::can_represent_arg(OptoReg::Name(out_arg_limit_per_call-1))) {
1321-
C->record_method_not_compilable_all_tiers("unsupported outgoing calling sequence");
1321+
C->record_method_not_compilable("unsupported outgoing calling sequence");
13221322
} else {
13231323
for (int i = begin_out_arg_area; i < out_arg_limit_per_call; i++)
13241324
proj->_rout.Insert(OptoReg::Name(i));
@@ -1506,7 +1506,7 @@ Node *Matcher::Label_Root( const Node *n, State *svec, Node *control, const Node
15061506
// out of stack space. See bugs 6272980 & 6227033 for more info.
15071507
LabelRootDepth++;
15081508
if (LabelRootDepth > MaxLabelRootDepth) {
1509-
C->record_method_not_compilable_all_tiers("Out of stack space, increase MaxLabelRootDepth");
1509+
C->record_method_not_compilable("Out of stack space, increase MaxLabelRootDepth");
15101510
return NULL;
15111511
}
15121512
uint care = 0; // Edges matcher cares about

‎hotspot/src/share/vm/opto/parse1.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,7 @@ Parse::Parse(JVMState* caller, ciMethod* parse_method, float expected_uses)
415415
_iter.reset_to_method(method());
416416
_flow = method()->get_flow_analysis();
417417
if (_flow->failing()) {
418-
C->record_method_not_compilable_all_tiers(_flow->failure_reason());
418+
C->record_method_not_compilable(_flow->failure_reason());
419419
}
420420

421421
#ifndef PRODUCT
@@ -1080,7 +1080,7 @@ SafePointNode* Parse::create_entry_map() {
10801080
// Check for really stupid bail-out cases.
10811081
uint len = TypeFunc::Parms + method()->max_locals() + method()->max_stack();
10821082
if (len >= 32760) {
1083-
C->record_method_not_compilable_all_tiers("too many local variables");
1083+
C->record_method_not_compilable("too many local variables");
10841084
return NULL;
10851085
}
10861086

0 commit comments

Comments
 (0)
Please sign in to comment.