This commit is contained in:
Alejandro Murillo 2014-05-02 09:52:17 -07:00
commit c202b95c0f
45 changed files with 422 additions and 193 deletions

View File

@ -37,7 +37,7 @@
# GAMMADIR - top of workspace # GAMMADIR - top of workspace
# OS_FAMILY - operating system # OS_FAMILY - operating system
# VARIANT - core, compiler1, compiler2, or tiered # VARIANT - core, compiler1, compiler2, or tiered
# HOTSPOT_RELEASE_VERSION - <major>.<minor>-b<nn> (11.0-b07) # HOTSPOT_RELEASE_VERSION - <major_ver>.<minor_ver>.<micro_ver>[-<identifier>][-<debug_target>][-b<nn>]
# HOTSPOT_BUILD_VERSION - internal, internal-$(USER_RELEASE_SUFFIX) or empty # HOTSPOT_BUILD_VERSION - internal, internal-$(USER_RELEASE_SUFFIX) or empty
# JRE_RELEASE_VERSION - <major>.<minor>.<micro> (1.7.0) # JRE_RELEASE_VERSION - <major>.<minor>.<micro> (1.7.0)
# #

View File

@ -122,7 +122,7 @@ SUNWprivate_1.1 {
JVM_GetClassModifiers; JVM_GetClassModifiers;
JVM_GetClassName; JVM_GetClassName;
JVM_GetClassNameUTF; JVM_GetClassNameUTF;
JVM_GetClassSignature; JVM_GetClassSignature;
JVM_GetClassSigners; JVM_GetClassSigners;
JVM_GetClassTypeAnnotations; JVM_GetClassTypeAnnotations;
JVM_GetComponentType; JVM_GetComponentType;
@ -163,6 +163,7 @@ SUNWprivate_1.1 {
JVM_GetStackTraceElement; JVM_GetStackTraceElement;
JVM_GetSystemPackage; JVM_GetSystemPackage;
JVM_GetSystemPackages; JVM_GetSystemPackages;
JVM_GetTemporaryDirectory;
JVM_GetThreadStateNames; JVM_GetThreadStateNames;
JVM_GetThreadStateValues; JVM_GetThreadStateValues;
JVM_GetVersionInfo; JVM_GetVersionInfo;

View File

@ -161,6 +161,7 @@ SUNWprivate_1.1 {
JVM_GetStackTraceElement; JVM_GetStackTraceElement;
JVM_GetSystemPackage; JVM_GetSystemPackage;
JVM_GetSystemPackages; JVM_GetSystemPackages;
JVM_GetTemporaryDirectory;
JVM_GetThreadStateNames; JVM_GetThreadStateNames;
JVM_GetThreadStateValues; JVM_GetThreadStateValues;
JVM_GetVersionInfo; JVM_GetVersionInfo;

View File

@ -73,17 +73,14 @@ else
endif endif
endif endif
# HOTSPOT_RELEASE_VERSION and HOTSPOT_BUILD_VERSION are defined
# in $(GAMMADIR)/make/defs.make
ifeq ($(HOTSPOT_BUILD_VERSION),)
BUILD_VERSION = -DHOTSPOT_RELEASE_VERSION="\"$(HOTSPOT_RELEASE_VERSION)\""
else
BUILD_VERSION = -DHOTSPOT_RELEASE_VERSION="\"$(HOTSPOT_RELEASE_VERSION)-$(HOTSPOT_BUILD_VERSION)\""
endif
# The following variables are defined in the generated flags.make file. # The following variables are defined in the generated flags.make file.
BUILD_VERSION = -DHOTSPOT_RELEASE_VERSION="\"$(HS_BUILD_VER)\"" JDK_VER_DEFS = -DJDK_MAJOR_VERSION="\"$(JDK_MAJOR_VERSION)\"" \
JRE_VERSION = -DJRE_RELEASE_VERSION="\"$(JRE_RELEASE_VER)\"" -DJDK_MINOR_VERSION="\"$(JDK_MINOR_VERSION)\"" \
-DJDK_MICRO_VERSION="\"$(JDK_MICRO_VERSION)\"" \
-DJDK_BUILD_NUMBER="\"$(JDK_BUILD_NUMBER)\""
VM_VER_DEFS = -DHOTSPOT_RELEASE_VERSION="\"$(HS_BUILD_VER)\"" \
-DJRE_RELEASE_VERSION="\"$(JRE_RELEASE_VER)\"" \
$(JDK_VER_DEFS)
HS_LIB_ARCH = -DHOTSPOT_LIB_ARCH=\"$(LIBARCH)\" HS_LIB_ARCH = -DHOTSPOT_LIB_ARCH=\"$(LIBARCH)\"
BUILD_TARGET = -DHOTSPOT_BUILD_TARGET="\"$(TARGET)\"" BUILD_TARGET = -DHOTSPOT_BUILD_TARGET="\"$(TARGET)\""
BUILD_USER = -DHOTSPOT_BUILD_USER="\"$(HOTSPOT_BUILD_USER)\"" BUILD_USER = -DHOTSPOT_BUILD_USER="\"$(HOTSPOT_BUILD_USER)\""
@ -92,7 +89,6 @@ VM_DISTRO = -DHOTSPOT_VM_DISTRO="\"$(HOTSPOT_VM_DISTRO)\""
CXXFLAGS = \ CXXFLAGS = \
${SYSDEFS} \ ${SYSDEFS} \
${INCLUDES} \ ${INCLUDES} \
${BUILD_VERSION} \
${BUILD_TARGET} \ ${BUILD_TARGET} \
${BUILD_USER} \ ${BUILD_USER} \
${HS_LIB_ARCH} \ ${HS_LIB_ARCH} \
@ -101,7 +97,7 @@ CXXFLAGS = \
# This is VERY important! The version define must only be supplied to vm_version.o # This is VERY important! The version define must only be supplied to vm_version.o
# If not, ccache will not re-use the cache at all, since the version string might contain # If not, ccache will not re-use the cache at all, since the version string might contain
# a time and date. # a time and date.
CXXFLAGS/vm_version.o += ${JRE_VERSION} CXXFLAGS/vm_version.o += ${VM_VER_DEFS}
CXXFLAGS/BYFILE = $(CXXFLAGS/$@) CXXFLAGS/BYFILE = $(CXXFLAGS/$@)

View File

@ -36,7 +36,7 @@
# GAMMADIR - top of workspace # GAMMADIR - top of workspace
# OS_FAMILY - operating system # OS_FAMILY - operating system
# VARIANT - core, compiler1, compiler2, or tiered # VARIANT - core, compiler1, compiler2, or tiered
# HOTSPOT_RELEASE_VERSION - <major>.<minor>-b<nn> (11.0-b07) # HOTSPOT_RELEASE_VERSION - <major_ver>.<minor_ver>.<micro_ver>[-<identifier>][-<debug_target>][-b<nn>]
# HOTSPOT_BUILD_VERSION - internal, internal-$(USER_RELEASE_SUFFIX) or empty # HOTSPOT_BUILD_VERSION - internal, internal-$(USER_RELEASE_SUFFIX) or empty
# JRE_RELEASE_VERSION - <major>.<minor>.<micro> (1.7.0) # JRE_RELEASE_VERSION - <major>.<minor>.<micro> (1.7.0)
# #

View File

@ -161,6 +161,7 @@
_JVM_GetStackTraceElement _JVM_GetStackTraceElement
_JVM_GetSystemPackage _JVM_GetSystemPackage
_JVM_GetSystemPackages _JVM_GetSystemPackages
_JVM_GetTemporaryDirectory
_JVM_GetThreadStateNames _JVM_GetThreadStateNames
_JVM_GetThreadStateValues _JVM_GetThreadStateValues
_JVM_GetVersionInfo _JVM_GetVersionInfo

View File

@ -161,6 +161,7 @@
_JVM_GetStackTraceElement _JVM_GetStackTraceElement
_JVM_GetSystemPackage _JVM_GetSystemPackage
_JVM_GetSystemPackages _JVM_GetSystemPackages
_JVM_GetTemporaryDirectory
_JVM_GetThreadStateNames _JVM_GetThreadStateNames
_JVM_GetThreadStateValues _JVM_GetThreadStateValues
_JVM_GetVersionInfo _JVM_GetVersionInfo

View File

@ -122,7 +122,7 @@ SUNWprivate_1.1 {
JVM_GetClassModifiers; JVM_GetClassModifiers;
JVM_GetClassName; JVM_GetClassName;
JVM_GetClassNameUTF; JVM_GetClassNameUTF;
JVM_GetClassSignature; JVM_GetClassSignature;
JVM_GetClassSigners; JVM_GetClassSigners;
JVM_GetClassTypeAnnotations; JVM_GetClassTypeAnnotations;
JVM_GetComponentType; JVM_GetComponentType;
@ -163,6 +163,7 @@ SUNWprivate_1.1 {
JVM_GetStackTraceElement; JVM_GetStackTraceElement;
JVM_GetSystemPackage; JVM_GetSystemPackage;
JVM_GetSystemPackages; JVM_GetSystemPackages;
JVM_GetTemporaryDirectory;
JVM_GetThreadStateNames; JVM_GetThreadStateNames;
JVM_GetThreadStateValues; JVM_GetThreadStateValues;
JVM_GetVersionInfo; JVM_GetVersionInfo;

View File

@ -163,6 +163,7 @@ SUNWprivate_1.1 {
JVM_GetStackTraceElement; JVM_GetStackTraceElement;
JVM_GetSystemPackage; JVM_GetSystemPackage;
JVM_GetSystemPackages; JVM_GetSystemPackages;
JVM_GetTemporaryDirectory;
JVM_GetThreadStateNames; JVM_GetThreadStateNames;
JVM_GetThreadStateValues; JVM_GetThreadStateValues;
JVM_GetVersionInfo; JVM_GetVersionInfo;

View File

@ -72,17 +72,14 @@ else
endif endif
endif endif
# HOTSPOT_RELEASE_VERSION and HOTSPOT_BUILD_VERSION are defined
# in $(GAMMADIR)/make/defs.make
ifeq ($(HOTSPOT_BUILD_VERSION),)
BUILD_VERSION = -DHOTSPOT_RELEASE_VERSION="\"$(HOTSPOT_RELEASE_VERSION)\""
else
BUILD_VERSION = -DHOTSPOT_RELEASE_VERSION="\"$(HOTSPOT_RELEASE_VERSION)-$(HOTSPOT_BUILD_VERSION)\""
endif
# The following variables are defined in the generated flags.make file. # The following variables are defined in the generated flags.make file.
BUILD_VERSION = -DHOTSPOT_RELEASE_VERSION="\"$(HS_BUILD_VER)\"" JDK_VER_DEFS = -DJDK_MAJOR_VERSION="\"$(JDK_MAJOR_VERSION)\"" \
JRE_VERSION = -DJRE_RELEASE_VERSION="\"$(JRE_RELEASE_VER)\"" -DJDK_MINOR_VERSION="\"$(JDK_MINOR_VERSION)\"" \
-DJDK_MICRO_VERSION="\"$(JDK_MICRO_VERSION)\"" \
-DJDK_BUILD_NUMBER="\"$(JDK_BUILD_NUMBER)\""
VM_VER_DEFS = -DHOTSPOT_RELEASE_VERSION="\"$(HS_BUILD_VER)\"" \
-DJRE_RELEASE_VERSION="\"$(JRE_RELEASE_VER)\"" \
$(JDK_VER_DEFS)
HS_LIB_ARCH = -DHOTSPOT_LIB_ARCH=\"$(LIBARCH)\" HS_LIB_ARCH = -DHOTSPOT_LIB_ARCH=\"$(LIBARCH)\"
BUILD_TARGET = -DHOTSPOT_BUILD_TARGET="\"$(TARGET)\"" BUILD_TARGET = -DHOTSPOT_BUILD_TARGET="\"$(TARGET)\""
BUILD_USER = -DHOTSPOT_BUILD_USER="\"$(HOTSPOT_BUILD_USER)\"" BUILD_USER = -DHOTSPOT_BUILD_USER="\"$(HOTSPOT_BUILD_USER)\""
@ -91,7 +88,6 @@ VM_DISTRO = -DHOTSPOT_VM_DISTRO="\"$(HOTSPOT_VM_DISTRO)\""
CXXFLAGS = \ CXXFLAGS = \
${SYSDEFS} \ ${SYSDEFS} \
${INCLUDES} \ ${INCLUDES} \
${BUILD_VERSION} \
${BUILD_TARGET} \ ${BUILD_TARGET} \
${BUILD_USER} \ ${BUILD_USER} \
${HS_LIB_ARCH} \ ${HS_LIB_ARCH} \
@ -100,7 +96,7 @@ CXXFLAGS = \
# This is VERY important! The version define must only be supplied to vm_version.o # This is VERY important! The version define must only be supplied to vm_version.o
# If not, ccache will not re-use the cache at all, since the version string might contain # If not, ccache will not re-use the cache at all, since the version string might contain
# a time and date. # a time and date.
CXXFLAGS/vm_version.o += ${JRE_VERSION} CXXFLAGS/vm_version.o += ${VM_VER_DEFS}
CXXFLAGS/BYFILE = $(CXXFLAGS/$@) CXXFLAGS/BYFILE = $(CXXFLAGS/$@)

View File

@ -114,7 +114,7 @@ ifeq ($(JVM_VARIANTS),)
endif endif
# hotspot version definitions # hotspot version definitions
include $(GAMMADIR)/make/hotspot_version include $(GAMMADIR)/make/jdk_version
# Java versions needed # Java versions needed
ifeq ($(PREVIOUS_JDK_VERSION),) ifeq ($(PREVIOUS_JDK_VERSION),)
@ -129,6 +129,9 @@ endif
ifeq ($(JDK_MICRO_VERSION),) ifeq ($(JDK_MICRO_VERSION),)
JDK_MICRO_VERSION=$(JDK_MICRO_VER) JDK_MICRO_VERSION=$(JDK_MICRO_VER)
endif endif
ifeq ($(JDK_BUILD_NUMBER),)
JDK_BUILD_NUMBER=0
endif
ifeq ($(JDK_MKTG_VERSION),) ifeq ($(JDK_MKTG_VERSION),)
JDK_MKTG_VERSION=$(JDK_MINOR_VERSION).$(JDK_MICRO_VERSION) JDK_MKTG_VERSION=$(JDK_MINOR_VERSION).$(JDK_MICRO_VERSION)
endif endif
@ -146,7 +149,7 @@ ifndef JRE_RELEASE_VERSION
endif endif
ifndef HOTSPOT_RELEASE_VERSION ifndef HOTSPOT_RELEASE_VERSION
HOTSPOT_RELEASE_VERSION=$(HS_MAJOR_VER).$(HS_MINOR_VER)-b$(HS_BUILD_NUMBER) HOTSPOT_RELEASE_VERSION=$(FULL_VERSION)
endif endif
ifdef HOTSPOT_BUILD_VERSION ifdef HOTSPOT_BUILD_VERSION
@ -325,7 +328,6 @@ MAKE_ARGS += BOOTDIR=$(ABS_BOOTDIR)
MAKE_ARGS += OUTPUTDIR=$(ABS_OUTPUTDIR) MAKE_ARGS += OUTPUTDIR=$(ABS_OUTPUTDIR)
MAKE_ARGS += GAMMADIR=$(ABS_GAMMADIR) MAKE_ARGS += GAMMADIR=$(ABS_GAMMADIR)
MAKE_ARGS += MAKE_VERBOSE=$(MAKE_VERBOSE) MAKE_ARGS += MAKE_VERBOSE=$(MAKE_VERBOSE)
MAKE_ARGS += HOTSPOT_RELEASE_VERSION=$(HOTSPOT_RELEASE_VERSION)
MAKE_ARGS += JRE_RELEASE_VERSION=$(JRE_RELEASE_VERSION) MAKE_ARGS += JRE_RELEASE_VERSION=$(JRE_RELEASE_VERSION)
# Pass HOTSPOT_BUILD_VERSION as argument to OS specific Makefile # Pass HOTSPOT_BUILD_VERSION as argument to OS specific Makefile

View File

@ -1,5 +1,5 @@
# #
# Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # This code is free software; you can redistribute it and/or modify it
@ -19,27 +19,18 @@
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any # or visit www.oracle.com if you need additional information or have any
# questions. # questions.
#
# #
# # Master JDK version file. These values may be overridden by a control
#
# Master Hotspot version file. These values may be overridden by a control
# workspace build. This file format must remain compatible with both # workspace build. This file format must remain compatible with both
# GNU Makefile and Microsoft nmake formats. # GNU Makefile and Microsoft nmake formats.
# #
# Don't put quotes (fail windows build). # Don't put quotes (fail windows build).
HOTSPOT_VM_COPYRIGHT=Copyright 2013 HOTSPOT_VM_COPYRIGHT=Copyright 2014
HS_MAJOR_VER=25
HS_MINOR_VER=0
HS_BUILD_NUMBER=62
JDK_MAJOR_VER=1 JDK_MAJOR_VER=1
JDK_MINOR_VER=8 JDK_MINOR_VER=9
JDK_MICRO_VER=0 JDK_MICRO_VER=0
# Previous (bootdir) JDK version # Previous (bootdir) JDK version
JDK_PREVIOUS_VERSION=1.7.0 JDK_PREVIOUS_VERSION=1.8.0

View File

@ -36,7 +36,7 @@
# GAMMADIR - top of workspace # GAMMADIR - top of workspace
# OS_FAMILY - operating system # OS_FAMILY - operating system
# VARIANT - core, compiler1, compiler2, or tiered # VARIANT - core, compiler1, compiler2, or tiered
# HOTSPOT_RELEASE_VERSION - <major>.<minor>-b<nn> (11.0-b07) # HOTSPOT_RELEASE_VERSION - <major_ver>.<minor_ver>.<micro_ver>[-<identifier>][-<debug_target>][-b<nn>]
# HOTSPOT_BUILD_VERSION - internal, internal-$(USER_RELEASE_SUFFIX) or empty # HOTSPOT_BUILD_VERSION - internal, internal-$(USER_RELEASE_SUFFIX) or empty
# JRE_RELEASE_VERSION - <major>.<minor>.<micro> (1.7.0) # JRE_RELEASE_VERSION - <major>.<minor>.<micro> (1.7.0)
# #

View File

@ -122,7 +122,7 @@ SUNWprivate_1.1 {
JVM_GetClassModifiers; JVM_GetClassModifiers;
JVM_GetClassName; JVM_GetClassName;
JVM_GetClassNameUTF; JVM_GetClassNameUTF;
JVM_GetClassSignature; JVM_GetClassSignature;
JVM_GetClassSigners; JVM_GetClassSigners;
JVM_GetClassTypeAnnotations; JVM_GetClassTypeAnnotations;
JVM_GetComponentType; JVM_GetComponentType;
@ -163,6 +163,7 @@ SUNWprivate_1.1 {
JVM_GetStackTraceElement; JVM_GetStackTraceElement;
JVM_GetSystemPackage; JVM_GetSystemPackage;
JVM_GetSystemPackages; JVM_GetSystemPackages;
JVM_GetTemporaryDirectory;
JVM_GetThreadStateNames; JVM_GetThreadStateNames;
JVM_GetThreadStateValues; JVM_GetThreadStateValues;
JVM_GetVersionInfo; JVM_GetVersionInfo;

View File

@ -163,6 +163,7 @@ SUNWprivate_1.1 {
JVM_GetStackTraceElement; JVM_GetStackTraceElement;
JVM_GetSystemPackage; JVM_GetSystemPackage;
JVM_GetSystemPackages; JVM_GetSystemPackages;
JVM_GetTemporaryDirectory;
JVM_GetThreadStateNames; JVM_GetThreadStateNames;
JVM_GetThreadStateValues; JVM_GetThreadStateValues;
JVM_GetVersionInfo; JVM_GetVersionInfo;

View File

@ -73,17 +73,14 @@ else
endif endif
endif endif
# HOTSPOT_RELEASE_VERSION and HOTSPOT_BUILD_VERSION are defined
# in $(GAMMADIR)/make/defs.make
ifeq ($(HOTSPOT_BUILD_VERSION),)
BUILD_VERSION = -DHOTSPOT_RELEASE_VERSION="\"$(HOTSPOT_RELEASE_VERSION)\""
else
BUILD_VERSION = -DHOTSPOT_RELEASE_VERSION="\"$(HOTSPOT_RELEASE_VERSION)-$(HOTSPOT_BUILD_VERSION)\""
endif
# The following variables are defined in the generated flags.make file. # The following variables are defined in the generated flags.make file.
BUILD_VERSION = -DHOTSPOT_RELEASE_VERSION="\"$(HS_BUILD_VER)\"" JDK_VER_DEFS = -DJDK_MAJOR_VERSION="\"$(JDK_MAJOR_VERSION)\"" \
JRE_VERSION = -DJRE_RELEASE_VERSION="\"$(JRE_RELEASE_VER)\"" -DJDK_MINOR_VERSION="\"$(JDK_MINOR_VERSION)\"" \
-DJDK_MICRO_VERSION="\"$(JDK_MICRO_VERSION)\"" \
-DJDK_BUILD_NUMBER="\"$(JDK_BUILD_NUMBER)\""
VM_VER_DEFS = -DHOTSPOT_RELEASE_VERSION="\"$(HS_BUILD_VER)\"" \
-DJRE_RELEASE_VERSION="\"$(JRE_RELEASE_VER)\"" \
$(JDK_VER_DEFS)
HS_LIB_ARCH = -DHOTSPOT_LIB_ARCH=\"$(LIBARCH)\" HS_LIB_ARCH = -DHOTSPOT_LIB_ARCH=\"$(LIBARCH)\"
BUILD_TARGET = -DHOTSPOT_BUILD_TARGET="\"$(TARGET)\"" BUILD_TARGET = -DHOTSPOT_BUILD_TARGET="\"$(TARGET)\""
BUILD_USER = -DHOTSPOT_BUILD_USER="\"$(HOTSPOT_BUILD_USER)\"" BUILD_USER = -DHOTSPOT_BUILD_USER="\"$(HOTSPOT_BUILD_USER)\""
@ -92,7 +89,6 @@ VM_DISTRO = -DHOTSPOT_VM_DISTRO="\"$(HOTSPOT_VM_DISTRO)\""
CXXFLAGS = \ CXXFLAGS = \
${SYSDEFS} \ ${SYSDEFS} \
${INCLUDES} \ ${INCLUDES} \
${BUILD_VERSION} \
${BUILD_TARGET} \ ${BUILD_TARGET} \
${BUILD_USER} \ ${BUILD_USER} \
${HS_LIB_ARCH} \ ${HS_LIB_ARCH} \
@ -101,7 +97,7 @@ CXXFLAGS = \
# This is VERY important! The version define must only be supplied to vm_version.o # This is VERY important! The version define must only be supplied to vm_version.o
# If not, ccache will not re-use the cache at all, since the version string might contain # If not, ccache will not re-use the cache at all, since the version string might contain
# a time and date. # a time and date.
CXXFLAGS/vm_version.o += ${JRE_VERSION} CXXFLAGS/vm_version.o += ${VM_VER_DEFS}
CXXFLAGS/BYFILE = $(CXXFLAGS/$@) CXXFLAGS/BYFILE = $(CXXFLAGS/$@)

View File

@ -36,7 +36,7 @@
# GAMMADIR - top of workspace # GAMMADIR - top of workspace
# OS_FAMILY - operating system # OS_FAMILY - operating system
# VARIANT - core, compiler1, compiler2, or tiered # VARIANT - core, compiler1, compiler2, or tiered
# HOTSPOT_RELEASE_VERSION - <major>.<minor>-b<nn> (11.0-b07) # HOTSPOT_RELEASE_VERSION - <major_ver>.<minor_ver>.<micro_ver>[-<identifier>][-<debug_target>][-b<nn>]
# HOTSPOT_BUILD_VERSION - internal, internal-$(USER_RELEASE_SUFFIX) or empty # HOTSPOT_BUILD_VERSION - internal, internal-$(USER_RELEASE_SUFFIX) or empty
# JRE_RELEASE_VERSION - <major>.<minor>.<micro> (1.7.0) # JRE_RELEASE_VERSION - <major>.<minor>.<micro> (1.7.0)
# #

View File

@ -163,6 +163,7 @@ SUNWprivate_1.1 {
JVM_GetStackTraceElement; JVM_GetStackTraceElement;
JVM_GetSystemPackage; JVM_GetSystemPackage;
JVM_GetSystemPackages; JVM_GetSystemPackages;
JVM_GetTemporaryDirectory;
JVM_GetThreadStateNames; JVM_GetThreadStateNames;
JVM_GetThreadStateValues; JVM_GetThreadStateValues;
JVM_GetVersionInfo; JVM_GetVersionInfo;

View File

@ -69,8 +69,13 @@ else
endif endif
# The following variables are defined in the generated flags.make file. # The following variables are defined in the generated flags.make file.
BUILD_VERSION = -DHOTSPOT_RELEASE_VERSION="\"$(HS_BUILD_VER)\"" JDK_VER_DEFS = -DJDK_MAJOR_VERSION="\"$(JDK_MAJOR_VERSION)\"" \
JRE_VERSION = -DJRE_RELEASE_VERSION="\"$(JRE_RELEASE_VER)\"" -DJDK_MINOR_VERSION="\"$(JDK_MINOR_VERSION)\"" \
-DJDK_MICRO_VERSION="\"$(JDK_MICRO_VERSION)\"" \
-DJDK_BUILD_NUMBER="\"$(JDK_BUILD_NUMBER)\""
VM_VER_DEFS = -DHOTSPOT_RELEASE_VERSION="\"$(HS_BUILD_VER)\"" \
-DJRE_RELEASE_VERSION="\"$(JRE_RELEASE_VER)\"" \
$(JDK_VER_DEFS)
HS_LIB_ARCH = -DHOTSPOT_LIB_ARCH=\"$(LIBARCH)\" HS_LIB_ARCH = -DHOTSPOT_LIB_ARCH=\"$(LIBARCH)\"
BUILD_TARGET = -DHOTSPOT_BUILD_TARGET="\"$(TARGET)\"" BUILD_TARGET = -DHOTSPOT_BUILD_TARGET="\"$(TARGET)\""
BUILD_USER = -DHOTSPOT_BUILD_USER="\"$(HOTSPOT_BUILD_USER)\"" BUILD_USER = -DHOTSPOT_BUILD_USER="\"$(HOTSPOT_BUILD_USER)\""
@ -79,7 +84,6 @@ VM_DISTRO = -DHOTSPOT_VM_DISTRO="\"$(HOTSPOT_VM_DISTRO)\""
CXXFLAGS = \ CXXFLAGS = \
${SYSDEFS} \ ${SYSDEFS} \
${INCLUDES} \ ${INCLUDES} \
${BUILD_VERSION} \
${BUILD_TARGET} \ ${BUILD_TARGET} \
${BUILD_USER} \ ${BUILD_USER} \
${HS_LIB_ARCH} \ ${HS_LIB_ARCH} \
@ -88,7 +92,7 @@ CXXFLAGS = \
# This is VERY important! The version define must only be supplied to vm_version.o # This is VERY important! The version define must only be supplied to vm_version.o
# If not, ccache will not re-use the cache at all, since the version string might contain # If not, ccache will not re-use the cache at all, since the version string might contain
# a time and date. # a time and date.
CXXFLAGS/vm_version.o += ${JRE_VERSION} CXXFLAGS/vm_version.o += ${VM_VER_DEFS}
CXXFLAGS/BYFILE = $(CXXFLAGS/$@) CXXFLAGS/BYFILE = $(CXXFLAGS/$@)

View File

@ -117,7 +117,7 @@ VARIANT_TEXT=Tiered
# These can be overridden via the nmake.exe command line. # These can be overridden via the nmake.exe command line.
# They are overridden by RE during the control builds. # They are overridden by RE during the control builds.
# #
!include "$(WorkSpace)/make/hotspot_version" !include "$(WorkSpace)/make/jdk_version"
# Define HOTSPOT_VM_DISTRO based on settings in make/openjdk_distro # Define HOTSPOT_VM_DISTRO based on settings in make/openjdk_distro
# or make/hotspot_distro. # or make/hotspot_distro.
@ -163,7 +163,7 @@ HS_FILEDESC=$(HOTSPOT_VM_DISTRO) $(ARCH_TEXT) $(VARIANT_TEXT) VM
# 1.6.0-b01 will be 6.0.0.1 # 1.6.0-b01 will be 6.0.0.1
# 1.6.0_01a-b02 will be 6.0.11.2 # 1.6.0_01a-b02 will be 6.0.11.2
# #
# JDK_* variables are defined in make/hotspot_version or on command line # JDK_* variables are defined in make/jdk_version or on command line
# #
JDK_VER=$(JDK_MINOR_VER),$(JDK_MICRO_VER),$(JDK_UPDATE_VER),$(JDK_BUILD_NUMBER) JDK_VER=$(JDK_MINOR_VER),$(JDK_MICRO_VER),$(JDK_UPDATE_VER),$(JDK_BUILD_NUMBER)
JDK_DOTVER=$(JDK_MINOR_VER).$(JDK_MICRO_VER).$(JDK_UPDATE_VER).$(JDK_BUILD_NUMBER) JDK_DOTVER=$(JDK_MINOR_VER).$(JDK_MICRO_VER).$(JDK_UPDATE_VER).$(JDK_BUILD_NUMBER)
@ -179,13 +179,12 @@ JDK_MKTG_VERSION=$(JDK_MINOR_VER).$(JDK_MICRO_VER)
# Hotspot Express VM FileVersion: # Hotspot Express VM FileVersion:
# 10.0-b<yz> will have DLL version 10.0.0.yz (need 4 numbers). # 10.0-b<yz> will have DLL version 10.0.0.yz (need 4 numbers).
# #
# HS_* variables are defined in make/hotspot_version
# #
HS_VER=$(HS_MAJOR_VER),$(HS_MINOR_VER),0,$(HS_BUILD_NUMBER) HS_VER=$(JDK_VER)
HS_DOTVER=$(HS_MAJOR_VER).$(HS_MINOR_VER).0.$(HS_BUILD_NUMBER) HS_DOTVER=$(JDK_DOTVER)
!if "$(HOTSPOT_RELEASE_VERSION)" == "" !if "$(HOTSPOT_RELEASE_VERSION)" == ""
HOTSPOT_RELEASE_VERSION=$(HS_MAJOR_VER).$(HS_MINOR_VER)-b$(HS_BUILD_NUMBER) HOTSPOT_RELEASE_VERSION=$(JRE_RELEASE_VERSION)
!endif !endif
!if "$(HOTSPOT_BUILD_VERSION)" == "" !if "$(HOTSPOT_BUILD_VERSION)" == ""

View File

@ -179,9 +179,9 @@ LIBRARY_SUFFIX=dll
# next parameters are defined in $(GAMMADIR)/make/defs.make. # next parameters are defined in $(GAMMADIR)/make/defs.make.
MAKE_ARGS += JDK_MKTG_VERSION=$(JDK_MKTG_VERSION) MAKE_ARGS += JDK_MKTG_VERSION=$(JDK_MKTG_VERSION)
MAKE_ARGS += JDK_MAJOR_VER=$(JDK_MAJOR_VERSION) MAKE_ARGS += JDK_MAJOR_VERSION=$(JDK_MAJOR_VERSION)
MAKE_ARGS += JDK_MINOR_VER=$(JDK_MINOR_VERSION) MAKE_ARGS += JDK_MINOR_VERSION=$(JDK_MINOR_VERSION)
MAKE_ARGS += JDK_MICRO_VER=$(JDK_MICRO_VERSION) MAKE_ARGS += JDK_MICRO_VERSION=$(JDK_MICRO_VERSION)
ifdef COOKED_JDK_UPDATE_VERSION ifdef COOKED_JDK_UPDATE_VERSION
MAKE_ARGS += JDK_UPDATE_VER=$(COOKED_JDK_UPDATE_VERSION) MAKE_ARGS += JDK_UPDATE_VER=$(COOKED_JDK_UPDATE_VERSION)

View File

@ -56,6 +56,10 @@ HOTSPOT_LIB_ARCH=$(BUILDARCH)
# The following variables are defined in the generated local.make file. # The following variables are defined in the generated local.make file.
CXX_FLAGS=$(CXX_FLAGS) /D "HOTSPOT_RELEASE_VERSION=\"$(HS_BUILD_VER)\"" CXX_FLAGS=$(CXX_FLAGS) /D "HOTSPOT_RELEASE_VERSION=\"$(HS_BUILD_VER)\""
CXX_FLAGS=$(CXX_FLAGS) /D "JDK_MAJOR_VERSION=\"$(JDK_MAJOR_VERSION)\""
CXX_FLAGS=$(CXX_FLAGS) /D "JDK_MINOR_VERSION=\"$(JDK_MINOR_VERSION)\""
CXX_FLAGS=$(CXX_FLAGS) /D "JDK_MICRO_VERSION=\"$(JDK_MICRO_VERSION)\""
CXX_FLAGS=$(CXX_FLAGS) /D "JDK_BUILD_NUMBER=\"$(JDK_BUILD_NUMBER)\""
CXX_FLAGS=$(CXX_FLAGS) /D "JRE_RELEASE_VERSION=\"$(JRE_RELEASE_VER)\"" CXX_FLAGS=$(CXX_FLAGS) /D "JRE_RELEASE_VERSION=\"$(JRE_RELEASE_VER)\""
CXX_FLAGS=$(CXX_FLAGS) /D "HOTSPOT_LIB_ARCH=\"$(HOTSPOT_LIB_ARCH)\"" 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_TARGET=\"$(BUILD_FLAVOR)\""

View File

@ -78,24 +78,23 @@ HS_INTERNAL_NAME=jvm
default:: $(AdditionalTargets) $(JvmtiGeneratedFiles) $(TraceGeneratedFiles) default:: $(AdditionalTargets) $(JvmtiGeneratedFiles) $(TraceGeneratedFiles)
!include $(HOTSPOTWORKSPACE)/make/hotspot_version !include $(HOTSPOTWORKSPACE)/make/jdk_version
!if "$(USER_RELEASE_SUFFIX)" != "" !if "$(USER_RELEASE_SUFFIX)" != ""
HOTSPOT_BUILD_VERSION = internal-$(USER_RELEASE_SUFFIX) HOTSPOT_BUILD_VERSION = internal-$(USER_RELEASE_SUFFIX)
!else !else
HOTSPOT_BUILD_VERSION = internal HOTSPOT_BUILD_VERSION = internal
!endif !endif
!if "$(HOTSPOT_RELEASE_VERSION)" != ""
HOTSPOT_RELEASE_VERSION="\\\"$(HOTSPOT_RELEASE_VERSION)\\\""
!else
HOTSPOT_RELEASE_VERSION="\\\"$(HS_MAJOR_VER).$(HS_MINOR_VER)-b$(HS_BUILD_NUMBER)-$(HOTSPOT_BUILD_VERSION)\\\""
!endif
!if "$(JRE_RELEASE_VERSION)" != "" !if "$(JRE_RELEASE_VERSION)" != ""
JRE_RELEASE_VERSION="\\\"$(JRE_RELEASE_VERSION)\\\"" JRE_RELEASE_VERSION="\\\"$(JRE_RELEASE_VERSION)\\\""
!else !else
JRE_RELEASE_VERSION="\\\"$(JDK_MAJOR_VER).$(JDK_MINOR_VER).$(JDK_MICRO_VER)\\\"" JRE_RELEASE_VERSION="\\\"$(JDK_MAJOR_VER).$(JDK_MINOR_VER).$(JDK_MICRO_VER)\\\""
!endif !endif
!if "$(HOTSPOT_RELEASE_VERSION)" != ""
HOTSPOT_RELEASE_VERSION="\\\"$(HOTSPOT_RELEASE_VERSION)\\\""
!else
HOTSPOT_RELEASE_VERSION="\\\"$(JRE_RELEASE_VERSION)\\\""
!endif
# Define HOTSPOT_VM_DISTRO if HOTSPOT_VM_DISTRO is set, # Define HOTSPOT_VM_DISTRO if HOTSPOT_VM_DISTRO is set,
# and if it is not see if we have the src/closed directory # and if it is not see if we have the src/closed directory
!if "$(HOTSPOT_VM_DISTRO)" != "" !if "$(HOTSPOT_VM_DISTRO)" != ""

View File

@ -127,8 +127,12 @@
// global variables // global variables
julong os::Bsd::_physical_memory = 0; julong os::Bsd::_physical_memory = 0;
#ifdef __APPLE__
mach_timebase_info_data_t os::Bsd::_timebase_info = {0, 0};
volatile uint64_t os::Bsd::_max_abstime = 0;
#else
int (*os::Bsd::_clock_gettime)(clockid_t, struct timespec *) = NULL; int (*os::Bsd::_clock_gettime)(clockid_t, struct timespec *) = NULL;
#endif
pthread_t os::Bsd::_main_thread; pthread_t os::Bsd::_main_thread;
int os::Bsd::_page_size = -1; int os::Bsd::_page_size = -1;
@ -986,13 +990,15 @@ jlong os::javaTimeMillis() {
return jlong(time.tv_sec) * 1000 + jlong(time.tv_usec / 1000); return jlong(time.tv_sec) * 1000 + jlong(time.tv_usec / 1000);
} }
#ifndef __APPLE__
#ifndef CLOCK_MONOTONIC #ifndef CLOCK_MONOTONIC
#define CLOCK_MONOTONIC (1) #define CLOCK_MONOTONIC (1)
#endif #endif
#endif
#ifdef __APPLE__ #ifdef __APPLE__
void os::Bsd::clock_init() { void os::Bsd::clock_init() {
// XXXDARWIN: Investigate replacement monotonic clock mach_timebase_info(&_timebase_info);
} }
#else #else
void os::Bsd::clock_init() { void os::Bsd::clock_init() {
@ -1007,10 +1013,39 @@ void os::Bsd::clock_init() {
#endif #endif
#ifdef __APPLE__
jlong os::javaTimeNanos() {
const uint64_t tm = mach_absolute_time();
const uint64_t now = (tm * Bsd::_timebase_info.numer) / Bsd::_timebase_info.denom;
const uint64_t prev = Bsd::_max_abstime;
if (now <= prev) {
return prev; // same or retrograde time;
}
const uint64_t obsv = Atomic::cmpxchg(now, (volatile jlong*)&Bsd::_max_abstime, prev);
assert(obsv >= prev, "invariant"); // Monotonicity
// If the CAS succeeded then we're done and return "now".
// If the CAS failed and the observed value "obsv" is >= now then
// we should return "obsv". If the CAS failed and now > obsv > prv then
// some other thread raced this thread and installed a new value, in which case
// we could either (a) retry the entire operation, (b) retry trying to install now
// or (c) just return obsv. We use (c). No loop is required although in some cases
// we might discard a higher "now" value in deference to a slightly lower but freshly
// installed obsv value. That's entirely benign -- it admits no new orderings compared
// to (a) or (b) -- and greatly reduces coherence traffic.
// We might also condition (c) on the magnitude of the delta between obsv and now.
// Avoiding excessive CAS operations to hot RW locations is critical.
// See https://blogs.oracle.com/dave/entry/cas_and_cache_trivia_invalidate
return (prev == obsv) ? now : obsv;
}
#else // __APPLE__
jlong os::javaTimeNanos() { jlong os::javaTimeNanos() {
if (os::supports_monotonic_clock()) { if (os::supports_monotonic_clock()) {
struct timespec tp; struct timespec tp;
int status = Bsd::clock_gettime(CLOCK_MONOTONIC, &tp); int status = Bsd::_clock_gettime(CLOCK_MONOTONIC, &tp);
assert(status == 0, "gettime error"); assert(status == 0, "gettime error");
jlong result = jlong(tp.tv_sec) * (1000 * 1000 * 1000) + jlong(tp.tv_nsec); jlong result = jlong(tp.tv_sec) * (1000 * 1000 * 1000) + jlong(tp.tv_nsec);
return result; return result;
@ -1023,6 +1058,8 @@ jlong os::javaTimeNanos() {
} }
} }
#endif // __APPLE__
void os::javaTimeNanos_info(jvmtiTimerInfo *info_ptr) { void os::javaTimeNanos_info(jvmtiTimerInfo *info_ptr) {
if (os::supports_monotonic_clock()) { if (os::supports_monotonic_clock()) {
info_ptr->max_value = ALL_64_BITS; info_ptr->max_value = ALL_64_BITS;

View File

@ -58,7 +58,13 @@ class Bsd {
// For signal flags diagnostics // For signal flags diagnostics
static int sigflags[MAXSIGNUM]; static int sigflags[MAXSIGNUM];
#ifdef __APPLE__
// mach_absolute_time
static mach_timebase_info_data_t _timebase_info;
static volatile uint64_t _max_abstime;
#else
static int (*_clock_gettime)(clockid_t, struct timespec *); static int (*_clock_gettime)(clockid_t, struct timespec *);
#endif
static GrowableArray<int>* _cpu_to_node; static GrowableArray<int>* _cpu_to_node;
@ -134,10 +140,6 @@ class Bsd {
// Real-time clock functions // Real-time clock functions
static void clock_init(void); static void clock_init(void);
static int clock_gettime(clockid_t clock_id, struct timespec *tp) {
return _clock_gettime ? _clock_gettime(clock_id, tp) : -1;
}
// Stack repair handling // Stack repair handling
// none present // none present

View File

@ -287,7 +287,11 @@ inline int os::set_sock_opt(int fd, int level, int optname,
} }
inline bool os::supports_monotonic_clock() { inline bool os::supports_monotonic_clock() {
#ifdef __APPLE__
return true;
#else
return Bsd::_clock_gettime != NULL; return Bsd::_clock_gettime != NULL;
#endif
} }
#endif // OS_BSD_VM_OS_BSD_INLINE_HPP #endif // OS_BSD_VM_OS_BSD_INLINE_HPP

View File

@ -347,11 +347,7 @@ julong os::physical_memory() {
static hrtime_t first_hrtime = 0; static hrtime_t first_hrtime = 0;
static const hrtime_t hrtime_hz = 1000*1000*1000; static const hrtime_t hrtime_hz = 1000*1000*1000;
const int LOCK_BUSY = 1;
const int LOCK_FREE = 0;
const int LOCK_INVALID = -1;
static volatile hrtime_t max_hrtime = 0; static volatile hrtime_t max_hrtime = 0;
static volatile int max_hrtime_lock = LOCK_FREE; // Update counter with LSB as lock-in-progress
void os::Solaris::initialize_system_info() { void os::Solaris::initialize_system_info() {
@ -1364,58 +1360,31 @@ void* os::thread_local_storage_at(int index) {
} }
// gethrtime can move backwards if read from one cpu and then a different cpu // gethrtime() should be monotonic according to the documentation,
// getTimeNanos is guaranteed to not move backward on Solaris // but some virtualized platforms are known to break this guarantee.
// local spinloop created as faster for a CAS on an int than // getTimeNanos() must be guaranteed not to move backwards, so we
// a CAS on a 64bit jlong. Also Atomic::cmpxchg for jlong is not // are forced to add a check here.
// supported on sparc v8 or pre supports_cx8 intel boxes.
// oldgetTimeNanos for systems which do not support CAS on 64bit jlong
// i.e. sparc v8 and pre supports_cx8 (i486) intel boxes
inline hrtime_t oldgetTimeNanos() {
int gotlock = LOCK_INVALID;
hrtime_t newtime = gethrtime();
for (;;) {
// grab lock for max_hrtime
int curlock = max_hrtime_lock;
if (curlock & LOCK_BUSY) continue;
if (gotlock = Atomic::cmpxchg(LOCK_BUSY, &max_hrtime_lock, LOCK_FREE) != LOCK_FREE) continue;
if (newtime > max_hrtime) {
max_hrtime = newtime;
} else {
newtime = max_hrtime;
}
// release lock
max_hrtime_lock = LOCK_FREE;
return newtime;
}
}
// gethrtime can move backwards if read from one cpu and then a different cpu
// getTimeNanos is guaranteed to not move backward on Solaris
inline hrtime_t getTimeNanos() { inline hrtime_t getTimeNanos() {
if (VM_Version::supports_cx8()) { const hrtime_t now = gethrtime();
const hrtime_t now = gethrtime(); const hrtime_t prev = max_hrtime;
// Use atomic long load since 32-bit x86 uses 2 registers to keep long. if (now <= prev) {
const hrtime_t prev = Atomic::load((volatile jlong*)&max_hrtime); return prev; // same or retrograde time;
if (now <= prev) return prev; // same or retrograde time;
const hrtime_t obsv = Atomic::cmpxchg(now, (volatile jlong*)&max_hrtime, prev);
assert(obsv >= prev, "invariant"); // Monotonicity
// If the CAS succeeded then we're done and return "now".
// If the CAS failed and the observed value "obs" is >= now then
// we should return "obs". If the CAS failed and now > obs > prv then
// some other thread raced this thread and installed a new value, in which case
// we could either (a) retry the entire operation, (b) retry trying to install now
// or (c) just return obs. We use (c). No loop is required although in some cases
// we might discard a higher "now" value in deference to a slightly lower but freshly
// installed obs value. That's entirely benign -- it admits no new orderings compared
// to (a) or (b) -- and greatly reduces coherence traffic.
// We might also condition (c) on the magnitude of the delta between obs and now.
// Avoiding excessive CAS operations to hot RW locations is critical.
// See http://blogs.sun.com/dave/entry/cas_and_cache_trivia_invalidate
return (prev == obsv) ? now : obsv ;
} else {
return oldgetTimeNanos();
} }
const hrtime_t obsv = Atomic::cmpxchg(now, (volatile jlong*)&max_hrtime, prev);
assert(obsv >= prev, "invariant"); // Monotonicity
// If the CAS succeeded then we're done and return "now".
// If the CAS failed and the observed value "obsv" is >= now then
// we should return "obsv". If the CAS failed and now > obsv > prv then
// some other thread raced this thread and installed a new value, in which case
// we could either (a) retry the entire operation, (b) retry trying to install now
// or (c) just return obsv. We use (c). No loop is required although in some cases
// we might discard a higher "now" value in deference to a slightly lower but freshly
// installed obsv value. That's entirely benign -- it admits no new orderings compared
// to (a) or (b) -- and greatly reduces coherence traffic.
// We might also condition (c) on the magnitude of the delta between obsv and now.
// Avoiding excessive CAS operations to hot RW locations is critical.
// See https://blogs.oracle.com/dave/entry/cas_and_cache_trivia_invalidate
return (prev == obsv) ? now : obsv;
} }
// Time since start-up in seconds to a fine granularity. // Time since start-up in seconds to a fine granularity.

View File

@ -130,6 +130,13 @@ BOOL WINAPI DllMain(HINSTANCE hinst, DWORD reason, LPVOID reserved) {
case DLL_PROCESS_DETACH: case DLL_PROCESS_DETACH:
if(ForceTimeHighResolution) if(ForceTimeHighResolution)
timeEndPeriod(1L); timeEndPeriod(1L);
// Workaround for issue when a custom launcher doesn't call
// DestroyJavaVM and NMT is trying to track memory when free is
// called from a static destructor
if (MemTracker::is_on()) {
MemTracker::shutdown(MemTracker::NMT_normal);
}
break; break;
default: default:
break; break;

View File

@ -421,6 +421,15 @@ char* java_lang_String::as_utf8_string(oop java_string, int start, int len) {
return UNICODE::as_utf8(position, len); return UNICODE::as_utf8(position, len);
} }
char* java_lang_String::as_utf8_string(oop java_string, int start, int len, char* buf, int buflen) {
typeArrayOop value = java_lang_String::value(java_string);
int offset = java_lang_String::offset(java_string);
int length = java_lang_String::length(java_string);
assert(start + len <= length, "just checking");
jchar* position = value->char_at_addr(offset + start);
return UNICODE::as_utf8(position, len, buf, buflen);
}
bool java_lang_String::equals(oop java_string, jchar* chars, int len) { bool java_lang_String::equals(oop java_string, jchar* chars, int len) {
assert(java_string->klass() == SystemDictionary::String_klass(), assert(java_string->klass() == SystemDictionary::String_klass(),
"must be java_string"); "must be java_string");

View File

@ -162,6 +162,7 @@ class java_lang_String : AllStatic {
static char* as_utf8_string(oop java_string); static char* as_utf8_string(oop java_string);
static char* as_utf8_string(oop java_string, char* buf, int buflen); static char* as_utf8_string(oop java_string, char* buf, int buflen);
static char* as_utf8_string(oop java_string, int start, int len); static char* as_utf8_string(oop java_string, int start, int len);
static char* as_utf8_string(oop java_string, int start, int len, char* buf, int buflen);
static char* as_platform_dependent_str(Handle java_string, TRAPS); static char* as_platform_dependent_str(Handle java_string, TRAPS);
static jchar* as_unicode_string(oop java_string, int& length, TRAPS); static jchar* as_unicode_string(oop java_string, int& length, TRAPS);
// produce an ascii string with all other values quoted using \u#### // produce an ascii string with all other values quoted using \u####

View File

@ -1282,6 +1282,7 @@ void ConcurrentMark::checkpointRootsFinal(bool clear_all_soft_refs) {
Universe::verify(VerifyOption_G1UsePrevMarking, Universe::verify(VerifyOption_G1UsePrevMarking,
" VerifyDuringGC:(before)"); " VerifyDuringGC:(before)");
} }
g1h->check_bitmaps("Remark Start");
G1CollectorPolicy* g1p = g1h->g1_policy(); G1CollectorPolicy* g1p = g1h->g1_policy();
g1p->record_concurrent_mark_remark_start(); g1p->record_concurrent_mark_remark_start();
@ -1330,6 +1331,7 @@ void ConcurrentMark::checkpointRootsFinal(bool clear_all_soft_refs) {
Universe::verify(VerifyOption_G1UseNextMarking, Universe::verify(VerifyOption_G1UseNextMarking,
" VerifyDuringGC:(after)"); " VerifyDuringGC:(after)");
} }
g1h->check_bitmaps("Remark End");
assert(!restart_for_overflow(), "sanity"); assert(!restart_for_overflow(), "sanity");
// Completely reset the marking state since marking completed // Completely reset the marking state since marking completed
set_non_marking_state(); set_non_marking_state();
@ -1979,6 +1981,7 @@ void ConcurrentMark::cleanup() {
Universe::verify(VerifyOption_G1UsePrevMarking, Universe::verify(VerifyOption_G1UsePrevMarking,
" VerifyDuringGC:(before)"); " VerifyDuringGC:(before)");
} }
g1h->check_bitmaps("Cleanup Start");
G1CollectorPolicy* g1p = G1CollectedHeap::heap()->g1_policy(); G1CollectorPolicy* g1p = G1CollectedHeap::heap()->g1_policy();
g1p->record_concurrent_mark_cleanup_start(); g1p->record_concurrent_mark_cleanup_start();
@ -2133,6 +2136,7 @@ void ConcurrentMark::cleanup() {
Universe::verify(VerifyOption_G1UsePrevMarking, Universe::verify(VerifyOption_G1UsePrevMarking,
" VerifyDuringGC:(after)"); " VerifyDuringGC:(after)");
} }
g1h->check_bitmaps("Cleanup End");
g1h->verify_region_sets_optional(); g1h->verify_region_sets_optional();
g1h->trace_heap_after_concurrent_cycle(); g1h->trace_heap_after_concurrent_cycle();
@ -3224,6 +3228,11 @@ void ConcurrentMark::print_stats() {
void ConcurrentMark::abort() { void ConcurrentMark::abort() {
// Clear all marks to force marking thread to do nothing // Clear all marks to force marking thread to do nothing
_nextMarkBitMap->clearAll(); _nextMarkBitMap->clearAll();
// Note we cannot clear the previous marking bitmap here
// since VerifyDuringGC verifies the objects marked during
// a full GC against the previous bitmap.
// Clear the liveness counting data // Clear the liveness counting data
clear_all_count_data(); clear_all_count_data();
// Empty mark stack // Empty mark stack

View File

@ -768,6 +768,7 @@ G1CollectedHeap::humongous_obj_allocate_initialize_regions(uint first,
// match new_top. // match new_top.
assert(hr == NULL || assert(hr == NULL ||
(hr->end() == new_end && hr->top() == new_top), "sanity"); (hr->end() == new_end && hr->top() == new_top), "sanity");
check_bitmaps("Humongous Region Allocation", first_hr);
assert(first_hr->used() == word_size * HeapWordSize, "invariant"); assert(first_hr->used() == word_size * HeapWordSize, "invariant");
_summary_bytes_used += first_hr->used(); _summary_bytes_used += first_hr->used();
@ -1326,6 +1327,7 @@ bool G1CollectedHeap::do_collection(bool explicit_gc,
verify_before_gc(); verify_before_gc();
check_bitmaps("Full GC Start");
pre_full_gc_dump(gc_timer); pre_full_gc_dump(gc_timer);
COMPILER2_PRESENT(DerivedPointerTable::clear()); COMPILER2_PRESENT(DerivedPointerTable::clear());
@ -1499,6 +1501,18 @@ bool G1CollectedHeap::do_collection(bool explicit_gc,
verify_after_gc(); verify_after_gc();
// Clear the previous marking bitmap, if needed for bitmap verification.
// Note we cannot do this when we clear the next marking bitmap in
// ConcurrentMark::abort() above since VerifyDuringGC verifies the
// objects marked during a full GC against the previous bitmap.
// But we need to clear it before calling check_bitmaps below since
// the full GC has compacted objects and updated TAMS but not updated
// the prev bitmap.
if (G1VerifyBitmaps) {
((CMBitMap*) concurrent_mark()->prevMarkBitMap())->clearAll();
}
check_bitmaps("Full GC End");
// Start a new incremental collection set for the next pause // Start a new incremental collection set for the next pause
assert(g1_policy()->collection_set() == NULL, "must be"); assert(g1_policy()->collection_set() == NULL, "must be");
g1_policy()->start_incremental_cset_building(); g1_policy()->start_incremental_cset_building();
@ -3978,6 +3992,7 @@ G1CollectedHeap::do_collection_pause_at_safepoint(double target_pause_time_ms) {
increment_gc_time_stamp(); increment_gc_time_stamp();
verify_before_gc(); verify_before_gc();
check_bitmaps("GC Start");
COMPILER2_PRESENT(DerivedPointerTable::clear()); COMPILER2_PRESENT(DerivedPointerTable::clear());
@ -4223,6 +4238,7 @@ G1CollectedHeap::do_collection_pause_at_safepoint(double target_pause_time_ms) {
increment_gc_time_stamp(); increment_gc_time_stamp();
verify_after_gc(); verify_after_gc();
check_bitmaps("GC End");
assert(!ref_processor_stw()->discovery_enabled(), "Postcondition"); assert(!ref_processor_stw()->discovery_enabled(), "Postcondition");
ref_processor_stw()->verify_no_references_recorded(); ref_processor_stw()->verify_no_references_recorded();
@ -5945,6 +5961,11 @@ void G1CollectedHeap::free_region(HeapRegion* hr,
assert(!hr->is_empty(), "the region should not be empty"); assert(!hr->is_empty(), "the region should not be empty");
assert(free_list != NULL, "pre-condition"); assert(free_list != NULL, "pre-condition");
if (G1VerifyBitmaps) {
MemRegion mr(hr->bottom(), hr->end());
concurrent_mark()->clearRangePrevBitmap(mr);
}
// Clear the card counts for this region. // Clear the card counts for this region.
// Note: we only need to do this if the region is not young // Note: we only need to do this if the region is not young
// (since we don't refine cards in young regions). // (since we don't refine cards in young regions).
@ -6079,7 +6100,87 @@ void G1CollectedHeap::verify_dirty_young_list(HeapRegion* head) {
void G1CollectedHeap::verify_dirty_young_regions() { void G1CollectedHeap::verify_dirty_young_regions() {
verify_dirty_young_list(_young_list->first_region()); verify_dirty_young_list(_young_list->first_region());
} }
#endif
bool G1CollectedHeap::verify_no_bits_over_tams(const char* bitmap_name, CMBitMapRO* bitmap,
HeapWord* tams, HeapWord* end) {
guarantee(tams <= end,
err_msg("tams: "PTR_FORMAT" end: "PTR_FORMAT, tams, end));
HeapWord* result = bitmap->getNextMarkedWordAddress(tams, end);
if (result < end) {
gclog_or_tty->cr();
gclog_or_tty->print_cr("## wrong marked address on %s bitmap: "PTR_FORMAT,
bitmap_name, result);
gclog_or_tty->print_cr("## %s tams: "PTR_FORMAT" end: "PTR_FORMAT,
bitmap_name, tams, end);
return false;
}
return true;
}
bool G1CollectedHeap::verify_bitmaps(const char* caller, HeapRegion* hr) {
CMBitMapRO* prev_bitmap = concurrent_mark()->prevMarkBitMap();
CMBitMapRO* next_bitmap = (CMBitMapRO*) concurrent_mark()->nextMarkBitMap();
HeapWord* bottom = hr->bottom();
HeapWord* ptams = hr->prev_top_at_mark_start();
HeapWord* ntams = hr->next_top_at_mark_start();
HeapWord* end = hr->end();
bool res_p = verify_no_bits_over_tams("prev", prev_bitmap, ptams, end);
bool res_n = true;
// We reset mark_in_progress() before we reset _cmThread->in_progress() and in this window
// we do the clearing of the next bitmap concurrently. Thus, we can not verify the bitmap
// if we happen to be in that state.
if (mark_in_progress() || !_cmThread->in_progress()) {
res_n = verify_no_bits_over_tams("next", next_bitmap, ntams, end);
}
if (!res_p || !res_n) {
gclog_or_tty->print_cr("#### Bitmap verification failed for "HR_FORMAT,
HR_FORMAT_PARAMS(hr));
gclog_or_tty->print_cr("#### Caller: %s", caller);
return false;
}
return true;
}
void G1CollectedHeap::check_bitmaps(const char* caller, HeapRegion* hr) {
if (!G1VerifyBitmaps) return;
guarantee(verify_bitmaps(caller, hr), "bitmap verification");
}
class G1VerifyBitmapClosure : public HeapRegionClosure {
private:
const char* _caller;
G1CollectedHeap* _g1h;
bool _failures;
public:
G1VerifyBitmapClosure(const char* caller, G1CollectedHeap* g1h) :
_caller(caller), _g1h(g1h), _failures(false) { }
bool failures() { return _failures; }
virtual bool doHeapRegion(HeapRegion* hr) {
if (hr->continuesHumongous()) return false;
bool result = _g1h->verify_bitmaps(_caller, hr);
if (!result) {
_failures = true;
}
return false;
}
};
void G1CollectedHeap::check_bitmaps(const char* caller) {
if (!G1VerifyBitmaps) return;
G1VerifyBitmapClosure cl(caller, this);
heap_region_iterate(&cl);
guarantee(!cl.failures(), "bitmap verification");
}
#endif // PRODUCT
void G1CollectedHeap::cleanUpCardTable() { void G1CollectedHeap::cleanUpCardTable() {
G1SATBCardTableModRefBS* ct_bs = g1_barrier_set(); G1SATBCardTableModRefBS* ct_bs = g1_barrier_set();
@ -6464,6 +6565,7 @@ HeapRegion* G1CollectedHeap::new_mutator_alloc_region(size_t word_size,
if (new_alloc_region != NULL) { if (new_alloc_region != NULL) {
set_region_short_lived_locked(new_alloc_region); set_region_short_lived_locked(new_alloc_region);
_hr_printer.alloc(new_alloc_region, G1HRPrinter::Eden, young_list_full); _hr_printer.alloc(new_alloc_region, G1HRPrinter::Eden, young_list_full);
check_bitmaps("Mutator Region Allocation", new_alloc_region);
return new_alloc_region; return new_alloc_region;
} }
} }
@ -6530,8 +6632,10 @@ HeapRegion* G1CollectedHeap::new_gc_alloc_region(size_t word_size,
if (survivor) { if (survivor) {
new_alloc_region->set_survivor(); new_alloc_region->set_survivor();
_hr_printer.alloc(new_alloc_region, G1HRPrinter::Survivor); _hr_printer.alloc(new_alloc_region, G1HRPrinter::Survivor);
check_bitmaps("Survivor Region Allocation", new_alloc_region);
} else { } else {
_hr_printer.alloc(new_alloc_region, G1HRPrinter::Old); _hr_printer.alloc(new_alloc_region, G1HRPrinter::Old);
check_bitmaps("Old Region Allocation", new_alloc_region);
} }
bool during_im = g1_policy()->during_initial_mark_pause(); bool during_im = g1_policy()->during_initial_mark_pause();
new_alloc_region->note_start_of_copying(during_im); new_alloc_region->note_start_of_copying(during_im);

View File

@ -1186,6 +1186,30 @@ public:
void verify_dirty_young_list(HeapRegion* head) PRODUCT_RETURN; void verify_dirty_young_list(HeapRegion* head) PRODUCT_RETURN;
void verify_dirty_young_regions() PRODUCT_RETURN; void verify_dirty_young_regions() PRODUCT_RETURN;
#ifndef PRODUCT
// Make sure that the given bitmap has no marked objects in the
// range [from,limit). If it does, print an error message and return
// false. Otherwise, just return true. bitmap_name should be "prev"
// or "next".
bool verify_no_bits_over_tams(const char* bitmap_name, CMBitMapRO* bitmap,
HeapWord* from, HeapWord* limit);
// Verify that the prev / next bitmap range [tams,end) for the given
// region has no marks. Return true if all is well, false if errors
// are detected.
bool verify_bitmaps(const char* caller, HeapRegion* hr);
#endif // PRODUCT
// If G1VerifyBitmaps is set, verify that the marking bitmaps for
// the given region do not have any spurious marks. If errors are
// detected, print appropriate error messages and crash.
void check_bitmaps(const char* caller, HeapRegion* hr) PRODUCT_RETURN;
// If G1VerifyBitmaps is set, verify that the marking bitmaps do not
// have any spurious marks. If errors are detected, print
// appropriate error messages and crash.
void check_bitmaps(const char* caller) PRODUCT_RETURN;
// verify_region_sets() performs verification over the region // verify_region_sets() performs verification over the region
// lists. It will be compiled in the product code to be used when // lists. It will be compiled in the product code to be used when
// necessary (i.e., during heap verification). // necessary (i.e., during heap verification).

View File

@ -191,6 +191,7 @@ public:
hr->note_self_forwarding_removal_start(during_initial_mark, hr->note_self_forwarding_removal_start(during_initial_mark,
during_conc_mark); during_conc_mark);
_g1h->check_bitmaps("Self-Forwarding Ptr Removal", hr);
// In the common case (i.e. when there is no evacuation // In the common case (i.e. when there is no evacuation
// failure) we make sure that the following is done when // failure) we make sure that the following is done when

View File

@ -325,11 +325,14 @@
"evacuation pauses") \ "evacuation pauses") \
\ \
diagnostic(bool, G1VerifyRSetsDuringFullGC, false, \ diagnostic(bool, G1VerifyRSetsDuringFullGC, false, \
"If true, perform verification of each heap region's " \ "If true, perform verification of each heap region's " \
"remembered set when verifying the heap during a full GC.") \ "remembered set when verifying the heap during a full GC.") \
\ \
diagnostic(bool, G1VerifyHeapRegionCodeRoots, false, \ diagnostic(bool, G1VerifyHeapRegionCodeRoots, false, \
"Verify the code root lists attached to each heap region.") "Verify the code root lists attached to each heap region.") \
\
develop(bool, G1VerifyBitmaps, false, \
"Verifies the consistency of the marking bitmaps")
G1_FLAGS(DECLARE_DEVELOPER_FLAG, DECLARE_PD_DEVELOPER_FLAG, DECLARE_PRODUCT_FLAG, DECLARE_PD_PRODUCT_FLAG, DECLARE_DIAGNOSTIC_FLAG, DECLARE_EXPERIMENTAL_FLAG, DECLARE_NOTPRODUCT_FLAG, DECLARE_MANAGEABLE_FLAG, DECLARE_PRODUCT_RW_FLAG) G1_FLAGS(DECLARE_DEVELOPER_FLAG, DECLARE_PD_DEVELOPER_FLAG, DECLARE_PRODUCT_FLAG, DECLARE_PD_PRODUCT_FLAG, DECLARE_DIAGNOSTIC_FLAG, DECLARE_EXPERIMENTAL_FLAG, DECLARE_NOTPRODUCT_FLAG, DECLARE_MANAGEABLE_FLAG, DECLARE_PRODUCT_RW_FLAG)

View File

@ -488,6 +488,7 @@ void Klass::remove_unshareable_info() {
} }
void Klass::restore_unshareable_info(TRAPS) { void Klass::restore_unshareable_info(TRAPS) {
TRACE_INIT_ID(this);
// If an exception happened during CDS restore, some of these fields may already be // If an exception happened during CDS restore, some of these fields may already be
// set. We leave the class on the CLD list, even if incomplete so that we don't // set. We leave the class on the CLD list, even if incomplete so that we don't
// modify the CLD list outside a safepoint. // modify the CLD list outside a safepoint.

View File

@ -3150,11 +3150,9 @@ JNI_ENTRY(void, jni_GetStringUTFRegion(JNIEnv *env, jstring string, jsize start,
} else { } else {
//%note jni_7 //%note jni_7
if (len > 0) { if (len > 0) {
ResourceMark rm(THREAD); // Assume the buffer is large enough as the JNI spec. does not require user error checking
char *utf_region = java_lang_String::as_utf8_string(s, start, len); java_lang_String::as_utf8_string(s, start, len, buf, INT_MAX);
int utf_len = (int)strlen(utf_region); // as_utf8_string null-terminates the result string
memcpy(buf, utf_region, utf_len);
buf[utf_len] = 0;
} else { } else {
// JDK null-terminates the buffer even in len is zero // JDK null-terminates the buffer even in len is zero
if (buf != NULL) { if (buf != NULL) {
@ -3880,6 +3878,7 @@ void TestNewSize_test();
void TestOldSize_test(); void TestOldSize_test();
void TestKlass_test(); void TestKlass_test();
void TestBitMap_test(); void TestBitMap_test();
void TestAsUtf8();
#if INCLUDE_ALL_GCS #if INCLUDE_ALL_GCS
void TestOldFreeSpaceCalculation_test(); void TestOldFreeSpaceCalculation_test();
void TestG1BiasedArray_test(); void TestG1BiasedArray_test();
@ -3907,6 +3906,7 @@ void execute_internal_vm_tests() {
run_unit_test(TestOldSize_test()); run_unit_test(TestOldSize_test());
run_unit_test(TestKlass_test()); run_unit_test(TestKlass_test());
run_unit_test(TestBitMap_test()); run_unit_test(TestBitMap_test());
run_unit_test(TestAsUtf8());
#if INCLUDE_VM_STRUCTS #if INCLUDE_VM_STRUCTS
run_unit_test(VMStructs::test()); run_unit_test(VMStructs::test());
#endif #endif

View File

@ -386,6 +386,23 @@ JVM_ENTRY(jobject, JVM_InitProperties(JNIEnv *env, jobject properties))
JVM_END JVM_END
/*
* Return the temporary directory that the VM uses for the attach
* and perf data files.
*
* It is important that this directory is well-known and the
* same for all VM instances. It cannot be affected by configuration
* variables such as java.io.tmpdir.
*/
JVM_ENTRY(jstring, JVM_GetTemporaryDirectory(JNIEnv *env))
JVMWrapper("JVM_GetTemporaryDirectory");
HandleMark hm(THREAD);
const char* temp_dir = os::get_temp_directory();
Handle h = java_lang_String::create_from_platform_dependent_str(temp_dir, CHECK_NULL);
return (jstring) JNIHandles::make_local(env, h());
JVM_END
// java.lang.Runtime ///////////////////////////////////////////////////////////////////////// // java.lang.Runtime /////////////////////////////////////////////////////////////////////////
extern volatile jint vm_created; extern volatile jint vm_created;

View File

@ -1485,6 +1485,9 @@ JVM_GetManagement(jint version);
JNIEXPORT jobject JNICALL JNIEXPORT jobject JNICALL
JVM_InitAgentProperties(JNIEnv *env, jobject agent_props); JVM_InitAgentProperties(JNIEnv *env, jobject agent_props);
JNIEXPORT jstring JNICALL
JVM_GetTemporaryDirectory(JNIEnv *env);
/* Generics reflection support. /* Generics reflection support.
* *
* Returns information about the given class's EnclosingMethod * Returns information about the given class's EnclosingMethod
@ -1553,12 +1556,10 @@ JVM_GetThreadStateNames(JNIEnv* env, jint javaThreadState, jintArray values);
* ========================================================================== * ==========================================================================
*/ */
typedef struct { typedef struct {
/* HotSpot Express VM version string: /* VM version string: follows the JDK release version naming convention */
* <major>.<minor>-bxx[-<identifier>][-<debug_flavor>] unsigned int jvm_version; /* <major_ver>.<minor_ver>.<micro_ver>[-<identifier>][-<debug_target>][-b<nn>] */
*/ unsigned int update_version : 8;
unsigned int jvm_version; /* Consists of major.minor.0.build */ unsigned int special_update_version : 8;
unsigned int update_version : 8; /* 0 in HotSpot Express VM */
unsigned int special_update_version : 8; /* 0 in HotSpot Express VM */
unsigned int reserved1 : 16; unsigned int reserved1 : 16;
unsigned int reserved2; unsigned int reserved2;
@ -1577,11 +1578,7 @@ typedef struct {
#define JVM_VERSION_MAJOR(version) ((version & 0xFF000000) >> 24) #define JVM_VERSION_MAJOR(version) ((version & 0xFF000000) >> 24)
#define JVM_VERSION_MINOR(version) ((version & 0x00FF0000) >> 16) #define JVM_VERSION_MINOR(version) ((version & 0x00FF0000) >> 16)
// Micro version is 0 in HotSpot Express VM (set in jvm.cpp).
#define JVM_VERSION_MICRO(version) ((version & 0x0000FF00) >> 8) #define JVM_VERSION_MICRO(version) ((version & 0x0000FF00) >> 8)
/* Build number is available in all HotSpot Express VM builds.
* It is defined in make/hotspot_version file.
*/
#define JVM_VERSION_BUILD(version) ((version & 0x000000FF)) #define JVM_VERSION_BUILD(version) ((version & 0x000000FF))
JNIEXPORT void JNICALL JNIEXPORT void JNICALL

View File

@ -48,6 +48,9 @@
#ifdef TARGET_OS_FAMILY_bsd #ifdef TARGET_OS_FAMILY_bsd
# include "jvm_bsd.h" # include "jvm_bsd.h"
# include <setjmp.h> # include <setjmp.h>
# ifdef __APPLE__
# include <mach/mach_time.h>
# endif
#endif #endif
class AgentLibrary; class AgentLibrary;

View File

@ -1218,6 +1218,7 @@ typedef TwoOopHashtable<Symbol*, mtClass> SymbolTwoOopHashtable;
static_field(Abstract_VM_Version, _s_internal_vm_info_string, const char*) \ static_field(Abstract_VM_Version, _s_internal_vm_info_string, const char*) \
static_field(Abstract_VM_Version, _vm_major_version, int) \ static_field(Abstract_VM_Version, _vm_major_version, int) \
static_field(Abstract_VM_Version, _vm_minor_version, int) \ static_field(Abstract_VM_Version, _vm_minor_version, int) \
static_field(Abstract_VM_Version, _vm_micro_version, int) \
static_field(Abstract_VM_Version, _vm_build_number, int) \ static_field(Abstract_VM_Version, _vm_build_number, int) \
static_field(Abstract_VM_Version, _reserve_for_allocation_prefetch, int) \ static_field(Abstract_VM_Version, _reserve_for_allocation_prefetch, int) \
\ \

View File

@ -55,6 +55,20 @@ int Abstract_VM_Version::_reserve_for_allocation_prefetch = 0;
#ifndef HOTSPOT_RELEASE_VERSION #ifndef HOTSPOT_RELEASE_VERSION
#error HOTSPOT_RELEASE_VERSION must be defined #error HOTSPOT_RELEASE_VERSION must be defined
#endif #endif
#ifndef JDK_MAJOR_VERSION
#error JDK_MAJOR_VERSION must be defined
#endif
#ifndef JDK_MINOR_VERSION
#error JDK_MINOR_VERSION must be defined
#endif
#ifndef JDK_MICRO_VERSION
#error JDK_MICRO_VERSION must be defined
#endif
#ifndef JDK_BUILD_NUMBER
#error JDK_BUILD_NUMBER must be defined
#endif
#ifndef JRE_RELEASE_VERSION #ifndef JRE_RELEASE_VERSION
#error JRE_RELEASE_VERSION must be defined #error JRE_RELEASE_VERSION must be defined
#endif #endif
@ -68,39 +82,44 @@ int Abstract_VM_Version::_reserve_for_allocation_prefetch = 0;
#define VM_RELEASE HOTSPOT_RELEASE_VERSION "-" HOTSPOT_BUILD_TARGET #define VM_RELEASE HOTSPOT_RELEASE_VERSION "-" HOTSPOT_BUILD_TARGET
#endif #endif
// HOTSPOT_RELEASE_VERSION must follow the release version naming convention // HOTSPOT_RELEASE_VERSION follows the JDK release version naming convention
// <major_ver>.<minor_ver>-b<nn>[-<identifier>][-<debug_target>] // <major_ver>.<minor_ver>.<micro_ver>[-<identifier>][-<debug_target>][-b<nn>]
int Abstract_VM_Version::_vm_major_version = 0; int Abstract_VM_Version::_vm_major_version = 0;
int Abstract_VM_Version::_vm_minor_version = 0; int Abstract_VM_Version::_vm_minor_version = 0;
int Abstract_VM_Version::_vm_micro_version = 0;
int Abstract_VM_Version::_vm_build_number = 0; int Abstract_VM_Version::_vm_build_number = 0;
bool Abstract_VM_Version::_initialized = false; bool Abstract_VM_Version::_initialized = false;
int Abstract_VM_Version::_parallel_worker_threads = 0; int Abstract_VM_Version::_parallel_worker_threads = 0;
bool Abstract_VM_Version::_parallel_worker_threads_initialized = false; bool Abstract_VM_Version::_parallel_worker_threads_initialized = false;
#ifdef ASSERT
static void assert_digits(const char * s, const char * message) {
for (int i = 0; s[i] != '\0'; i++) {
assert(isdigit(s[i]), message);
}
}
#endif
static void set_version_field(int * version_field, const char * version_str,
const char * const assert_msg) {
if (version_str != NULL && *version_str != '\0') {
DEBUG_ONLY(assert_digits(version_str, assert_msg));
*version_field = atoi(version_str);
}
}
void Abstract_VM_Version::initialize() { void Abstract_VM_Version::initialize() {
if (_initialized) { if (_initialized) {
return; return;
} }
char* vm_version = os::strdup(HOTSPOT_RELEASE_VERSION);
// Expecting the next vm_version format: set_version_field(&_vm_major_version, JDK_MAJOR_VERSION, "bad major version");
// <major_ver>.<minor_ver>-b<nn>[-<identifier>] set_version_field(&_vm_minor_version, JDK_MINOR_VERSION, "bad minor version");
char* vm_major_ver = vm_version; set_version_field(&_vm_micro_version, JDK_MICRO_VERSION, "bad micro version");
assert(isdigit(vm_major_ver[0]),"wrong vm major version number"); int offset = (JDK_BUILD_NUMBER != NULL && JDK_BUILD_NUMBER[0] == 'b') ? 1 : 0;
char* vm_minor_ver = strchr(vm_major_ver, '.'); set_version_field(&_vm_build_number, JDK_BUILD_NUMBER + offset,
assert(vm_minor_ver != NULL && isdigit(vm_minor_ver[1]),"wrong vm minor version number"); "bad build number");
vm_minor_ver[0] = '\0'; // terminate vm_major_ver
vm_minor_ver += 1;
char* vm_build_num = strchr(vm_minor_ver, '-');
assert(vm_build_num != NULL && vm_build_num[1] == 'b' && isdigit(vm_build_num[2]),"wrong vm build number");
vm_build_num[0] = '\0'; // terminate vm_minor_ver
vm_build_num += 2;
_vm_major_version = atoi(vm_major_ver);
_vm_minor_version = atoi(vm_minor_ver);
_vm_build_number = atoi(vm_build_num);
os::free(vm_version);
_initialized = true; _initialized = true;
} }
@ -276,6 +295,7 @@ const char *Abstract_VM_Version::vm_build_user() {
unsigned int Abstract_VM_Version::jvm_version() { unsigned int Abstract_VM_Version::jvm_version() {
return ((Abstract_VM_Version::vm_major_version() & 0xFF) << 24) | return ((Abstract_VM_Version::vm_major_version() & 0xFF) << 24) |
((Abstract_VM_Version::vm_minor_version() & 0xFF) << 16) | ((Abstract_VM_Version::vm_minor_version() & 0xFF) << 16) |
((Abstract_VM_Version::vm_micro_version() & 0xFF) << 8) |
(Abstract_VM_Version::vm_build_number() & 0xFF); (Abstract_VM_Version::vm_build_number() & 0xFF);
} }

View File

@ -44,6 +44,7 @@ class Abstract_VM_Version: AllStatic {
static unsigned int _logical_processors_per_package; static unsigned int _logical_processors_per_package;
static int _vm_major_version; static int _vm_major_version;
static int _vm_minor_version; static int _vm_minor_version;
static int _vm_micro_version;
static int _vm_build_number; static int _vm_build_number;
static bool _initialized; static bool _initialized;
static int _parallel_worker_threads; static int _parallel_worker_threads;
@ -68,6 +69,7 @@ class Abstract_VM_Version: AllStatic {
static int vm_major_version() { assert(_initialized, "not initialized"); return _vm_major_version; } static int vm_major_version() { assert(_initialized, "not initialized"); return _vm_major_version; }
static int vm_minor_version() { assert(_initialized, "not initialized"); return _vm_minor_version; } static int vm_minor_version() { assert(_initialized, "not initialized"); return _vm_minor_version; }
static int vm_micro_version() { assert(_initialized, "not initialized"); return _vm_micro_version; }
static int vm_build_number() { assert(_initialized, "not initialized"); return _vm_build_number; } static int vm_build_number() { assert(_initialized, "not initialized"); return _vm_build_number; }
// Gets the jvm_version_info.jvm_version defined in jvm.h // Gets the jvm_version_info.jvm_version defined in jvm.h

View File

@ -785,7 +785,7 @@ void MemTracker::Tracker::record(address old_addr, address new_addr, size_t size
MEMFLAGS flags, address pc) { MEMFLAGS flags, address pc) {
assert(old_addr != NULL && new_addr != NULL, "Sanity check"); assert(old_addr != NULL && new_addr != NULL, "Sanity check");
assert(_op == Realloc || _op == NoOp, "Wrong call"); assert(_op == Realloc || _op == NoOp, "Wrong call");
if (MemTracker::is_on() && NMT_CAN_TRACK(flags) && _op != NoOp) { if (MemTracker::is_on() && NMT_CAN_TRACK(flags) && _op != NoOp && !MemTracker::shutdown_in_progress()) {
assert(_seq > 0, "Need pre-reserve sequence number"); assert(_seq > 0, "Need pre-reserve sequence number");
if (_need_thread_critical_lock) { if (_need_thread_critical_lock) {
ThreadCritical tc; ThreadCritical tc;
@ -811,7 +811,7 @@ void MemTracker::Tracker::record(address addr, size_t size, MEMFLAGS flags, addr
// OOM already? // OOM already?
if (addr == NULL) return; if (addr == NULL) return;
if (MemTracker::is_on() && NMT_CAN_TRACK(flags) && _op != NoOp) { if (MemTracker::is_on() && NMT_CAN_TRACK(flags) && _op != NoOp && !MemTracker::shutdown_in_progress()) {
bool pre_reserved_seq = (_seq != 0); bool pre_reserved_seq = (_seq != 0);
address pc = CALLER_CALLER_PC; address pc = CALLER_CALLER_PC;
MEMFLAGS orig_flags = flags; MEMFLAGS orig_flags = flags;

View File

@ -329,23 +329,19 @@ int UNICODE::utf8_length(jchar* base, int length) {
char* UNICODE::as_utf8(jchar* base, int length) { char* UNICODE::as_utf8(jchar* base, int length) {
int utf8_len = utf8_length(base, length); int utf8_len = utf8_length(base, length);
u_char* result = NEW_RESOURCE_ARRAY(u_char, utf8_len + 1); u_char* buf = NEW_RESOURCE_ARRAY(u_char, utf8_len + 1);
u_char* p = result; char* result = as_utf8(base, length, (char*) buf, utf8_len + 1);
for (int index = 0; index < length; index++) { assert((int) strlen(result) == utf8_len, "length prediction must be correct");
p = utf8_write(p, base[index]); return result;
}
*p = '\0';
assert(p == &result[utf8_len], "length prediction must be correct");
return (char*) result;
} }
char* UNICODE::as_utf8(jchar* base, int length, char* buf, int buflen) { char* UNICODE::as_utf8(jchar* base, int length, char* buf, int buflen) {
u_char* p = (u_char*)buf; u_char* p = (u_char*)buf;
u_char* end = (u_char*)buf + buflen;
for (int index = 0; index < length; index++) { for (int index = 0; index < length; index++) {
jchar c = base[index]; jchar c = base[index];
if (p + utf8_size(c) >= end) break; // string is truncated buflen -= utf8_size(c);
p = utf8_write(p, base[index]); if (buflen <= 0) break; // string is truncated
p = utf8_write(p, c);
} }
*p = '\0'; *p = '\0';
return buf; return buf;
@ -389,3 +385,29 @@ void UNICODE::as_quoted_ascii(const jchar* base, int length, char* buf, int bufl
} }
*p = '\0'; *p = '\0';
} }
#ifndef PRODUCT
void TestAsUtf8() {
char res[60];
jchar str[20];
for (int i = 0; i < 20; i++) {
str[i] = 0x0800; // char that is 2B in UTF-16 but 3B in UTF-8
}
str[19] = (jchar)'\0';
// The resulting string in UTF-8 is 3*19 bytes long, but should be truncated
UNICODE::as_utf8(str, 19, res, 10);
assert(strlen(res) == 9, "string should be truncated here");
UNICODE::as_utf8(str, 19, res, 18);
assert(strlen(res) == 15, "string should be truncated here");
UNICODE::as_utf8(str, 19, res, 20);
assert(strlen(res) == 18, "string should be truncated here");
// Test with an "unbounded" buffer
UNICODE::as_utf8(str, 19, res, INT_MAX);
assert(strlen(res) == 3*19, "string should end here");
}
#endif