8139986: Store debug level in java.vm.debug and conditionally print in "java -version"
Reviewed-by: ihse, dcubed, ksrini, dholmes
--- a/hotspot/make/aix/makefiles/vm.make Mon Nov 02 09:11:55 2015 -0800
+++ b/hotspot/make/aix/makefiles/vm.make Wed Nov 04 11:00:29 2015 -0800
@@ -81,6 +81,7 @@
-DVERSION_BUILD=$(VERSION_BUILD)
VM_VER_DEFS = -DHOTSPOT_VERSION_STRING="\"$(HOTSPOT_VERSION_STRING)\"" \
-DVERSION_STRING="\"$(VERSION_STRING)\"" \
+ -DDEBUG_LEVEL="\"$(DEBUG_LEVEL)\"" \
$(JDK_VER_DEFS)
HS_LIB_ARCH = -DHOTSPOT_LIB_ARCH=\"$(LIBARCH)\"
BUILD_USER = -DHOTSPOT_BUILD_USER="\"$(HOTSPOT_BUILD_USER)\""
--- a/hotspot/make/bsd/makefiles/vm.make Mon Nov 02 09:11:55 2015 -0800
+++ b/hotspot/make/bsd/makefiles/vm.make Wed Nov 04 11:00:29 2015 -0800
@@ -80,6 +80,7 @@
-DVERSION_BUILD=$(VERSION_BUILD)
VM_VER_DEFS = -DHOTSPOT_VERSION_STRING="\"$(HOTSPOT_VERSION_STRING)\"" \
-DVERSION_STRING="\"$(VERSION_STRING)\"" \
+ -DDEBUG_LEVEL="\"$(DEBUG_LEVEL)\"" \
$(JDK_VER_DEFS)
HS_LIB_ARCH = -DHOTSPOT_LIB_ARCH=\"$(LIBARCH)\"
BUILD_USER = -DHOTSPOT_BUILD_USER="\"$(HOTSPOT_BUILD_USER)\""
--- a/hotspot/make/linux/makefiles/vm.make Mon Nov 02 09:11:55 2015 -0800
+++ b/hotspot/make/linux/makefiles/vm.make Wed Nov 04 11:00:29 2015 -0800
@@ -82,6 +82,7 @@
-DVERSION_BUILD=$(VERSION_BUILD)
VM_VER_DEFS = -DHOTSPOT_VERSION_STRING="\"$(HOTSPOT_VERSION_STRING)\"" \
-DVERSION_STRING="\"$(VERSION_STRING)\"" \
+ -DDEBUG_LEVEL="\"$(DEBUG_LEVEL)\"" \
$(JDK_VER_DEFS)
HS_LIB_ARCH = -DHOTSPOT_LIB_ARCH=\"$(LIBARCH)\"
BUILD_USER = -DHOTSPOT_BUILD_USER="\"$(HOTSPOT_BUILD_USER)\""
--- a/hotspot/make/solaris/makefiles/vm.make Mon Nov 02 09:11:55 2015 -0800
+++ b/hotspot/make/solaris/makefiles/vm.make Wed Nov 04 11:00:29 2015 -0800
@@ -76,6 +76,7 @@
-DVERSION_BUILD=$(VERSION_BUILD)
VM_VER_DEFS = -DHOTSPOT_VERSION_STRING="\"$(HOTSPOT_VERSION_STRING)\"" \
-DVERSION_STRING="\"$(VERSION_STRING)\"" \
+ -DDEBUG_LEVEL="\"$(DEBUG_LEVEL)\"" \
$(JDK_VER_DEFS)
HS_LIB_ARCH = -DHOTSPOT_LIB_ARCH=\"$(LIBARCH)\"
BUILD_USER = -DHOTSPOT_BUILD_USER="\"$(HOTSPOT_BUILD_USER)\""
--- a/hotspot/make/windows/makefiles/defs.make Mon Nov 02 09:11:55 2015 -0800
+++ b/hotspot/make/windows/makefiles/defs.make Wed Nov 04 11:00:29 2015 -0800
@@ -184,6 +184,7 @@
MAKE_ARGS += VERSION_SECURITY=$(VERSION_SECURITY)
MAKE_ARGS += VERSION_PATCH=$(VERSION_PATCH)
MAKE_ARGS += VERSION_BUILD=$(VERSION_BUILD)
+MAKE_ARGS += DEBUG_LEVEL=$(DEBUG_LEVEL)
# JDK_DOTVER and JDK_VER are needed in Windows RC files
COMMA:=,
--- a/hotspot/make/windows/makefiles/vm.make Mon Nov 02 09:11:55 2015 -0800
+++ b/hotspot/make/windows/makefiles/vm.make Wed Nov 04 11:00:29 2015 -0800
@@ -65,6 +65,7 @@
CXX_FLAGS=$(CXX_FLAGS) /D "VERSION_PATCH=$(VERSION_PATCH)"
CXX_FLAGS=$(CXX_FLAGS) /D "VERSION_BUILD=$(VERSION_BUILD)"
CXX_FLAGS=$(CXX_FLAGS) /D "VERSION_STRING=\"$(VERSION_STRING)\""
+CXX_FLAGS=$(CXX_FLAGS) /D "DEBUG_LEVEL=\"$(DEBUG_LEVEL)\""
CXX_FLAGS=$(CXX_FLAGS) /D "HOTSPOT_LIB_ARCH=\"$(HOTSPOT_LIB_ARCH)\""
CXX_FLAGS=$(CXX_FLAGS) /D "HOTSPOT_BUILD_TARGET=\"$(BUILD_FLAVOR)\""
CXX_FLAGS=$(CXX_FLAGS) /D "HOTSPOT_BUILD_USER=\"$(BuildUser)\""
--- a/hotspot/make/windows/projectfiles/common/Makefile Mon Nov 02 09:11:55 2015 -0800
+++ b/hotspot/make/windows/projectfiles/common/Makefile Wed Nov 04 11:00:29 2015 -0800
@@ -115,7 +115,7 @@
VERSION_SECURITY=$(STANDALONE_JDK_SECURITY_VER)
VERSION_PATCH=$(STANDALONE_JDK_PATCH_VER)
-ReleaseOptions = -define HOTSPOT_RELEASE_VERSION=$(HOTSPOT_RELEASE_VERSION) -define JRE_RELEASE_VERSION=$(JRE_RELEASE_VERSION) -define HOTSPOT_VM_DISTRO=$(HOTSPOT_VM_DISTRO) -define VERSION_MAJOR=$(VERSION_MAJOR) -define VERSION_MINOR=$(VERSION_MINOR) -define VERSION_SECURITY=$(VERSION_SECURITY) -define VERSION_PATCH=$(VERSION_PATCH) -define VISUAL_STUDIO_BUILD=true
+ReleaseOptions = -define HOTSPOT_RELEASE_VERSION=$(HOTSPOT_RELEASE_VERSION) -define JRE_RELEASE_VERSION=$(JRE_RELEASE_VERSION) -define HOTSPOT_VM_DISTRO=$(HOTSPOT_VM_DISTRO) -define VERSION_MAJOR=$(VERSION_MAJOR) -define VERSION_MINOR=$(VERSION_MINOR) -define VERSION_SECURITY=$(VERSION_SECURITY) -define VERSION_PATCH=$(VERSION_PATCH) -define DEBUG_LEVEL=$(DEBUG_LEVEL) -define VISUAL_STUDIO_BUILD=true
ProjectCreatorIDEOptions = $(ProjectCreatorIDEOptions) $(ReleaseOptions)
$(HOTSPOTBUILDSPACE)/$(ProjectFile): $(HOTSPOTBUILDSPACE)/classes/ProjectCreator.class
--- a/hotspot/src/share/vm/runtime/arguments.cpp Mon Nov 02 09:11:55 2015 -0800
+++ b/hotspot/src/share/vm/runtime/arguments.cpp Wed Nov 04 11:00:29 2015 -0800
@@ -197,6 +197,7 @@
PropertyList_add(&_system_properties, new SystemProperty("java.vm.version", VM_Version::vm_release(), false));
PropertyList_add(&_system_properties, new SystemProperty("java.vm.name", VM_Version::vm_name(), false));
PropertyList_add(&_system_properties, new SystemProperty("java.vm.info", VM_Version::vm_info_string(), true));
+ PropertyList_add(&_system_properties, new SystemProperty("jdk.debug", VM_Version::jdk_debug_level(), false));
// Following are JVMTI agent writable properties.
// Properties values are set to NULL and they are
--- a/hotspot/src/share/vm/runtime/statSampler.cpp Mon Nov 02 09:11:55 2015 -0800
+++ b/hotspot/src/share/vm/runtime/statSampler.cpp Wed Nov 04 11:00:29 2015 -0800
@@ -223,6 +223,7 @@
"java.vm.name",
"java.vm.vendor",
"java.vm.info",
+ "jdk.debug",
"java.library.path",
"java.class.path",
"java.version",
--- a/hotspot/src/share/vm/runtime/vm_version.cpp Mon Nov 02 09:11:55 2015 -0800
+++ b/hotspot/src/share/vm/runtime/vm_version.cpp Wed Nov 04 11:00:29 2015 -0800
@@ -64,6 +64,10 @@
#error VERSION_STRING must be defined
#endif
+#ifndef DEBUG_LEVEL
+ #error DEBUG_LEVEL must be defined
+#endif
+
// NOTE: Builds within Visual Studio do not define the build target in
// HOTSPOT_VERSION_STRING, so it must be done here
#if defined(VISUAL_STUDIO_BUILD) && !defined(PRODUCT)
@@ -243,6 +247,10 @@
return HOTSPOT_BUILD_USER;
}
+const char *Abstract_VM_Version::jdk_debug_level() {
+ return DEBUG_LEVEL;
+}
+
unsigned int Abstract_VM_Version::jvm_version() {
return ((Abstract_VM_Version::vm_major_version() & 0xFF) << 24) |
((Abstract_VM_Version::vm_minor_version() & 0xFF) << 16) |
--- a/hotspot/src/share/vm/runtime/vm_version.hpp Mon Nov 02 09:11:55 2015 -0800
+++ b/hotspot/src/share/vm/runtime/vm_version.hpp Wed Nov 04 11:00:29 2015 -0800
@@ -87,6 +87,7 @@
// Internal version providing additional build information
static const char* internal_vm_info_string();
static const char* jre_release_version();
+ static const char* jdk_debug_level();
// does HW support an 8-byte compare-exchange operation?
static bool supports_cx8() {
--- a/hotspot/test/testlibrary/jdk/test/lib/Platform.java Mon Nov 02 09:11:55 2015 -0800
+++ b/hotspot/test/testlibrary/jdk/test/lib/Platform.java Wed Nov 04 11:00:29 2015 -0800
@@ -29,7 +29,7 @@
private static final String osName = System.getProperty("os.name");
private static final String dataModel = System.getProperty("sun.arch.data.model");
private static final String vmVersion = System.getProperty("java.vm.version");
- private static final String javaVersion = System.getProperty("java.version");
+ private static final String jdkDebug = System.getProperty("jdk.debug");
private static final String osArch = System.getProperty("os.arch");
private static final String vmName = System.getProperty("java.vm.name");
private static final String userName = System.getProperty("user.name");
@@ -100,8 +100,7 @@
}
public static boolean isDebugBuild() {
- return (vmVersion.toLowerCase().contains("debug") ||
- javaVersion.toLowerCase().contains("debug"));
+ return (jdkDebug.toLowerCase().contains("debug"));
}
public static String getVMVersion() {