diff --git a/jdk/src/java.base/share/classes/java/lang/Thread.java b/jdk/src/java.base/share/classes/java/lang/Thread.java index 54fc27f31b5..310ada1b470 100644 --- a/jdk/src/java.base/share/classes/java/lang/Thread.java +++ b/jdk/src/java.base/share/classes/java/lang/Thread.java @@ -340,6 +340,45 @@ class Thread implements Runnable { sleep(millis); } + /** + * Indicates that the caller is momentarily unable to progress, until the + * occurrence of one or more actions on the part of other activities. By + * invoking this method within each iteration of a spin-wait loop construct, + * the calling thread indicates to the runtime that it is busy-waiting. + * The runtime may take action to improve the performance of invoking + * spin-wait loop constructions. + *

+ * @apiNote + * As an example consider a method in a class that spins in a loop until + * some flag is set outside of that method. A call to the {@code onSpinWait} + * method should be placed inside the spin loop. + *

{@code
+     *     class EventHandler {
+     *         volatile boolean eventNotificationNotReceived;
+     *         void waitForEventAndHandleIt() {
+     *             while ( eventNotificationNotReceived ) {
+     *                 java.lang.Thread.onSpinWait();
+     *             }
+     *             readAndProcessEvent();
+     *         }
+     *
+     *         void readAndProcessEvent() {
+     *             // Read event from some source and process it
+     *              . . .
+     *         }
+     *     }
+     * }
+ *

+ * The code above would remain correct even if the {@code onSpinWait} + * method was not called at all. However on some architectures the Java + * Virtual Machine may issue the processor instructions to address such + * code patterns in a more beneficial way. + *

+ * @since 9 + */ + @HotSpotIntrinsicCandidate + public static void onSpinWait() {} + /** * Initializes a Thread with the current AccessControlContext. * @see #init(ThreadGroup,Runnable,String,long,AccessControlContext,boolean) diff --git a/jdk/src/java.base/share/classes/sun/launcher/resources/launcher.properties b/jdk/src/java.base/share/classes/sun/launcher/resources/launcher.properties index 52d621b414d..f678ba37057 100644 --- a/jdk/src/java.base/share/classes/sun/launcher/resources/launcher.properties +++ b/jdk/src/java.base/share/classes/sun/launcher/resources/launcher.properties @@ -99,7 +99,6 @@ java.launcher.X.usage=\ \ -Xdiag show additional diagnostic messages\n\ \ -Xdiag:resolver show resolver diagnostic messages\n\ \ -Xnoclassgc disable class garbage collection\n\ -\ -Xincgc enable incremental garbage collection\n\ \ -Xloggc: log GC status to a file with time stamps\n\ \ -Xbatch disable background compilation\n\ \ -Xms set initial Java heap size\n\ diff --git a/jdk/src/java.instrument/share/native/libinstrument/InvocationAdapter.c b/jdk/src/java.instrument/share/native/libinstrument/InvocationAdapter.c index 0c57f8b289d..a74b2b725ba 100644 --- a/jdk/src/java.instrument/share/native/libinstrument/InvocationAdapter.c +++ b/jdk/src/java.instrument/share/native/libinstrument/InvocationAdapter.c @@ -518,18 +518,22 @@ static void splitPathList(const char* str, int* pathCount, char*** paths) { int count = 0; char** segments = NULL; + char** new_segments; char* c = (char*) str; while (*c != '\0') { while (*c == ' ') c++; /* skip leading spaces */ if (*c == '\0') { break; } - if (segments == NULL) { - segments = (char**)malloc( sizeof(char**) ); - } else { - segments = (char**)realloc( segments, (count+1)*sizeof(char**) ); + new_segments = (char**)realloc(segments, (count+1)*sizeof(char*)); + if (new_segments == NULL) { + jplis_assert(0); + free(segments); + count = 0; + segments = NULL; + break; } - jplis_assert(segments != (char**)NULL); + segments = new_segments; segments[count++] = c; c = strchr(c, ' '); if (c == NULL) { diff --git a/jdk/src/jdk.jdi/share/classes/com/sun/tools/example/debug/tty/Commands.java b/jdk/src/jdk.jdi/share/classes/com/sun/tools/example/debug/tty/Commands.java index bbae8bc44c8..5e6438d887a 100644 --- a/jdk/src/jdk.jdi/share/classes/com/sun/tools/example/debug/tty/Commands.java +++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/example/debug/tty/Commands.java @@ -1534,7 +1534,6 @@ class Commands { PathSearchingVirtualMachine vm = (PathSearchingVirtualMachine)Env.vm(); MessageOutput.println("base directory:", vm.baseDirectory()); MessageOutput.println("classpath:", vm.classPath().toString()); - MessageOutput.println("bootclasspath:", vm.bootClassPath().toString()); } else { MessageOutput.println("The VM does not use paths"); } diff --git a/jdk/src/jdk.jdi/share/classes/com/sun/tools/example/debug/tty/TTYResources.java b/jdk/src/jdk.jdi/share/classes/com/sun/tools/example/debug/tty/TTYResources.java index c412743c4b6..39e703d88b8 100644 --- a/jdk/src/jdk.jdi/share/classes/com/sun/tools/example/debug/tty/TTYResources.java +++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/example/debug/tty/TTYResources.java @@ -74,7 +74,6 @@ public class TTYResources extends java.util.ListResourceBundle { {"Array element is not a method", "Array element is not a method"}, {"Array index must be a integer type", "Array index must be a integer type"}, {"base directory:", "base directory: {0}"}, - {"bootclasspath:", "bootclasspath: {0}"}, {"Breakpoint hit:", "Breakpoint hit: "}, {"breakpoint", "breakpoint {0}"}, {"Breakpoints set:", "Breakpoints set:"}, diff --git a/jdk/src/jdk.jdi/share/classes/com/sun/tools/example/debug/tty/TTYResources_ja.java b/jdk/src/jdk.jdi/share/classes/com/sun/tools/example/debug/tty/TTYResources_ja.java index 1cb6d231d50..b3562226398 100644 --- a/jdk/src/jdk.jdi/share/classes/com/sun/tools/example/debug/tty/TTYResources_ja.java +++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/example/debug/tty/TTYResources_ja.java @@ -74,7 +74,6 @@ public class TTYResources_ja extends java.util.ListResourceBundle { {"Array element is not a method", "\u914D\u5217\u8981\u7D20\u306F\u30E1\u30BD\u30C3\u30C9\u3067\u306F\u3042\u308A\u307E\u305B\u3093"}, {"Array index must be a integer type", "\u914D\u5217\u306E\u6DFB\u3048\u5B57\u306F\u6574\u6570\u578B\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059"}, {"base directory:", "\u30D9\u30FC\u30B9\u30FB\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA: {0}"}, - {"bootclasspath:", "\u30D6\u30FC\u30C8\u30FB\u30AF\u30E9\u30B9\u30D1\u30B9: {0}"}, {"Breakpoint hit:", "\u30D2\u30C3\u30C8\u3057\u305F\u30D6\u30EC\u30FC\u30AF\u30DD\u30A4\u30F3\u30C8: "}, {"breakpoint", "\u30D6\u30EC\u30FC\u30AF\u30DD\u30A4\u30F3\u30C8{0}"}, {"Breakpoints set:", "\u8A2D\u5B9A\u3055\u308C\u3066\u3044\u308B\u30D6\u30EC\u30FC\u30AF\u30DD\u30A4\u30F3\u30C8:"}, diff --git a/jdk/src/jdk.jdi/share/classes/com/sun/tools/example/debug/tty/TTYResources_zh_CN.java b/jdk/src/jdk.jdi/share/classes/com/sun/tools/example/debug/tty/TTYResources_zh_CN.java index 50790cb9d72..79dc9268da0 100644 --- a/jdk/src/jdk.jdi/share/classes/com/sun/tools/example/debug/tty/TTYResources_zh_CN.java +++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/example/debug/tty/TTYResources_zh_CN.java @@ -74,7 +74,6 @@ public class TTYResources_zh_CN extends java.util.ListResourceBundle { {"Array element is not a method", "\u6570\u7EC4\u5143\u7D20\u4E0D\u662F\u65B9\u6CD5"}, {"Array index must be a integer type", "\u6570\u7EC4\u7D22\u5F15\u5FC5\u987B\u4E3A\u6574\u6570\u7C7B\u578B"}, {"base directory:", "\u57FA\u76EE\u5F55: {0}"}, - {"bootclasspath:", "\u5F15\u5BFC\u7C7B\u8DEF\u5F84: {0}"}, {"Breakpoint hit:", "\u65AD\u70B9\u547D\u4E2D: "}, {"breakpoint", "\u65AD\u70B9{0}"}, {"Breakpoints set:", "\u65AD\u70B9\u96C6:"}, diff --git a/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/VirtualMachineImpl.java b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/VirtualMachineImpl.java index 47e743483e3..28c3dfbfa3c 100644 --- a/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/VirtualMachineImpl.java +++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/VirtualMachineImpl.java @@ -1439,7 +1439,7 @@ class VirtualMachineImpl extends MirrorImpl } public List bootClassPath() { - return Arrays.asList(getClasspath().bootclasspaths); + return Collections.emptyList(); } public String baseDirectory() { diff --git a/jdk/src/jdk.jdwp.agent/share/native/libjdwp/VirtualMachineImpl.c b/jdk/src/jdk.jdwp.agent/share/native/libjdwp/VirtualMachineImpl.c index 2718ad1e3a4..8e1639c5e2e 100644 --- a/jdk/src/jdk.jdwp.agent/share/native/libjdwp/VirtualMachineImpl.c +++ b/jdk/src/jdk.jdwp.agent/share/native/libjdwp/VirtualMachineImpl.c @@ -126,7 +126,7 @@ classesForSignature(PacketInputStream *in, PacketOutputStream *out) int writtenCount = 0; int i; - for (i=0; i