8246153: TestEliminateArrayCopy fails with -XX:+StressReflectiveCode

Use the memory input instead of the control input to find the membar.

Reviewed-by: kvn, neliasso
This commit is contained in:
Tobias Hartmann 2020-06-02 09:07:53 +02:00
parent 44ae643b2b
commit 5793b0633a
2 changed files with 8 additions and 5 deletions

View File

@ -977,8 +977,8 @@ void PhaseMacroExpand::process_users_of_allocation(CallNode *alloc) {
if (ac->is_clonebasic()) {
Node* membar_after = ac->proj_out(TypeFunc::Control)->unique_ctrl_out();
disconnect_projections(ac, _igvn);
assert(alloc->in(0)->is_Proj() && alloc->in(0)->in(0)->Opcode() == Op_MemBarCPUOrder, "mem barrier expected before allocation");
Node* membar_before = alloc->in(0)->in(0);
assert(alloc->in(TypeFunc::Memory)->is_Proj() && alloc->in(TypeFunc::Memory)->in(0)->Opcode() == Op_MemBarCPUOrder, "mem barrier expected before allocation");
Node* membar_before = alloc->in(TypeFunc::Memory)->in(0);
disconnect_projections(membar_before->as_MemBar(), _igvn);
if (membar_after->is_MemBar()) {
disconnect_projections(membar_after->as_MemBar(), _igvn);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -23,14 +23,17 @@
/*
* @test
* @bug 8076188
* @bug 8076188 8246153
* @summary arraycopy to non escaping destination may be eliminated
* @library /
*
* @run main/othervm -ea -XX:-BackgroundCompilation -XX:-UseOnStackReplacement
* -XX:CompileCommand=dontinline,compiler.arraycopy.TestEliminateArrayCopy*::m*
* compiler.arraycopy.TestEliminateArrayCopy
*
* @run main/othervm -ea -XX:-BackgroundCompilation -XX:-UseOnStackReplacement
* -XX:+IgnoreUnrecognizedVMOptions -XX:+StressReflectiveCode
* -XX:CompileCommand=dontinline,compiler.arraycopy.TestEliminateArrayCopy*::m*
* compiler.arraycopy.TestEliminateArrayCopy
*/
package compiler.arraycopy;