< prev index next >

src/share/vm/opto/phaseX.cpp

Print this page

        

@@ -32,10 +32,11 @@
 #include "opto/machnode.hpp"
 #include "opto/opcodes.hpp"
 #include "opto/phaseX.hpp"
 #include "opto/regalloc.hpp"
 #include "opto/rootnode.hpp"
+#include "opto/shenandoahSupport.hpp"
 
 //=============================================================================
 #define NODE_HASH_MINIMUM_SIZE    255
 //------------------------------NodeHash---------------------------------------
 NodeHash::NodeHash(uint est_max_size) :

@@ -563,10 +564,42 @@
   }
 }
 
 #endif
 
+bool PhaseTransform::eqv(const Node* n1, const Node* n2) const {
+  if (UseShenandoahGC) {
+
+    if (n1 == n2) return true;
+
+    if (n1 == NULL || n2 == NULL) return false;
+
+    if (n1->is_AddP() && n2->is_AddP()) {
+      Node* addp1 = n1->as_AddP();
+      Node* base1 = addp1->in(AddPNode::Base);
+      Node* addr1 = addp1->in(AddPNode::Address);
+      Node* offs1 = addp1->in(AddPNode::Offset);
+
+      Node* addp2 = n2->as_AddP();
+      Node* base2 = addp2->in(AddPNode::Base);
+      Node* addr2 = addp2->in(AddPNode::Address);
+      Node* offs2 = addp2->in(AddPNode::Offset);
+
+      if (base1 == addr1 && base2 == addr2) {
+
+        addr1 = ShenandoahBarrierNode::skip_through_barrier(addr1);
+        addr2 = ShenandoahBarrierNode::skip_through_barrier(addr2);
+
+        if (addr1 == addr2 && offs1 == offs2) return true;
+      }
+
+    }
+    return false;
+  } else {
+    return n1 == n2;
+  }
+}
 
 //=============================================================================
 //------------------------------PhaseValues------------------------------------
 // Set minimum table size to "255"
 PhaseValues::PhaseValues( Arena *arena, uint est_max_size ) : PhaseTransform(arena, GVN), _table(arena, est_max_size) {

@@ -1188,10 +1221,13 @@
   // If 'k' computes a constant, replace it with a constant
   if (t->singleton() && !k->is_Con()) {
     NOT_PRODUCT(set_progress();)
     Node* con = makecon(t);     // Make a constant
     add_users_to_worklist(k);
+    if (k->Opcode() == Op_ShenandoahWriteBarrier) {
+      assert(con->is_top(), "can only replace barrier with top");
+    }
     subsume_node(k, con);       // Everybody using k now uses con
     return con;
   }
 
   // Now check for Identities
< prev index next >