< prev index next >

src/hotspot/share/gc/g1/c2/g1BarrierSetC2.cpp

Print this page
rev 52474 : 8213615: GC/C2 abstraction for escape analysis

@@ -29,10 +29,11 @@
 #include "gc/g1/g1CardTable.hpp"
 #include "gc/g1/g1ThreadLocalData.hpp"
 #include "gc/g1/heapRegion.hpp"
 #include "opto/arraycopynode.hpp"
 #include "opto/compile.hpp"
+#include "opto/escape.hpp"
 #include "opto/graphKit.hpp"
 #include "opto/idealKit.hpp"
 #include "opto/macro.hpp"
 #include "opto/rootnode.hpp"
 #include "opto/type.hpp"

@@ -838,5 +839,34 @@
       }
     }
   }
 }
 #endif
+
+bool G1BarrierSetC2::escape_add_to_con_graph(ConnectionGraph* conn_graph, PhaseGVN* gvn, Unique_Node_List* delayed_worklist, Node* n, uint opcode) const {
+  if (opcode == Op_StoreP) {
+    Node* adr = n->in(MemNode::Address);
+    const Type* adr_type = gvn->type(adr);
+    // Pointer stores in G1 barriers looks like unsafe access.
+    // Ignore such stores to be able scalar replace non-escaping
+    // allocations.
+    if (adr_type->isa_rawptr() && adr->is_AddP()) {
+      Node* base = conn_graph->get_addp_base(adr);
+      if (base->Opcode() == Op_LoadP &&
+          base->in(MemNode::Address)->is_AddP()) {
+        adr = base->in(MemNode::Address);
+        Node* tls = conn_graph->get_addp_base(adr);
+        if (tls->Opcode() == Op_ThreadLocal) {
+          int offs = (int) gvn->find_intptr_t_con(adr->in(AddPNode::Offset), Type::OffsetBot);
+          const int buf_offset = in_bytes(G1ThreadLocalData::satb_mark_queue_buffer_offset());
+          if (offs == buf_offset) {
+            return true; // G1 pre barrier previous oop value store.
+          }
+          if (offs == in_bytes(G1ThreadLocalData::dirty_card_queue_buffer_offset())) {
+            return true; // G1 post barrier card address store.
+          }
+        }
+      }
+    }
+  }
+  return false;
+}
< prev index next >