11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 * version 2 for more details (a copy is included in the LICENSE file that
14 * accompanied this code).
15 *
16 * You should have received a copy of the GNU General Public License version
17 * 2 along with this work; if not, write to the Free Software Foundation,
18 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
19 *
20 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
21 * or visit www.oracle.com if you need additional information or have any
22 * questions.
23 */
24
25 /*
26 * @test
27 * @bug 8145336
28 * @summary PPC64: fix string intrinsics after CompactStrings change
29 * @modules java.base/jdk.internal.misc
30 * @library /testlibrary /test/lib
31 * @build sun.hotspot.WhiteBox
32 * @run main ClassFileInstaller sun.hotspot.WhiteBox
33 * sun.hotspot.WhiteBox$WhiteBoxPermission
34 *
35 * @run main/othervm
36 * -Xbootclasspath/a:.
37 * -Xmixed
38 * -XX:+UnlockDiagnosticVMOptions
39 * -XX:+WhiteBoxAPI
40 * -XX:MaxInlineSize=70
41 * -XX:MinInliningThreshold=0
42 * TestStringIntrinsics2
43 */
44
45 import java.lang.annotation.ElementType;
46 import java.lang.annotation.RetentionPolicy;
47 import java.lang.annotation.Retention;
48 import java.lang.annotation.Target;
49 import java.lang.reflect.Method;
50 import java.util.Arrays;
51 import java.util.function.Consumer;
52 import java.util.function.Function;
53
54 import static jdk.test.lib.Asserts.*;
55 import sun.hotspot.WhiteBox;
56
57 public class TestStringIntrinsics2 {
58 // ------------------------------------------------------------------------
59 //
60 // We test the following cases:
61 // - no match in string. Do we miss the end condition? Will crash if we read
62 // past the string.
63 // - no match in string, but after the string there is a match.
64 // Do we incorrectly report this match? We had a case where we stepped
65 // a few chars past the string, this test would report that error. The
66 // one above would not.
67 // - The needle is exactly at the end of the string.
68 // - The needle spans the end of the string
69 //
70 // A special case are needles of length 1. For these we test:
71 // - needle is first char
72 // - needle is last char
73 // - no match
74 // - match behind string.
75 //
|
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 * version 2 for more details (a copy is included in the LICENSE file that
14 * accompanied this code).
15 *
16 * You should have received a copy of the GNU General Public License version
17 * 2 along with this work; if not, write to the Free Software Foundation,
18 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
19 *
20 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
21 * or visit www.oracle.com if you need additional information or have any
22 * questions.
23 */
24
25 /*
26 * @test
27 * @bug 8145336
28 * @summary PPC64: fix string intrinsics after CompactStrings change
29 * @modules java.base/jdk.internal.misc
30 * @library /testlibrary /test/lib
31 *
32 * @build sun.hotspot.WhiteBox
33 * @run driver ClassFileInstaller sun.hotspot.WhiteBox
34 * sun.hotspot.WhiteBox$WhiteBoxPermission
35 *
36 * @run main/othervm
37 * -Xbootclasspath/a:.
38 * -Xmixed
39 * -XX:+UnlockDiagnosticVMOptions
40 * -XX:+WhiteBoxAPI
41 * -XX:MaxInlineSize=70
42 * -XX:MinInliningThreshold=0
43 * compiler.intrinsics.string.TestStringIntrinsics2
44 */
45
46 package compiler.intrinsics.string;
47
48 import sun.hotspot.WhiteBox;
49
50 import java.lang.annotation.ElementType;
51 import java.lang.annotation.Retention;
52 import java.lang.annotation.RetentionPolicy;
53 import java.lang.annotation.Target;
54 import java.util.Arrays;
55 import java.util.function.Consumer;
56
57 import static jdk.test.lib.Asserts.assertEquals;
58 import static jdk.test.lib.Asserts.assertFalse;
59 import static jdk.test.lib.Asserts.assertTrue;
60
61 public class TestStringIntrinsics2 {
62 // ------------------------------------------------------------------------
63 //
64 // We test the following cases:
65 // - no match in string. Do we miss the end condition? Will crash if we read
66 // past the string.
67 // - no match in string, but after the string there is a match.
68 // Do we incorrectly report this match? We had a case where we stepped
69 // a few chars past the string, this test would report that error. The
70 // one above would not.
71 // - The needle is exactly at the end of the string.
72 // - The needle spans the end of the string
73 //
74 // A special case are needles of length 1. For these we test:
75 // - needle is first char
76 // - needle is last char
77 // - no match
78 // - match behind string.
79 //
|