8139986: Store debug level in java.vm.debug and conditionally print in "java -version"

Reviewed-by: ihse, dcubed, ksrini, dholmes
This commit is contained in:
Alejandro Murillo 2015-11-04 11:00:29 -08:00
parent 8fe1b0faab
commit c573c1777e
12 changed files with 20 additions and 4 deletions

View File

@ -81,6 +81,7 @@ JDK_VER_DEFS = -DVERSION_MAJOR=$(VERSION_MAJOR) \
-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)\""

View File

@ -80,6 +80,7 @@ JDK_VER_DEFS = -DVERSION_MAJOR=$(VERSION_MAJOR) \
-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)\""

View File

@ -82,6 +82,7 @@ JDK_VER_DEFS = -DVERSION_MAJOR=$(VERSION_MAJOR) \
-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)\""

View File

@ -76,6 +76,7 @@ JDK_VER_DEFS = -DVERSION_MAJOR=$(VERSION_MAJOR) \
-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)\""

View File

@ -184,6 +184,7 @@ MAKE_ARGS += VERSION_MINOR=$(VERSION_MINOR)
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:=,

View File

@ -65,6 +65,7 @@ CXX_FLAGS=$(CXX_FLAGS) /D "VERSION_SECURITY=$(VERSION_SECURITY)"
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)\""

View File

@ -115,7 +115,7 @@ VERSION_MINOR=$(STANDALONE_JDK_MINOR_VER)
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

View File

@ -197,6 +197,7 @@ void Arguments::init_system_properties() {
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

View File

@ -223,6 +223,7 @@ static const char* property_counters_ss[] = {
"java.vm.name",
"java.vm.vendor",
"java.vm.info",
"jdk.debug",
"java.library.path",
"java.class.path",
"java.version",

View File

@ -64,6 +64,10 @@ int Abstract_VM_Version::_reserve_for_allocation_prefetch = 0;
#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 @@ const char *Abstract_VM_Version::vm_build_user() {
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) |

View File

@ -87,6 +87,7 @@ class Abstract_VM_Version: AllStatic {
// 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() {

View File

@ -29,7 +29,7 @@ public class Platform {
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 class Platform {
}
public static boolean isDebugBuild() {
return (vmVersion.toLowerCase().contains("debug") ||
javaVersion.toLowerCase().contains("debug"));
return (jdkDebug.toLowerCase().contains("debug"));
}
public static String getVMVersion() {