mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-22 12:04:39 +02:00
8144993: Elide redundant memory barrier after AllocationNode
Elide memory barrier for AllocationNode when it doesn't escape in initializer and has an MemBarRelease node at exit of initializer method. Reviewed-by: aph, mdoerr, goetz, kvn, asiebenborn
This commit is contained in:
parent
c4a81b327d
commit
3767315e75
4 changed files with 48 additions and 4 deletions
|
@ -962,6 +962,14 @@ void Parse::do_exits() {
|
|||
PPC64_ONLY(wrote_volatile() ||)
|
||||
(AlwaysSafeConstructors && wrote_fields()))) {
|
||||
_exits.insert_mem_bar(Op_MemBarRelease, alloc_with_final());
|
||||
|
||||
// If Memory barrier is created for final fields write
|
||||
// and allocation node does not escape the initialize method,
|
||||
// then barrier introduced by allocation node can be removed.
|
||||
if (DoEscapeAnalysis && alloc_with_final()) {
|
||||
AllocateNode *alloc = AllocateNode::Ideal_allocation(alloc_with_final(), &_gvn);
|
||||
alloc->compute_MemBar_redundancy(method());
|
||||
}
|
||||
if (PrintOpto && (Verbose || WizardMode)) {
|
||||
method()->print_name();
|
||||
tty->print_cr(" writes finals and needs a memory barrier");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue