--- a/hotspot/src/os/bsd/vm/os_bsd.cpp Thu Jan 23 09:40:32 2014 -0800
+++ b/hotspot/src/os/bsd/vm/os_bsd.cpp Thu Jan 23 09:45:38 2014 -0800
@@ -1557,6 +1557,17 @@
}
#endif /* !__APPLE__ */
+void* os::get_default_process_handle() {
+#ifdef __APPLE__
+ // MacOS X needs to use RTLD_FIRST instead of RTLD_LAZY
+ // to avoid finding unexpected symbols on second (or later)
+ // loads of a library.
+ return (void*)::dlopen(NULL, RTLD_FIRST);
+#else
+ return (void*)::dlopen(NULL, RTLD_LAZY);
+#endif
+}
+
// XXX: Do we need a lock around this as per Linux?
void* os::dll_lookup(void* handle, const char* name) {
return dlsym(handle, name);
--- a/hotspot/src/os/linux/vm/os_linux.cpp Thu Jan 23 09:40:32 2014 -0800
+++ b/hotspot/src/os/linux/vm/os_linux.cpp Thu Jan 23 09:45:38 2014 -0800
@@ -2104,6 +2104,9 @@
return res;
}
+void* os::get_default_process_handle() {
+ return (void*)::dlopen(NULL, RTLD_LAZY);
+}
static bool _print_ascii_file(const char* filename, outputStream* st) {
int fd = ::open(filename, O_RDONLY);
--- a/hotspot/src/os/posix/vm/os_posix.cpp Thu Jan 23 09:40:32 2014 -0800
+++ b/hotspot/src/os/posix/vm/os_posix.cpp Thu Jan 23 09:45:38 2014 -0800
@@ -262,10 +262,6 @@
return ::fdopen(fd, mode);
}
-void* os::get_default_process_handle() {
- return (void*)::dlopen(NULL, RTLD_LAZY);
-}
-
// Builds a platform dependent Agent_OnLoad_<lib_name> function name
// which is used to find statically linked in agents.
// Parameters:
--- a/hotspot/src/os/solaris/vm/os_solaris.cpp Thu Jan 23 09:40:32 2014 -0800
+++ b/hotspot/src/os/solaris/vm/os_solaris.cpp Thu Jan 23 09:45:38 2014 -0800
@@ -2146,6 +2146,10 @@
return dlsym(handle, name);
}
+void* os::get_default_process_handle() {
+ return (void*)::dlopen(NULL, RTLD_LAZY);
+}
+
int os::stat(const char *path, struct stat *sbuf) {
char pathbuf[MAX_PATH];
if (strlen(path) > MAX_PATH - 1) {
--- a/hotspot/src/share/vm/runtime/globals.cpp Thu Jan 23 09:40:32 2014 -0800
+++ b/hotspot/src/share/vm/runtime/globals.cpp Thu Jan 23 09:45:38 2014 -0800
@@ -31,6 +31,7 @@
#include "utilities/ostream.hpp"
#include "utilities/macros.hpp"
#include "utilities/top.hpp"
+#include "trace/tracing.hpp"
#if INCLUDE_ALL_GCS
#include "gc_implementation/g1/g1_globals.hpp"
#endif // INCLUDE_ALL_GCS
@@ -593,6 +594,17 @@
return true;
}
+template<class E, class T>
+static void trace_flag_changed(const char* name, const T old_value, const T new_value, const Flag::Flags origin)
+{
+ E e;
+ e.set_name(name);
+ e.set_old_value(old_value);
+ e.set_new_value(new_value);
+ e.set_origin(origin);
+ e.commit();
+}
+
bool CommandLineFlags::boolAt(char* name, size_t len, bool* value) {
Flag* result = Flag::find_flag(name, len);
if (result == NULL) return false;
@@ -606,6 +618,7 @@
if (result == NULL) return false;
if (!result->is_bool()) return false;
bool old_value = result->get_bool();
+ trace_flag_changed<EventBooleanFlagChanged, bool>(name, old_value, *value, origin);
result->set_bool(*value);
*value = old_value;
result->set_origin(origin);
@@ -615,6 +628,7 @@
void CommandLineFlagsEx::boolAtPut(CommandLineFlagWithType flag, bool value, Flag::Flags origin) {
Flag* faddr = address_of_flag(flag);
guarantee(faddr != NULL && faddr->is_bool(), "wrong flag type");
+ trace_flag_changed<EventBooleanFlagChanged, bool>(faddr->_name, faddr->get_bool(), value, origin);
faddr->set_bool(value);
faddr->set_origin(origin);
}
@@ -632,6 +646,7 @@
if (result == NULL) return false;
if (!result->is_intx()) return false;
intx old_value = result->get_intx();
+ trace_flag_changed<EventLongFlagChanged, s8>(name, old_value, *value, origin);
result->set_intx(*value);
*value = old_value;
result->set_origin(origin);
@@ -641,6 +656,7 @@
void CommandLineFlagsEx::intxAtPut(CommandLineFlagWithType flag, intx value, Flag::Flags origin) {
Flag* faddr = address_of_flag(flag);
guarantee(faddr != NULL && faddr->is_intx(), "wrong flag type");
+ trace_flag_changed<EventLongFlagChanged, s8>(faddr->_name, faddr->get_intx(), value, origin);
faddr->set_intx(value);
faddr->set_origin(origin);
}
@@ -658,6 +674,7 @@
if (result == NULL) return false;
if (!result->is_uintx()) return false;
uintx old_value = result->get_uintx();
+ trace_flag_changed<EventUnsignedLongFlagChanged, u8>(name, old_value, *value, origin);
result->set_uintx(*value);
*value = old_value;
result->set_origin(origin);
@@ -667,6 +684,7 @@
void CommandLineFlagsEx::uintxAtPut(CommandLineFlagWithType flag, uintx value, Flag::Flags origin) {
Flag* faddr = address_of_flag(flag);
guarantee(faddr != NULL && faddr->is_uintx(), "wrong flag type");
+ trace_flag_changed<EventUnsignedLongFlagChanged, u8>(faddr->_name, faddr->get_uintx(), value, origin);
faddr->set_uintx(value);
faddr->set_origin(origin);
}
@@ -684,6 +702,7 @@
if (result == NULL) return false;
if (!result->is_uint64_t()) return false;
uint64_t old_value = result->get_uint64_t();
+ trace_flag_changed<EventUnsignedLongFlagChanged, u8>(name, old_value, *value, origin);
result->set_uint64_t(*value);
*value = old_value;
result->set_origin(origin);
@@ -693,6 +712,7 @@
void CommandLineFlagsEx::uint64_tAtPut(CommandLineFlagWithType flag, uint64_t value, Flag::Flags origin) {
Flag* faddr = address_of_flag(flag);
guarantee(faddr != NULL && faddr->is_uint64_t(), "wrong flag type");
+ trace_flag_changed<EventUnsignedLongFlagChanged, u8>(faddr->_name, faddr->get_uint64_t(), value, origin);
faddr->set_uint64_t(value);
faddr->set_origin(origin);
}
@@ -710,6 +730,7 @@
if (result == NULL) return false;
if (!result->is_double()) return false;
double old_value = result->get_double();
+ trace_flag_changed<EventDoubleFlagChanged, double>(name, old_value, *value, origin);
result->set_double(*value);
*value = old_value;
result->set_origin(origin);
@@ -719,6 +740,7 @@
void CommandLineFlagsEx::doubleAtPut(CommandLineFlagWithType flag, double value, Flag::Flags origin) {
Flag* faddr = address_of_flag(flag);
guarantee(faddr != NULL && faddr->is_double(), "wrong flag type");
+ trace_flag_changed<EventDoubleFlagChanged, double>(faddr->_name, faddr->get_double(), value, origin);
faddr->set_double(value);
faddr->set_origin(origin);
}
@@ -736,6 +758,7 @@
if (result == NULL) return false;
if (!result->is_ccstr()) return false;
ccstr old_value = result->get_ccstr();
+ trace_flag_changed<EventStringFlagChanged, const char*>(name, old_value, *value, origin);
char* new_value = NULL;
if (*value != NULL) {
new_value = NEW_C_HEAP_ARRAY(char, strlen(*value)+1, mtInternal);
@@ -757,6 +780,7 @@
Flag* faddr = address_of_flag(flag);
guarantee(faddr != NULL && faddr->is_ccstr(), "wrong flag type");
ccstr old_value = faddr->get_ccstr();
+ trace_flag_changed<EventStringFlagChanged, const char*>(faddr->_name, old_value, value, origin);
char* new_value = NEW_C_HEAP_ARRAY(char, strlen(value)+1, mtInternal);
strcpy(new_value, value);
faddr->set_ccstr(new_value);
--- a/hotspot/src/share/vm/trace/trace.xml Thu Jan 23 09:40:32 2014 -0800
+++ b/hotspot/src/share/vm/trace/trace.xml Thu Jan 23 09:45:38 2014 -0800
@@ -122,6 +122,46 @@
<value type="CLASS" field="definingClassLoader" label="Defining Class Loader"/>
</event>
+ <event id="LongFlagChanged" path="vm/flag/long_changed" label="Long Flag Changed"
+ is_instant="true">
+ <value type="UTF8" field="name" label="Name" />
+ <value type="LONG" field="old_value" label="Old Value" />
+ <value type="LONG" field="new_value" label="New Value" />
+ <value type="FLAGVALUEORIGIN" field="origin" label="Origin" />
+ </event>
+
+ <event id="UnsignedLongFlagChanged" path="vm/flag/ulong_changed" label="Unsigned Long Flag Changed"
+ is_instant="true">
+ <value type="UTF8" field="name" label="Name" />
+ <value type="ULONG" field="old_value" label="Old Value" />
+ <value type="ULONG" field="new_value" label="New Value" />
+ <value type="FLAGVALUEORIGIN" field="origin" label="Origin" />
+ </event>
+
+ <event id="DoubleFlagChanged" path="vm/flag/double_changed" label="Double Flag Changed"
+ is_instant="true">
+ <value type="UTF8" field="name" label="Name" />
+ <value type="DOUBLE" field="old_value" label="Old Value" />
+ <value type="DOUBLE" field="new_value" label="New Value" />
+ <value type="FLAGVALUEORIGIN" field="origin" label="Origin" />
+ </event>
+
+ <event id="BooleanFlagChanged" path="vm/flag/boolean_changed" label="Boolean Flag Changed"
+ is_instant="true">
+ <value type="UTF8" field="name" label="Name" />
+ <value type="BOOLEAN" field="old_value" label="Old Value" />
+ <value type="BOOLEAN" field="new_value" label="New Value" />
+ <value type="FLAGVALUEORIGIN" field="origin" label="Origin" />
+ </event>
+
+ <event id="StringFlagChanged" path="vm/flag/string_changed" label="String Flag Changed"
+ is_instant="true">
+ <value type="UTF8" field="name" label="Name" />
+ <value type="UTF8" field="old_value" label="Old Value" />
+ <value type="UTF8" field="new_value" label="New Value" />
+ <value type="FLAGVALUEORIGIN" field="origin" label="Origin" />
+ </event>
+
<struct id="VirtualSpace">
<value type="ADDRESS" field="start" label="Start Address" description="Start address of the virtual space" />
<value type="ADDRESS" field="committedEnd" label="Committed End Address" description="End address of the committed memory for the virtual space" />
--- a/hotspot/src/share/vm/trace/tracetypes.xml Thu Jan 23 09:40:32 2014 -0800
+++ b/hotspot/src/share/vm/trace/tracetypes.xml Thu Jan 23 09:45:38 2014 -0800
@@ -150,6 +150,11 @@
<value type="UTF8" field="phase" label="phase" />
</content_type>
+ <content_type id="FlagValueOrigin" hr_name="Flag Value Origin"
+ type="U1" jvm_type="FLAGVALUEORIGIN">
+ <value type="UTF8" field="origin" label="origin" />
+ </content_type>
+
</content_types>
@@ -334,6 +339,10 @@
<!-- VMOPERATIONTYPE -->
<primary_type symbol="VMOPERATIONTYPE" datatype="U2" contenttype="VMOPERATIONTYPE"
type="u2" sizeop="sizeof(u2)" />
+
+ <!-- FLAGVALUEORIGIN -->
+ <primary_type symbol="FLAGVALUEORIGIN" datatype="U1"
+ contenttype="FLAGVALUEORIGIN" type="u1" sizeop="sizeof(u1)" />
</primary_types>
</types>
--- a/hotspot/test/serviceability/sa/jmap-hashcode/Test8028623.java Thu Jan 23 09:40:32 2014 -0800
+++ b/hotspot/test/serviceability/sa/jmap-hashcode/Test8028623.java Thu Jan 23 09:45:38 2014 -0800
@@ -26,6 +26,8 @@
* @bug 8028623
* @summary Test hashing of extended characters in Serviceability Agent.
* @library /testlibrary
+ * @compile -encoding utf8 Test8028623.java
+ * @run main Test8028623
*/
import com.oracle.java.testlibrary.JDKToolLauncher;