8136596: Remove aarch64: MemBarRelease when final field's allocation is NoEscape or ArgEscape

Elide MemBar when AllocateNode _is_non_escaping

Reviewed-by: kvn, roland
This commit is contained in:
Hui Shi 2015-09-21 10:51:33 +02:00 committed by Roland Westrelin
parent a61a0cec2e
commit 0f4b248b18
3 changed files with 15 additions and 2 deletions

View File

@ -907,6 +907,18 @@ public:
// 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---------------------------------

View File

@ -1512,7 +1512,8 @@ void PhaseMacroExpand::expand_allocate_common(
// 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

View File

@ -2945,7 +2945,7 @@ Node *MemBarNode::Ideal(PhaseGVN *phase, bool can_reshape) {
// 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;
}