mirror of
https://github.com/openjdk/jdk.git
synced 2026-07-02 07:10:23 +00:00
8387015: C2: crash with "named projection 2 not found" from ArrayCopyNode::finish_transform() for clone
Reviewed-by: qamai, kvn
This commit is contained in:
parent
193de1b1c7
commit
07a52da1fe
@ -180,6 +180,12 @@ Node* ArrayCopyNode::try_clone_instance(PhaseGVN *phase, bool can_reshape, int c
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Node* out_mem = proj_out_or_null(TypeFunc::Memory);
|
||||
if (can_reshape && out_mem == nullptr) { // dead node?
|
||||
return NodeSentinel;
|
||||
}
|
||||
|
||||
|
||||
Node* base_src = in(ArrayCopyNode::Src);
|
||||
Node* base_dest = in(ArrayCopyNode::Dest);
|
||||
Node* ctl = in(TypeFunc::Control);
|
||||
|
||||
79
test/hotspot/jtreg/compiler/arraycopy/TestDeadCloneMem.java
Normal file
79
test/hotspot/jtreg/compiler/arraycopy/TestDeadCloneMem.java
Normal file
@ -0,0 +1,79 @@
|
||||
/*
|
||||
* Copyright (c) 2026 IBM Corporation. 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
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @test
|
||||
* @bug JDK-8387015
|
||||
* @summary C2: crash with "named projection 2 not found" from ArrayCopyNode::finish_transform() for clone
|
||||
* @run main/othervm -Xcomp -XX:+UnlockDiagnosticVMOptions -XX:CompileOnly=${test.main.class}::test1
|
||||
* -XX:CompileCommand=dontinline,${test.main.class}::notInlined -XX:+StressIGVN
|
||||
* -XX:StressSeed=1324432947 ${test.main.class}
|
||||
* @run main/othervm -Xcomp -XX:+UnlockDiagnosticVMOptions -XX:CompileOnly=${test.main.class}::test1
|
||||
* -XX:CompileCommand=dontinline,${test.main.class}::notInlined -XX:+StressIGVN
|
||||
* ${test.main.class}
|
||||
*/
|
||||
|
||||
package compiler.arraycopy;
|
||||
|
||||
public class TestDeadCloneMem {
|
||||
private static int field;
|
||||
|
||||
public static void main(String[] args) {
|
||||
int[] array = new int[10];
|
||||
array.clone();
|
||||
Object o = new Object();
|
||||
test1(42, false);
|
||||
}
|
||||
|
||||
private static int test1(int flag, boolean flag2) {
|
||||
int len;
|
||||
if (flag != 42) {
|
||||
if (flag2) {
|
||||
field = 42;
|
||||
}
|
||||
int[] array2;
|
||||
if (flag != 42) {
|
||||
len = -1;
|
||||
array2 = new int[4];
|
||||
} else {
|
||||
len = 42;
|
||||
array2 = new int[100];
|
||||
}
|
||||
int[] array = new int[len];
|
||||
int length = array.length;
|
||||
int i = 0;
|
||||
do {
|
||||
synchronized (new Object()) {}
|
||||
notInlined();
|
||||
array2.clone();
|
||||
i++;
|
||||
} while (i < 10);
|
||||
return length;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
private static void notInlined() {
|
||||
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user