author | hseigel |
Wed, 01 Mar 2017 08:00:02 -0500 | |
changeset 46194 | 5596e6f63072 |
parent 40631 | ed82623d7831 |
permissions | -rw-r--r-- |
35581
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
1 |
/* |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
2 |
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. |
35594 | 3 |
* Copyright (c) 2016 SAP SE. All rights reserved. |
35581
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
4 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
5 |
* |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
6 |
* This code is free software; you can redistribute it and/or modify it |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
7 |
* under the terms of the GNU General Public License version 2 only, as |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
8 |
* published by the Free Software Foundation. |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
9 |
* |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
10 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
11 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
12 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
13 |
* version 2 for more details (a copy is included in the LICENSE file that |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
14 |
* accompanied this code). |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
15 |
* |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
16 |
* You should have received a copy of the GNU General Public License version |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
17 |
* 2 along with this work; if not, write to the Free Software Foundation, |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
18 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
19 |
* |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
20 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
21 |
* or visit www.oracle.com if you need additional information or have any |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
22 |
* questions. |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
23 |
*/ |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
24 |
|
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
25 |
/* |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
26 |
* @test |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
27 |
* @bug 8145336 |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
28 |
* @summary PPC64: fix string intrinsics after CompactStrings change |
38152
80e5da81fb2c
8154258: [TESTBUG] Various serviceability tests fail compilation
dsamersoff
parents:
36303
diff
changeset
|
29 |
* @modules java.base/jdk.internal.misc |
40631
ed82623d7831
8157957: ClassNotFoundException: jdk.test.lib.JDKToolFinder
ctornqvi
parents:
40059
diff
changeset
|
30 |
* @library /test/lib |
40059 | 31 |
* |
35581
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
32 |
* @build sun.hotspot.WhiteBox |
40059 | 33 |
* @run driver ClassFileInstaller sun.hotspot.WhiteBox |
35581
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
34 |
* sun.hotspot.WhiteBox$WhiteBoxPermission |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
35 |
* |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
36 |
* @run main/othervm |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
37 |
* -Xbootclasspath/a:. |
36064
20a60a2de977
8148564: compiler/intrinsics/string/TestStringIntrinsics2.java times out
thartmann
parents:
35753
diff
changeset
|
38 |
* -Xmixed |
35581
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
39 |
* -XX:+UnlockDiagnosticVMOptions |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
40 |
* -XX:+WhiteBoxAPI |
36064
20a60a2de977
8148564: compiler/intrinsics/string/TestStringIntrinsics2.java times out
thartmann
parents:
35753
diff
changeset
|
41 |
* -XX:MaxInlineSize=70 |
35581
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
42 |
* -XX:MinInliningThreshold=0 |
40059 | 43 |
* compiler.intrinsics.string.TestStringIntrinsics2 |
35581
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
44 |
*/ |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
45 |
|
40059 | 46 |
package compiler.intrinsics.string; |
47 |
||
48 |
import sun.hotspot.WhiteBox; |
|
49 |
||
35581
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
50 |
import java.lang.annotation.ElementType; |
40059 | 51 |
import java.lang.annotation.Retention; |
35581
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
52 |
import java.lang.annotation.RetentionPolicy; |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
53 |
import java.lang.annotation.Target; |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
54 |
import java.util.Arrays; |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
55 |
import java.util.function.Consumer; |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
56 |
|
40059 | 57 |
import static jdk.test.lib.Asserts.assertEquals; |
58 |
import static jdk.test.lib.Asserts.assertFalse; |
|
59 |
import static jdk.test.lib.Asserts.assertTrue; |
|
35581
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
60 |
|
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
61 |
public class TestStringIntrinsics2 { |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
62 |
// ------------------------------------------------------------------------ |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
63 |
// |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
64 |
// We test the following cases: |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
65 |
// - no match in string. Do we miss the end condition? Will crash if we read |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
66 |
// past the string. |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
67 |
// - no match in string, but after the string there is a match. |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
68 |
// Do we incorrectly report this match? We had a case where we stepped |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
69 |
// a few chars past the string, this test would report that error. The |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
70 |
// one above would not. |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
71 |
// - The needle is exactly at the end of the string. |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
72 |
// - The needle spans the end of the string |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
73 |
// |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
74 |
// A special case are needles of length 1. For these we test: |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
75 |
// - needle is first char |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
76 |
// - needle is last char |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
77 |
// - no match |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
78 |
// - match behind string. |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
79 |
// |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
80 |
// We test all these for an unknown needle, and needles known to the compiler |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
81 |
// of lengths 5, 2 and 1. |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
82 |
|
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
83 |
|
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
84 |
private static final WhiteBox WB = WhiteBox.getWhiteBox(); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
85 |
|
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
86 |
public enum Role { |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
87 |
TEST_ENTRY, |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
88 |
TEST_HELPER |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
89 |
} |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
90 |
|
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
91 |
@Retention(RetentionPolicy.RUNTIME) |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
92 |
@Target(ElementType.METHOD) |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
93 |
@interface Test { |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
94 |
Role role(); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
95 |
int compileAt() default 0; |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
96 |
int warmup() default 0; |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
97 |
String[] warmupArgs() default {}; |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
98 |
} |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
99 |
|
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
100 |
// All this mess is needed to avoid try/catch inside the lambdas below. |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
101 |
// See: http://stackoverflow.com/questions/27644361/how-can-i-throw-checked-exceptions-from-inside-java-8-streams |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
102 |
@SuppressWarnings ("unchecked") |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
103 |
private static <E extends Throwable> void throwAsUnchecked(Exception exception) throws E { |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
104 |
throw (E)exception; |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
105 |
} |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
106 |
@FunctionalInterface |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
107 |
public interface Consumer_WithExceptions<T, E extends Exception> { |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
108 |
void accept(T t) throws E; |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
109 |
} |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
110 |
public static <T, E extends Exception> Consumer<T> rethrowConsumer(Consumer_WithExceptions<T, E> consumer) { |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
111 |
return t -> { |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
112 |
try { consumer.accept(t); } |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
113 |
catch (Exception exception) { throwAsUnchecked(exception); } |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
114 |
}; |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
115 |
} |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
116 |
|
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
117 |
public static void main(String[] args) throws Exception { |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
118 |
|
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
119 |
// Warmup helper methods |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
120 |
Arrays.stream(TestStringIntrinsics2.class.getDeclaredMethods()) |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
121 |
.filter(m -> m.isAnnotationPresent(Test.class)) |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
122 |
.filter(m -> m.getAnnotation(Test.class).warmup() > 0) |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
123 |
.forEach(rethrowConsumer(m -> { |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
124 |
Test a = m.getAnnotation(Test.class); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
125 |
System.out.println("Warming up " + m + " " + a.warmup() + " time(s) "); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
126 |
for (int i=0; i < a.warmup(); i++) { |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
127 |
m.invoke(null, (Object[])a.warmupArgs()); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
128 |
} |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
129 |
})); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
130 |
|
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
131 |
// Compile helper methods |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
132 |
Arrays.stream(TestStringIntrinsics2.class.getDeclaredMethods()) |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
133 |
.filter(m -> m.isAnnotationPresent(Test.class)) |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
134 |
.filter(m -> m.getAnnotation(Test.class).compileAt() > 0) |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
135 |
.forEach(rethrowConsumer(m -> { |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
136 |
Test a = m.getAnnotation(Test.class); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
137 |
if (WB.isMethodCompilable(m, a.compileAt())) { |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
138 |
WB.enqueueMethodForCompilation(m, a.compileAt()); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
139 |
while (WB.isMethodQueuedForCompilation(m)) Thread.sleep(10); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
140 |
System.out.println(m + " compiled at " + WB.getMethodCompilationLevel(m)); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
141 |
} else { |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
142 |
System.out.println("Can't compile " + m + " at level " + a.compileAt()); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
143 |
} |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
144 |
})); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
145 |
|
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
146 |
// Run test methods |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
147 |
Arrays.stream(TestStringIntrinsics2.class.getDeclaredMethods()) |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
148 |
.filter(m -> m.isAnnotationPresent(Test.class)) |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
149 |
.filter(m -> m.getAnnotation(Test.class).role() == Role.TEST_ENTRY) |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
150 |
.forEach(rethrowConsumer(m -> { |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
151 |
System.out.print("Executing " + m); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
152 |
m.invoke(null, (Object[])null); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
153 |
System.out.println(" - OK"); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
154 |
})); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
155 |
} |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
156 |
|
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
157 |
static String text = "<t><t><t><t><t><t>\n" + "<hit>"; |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
158 |
static String text2 = "<t><t><t><t><t><t><t>\n" + "<hit>"; |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
159 |
static String[] ss = text.split("\n"); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
160 |
static String[] ss2 = null; |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
161 |
static String needle = "<miss>"; |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
162 |
|
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
163 |
@Test(role = Role.TEST_ENTRY) |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
164 |
public static void test_indexOf_no_match() { |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
165 |
int res = indexOf_no_match_unknown_needle(ss[0], "<miss>"); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
166 |
assertEquals(res, -1, "test_indexOf_no_match_unknown_needle matched at: " + res); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
167 |
res = indexOf_no_match_imm_needle(ss[0]); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
168 |
assertEquals(res, -1, "test_indexOf_no_match_imm_needle matched at: " + res); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
169 |
res = indexOf_no_match_imm2_needle(ss[0]); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
170 |
assertEquals(res, -1, "test_indexOf_no_match_imm2_needle matched at: " + res); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
171 |
|
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
172 |
if (ss2 == null) ss2 = text.split("\n"); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
173 |
res = indexOf_no_match_unknown_needle(ss2[0], "<miss>"); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
174 |
assertEquals(res, -1, "test_indexOf_no_match_unknown_needle matched at: " + res); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
175 |
res = indexOf_no_match_imm_needle(ss2[0]); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
176 |
assertEquals(res, -1, "test_indexOf_no_match_imm_needle matched at: " + res); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
177 |
res = indexOf_no_match_imm2_needle(ss2[0]); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
178 |
assertEquals(res, -1, "test_indexOf_no_match_imm2_needle matched at: " + res); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
179 |
res = indexOf_no_match_imm1_needle(ss2[0]); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
180 |
assertEquals(res, -1, "test_indexOf_no_match_imm1_needle matched at: " + res); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
181 |
} |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
182 |
|
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
183 |
@Test(role = Role.TEST_HELPER, compileAt = 4, warmup = 1, warmupArgs = { "<t><t><t>", "<miss>" }) |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
184 |
static int indexOf_no_match_unknown_needle(String s, String needle) { |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
185 |
int index = s.indexOf(needle); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
186 |
return index; |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
187 |
} |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
188 |
|
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
189 |
@Test(role = Role.TEST_HELPER, compileAt = 4, warmup = 1, warmupArgs = { "<t><t><t>" }) |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
190 |
static int indexOf_no_match_imm_needle(String s) { |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
191 |
int index = s.indexOf("<hitt>"); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
192 |
return index; |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
193 |
} |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
194 |
|
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
195 |
@Test(role = Role.TEST_HELPER, compileAt = 4, warmup = 1, warmupArgs = { "<t><t><t>" }) |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
196 |
static int indexOf_no_match_imm2_needle(String s) { |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
197 |
int index = s.indexOf("<m"); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
198 |
return index; |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
199 |
} |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
200 |
|
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
201 |
@Test(role = Role.TEST_HELPER, compileAt = 4, warmup = 1, warmupArgs = { "<t><t><t>" }) |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
202 |
static int indexOf_no_match_imm1_needle(String s) { |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
203 |
int index = s.indexOf("m"); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
204 |
return index; |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
205 |
} |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
206 |
|
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
207 |
@Test(role = Role.TEST_ENTRY) |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
208 |
public static void test_indexOf_reads_past_string() { |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
209 |
if (ss == null) ss = text.split("\n"); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
210 |
String res = indexOf_reads_past_string_unknown_needle(ss[0], "<hit>"); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
211 |
assertEquals(res, null, "test_indexOf_reads_past_string_unknown_needle " + res); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
212 |
res = indexOf_reads_past_string_imm_needle(ss[0]); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
213 |
assertEquals(res, null, "test_indexOf_reads_past_string_imm_needle " + res); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
214 |
res = indexOf_reads_past_string_imm2_needle(ss[0]); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
215 |
assertEquals(res, null, "test_indexOf_reads_past_string_imm2_needle " + res); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
216 |
res = indexOf_reads_past_string_imm1_needle(ss[0]); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
217 |
assertEquals(res, null, "test_indexOf_reads_past_string_imm1_needle " + res); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
218 |
} |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
219 |
|
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
220 |
@Test(role = Role.TEST_HELPER, compileAt = 4, warmup = 1, warmupArgs = { "<t><t><t>", "<hit>" }) |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
221 |
static String indexOf_reads_past_string_unknown_needle(String s, String needle) { |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
222 |
int index = s.indexOf(needle); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
223 |
if (index > s.length()) { |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
224 |
return "Found needle \"" + needle + "\" behind string of length " + s.length() |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
225 |
+ " at position " + index + "."; |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
226 |
} |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
227 |
return null; |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
228 |
} |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
229 |
|
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
230 |
@Test(role = Role.TEST_HELPER, compileAt = 4, warmup = 1, warmupArgs = { "<t><t><t>" }) |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
231 |
static String indexOf_reads_past_string_imm_needle(String s) { |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
232 |
int index = s.indexOf("<hit>"); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
233 |
if (index > s.length()) { |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
234 |
return "Found needle \"<hit>\" behind string of length " + s.length() + " at position " + index + "."; |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
235 |
} |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
236 |
return null; |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
237 |
} |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
238 |
|
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
239 |
@Test(role = Role.TEST_HELPER, compileAt = 4, warmup = 1, warmupArgs = { "<t><t><t>" }) |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
240 |
static String indexOf_reads_past_string_imm2_needle(String s) { |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
241 |
int index = s.indexOf("<h"); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
242 |
if (index > s.length()) { |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
243 |
return "Found needle \"<h\" behind string of length " + s.length() + " at position " + index + "."; |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
244 |
} |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
245 |
return null; |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
246 |
} |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
247 |
|
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
248 |
@Test(role = Role.TEST_HELPER, compileAt = 4, warmup = 1, warmupArgs = { "<t><t><t>" }) |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
249 |
static String indexOf_reads_past_string_imm1_needle(String s) { |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
250 |
int index = s.indexOf("h"); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
251 |
if (index > s.length()) { |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
252 |
return "Found needle \"<h\" behind string of length " + s.length() + " at position " + index + "."; |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
253 |
} |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
254 |
return null; |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
255 |
} |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
256 |
|
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
257 |
static String text3 = "<t><hi><t><h><hit<t><hit>"; |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
258 |
static String text4 = "a<t><hi><t><h><hit<t><hit>"; |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
259 |
static String text5 = "gg<t><hi><t><h><hit<t><hit>"; |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
260 |
static String text6 = "ccc<t><hi><t><h><hit<t><hit>"; |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
261 |
static int len3 = text3.length(); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
262 |
static int len4 = text4.length(); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
263 |
static int len5 = text5.length(); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
264 |
static int len6 = text6.length(); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
265 |
|
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
266 |
static String text7 = "<t><t><t><t><t<t><h"; |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
267 |
static String text8 = "a<t><t><t><t><t<t><h"; |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
268 |
static String text9 = "gg<t><t><t><t><t<t><h"; |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
269 |
static String text10 = "ccc<t><t><t><t><t<t><h"; |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
270 |
|
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
271 |
@Test(role = Role.TEST_ENTRY) |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
272 |
public static void test_indexOf_match_at_end_of_string() { |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
273 |
String testname = "test_indexOf_match_at_end_of_string"; |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
274 |
int res = 0; |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
275 |
res = indexOf_match_at_end_of_string_unknown_needle(text3, "<hit>"); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
276 |
assertEquals(len3, res + 5, testname); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
277 |
res = indexOf_match_at_end_of_string_unknown_needle(text4, "<hit>"); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
278 |
assertEquals(len4, res + 5, testname); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
279 |
res = indexOf_match_at_end_of_string_unknown_needle(text5, "<hit>"); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
280 |
assertEquals(len5, res + 5, testname); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
281 |
res = indexOf_match_at_end_of_string_unknown_needle(text6, "<hit>"); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
282 |
assertEquals(len6, res + 5, testname); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
283 |
|
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
284 |
res = indexOf_match_at_end_of_string_imm_needle(text3); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
285 |
assertEquals(len3, res + 5, testname); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
286 |
res = indexOf_match_at_end_of_string_imm_needle(text4); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
287 |
assertEquals(len4, res + 5, testname); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
288 |
res = indexOf_match_at_end_of_string_imm_needle(text5); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
289 |
assertEquals(len5, res + 5, testname); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
290 |
res = indexOf_match_at_end_of_string_imm_needle(text6); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
291 |
assertEquals(len6, res + 5, testname); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
292 |
|
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
293 |
res = indexOf_match_at_end_of_string_imm2_needle(text7); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
294 |
assertEquals(text7.length(), res + 2, testname); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
295 |
res = indexOf_match_at_end_of_string_imm2_needle(text8); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
296 |
assertEquals(text8.length(), res + 2, testname); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
297 |
res = indexOf_match_at_end_of_string_imm2_needle(text9); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
298 |
assertEquals(text9.length(), res + 2, testname); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
299 |
res = indexOf_match_at_end_of_string_imm2_needle(text10); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
300 |
assertEquals(text10.length(), res + 2, testname); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
301 |
|
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
302 |
res = indexOf_match_at_end_of_string_imm1_needle(text7); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
303 |
assertEquals(text7.length(), res + 1, testname); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
304 |
res = indexOf_match_at_end_of_string_imm1_needle(text8); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
305 |
assertEquals(text8.length(), res + 1, testname); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
306 |
res = indexOf_match_at_end_of_string_imm1_needle(text9); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
307 |
assertEquals(text9.length(), res + 1, testname); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
308 |
res = indexOf_match_at_end_of_string_imm1_needle(text10); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
309 |
assertEquals(text10.length(), res + 1, testname); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
310 |
} |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
311 |
|
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
312 |
@Test(role = Role.TEST_HELPER, compileAt = 4, warmup = 1, warmupArgs = { "<t><hi><t><h><hit<t><hit>", "<hit>" }) |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
313 |
static int indexOf_match_at_end_of_string_unknown_needle(String s, String needle) { |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
314 |
int index = s.indexOf(needle); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
315 |
return index; |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
316 |
} |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
317 |
|
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
318 |
@Test(role = Role.TEST_HELPER, compileAt = 4, warmup = 1, warmupArgs = { "<t><hi><t><h><hit<t><hit>" }) |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
319 |
static int indexOf_match_at_end_of_string_imm_needle(String s) { |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
320 |
int index = s.indexOf("<hit>"); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
321 |
return index; |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
322 |
} |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
323 |
|
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
324 |
@Test(role = Role.TEST_HELPER, compileAt = 4, warmup = 1, warmupArgs = { "<t><hi><t><h><hit<t><hit>" }) |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
325 |
static int indexOf_match_at_end_of_string_imm2_needle(String s) { |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
326 |
int index = s.indexOf("<h"); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
327 |
return index; |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
328 |
} |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
329 |
|
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
330 |
@Test(role = Role.TEST_HELPER, compileAt = 4, warmup = 1, warmupArgs = { "<t><hi><t><h><hit<t><hit>" }) |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
331 |
static int indexOf_match_at_end_of_string_imm1_needle(String s) { |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
332 |
int index = s.indexOf("h"); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
333 |
return index; |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
334 |
} |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
335 |
|
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
336 |
static String s0_1 = text3.substring(0, len3-1); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
337 |
static String s0_2 = text3.substring(0, len3-2); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
338 |
static String s0_3 = text3.substring(0, len3-3); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
339 |
static String s0_4 = text3.substring(0, len3-4); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
340 |
static String s1_1 = text4.substring(0, len4-1); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
341 |
static String s1_2 = text4.substring(0, len4-2); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
342 |
static String s1_3 = text4.substring(0, len4-3); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
343 |
static String s1_4 = text4.substring(0, len4-4); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
344 |
static String s2_1 = text5.substring(0, len5-1); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
345 |
static String s2_2 = text5.substring(0, len5-2); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
346 |
static String s2_3 = text5.substring(0, len5-3); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
347 |
static String s2_4 = text5.substring(0, len5-4); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
348 |
static String s3_1 = text6.substring(0, len6-1); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
349 |
static String s3_2 = text6.substring(0, len6-2); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
350 |
static String s3_3 = text6.substring(0, len6-3); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
351 |
static String s3_4 = text6.substring(0, len6-4); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
352 |
|
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
353 |
static String s0_1x = text7 .substring(0, text7 .length()-1); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
354 |
static String s1_1x = text8 .substring(0, text8 .length()-1); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
355 |
static String s2_1x = text9 .substring(0, text9 .length()-1); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
356 |
static String s3_1x = text10.substring(0, text10.length()-1); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
357 |
|
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
358 |
@Test(role = Role.TEST_ENTRY) |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
359 |
public static void test_indexOf_match_spans_end_of_string() { |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
360 |
String res = null; |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
361 |
res = indexOf_match_spans_end_of_string_unknown_needle(s0_1, "<hit>"); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
362 |
assertEquals(res, null, "test_indexOf_match_spans_end_of_string_unknown_needle s0_1 " + res); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
363 |
res = indexOf_match_spans_end_of_string_unknown_needle(s0_2, "<hit>"); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
364 |
assertEquals(res, null, "test_indexOf_match_spans_end_of_string_unknown_needle s0_2 " + res); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
365 |
res = indexOf_match_spans_end_of_string_unknown_needle(s0_3, "<hit>"); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
366 |
assertEquals(res, null, "test_indexOf_match_spans_end_of_string_unknown_needle s0_3 " + res); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
367 |
res = indexOf_match_spans_end_of_string_unknown_needle(s0_4, "<hit>"); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
368 |
assertEquals(res, null, "test_indexOf_match_spans_end_of_string_unknown_needle s0_4 " + res); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
369 |
res = indexOf_match_spans_end_of_string_unknown_needle(s1_1, "<hit>"); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
370 |
assertEquals(res, null, "test_indexOf_match_spans_end_of_string_unknown_needle s1_1 " + res); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
371 |
res = indexOf_match_spans_end_of_string_unknown_needle(s1_2, "<hit>"); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
372 |
assertEquals(res, null, "test_indexOf_match_spans_end_of_string_unknown_needle s1_2 " + res); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
373 |
res = indexOf_match_spans_end_of_string_unknown_needle(s1_3, "<hit>"); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
374 |
assertEquals(res, null, "test_indexOf_match_spans_end_of_string_unknown_needle s1_3 " + res); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
375 |
res = indexOf_match_spans_end_of_string_unknown_needle(s1_4, "<hit>"); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
376 |
assertEquals(res, null, "test_indexOf_match_spans_end_of_string_unknown_needle s1_4 " + res); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
377 |
res = indexOf_match_spans_end_of_string_unknown_needle(s2_1, "<hit>"); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
378 |
assertEquals(res, null, "test_indexOf_match_spans_end_of_string_unknown_needle s2_1 " + res); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
379 |
res = indexOf_match_spans_end_of_string_unknown_needle(s2_2, "<hit>"); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
380 |
assertEquals(res, null, "test_indexOf_match_spans_end_of_string_unknown_needle s2_2 " + res); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
381 |
res = indexOf_match_spans_end_of_string_unknown_needle(s2_3, "<hit>"); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
382 |
assertEquals(res, null, "test_indexOf_match_spans_end_of_string_unknown_needle s2_3 " + res); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
383 |
res = indexOf_match_spans_end_of_string_unknown_needle(s2_4, "<hit>"); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
384 |
assertEquals(res, null, "test_indexOf_match_spans_end_of_string_unknown_needle s2_4 " + res); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
385 |
res = indexOf_match_spans_end_of_string_unknown_needle(s3_1, "<hit>"); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
386 |
assertEquals(res, null, "test_indexOf_match_spans_end_of_string_unknown_needle s3_1 " + res); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
387 |
res = indexOf_match_spans_end_of_string_unknown_needle(s3_2, "<hit>"); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
388 |
assertEquals(res, null, "test_indexOf_match_spans_end_of_string_unknown_needle s3_2 " + res); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
389 |
res = indexOf_match_spans_end_of_string_unknown_needle(s3_3, "<hit>"); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
390 |
assertEquals(res, null, "test_indexOf_match_spans_end_of_string_unknown_needle s3_3 " + res); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
391 |
res = indexOf_match_spans_end_of_string_unknown_needle(s3_4, "<hit>"); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
392 |
assertEquals(res, null, "test_indexOf_match_spans_end_of_string_unknown_needle s3_4 " + res); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
393 |
|
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
394 |
res = indexOf_match_spans_end_of_string_imm_needle(s0_1); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
395 |
assertEquals(res, null, "test_indexOf_match_spans_end_of_string_imm_needle s0_1 " + res); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
396 |
res = indexOf_match_spans_end_of_string_imm_needle(s0_2); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
397 |
assertEquals(res, null, "test_indexOf_match_spans_end_of_string_imm_needle s0_2 " + res); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
398 |
res = indexOf_match_spans_end_of_string_imm_needle(s0_3); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
399 |
assertEquals(res, null, "test_indexOf_match_spans_end_of_string_imm_needle s0_3 " + res); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
400 |
res = indexOf_match_spans_end_of_string_imm_needle(s0_4); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
401 |
assertEquals(res, null, "test_indexOf_match_spans_end_of_string_imm_needle s0_4 " + res); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
402 |
res = indexOf_match_spans_end_of_string_imm_needle(s1_1); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
403 |
assertEquals(res, null, "test_indexOf_match_spans_end_of_string_imm_needle s1_1 " + res); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
404 |
res = indexOf_match_spans_end_of_string_imm_needle(s1_2); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
405 |
assertEquals(res, null, "test_indexOf_match_spans_end_of_string_imm_needle s1_2 " + res); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
406 |
res = indexOf_match_spans_end_of_string_imm_needle(s1_3); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
407 |
assertEquals(res, null, "test_indexOf_match_spans_end_of_string_imm_needle s1_3 " + res); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
408 |
res = indexOf_match_spans_end_of_string_imm_needle(s1_4); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
409 |
assertEquals(res, null, "test_indexOf_match_spans_end_of_string_imm_needle s1_4 " + res); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
410 |
res = indexOf_match_spans_end_of_string_imm_needle(s2_1); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
411 |
assertEquals(res, null, "test_indexOf_match_spans_end_of_string_imm_needle s2_1 " + res); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
412 |
res = indexOf_match_spans_end_of_string_imm_needle(s2_2); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
413 |
assertEquals(res, null, "test_indexOf_match_spans_end_of_string_imm_needle s2_2 " + res); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
414 |
res = indexOf_match_spans_end_of_string_imm_needle(s2_3); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
415 |
assertEquals(res, null, "test_indexOf_match_spans_end_of_string_imm_needle s2_3 " + res); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
416 |
res = indexOf_match_spans_end_of_string_imm_needle(s2_4); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
417 |
assertEquals(res, null, "test_indexOf_match_spans_end_of_string_imm_needle s2_4 " + res); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
418 |
res = indexOf_match_spans_end_of_string_imm_needle(s3_1); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
419 |
assertEquals(res, null, "test_indexOf_match_spans_end_of_string_imm_needle s3_1 " + res); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
420 |
res = indexOf_match_spans_end_of_string_imm_needle(s3_2); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
421 |
assertEquals(res, null, "test_indexOf_match_spans_end_of_string_imm_needle s3_2 " + res); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
422 |
res = indexOf_match_spans_end_of_string_imm_needle(s3_3); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
423 |
assertEquals(res, null, "test_indexOf_match_spans_end_of_string_imm_needle s3_3 " + res); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
424 |
res = indexOf_match_spans_end_of_string_imm_needle(s3_4); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
425 |
assertEquals(res, null, "test_indexOf_match_spans_end_of_string_imm_needle s3_4 " + res); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
426 |
|
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
427 |
res = indexOf_match_spans_end_of_string_imm2_needle(s0_1x); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
428 |
assertEquals(res, null, "test_indexOf_match_spans_end_of_string_imm2_needle s0_1x " + res); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
429 |
res = indexOf_match_spans_end_of_string_imm2_needle(s1_1x); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
430 |
assertEquals(res, null, "test_indexOf_match_spans_end_of_string_imm2_needle s1_1x " + res); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
431 |
res = indexOf_match_spans_end_of_string_imm2_needle(s2_1x); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
432 |
assertEquals(res, null, "test_indexOf_match_spans_end_of_string_imm2_needle s2_1x " + res); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
433 |
res = indexOf_match_spans_end_of_string_imm2_needle(s3_1x); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
434 |
assertEquals(res, null, "test_indexOf_match_spans_end_of_string_imm2_needle s3_1x " + res); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
435 |
} |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
436 |
|
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
437 |
@Test(role = Role.TEST_HELPER, compileAt = 4, warmup = 1, warmupArgs = { "<t><hi><t><h><hit<t><hit", "<hit>" }) |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
438 |
static String indexOf_match_spans_end_of_string_unknown_needle(String s, String needle) { |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
439 |
int index = s.indexOf(needle); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
440 |
if (index > -1) { |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
441 |
return "Found needle \"" + needle + "\" that is spanning the end of the string: " + s + "."; |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
442 |
} |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
443 |
return null; |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
444 |
} |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
445 |
|
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
446 |
@Test(role = Role.TEST_HELPER, compileAt = 4, warmup = 1, warmupArgs = { "<t><hi><t><h><hit<t><hit" }) |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
447 |
static String indexOf_match_spans_end_of_string_imm_needle(String s) { |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
448 |
int index = s.indexOf("<hit>"); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
449 |
if (index > -1) { |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
450 |
return "Found needle \"<hit>\" that is spanning the end of the string: " + s + "."; |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
451 |
} |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
452 |
return null; |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
453 |
} |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
454 |
|
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
455 |
@Test(role = Role.TEST_HELPER, compileAt = 4, warmup = 1, warmupArgs = { "<t><t><t><t><t<t><" }) |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
456 |
static String indexOf_match_spans_end_of_string_imm2_needle(String s) { |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
457 |
int index = s.indexOf("<h"); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
458 |
if (index > -1) { |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
459 |
return "Found needle \"<h\" that is spanning the end of the string: " + s + "."; |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
460 |
} |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
461 |
return null; |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
462 |
} |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
463 |
|
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
464 |
static String text16 = "ooooooo"; |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
465 |
static String text11 = "1ooooooo"; |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
466 |
static String text12 = "ooooooo1"; |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
467 |
static String text13 = "oooooooo1"; |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
468 |
static String text14 = "ooooooooo1"; |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
469 |
static String text15 = "oooooooooo1"; |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
470 |
static int len12 = text12.length(); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
471 |
static int len13 = text13.length(); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
472 |
static int len14 = text14.length(); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
473 |
static int len15 = text15.length(); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
474 |
|
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
475 |
static String text12_1 = text12.substring(0, len12-1); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
476 |
static String text13_1 = text13.substring(0, len13-1); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
477 |
static String text14_1 = text14.substring(0, len14-1); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
478 |
static String text15_1 = text15.substring(0, len15-1); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
479 |
|
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
480 |
@Test(role = Role.TEST_ENTRY) |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
481 |
public static void test_indexOf_imm1_needle() { |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
482 |
assertEquals( -1, indexOf_imm1_needle(text16), "test_indexOf_imm1_needle no_match"); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
483 |
|
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
484 |
assertEquals( 0, indexOf_imm1_needle(text11), "test_indexOf_imm1_needle first_matches"); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
485 |
|
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
486 |
assertEquals(len12-1, indexOf_imm1_needle(text12), "test_indexOf_imm1_needle last_matches"); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
487 |
assertEquals(len13-1, indexOf_imm1_needle(text13), "test_indexOf_imm1_needle last_matches"); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
488 |
assertEquals(len14-1, indexOf_imm1_needle(text14), "test_indexOf_imm1_needle last_matches"); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
489 |
assertEquals(len15-1, indexOf_imm1_needle(text15), "test_indexOf_imm1_needle last_matches"); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
490 |
|
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
491 |
assertEquals( -1, indexOf_imm1_needle(text12_1), "test_indexOf_imm1_needle walked_past"); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
492 |
assertEquals( -1, indexOf_imm1_needle(text13_1), "test_indexOf_imm1_needle walked_past"); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
493 |
assertEquals( -1, indexOf_imm1_needle(text14_1), "test_indexOf_imm1_needle walked_past"); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
494 |
assertEquals( -1, indexOf_imm1_needle(text15_1), "test_indexOf_imm1_needle walked_past"); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
495 |
} |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
496 |
|
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
497 |
@Test(role = Role.TEST_HELPER, compileAt = 4, warmup = 1, warmupArgs = { "ooooooo1" }) |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
498 |
static int indexOf_imm1_needle(String s) { |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
499 |
return s.indexOf("1"); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
500 |
} |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
501 |
|
36303
6241574f5982
8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents:
36064
diff
changeset
|
502 |
static String text1UTF16 = "A" + "\u05d0" + "\u05d1" + "B"; |
6241574f5982
8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents:
36064
diff
changeset
|
503 |
|
6241574f5982
8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents:
36064
diff
changeset
|
504 |
@Test(role = Role.TEST_ENTRY) |
6241574f5982
8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents:
36064
diff
changeset
|
505 |
public static void test_indexOf_immUTF16() { |
6241574f5982
8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents:
36064
diff
changeset
|
506 |
assertEquals( 3, indexOf_imm1Latin1_needle(text1UTF16), "test_indexOf_immUTF16"); |
6241574f5982
8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents:
36064
diff
changeset
|
507 |
assertEquals( 1, indexOf_imm1UTF16_needle(text1UTF16), "test_indexOf_immUTF16"); |
6241574f5982
8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents:
36064
diff
changeset
|
508 |
assertEquals( 1, indexOf_immUTF16_needle(text1UTF16), "test_indexOf_immUTF16"); |
6241574f5982
8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents:
36064
diff
changeset
|
509 |
} |
6241574f5982
8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents:
36064
diff
changeset
|
510 |
|
6241574f5982
8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents:
36064
diff
changeset
|
511 |
@Test(role = Role.TEST_HELPER, compileAt = 4, warmup = 1, warmupArgs = { "A" + "\u05d0" + "\u05d1" + "B" }) |
6241574f5982
8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents:
36064
diff
changeset
|
512 |
static int indexOf_imm1Latin1_needle(String s) { |
6241574f5982
8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents:
36064
diff
changeset
|
513 |
return s.indexOf("B"); |
6241574f5982
8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents:
36064
diff
changeset
|
514 |
} |
6241574f5982
8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents:
36064
diff
changeset
|
515 |
|
6241574f5982
8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents:
36064
diff
changeset
|
516 |
@Test(role = Role.TEST_HELPER, compileAt = 4, warmup = 1, warmupArgs = { "A" + "\u05d0" + "\u05d1" + "B" }) |
6241574f5982
8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents:
36064
diff
changeset
|
517 |
static int indexOf_imm1UTF16_needle(String s) { |
6241574f5982
8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents:
36064
diff
changeset
|
518 |
return s.indexOf("\u05d0"); |
6241574f5982
8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents:
36064
diff
changeset
|
519 |
} |
6241574f5982
8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents:
36064
diff
changeset
|
520 |
|
6241574f5982
8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents:
36064
diff
changeset
|
521 |
@Test(role = Role.TEST_HELPER, compileAt = 4, warmup = 1, warmupArgs = { "A" + "\u05d0" + "\u05d1" + "B" }) |
6241574f5982
8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents:
36064
diff
changeset
|
522 |
static int indexOf_immUTF16_needle(String s) { |
6241574f5982
8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents:
36064
diff
changeset
|
523 |
return s.indexOf("\u05d0" + "\u05d1"); |
6241574f5982
8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents:
36064
diff
changeset
|
524 |
} |
35581
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
525 |
|
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
526 |
@Test(role = Role.TEST_HELPER, compileAt = 4, warmup = 1, warmupArgs = { "abc", "abcd" }) |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
527 |
public static int asmStringCompareTo(String a, String b) { |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
528 |
return a.compareTo(b); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
529 |
} |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
530 |
|
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
531 |
@Test(role = Role.TEST_ENTRY) |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
532 |
public static void test_asmStringCompareTo() { |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
533 |
// null |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
534 |
try { |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
535 |
asmStringCompareTo("not null", null); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
536 |
assertTrue(false, |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
537 |
"TestOther.asmStringCompareTo(\"not null\", null) doesn't throw exception"); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
538 |
} catch (NullPointerException e) { |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
539 |
assertEquals("java.lang.String.compareTo", |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
540 |
e.getStackTrace()[0].getClassName() + "." + |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
541 |
e.getStackTrace()[0].getMethodName(), |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
542 |
"TestOther.asmStringCompareTo(\"not null\", null) throws exception"); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
543 |
} |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
544 |
|
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
545 |
// ==0 |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
546 |
{ |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
547 |
// check length 0 optimization |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
548 |
assertEquals(0, asmStringCompareTo("", ""), |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
549 |
"TestOther.asmStringCompareTo(\"\", \"\")"); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
550 |
|
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
551 |
// check first character optimization |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
552 |
assertEquals(0, asmStringCompareTo("A", "A"), |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
553 |
"TestOther.asmStringCompareTo(\"A\", \"A\")"); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
554 |
|
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
555 |
// check real comparisons |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
556 |
assertEquals(0, asmStringCompareTo(new String("eq") + new String("ual"), "equal"), |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
557 |
"TestOther.asmStringCompareTo(\"equal\", \"equal\")"); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
558 |
assertEquals(0, asmStringCompareTo("textABC", "textABC"), |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
559 |
"TestOther.asmStringCompareTo(\"textABC\", \"textABC\")"); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
560 |
assertEquals(0, |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
561 |
asmStringCompareTo(new String("abcdefgh01234") + |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
562 |
new String("56abcdefgh0123456abcdefgh0123456"), |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
563 |
"abcdefgh0123456abcdefgh0123456abcdefgh0123456"), |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
564 |
"TestOther.asmStringCompareTo(\"abcdefgh0123456abcdefgh0123456abcdefgh0123456\", " + |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
565 |
"\"abcdefgh0123456abcdefgh0123456abcdefgh0123456\")"); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
566 |
} |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
567 |
|
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
568 |
// <0 |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
569 |
{ |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
570 |
// check first character optimization |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
571 |
assertEquals(-1, asmStringCompareTo("4", "5"), |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
572 |
"TestOther.asmStringCompareTo(\"4\", \"5\")"); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
573 |
|
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
574 |
// check real comparisons |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
575 |
assertEquals(-1, asmStringCompareTo("diff4", "diff5"), |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
576 |
"TestOther.asmStringCompareTo(\"diff4\", \"diff5\")"); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
577 |
assertEquals(-10, asmStringCompareTo("", "123456789A"), |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
578 |
"TestOther.asmStringCompareTo(\"\", \"123456789A\")"); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
579 |
assertEquals(-10, asmStringCompareTo("ZYX", "ZYX123456789A"), |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
580 |
"TestOther.asmStringCompareTo(\"ZYX\", \"ZYX123456789A\")"); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
581 |
} |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
582 |
|
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
583 |
// >0 |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
584 |
{ |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
585 |
// check first character optimization |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
586 |
assertEquals(1, asmStringCompareTo("5", "4"), |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
587 |
"TestOther.asmStringCompareTo(\"5\", \"4\")"); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
588 |
|
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
589 |
// check real comparisons |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
590 |
assertEquals(1, asmStringCompareTo("diff5", "diff4"), |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
591 |
"TestOther.asmStringCompareTo(\"diff5\", \"diff4\")"); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
592 |
assertEquals(10, asmStringCompareTo("123456789A", ""), |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
593 |
"TestOther.asmStringCompareTo(\"123456789A\", \"\")"); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
594 |
assertEquals(10, asmStringCompareTo("ZYX123456789A", "ZYX"), |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
595 |
"TestOther.asmStringCompareTo(\"ZYX123456789A\", \"ZYX\")"); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
596 |
} |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
597 |
|
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
598 |
// very long strings (100k) |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
599 |
{ |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
600 |
char[] ac = new char[(100 * 1024)]; |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
601 |
for (int i = 0; i < (100 * 1024); i += 315) |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
602 |
ac[i] = (char) ((i % 12) + 'a'); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
603 |
char[] bc = new char[(100 * 1024)]; |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
604 |
for (int i = 0; i < (100 * 1024); i += 315) |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
605 |
bc[i] = (char) ((i % 12) + 'a'); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
606 |
|
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
607 |
ac[(100 * 1024) - 1] = '2'; |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
608 |
bc[(100 * 1024) - 1] = '2'; |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
609 |
String a1 = new String(ac); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
610 |
String b1 = new String(bc); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
611 |
assertEquals(0, asmStringCompareTo(a1, b1), |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
612 |
"TestOther.asmStringCompareTo(very_long_strings_1)"); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
613 |
|
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
614 |
ac[(100 * 1024) - 1] = 'X'; |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
615 |
bc[(100 * 1024) - 1] = 'Z'; |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
616 |
String a2 = new String(ac); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
617 |
String b2 = new String(bc); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
618 |
assertEquals(-2, asmStringCompareTo(a2, b2), |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
619 |
"TestOther.asmStringCompareTo(very_long_strings_2)"); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
620 |
} |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
621 |
|
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
622 |
// very very long strings (2M) |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
623 |
{ |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
624 |
char[] ac = new char[(2 * 1024 * 1024)]; |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
625 |
for (int i = 0; i < (2 * 1024 * 1024); i += 315) |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
626 |
ac[i] = (char) ((i % 12) + 'a'); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
627 |
char[] bc = new char[(2 * 1024 * 1024)]; |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
628 |
for (int i = 0; i < (2 * 1024 * 1024); i += 315) |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
629 |
bc[i] = (char) ((i % 12) + 'a'); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
630 |
|
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
631 |
ac[(2 * 1024 * 1024) - 1] = '3'; |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
632 |
bc[(2 * 1024 * 1024) - 1] = '3'; |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
633 |
String a1 = new String(ac); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
634 |
String b1 = new String(bc); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
635 |
assertEquals(0, asmStringCompareTo(a1, b1), |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
636 |
"TestOther.asmStringCompareTo(very_very_long_strings_1)"); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
637 |
|
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
638 |
ac[(2 * 1024 * 1024) - 1] = 'W'; |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
639 |
bc[(2 * 1024 * 1024) - 1] = 'Z'; |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
640 |
String a2 = new String(ac); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
641 |
String b2 = new String(bc); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
642 |
assertEquals(-3, asmStringCompareTo(a2, b2), |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
643 |
"TestOther.asmStringCompareTo(very_very_long_strings_2)"); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
644 |
} |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
645 |
} |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
646 |
|
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
647 |
|
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
648 |
@Test(role = Role.TEST_HELPER, compileAt = 4, warmup = 1, warmupArgs = { "abc", "abcd" }) |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
649 |
public static boolean asmStringEquals(String a, String b) { |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
650 |
return a.equals(b); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
651 |
} |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
652 |
|
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
653 |
static String a1 = "abcd"; |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
654 |
static String b1 = "abcd"; |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
655 |
static final String a2 = "1234"; |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
656 |
static final String b2 = "1234"; |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
657 |
|
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
658 |
@Test(role = Role.TEST_HELPER, compileAt = 4, warmup = 1) |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
659 |
public static boolean asmStringEqualsConst() { |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
660 |
boolean ret = a1.equals(b1); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
661 |
ret &= a2.equals(b2); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
662 |
ret &= !a2.equals(b1); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
663 |
ret &= "ABCD".equals("ABCD"); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
664 |
return ret; |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
665 |
} |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
666 |
|
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
667 |
|
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
668 |
@Test(role = Role.TEST_ENTRY) |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
669 |
public static void test_asmStringEquals() { |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
670 |
// null |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
671 |
{ |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
672 |
assertFalse(asmStringEquals("not null", null), |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
673 |
"TestOther.asmStringEquals(\"not null\", null)"); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
674 |
} |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
675 |
|
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
676 |
// true |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
677 |
{ |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
678 |
// check constant optimization |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
679 |
assertTrue(asmStringEqualsConst(), |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
680 |
"TestOther.asmStringEqualsConst(\"\", \"\")"); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
681 |
|
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
682 |
// check length 0 optimization |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
683 |
assertTrue(asmStringEquals("", ""), |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
684 |
"TestOther.asmStringEquals(\"\", \"\")"); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
685 |
|
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
686 |
// check first character optimization |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
687 |
assertTrue(asmStringEquals("A", "A"), |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
688 |
"TestOther.asmStringEquals(\"A\", \"A\")"); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
689 |
|
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
690 |
// check real comparisons |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
691 |
assertTrue(asmStringEquals(new String("eq") + new String("ual"), "equal"), |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
692 |
"TestOther.asmStringEquals(\"equal\", \"equal\")"); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
693 |
assertTrue(asmStringEquals("textABC", "textABC"), |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
694 |
"TestOther.asmStringEquals(\"textABC\", \"textABC\")"); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
695 |
assertTrue(asmStringEquals(new String("abcdefgh01234") + |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
696 |
new String("56abcdefgh0123456abcdefgh0123456"), |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
697 |
"abcdefgh0123456abcdefgh0123456abcdefgh0123456"), |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
698 |
"TestOther.asmStringEquals(\"abcdefgh0123456abcdefgh0123456abcdefgh0123456\", " + |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
699 |
"\"abcdefgh0123456abcdefgh0123456abcdefgh0123456\")"); |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
700 |
} |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
701 |
} |
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
702 |
|
dd47cf4734f2
8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents:
diff
changeset
|
703 |
} |