--- a/hotspot/src/share/vm/runtime/globals.cpp Mon Jan 20 09:56:47 2014 +0000
+++ b/hotspot/src/share/vm/runtime/globals.cpp Thu Jan 23 08:12:12 2014 +0100
@@ -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);