< prev index next >

src/hotspot/share/opto/locknode.cpp

Print this page
*** 177,10 ***
--- 177,12 ---
  //=============================================================================
  //------------------------------do_monitor_enter-------------------------------
  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
    if (stopped()) return;
  

*** 194,10 ***
--- 196,14 ---
  
  //------------------------------do_monitor_exit--------------------------------
  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
    // for a null check on Unlock.
    shared_unlock(map()->peek_monitor_box(), map()->peek_monitor_obj());
< prev index next >