Skip to content

Commit

Permalink
use has_monitor_bytecodes() in c1 as well
Browse files Browse the repository at this point in the history
  • Loading branch information
JornVernee committed Oct 31, 2023
1 parent a484206 commit a33a905
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
6 changes: 1 addition & 5 deletions src/hotspot/share/c1/c1_Compilation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -389,10 +389,6 @@ int Compilation::compile_java_method() {
BAILOUT_("mdo allocation failed", no_frame_size);
}

if (method()->is_synchronized()) {
set_has_monitors(true);
}

{
PhaseTraceTime timeit(_t_buildIR);
build_hir();
Expand Down Expand Up @@ -580,7 +576,7 @@ Compilation::Compilation(AbstractCompiler* compiler, ciEnv* env, ciMethod* metho
, _would_profile(false)
, _has_method_handle_invokes(false)
, _has_reserved_stack_access(method->has_reserved_stack_access())
, _has_monitors(false)
, _has_monitors(method->is_synchronized() || method->has_monitor_bytecodes())
, _install_code(install_code)
, _bailout_msg(nullptr)
, _exception_info_list(nullptr)
Expand Down
10 changes: 9 additions & 1 deletion src/hotspot/share/c1/c1_GraphBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2316,7 +2316,6 @@ void GraphBuilder::instance_of(int klass_index) {
void GraphBuilder::monitorenter(Value x, int bci) {
// save state before locking in case of deoptimization after a NullPointerException
ValueStack* state_before = copy_state_for_exception_with_bci(bci);
compilation()->set_has_monitors(true);
append_with_bci(new MonitorEnter(x, state()->lock(x), state_before), bci);
kill_all();
}
Expand Down Expand Up @@ -3526,6 +3525,9 @@ bool GraphBuilder::try_inline(ciMethod* callee, bool holder_known, bool ignore_r
if (callee->has_reserved_stack_access()) {
compilation()->set_has_reserved_stack_access(true);
}
if (callee->has_monitor_bytecodes()) {
compilation()->set_has_monitors(true);
}
return true;
}
return false;
Expand All @@ -3539,6 +3541,9 @@ bool GraphBuilder::try_inline(ciMethod* callee, bool holder_known, bool ignore_r
if (callee->has_reserved_stack_access()) {
compilation()->set_has_reserved_stack_access(true);
}
if (callee->has_monitor_bytecodes()) {
compilation()->set_has_monitors(true);
}
return true;
}
// try normal inlining
Expand All @@ -3559,6 +3564,9 @@ bool GraphBuilder::try_inline(ciMethod* callee, bool holder_known, bool ignore_r
if (callee->has_reserved_stack_access()) {
compilation()->set_has_reserved_stack_access(true);
}
if (callee->has_monitor_bytecodes()) {
compilation()->set_has_monitors(true);
}
return true;
}

Expand Down

0 comments on commit a33a905

Please sign in to comment.