[aarch64-port-dev ] RFR: 8144993: Elide redundant memory barrier after AllocationNode
Hui Shi
hui.shi at linaro.org
Thu Dec 10 14:48:05 UTC 2015
Hi All,
Could some one help comments this change?
Bug: https://bugs.openjdk.java.net/browse/JDK-8144993
webrev: http://cr.openjdk.java.net/~hshi/8144993/webrev/
This patch aims to remove redundant memory barrier after allocation node,
on AArch64 it removes redundant dmb when creating object. The motivation is
dmb instructions after commonly used object allocation, for example string
and boxing objects is redundant with dmb inserted for final field write. In
following small case:
String foo(String s)
{
String copy = new String(s);
return copy;
}
There are two dmb instructions in generated code. First one is
membar_storestore, inserted in PhaseMacroExpand::expand_allocate_common.
Second one is membar_release, inserted at exit of initializer method as
final fields write happens. Allocated String doesn't escape in String
initializer method, membar_release includes membar_storestore semantic. So
first one can be removed safely.
0x0000007f85bbfa8c: prfm pstl1keep, [x11,#256]
0x0000007f85bbfa90: str xzr, [x0,#16]
0x0000007f85bbfa94: dmb ishst // first dmb to remove
....
0x0000007fa01d83c0: ldrsb w10, [x20,#20]
0x0000007fa01d83c4: ldr w12, [x20,#16]
0x0000007fa01d83c8: ldr x11, [sp,#8]
0x0000007fa01d83cc: strb w10, [x11,#20]
0x0000007fa01d83d0: str w12, [x11,#16]
0x0000007fa01d83d4: dmb ish // second dmb
Patch targets this pattern and remove redundant memory barrier for
allocation node.
1. When inserting memory barrier for final field write. If final fields'
object allocation node is available, invoke
AllocationNode::compute_MemBar_redundancy(initializer method).
2. In AllocationNode:
2.1 Add a new field _is_allocation_MemBar_redundant flag indicate if
memory barrier after allocation node is redundant.
2.2 Add method compute_MemBar_redundancy, set
_is_allocation_MemBar_redundant true if first parameter "this" does not
escape in initializer method according to BCEscapeAnalyzer.
3. skip inserting memory barrier in
PhaseMacroExpand::expand_allocate_common, when AllocationNode's
_is_allocation_MemBar_redundant
flag is true.
Regards
Hui
More information about the aarch64-port-dev
mailing list