Skip to content

Commit fa600dc

Browse files
committed
8334228: C2 SuperWord: fix JDK-24 regression in VPointer::cmp_for_sort after JDK-8325155
Reviewed-by: chagedorn, kvn
1 parent 8ae7836 commit fa600dc

File tree

1 file changed

+55
-0
lines changed

1 file changed

+55
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
/*
2+
* Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved.
3+
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4+
*
5+
* This code is free software; you can redistribute it and/or modify it
6+
* under the terms of the GNU General Public License version 2 only, as
7+
* published by the Free Software Foundation.
8+
*
9+
* This code is distributed in the hope that it will be useful, but WITHOUT
10+
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11+
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12+
* version 2 for more details (a copy is included in the LICENSE file that
13+
* accompanied this code).
14+
*
15+
* You should have received a copy of the GNU General Public License version
16+
* 2 along with this work; if not, write to the Free Software Foundation,
17+
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18+
*
19+
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20+
* or visit www.oracle.com if you need additional information or have any
21+
* questions.
22+
*/
23+
24+
/**
25+
* @test
26+
* @bug 8334228
27+
* @summary Test sorting of VPointer by offset, when subtraction of two offsets can overflow.
28+
* @run main/othervm -XX:CompileCommand=compileonly,compiler.vectorization.TestOffsetSorting::test -Xcomp compiler.vectorization.TestOffsetSorting
29+
* @run main compiler.vectorization.TestOffsetSorting
30+
*/
31+
32+
package compiler.vectorization;
33+
34+
public class TestOffsetSorting {
35+
static int RANGE = 10_000;
36+
37+
public static void main(String[] args) {
38+
int[] a = new int[RANGE];
39+
for (int i = 0; i < 10_000; i++) {
40+
try {
41+
test(a, 0);
42+
throw new RuntimeException("test should go out-of-bounds");
43+
} catch (ArrayIndexOutOfBoundsException e) {
44+
}
45+
}
46+
}
47+
48+
static void test(int[] a, int invar) {
49+
int large = (1 << 28) + (1 << 20);
50+
for (int i = 0; i < 1_000; i++) {
51+
a[i + invar - large] = 42;
52+
a[i + invar + large] = 42;
53+
}
54+
}
55+
}

0 commit comments

Comments
 (0)