Skip to content

Commit 910546f

Browse files
committed
8283422: Create a new test for JDK-8254790
Reviewed-by: clanger Backport-of: ad83ec7e281cb3ab7c42e71fab47ea21b93079ea
1 parent 0910bdb commit 910546f

File tree

3 files changed

+78
-2
lines changed

3 files changed

+78
-2
lines changed

test/hotspot/jtreg/TEST.groups

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
2+
# Copyright (c) 2013, 2022, Oracle and/or its affiliates. All rights reserved.
33
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
#
55
# This code is free software; you can redistribute it and/or modify it
@@ -94,6 +94,7 @@ hotspot_slow_compiler = \
9494
compiler/codegen/aes \
9595
compiler/codecache/stress \
9696
compiler/gcbarriers/PreserveFPRegistersTest.java \
97+
resourcehogs/compiler \
9798
:hotspot_compiler_arraycopy
9899

99100
tier1_compiler_1 = \

test/hotspot/jtreg/compiler/intrinsics/string/TestStringIntrinsics2.java

+15-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2016, 2022, Oracle and/or its affiliates. All rights reserved.
33
* Copyright (c) 2016 SAP SE. All rights reserved.
44
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
55
*
@@ -706,4 +706,18 @@ public static void test_asmStringEquals() {
706706
}
707707
}
708708

709+
static String longLatin1 = "0123456789A".repeat(100);
710+
static String longUTF = "0123456789\ubeef".repeat(100);
711+
712+
@Test(role = Role.TEST_HELPER, compileAt = 4, warmup = 1, warmupArgs = { "0123456789", "1" })
713+
public static boolean indexOf_use_result_immediately(String a, String b) {
714+
char ch = b.charAt(0);
715+
return ch == a.charAt(a.indexOf(ch));
716+
}
717+
718+
@Test(role = Role.TEST_ENTRY)
719+
public static void test_indexOf_use_result_immediately() {
720+
assertTrue(indexOf_use_result_immediately(longLatin1, "A"));
721+
assertTrue(indexOf_use_result_immediately(longUTF, "\ubeef"));
722+
}
709723
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
/*
2+
* Copyright (c) 2016, 2022, Oracle and/or its affiliates. All rights reserved.
3+
* Copyright (c) 2016 SAP SE. All rights reserved.
4+
* Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.
5+
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6+
*
7+
* This code is free software; you can redistribute it and/or modify it
8+
* under the terms of the GNU General Public License version 2 only, as
9+
* published by the Free Software Foundation.
10+
*
11+
* This code is distributed in the hope that it will be useful, but WITHOUT
12+
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13+
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14+
* version 2 for more details (a copy is included in the LICENSE file that
15+
* accompanied this code).
16+
*
17+
* You should have received a copy of the GNU General Public License version
18+
* 2 along with this work; if not, write to the Free Software Foundation,
19+
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20+
*
21+
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22+
* or visit www.oracle.com if you need additional information or have any
23+
* questions.
24+
*/
25+
26+
/*
27+
* @test
28+
* @bug 8254790
29+
* @requires vm.bits == "64" & os.maxMemory > 8G
30+
* @modules java.base/jdk.internal.misc
31+
* @library /test/lib /test/hotspot/jtreg
32+
*
33+
* @build compiler.intrinsics.string.TestStringIntrinsics2
34+
* @build sun.hotspot.WhiteBox
35+
* @run driver ClassFileInstaller sun.hotspot.WhiteBox
36+
*
37+
* @run main/othervm
38+
* -mx8G
39+
* -Xbootclasspath/a:.
40+
* -Xmixed
41+
* -XX:+UnlockDiagnosticVMOptions
42+
* -XX:+WhiteBoxAPI
43+
* -XX:+IgnoreUnrecognizedVMOptions
44+
* -XX:MaxInlineSize=70
45+
* -XX:MinInlineFrequencyRatio=0
46+
* resourcehogs.compiler.intrinsics.string.TestStringIntrinsics2LargeArray
47+
*/
48+
49+
package resourcehogs.compiler.intrinsics.string;
50+
51+
import java.lang.ref.Reference;
52+
53+
import compiler.intrinsics.string.TestStringIntrinsics2;
54+
55+
public final class TestStringIntrinsics2LargeArray {
56+
public static void main(String[] args) throws Exception {
57+
int[] hugeArray = new int[Integer.MAX_VALUE / 2];
58+
TestStringIntrinsics2.main(args);
59+
Reference.reachabilityFence(hugeArray);
60+
}
61+
}

0 commit comments

Comments
 (0)