Skip to content

Commit

Permalink
use ciMethod::has_monitor_bytecodes
Browse files Browse the repository at this point in the history
  • Loading branch information
JornVernee committed Oct 31, 2023
1 parent e223d95 commit a484206
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 28 deletions.
6 changes: 0 additions & 6 deletions src/hotspot/share/opto/locknode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,6 @@ void FastLockNode::create_rtm_lock_counter(JVMState* state) {
void Parse::do_monitor_enter() {
kill_dead_locals();

C->set_has_monitors(true);

// Null check; get casted pointer.
Node* obj = null_check(peek());
// Check for locking null object
Expand All @@ -198,10 +196,6 @@ void Parse::do_monitor_enter() {
void Parse::do_monitor_exit() {
kill_dead_locals();

// need to set it for monitor exit as well.
// OSR compiled methods can start with lock taken
C->set_has_monitors(true);

pop(); // Pop oop to unlock
// Because monitors are guaranteed paired (else we bail out), we know
// the matching Lock for this Unlock. Hence we know there is no need
Expand Down
23 changes: 1 addition & 22 deletions src/hotspot/share/opto/parse1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ Parse::Parse(JVMState* caller, ciMethod* parse_method, float expected_uses)
C->set_has_reserved_stack_access(true);
}

if (parse_method->is_synchronized()) {
if (parse_method->is_synchronized() || parse_method->has_monitor_bytecodes()) {
C->set_has_monitors(true);
}

Expand Down Expand Up @@ -1504,17 +1504,6 @@ void Parse::Block::record_state(Parse* p) {
set_start_map(p->stop());
}

static bool has_monitorexit(ciBytecodeStream& iter, int limit) {
iter.next(); // prime
for (; iter.cur_bci() < limit; iter.next()) {
Bytecodes::Code bc = iter.cur_bc();
if (bc == Bytecodes::_monitorexit) {
return true;
}
}
return false;
}


//------------------------------do_one_block-----------------------------------
void Parse::do_one_block() {
Expand Down Expand Up @@ -1554,16 +1543,6 @@ void Parse::do_one_block() {
uncommon_trap(Deoptimization::Reason_unreached,
Deoptimization::Action_reinterpret,
nullptr, "dead catch block");

if (C->is_osr_compilation()) {
// Continuations need to know if this ex handler has a monitorexit.
// We only need to do this for OSR compilations, since we might not see
// the monitorenter in that case.
if (has_monitorexit(iter(), block()->limit())) {
C->set_has_monitors(true);
}
}

return;
}
}
Expand Down

0 comments on commit a484206

Please sign in to comment.