changeset 8561:dbab938afe28

8136596: Remove aarch64: MemBarRelease when final field's allocation is NoEscape or ArgEscape Summary: elide MemBar when AllocateNode _is_non_escaping Reviewed-by: kvn, roland Contributed-by: hui.shi@linaro.org
author roland
date Mon, 21 Sep 2015 10:51:33 +0200
parents 4be0afa7fd02
children ed6af9cfdd70
files src/share/vm/opto/callnode.hpp src/share/vm/opto/macro.cpp src/share/vm/opto/memnode.cpp
diffstat 3 files changed, 15 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/vm/opto/callnode.hpp	Tue Sep 15 12:59:51 2015 +0000
+++ b/src/share/vm/opto/callnode.hpp	Mon Sep 21 10:51:33 2015 +0200
@@ -894,6 +894,18 @@
 
   // Convenience for initialization->maybe_set_complete(phase)
   bool maybe_set_complete(PhaseGVN* phase);
+
+  // Return true if allocation doesn't escape thread, its escape state
+  // needs be noEscape or ArgEscape. InitializeNode._does_not_escape
+  // is true when its allocation's escape state is noEscape or
+  // ArgEscape. In case allocation's InitializeNode is NULL, check
+  // AlllocateNode._is_non_escaping flag.
+  // AlllocateNode._is_non_escaping is true when its escape state is
+  // noEscape.
+  bool does_not_escape_thread() {
+    InitializeNode* init = NULL;
+    return _is_non_escaping || (((init = initialization()) != NULL) && init->does_not_escape());
+  }
 };
 
 //------------------------------AllocateArray---------------------------------
--- a/src/share/vm/opto/macro.cpp	Tue Sep 15 12:59:51 2015 +0000
+++ b/src/share/vm/opto/macro.cpp	Mon Sep 21 10:51:33 2015 +0200
@@ -1385,7 +1385,8 @@
     // MemBarStoreStore so that stores that initialize this object
     // can't be reordered with a subsequent store that makes this
     // object accessible by other threads.
-    if (init == NULL || (!init->is_complete_with_arraycopy() && !init->does_not_escape())) {
+    if (!alloc->does_not_escape_thread() &&
+        (init == NULL || !init->is_complete_with_arraycopy())) {
       if (init == NULL || init->req() < InitializeNode::RawStores) {
         // No InitializeNode or no stores captured by zeroing
         // elimination. Simply add the MemBarStoreStore after object
--- a/src/share/vm/opto/memnode.cpp	Tue Sep 15 12:59:51 2015 +0000
+++ b/src/share/vm/opto/memnode.cpp	Mon Sep 21 10:51:33 2015 +0200
@@ -3065,7 +3065,7 @@
       // Final field stores.
       Node* alloc = AllocateNode::Ideal_allocation(in(MemBarNode::Precedent), phase);
       if ((alloc != NULL) && alloc->is_Allocate() &&
-          alloc->as_Allocate()->_is_non_escaping) {
+          alloc->as_Allocate()->does_not_escape_thread()) {
         // The allocated object does not escape.
         eliminate = true;
       }