Skip to content

Commit

Permalink
8159720: Failure of C2 compilation with tiered prevents some C1 compi…
Browse files Browse the repository at this point in the history
…lations

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
  • Loading branch information
y1yang0 authored and Paul Hohensee committed Nov 9, 2022
1 parent 01f7d1e commit 6e563e5
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 14 deletions.
2 changes: 1 addition & 1 deletion hotspot/src/share/vm/opto/compile.cpp
Expand Up @@ -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());
Expand Down
10 changes: 3 additions & 7 deletions hotspot/src/share/vm/opto/compile.hpp
Expand Up @@ -733,16 +733,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);
Expand Down
8 changes: 4 additions & 4 deletions hotspot/src/share/vm/opto/matcher.cpp
Expand Up @@ -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;
Expand Down Expand Up @@ -1139,7 +1139,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;
Expand Down Expand Up @@ -1318,7 +1318,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));
Expand Down Expand Up @@ -1506,7 +1506,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
Expand Down
4 changes: 2 additions & 2 deletions hotspot/src/share/vm/opto/parse1.cpp
Expand Up @@ -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
Expand Down Expand Up @@ -1080,7 +1080,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;
}

Expand Down

1 comment on commit 6e563e5

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.