Mercurial > hg > release > icedtea6-1.11
changeset 2637:b3627e530d7c
Merge
author | Andrew John Hughes <ahughes@redhat.com> |
---|---|
date | Wed, 09 Mar 2011 23:47:23 +0000 |
parents | 611a31a7c5a1 (current diff) 4cbe17b91cc8 (diff) |
children | 15ee0af0207b |
files | ChangeLog Makefile.am patches/jamvm/ignore-more-XX-options.patch |
diffstat | 10 files changed, 862 insertions(+), 47 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Thu Mar 03 12:32:40 2011 +0000 +++ b/ChangeLog Wed Mar 09 23:47:23 2011 +0000 @@ -1,3 +1,63 @@ +2011-03-09 Pavel Tisnovsky <ptisnovs@redhat.com> + + * Makefile.am: Add new patch. + * patches/jtreg-double-to-string.patch: + Patch which adds more test cases to test + java/lang/Double/ToString + +2011-03-08 Pavel Tisnovsky <ptisnovs@redhat.com> + + * patches/jtreg-hotspot-bug-6196102.patch: + Fixed number of patched lines. + +2011-03-08 Pavel Tisnovsky <ptisnovs@redhat.com> + + * Makefile.am: Add new patch. + * patches/jtreg-hotspot-bug-6196102.patch: + Added new hotspot regresion test. + +2011-03-08 Pavel Tisnovsky <ptisnovs@redhat.com> + + * Makefile.am: + Added checking of JTreg results - if at least one + regression test failed, make exits with error code + * NEWS: Updated, added PR637 to a list of bug fixes. + +2011-03-07 Omair Majid <omajid@redhat.com> + + * Makefile.am (ICEDTEA_PATCHES): Apply + patches/jtreg-remove-test-6987555.patch and + patches/jtreg-remove-test-6991596.patch only on ALT_HSBUILD. + +2011-03-07 Pavel Tisnovsky <ptisnovs@redhat.com> + + * Makefile.am: Added two new patches. + * patches/jtreg-remove-test-6987555.patch: + Patch to remove regression test + hotspot/test/compiler/6987555/Test6987555 + which is not valid for OpenJDK6 + * patches/jtreg-remove-test-6991596.patch: + Patch to remove regression test + hotspot/test/compiler/6991596/Test6991596 + which is not valid for OpenJDK6 + +2011-02-24 Matthias Klose <doko@ubuntu.com> + + * Makefile.am (jtregcheck): Allow setting which tests to run. + +2011-03-04 Xerxes Ranby <xerxes@zafena.se> + + CACAO: Ignore all unknown options. + * Makefile.am: Add CACAO patch. + * patches/cacao/ignore-unknown-options.patch: Added. + +2011-03-03 Xerxes Ranby <xerxes@zafena.se> + + JamVM: Ignore all unknown options. + * Makefile.am: Replaced JamVM patch. + * patches/jamvm/ignore-more-XX-options.patch: Removed. + * patches/jamvm/ignore-unknown-options.patch: Added. + 2011-03-03 Andrew John Hughes <ahughes@redhat.com> * Makefile.am:
--- a/Makefile.am Thu Mar 03 12:32:40 2011 +0000 +++ b/Makefile.am Wed Mar 09 23:47:23 2011 +0000 @@ -324,12 +324,16 @@ patches/openjdk/6766342-AA-simple-shape-performance.patch \ patches/openjdk/7016856-pisces-performance.patch \ patches/openjdk/6934977-MappedByteBuffer.load.patch \ - patches/jaxp-serial-version-uid.patch + patches/jaxp-serial-version-uid.patch \ + patches/jtreg-hotspot-bug-6196102.patch \ + patches/jtreg-double-to-string.patch if WITH_ALT_HSBUILD ICEDTEA_PATCHES += \ patches/pr639-broken_shark_build.patch \ - patches/hotspot/$(HSBUILD)/powerpc-stacksize.patch + patches/hotspot/$(HSBUILD)/powerpc-stacksize.patch \ + patches/jtreg-remove-test-6987555.patch \ + patches/jtreg-remove-test-6991596.patch else ICEDTEA_PATCHES += \ patches/hotspot/$(HSBUILD)/no-precompiled-headers.patch \ @@ -347,7 +351,8 @@ patches/cacao/launcher.patch \ patches/cacao/arm-arch-defines.patch \ patches/cacao/jsig.patch \ - patches/cacao/memory.patch + patches/cacao/memory.patch \ + patches/cacao/ignore-unknown-options.patch endif if ENABLE_CACAO @@ -358,7 +363,7 @@ if BUILD_JAMVM ICEDTEA_PATCHES += \ - patches/jamvm/ignore-more-XX-options.patch + patches/jamvm/ignore-unknown-options.patch endif if ENABLE_PULSE_JAVA @@ -622,7 +627,8 @@ clean-rewriter clean-rewrite-rhino clean-add-systemtap clean-add-systemtap-debug \ clean-add-pulseaudio clean-add-pulseaudio-debug clean-add-nss clean-add-nss-debug \ clean-add-tzdata-support clean-add-tzdata-support-debug clean-add-systemtap-ecj \ - clean-add-pulseaudio-ecj clean-add-nss-ecj clean-add-tzdata-support-ecj clean-fonts + clean-add-pulseaudio-ecj clean-add-nss-ecj clean-add-tzdata-support-ecj clean-fonts \ + jtregcheck-summary env: @echo 'unset JAVA_HOME' @@ -2069,6 +2075,7 @@ $(ICEDTEA_JTREG_OPTIONS) \ `pwd`/openjdk/hotspot/test \ | tee test/$@.log + test -z `grep "^Error:\|^FAILED:" test/$@.log` check-langtools: stamps/jtreg.stamp mkdir -p test/langtools/JTwork test/langtools/JTreport @@ -2079,6 +2086,7 @@ $(ICEDTEA_JTREG_OPTIONS) \ `pwd`/openjdk/langtools/test \ | tee test/$@.log + test -z `grep "^Error:\|^FAILED:" test/$@.log` check-jdk: stamps/jtreg.stamp mkdir -p test/jdk/JTwork test/jdk/JTreport @@ -2095,6 +2103,7 @@ $(ICEDTEA_JTREG_OPTIONS) \ `pwd`/openjdk/jdk/test \ | tee test/$@.log + test -z `grep "^Error:\|^FAILED:" test/$@.log` clean-jtreg-reports: rm -rf test/hotspot test/langtools test/jdk @@ -2107,8 +2116,13 @@ jtreg_pids = ps x --no-headers -ww -o pid,ppid,args \ | awk '$$2 == 1 && $$3 ~ /^$(subst /,\/,$(CURDIR)/$(sdkimg))/ {print $$1}' -jtregcheck: jtreg check-hotspot check-langtools check-jdk +jtreg_checks = hotspot langtools jdk + +jtregcheck: jtreg $(jtreg_checks:%=check-%) jtregcheck-summary + +jtregcheck-summary: for i in hotspot langtools jdk; do \ + touch test/check-$$i.log; \ echo "--------------- jtreg console summary for $$i ---------------"; \ egrep -v '^(Passed:|Directory|Re[a-z]+\ written\ to)' test/check-$$i.log; \ done | tee test/jtreg-summary.log
--- a/NEWS Thu Mar 03 12:32:40 2011 +0000 +++ b/NEWS Wed Mar 09 23:47:23 2011 +0000 @@ -11,6 +11,13 @@ New in release 1.11 (2011-XX-XX): * Use HotSpot 20 as the default virtual machine. +* Bug fixes + - PR637: make check should exit with an error code if any of regression test + failed. Use make check -k if you want to run all three test suites. And it + is now also possible to run individual jtreg testsuite (jdk,langtools and + hotspot) with the jtreg_checks argument: + make check jtreg_checks="langtools hotspot". + If none is provided make check runs all testsuites. New in release 1.10 (2011-XX-XX):
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/cacao/ignore-unknown-options.patch Wed Mar 09 23:47:23 2011 +0000 @@ -0,0 +1,17 @@ +Index: cacao/cacao/src/vm/vm.cpp +=================================================================== +--- cacao.orig/cacao/src/vm/vm.cpp 2011-03-04 00:20:24.000000000 +0100 ++++ cacao/cacao/src/vm/vm.cpp 2011-03-04 01:12:45.000000000 +0100 +@@ -1239,9 +1239,10 @@ + + #endif + default: +- printf("Unknown option: %s\n", ++ fprintf(stderr,"Unknown option: %s\n", + vm_args->options[opt_index].optionString); +- usage(); ++ opt_index++; ++ /* Ignore */ + } + } +
--- a/patches/jamvm/ignore-more-XX-options.patch Thu Mar 03 12:32:40 2011 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,41 +0,0 @@ -Index: jamvm/jamvm/src/jni.c -=================================================================== ---- jamvm/jamvm.orig/src/jni.c 2011-02-23 09:54:17.000000000 +0100 -+++ jamvm/jamvm/src/jni.c 2011-02-23 09:58:21.000000000 +0100 -@@ -1638,6 +1638,36 @@ - #endif - /* Compatibility options */ - } else if(strncmp(string, "-XX:PermSize=", 13) == 0 || -+ strncmp(string, "-esa", 4) == 0 || -+ strncmp(string, "-Xbatch", 7) == 0 || -+ strncmp(string, "-Xcomp", 6) == 0 || -+ strncmp(string, "-Xverify:all", 12) == 0 || -+ strncmp(string, "-XX:+AggressiveOpts", 19) == 0 || -+ strncmp(string, "-XX:-BlockLayoutRotateLoops", 27) == 0 || -+ strncmp(string, "-XX:CompileCommand=", 19) == 0 || -+ strncmp(string, "-XX:CompileOnly=", 16) == 0 || -+ strncmp(string, "-XX:CompileThreshold=", 21) == 0 || -+ strncmp(string, "-XX:+DeoptimizeALot", 19) == 0 || -+ strncmp(string, "-XX:+DoEscapeAnalysis", 21) == 0 || -+ strncmp(string, "-XX:HeapBaseMinAddress=", 23) == 0 || -+ strncmp(string, "-XX:+IgnoreUnrecognizedVMOptions", 32) == 0 || -+ strncmp(string, "-XX:-Inline", 11) == 0 || -+ strncmp(string, "-XX:-InlineObjectHash", 21) == 0 || -+ strncmp(string, "-XX:InlineSmallCode=", 20) == 0 || -+ strncmp(string, "-XX:LoopUnrollLimit=", 20) == 0 || -+ strncmp(string, "-XX:-LoopUnswitching", 20) == 0 || -+ strncmp(string, "-XX:MaxInlineSize=", 18) == 0 || -+ strncmp(string, "-XX:+OptimizeFill", 17) == 0 || -+ strncmp(string, "-XX:+PrintCompilation", 21) == 0 || -+ strncmp(string, "-XX:-ProfileInterpreter", 23) == 0 || -+ strncmp(string, "-XX:+ScavengeALot", 17) == 0 || -+ strncmp(string, "-XX:ThreadStackSize=", 20) == 0 || -+ strncmp(string, "-XX:+UnlockDiagnosticVMOptions", 30) == 0 || -+ strncmp(string, "-XX:-UseCompressedOops", 22) == 0 || -+ strncmp(string, "-XX:+UseCompressedOops", 22) == 0 || -+ strncmp(string, "-XX:+UseConcMarkSweepGC", 23) == 0 || -+ strncmp(string, "-XX:UseSSE=", 11) == 0 || -+ strncmp(string, "-XX:+VerifyBeforeGC", 19) == 0 || - strncmp(string, "-XX:MaxPermSize=", 16) == 0) { - /* Ignore */ - } else if(!vm_args->ignoreUnrecognized) {
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/jamvm/ignore-unknown-options.patch Wed Mar 09 23:47:23 2011 +0000 @@ -0,0 +1,13 @@ +Index: jamvm/jamvm/src/jni.c +=================================================================== +--- jamvm.orig/jamvm/src/jni.c 2011-02-27 04:35:37.000000000 +0100 ++++ jamvm/jamvm/src/jni.c 2011-03-03 13:48:31.897900208 +0100 +@@ -1642,7 +1642,7 @@ + /* Ignore */ + } else if(!vm_args->ignoreUnrecognized) { + optError(args, "Unrecognised option: %s\n", string); +- goto error; ++ /* Ignore */ + } + } +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/jtreg-double-to-string.patch Wed Mar 09 23:47:23 2011 +0000 @@ -0,0 +1,48 @@ +--- openjdk-old/jdk/test/java/lang/Double/ToString.java 2011-02-28 10:51:09.454128000 +0100 ++++ openjdk/jdk/test/java/lang/Double/ToString.java 2011-02-28 10:51:09.454128000 +0100 +@@ -23,17 +23,39 @@ + + /* + * @test +- * @bug 4428022 ++ * @bug 4428022 4511638 + * @summary Tests for Double.toString +- * @author Andrew Haley <aph@redhat.com> ++ * @author Andrew Haley <aph@redhat.com>, Pavel Tisnovsky <ptisnovs@redhat.com> + */ + + public class ToString { ++ private static boolean conversionFailure = false; ++ ++ public static void check(double d, String str) { ++ String converted = Double.toString(d); ++ if (!converted.equals(str)) { ++ conversionFailure = true; ++ System.out.println("Double.toString(" + str + ") is not \"" + str + "\" but \"" + converted + "\""); ++ } ++ else { ++ System.out.println("Double value " + str + " converted correctly"); ++ } ++ } + + public static void main(String args[]) { +- if (!Double.toString(0.001).equals("0.001")) +- throw new RuntimeException("Double.toString(0.001) is not \"0.001\""); +- if (!Double.toString(0.002).equals("0.002")) +- throw new RuntimeException("Double.toString(0.001) is not \"0.002\""); ++ check(0.001, "0.001"); ++ check(0.002, "0.002"); ++ check(7.79625120912E289, "7.79625120912E289"); ++ check(1.0E23, "1.0E23"); ++ check(9.999999999999999E22, "1.0E23"); ++ check(8.41E21, "8.41E21"); ++ check(2.0E23, "2.0E23"); ++ check(8.962E21, "8.962E21"); ++ check(7.3879E20, "7.3879E20"); ++ check(3.1E22, "3.1E22"); ++ check(5.63E21, "5.63E21"); ++ if (conversionFailure) { ++ throw new RuntimeException("At least one conversion failure occured"); ++ } + } + }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/jtreg-hotspot-bug-6196102.patch Wed Mar 09 23:47:23 2011 +0000 @@ -0,0 +1,41 @@ +--- /dev/null 1970-01-01 01:00:00.000000000 +0100 ++++ openjdk/hotspot/test/runtime/6196102/LoopTest.java 2011-02-28 22:06:47.654895000 +0100 +@@ -0,0 +1,38 @@ ++/* ++ * Copyright 2011 Red Hat, Inc. All Rights Reserved. ++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. ++ * ++ * This code is free software; you can redistribute it and/or modify it ++ * under the terms of the GNU General Public License version 2 only, as ++ * published by the Free Software Foundation. ++ * ++ * This code is distributed in the hope that it will be useful, but WITHOUT ++ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or ++ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License ++ * version 2 for more details (a copy is included in the LICENSE file that ++ * accompanied this code). ++ * ++ * You should have received a copy of the GNU General Public License version ++ * 2 along with this work; if not, write to the Free Software Foundation, ++ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. ++ */ ++ ++/* ++ * @test LoopTest ++ * @bug 6196102 5091921 ++ * @summary verify that loop control variable is always computed correctly ++ * @run main LoopTest ++ * @author ptisnovs@redhat.com ++*/ ++public class LoopTest { ++ static public void main(String[] args) { ++ int i1 = 0; ++ int i2 = Integer.MAX_VALUE; ++ while (i1 >= 0) { ++ i1++; ++ if (i1 > i2) { ++ throw new RuntimeException("Failed when i1 == " + i1 + " and i2 == " + i2); ++ } ++ } ++ } ++}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/jtreg-remove-test-6987555.patch Wed Mar 09 23:47:23 2011 +0000 @@ -0,0 +1,184 @@ +The regression test openjdk/hotspot/test/compiler/6987555/Test6987555.java is +based on JSR-292 which is not part of OpenJDK6 - this means this test should be +removed. + +--- openjdk/hotspot/test/compiler/6987555/Test6987555.java 2011-02-22 17:51:24.000000000 +0100 ++++ /dev/null 2010-06-29 10:52:54.337250608 +0200 +@@ -1,177 +0,0 @@ +-/* +- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. +- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +- * +- * This code is free software; you can redistribute it and/or modify it +- * under the terms of the GNU General Public License version 2 only, as +- * published by the Free Software Foundation. +- * +- * This code is distributed in the hope that it will be useful, but WITHOUT +- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +- * version 2 for more details (a copy is included in the LICENSE file that +- * accompanied this code). +- * +- * You should have received a copy of the GNU General Public License version +- * 2 along with this work; if not, write to the Free Software Foundation, +- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +- * +- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +- * or visit www.oracle.com if you need additional information or have any +- * questions. +- * +- */ +- +-/** +- * @test +- * @bug 6987555 +- * @summary JSR 292 unboxing to a boolean value fails on big-endian SPARC +- * +- * @run main/othervm -Xint -ea -XX:+UnlockExperimentalVMOptions -XX:+EnableMethodHandles -XX:+EnableInvokeDynamic -XX:+UnlockDiagnosticVMOptions -XX:+VerifyMethodHandles Test6987555 +- */ +- +-import java.dyn.*; +- +-public class Test6987555 { +- private static final Class CLASS = Test6987555.class; +- private static final String NAME = "foo"; +- private static final boolean DEBUG = false; +- +- public static void main(String[] args) throws Throwable { +- testboolean(); +- testbyte(); +- testchar(); +- testshort(); +- testint(); +- } +- +- // boolean +- static void testboolean() throws Throwable { +- doboolean(false); +- doboolean(true); +- } +- static void doboolean(boolean x) throws Throwable { +- if (DEBUG) System.out.println("boolean=" + x); +- MethodHandle mh1 = MethodHandles.lookup().findStatic(CLASS, NAME, MethodType.methodType(boolean.class, boolean.class)); +- MethodHandle mh2 = mh1.asType(MethodType.methodType(boolean.class, Boolean.class)); +- boolean a = mh1.<boolean>invokeExact(x); +- boolean b = mh2.<boolean>invokeExact(Boolean.valueOf(x)); +- assert a == b : a + " != " + b; +- } +- +- // byte +- static void testbyte() throws Throwable { +- byte[] a = new byte[] { +- Byte.MIN_VALUE, +- Byte.MIN_VALUE + 1, +- -0x0F, +- -1, +- 0, +- 1, +- 0x0F, +- Byte.MAX_VALUE - 1, +- Byte.MAX_VALUE +- }; +- for (int i = 0; i < a.length; i++) { +- dobyte(a[i]); +- } +- } +- static void dobyte(byte x) throws Throwable { +- if (DEBUG) System.out.println("byte=" + x); +- MethodHandle mh1 = MethodHandles.lookup().findStatic(CLASS, NAME, MethodType.methodType(byte.class, byte.class)); +- MethodHandle mh2 = mh1.asType(MethodType.methodType(byte.class, Byte.class)); +- byte a = mh1.<byte>invokeExact(x); +- byte b = mh2.<byte>invokeExact(Byte.valueOf(x)); +- assert a == b : a + " != " + b; +- } +- +- // char +- static void testchar() throws Throwable { +- char[] a = new char[] { +- Character.MIN_VALUE, +- Character.MIN_VALUE + 1, +- 0x000F, +- 0x00FF, +- 0x0FFF, +- Character.MAX_VALUE - 1, +- Character.MAX_VALUE +- }; +- for (int i = 0; i < a.length; i++) { +- dochar(a[i]); +- } +- } +- static void dochar(char x) throws Throwable { +- if (DEBUG) System.out.println("char=" + x); +- MethodHandle mh1 = MethodHandles.lookup().findStatic(CLASS, NAME, MethodType.methodType(char.class, char.class)); +- MethodHandle mh2 = mh1.asType(MethodType.methodType(char.class, Character.class)); +- char a = mh1.<char>invokeExact(x); +- char b = mh2.<char>invokeExact(Character.valueOf(x)); +- assert a == b : a + " != " + b; +- } +- +- // short +- static void testshort() throws Throwable { +- short[] a = new short[] { +- Short.MIN_VALUE, +- Short.MIN_VALUE + 1, +- -0x0FFF, +- -0x00FF, +- -0x000F, +- -1, +- 0, +- 1, +- 0x000F, +- 0x00FF, +- 0x0FFF, +- Short.MAX_VALUE - 1, +- Short.MAX_VALUE +- }; +- for (int i = 0; i < a.length; i++) { +- doshort(a[i]); +- } +- } +- static void doshort(short x) throws Throwable { +- if (DEBUG) System.out.println("short=" + x); +- MethodHandle mh1 = MethodHandles.lookup().findStatic(CLASS, NAME, MethodType.methodType(short.class, short.class)); +- MethodHandle mh2 = mh1.asType(MethodType.methodType(short.class, Short.class)); +- short a = mh1.<short>invokeExact(x); +- short b = mh2.<short>invokeExact(Short.valueOf(x)); +- assert a == b : a + " != " + b; +- } +- +- // int +- static void testint() throws Throwable { +- int[] a = new int[] { +- Integer.MIN_VALUE, +- Integer.MIN_VALUE + 1, +- -0x00000FFF, +- -0x000000FF, +- -0x0000000F, +- -1, +- 0, +- 1, +- 0x0000000F, +- 0x000000FF, +- 0x00000FFF, +- Integer.MAX_VALUE - 1, +- Integer.MAX_VALUE +- }; +- for (int i = 0; i < a.length; i++) { +- doint(a[i]); +- } +- } +- static void doint(int x) throws Throwable { +- if (DEBUG) System.out.println("int=" + x); +- MethodHandle mh1 = MethodHandles.lookup().findStatic(CLASS, NAME, MethodType.methodType(int.class, int.class)); +- MethodHandle mh2 = mh1.asType(MethodType.methodType(int.class, Integer.class)); +- int a = mh1.<int>invokeExact(x); +- int b = mh2.<int>invokeExact(Integer.valueOf(x)); +- assert a == b : a + " != " + b; +- } +- +- public static boolean foo(boolean i) { return i; } +- public static byte foo(byte i) { return i; } +- public static char foo(char i) { return i; } +- public static short foo(short i) { return i; } +- public static int foo(int i) { return i; } +-}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/jtreg-remove-test-6991596.patch Wed Mar 09 23:47:23 2011 +0000 @@ -0,0 +1,472 @@ +The regression test openjdk/hotspot/test/compiler/6991596/Test6991596.java is +based on JSR-292 which is not part of OpenJDK6 - this means this test should be +removed. + +--- openjdk/hotspot/test/compiler/6991596/Test6991596.java 2011-02-22 17:51:24.000000000 +0100 ++++ /dev/null 2010-06-29 10:52:54.337250608 +0200 +@@ -1,465 +0,0 @@ +-/* +- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. +- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +- * +- * This code is free software; you can redistribute it and/or modify it +- * under the terms of the GNU General Public License version 2 only, as +- * published by the Free Software Foundation. +- * +- * This code is distributed in the hope that it will be useful, but WITHOUT +- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +- * version 2 for more details (a copy is included in the LICENSE file that +- * accompanied this code). +- * +- * You should have received a copy of the GNU General Public License version +- * 2 along with this work; if not, write to the Free Software Foundation, +- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +- * +- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +- * or visit www.oracle.com if you need additional information or have any +- * questions. +- * +- */ +- +-/** +- * @test +- * @bug 6991596 +- * @summary JSR 292 unimplemented adapter_opt_i2i and adapter_opt_l2i on SPARC +- * +- * @run main/othervm -ea -XX:+UnlockExperimentalVMOptions -XX:+EnableMethodHandles -XX:+EnableInvokeDynamic -XX:+UnlockDiagnosticVMOptions -XX:+VerifyMethodHandles Test6991596 +- */ +- +-import java.dyn.*; +- +-public class Test6991596 { +- private static final Class CLASS = Test6991596.class; +- private static final String NAME = "foo"; +- private static final boolean DEBUG = System.getProperty("DEBUG", "false").equals("true"); +- +- public static void main(String[] args) throws Throwable { +- testboolean(); +- testbyte(); +- testchar(); +- testshort(); +- testint(); +- testlong(); +- } +- +- // Helpers to get various methods. +- static MethodHandle getmh1(Class ret, Class arg) throws NoAccessException { +- return MethodHandles.lookup().findStatic(CLASS, NAME, MethodType.methodType(ret, arg)); +- } +- static MethodHandle getmh2(MethodHandle mh1, Class ret, Class arg) { +- return MethodHandles.convertArguments(mh1, MethodType.methodType(ret, arg)); +- } +- static MethodHandle getmh3(MethodHandle mh1, Class ret, Class arg) { +- return MethodHandles.convertArguments(mh1, MethodType.methodType(ret, arg)); +- } +- +- // test adapter_opt_i2i +- static void testboolean() throws Throwable { +- boolean[] a = new boolean[] { +- true, +- false +- }; +- for (int i = 0; i < a.length; i++) { +- doboolean(a[i]); +- } +- } +- static void doboolean(boolean x) throws Throwable { +- if (DEBUG) System.out.println("boolean=" + x); +- +- // boolean +- { +- MethodHandle mh1 = getmh1( boolean.class, boolean.class); +- MethodHandle mh2 = getmh2(mh1, boolean.class, boolean.class); +- // TODO add this for all cases when the bugs are fixed. +- //MethodHandle mh3 = getmh3(mh1, boolean.class, boolean.class); +- boolean a = (boolean) mh1.invokeExact((boolean) x); +- boolean b = (boolean) mh2.invokeExact(x); +- //boolean c = mh3.<boolean>invokeExact((boolean) x); +- check(x, a, b); +- //check(x, c, x); +- } +- +- // byte +- { +- MethodHandle mh1 = getmh1( byte.class, byte.class ); +- MethodHandle mh2 = getmh2(mh1, byte.class, boolean.class); +- byte a = (byte) mh1.invokeExact((byte) (x ? 1 : 0)); +- byte b = (byte) mh2.invokeExact(x); +- check(x, a, b); +- } +- +- // char +- { +- MethodHandle mh1 = getmh1( char.class, char.class); +- MethodHandle mh2 = getmh2(mh1, char.class, boolean.class); +- char a = (char) mh1.invokeExact((char) (x ? 1 : 0)); +- char b = (char) mh2.invokeExact(x); +- check(x, a, b); +- } +- +- // short +- { +- MethodHandle mh1 = getmh1( short.class, short.class); +- MethodHandle mh2 = getmh2(mh1, short.class, boolean.class); +- short a = (short) mh1.invokeExact((short) (x ? 1 : 0)); +- short b = (short) mh2.invokeExact(x); +- check(x, a, b); +- } +- } +- +- static void testbyte() throws Throwable { +- byte[] a = new byte[] { +- Byte.MIN_VALUE, +- Byte.MIN_VALUE + 1, +- -0x0F, +- -1, +- 0, +- 1, +- 0x0F, +- Byte.MAX_VALUE - 1, +- Byte.MAX_VALUE +- }; +- for (int i = 0; i < a.length; i++) { +- dobyte(a[i]); +- } +- } +- static void dobyte(byte x) throws Throwable { +- if (DEBUG) System.out.println("byte=" + x); +- +- // boolean +- { +- MethodHandle mh1 = getmh1( boolean.class, boolean.class); +- MethodHandle mh2 = getmh2(mh1, boolean.class, byte.class); +- boolean a = (boolean) mh1.invokeExact((x & 1) == 1); +- boolean b = (boolean) mh2.invokeExact(x); +- check(x, a, b); +- } +- +- // byte +- { +- MethodHandle mh1 = getmh1( byte.class, byte.class); +- MethodHandle mh2 = getmh2(mh1, byte.class, byte.class); +- byte a = (byte) mh1.invokeExact((byte) x); +- byte b = (byte) mh2.invokeExact(x); +- check(x, a, b); +- } +- +- // char +- { +- MethodHandle mh1 = getmh1( char.class, char.class); +- MethodHandle mh2 = getmh2(mh1, char.class, byte.class); +- char a = (char) mh1.invokeExact((char) x); +- char b = (char) mh2.invokeExact(x); +- check(x, a, b); +- } +- +- // short +- { +- MethodHandle mh1 = getmh1( short.class, short.class); +- MethodHandle mh2 = getmh2(mh1, short.class, byte.class); +- short a = (short) mh1.invokeExact((short) x); +- short b = (short) mh2.invokeExact(x); +- check(x, a, b); +- } +- } +- +- static void testchar() throws Throwable { +- char[] a = new char[] { +- Character.MIN_VALUE, +- Character.MIN_VALUE + 1, +- 0x000F, +- 0x00FF, +- 0x0FFF, +- Character.MAX_VALUE - 1, +- Character.MAX_VALUE +- }; +- for (int i = 0; i < a.length; i++) { +- dochar(a[i]); +- } +- } +- static void dochar(char x) throws Throwable { +- if (DEBUG) System.out.println("char=" + x); +- +- // boolean +- { +- MethodHandle mh1 = getmh1( boolean.class, boolean.class); +- MethodHandle mh2 = getmh2(mh1, boolean.class, char.class); +- boolean a = (boolean) mh1.invokeExact((x & 1) == 1); +- boolean b = (boolean) mh2.invokeExact(x); +- check(x, a, b); +- } +- +- // byte +- { +- MethodHandle mh1 = getmh1( byte.class, byte.class); +- MethodHandle mh2 = getmh2(mh1, byte.class, char.class); +- byte a = (byte) mh1.invokeExact((byte) x); +- byte b = (byte) mh2.invokeExact(x); +- check(x, a, b); +- } +- +- // char +- { +- MethodHandle mh1 = getmh1( char.class, char.class); +- MethodHandle mh2 = getmh2(mh1, char.class, char.class); +- char a = (char) mh1.invokeExact((char) x); +- char b = (char) mh2.invokeExact(x); +- check(x, a, b); +- } +- +- // short +- { +- MethodHandle mh1 = getmh1( short.class, short.class); +- MethodHandle mh2 = getmh2(mh1, short.class, char.class); +- short a = (short) mh1.invokeExact((short) x); +- short b = (short) mh2.invokeExact(x); +- check(x, a, b); +- } +- } +- +- static void testshort() throws Throwable { +- short[] a = new short[] { +- Short.MIN_VALUE, +- Short.MIN_VALUE + 1, +- -0x0FFF, +- -0x00FF, +- -0x000F, +- -1, +- 0, +- 1, +- 0x000F, +- 0x00FF, +- 0x0FFF, +- Short.MAX_VALUE - 1, +- Short.MAX_VALUE +- }; +- for (int i = 0; i < a.length; i++) { +- doshort(a[i]); +- } +- } +- static void doshort(short x) throws Throwable { +- if (DEBUG) System.out.println("short=" + x); +- +- // boolean +- { +- MethodHandle mh1 = getmh1( boolean.class, boolean.class); +- MethodHandle mh2 = getmh2(mh1, boolean.class, short.class); +- boolean a = (boolean) mh1.invokeExact((x & 1) == 1); +- boolean b = (boolean) mh2.invokeExact(x); +- check(x, a, b); +- } +- +- // byte +- { +- MethodHandle mh1 = getmh1( byte.class, byte.class); +- MethodHandle mh2 = getmh2(mh1, byte.class, short.class); +- byte a = (byte) mh1.invokeExact((byte) x); +- byte b = (byte) mh2.invokeExact(x); +- check(x, a, b); +- } +- +- // char +- { +- MethodHandle mh1 = getmh1( char.class, char.class); +- MethodHandle mh2 = getmh2(mh1, char.class, short.class); +- char a = (char) mh1.invokeExact((char) x); +- char b = (char) mh2.invokeExact(x); +- check(x, a, b); +- } +- +- // short +- { +- MethodHandle mh1 = getmh1( short.class, short.class); +- MethodHandle mh2 = getmh2(mh1, short.class, short.class); +- short a = (short) mh1.invokeExact((short) x); +- short b = (short) mh2.invokeExact(x); +- check(x, a, b); +- } +- } +- +- static void testint() throws Throwable { +- int[] a = new int[] { +- Integer.MIN_VALUE, +- Integer.MIN_VALUE + 1, +- -0x0FFFFFFF, +- -0x00FFFFFF, +- -0x000FFFFF, +- -0x0000FFFF, +- -0x00000FFF, +- -0x000000FF, +- -0x0000000F, +- -1, +- 0, +- 1, +- 0x0000000F, +- 0x000000FF, +- 0x00000FFF, +- 0x0000FFFF, +- 0x000FFFFF, +- 0x00FFFFFF, +- 0x0FFFFFFF, +- Integer.MAX_VALUE - 1, +- Integer.MAX_VALUE +- }; +- for (int i = 0; i < a.length; i++) { +- doint(a[i]); +- } +- } +- static void doint(int x) throws Throwable { +- if (DEBUG) System.out.println("int=" + x); +- +- // boolean +- { +- MethodHandle mh1 = getmh1( boolean.class, boolean.class); +- MethodHandle mh2 = getmh2(mh1, boolean.class, int.class); +- boolean a = (boolean) mh1.invokeExact((x & 1) == 1); +- boolean b = (boolean) mh2.invokeExact(x); +- check(x, a, b); +- } +- +- // byte +- { +- MethodHandle mh1 = getmh1( byte.class, byte.class); +- MethodHandle mh2 = getmh2(mh1, byte.class, int.class); +- byte a = (byte) mh1.invokeExact((byte) x); +- byte b = (byte) mh2.invokeExact(x); +- check(x, a, b); +- } +- +- // char +- { +- MethodHandle mh1 = getmh1( char.class, char.class); +- MethodHandle mh2 = getmh2(mh1, char.class, int.class); +- char a = (char) mh1.invokeExact((char) x); +- char b = (char) mh2.invokeExact(x); +- check(x, a, b); +- } +- +- // short +- { +- MethodHandle mh1 = getmh1( short.class, short.class); +- MethodHandle mh2 = getmh2(mh1, short.class, int.class); +- short a = (short) mh1.invokeExact((short) x); +- short b = (short) mh2.invokeExact(x); +- assert a == b : a + " != " + b; +- check(x, a, b); +- } +- +- // int +- { +- MethodHandle mh1 = getmh1( int.class, int.class); +- MethodHandle mh2 = getmh2(mh1, int.class, int.class); +- int a = (int) mh1.invokeExact((int) x); +- int b = (int) mh2.invokeExact(x); +- check(x, a, b); +- } +- } +- +- // test adapter_opt_l2i +- static void testlong() throws Throwable { +- long[] a = new long[] { +- Long.MIN_VALUE, +- Long.MIN_VALUE + 1, +- -0x000000000FFFFFFFL, +- -0x0000000000FFFFFFL, +- -0x00000000000FFFFFL, +- -0x000000000000FFFFL, +- -0x0000000000000FFFL, +- -0x00000000000000FFL, +- -0x000000000000000FL, +- -1L, +- 0L, +- 1L, +- 0x000000000000000FL, +- 0x00000000000000FFL, +- 0x0000000000000FFFL, +- 0x0000000000000FFFL, +- 0x000000000000FFFFL, +- 0x00000000000FFFFFL, +- 0x0000000000FFFFFFL, +- 0x000000000FFFFFFFL, +- Long.MAX_VALUE - 1, +- Long.MAX_VALUE +- }; +- for (int i = 0; i < a.length; i++) { +- dolong(a[i]); +- } +- } +- static void dolong(long x) throws Throwable { +- if (DEBUG) System.out.println("long=" + x); +- +- // boolean +- { +- MethodHandle mh1 = getmh1( boolean.class, boolean.class); +- MethodHandle mh2 = getmh2(mh1, boolean.class, long.class); +- boolean a = (boolean) mh1.invokeExact((x & 1L) == 1L); +- boolean b = (boolean) mh2.invokeExact(x); +- check(x, a, b); +- } +- +- // byte +- { +- MethodHandle mh1 = getmh1( byte.class, byte.class); +- MethodHandle mh2 = getmh2(mh1, byte.class, long.class); +- byte a = (byte) mh1.invokeExact((byte) x); +- byte b = (byte) mh2.invokeExact(x); +- check(x, a, b); +- } +- +- // char +- { +- MethodHandle mh1 = getmh1( char.class, char.class); +- MethodHandle mh2 = getmh2(mh1, char.class, long.class); +- char a = (char) mh1.invokeExact((char) x); +- char b = (char) mh2.invokeExact(x); +- check(x, a, b); +- } +- +- // short +- { +- MethodHandle mh1 = getmh1( short.class, short.class); +- MethodHandle mh2 = getmh2(mh1, short.class, long.class); +- short a = (short) mh1.invokeExact((short) x); +- short b = (short) mh2.invokeExact(x); +- check(x, a, b); +- } +- +- // int +- { +- MethodHandle mh1 = getmh1( int.class, int.class); +- MethodHandle mh2 = getmh2(mh1, int.class, long.class); +- int a = (int) mh1.invokeExact((int) x); +- int b = (int) mh2.invokeExact(x); +- check(x, a, b); +- } +- } +- +- static void check(boolean x, boolean e, boolean a) { p(z2h(x), z2h(e), z2h(a)); assert e == a : z2h(x) + ": " + z2h(e) + " != " + z2h(a); } +- static void check(boolean x, byte e, byte a) { p(z2h(x), i2h(e), i2h(a)); assert e == a : z2h(x) + ": " + i2h(e) + " != " + i2h(a); } +- static void check(boolean x, int e, int a) { p(z2h(x), i2h(e), i2h(a)); assert e == a : z2h(x) + ": " + i2h(e) + " != " + i2h(a); } +- +- static void check(int x, boolean e, boolean a) { p(i2h(x), z2h(e), z2h(a)); assert e == a : i2h(x) + ": " + z2h(e) + " != " + z2h(a); } +- static void check(int x, byte e, byte a) { p(i2h(x), i2h(e), i2h(a)); assert e == a : i2h(x) + ": " + i2h(e) + " != " + i2h(a); } +- static void check(int x, int e, int a) { p(i2h(x), i2h(e), i2h(a)); assert e == a : i2h(x) + ": " + i2h(e) + " != " + i2h(a); } +- +- static void check(long x, boolean e, boolean a) { p(l2h(x), z2h(e), z2h(a)); assert e == a : l2h(x) + ": " + z2h(e) + " != " + z2h(a); } +- static void check(long x, byte e, byte a) { p(l2h(x), i2h(e), i2h(a)); assert e == a : l2h(x) + ": " + i2h(e) + " != " + i2h(a); } +- static void check(long x, int e, int a) { p(l2h(x), i2h(e), i2h(a)); assert e == a : l2h(x) + ": " + i2h(e) + " != " + i2h(a); } +- +- static void p(String x, String e, String a) { if (DEBUG) System.out.println(x + ": expected: " + e + ", actual: " + a); } +- +- static String z2h(boolean x) { return x ? "1" : "0"; } +- static String i2h(int x) { return Integer.toHexString(x); } +- static String l2h(long x) { return Long.toHexString(x); } +- +- // to int +- public static boolean foo(boolean i) { return i; } +- public static byte foo(byte i) { return i; } +- public static char foo(char i) { return i; } +- public static short foo(short i) { return i; } +- public static int foo(int i) { return i; } +-}