--- a/hotspot/agent/src/share/classes/com/sun/java/swing/action/ActionManager.java Thu Apr 02 14:02:54 2015 -0400
+++ b/hotspot/agent/src/share/classes/com/sun/java/swing/action/ActionManager.java Fri Apr 03 13:18:06 2015 +0000
@@ -46,6 +46,11 @@
return manager;
}
+ protected static void setInstance(ActionManager m)
+ {
+ manager = m;
+ }
+
protected abstract void addActions();
protected void addAction(String cmdname, Action action)
@@ -90,6 +95,6 @@
private HashMap actions;
private static ActionUtilities utilities = new ActionUtilities();
- protected static ActionManager manager;
+ private static ActionManager manager;
}
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/ui/action/HSDBActionManager.java Thu Apr 02 14:02:54 2015 -0400
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/ui/action/HSDBActionManager.java Fri Apr 03 13:18:06 2015 +0000
@@ -32,10 +32,12 @@
public class HSDBActionManager extends ActionManager {
public static ActionManager getInstance() {
- if (manager == null) {
- manager = new HSDBActionManager();
+ ActionManager m = ActionManager.getInstance();
+ if (m == null) {
+ m = new HSDBActionManager();
+ ActionManager.setInstance(m);
}
- return manager;
+ return m;
}
protected void addActions() {
--- a/hotspot/src/cpu/x86/vm/vm_version_x86.cpp Thu Apr 02 14:02:54 2015 -0400
+++ b/hotspot/src/cpu/x86/vm/vm_version_x86.cpp Fri Apr 03 13:18:06 2015 +0000
@@ -379,15 +379,6 @@
};
};
-
-void VM_Version::get_cpu_info_wrapper() {
- get_cpu_info_stub(&_cpuid_info);
-}
-
-#ifndef CALL_TEST_FUNC_WITH_WRAPPER_IF_NEEDED
- #define CALL_TEST_FUNC_WITH_WRAPPER_IF_NEEDED(f) f()
-#endif
-
void VM_Version::get_processor_features() {
_cpu = 4; // 486 by default
@@ -401,9 +392,7 @@
if (!Use486InstrsOnly) {
// Get raw processor info
- // Some platforms (like Win*) need a wrapper around here
- // in order to properly handle SEGV for YMM registers test.
- CALL_TEST_FUNC_WITH_WRAPPER_IF_NEEDED(get_cpu_info_wrapper);
+ get_cpu_info_stub(&_cpuid_info);
assert_is_initialized();
_cpu = extended_cpu_family();
--- a/hotspot/src/os/aix/vm/os_aix.cpp Thu Apr 02 14:02:54 2015 -0400
+++ b/hotspot/src/os/aix/vm/os_aix.cpp Fri Apr 03 13:18:06 2015 +0000
@@ -238,7 +238,6 @@
static pid_t _initial_pid = 0;
static int SR_signum = SIGUSR2; // Signal used to suspend/resume a thread (must be > SIGSEGV, see 4355769)
static sigset_t SR_sigset;
-static pthread_mutex_t dl_mutex; // Used to protect dlsym() calls.
julong os::available_memory() {
return Aix::available_memory();
@@ -1479,13 +1478,8 @@
return NULL;
}
-// Glibc-2.0 libdl is not MT safe. If you are building with any glibc,
-// chances are you might want to run the generated bits against glibc-2.0
-// libdl.so, so always use locking for any version of glibc.
void* os::dll_lookup(void* handle, const char* name) {
- pthread_mutex_lock(&dl_mutex);
void* res = dlsym(handle, name);
- pthread_mutex_unlock(&dl_mutex);
return res;
}
@@ -3685,7 +3679,6 @@
Aix::_main_thread = pthread_self();
initial_time_count = os::elapsed_counter();
- pthread_mutex_init(&dl_mutex, NULL);
}
// This is called _after_ the global arguments have been parsed.
--- a/hotspot/src/os/linux/vm/os_linux.cpp Thu Apr 02 14:02:54 2015 -0400
+++ b/hotspot/src/os/linux/vm/os_linux.cpp Fri Apr 03 13:18:06 2015 +0000
@@ -158,9 +158,6 @@
static int SR_signum = SIGUSR2;
sigset_t SR_sigset;
-// Used to protect dlsym() calls
-static pthread_mutex_t dl_mutex;
-
// Declarations
static void unpackTime(timespec* absTime, bool isAbsolute, jlong time);
@@ -2025,14 +2022,8 @@
return result;
}
-// glibc-2.0 libdl is not MT safe. If you are building with any glibc,
-// chances are you might want to run the generated bits against glibc-2.0
-// libdl.so, so always use locking for any version of glibc.
-//
void* os::dll_lookup(void* handle, const char* name) {
- pthread_mutex_lock(&dl_mutex);
void* res = dlsym(handle, name);
- pthread_mutex_unlock(&dl_mutex);
return res;
}
@@ -4641,8 +4632,6 @@
}
// else it defaults to CLOCK_REALTIME
- pthread_mutex_init(&dl_mutex, NULL);
-
// If the pagesize of the VM is greater than 8K determine the appropriate
// number of initial guard pages. The user can change this with the
// command line arguments, if needed.
--- a/hotspot/src/os/windows/vm/os_windows.cpp Thu Apr 02 14:02:54 2015 -0400
+++ b/hotspot/src/os/windows/vm/os_windows.cpp Fri Apr 03 13:18:06 2015 +0000
@@ -2695,17 +2695,6 @@
}
#endif
-void os::win32::call_test_func_with_wrapper(void (*funcPtr)(void)) {
- // Install a win32 structured exception handler around the test
- // function call so the VM can generate an error dump if needed.
- __try {
- (*funcPtr)();
- } __except(topLevelExceptionFilter(
- (_EXCEPTION_POINTERS*)_exception_info())) {
- // Nothing to do.
- }
-}
-
// Virtual Memory
int os::vm_page_size() { return os::win32::vm_page_size(); }
--- a/hotspot/src/os/windows/vm/os_windows.hpp Thu Apr 02 14:02:54 2015 -0400
+++ b/hotspot/src/os/windows/vm/os_windows.hpp Fri Apr 03 13:18:06 2015 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, 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
@@ -115,8 +115,6 @@
static address fast_jni_accessor_wrapper(BasicType);
#endif
- static void call_test_func_with_wrapper(void (*funcPtr)(void));
-
// filter function to ignore faults on serializations page
static LONG WINAPI serialize_fault_filter(struct _EXCEPTION_POINTERS* e);
};
--- a/hotspot/src/os/windows/vm/os_windows.inline.hpp Thu Apr 02 14:02:54 2015 -0400
+++ b/hotspot/src/os/windows/vm/os_windows.inline.hpp Fri Apr 03 13:18:06 2015 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, 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
@@ -104,7 +104,4 @@
win32::exit_process_or_thread(win32::EPT_PROCESS, num);
}
-#define CALL_TEST_FUNC_WITH_WRAPPER_IF_NEEDED(f) \
- os::win32::call_test_func_with_wrapper(f)
-
#endif // OS_WINDOWS_VM_OS_WINDOWS_INLINE_HPP
--- a/hotspot/src/share/vm/prims/jni.cpp Thu Apr 02 14:02:54 2015 -0400
+++ b/hotspot/src/share/vm/prims/jni.cpp Fri Apr 03 13:18:06 2015 +0000
@@ -84,6 +84,9 @@
static jint CurrentVersion = JNI_VERSION_1_8;
+#ifdef _WIN32
+extern LONG WINAPI topLevelExceptionFilter(_EXCEPTION_POINTERS* );
+#endif
// The DT_RETURN_MARK macros create a scoped object to fire the dtrace
// '-return' probe regardless of the return path is taken out of the function.
@@ -3924,7 +3927,7 @@
DT_RETURN_MARK_DECL(CreateJavaVM, jint
, HOTSPOT_JNI_CREATEJAVAVM_RETURN(_ret_ref));
-_JNI_IMPORT_OR_EXPORT_ jint JNICALL JNI_CreateJavaVM(JavaVM **vm, void **penv, void *args) {
+static jint JNI_CreateJavaVM_inner(JavaVM **vm, void **penv, void *args) {
HOTSPOT_JNI_CREATEJAVAVM_ENTRY((void **) vm, penv, args);
jint result = JNI_ERR;
@@ -4001,18 +4004,14 @@
}
#ifndef PRODUCT
- #ifndef CALL_TEST_FUNC_WITH_WRAPPER_IF_NEEDED
- #define CALL_TEST_FUNC_WITH_WRAPPER_IF_NEEDED(f) f()
- #endif
-
// Check if we should compile all classes on bootclasspath
if (CompileTheWorld) ClassLoader::compile_the_world();
if (ReplayCompiles) ciReplay::replay(thread);
// Some platforms (like Win*) need a wrapper around these test
// functions in order to properly handle error conditions.
- CALL_TEST_FUNC_WITH_WRAPPER_IF_NEEDED(test_error_handler);
- CALL_TEST_FUNC_WITH_WRAPPER_IF_NEEDED(execute_internal_vm_tests);
+ test_error_handler();
+ execute_internal_vm_tests();
#endif
// Since this is not a JVM_ENTRY we have to set the thread state manually before leaving.
@@ -4045,8 +4044,23 @@
}
return result;
+
}
+_JNI_IMPORT_OR_EXPORT_ jint JNICALL JNI_CreateJavaVM(JavaVM **vm, void **penv, void *args) {
+ jint result = 0;
+ // On Windows, let CreateJavaVM run with SEH protection
+#ifdef _WIN32
+ __try {
+#endif
+ result = JNI_CreateJavaVM_inner(vm, penv, args);
+#ifdef _WIN32
+ } __except(topLevelExceptionFilter((_EXCEPTION_POINTERS*)_exception_info())) {
+ // Nothing to do.
+ }
+#endif
+ return result;
+}
_JNI_IMPORT_OR_EXPORT_ jint JNICALL JNI_GetCreatedJavaVMs(JavaVM **vm_buf, jsize bufLen, jsize *numVMs) {
// See bug 4367188, the wrapper can sometimes cause VM crashes
--- a/hotspot/test/serviceability/dcmd/vm/SetVMFlagTest.java Thu Apr 02 14:02:54 2015 -0400
+++ b/hotspot/test/serviceability/dcmd/vm/SetVMFlagTest.java Fri Apr 03 13:18:06 2015 +0000
@@ -38,13 +38,10 @@
*/
public class SetVMFlagTest {
- private static final String PRINTGC_NAME = "PrintGC";
- private static final String XMX_NAME = "MaxHeapSize";
-
- private static final String PRINTGC_PATTERN = "\\s*bool " + PRINTGC_NAME +
- "\\s+[\\:]?=\\s+(.*?)\\s+\\{manageable\\}";
- private static final String XMX_PATTERN = "\\s*uintx " + XMX_NAME +
- "\\s+[\\:]?=\\s+(.*?)\\s+\\{product\\}";
+ private static final String MANAGEABLE_PATTERN = "\\s*bool\\s+(\\S+)\\s+[\\:]?=\\s+" +
+ "(.*?)\\s+\\{manageable\\}";
+ private static final String IMMUTABLE_PATTERN = "\\s*uintx\\s+(\\S+)\\s+[\\:]?=\\s+" +
+ "(.*?)\\s+\\{product\\}";
public void run(CommandExecutor executor) {
setMutableFlag(executor);
@@ -60,76 +57,86 @@
private void setMutableFlag(CommandExecutor executor) {
OutputAnalyzer out = getAllFlags(executor);
- String flagVal = out.firstMatch(PRINTGC_PATTERN, 1);
+ String flagName = out.firstMatch(MANAGEABLE_PATTERN, 1);
+ String flagVal = out.firstMatch(MANAGEABLE_PATTERN, 2);
+
+ System.out.println("### Setting a mutable flag '" + flagName + "'");
if (flagVal == null) {
System.err.println(out.getOutput());
- throw new Error("'" + PRINTGC_NAME + "' flag is either not available or manageable");
+ throw new Error("Can not find a boolean manageable flag");
}
Boolean blnVal = Boolean.parseBoolean(flagVal);
- out = executor.execute("VM.set_flag " + PRINTGC_NAME + " " + (blnVal ? 0 : 1));
+ out = executor.execute("VM.set_flag " + flagName + " " + (blnVal ? 0 : 1));
out.stderrShouldBeEmpty();
out = getAllFlags(executor);
- String newFlagVal = out.firstMatch(PRINTGC_PATTERN, 1);
+ String newFlagVal = out.firstMatch(MANAGEABLE_PATTERN.replace("(\\S+)", flagName), 1);
assertNotEquals(newFlagVal, flagVal);
}
private void setMutableFlagWithInvalidValue(CommandExecutor executor) {
OutputAnalyzer out = getAllFlags(executor);
- String flagVal = out.firstMatch(PRINTGC_PATTERN, 1);
+ String flagName = out.firstMatch(MANAGEABLE_PATTERN, 1);
+ String flagVal = out.firstMatch(MANAGEABLE_PATTERN, 2);
+
+ System.out.println("### Setting a mutable flag '" + flagName + "' to an invalid value");
if (flagVal == null) {
System.err.println(out.getOutput());
- throw new Error("'" + PRINTGC_NAME + "' flag is either not available or manageable");
+ throw new Error("Can not find a boolean manageable flag");
}
- // PrintGC is a boolean flag and accepts only 0/1 as its value
- out = executor.execute("VM.set_flag " + PRINTGC_NAME + " unexpected_value");
+ // a boolean flag accepts only 0/1 as its value
+ out = executor.execute("VM.set_flag " + flagName + " unexpected_value");
out.stderrShouldBeEmpty();
out.stdoutShouldContain("flag value must be a boolean (1 or 0)");
out = getAllFlags(executor);
- String newFlagVal = out.firstMatch(PRINTGC_PATTERN, 1);
+ String newFlagVal = out.firstMatch(MANAGEABLE_PATTERN.replace("(\\S+)", flagName), 1);
assertEquals(newFlagVal, flagVal);
}
private void setImmutableFlag(CommandExecutor executor) {
OutputAnalyzer out = getAllFlags(executor);
- String flagVal = out.firstMatch(XMX_PATTERN, 1);
+ String flagName = out.firstMatch(IMMUTABLE_PATTERN, 1);
+ String flagVal = out.firstMatch(IMMUTABLE_PATTERN, 2);
+
+ System.out.println("### Setting an immutable flag '" + flagName + "'");
if (flagVal == null) {
System.err.println(out.getOutput());
- throw new Error("'" + XMX_NAME + "' flag is not available or immutable");
+ throw new Error("Can not find an immutable uintx flag");
}
Long numVal = Long.parseLong(flagVal);
- out = executor.execute("VM.set_flag " + XMX_NAME + " " + (numVal + 1));
+ out = executor.execute("VM.set_flag " + flagName + " " + (numVal + 1));
out.stderrShouldBeEmpty();
out.stdoutShouldContain("only 'writeable' flags can be set");
out = getAllFlags(executor);
- String newFlagVal = out.firstMatch(XMX_PATTERN, 1);
+ String newFlagVal = out.firstMatch(IMMUTABLE_PATTERN.replace("(\\S+)", flagName), 1);
assertEquals(newFlagVal, flagVal);
}
private void setNonExistingFlag(CommandExecutor executor) {
String unknownFlag = "ThisIsUnknownFlag";
+ System.out.println("### Setting a non-existing flag '" + unknownFlag + "'");
OutputAnalyzer out = executor.execute("VM.set_flag " + unknownFlag + " 1");
out.stderrShouldBeEmpty();
out.stdoutShouldContain("flag " + unknownFlag + " does not exist");
}
private OutputAnalyzer getAllFlags(CommandExecutor executor) {
- return executor.execute("VM.flags -all");
+ return executor.execute("VM.flags -all", true);
}
}
\ No newline at end of file
--- a/hotspot/test/testlibrary/com/oracle/java/testlibrary/dcmd/CommandExecutor.java Thu Apr 02 14:02:54 2015 -0400
+++ b/hotspot/test/testlibrary/com/oracle/java/testlibrary/dcmd/CommandExecutor.java Fri Apr 03 13:18:06 2015 +0000
@@ -40,16 +40,34 @@
* stderr, regardless of the specific executor used.
*/
public final OutputAnalyzer execute(String cmd) throws CommandExecutorException {
- System.out.printf("Running DCMD '%s' through '%s'%n", cmd, this.getClass().getSimpleName());
+ return execute(cmd, false);
+ }
+
+ /**
+ * Execute a diagnostic command
+ *
+ * @param cmd The diagnostic command to execute
+ * @param silent Do not print the command output
+ * @return an {@link jdk.testlibrary.OutputAnalyzer} encapsulating the output of the command
+ * @throws CommandExecutorException if there is an exception on the "calling side" while trying to execute the
+ * Diagnostic Command. Exceptions thrown on the remote side are available as textual representations in
+ * stderr, regardless of the specific executor used.
+ */
+ public final OutputAnalyzer execute(String cmd, boolean silent) throws CommandExecutorException {
+ if (!silent) {
+ System.out.printf("Running DCMD '%s' through '%s'%n", cmd, this.getClass().getSimpleName());
+ }
+
OutputAnalyzer oa = executeImpl(cmd);
- System.out.println("---------------- stdout ----------------");
- System.out.println(oa.getStdout());
- System.out.println("---------------- stderr ----------------");
- System.out.println(oa.getStderr());
- System.out.println("----------------------------------------");
- System.out.println();
-
+ if (!silent) {
+ System.out.println("---------------- stdout ----------------");
+ System.out.println(oa.getStdout());
+ System.out.println("---------------- stderr ----------------");
+ System.out.println(oa.getStderr());
+ System.out.println("----------------------------------------");
+ System.out.println();
+ }
return oa;
}