Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/hotspot/share/opto/arraycopynode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,13 @@ bool ArrayCopyNode::prepare_array_copy(PhaseGVN *phase, bool can_reshape,
return false;
}

Node* hook = new Node(1);
hook->init_req(0, dest_offset);

Node* src_scale = phase->transform(new LShiftXNode(src_offset, phase->intcon(shift)));

hook->destruct(phase);

Node* dest_scale = phase->transform(new LShiftXNode(dest_offset, phase->intcon(shift)));

adr_src = phase->transform(new AddPNode(base_src, base_src, src_scale));
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
/*
* Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2025 SAP SE. 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 8361117
* @summary SIGSEGV in LShiftLNode::Ideal due to unexpected dead node
*
* @run main/othervm -XX:-TieredCompilation
* -XX:CompileCommand=compileonly,compiler.c2.TestArrayCopyLShiftIdealization::test
* compiler.c2.TestArrayCopyLShiftIdealization
*/

package compiler.c2;

public class TestArrayCopyLShiftIdealization {
public static void test() {
int size = 1000;
int[] arr1 = new int[size];
int[] arr2 = new int[size];
for (int i = 0; i < size; i++) {
arr1[i] = i;
}
for (int i = 0; i < size; i += 10) {
for (int j = 0; j < 5; j++) {
int srcPos = i + j;
int destPos = i + j;
int length = 5 - j;
java.lang.System.arraycopy(arr1, srcPos, arr2, destPos,
length);
}
}
}

public static void main(String[] args) {
for (int i = 0; i < 10_000; i++) {
test();
}
}
}