From bcec429910a75a9c04bad23cfb06cc2d82f17ebe Mon Sep 17 00:00:00 2001 From: Paul Sandoz Date: Wed, 11 May 2016 09:13:45 +0200 Subject: [PATCH 1/5] 8144826: [JVMCI] Remove jdk.vm.ci.hotspot.Stable and use jdk.internal.vm.annotation.Stable Reviewed-by: twisti --- jdk/src/java.base/share/classes/module-info.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/jdk/src/java.base/share/classes/module-info.java b/jdk/src/java.base/share/classes/module-info.java index 974654bcce0..a2c4bf17fef 100644 --- a/jdk/src/java.base/share/classes/module-info.java +++ b/jdk/src/java.base/share/classes/module-info.java @@ -187,7 +187,8 @@ module java.base { jdk.scripting.nashorn, jdk.unsupported; exports jdk.internal.vm.annotation to - jdk.unsupported; + jdk.unsupported, + jdk.vm.ci; exports jdk.internal.util.jar to jdk.jartool; exports jdk.internal.vm to From dd051e31bbaaf0446ffdf4cabefe9e9bbe7cc411 Mon Sep 17 00:00:00 2001 From: Tobias Hartmann Date: Fri, 13 May 2016 08:31:23 +0200 Subject: [PATCH 2/5] 8155608: String intrinsic range checks are not strict enough Range checks in inflate, compress and getChars are not strict enough. Reviewed-by: kvn, twisti, jrose --- .../java.base/share/classes/java/lang/StringLatin1.java | 4 ++-- .../java.base/share/classes/java/lang/StringUTF16.java | 8 +++++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/jdk/src/java.base/share/classes/java/lang/StringLatin1.java b/jdk/src/java.base/share/classes/java/lang/StringLatin1.java index c491f4833e1..e4901dd69ad 100644 --- a/jdk/src/java.base/share/classes/java/lang/StringLatin1.java +++ b/jdk/src/java.base/share/classes/java/lang/StringLatin1.java @@ -557,7 +557,7 @@ final class StringLatin1 { // inflatedCopy byte[] -> char[] @HotSpotIntrinsicCandidate - private static void inflate(byte[] src, int srcOff, char[] dst, int dstOff, int len) { + public static void inflate(byte[] src, int srcOff, char[] dst, int dstOff, int len) { for (int i = 0; i < len; i++) { dst[dstOff++] = (char)(src[srcOff++] & 0xff); } @@ -567,7 +567,7 @@ final class StringLatin1 { @HotSpotIntrinsicCandidate public static void inflate(byte[] src, int srcOff, byte[] dst, int dstOff, int len) { // We need a range check here because 'putChar' has no checks - checkBoundsOffCount(dstOff, len, dst.length); + checkBoundsOffCount(dstOff << 1, len << 1, dst.length); for (int i = 0; i < len; i++) { StringUTF16.putChar(dst, dstOff++, src[srcOff++] & 0xff); } diff --git a/jdk/src/java.base/share/classes/java/lang/StringUTF16.java b/jdk/src/java.base/share/classes/java/lang/StringUTF16.java index fe0c964b290..1e61bd13664 100644 --- a/jdk/src/java.base/share/classes/java/lang/StringUTF16.java +++ b/jdk/src/java.base/share/classes/java/lang/StringUTF16.java @@ -144,7 +144,7 @@ final class StringUTF16 { // compressedCopy char[] -> byte[] @HotSpotIntrinsicCandidate - private static int compress(char[] src, int srcOff, byte[] dst, int dstOff, int len) { + public static int compress(char[] src, int srcOff, byte[] dst, int dstOff, int len) { for (int i = 0; i < len; i++) { char c = src[srcOff]; if (c > 0xFF) { @@ -162,7 +162,7 @@ final class StringUTF16 { @HotSpotIntrinsicCandidate public static int compress(byte[] src, int srcOff, byte[] dst, int dstOff, int len) { // We need a range check here because 'getChar' has no checks - checkBoundsOffCount(srcOff, len, src.length); + checkBoundsOffCount(srcOff << 1, len << 1, src.length); for (int i = 0; i < len; i++) { char c = getChar(src, srcOff); if (c > 0xFF) { @@ -211,7 +211,9 @@ final class StringUTF16 { @HotSpotIntrinsicCandidate public static void getChars(byte[] value, int srcBegin, int srcEnd, char dst[], int dstBegin) { // We need a range check here because 'getChar' has no checks - checkBoundsOffCount(srcBegin, srcEnd - srcBegin, value.length); + if (srcBegin < srcEnd) { + checkBoundsOffCount(srcBegin << 1, (srcEnd - srcBegin) << 1, value.length); + } for (int i = srcBegin; i < srcEnd; i++) { dst[dstBegin++] = getChar(value, i); } From 847a2d2de1d89266501ae2ea64e31259ea05c6ba Mon Sep 17 00:00:00 2001 From: Staffan Larsen Date: Tue, 24 May 2016 08:53:54 +0200 Subject: [PATCH 3/5] 8157555: com/sun/jdi/RedefineClearBreakpoint.sh times out due to Indify String Concat being slow in debug mode Reviewed-by: sspitsyn --- jdk/test/com/sun/jdi/ShellScaffold.sh | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/jdk/test/com/sun/jdi/ShellScaffold.sh b/jdk/test/com/sun/jdi/ShellScaffold.sh index eb7e6b45351..7727a8f762d 100644 --- a/jdk/test/com/sun/jdi/ShellScaffold.sh +++ b/jdk/test/com/sun/jdi/ShellScaffold.sh @@ -131,11 +131,13 @@ killcmd=kill # This can be increased if timing seems to be an issue. sleep_seconds=1 -if [ -n "$TIMEOUT_FACTOR" ] ; then - sleep_seconds=$(echo $TIMEOUT_FACTOR $sleep_seconds | awk '{printf "%d\n", int($1 * $2)}') +timeout_factor=1 +if [ -n "$TESTTIMEOUTFACTOR" ] ; then + # convert float value to int + timeout_factor=$(echo $TESTTIMEOUTFACTOR | awk '{printf "%d\n", int($1)}') fi -echo "ShellScaffold.sh: Version" >& 2 +echo "ShellScaffold.sh: Running with timeout_factor = $timeout_factor" >& 2 topPid=$$ # Be careful to echo to >& in these general functions. @@ -664,6 +666,7 @@ cmd() count=0 desiredFileSize=`expr $fileSize + 4` msg1=`echo At start: cmd/size/waiting : $command / $fileSize / \`date\`` + timeLimit=`expr 60 * $timeout_factor` while [ 1 = 1 ] ; do newFileSize=`wc -c $jdbOutFile | awk '{ print $1 } '` #echo jj: desired = $desiredFileSize, new = $newFileSize >& 2 @@ -673,20 +676,17 @@ cmd() break fi sleep ${sleep_seconds} - count=`expr $count + 1` - if [ $count = 30 -o $count = 60 ] ; then + count=`expr $count + ${sleep_seconds}` + if [ $count -gt $timeLimit ] ; then # record some debug info. - echo "--DEBUG: jdb $$ didn't responded to command in $count secs: $command" >& 2 + echo "--DEBUG: jdb $$ didn't respond to command in $count secs: $command" >& 2 echo "--DEBUG:" $msg1 >& 2 echo "--DEBUG: "done size/waiting : / $newFileSize / `date` >& 2 echo "-- $jdbOutFile follows-------------------------------" >& 2 cat $jdbOutFile >& 2 echo "------------------------------------------" >& 2 dojstack - #$psCmd | sed -e '/com.sun.javatest/d' -e '/nsk/d' >& 2 - if [ $count = 60 ] ; then - dofail "jdb never responded to command: $command" - fi + dofail "jdb never responded to command: $command" fi done # Note that this assumes just these chars in thread names. @@ -734,7 +734,8 @@ waitForJdbMsg() nlines=$2 allowExit="$3" myCount=0 - timeLimit=40 # wait a max of this many secs for a response from a jdb command + timeLimit=`expr 40 * $timeout_factor` # wait a max of this many secs for a response from a jdb command + while [ 1 = 1 ] ; do if [ -r $jdbOutFile ] ; then # Something here causes jdb to complain about Unrecognized cmd on x86. @@ -772,7 +773,7 @@ waitForJdbMsg() myCount=`expr $myCount + ${sleep_seconds}` if [ $myCount -gt $timeLimit ] ; then - echo "--Fail: waitForJdbMsg timed out after $timeLimit seconds, looking for /$1/, in $nlines lines; exitting" >> $failFile + echo "--Fail: waitForJdbMsg timed out after $timeLimit seconds, looking for /$1/, in $nlines lines; exiting" >> $failFile echo "vv jdbOutFile vvvvvvvvvvvvvvvvvvvvvvvvvvvv" >& 2 cat $jdbOutFile >& 2 echo "^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^" >& 2 From 10f79f95df679bf0996924225d838b6a7f4f932b Mon Sep 17 00:00:00 2001 From: Alan Bateman Date: Wed, 25 May 2016 17:29:47 -0400 Subject: [PATCH 4/5] 8157716: jdk.internal.loader.ClassLoaders.addURLToUCP() should return converted real path URL Rename jdk.internal.loader.ClassLoaders.addURLToUCP() to toFileURL(), which returns the converted URL. Reviewed-by: martin, mchung --- .../jdk/internal/loader/ClassLoaders.java | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/jdk/src/java.base/share/classes/jdk/internal/loader/ClassLoaders.java b/jdk/src/java.base/share/classes/jdk/internal/loader/ClassLoaders.java index bc2396f10c3..deaf34c41c2 100644 --- a/jdk/src/java.base/share/classes/jdk/internal/loader/ClassLoaders.java +++ b/jdk/src/java.base/share/classes/jdk/internal/loader/ClassLoaders.java @@ -237,24 +237,29 @@ public class ClassLoaders { int off = 0; int next; while ((next = cp.indexOf(File.pathSeparator, off)) != -1) { - addURLToUCP(cp.substring(off, next), ucp); + URL url = toFileURL(cp.substring(off, next)); + if (url != null) + ucp.addURL(url); off = next + 1; } // remaining - addURLToUCP(cp.substring(off), ucp); + URL url = toFileURL(cp.substring(off)); + if (url != null) + ucp.addURL(url); } /** - * Attempts to convert to the given string to a file URL and adds it - * to the given URLClassPath. + * Attempts to convert the given string to a file URL. + * + * @apiNote This is called by the VM */ - private static void addURLToUCP(String s, URLClassPath ucp) { + private static URL toFileURL(String s) { try { - URL url = Paths.get(s).toRealPath().toUri().toURL(); - ucp.addURL(url); + return Paths.get(s).toRealPath().toUri().toURL(); } catch (InvalidPathException | IOException ignore) { // malformed path string or class path element does not exist + return null; } } From df511d0dccf41965b65bd5c2f6e17f33f226fa61 Mon Sep 17 00:00:00 2001 From: Dmitry Samersoff Date: Fri, 27 May 2016 19:31:41 +0300 Subject: [PATCH 5/5] 8152950: BasicLauncherTest.java fails due to type error Better handle js engine initialization error Reviewed-by: jbachorik --- .../sun/tools/jhsdb/BasicLauncherTest.java | 34 +++++++++++++------ 1 file changed, 24 insertions(+), 10 deletions(-) diff --git a/jdk/test/sun/tools/jhsdb/BasicLauncherTest.java b/jdk/test/sun/tools/jhsdb/BasicLauncherTest.java index b0f3b8d4f73..6d8d59dd455 100644 --- a/jdk/test/sun/tools/jhsdb/BasicLauncherTest.java +++ b/jdk/test/sun/tools/jhsdb/BasicLauncherTest.java @@ -49,14 +49,26 @@ import jdk.testlibrary.Platform; public class BasicLauncherTest { - private final static String toolName = "jhsdb"; private static LingeredApp theApp = null; + private static boolean useJavaLauncher = false; - /** - * - * @return exit code of tool - */ - public static int launchCLHSDB() + private static JDKToolLauncher createSALauncher() { + JDKToolLauncher launcher = null; + if (useJavaLauncher) { + // Use java launcher if we need to pass additional parameters to VM + // for debugging purpose + // e.g. -Xlog:class+load=info:file=/tmp/BasicLauncherTest.log + launcher = JDKToolLauncher.createUsingTestJDK("java"); + launcher.addToolArg("sun.jvm.hotspot.SALauncher"); + } + else { + launcher = JDKToolLauncher.createUsingTestJDK("jhsdb"); + } + + return launcher; + } + + public static void launchCLHSDB() throws IOException { System.out.println("Starting LingeredApp"); @@ -64,7 +76,7 @@ public class BasicLauncherTest { theApp = LingeredApp.startApp(); System.out.println("Starting clhsdb against " + theApp.getPid()); - JDKToolLauncher launcher = JDKToolLauncher.createUsingTestJDK(toolName); + JDKToolLauncher launcher = createSALauncher(); launcher.addToolArg("clhsdb"); launcher.addToolArg("--pid=" + Long.toString(theApp.getPid())); @@ -84,7 +96,9 @@ public class BasicLauncherTest { toolProcess.waitFor(); - return toolProcess.exitValue(); + if (toolProcess.exitValue() != 0) { + throw new RuntimeException("FAILED CLHSDB terminated with non-zero exit code " + toolProcess.exitValue()); + } } catch (Exception ex) { throw new RuntimeException("Test ERROR " + ex, ex); } finally { @@ -104,8 +118,8 @@ public class BasicLauncherTest { try { theApp = LingeredApp.startApp(Arrays.asList("-Xmx256m")); - System.out.println("Starting " + toolName + " " + toolArgs.get(0) + " against " + theApp.getPid()); - JDKToolLauncher launcher = JDKToolLauncher.createUsingTestJDK(toolName); + System.out.println("Starting " + toolArgs.get(0) + " against " + theApp.getPid()); + JDKToolLauncher launcher = createSALauncher(); for (String cmd : toolArgs) { launcher.addToolArg(cmd);