< prev index next >

src/hotspot/share/opto/macro.cpp

Print this page
*** 1295,10 ***
--- 1295,14 ---
  
    enum { too_big_or_final_path = 1, need_gc_path = 2 };
    Node *slow_region = nullptr;
    Node *toobig_false = ctrl;
  
+   if (PEAParanoid && alloc->materialized_cnt() > 0) {
+     fatal("[PEA] Expanding obj#%d which has been materialized.", alloc->_idx);
+   }
+ 
    // generate the initial test if necessary
    if (initial_slow_test != nullptr ) {
      assert (expand_fast_path, "Only need test if there is a fast path");
      slow_region = new RegionNode(3);
  

*** 1948,28 ***
    // eliminated even if different objects are referenced in one locked region
    // (for example, OSR compilation of nested loop inside locked scope).
    if (EliminateNestedLocks ||
        oldbox->as_BoxLock()->is_simple_lock_region(nullptr, obj, nullptr)) {
      // Box is used only in one lock region. Mark this box as eliminated.
!     _igvn.hash_delete(oldbox);
-     oldbox->as_BoxLock()->set_eliminated(); // This changes box's hash value
-      _igvn.hash_insert(oldbox);
- 
      for (uint i = 0; i < oldbox->outcnt(); i++) {
        Node* u = oldbox->raw_out(i);
        if (u->is_AbstractLock() && !u->as_AbstractLock()->is_non_esc_obj()) {
          AbstractLockNode* alock = u->as_AbstractLock();
          // Check lock's box since box could be referenced by Lock's debug info.
          if (alock->box_node() == oldbox) {
!           // Mark eliminated all related locks and unlocks.
  #ifdef ASSERT
!           alock->log_lock_optimization(C, "eliminate_lock_set_non_esc4");
  #endif
!           alock->set_non_esc_obj();
          }
        }
      }
      return;
    }
  
    // Create new "eliminated" BoxLock node and use it in monitor debug info
    // instead of oldbox for the same object.
--- 1952,36 ---
    // eliminated even if different objects are referenced in one locked region
    // (for example, OSR compilation of nested loop inside locked scope).
    if (EliminateNestedLocks ||
        oldbox->as_BoxLock()->is_simple_lock_region(nullptr, obj, nullptr)) {
      // Box is used only in one lock region. Mark this box as eliminated.
!     int locks = 0;
      for (uint i = 0; i < oldbox->outcnt(); i++) {
        Node* u = oldbox->raw_out(i);
        if (u->is_AbstractLock() && !u->as_AbstractLock()->is_non_esc_obj()) {
          AbstractLockNode* alock = u->as_AbstractLock();
          // Check lock's box since box could be referenced by Lock's debug info.
          if (alock->box_node() == oldbox) {
!           locks++;
+ 
+           if (alock->obj_node() == obj) {
+             // Mark eliminated all related locks and unlocks.
  #ifdef ASSERT
!             alock->log_lock_optimization(C, "eliminate_lock_set_non_esc4");
  #endif
!             alock->set_non_esc_obj();
+             locks--;
+           }
          }
        }
      }
+     if (locks == 0) {
+       _igvn.hash_delete(oldbox);
+       oldbox->as_BoxLock()->set_eliminated(); // This changes box's hash value
+       _igvn.hash_insert(oldbox);
+     }
+ 
      return;
    }
  
    // Create new "eliminated" BoxLock node and use it in monitor debug info
    // instead of oldbox for the same object.

*** 2110,11 ***
    }
  #ifdef ASSERT
    if (!alock->is_coarsened()) {
      // Check that new "eliminated" BoxLock node is created.
      BoxLockNode* oldbox = alock->box_node()->as_BoxLock();
!     assert(oldbox->is_eliminated(), "should be done already");
    }
  #endif
  
    alock->log_lock_optimization(C, "eliminate_lock");
  
--- 2122,11 ---
    }
  #ifdef ASSERT
    if (!alock->is_coarsened()) {
      // Check that new "eliminated" BoxLock node is created.
      BoxLockNode* oldbox = alock->box_node()->as_BoxLock();
!     assert(oldbox->is_eliminated() || DoPartialEscapeAnalysis, "should be done already");
    }
  #endif
  
    alock->log_lock_optimization(C, "eliminate_lock");
  
< prev index next >