< prev index next >

src/share/vm/opto/callnode.hpp

Print this page
rev 9640 : 8144993: Elide redundant memory barrier after AllocationNode
Summary: Elide memory barrier for AllocationNode when it doesn't escape in initializer and has an MemBarRelease node at exit of initializer method.
Reviewed-by: duke

@@ -856,10 +856,12 @@
   }
 
   // Result of Escape Analysis
   bool _is_scalar_replaceable;
   bool _is_non_escaping;
+  // True when MemBar for new is redundant with MemBar at initialzer exit
+  bool _is_allocation_MemBar_redundant;
 
   virtual uint size_of() const; // Size is bigger
   AllocateNode(Compile* C, const TypeFunc *atype, Node *ctrl, Node *mem, Node *abio,
                Node *size, Node *klass_node, Node *initial_test);
   // Expansion modifies the JVMState, so we need to clone it

@@ -921,10 +923,17 @@
   // noEscape.
   bool does_not_escape_thread() {
     InitializeNode* init = NULL;
     return _is_non_escaping || (((init = initialization()) != NULL) && init->does_not_escape());
   }
+
+  // If object doesn't escape in <.init> method and there is memory barrier
+  // inserted at exit of its <.init>, memory barrier for new is not necessary.
+  // Inovke this method when MemBar at exit of initializer and post-dominate
+  // allocation node.
+  void compute_MemBar_redundancy(ciMethod* initializer);
+  bool is_allocation_MemBar_redundant() { return _is_allocation_MemBar_redundant; }
 };
 
 //------------------------------AllocateArray---------------------------------
 //
 // High-level array allocation
< prev index next >