Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
8246153: TestEliminateArrayCopy fails with -XX:+StressReflectiveCode
Use the memory input instead of the control input to find the membar.

Reviewed-by: kvn, neliasso
  • Loading branch information
TobiHartmann committed Jun 2, 2020
1 parent 44ae643 commit 5793b0633a67370e510cce6e2eaf9e5f2a6a8db5
Showing with 8 additions and 5 deletions.
  1. +2 −2 src/hotspot/share/opto/macro.cpp
  2. +6 −3 test/hotspot/jtreg/compiler/arraycopy/TestEliminateArrayCopy.java
@@ -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);
@@ -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;

0 comments on commit 5793b06

Please sign in to comment.