This commit is contained in:
Phil Race 2017-12-18 10:28:43 -08:00
commit b1bede0343
204 changed files with 4546 additions and 12429 deletions

View File

@ -460,3 +460,5 @@ a2008587c13fa05fa2dbfcb09fe987576fbedfd1 jdk-10+32
bbd692ad4fa300ecca7939ffbe3b1d5e52a28cc6 jdk-10+33
89deac44e51517841491ba86ff44aa82a5ca96b3 jdk-10+34
d8c634b016c628622c9abbdc6bf50509e5dedbec jdk-10+35
0ee20aad71c4f33c426372b4c8bcc1235ce2ec08 jdk-11+0
959f2f7cbaa6d2ee45d50029744efb219721576c jdk-10+36

37
ADDITIONAL_LICENSE_INFO Normal file
View File

@ -0,0 +1,37 @@
ADDITIONAL INFORMATION ABOUT LICENSING
Certain files distributed by Oracle America, Inc. and/or its affiliates are
subject to the following clarification and special exception to the GPLv2,
based on the GNU Project exception for its Classpath libraries, known as the
GNU Classpath Exception.
Note that Oracle includes multiple, independent programs in this software
package. Some of those programs are provided under licenses deemed
incompatible with the GPLv2 by the Free Software Foundation and others.
For example, the package includes programs licensed under the Apache
License, Version 2.0 and may include FreeType. Such programs are licensed
to you under their original licenses.
Oracle facilitates your further distribution of this package by adding the
Classpath Exception to the necessary parts of its GPLv2 code, which permits
you to use that code in combination with other independent modules not
licensed under the GPLv2. However, note that this would not permit you to
commingle code under an incompatible license with Oracle's GPLv2 licensed
code by, for example, cutting and pasting such code into a file also
containing Oracle's GPLv2 licensed code and then distributing the result.
Additionally, if you were to remove the Classpath Exception from any of the
files to which it applies and distribute the result, you would likely be
required to license some or all of the other code in that distribution under
the GPLv2 as well, and since the GPLv2 is incompatible with the license terms
of some items included in the distribution by Oracle, removing the Classpath
Exception could therefore effectively compromise your ability to further
distribute the package.
Failing to distribute notices associated with some files may also create
unexpected legal consequences.
Proceed with caution and we recommend that you obtain the advice of a lawyer
skilled in open source matters before removing the Classpath Exception or
making modifications to this package which may subsequently be redistributed
and/or involve the use of third party software.

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@ -41,7 +41,7 @@ ifeq ($(OPENJDK_TARGET_OS), macosx)
BUNDLE_ID := $(MACOSX_BUNDLE_ID_BASE).$(VERSION_SHORT)
BUNDLE_NAME := $(MACOSX_BUNDLE_NAME_BASE) $(VERSION_SHORT)
BUNDLE_INFO := $(MACOSX_BUNDLE_NAME_BASE) $(VERSION_STRING)
BUNDLE_PLATFORM_VERSION := $(VERSION_MAJOR).$(VERSION_MINOR)
BUNDLE_PLATFORM_VERSION := $(VERSION_FEATURE).$(VERSION_INTERIM)
BUNDLE_VERSION := $(VERSION_NUMBER)
ifeq ($(COMPANY_NAME), N/A)
BUNDLE_VENDOR := UNDEFINED

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@ -48,6 +48,9 @@ define create-info-file
$(call info-file-item, "SUN_ARCH_ABI", "$(JDK_ARCH_ABI_PROP_NAME)"))
$(call info-file-item, "SOURCE", "$(strip $(SOURCE_REVISION))")
$(call info-file-item, "IMPLEMENTOR", "$(COMPANY_NAME)")
$(if $(VENDOR_VERSION_STRING), \
$(call info-file-item, "IMPLEMENTOR_VERSION", "$(VENDOR_VERSION_STRING)"))
$(call info-file-item, "JAVA_VERSION_DATE", "$(VERSION_DATE)")
$(call info-file-item, "OS_NAME", "$(RELEASE_FILE_OS_NAME)")
$(call info-file-item, "OS_ARCH", "$(RELEASE_FILE_OS_ARCH)")
endef

View File

@ -313,7 +313,7 @@ AC_DEFUN_ONCE([FLAGS_SETUP_INIT_FLAGS],
-D\"JDK_COMPONENT=\$(PRODUCT_NAME) \$(JDK_RC_PLATFORM_NAME) binary\" \
-D\"JDK_VER=\$(VERSION_NUMBER)\" \
-D\"JDK_COPYRIGHT=Copyright \xA9 $COPYRIGHT_YEAR\" \
-D\"JDK_NAME=\$(PRODUCT_NAME) \$(JDK_RC_PLATFORM_NAME) \$(VERSION_MAJOR)\" \
-D\"JDK_NAME=\$(PRODUCT_NAME) \$(JDK_RC_PLATFORM_NAME) \$(VERSION_FEATURE)\" \
-D\"JDK_FVER=\$(subst .,\$(COMMA),\$(VERSION_NUMBER_FOUR_POSITIONS))\""
JVM_RCFLAGS="$JVM_RCFLAGS \
@ -1166,7 +1166,9 @@ AC_DEFUN([FLAGS_SETUP_COMPILER_FLAGS_FOR_JDK_HELPER],
-I${TOPDIR}/src/java.base/$OPENJDK_$1_OS/native/include \
-I${TOPDIR}/src/java.base/$OPENJDK_$1_OS_TYPE/native/include \
-I${TOPDIR}/src/java.base/share/native/libjava \
-I${TOPDIR}/src/java.base/$OPENJDK_$1_OS_TYPE/native/libjava"
-I${TOPDIR}/src/java.base/$OPENJDK_$1_OS_TYPE/native/libjava \
-I${TOPDIR}/src/hotspot/share/include \
-I${TOPDIR}/src/hotspot/os/${HOTSPOT_$1_OS_TYPE}/include"
# The shared libraries are compiled using the picflag.
$2CFLAGS_JDKLIB="[$]$2COMMON_CCXXFLAGS_JDK \

View File

@ -887,6 +887,8 @@ JAVA
BOOT_JDK
JAVA_CHECK
JAVAC_CHECK
VENDOR_VERSION_STRING
VERSION_DATE
VERSION_IS_GA
VERSION_SHORT
VERSION_STRING
@ -896,9 +898,9 @@ VERSION_OPT
VERSION_BUILD
VERSION_PRE
VERSION_PATCH
VERSION_SECURITY
VERSION_MINOR
VERSION_MAJOR
VERSION_UPDATE
VERSION_INTERIM
VERSION_FEATURE
MACOSX_BUNDLE_ID_BASE
MACOSX_BUNDLE_NAME_BASE
HOTSPOT_VM_DISTRO
@ -972,7 +974,6 @@ HOTSPOT_BUILD_CPU
HOTSPOT_BUILD_OS_TYPE
HOTSPOT_BUILD_OS
OPENJDK_BUILD_BUNDLE_PLATFORM
OPENJDK_BUILD_OS_EXPORT_DIR
OPENJDK_BUILD_CPU_OSARCH
OPENJDK_BUILD_CPU_ISADIR
OPENJDK_BUILD_CPU_LEGACY_LIB
@ -984,7 +985,6 @@ HOTSPOT_TARGET_OS_TYPE
HOTSPOT_TARGET_OS
DEFINE_CROSS_COMPILE_ARCH
OPENJDK_TARGET_BUNDLE_PLATFORM
OPENJDK_TARGET_OS_EXPORT_DIR
OPENJDK_TARGET_CPU_OSARCH
OPENJDK_TARGET_CPU_ISADIR
OPENJDK_TARGET_CPU_LEGACY_LIB
@ -1093,6 +1093,7 @@ infodir
docdir
oldincludedir
includedir
runstatedir
localstatedir
sharedstatedir
sysconfdir
@ -1143,14 +1144,19 @@ with_milestone
with_update_version
with_user_release_suffix
with_build_number
with_version_major
with_version_minor
with_version_security
with_version_string
with_version_pre
with_version_opt
with_version_build
with_version_major
with_version_minor
with_version_security
with_version_feature
with_version_interim
with_version_update
with_version_patch
with_version_date
with_vendor_version_string
with_boot_jdk
with_build_jdk
with_import_modules
@ -1377,6 +1383,7 @@ datadir='${datarootdir}'
sysconfdir='${prefix}/etc'
sharedstatedir='${prefix}/com'
localstatedir='${prefix}/var'
runstatedir='${localstatedir}/run'
includedir='${prefix}/include'
oldincludedir='/usr/include'
docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
@ -1629,6 +1636,15 @@ do
| -silent | --silent | --silen | --sile | --sil)
silent=yes ;;
-runstatedir | --runstatedir | --runstatedi | --runstated \
| --runstate | --runstat | --runsta | --runst | --runs \
| --run | --ru | --r)
ac_prev=runstatedir ;;
-runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \
| --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \
| --run=* | --ru=* | --r=*)
runstatedir=$ac_optarg ;;
-sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
ac_prev=sbindir ;;
-sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
@ -1766,7 +1782,7 @@ fi
for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \
datadir sysconfdir sharedstatedir localstatedir includedir \
oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
libdir localedir mandir
libdir localedir mandir runstatedir
do
eval ac_val=\$$ac_var
# Remove trailing slashes.
@ -1919,6 +1935,7 @@ Fine tuning of the installation directories:
--sysconfdir=DIR read-only single-machine data [PREFIX/etc]
--sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
--localstatedir=DIR modifiable single-machine data [PREFIX/var]
--runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run]
--libdir=DIR object code libraries [EPREFIX/lib]
--includedir=DIR C header files [PREFIX/include]
--oldincludedir=DIR C header files for non-gcc [/usr/include]
@ -2060,6 +2077,12 @@ Optional Packages:
compatibility and is ignored
--with-build-number Deprecated. Option is kept for backwards
compatibility and is ignored
--with-version-major Deprecated. Option is kept for backwards
compatibility and is ignored
--with-version-minor Deprecated. Option is kept for backwards
compatibility and is ignored
--with-version-security Deprecated. Option is kept for backwards
compatibility and is ignored
--with-version-string Set version string [calculated]
--with-version-pre Set the base part of the version 'PRE' field
(pre-release identifier) ['internal']
@ -2067,14 +2090,17 @@ Optional Packages:
[<timestamp>.<user>.<dirname>]
--with-version-build Set version 'BUILD' field (build number) [not
specified]
--with-version-major Set version 'MAJOR' field (first number) [current
--with-version-feature Set version 'FEATURE' field (first number) [current
source value]
--with-version-minor Set version 'MINOR' field (second number) [current
--with-version-interim Set version 'INTERIM' field (second number) [current
source value]
--with-version-security Set version 'SECURITY' field (third number) [current
--with-version-update Set version 'UPDATE' field (third number) [current
source value]
--with-version-patch Set version 'PATCH' field (fourth number) [not
specified]
--with-version-date Set version date [current source value]
--with-vendor-version-string
Set vendor version string [not specified]
--with-boot-jdk path to Boot JDK (used to bootstrap build) [probed]
--with-build-jdk path to JDK of same version as is being built[the
newly built JDK]
@ -4449,7 +4475,7 @@ VALID_JVM_VARIANTS="server client minimal core zero custom"
#
# Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@ -5159,7 +5185,7 @@ VS_SDK_PLATFORM_NAME_2013=
#CUSTOM_AUTOCONF_INCLUDE
# Do not change or remove the following line, it is needed for consistency checks:
DATE_WHEN_GENERATED=1512479382
DATE_WHEN_GENERATED=1513206608
###############################################################################
#
@ -16200,13 +16226,6 @@ $as_echo "$COMPILE_TYPE" >&6; }
OPENJDK_TARGET_CPU_JLI="amd64"
fi
if test "x$OPENJDK_TARGET_OS" = xmacosx; then
OPENJDK_TARGET_OS_EXPORT_DIR=macosx
else
OPENJDK_TARGET_OS_EXPORT_DIR=${OPENJDK_TARGET_OS_TYPE}
fi
# The new version string in JDK 9 also defined new naming of OS and ARCH for bundles
# Macosx is osx and x86_64 is x64
if test "x$OPENJDK_TARGET_OS" = xmacosx; then
@ -16358,13 +16377,6 @@ $as_echo "$COMPILE_TYPE" >&6; }
OPENJDK_BUILD_CPU_JLI="amd64"
fi
if test "x$OPENJDK_BUILD_OS" = xmacosx; then
OPENJDK_BUILD_OS_EXPORT_DIR=macosx
else
OPENJDK_BUILD_OS_EXPORT_DIR=${OPENJDK_BUILD_OS_TYPE}
fi
# The new version string in JDK 9 also defined new naming of OS and ARCH for bundles
# Macosx is osx and x86_64 is x64
if test "x$OPENJDK_BUILD_OS" = xmacosx; then
@ -25004,6 +25016,33 @@ fi
# Check whether --with-version-major was given.
if test "${with_version_major+set}" = set; then :
withval=$with_version_major; { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Option --with-version-major is deprecated and will be ignored." >&5
$as_echo "$as_me: WARNING: Option --with-version-major is deprecated and will be ignored." >&2;}
fi
# Check whether --with-version-minor was given.
if test "${with_version_minor+set}" = set; then :
withval=$with_version_minor; { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Option --with-version-minor is deprecated and will be ignored." >&5
$as_echo "$as_me: WARNING: Option --with-version-minor is deprecated and will be ignored." >&2;}
fi
# Check whether --with-version-security was given.
if test "${with_version_security+set}" = set; then :
withval=$with_version_security; { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Option --with-version-security is deprecated and will be ignored." >&5
$as_echo "$as_me: WARNING: Option --with-version-security is deprecated and will be ignored." >&2;}
fi
# Source the version numbers file
. $AUTOCONF_DIR/version-numbers
@ -25032,20 +25071,20 @@ fi
elif test "x$with_version_string" != x; then
# Additional [] needed to keep m4 from mangling shell constructs.
if [[ $with_version_string =~ ^([0-9]+)(\.([0-9]+))?(\.([0-9]+))?(\.([0-9]+))?(-([a-zA-Z]+))?((\+)([0-9]+)?(-([-a-zA-Z0-9.]+))?)?$ ]] ; then
VERSION_MAJOR=${BASH_REMATCH[1]}
VERSION_MINOR=${BASH_REMATCH[3]}
VERSION_SECURITY=${BASH_REMATCH[5]}
VERSION_FEATURE=${BASH_REMATCH[1]}
VERSION_INTERIM=${BASH_REMATCH[3]}
VERSION_UPDATE=${BASH_REMATCH[5]}
VERSION_PATCH=${BASH_REMATCH[7]}
VERSION_PRE=${BASH_REMATCH[9]}
version_plus_separator=${BASH_REMATCH[11]}
VERSION_BUILD=${BASH_REMATCH[12]}
VERSION_OPT=${BASH_REMATCH[14]}
# Unspecified numerical fields are interpreted as 0.
if test "x$VERSION_MINOR" = x; then
VERSION_MINOR=0
if test "x$VERSION_INTERIM" = x; then
VERSION_INTERIM=0
fi
if test "x$VERSION_SECURITY" = x; then
VERSION_SECURITY=0
if test "x$VERSION_UPDATE" = x; then
VERSION_UPDATE=0
fi
if test "x$VERSION_PATCH" = x; then
VERSION_PATCH=0
@ -25174,22 +25213,22 @@ $as_echo "$as_me: WARNING: Value for VERSION_BUILD has been sanitized from '$wit
fi
# Check whether --with-version-major was given.
if test "${with_version_major+set}" = set; then :
withval=$with_version_major; with_version_major_present=true
# Check whether --with-version-feature was given.
if test "${with_version_feature+set}" = set; then :
withval=$with_version_feature; with_version_feature_present=true
else
with_version_major_present=false
with_version_feature_present=false
fi
if test "x$with_version_major_present" = xtrue; then
if test "x$with_version_major" = xyes; then
as_fn_error $? "--with-version-major must have a value" "$LINENO" 5
if test "x$with_version_feature_present" = xtrue; then
if test "x$with_version_feature" = xyes; then
as_fn_error $? "--with-version-feature must have a value" "$LINENO" 5
else
# Additional [] needed to keep m4 from mangling shell constructs.
if ! [[ "$with_version_major" =~ ^0*([1-9][0-9]*)|(0)$ ]] ; then
as_fn_error $? "\"$with_version_major\" is not a valid numerical value for VERSION_MAJOR" "$LINENO" 5
if ! [[ "$with_version_feature" =~ ^0*([1-9][0-9]*)|(0)$ ]] ; then
as_fn_error $? "\"$with_version_feature\" is not a valid numerical value for VERSION_FEATURE" "$LINENO" 5
fi
# Extract the version number without leading zeros.
cleaned_value=${BASH_REMATCH[1]}
@ -25199,44 +25238,44 @@ fi
fi
if test $cleaned_value -gt 255; then
as_fn_error $? "VERSION_MAJOR is given as $with_version_major. This is greater than 255 which is not allowed." "$LINENO" 5
as_fn_error $? "VERSION_FEATURE is given as $with_version_feature. This is greater than 255 which is not allowed." "$LINENO" 5
fi
if test "x$cleaned_value" != "x$with_version_major"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Value for VERSION_MAJOR has been sanitized from '$with_version_major' to '$cleaned_value'" >&5
$as_echo "$as_me: WARNING: Value for VERSION_MAJOR has been sanitized from '$with_version_major' to '$cleaned_value'" >&2;}
if test "x$cleaned_value" != "x$with_version_feature"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Value for VERSION_FEATURE has been sanitized from '$with_version_feature' to '$cleaned_value'" >&5
$as_echo "$as_me: WARNING: Value for VERSION_FEATURE has been sanitized from '$with_version_feature' to '$cleaned_value'" >&2;}
fi
VERSION_MAJOR=$cleaned_value
VERSION_FEATURE=$cleaned_value
fi
else
if test "x$NO_DEFAULT_VERSION_PARTS" != xtrue; then
# Default is to get value from version-numbers
VERSION_MAJOR="$DEFAULT_VERSION_MAJOR"
VERSION_FEATURE="$DEFAULT_VERSION_FEATURE"
fi
fi
# Check whether --with-version-minor was given.
if test "${with_version_minor+set}" = set; then :
withval=$with_version_minor; with_version_minor_present=true
# Check whether --with-version-interim was given.
if test "${with_version_interim+set}" = set; then :
withval=$with_version_interim; with_version_interim_present=true
else
with_version_minor_present=false
with_version_interim_present=false
fi
if test "x$with_version_minor_present" = xtrue; then
if test "x$with_version_minor" = xyes; then
as_fn_error $? "--with-version-minor must have a value" "$LINENO" 5
elif test "x$with_version_minor" = xno; then
if test "x$with_version_interim_present" = xtrue; then
if test "x$with_version_interim" = xyes; then
as_fn_error $? "--with-version-interim must have a value" "$LINENO" 5
elif test "x$with_version_interim" = xno; then
# Interpret --without-* as empty string (i.e. 0) instead of the literal "no"
VERSION_MINOR=0
elif test "x$with_version_minor" = x; then
VERSION_MINOR=0
VERSION_INTERIM=0
elif test "x$with_version_interim" = x; then
VERSION_INTERIM=0
else
# Additional [] needed to keep m4 from mangling shell constructs.
if ! [[ "$with_version_minor" =~ ^0*([1-9][0-9]*)|(0)$ ]] ; then
as_fn_error $? "\"$with_version_minor\" is not a valid numerical value for VERSION_MINOR" "$LINENO" 5
if ! [[ "$with_version_interim" =~ ^0*([1-9][0-9]*)|(0)$ ]] ; then
as_fn_error $? "\"$with_version_interim\" is not a valid numerical value for VERSION_INTERIM" "$LINENO" 5
fi
# Extract the version number without leading zeros.
cleaned_value=${BASH_REMATCH[1]}
@ -25246,44 +25285,44 @@ fi
fi
if test $cleaned_value -gt 255; then
as_fn_error $? "VERSION_MINOR is given as $with_version_minor. This is greater than 255 which is not allowed." "$LINENO" 5
as_fn_error $? "VERSION_INTERIM is given as $with_version_interim. This is greater than 255 which is not allowed." "$LINENO" 5
fi
if test "x$cleaned_value" != "x$with_version_minor"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Value for VERSION_MINOR has been sanitized from '$with_version_minor' to '$cleaned_value'" >&5
$as_echo "$as_me: WARNING: Value for VERSION_MINOR has been sanitized from '$with_version_minor' to '$cleaned_value'" >&2;}
if test "x$cleaned_value" != "x$with_version_interim"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Value for VERSION_INTERIM has been sanitized from '$with_version_interim' to '$cleaned_value'" >&5
$as_echo "$as_me: WARNING: Value for VERSION_INTERIM has been sanitized from '$with_version_interim' to '$cleaned_value'" >&2;}
fi
VERSION_MINOR=$cleaned_value
VERSION_INTERIM=$cleaned_value
fi
else
if test "x$NO_DEFAULT_VERSION_PARTS" != xtrue; then
# Default is 0, if unspecified
VERSION_MINOR=$DEFAULT_VERSION_MINOR
VERSION_INTERIM=$DEFAULT_VERSION_INTERIM
fi
fi
# Check whether --with-version-security was given.
if test "${with_version_security+set}" = set; then :
withval=$with_version_security; with_version_security_present=true
# Check whether --with-version-update was given.
if test "${with_version_update+set}" = set; then :
withval=$with_version_update; with_version_update_present=true
else
with_version_security_present=false
with_version_update_present=false
fi
if test "x$with_version_security_present" = xtrue; then
if test "x$with_version_security" = xyes; then
as_fn_error $? "--with-version-security must have a value" "$LINENO" 5
elif test "x$with_version_security" = xno; then
if test "x$with_version_update_present" = xtrue; then
if test "x$with_version_update" = xyes; then
as_fn_error $? "--with-version-update must have a value" "$LINENO" 5
elif test "x$with_version_update" = xno; then
# Interpret --without-* as empty string (i.e. 0) instead of the literal "no"
VERSION_SECURITY=0
elif test "x$with_version_security" = x; then
VERSION_SECURITY=0
VERSION_UPDATE=0
elif test "x$with_version_update" = x; then
VERSION_UPDATE=0
else
# Additional [] needed to keep m4 from mangling shell constructs.
if ! [[ "$with_version_security" =~ ^0*([1-9][0-9]*)|(0)$ ]] ; then
as_fn_error $? "\"$with_version_security\" is not a valid numerical value for VERSION_SECURITY" "$LINENO" 5
if ! [[ "$with_version_update" =~ ^0*([1-9][0-9]*)|(0)$ ]] ; then
as_fn_error $? "\"$with_version_update\" is not a valid numerical value for VERSION_UPDATE" "$LINENO" 5
fi
# Extract the version number without leading zeros.
cleaned_value=${BASH_REMATCH[1]}
@ -25293,19 +25332,19 @@ fi
fi
if test $cleaned_value -gt 255; then
as_fn_error $? "VERSION_SECURITY is given as $with_version_security. This is greater than 255 which is not allowed." "$LINENO" 5
as_fn_error $? "VERSION_UPDATE is given as $with_version_update. This is greater than 255 which is not allowed." "$LINENO" 5
fi
if test "x$cleaned_value" != "x$with_version_security"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Value for VERSION_SECURITY has been sanitized from '$with_version_security' to '$cleaned_value'" >&5
$as_echo "$as_me: WARNING: Value for VERSION_SECURITY has been sanitized from '$with_version_security' to '$cleaned_value'" >&2;}
if test "x$cleaned_value" != "x$with_version_update"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Value for VERSION_UPDATE has been sanitized from '$with_version_update' to '$cleaned_value'" >&5
$as_echo "$as_me: WARNING: Value for VERSION_UPDATE has been sanitized from '$with_version_update' to '$cleaned_value'" >&2;}
fi
VERSION_SECURITY=$cleaned_value
VERSION_UPDATE=$cleaned_value
fi
else
if test "x$NO_DEFAULT_VERSION_PARTS" != xtrue; then
# Default is 0, if unspecified
VERSION_SECURITY=$DEFAULT_VERSION_SECURITY
VERSION_UPDATE=$DEFAULT_VERSION_UPDATE
fi
fi
@ -25366,7 +25405,7 @@ $as_echo "$as_me: WARNING: Value for VERSION_PATCH has been sanitized from '$wit
fi
# VERSION_NUMBER but always with exactly 4 positions, with 0 for empty positions.
VERSION_NUMBER_FOUR_POSITIONS=$VERSION_MAJOR.$VERSION_MINOR.$VERSION_SECURITY.$VERSION_PATCH
VERSION_NUMBER_FOUR_POSITIONS=$VERSION_FEATURE.$VERSION_INTERIM.$VERSION_UPDATE.$VERSION_PATCH
stripped_version_number=$VERSION_NUMBER_FOUR_POSITIONS
# Strip trailing zeroes from stripped_version_number
@ -25384,6 +25423,40 @@ $as_echo "$as_me: WARNING: Value for VERSION_PATCH has been sanitized from '$wit
# The short version string, just VERSION_NUMBER and PRE, if present.
VERSION_SHORT=$VERSION_NUMBER${VERSION_PRE:+-$VERSION_PRE}
# The version date
# Check whether --with-version-date was given.
if test "${with_version_date+set}" = set; then :
withval=$with_version_date;
fi
if test "x$with_version_date" = xyes; then
as_fn_error $? "--with-version-date must have a value" "$LINENO" 5
elif test "x$with_version_date" != x; then
if ! [[ $with_version_date =~ ^[0-9]{4}-[0-9]{2}-[0-9]{2}$ ]] ; then
as_fn_error $? "\"$with_version_date\" is not a valid version date" "$LINENO" 5
else
VERSION_DATE="$with_version_date"
fi
else
VERSION_DATE="$DEFAULT_VERSION_DATE"
fi
# The vendor version string, if any
# Check whether --with-vendor-version-string was given.
if test "${with_vendor_version_string+set}" = set; then :
withval=$with_vendor_version_string;
fi
if test "x$with_vendor_version_string" = xyes; then
as_fn_error $? "--with-vendor-version-string must have a value" "$LINENO" 5
elif ! [[ $with_vendor_version_string =~ ^[[:graph:]]*$ ]] ; then
as_fn_error $? "--with--vendor-version-string contains non-graphical characters: $with_vendor_version_string" "$LINENO" 5
else
VENDOR_VERSION_STRING="$with_vendor_version_string"
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for version string" >&5
$as_echo_n "checking for version string... " >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $VERSION_STRING" >&5
@ -25403,6 +25476,8 @@ $as_echo "$VERSION_STRING" >&6; }
###############################################################################
#
# Setup BootJDK, used to bootstrap the build.
@ -50669,7 +50744,7 @@ $as_echo "no" >&6; }
-D\"JDK_COMPONENT=\$(PRODUCT_NAME) \$(JDK_RC_PLATFORM_NAME) binary\" \
-D\"JDK_VER=\$(VERSION_NUMBER)\" \
-D\"JDK_COPYRIGHT=Copyright \xA9 $COPYRIGHT_YEAR\" \
-D\"JDK_NAME=\$(PRODUCT_NAME) \$(JDK_RC_PLATFORM_NAME) \$(VERSION_MAJOR)\" \
-D\"JDK_NAME=\$(PRODUCT_NAME) \$(JDK_RC_PLATFORM_NAME) \$(VERSION_FEATURE)\" \
-D\"JDK_FVER=\$(subst .,\$(COMMA),\$(VERSION_NUMBER_FOUR_POSITIONS))\""
JVM_RCFLAGS="$JVM_RCFLAGS \
@ -52817,7 +52892,9 @@ fi
-I${TOPDIR}/src/java.base/$OPENJDK_TARGET_OS/native/include \
-I${TOPDIR}/src/java.base/$OPENJDK_TARGET_OS_TYPE/native/include \
-I${TOPDIR}/src/java.base/share/native/libjava \
-I${TOPDIR}/src/java.base/$OPENJDK_TARGET_OS_TYPE/native/libjava"
-I${TOPDIR}/src/java.base/$OPENJDK_TARGET_OS_TYPE/native/libjava \
-I${TOPDIR}/src/hotspot/share/include \
-I${TOPDIR}/src/hotspot/os/${HOTSPOT_TARGET_OS_TYPE}/include"
# The shared libraries are compiled using the picflag.
CFLAGS_JDKLIB="$COMMON_CCXXFLAGS_JDK \
@ -53698,7 +53775,9 @@ fi
-I${TOPDIR}/src/java.base/$OPENJDK_BUILD_OS/native/include \
-I${TOPDIR}/src/java.base/$OPENJDK_BUILD_OS_TYPE/native/include \
-I${TOPDIR}/src/java.base/share/native/libjava \
-I${TOPDIR}/src/java.base/$OPENJDK_BUILD_OS_TYPE/native/libjava"
-I${TOPDIR}/src/java.base/$OPENJDK_BUILD_OS_TYPE/native/libjava \
-I${TOPDIR}/src/hotspot/share/include \
-I${TOPDIR}/src/hotspot/os/${HOTSPOT_BUILD_OS_TYPE}/include"
# The shared libraries are compiled using the picflag.
OPENJDK_BUILD_CFLAGS_JDKLIB="$OPENJDK_BUILD_COMMON_CCXXFLAGS_JDK \

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@ -62,6 +62,9 @@ AC_DEFUN_ONCE([JDKVER_SETUP_JDK_VERSION_NUMBERS],
BASIC_DEPRECATED_ARG_WITH([update-version])
BASIC_DEPRECATED_ARG_WITH([user-release-suffix])
BASIC_DEPRECATED_ARG_WITH([build-number])
BASIC_DEPRECATED_ARG_WITH([version-major])
BASIC_DEPRECATED_ARG_WITH([version-minor])
BASIC_DEPRECATED_ARG_WITH([version-security])
# Source the version numbers file
. $AUTOCONF_DIR/version-numbers
@ -87,20 +90,20 @@ AC_DEFUN_ONCE([JDKVER_SETUP_JDK_VERSION_NUMBERS],
elif test "x$with_version_string" != x; then
# Additional [] needed to keep m4 from mangling shell constructs.
if [ [[ $with_version_string =~ ^([0-9]+)(\.([0-9]+))?(\.([0-9]+))?(\.([0-9]+))?(-([a-zA-Z]+))?((\+)([0-9]+)?(-([-a-zA-Z0-9.]+))?)?$ ]] ]; then
VERSION_MAJOR=${BASH_REMATCH[[1]]}
VERSION_MINOR=${BASH_REMATCH[[3]]}
VERSION_SECURITY=${BASH_REMATCH[[5]]}
VERSION_FEATURE=${BASH_REMATCH[[1]]}
VERSION_INTERIM=${BASH_REMATCH[[3]]}
VERSION_UPDATE=${BASH_REMATCH[[5]]}
VERSION_PATCH=${BASH_REMATCH[[7]]}
VERSION_PRE=${BASH_REMATCH[[9]]}
version_plus_separator=${BASH_REMATCH[[11]]}
VERSION_BUILD=${BASH_REMATCH[[12]]}
VERSION_OPT=${BASH_REMATCH[[14]]}
# Unspecified numerical fields are interpreted as 0.
if test "x$VERSION_MINOR" = x; then
VERSION_MINOR=0
if test "x$VERSION_INTERIM" = x; then
VERSION_INTERIM=0
fi
if test "x$VERSION_SECURITY" = x; then
VERSION_SECURITY=0
if test "x$VERSION_UPDATE" = x; then
VERSION_UPDATE=0
fi
if test "x$VERSION_PATCH" = x; then
VERSION_PATCH=0
@ -191,64 +194,64 @@ AC_DEFUN_ONCE([JDKVER_SETUP_JDK_VERSION_NUMBERS],
fi
fi
AC_ARG_WITH(version-major, [AS_HELP_STRING([--with-version-major],
[Set version 'MAJOR' field (first number) @<:@current source value@:>@])],
[with_version_major_present=true], [with_version_major_present=false])
AC_ARG_WITH(version-feature, [AS_HELP_STRING([--with-version-feature],
[Set version 'FEATURE' field (first number) @<:@current source value@:>@])],
[with_version_feature_present=true], [with_version_feature_present=false])
if test "x$with_version_major_present" = xtrue; then
if test "x$with_version_major" = xyes; then
AC_MSG_ERROR([--with-version-major must have a value])
if test "x$with_version_feature_present" = xtrue; then
if test "x$with_version_feature" = xyes; then
AC_MSG_ERROR([--with-version-feature must have a value])
else
JDKVER_CHECK_AND_SET_NUMBER(VERSION_MAJOR, $with_version_major)
JDKVER_CHECK_AND_SET_NUMBER(VERSION_FEATURE, $with_version_feature)
fi
else
if test "x$NO_DEFAULT_VERSION_PARTS" != xtrue; then
# Default is to get value from version-numbers
VERSION_MAJOR="$DEFAULT_VERSION_MAJOR"
VERSION_FEATURE="$DEFAULT_VERSION_FEATURE"
fi
fi
AC_ARG_WITH(version-minor, [AS_HELP_STRING([--with-version-minor],
[Set version 'MINOR' field (second number) @<:@current source value@:>@])],
[with_version_minor_present=true], [with_version_minor_present=false])
AC_ARG_WITH(version-interim, [AS_HELP_STRING([--with-version-interim],
[Set version 'INTERIM' field (second number) @<:@current source value@:>@])],
[with_version_interim_present=true], [with_version_interim_present=false])
if test "x$with_version_minor_present" = xtrue; then
if test "x$with_version_minor" = xyes; then
AC_MSG_ERROR([--with-version-minor must have a value])
elif test "x$with_version_minor" = xno; then
if test "x$with_version_interim_present" = xtrue; then
if test "x$with_version_interim" = xyes; then
AC_MSG_ERROR([--with-version-interim must have a value])
elif test "x$with_version_interim" = xno; then
# Interpret --without-* as empty string (i.e. 0) instead of the literal "no"
VERSION_MINOR=0
elif test "x$with_version_minor" = x; then
VERSION_MINOR=0
VERSION_INTERIM=0
elif test "x$with_version_interim" = x; then
VERSION_INTERIM=0
else
JDKVER_CHECK_AND_SET_NUMBER(VERSION_MINOR, $with_version_minor)
JDKVER_CHECK_AND_SET_NUMBER(VERSION_INTERIM, $with_version_interim)
fi
else
if test "x$NO_DEFAULT_VERSION_PARTS" != xtrue; then
# Default is 0, if unspecified
VERSION_MINOR=$DEFAULT_VERSION_MINOR
VERSION_INTERIM=$DEFAULT_VERSION_INTERIM
fi
fi
AC_ARG_WITH(version-security, [AS_HELP_STRING([--with-version-security],
[Set version 'SECURITY' field (third number) @<:@current source value@:>@])],
[with_version_security_present=true], [with_version_security_present=false])
AC_ARG_WITH(version-update, [AS_HELP_STRING([--with-version-update],
[Set version 'UPDATE' field (third number) @<:@current source value@:>@])],
[with_version_update_present=true], [with_version_update_present=false])
if test "x$with_version_security_present" = xtrue; then
if test "x$with_version_security" = xyes; then
AC_MSG_ERROR([--with-version-security must have a value])
elif test "x$with_version_security" = xno; then
if test "x$with_version_update_present" = xtrue; then
if test "x$with_version_update" = xyes; then
AC_MSG_ERROR([--with-version-update must have a value])
elif test "x$with_version_update" = xno; then
# Interpret --without-* as empty string (i.e. 0) instead of the literal "no"
VERSION_SECURITY=0
elif test "x$with_version_security" = x; then
VERSION_SECURITY=0
VERSION_UPDATE=0
elif test "x$with_version_update" = x; then
VERSION_UPDATE=0
else
JDKVER_CHECK_AND_SET_NUMBER(VERSION_SECURITY, $with_version_security)
JDKVER_CHECK_AND_SET_NUMBER(VERSION_UPDATE, $with_version_update)
fi
else
if test "x$NO_DEFAULT_VERSION_PARTS" != xtrue; then
# Default is 0, if unspecified
VERSION_SECURITY=$DEFAULT_VERSION_SECURITY
VERSION_UPDATE=$DEFAULT_VERSION_UPDATE
fi
fi
@ -284,7 +287,7 @@ AC_DEFUN_ONCE([JDKVER_SETUP_JDK_VERSION_NUMBERS],
fi
# VERSION_NUMBER but always with exactly 4 positions, with 0 for empty positions.
VERSION_NUMBER_FOUR_POSITIONS=$VERSION_MAJOR.$VERSION_MINOR.$VERSION_SECURITY.$VERSION_PATCH
VERSION_NUMBER_FOUR_POSITIONS=$VERSION_FEATURE.$VERSION_INTERIM.$VERSION_UPDATE.$VERSION_PATCH
stripped_version_number=$VERSION_NUMBER_FOUR_POSITIONS
# Strip trailing zeroes from stripped_version_number
@ -302,12 +305,38 @@ AC_DEFUN_ONCE([JDKVER_SETUP_JDK_VERSION_NUMBERS],
# The short version string, just VERSION_NUMBER and PRE, if present.
VERSION_SHORT=$VERSION_NUMBER${VERSION_PRE:+-$VERSION_PRE}
# The version date
AC_ARG_WITH(version-date, [AS_HELP_STRING([--with-version-date],
[Set version date @<:@current source value@:>@])])
if test "x$with_version_date" = xyes; then
AC_MSG_ERROR([--with-version-date must have a value])
elif test "x$with_version_date" != x; then
if [ ! [[ $with_version_date =~ ^[0-9]{4}-[0-9]{2}-[0-9]{2}$ ]] ]; then
AC_MSG_ERROR(["$with_version_date" is not a valid version date])
else
VERSION_DATE="$with_version_date"
fi
else
VERSION_DATE="$DEFAULT_VERSION_DATE"
fi
# The vendor version string, if any
AC_ARG_WITH(vendor-version-string, [AS_HELP_STRING([--with-vendor-version-string],
[Set vendor version string @<:@not specified@:>@])])
if test "x$with_vendor_version_string" = xyes; then
AC_MSG_ERROR([--with-vendor-version-string must have a value])
elif [ ! [[ $with_vendor_version_string =~ ^[[:graph:]]*$ ]] ]; then
AC_MSG_ERROR([--with--vendor-version-string contains non-graphical characters: $with_vendor_version_string])
else
VENDOR_VERSION_STRING="$with_vendor_version_string"
fi
AC_MSG_CHECKING([for version string])
AC_MSG_RESULT([$VERSION_STRING])
AC_SUBST(VERSION_MAJOR)
AC_SUBST(VERSION_MINOR)
AC_SUBST(VERSION_SECURITY)
AC_SUBST(VERSION_FEATURE)
AC_SUBST(VERSION_INTERIM)
AC_SUBST(VERSION_UPDATE)
AC_SUBST(VERSION_PATCH)
AC_SUBST(VERSION_PRE)
AC_SUBST(VERSION_BUILD)
@ -317,4 +346,6 @@ AC_DEFUN_ONCE([JDKVER_SETUP_JDK_VERSION_NUMBERS],
AC_SUBST(VERSION_STRING)
AC_SUBST(VERSION_SHORT)
AC_SUBST(VERSION_IS_GA)
AC_SUBST(VERSION_DATE)
AC_SUBST(VENDOR_VERSION_STRING)
])

View File

@ -388,13 +388,6 @@ AC_DEFUN([PLATFORM_SETUP_LEGACY_VARS_HELPER],
OPENJDK_$1_CPU_JLI="amd64"
fi
if test "x$OPENJDK_$1_OS" = xmacosx; then
OPENJDK_$1_OS_EXPORT_DIR=macosx
else
OPENJDK_$1_OS_EXPORT_DIR=${OPENJDK_$1_OS_TYPE}
fi
AC_SUBST(OPENJDK_$1_OS_EXPORT_DIR)
# The new version string in JDK 9 also defined new naming of OS and ARCH for bundles
# Macosx is osx and x86_64 is x64
if test "x$OPENJDK_$1_OS" = xmacosx; then

View File

@ -78,7 +78,6 @@ OPENJDK_TARGET_CPU_ISADIR:=@OPENJDK_TARGET_CPU_ISADIR@
OPENJDK_TARGET_CPU_LEGACY:=@OPENJDK_TARGET_CPU_LEGACY@
OPENJDK_TARGET_CPU_LEGACY_LIB:=@OPENJDK_TARGET_CPU_LEGACY_LIB@
OPENJDK_TARGET_CPU_OSARCH:=@OPENJDK_TARGET_CPU_OSARCH@
OPENJDK_TARGET_OS_EXPORT_DIR:=@OPENJDK_TARGET_OS_EXPORT_DIR@
HOTSPOT_TARGET_OS := @HOTSPOT_TARGET_OS@
HOTSPOT_TARGET_OS_TYPE := @HOTSPOT_TARGET_OS_TYPE@
@ -144,10 +143,9 @@ COPYRIGHT_YEAR:=@COPYRIGHT_YEAR@
## Building blocks of the version string
# First three version numbers, with well-specified meanings (numerical)
VERSION_MAJOR := @VERSION_MAJOR@
VERSION_MINOR := @VERSION_MINOR@
VERSION_SECURITY := @VERSION_SECURITY@
# Optional fourth element for use by OpenJDK consumers (numerical)
VERSION_FEATURE := @VERSION_FEATURE@
VERSION_INTERIM := @VERSION_INTERIM@
VERSION_UPDATE := @VERSION_UPDATE@
VERSION_PATCH := @VERSION_PATCH@
# The pre-release identifier (string)
VERSION_PRE := @VERSION_PRE@
@ -165,17 +163,23 @@ VERSION_NUMBER_FOUR_POSITIONS := @VERSION_NUMBER_FOUR_POSITIONS@
VERSION_STRING := @VERSION_STRING@
# The short version string, without trailing zeroes and just PRE, if present.
VERSION_SHORT := @VERSION_SHORT@
# The Java specification version. It usually equals the major version number.
VERSION_SPECIFICATION := @VERSION_MAJOR@
# The Java specification version. It usually equals the feature version number.
VERSION_SPECIFICATION := @VERSION_FEATURE@
# A GA version is defined by the PRE string being empty. Rather than testing for
# that, this variable defines it with true/false.
VERSION_IS_GA := @VERSION_IS_GA@
# Version date
VERSION_DATE := @VERSION_DATE@
# Vendor version string
VENDOR_VERSION_STRING := @VENDOR_VERSION_STRING@
# Convenience CFLAGS settings for passing version information into native programs.
VERSION_CFLAGS := \
-DVERSION_MAJOR=$(VERSION_MAJOR) \
-DVERSION_MINOR=$(VERSION_MINOR) \
-DVERSION_SECURITY=$(VERSION_SECURITY) \
-DVERSION_FEATURE=$(VERSION_FEATURE) \
-DVERSION_INTERIM=$(VERSION_INTERIM) \
-DVERSION_UPDATE=$(VERSION_UPDATE) \
-DVERSION_PATCH=$(VERSION_PATCH) \
-DVERSION_PRE='"$(VERSION_PRE)"' \
-DVERSION_BUILD=$(VERSION_BUILD) \
@ -184,6 +188,8 @@ VERSION_CFLAGS := \
-DVERSION_STRING='"$(VERSION_STRING)"' \
-DVERSION_SHORT='"$(VERSION_SHORT)"' \
-DVERSION_SPECIFICATION='"$(VERSION_SPECIFICATION)"' \
-DVERSION_DATE='"$(VERSION_DATE)"' \
-DVENDOR_VERSION_STRING='"$(VENDOR_VERSION_STRING)"' \
#
# Platform naming variables

View File

@ -25,10 +25,11 @@
# Default version numbers to use unless overridden by configure
DEFAULT_VERSION_MAJOR=10
DEFAULT_VERSION_MINOR=0
DEFAULT_VERSION_SECURITY=0
DEFAULT_VERSION_FEATURE=10
DEFAULT_VERSION_INTERIM=0
DEFAULT_VERSION_UPDATE=0
DEFAULT_VERSION_PATCH=0
DEFAULT_VERSION_DATE=2018-03-20
LAUNCHER_NAME=openjdk
PRODUCT_NAME=OpenJDK

View File

@ -1050,17 +1050,17 @@ var concatObjects = function (o1, o2) {
* Constructs the numeric version string from reading the
* make/autoconf/version-numbers file and removing all trailing ".0".
*
* @param major Override major version
* @param minor Override minor version
* @param security Override security version
* @param feature Override feature version
* @param interim Override interim version
* @param update Override update version
* @param patch Override patch version
* @returns {String} The numeric version string
*/
var getVersion = function (major, minor, security, patch) {
var getVersion = function (feature, interim, update, patch) {
var version_numbers = getVersionNumbers();
var version = (major != null ? major : version_numbers.get("DEFAULT_VERSION_MAJOR"))
+ "." + (minor != null ? minor : version_numbers.get("DEFAULT_VERSION_MINOR"))
+ "." + (security != null ? security : version_numbers.get("DEFAULT_VERSION_SECURITY"))
var version = (feature != null ? feature : version_numbers.get("DEFAULT_VERSION_FEATURE"))
+ "." + (interim != null ? interim : version_numbers.get("DEFAULT_VERSION_INTERIM"))
+ "." + (update != null ? update : version_numbers.get("DEFAULT_VERSION_UPDATE"))
+ "." + (patch != null ? patch : version_numbers.get("DEFAULT_VERSION_PATCH"));
while (version.match(".*\\.0$")) {
version = version.substring(0, version.length - 2);

View File

@ -27,24 +27,6 @@ include CopyCommon.gmk
$(eval $(call IncludeCustomExtension, copy/Copy-java.base.gmk))
################################################################################
#
# Copy exported header files to outputdir.
#
TARGETS += \
$(INCLUDE_DST_DIR)/jni.h \
$(INCLUDE_DST_DIR)/jvmticmlr.h \
$(INCLUDE_DST_DIR)/classfile_constants.h \
$(INCLUDE_DST_OS_DIR)/jni_md.h \
#
$(INCLUDE_DST_DIR)/%.h: $(TOPDIR)/src/java.base/share/native/include/%.h
$(call install-file)
$(INCLUDE_DST_OS_DIR)/%.h: \
$(TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/native/include/%.h
$(call install-file)
################################################################################
ifneq ($(findstring $(OPENJDK_TARGET_OS), windows aix),)
@ -237,9 +219,10 @@ endif
# different license.
JDK_LICENSE ?= $(wildcard $(TOPDIR)/LICENSE)
JDK_NOTICE ?= $(wildcard $(TOPDIR)/ASSEMBLY_EXCEPTION)
JDK_ADDITIONAL_LICENSE_INFO ?= $(wildcard $(TOPDIR)/ADDITIONAL_LICENSE_INFO)
$(eval $(call SetupCopyFiles, COPY_JDK_NOTICES, \
FILES := $(JDK_LICENSE) $(JDK_NOTICE), \
FILES := $(JDK_LICENSE) $(JDK_NOTICE) $(JDK_ADDITIONAL_LICENSE_INFO), \
DEST := $(LEGAL_DST_DIR), \
FLATTEN := true, \
))

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@ -29,20 +29,6 @@ $(eval $(call IncludeCustomExtension, copy/Copy-java.desktop.gmk))
################################################################################
TARGETS += \
$(INCLUDE_DST_DIR)/jawt.h \
$(INCLUDE_DST_OS_DIR)/jawt_md.h \
#
$(INCLUDE_DST_DIR)/%.h: $(TOPDIR)/src/java.desktop/share/native/include/%.h
$(call install-file)
$(INCLUDE_DST_OS_DIR)/%.h: \
$(TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_EXPORT_DIR)/native/include/%.h
$(call install-file)
################################################################################
ifneq ($(FREETYPE_BUNDLE_LIB_PATH), )
# We need to bundle the freetype library, so it will be available at runtime
# as well as link time.

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 2104, 2016, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@ -23,19 +23,7 @@
# questions.
#
################################################################################
# Include CopyCommon.gmk to get exported header files to be properly copied.
include CopyCommon.gmk
################################################################################
ifeq ($(OPENJDK_TARGET_OS), windows)
TARGETS += $(INCLUDE_DST_OS_DIR)/bridge/AccessBridgeCallbacks.h \
$(INCLUDE_DST_OS_DIR)/bridge/AccessBridgeCalls.h \
$(INCLUDE_DST_OS_DIR)/bridge/AccessBridgePackages.h
$(INCLUDE_DST_OS_DIR)/bridge/%: \
$(TOPDIR)/src/jdk.accessibility/windows/native/include/bridge/%
$(install-file)
endif
################################################################################

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@ -23,13 +23,7 @@
# questions.
#
################################################################################
# Include CopyCommon.gmk to get exported header files to be properly copied.
include CopyCommon.gmk
################################################################################
TARGETS := $(INCLUDE_DST_DIR)/jdwpTransport.h
$(INCLUDE_DST_DIR)/%.h: $(TOPDIR)/src/jdk.jdwp.agent/share/native/include/%.h
$(call install-file)
################################################################################

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@ -23,15 +23,48 @@
# questions.
#
INCLUDE_DST_DIR := $(SUPPORT_OUTPUTDIR)/modules_include/$(MODULE)
LIB_DST_DIR := $(SUPPORT_OUTPUTDIR)/modules_libs/$(MODULE)
CONF_DST_DIR := $(SUPPORT_OUTPUTDIR)/modules_conf/$(MODULE)
LEGAL_DST_DIR := $(SUPPORT_OUTPUTDIR)/modules_legal/$(MODULE)
INCLUDE_DST_OS_DIR := $(INCLUDE_DST_DIR)/$(OPENJDK_TARGET_OS)
################################################################################
#
# Copy exported include headers files to output directory, if present.
#
ifeq ($(OPENJDK_TARGET_OS), windows)
INCLUDE_DST_OS_DIR := $(INCLUDE_DST_DIR)/win32
else ifeq ($(OPENJDK_TARGET_OS), macosx)
INCLUDE_DST_OS_DIR := $(INCLUDE_DST_DIR)/darwin
INCLUDE_TARGET_DIR := $(SUPPORT_OUTPUTDIR)/modules_include/$(MODULE)
INCLUDE_SOURCE_DIR := $(TOPDIR)/src/$(MODULE)/share/native/include
ifneq ($(wildcard $(INCLUDE_SOURCE_DIR)/*), )
$(eval $(call SetupCopyFiles, COPY_EXPORTED_INCLUDE, \
SRC := $(INCLUDE_SOURCE_DIR), \
DEST := $(INCLUDE_TARGET_DIR), \
FILES := $(shell $(FIND) $(INCLUDE_SOURCE_DIR) -type f), \
))
TARGETS += $(COPY_EXPORTED_INCLUDE)
endif
# For historical reasons, the OS include directories have odd names.
INCLUDE_TARGET_OS_SUBDIR := $(OPENJDK_TARGET_OS)
ifeq ($(OPENJDK_TARGET_OS), windows)
INCLUDE_TARGET_OS_SUBDIR := win32
else ifeq ($(OPENJDK_TARGET_OS), macosx)
INCLUDE_TARGET_OS_SUBDIR := darwin
endif
# Use the most specific of OS and OS_TYPE.
INCLUDE_SOURCE_OS_DIR := $(TOPDIR)/src/$(MODULE)/$(OPENJDK_TARGET_OS)/native/include
ifeq ($(wildcard $(INCLUDE_SOURCE_OS_DIR)/*), )
INCLUDE_SOURCE_OS_DIR := $(TOPDIR)/src/$(MODULE)/$(OPENJDK_TARGET_OS_TYPE)/native/include
endif
ifneq ($(wildcard $(INCLUDE_SOURCE_OS_DIR)/*), )
$(eval $(call SetupCopyFiles, COPY_EXPORTED_INCLUDE_OS, \
SRC := $(INCLUDE_SOURCE_OS_DIR), \
DEST := $(INCLUDE_TARGET_DIR)/$(INCLUDE_TARGET_OS_SUBDIR), \
FILES := $(shell $(FIND) $(INCLUDE_SOURCE_OS_DIR) -type f), \
))
TARGETS += $(COPY_EXPORTED_INCLUDE_OS)
endif

View File

@ -38,7 +38,9 @@ $(eval $(call SetupTextFileProcessing, BUILD_VERSION_JAVA, \
@@VERSION_NUMBER@@ => $(VERSION_NUMBER) ; \
@@VERSION_PRE@@ => $(VERSION_PRE) ; \
@@VERSION_BUILD@@ => $(VERSION_BUILD) ; \
@@VERSION_OPT@@ => $(VERSION_OPT), \
@@VERSION_OPT@@ => $(VERSION_OPT) ; \
@@VERSION_DATE@@ => $(VERSION_DATE) ; \
@@VENDOR_VERSION_STRING@@ => $(VENDOR_VERSION_STRING), \
))
GENSRC_JAVA_BASE += $(BUILD_VERSION_JAVA)

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2012, 2017, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@ -92,8 +92,10 @@ ifneq ($(COMPILE_TYPE), cross)
endif
SIZER_CFLAGS := \
-I${TOPDIR}/src/hotspot/share/include \
-I${TOPDIR}/src/hotspot/os/$(HOTSPOT_TARGET_OS_TYPE)/include \
-I$(TOPDIR)/src/java.base/share/native/include \
-I$(TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_EXPORT_DIR)/native/include \
-I$(TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/native/include \
-I$(TOPDIR)/src/java.base/share/native/libjava \
-I$(TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/native/libjava \
-I$(TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/common/awt \

View File

@ -57,9 +57,10 @@ JVM_CFLAGS_INCLUDES += \
$(patsubst %,-I%,$(filter-out $(JVM_VARIANT_OUTPUTDIR)/gensrc/%, $(JVM_SRC_DIRS))) \
-I$(JVM_VARIANT_OUTPUTDIR)/gensrc \
-I$(TOPDIR)/src/hotspot/share/precompiled \
-I$(TOPDIR)/src/hotspot/share/include \
-I$(TOPDIR)/src/hotspot/os/$(HOTSPOT_TARGET_OS_TYPE)/include \
-I$(TOPDIR)/src/java.base/share/native/include \
-I$(TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/native/include \
-I$(TOPDIR)/src/java.management/share/native/include \
-I$(TOPDIR)/src/java.base/share/native/libjimage \
#

View File

@ -57,7 +57,7 @@ ifneq ($(OPENJDK_TARGET_OS), windows)
endif
else ifeq ($(OPENJDK_TARGET_OS), solaris)
LIBJSIG_CFLAGS := -m64 -KPIC -mt -I $(TOPDIR)/src/java.base/unix/native/include
LIBJSIG_CFLAGS := -m64 -KPIC -mt -I $(TOPDIR)/src/hotspot/os/$(HOTSPOT_TARGET_OS_TYPE)/include
LIBJSIG_LDFLAGS := -m64 -mt -xnolib
LIBJSIG_LIBS := $(LIBDL)

View File

@ -177,6 +177,7 @@ jprt.make.rule.test.targets=${my.make.rule.test.targets.${jprt.test.set}}
# Not all test targets need the test image
jprt.test.bundle.targets=\
${my.make.rule.test.targets.svc}, \
${my.make.rule.test.targets.hotspot.reg}, \
${my.make.rule.test.targets.hotspot.gtest} \
${my.make.rule.test.targets.nativesanity} \

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@ -31,11 +31,6 @@ $(eval $(call SetupBuildLauncher, javac, \
CFLAGS := -DEXPAND_CLASSPATH_WILDCARDS, \
))
$(eval $(call SetupBuildLauncher, javah, \
MAIN_CLASS := com.sun.tools.javah.Main, \
CFLAGS := -DEXPAND_CLASSPATH_WILDCARDS, \
))
$(eval $(call SetupBuildLauncher, serialver, \
MAIN_CLASS := sun.tools.serialver.SerialVer, \
CFLAGS := -DEXPAND_CLASSPATH_WILDCARDS, \

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@ -30,8 +30,8 @@ $(eval $(call IncludeCustomExtension, lib/Lib-java.management.gmk))
################################################################################
LIBMANAGEMENT_SRC += $(TOPDIR)/src/java.management/share/native/libmanagement
LIBMANAGEMENT_CFLAGS := -I$(TOPDIR)/src/java.management/share/native/include \
LIBMANAGEMENT_SRC += $(TOPDIR)/src/java.management/share/native/libmanagement
LIBMANAGEMENT_CFLAGS := -I$(TOPDIR)/src/hotspot/share/include \
$(addprefix -I,$(LIBMANAGEMENT_SRC)) \
-I$(SUPPORT_OUTPUTDIR)/headers/java.management \
$(LIBJAVA_HEADER_FLAGS) \

View File

@ -36,6 +36,7 @@
#include "gc/shared/cardTableModRefBS.hpp"
#include "nativeInst_ppc.hpp"
#include "oops/objArrayKlass.hpp"
#include "runtime/safepointMechanism.inline.hpp"
#include "runtime/sharedRuntime.hpp"
#define __ _masm->
@ -1314,11 +1315,10 @@ void LIR_Assembler::return_op(LIR_Opr result) {
__ pop_frame();
}
if (LoadPollAddressFromThread) {
// TODO: PPC port __ ld(polling_page, in_bytes(JavaThread::poll_address_offset()), R16_thread);
Unimplemented();
if (SafepointMechanism::uses_thread_local_poll()) {
__ ld(polling_page, in_bytes(Thread::polling_page_offset()), R16_thread);
} else {
__ load_const_optimized(polling_page, (long)(address) os::get_polling_page(), R0); // TODO: PPC port: get_standard_polling_page()
__ load_const_optimized(polling_page, (long)(address) os::get_polling_page(), R0);
}
// Restore return pc relative to callers' sp.
@ -1341,26 +1341,18 @@ void LIR_Assembler::return_op(LIR_Opr result) {
int LIR_Assembler::safepoint_poll(LIR_Opr tmp, CodeEmitInfo* info) {
if (LoadPollAddressFromThread) {
const Register poll_addr = tmp->as_register();
// TODO: PPC port __ ld(poll_addr, in_bytes(JavaThread::poll_address_offset()), R16_thread);
Unimplemented();
__ relocate(relocInfo::poll_type); // XXX
guarantee(info != NULL, "Shouldn't be NULL");
int offset = __ offset();
add_debug_info_for_branch(info);
__ load_from_polling_page(poll_addr);
return offset;
const Register poll_addr = tmp->as_register();
if (SafepointMechanism::uses_thread_local_poll()) {
__ ld(poll_addr, in_bytes(Thread::polling_page_offset()), R16_thread);
} else {
__ load_const_optimized(poll_addr, (intptr_t)os::get_polling_page(), R0);
}
__ load_const_optimized(tmp->as_register(), (intptr_t)os::get_polling_page(), R0); // TODO: PPC port: get_standard_polling_page()
if (info != NULL) {
add_debug_info_for_branch(info);
}
int offset = __ offset();
__ relocate(relocInfo::poll_type);
__ load_from_polling_page(tmp->as_register());
__ load_from_polling_page(poll_addr);
return offset;
}

View File

@ -54,4 +54,6 @@ const bool CCallingConventionRequiresIntsAsLongs = true;
#define SUPPORT_RESERVED_STACK_AREA
#define THREAD_LOCAL_POLL
#endif // CPU_PPC_VM_GLOBALDEFINITIONS_PPC_HPP

View File

@ -83,7 +83,7 @@ define_pd_global(bool, CompactStrings, true);
// 2x unrolled loop is shorter with more than 9 HeapWords.
define_pd_global(intx, InitArrayShortSize, 9*BytesPerLong);
define_pd_global(bool, ThreadLocalHandshakes, false);
define_pd_global(bool, ThreadLocalHandshakes, true);
// Platform dependent flag handling: flags only defined on this platform.
#define ARCH_FLAGS(develop, \
@ -95,12 +95,6 @@ define_pd_global(bool, ThreadLocalHandshakes, false);
constraint, \
writeable) \
\
/* Load poll address from thread. This is used to implement per-thread */ \
/* safepoints on platforms != IA64. */ \
product(bool, LoadPollAddressFromThread, false, \
"Load polling page address from thread object (required for " \
"per-thread safepoints on platforms != IA64)") \
\
product(uintx, PowerArchitecturePPC64, 0, \
"CPU Version: x for PowerX. Currently recognizes Power5 to " \
"Power8. Default is 0. Newer CPUs will be recognized as Power8.") \

View File

@ -57,10 +57,10 @@ class InterpreterMacroAssembler: public MacroAssembler {
static const Address d_tmp;
// dispatch routines
void dispatch_next(TosState state, int step = 0);
void dispatch_next(TosState state, int step = 0, bool generate_poll = false);
void dispatch_via (TosState state, address* table);
void load_dispatch_table(Register dst, address* table);
void dispatch_Lbyte_code(TosState state, Register bytecode, address* table, bool verify = false);
void dispatch_Lbyte_code(TosState state, Register bytecode, address* table, bool generate_poll = false);
// Called by shared interpreter generator.
void dispatch_prolog(TosState state, int step = 0);

View File

@ -29,6 +29,7 @@
#include "interp_masm_ppc.hpp"
#include "interpreter/interpreterRuntime.hpp"
#include "prims/jvmtiThreadState.hpp"
#include "runtime/safepointMechanism.hpp"
#include "runtime/sharedRuntime.hpp"
#ifdef PRODUCT
@ -53,7 +54,7 @@ void InterpreterMacroAssembler::jump_to_entry(address entry, Register Rscratch)
}
}
void InterpreterMacroAssembler::dispatch_next(TosState state, int bcp_incr) {
void InterpreterMacroAssembler::dispatch_next(TosState state, int bcp_incr, bool generate_poll) {
Register bytecode = R12_scratch2;
if (bcp_incr != 0) {
lbzu(bytecode, bcp_incr, R14_bcp);
@ -61,7 +62,7 @@ void InterpreterMacroAssembler::dispatch_next(TosState state, int bcp_incr) {
lbz(bytecode, 0, R14_bcp);
}
dispatch_Lbyte_code(state, bytecode, Interpreter::dispatch_table(state));
dispatch_Lbyte_code(state, bytecode, Interpreter::dispatch_table(state), generate_poll);
}
void InterpreterMacroAssembler::dispatch_via(TosState state, address* table) {
@ -203,16 +204,26 @@ void InterpreterMacroAssembler::load_dispatch_table(Register dst, address* table
}
void InterpreterMacroAssembler::dispatch_Lbyte_code(TosState state, Register bytecode,
address* table, bool verify) {
if (verify) {
unimplemented("dispatch_Lbyte_code: verify"); // See Sparc Implementation to implement this
}
address* table, bool generate_poll) {
assert_different_registers(bytecode, R11_scratch1);
// Calc dispatch table address.
load_dispatch_table(R11_scratch1, table);
if (SafepointMechanism::uses_thread_local_poll() && generate_poll) {
address *sfpt_tbl = Interpreter::safept_table(state);
if (table != sfpt_tbl) {
Label dispatch;
ld(R0, in_bytes(Thread::polling_page_offset()), R16_thread);
// Armed page has poll_bit set, if poll bit is cleared just continue.
andi_(R0, R0, SafepointMechanism::poll_bit());
beq(CCR0, dispatch);
load_dispatch_table(R11_scratch1, sfpt_tbl);
align(32, 16);
bind(dispatch);
}
}
sldi(R12_scratch2, bytecode, LogBytesPerWord);
ldx(R11_scratch1, R11_scratch1, R12_scratch2);

View File

@ -37,6 +37,8 @@
#include "runtime/interfaceSupport.hpp"
#include "runtime/objectMonitor.hpp"
#include "runtime/os.hpp"
#include "runtime/safepoint.hpp"
#include "runtime/safepointMechanism.hpp"
#include "runtime/sharedRuntime.hpp"
#include "runtime/stubRoutines.hpp"
#include "utilities/macros.hpp"
@ -3019,6 +3021,18 @@ void MacroAssembler::serialize_memory(Register thread, Register tmp1, Register t
stwx(R0, tmp1, tmp2);
}
void MacroAssembler::safepoint_poll(Label& slow_path, Register temp_reg) {
if (SafepointMechanism::uses_thread_local_poll()) {
ld(temp_reg, in_bytes(Thread::polling_page_offset()), R16_thread);
// Armed page has poll_bit set.
andi_(temp_reg, temp_reg, SafepointMechanism::poll_bit());
} else {
lwz(temp_reg, (RegisterOrConstant)(intptr_t)SafepointSynchronize::address_of_state());
cmpwi(CCR0, temp_reg, SafepointSynchronize::_not_synchronized);
}
bne(CCR0, slow_path);
}
// GC barrier helper macros

View File

@ -647,6 +647,9 @@ class MacroAssembler: public Assembler {
// Support for serializing memory accesses between threads
void serialize_memory(Register thread, Register tmp1, Register tmp2);
// Check if safepoint requested and if so branch
void safepoint_poll(Label& slow_path, Register temp_reg);
// GC barrier support.
void card_write_barrier_post(Register Rstore_addr, Register Rnew_val, Register Rtmp);
void card_table_write(jbyte* byte_map_base, Register Rtmp, Register Robj);

View File

@ -1577,11 +1577,10 @@ void MachEpilogNode::emit(CodeBuffer &cbuf, PhaseRegAlloc *ra_) const {
}
if (method_needs_polling) {
if (LoadPollAddressFromThread) {
// TODO: PPC port __ ld(polling_page, in_bytes(JavaThread::poll_address_offset()), R16_thread);
Unimplemented();
if (SafepointMechanism::uses_thread_local_poll()) {
__ ld(polling_page, in_bytes(JavaThread::polling_page_offset()), R16_thread);
} else {
__ load_const_optimized(polling_page, (long)(address) os::get_polling_page()); // TODO: PPC port: get_standard_polling_page()
__ load_const_optimized(polling_page, (long)(address) os::get_polling_page());
}
}
@ -14147,7 +14146,6 @@ instruct repl2L_immIminus1(vecX dst, immI_minus1 src) %{
instruct safePoint_poll(iRegPdst poll) %{
match(SafePoint poll);
predicate(LoadPollAddressFromThread);
// It caused problems to add the effect that r0 is killed, but this
// effect no longer needs to be mentioned, since r0 is not contained
@ -14159,24 +14157,6 @@ instruct safePoint_poll(iRegPdst poll) %{
ins_pipe(pipe_class_default);
%}
// Safepoint without per-thread support. Load address of page to poll
// as constant.
// Rscratch2RegP is R12.
// LoadConPollAddr node is added in pd_post_matching_hook(). It must be
// a seperate node so that the oop map is at the right location.
instruct safePoint_poll_conPollAddr(rscratch2RegP poll) %{
match(SafePoint poll);
predicate(!LoadPollAddressFromThread);
// It caused problems to add the effect that r0 is killed, but this
// effect no longer needs to be mentioned, since r0 is not contained
// in a reg_class.
format %{ "LD R0, #0, R12 \t// Safepoint poll for GC" %}
ins_encode( enc_poll(0x0, poll) );
ins_pipe(pipe_class_default);
%}
// ============================================================================
// Call Instructions

View File

@ -214,6 +214,7 @@ OopMap* RegisterSaver::push_frame_reg_args_and_save_live_registers(MacroAssemble
// StackFrameStream construction (needed for deoptimization; see
// compiledVFrame::create_stack_value).
// If return_pc_adjustment != 0 adjust the return pc by return_pc_adjustment.
// Updated return pc is returned in R31 (if not return_pc_is_pre_saved).
int i;
int offset;
@ -233,16 +234,17 @@ OopMap* RegisterSaver::push_frame_reg_args_and_save_live_registers(MacroAssemble
BLOCK_COMMENT("push_frame_reg_args_and_save_live_registers {");
// Save r31 in the last slot of the not yet pushed frame so that we
// can use it as scratch reg.
__ std(R31, -reg_size, R1_SP);
// Save some registers in the last slots of the not yet pushed frame so that we
// can use them as scratch regs.
__ std(R31, - reg_size, R1_SP);
__ std(R30, -2*reg_size, R1_SP);
assert(-reg_size == register_save_offset - frame_size_in_bytes + ((regstosave_num-1)*reg_size),
"consistency check");
// save the flags
// Do the save_LR_CR by hand and adjust the return pc if requested.
__ mfcr(R31);
__ std(R31, _abi(cr), R1_SP);
__ mfcr(R30);
__ std(R30, _abi(cr), R1_SP);
switch (return_pc_location) {
case return_pc_is_lr: __ mflr(R31); break;
case return_pc_is_pre_saved: assert(return_pc_adjustment == 0, "unsupported"); break;
@ -257,7 +259,7 @@ OopMap* RegisterSaver::push_frame_reg_args_and_save_live_registers(MacroAssemble
}
// push a new frame
__ push_frame(frame_size_in_bytes, R31);
__ push_frame(frame_size_in_bytes, R30);
// save all registers (ints and floats)
offset = register_save_offset;
@ -267,7 +269,7 @@ OopMap* RegisterSaver::push_frame_reg_args_and_save_live_registers(MacroAssemble
switch (reg_type) {
case RegisterSaver::int_reg: {
if (reg_num != 31) { // We spilled R31 right at the beginning.
if (reg_num < 30) { // We spilled R30-31 right at the beginning.
__ std(as_Register(reg_num), offset, R1_SP);
}
break;
@ -278,8 +280,8 @@ OopMap* RegisterSaver::push_frame_reg_args_and_save_live_registers(MacroAssemble
}
case RegisterSaver::special_reg: {
if (reg_num == SR_CTR_SpecialRegisterEnumValue) {
__ mfctr(R31);
__ std(R31, offset, R1_SP);
__ mfctr(R30);
__ std(R30, offset, R1_SP);
} else {
Unimplemented();
}
@ -2364,23 +2366,14 @@ nmethod *SharedRuntime::generate_native_wrapper(MacroAssembler *masm,
Register sync_state = r_temp_5;
Register suspend_flags = r_temp_6;
__ load_const(sync_state_addr, SafepointSynchronize::address_of_state(), /*temp*/ sync_state);
// TODO: PPC port assert(4 == SafepointSynchronize::sz_state(), "unexpected field size");
__ lwz(sync_state, 0, sync_state_addr);
// No synchronization in progress nor yet synchronized
// (cmp-br-isync on one path, release (same as acquire on PPC64) on the other path).
__ safepoint_poll(sync, sync_state);
// Not suspended.
// TODO: PPC port assert(4 == Thread::sz_suspend_flags(), "unexpected field size");
__ lwz(suspend_flags, thread_(suspend_flags));
__ acquire();
Label do_safepoint;
// No synchronization in progress nor yet synchronized.
__ cmpwi(CCR0, sync_state, SafepointSynchronize::_not_synchronized);
// Not suspended.
__ cmpwi(CCR1, suspend_flags, 0);
__ bne(CCR0, sync);
__ beq(CCR1, no_block);
// Block. Save any potential method result value before the operation and
@ -2388,6 +2381,7 @@ nmethod *SharedRuntime::generate_native_wrapper(MacroAssembler *masm,
// lets us share the oopMap we used when we went native rather than create
// a distinct one for this pc.
__ bind(sync);
__ isync();
address entry_point = is_critical_native
? CAST_FROM_FN_PTR(address, JavaThread::check_special_condition_for_native_trans_and_transition)
@ -2410,7 +2404,7 @@ nmethod *SharedRuntime::generate_native_wrapper(MacroAssembler *masm,
// Transition from _thread_in_native_trans to _thread_in_Java.
__ li(R0, _thread_in_Java);
__ release();
__ lwsync(); // Acquire safepoint and suspend state, release thread state.
// TODO: PPC port assert(4 == JavaThread::sz_thread_state(), "unexpected field size");
__ stw(R0, thread_(thread_state));
__ bind(after_transition);
@ -3093,7 +3087,7 @@ SafepointBlob* SharedRuntime::generate_handler_blob(address call_ptr, int poll_t
return_pc_location = RegisterSaver::return_pc_is_thread_saved_exception_pc;
}
// Save registers, fpu state, and flags.
// Save registers, fpu state, and flags. Set R31 = return pc.
map = RegisterSaver::push_frame_reg_args_and_save_live_registers(masm,
&frame_size_in_bytes,
/*generate_oop_map=*/ true,
@ -3142,6 +3136,19 @@ SafepointBlob* SharedRuntime::generate_handler_blob(address call_ptr, int poll_t
// No exception case.
__ BIND(noException);
if (SafepointMechanism::uses_thread_local_poll() && !cause_return) {
Label no_adjust;
// If our stashed return pc was modified by the runtime we avoid touching it
__ ld(R0, frame_size_in_bytes + _abi(lr), R1_SP);
__ cmpd(CCR0, R0, R31);
__ bne(CCR0, no_adjust);
// Adjust return pc forward to step over the safepoint poll instruction
__ addi(R31, R31, 4);
__ std(R31, frame_size_in_bytes + _abi(lr), R1_SP);
__ bind(no_adjust);
}
// Normal exit, restore registers and exit.
RegisterSaver::restore_live_registers_and_pop_frame(masm,

View File

@ -1535,23 +1535,17 @@ address TemplateInterpreterGenerator::generate_native_entry(bool synchronized) {
// Acquire isn't strictly necessary here because of the fence, but
// sync_state is declared to be volatile, so we do it anyway
// (cmp-br-isync on one path, release (same as acquire on PPC64) on the other path).
int sync_state_offs = __ load_const_optimized(sync_state_addr, SafepointSynchronize::address_of_state(), /*temp*/R0, true);
// TODO PPC port assert(4 == SafepointSynchronize::sz_state(), "unexpected field size");
__ lwz(sync_state, sync_state_offs, sync_state_addr);
Label do_safepoint, sync_check_done;
// No synchronization in progress nor yet synchronized.
__ safepoint_poll(do_safepoint, sync_state);
// Not suspended.
// TODO PPC port assert(4 == Thread::sz_suspend_flags(), "unexpected field size");
__ lwz(suspend_flags, thread_(suspend_flags));
Label sync_check_done;
Label do_safepoint;
// No synchronization in progress nor yet synchronized.
__ cmpwi(CCR0, sync_state, SafepointSynchronize::_not_synchronized);
// Not suspended.
__ cmpwi(CCR1, suspend_flags, 0);
__ bne(CCR0, do_safepoint);
__ beq(CCR1, sync_check_done);
__ bind(do_safepoint);
__ isync();
// Block. We do the call directly and leave the current
@ -1592,7 +1586,7 @@ address TemplateInterpreterGenerator::generate_native_entry(bool synchronized) {
// we don't want the current thread to continue until all our prior memory
// accesses (including the new thread state) are visible to other threads.
__ li(R0/*thread_state*/, _thread_in_Java);
__ release();
__ lwsync(); // Acquire safepoint and suspend state, release thread state.
__ stw(R0/*thread_state*/, thread_(thread_state));
if (CheckJNICalls) {
@ -1858,10 +1852,7 @@ address TemplateInterpreterGenerator::generate_CRC32_update_entry() {
// Safepoint check
const Register sync_state = R11_scratch1;
int sync_state_offs = __ load_const_optimized(sync_state, SafepointSynchronize::address_of_state(), /*temp*/R0, true);
__ lwz(sync_state, sync_state_offs, sync_state);
__ cmpwi(CCR0, sync_state, SafepointSynchronize::_not_synchronized);
__ bne(CCR0, slow_path);
__ safepoint_poll(slow_path, sync_state);
// We don't generate local frame and don't align stack because
// we not even call stub code (we generate the code inline)
@ -1918,10 +1909,7 @@ address TemplateInterpreterGenerator::generate_CRC32_updateBytes_entry(AbstractI
// Safepoint check
const Register sync_state = R11_scratch1;
int sync_state_offs = __ load_const_optimized(sync_state, SafepointSynchronize::address_of_state(), /*temp*/R0, true);
__ lwz(sync_state, sync_state_offs, sync_state);
__ cmpwi(CCR0, sync_state, SafepointSynchronize::_not_synchronized);
__ bne(CCR0, slow_path);
__ safepoint_poll(slow_path, sync_state);
// We don't generate local frame and don't align stack because
// we not even call stub code (we generate the code inline)

View File

@ -1630,7 +1630,7 @@ void TemplateTable::branch(bool is_jsr, bool is_wide) {
// Push returnAddress for "ret" on stack.
__ push_ptr(R17_tos);
// And away we go!
__ dispatch_next(vtos);
__ dispatch_next(vtos, 0 ,true);
return;
}
@ -1643,7 +1643,6 @@ void TemplateTable::branch(bool is_jsr, bool is_wide) {
const bool increment_invocation_counter_for_backward_branches = UseCompiler && UseLoopCounter;
if (increment_invocation_counter_for_backward_branches) {
Label Lforward;
__ dispatch_prolog(vtos);
// Check branch direction.
__ cmpdi(CCR0, Rdisp, 0);
@ -1744,11 +1743,8 @@ void TemplateTable::branch(bool is_jsr, bool is_wide) {
}
__ bind(Lforward);
__ dispatch_epilog(vtos);
} else {
__ dispatch_next(vtos);
}
__ dispatch_next(vtos, 0, true);
}
// Helper function for if_cmp* methods below.
@ -1829,7 +1825,7 @@ void TemplateTable::ret() {
__ ld(R11_scratch1, in_bytes(Method::const_offset()), R19_method);
__ add(R11_scratch1, R17_tos, R11_scratch1);
__ addi(R14_bcp, R11_scratch1, in_bytes(ConstMethod::codes_offset()));
__ dispatch_next(vtos);
__ dispatch_next(vtos, 0, true);
}
void TemplateTable::wide_ret() {
@ -1846,7 +1842,7 @@ void TemplateTable::wide_ret() {
__ ld(Rscratch1, in_bytes(Method::const_offset()), R19_method);
__ addi(Rscratch2, R17_tos, in_bytes(ConstMethod::codes_offset()));
__ add(R14_bcp, Rscratch1, Rscratch2);
__ dispatch_next(vtos);
__ dispatch_next(vtos, 0, true);
}
void TemplateTable::tableswitch() {
@ -1896,7 +1892,7 @@ void TemplateTable::tableswitch() {
__ bind(Ldispatch);
__ add(R14_bcp, Roffset, R14_bcp);
__ dispatch_next(vtos);
__ dispatch_next(vtos, 0, true);
}
void TemplateTable::lookupswitch() {
@ -1960,7 +1956,7 @@ void TemplateTable::fast_linearswitch() {
__ bind(Lcontinue_execution);
__ add(R14_bcp, Roffset, R14_bcp);
__ dispatch_next(vtos);
__ dispatch_next(vtos, 0, true);
}
// Table switch using binary search (value/offset pairs are ordered).
@ -2093,7 +2089,7 @@ void TemplateTable::fast_binaryswitch() {
__ extsw(Rj, Rj);
__ add(R14_bcp, Rj, R14_bcp);
__ dispatch_next(vtos);
__ dispatch_next(vtos, 0 , true);
}
void TemplateTable::_return(TosState state) {
@ -2124,6 +2120,17 @@ void TemplateTable::_return(TosState state) {
__ bind(Lskip_register_finalizer);
}
if (SafepointMechanism::uses_thread_local_poll() && _desc->bytecode() != Bytecodes::_return_register_finalizer) {
Label no_safepoint;
__ ld(R11_scratch1, in_bytes(Thread::polling_page_offset()), R16_thread);
__ andi_(R11_scratch1, R11_scratch1, SafepointMechanism::poll_bit());
__ beq(CCR0, no_safepoint);
__ push(state);
__ call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::at_safepoint));
__ pop(state);
__ bind(no_safepoint);
}
// Move the result value into the correct register and remove memory stack frame.
__ remove_activation(state, /* throw_monitor_exception */ true);
// Restoration of lr done by remove_activation.

View File

@ -1459,6 +1459,10 @@ class Assembler : public AbstractAssembler {
bcondLogNotZero = bcondLogNotZero_Carry | bcondLogNotZero_NoCarry,
bcondLogCarry = bcondLogZero_Carry | bcondLogNotZero_Carry,
bcondLogBorrow = /* bcondLogZero_Borrow | */ bcondLogNotZero_Borrow,
// Vector compare instructions
bcondVAlltrue = 8, // All vector elements evaluate true
bcondVMixed = 4, // Some vector elements evaluate true, some false
bcondVAllfalse = 1, // All vector elements evaluate false
// string search instructions
bcondFound = 4,
bcondNotFound = 2,
@ -3022,6 +3026,12 @@ class Assembler : public AbstractAssembler {
inline void z_btrue( Label& L);
inline void z_bfalse(Label& L);
inline void z_bvat(Label& L); // all true
inline void z_bvnt(Label& L); // not all true (mixed or all false)
inline void z_bvmix(Label& L); // mixed true and false
inline void z_bvaf(Label& L); // not all false (mixed or all true)
inline void z_bvnf(Label& L); // all false
inline void z_brno( Label& L);

View File

@ -1315,23 +1315,28 @@ inline void Assembler::z_br(Register r2) { assert(r2 != Z_R0, "nop if target is
inline void Assembler::z_exrl(Register r1, Label& L) { z_exrl(r1, target(L)); } // z10
inline void Assembler::z_larl(Register r1, Label& L) { z_larl(r1, target(L)); }
inline void Assembler::z_bru( Label& L) { z_brc(bcondAlways,target(L)); }
inline void Assembler::z_brul( Label& L) { z_brcl(bcondAlways,target(L)); }
inline void Assembler::z_brul( address a) { z_brcl(bcondAlways,a); }
inline void Assembler::z_brh( Label& L) { z_brc(bcondHigh,target(L)); }
inline void Assembler::z_brl( Label& L) { z_brc(bcondLow,target(L)); }
inline void Assembler::z_bre( Label& L) { z_brc(bcondEqual,target(L)); }
inline void Assembler::z_brnh( Label& L) { z_brc(bcondNotHigh,target(L)); }
inline void Assembler::z_brnl( Label& L) { z_brc(bcondNotLow,target(L)); }
inline void Assembler::z_brne( Label& L) { z_brc(bcondNotEqual,target(L)); }
inline void Assembler::z_brz( Label& L) { z_brc(bcondZero,target(L)); }
inline void Assembler::z_brnz( Label& L) { z_brc(bcondNotZero,target(L)); }
inline void Assembler::z_braz( Label& L) { z_brc(bcondAllZero,target(L)); }
inline void Assembler::z_brnaz( Label& L) { z_brc(bcondNotAllZero,target(L)); }
inline void Assembler::z_bru( Label& L) { z_brc(bcondAlways, target(L)); }
inline void Assembler::z_brul( Label& L) { z_brcl(bcondAlways, target(L)); }
inline void Assembler::z_brul( address a) { z_brcl(bcondAlways,a ); }
inline void Assembler::z_brh( Label& L) { z_brc(bcondHigh, target(L)); }
inline void Assembler::z_brl( Label& L) { z_brc(bcondLow, target(L)); }
inline void Assembler::z_bre( Label& L) { z_brc(bcondEqual, target(L)); }
inline void Assembler::z_brnh( Label& L) { z_brc(bcondNotHigh, target(L)); }
inline void Assembler::z_brnl( Label& L) { z_brc(bcondNotLow, target(L)); }
inline void Assembler::z_brne( Label& L) { z_brc(bcondNotEqual, target(L)); }
inline void Assembler::z_brz( Label& L) { z_brc(bcondZero, target(L)); }
inline void Assembler::z_brnz( Label& L) { z_brc(bcondNotZero, target(L)); }
inline void Assembler::z_braz( Label& L) { z_brc(bcondAllZero, target(L)); }
inline void Assembler::z_brnaz( Label& L) { z_brc(bcondNotAllZero, target(L)); }
inline void Assembler::z_brnp( Label& L) { z_brc( bcondNotPositive, target( L)); }
inline void Assembler::z_btrue( Label& L) { z_brc(bcondAllOne,target(L)); }
inline void Assembler::z_bfalse(Label& L) { z_brc(bcondAllZero,target(L)); }
inline void Assembler::z_brno( Label& L) { z_brc(bcondNotOrdered,target(L)); }
inline void Assembler::z_btrue( Label& L) { z_brc(bcondAllOne, target(L)); }
inline void Assembler::z_bfalse(Label& L) { z_brc(bcondAllZero, target(L)); }
inline void Assembler::z_bvat( Label& L) { z_brc(bcondVAlltrue, target(L)); }
inline void Assembler::z_bvnt( Label& L) { z_brc((Assembler::branch_condition)(bcondVMixed | bcondVAllfalse), target(L)); }
inline void Assembler::z_bvmix( Label& L) { z_brc(bcondVMixed, target(L)); }
inline void Assembler::z_bvaf( Label& L) { z_brc(bcondVAllfalse, target(L)); }
inline void Assembler::z_bvnf( Label& L) { z_brc((Assembler::branch_condition)(bcondVMixed | bcondVAlltrue), target(L)); }
inline void Assembler::z_brno( Label& L) { z_brc(bcondNotOrdered, target(L)); }
inline void Assembler::z_brc( branch_condition m, Label& L) { z_brc(m, target(L)); }
inline void Assembler::z_brcl(branch_condition m, Label& L) { z_brcl(m, target(L)); }

View File

@ -36,6 +36,7 @@
#include "gc/shared/cardTableModRefBS.hpp"
#include "nativeInst_s390.hpp"
#include "oops/objArrayKlass.hpp"
#include "runtime/safepointMechanism.inline.hpp"
#include "runtime/sharedRuntime.hpp"
#include "vmreg_s390.inline.hpp"
@ -1135,8 +1136,12 @@ void LIR_Assembler::return_op(LIR_Opr result) {
(result->is_single_fpu() && result->as_float_reg() == Z_F0) ||
(result->is_double_fpu() && result->as_double_reg() == Z_F0), "convention");
AddressLiteral pp(os::get_polling_page());
__ load_const_optimized(Z_R1_scratch, pp);
if (SafepointMechanism::uses_thread_local_poll()) {
__ z_lg(Z_R1_scratch, Address(Z_thread, Thread::polling_page_offset()));
} else {
AddressLiteral pp(os::get_polling_page());
__ load_const_optimized(Z_R1_scratch, pp);
}
// Pop the frame before the safepoint code.
__ pop_frame_restore_retPC(initial_frame_size_in_bytes());
@ -1154,13 +1159,18 @@ void LIR_Assembler::return_op(LIR_Opr result) {
}
int LIR_Assembler::safepoint_poll(LIR_Opr tmp, CodeEmitInfo* info) {
AddressLiteral pp(os::get_polling_page());
__ load_const_optimized(tmp->as_register_lo(), pp);
const Register poll_addr = tmp->as_register_lo();
if (SafepointMechanism::uses_thread_local_poll()) {
__ z_lg(poll_addr, Address(Z_thread, Thread::polling_page_offset()));
} else {
AddressLiteral pp(os::get_polling_page());
__ load_const_optimized(poll_addr, pp);
}
guarantee(info != NULL, "Shouldn't be NULL");
add_debug_info_for_branch(info);
int offset = __ offset();
__ relocate(relocInfo::poll_type);
__ load_from_polling_page(tmp->as_register_lo());
__ load_from_polling_page(poll_addr);
return offset;
}

View File

@ -54,4 +54,6 @@ const bool CCallingConventionRequiresIntsAsLongs = true;
#define SUPPORT_RESERVED_STACK_AREA
#define THREAD_LOCAL_POLL
#endif // CPU_S390_VM_GLOBALDEFINITIONS_S390_HPP

View File

@ -85,7 +85,7 @@ define_pd_global(bool, CompactStrings, true);
// 8146801 (Short Array Allocation): No performance work done here yet.
define_pd_global(intx, InitArrayShortSize, 1*BytesPerLong);
define_pd_global(bool, ThreadLocalHandshakes, false);
define_pd_global(bool, ThreadLocalHandshakes, true);
#define ARCH_FLAGS(develop, product, diagnostic, experimental, notproduct, range, constraint, writeable) \
\

View File

@ -36,6 +36,7 @@
#include "prims/jvmtiThreadState.hpp"
#include "runtime/basicLock.hpp"
#include "runtime/biasedLocking.hpp"
#include "runtime/safepointMechanism.hpp"
#include "runtime/sharedRuntime.hpp"
#include "runtime/thread.inline.hpp"
@ -74,16 +75,16 @@ void InterpreterMacroAssembler::dispatch_epilog(TosState state, int step) {
dispatch_next(state, step);
}
void InterpreterMacroAssembler::dispatch_next(TosState state, int bcp_incr) {
void InterpreterMacroAssembler::dispatch_next(TosState state, int bcp_incr, bool generate_poll) {
z_llgc(Z_bytecode, bcp_incr, Z_R0, Z_bcp); // Load next bytecode.
add2reg(Z_bcp, bcp_incr); // Advance bcp. Add2reg produces optimal code.
dispatch_base(state, Interpreter::dispatch_table(state));
dispatch_base(state, Interpreter::dispatch_table(state), generate_poll);
}
// Common code to dispatch and dispatch_only.
// Dispatch value in Lbyte_code and increment Lbcp.
void InterpreterMacroAssembler::dispatch_base(TosState state, address* table) {
void InterpreterMacroAssembler::dispatch_base(TosState state, address* table, bool generate_poll) {
verify_FPU(1, state);
#ifdef ASSERT
@ -109,7 +110,20 @@ void InterpreterMacroAssembler::dispatch_base(TosState state, address* table) {
verify_oop(Z_tos, state);
// Dispatch table to use.
load_absolute_address(Z_tmp_1, (address) table); // Z_tmp_1 = table;
load_absolute_address(Z_tmp_1, (address)table); // Z_tmp_1 = table;
if (SafepointMechanism::uses_thread_local_poll() && generate_poll) {
address *sfpt_tbl = Interpreter::safept_table(state);
if (table != sfpt_tbl) {
Label dispatch;
const Address poll_byte_addr(Z_thread, in_bytes(Thread::polling_page_offset()) + 7 /* Big Endian */);
// Armed page has poll_bit set, if poll bit is cleared just continue.
z_tm(poll_byte_addr, SafepointMechanism::poll_bit());
z_braz(dispatch);
load_absolute_address(Z_tmp_1, (address)sfpt_tbl); // Z_tmp_1 = table;
bind(dispatch);
}
}
// 0 <= Z_bytecode < 256 => Use a 32 bit shift, because it is shorter than sllg.
// Z_bytecode must have been loaded zero-extended for this approach to be correct.
@ -119,8 +133,8 @@ void InterpreterMacroAssembler::dispatch_base(TosState state, address* table) {
z_br(Z_tmp_1);
}
void InterpreterMacroAssembler::dispatch_only(TosState state) {
dispatch_base(state, Interpreter::dispatch_table(state));
void InterpreterMacroAssembler::dispatch_only(TosState state, bool generate_poll) {
dispatch_base(state, Interpreter::dispatch_table(state), generate_poll);
}
void InterpreterMacroAssembler::dispatch_only_normal(TosState state) {

View File

@ -49,7 +49,7 @@ class InterpreterMacroAssembler: public MacroAssembler {
bool check_exceptions);
// Base routine for all dispatches.
void dispatch_base(TosState state, address* table);
void dispatch_base(TosState state, address* table, bool generate_poll = false);
public:
InterpreterMacroAssembler(CodeBuffer* c)
@ -78,11 +78,11 @@ class InterpreterMacroAssembler: public MacroAssembler {
// dispatch routines
void dispatch_prolog(TosState state, int step = 0);
void dispatch_epilog(TosState state, int step = 0);
void dispatch_only(TosState state);
void dispatch_only(TosState state, bool generate_poll = false);
// Dispatch normal table via Z_bytecode (assume Z_bytecode is loaded already).
void dispatch_only_normal(TosState state);
void dispatch_normal(TosState state);
void dispatch_next(TosState state, int step = 0);
void dispatch_next(TosState state, int step = 0, bool generate_poll = false);
void dispatch_next_noverify_oop(TosState state, int step = 0);
void dispatch_via(TosState state, address* table);

View File

@ -43,6 +43,8 @@
#include "runtime/interfaceSupport.hpp"
#include "runtime/objectMonitor.hpp"
#include "runtime/os.hpp"
#include "runtime/safepoint.hpp"
#include "runtime/safepointMechanism.hpp"
#include "runtime/sharedRuntime.hpp"
#include "runtime/stubRoutines.hpp"
#include "utilities/events.hpp"
@ -2019,6 +2021,15 @@ address MacroAssembler::get_PC(Register result, int64_t offset) {
return here + offset;
}
void MacroAssembler::instr_size(Register size, Register pc) {
// Extract 2 most significant bits of current instruction.
z_llgc(size, Address(pc));
z_srl(size, 6);
// Compute (x+3)&6 which translates 0->2, 1->4, 2->4, 3->6.
z_ahi(size, 3);
z_nill(size, 6);
}
// Resize_frame with SP(new) = SP(old) - [offset].
void MacroAssembler::resize_frame_sub(Register offset, Register fp, bool load_fp)
{
@ -2705,6 +2716,19 @@ void MacroAssembler::serialize_memory(Register thread, Register tmp1, Register t
z_st(Z_R0, 0, tmp2, tmp1);
}
void MacroAssembler::safepoint_poll(Label& slow_path, Register temp_reg) {
if (SafepointMechanism::uses_thread_local_poll()) {
const Address poll_byte_addr(Z_thread, in_bytes(Thread::polling_page_offset()) + 7 /* Big Endian */);
// Armed page has poll_bit set.
z_tm(poll_byte_addr, SafepointMechanism::poll_bit());
z_brnaz(slow_path);
} else {
load_const_optimized(temp_reg, SafepointSynchronize::address_of_state());
z_cli(/*SafepointSynchronize::sz_state()*/4-1, temp_reg, SafepointSynchronize::_not_synchronized);
z_brne(slow_path);
}
}
// Don't rely on register locking, always use Z_R1 as scratch register instead.
void MacroAssembler::bang_stack_with_offset(int offset) {
// Stack grows down, caller passes positive offset.
@ -4914,13 +4938,14 @@ unsigned int MacroAssembler::CopyRawMemory_AlignedDisjoint(Register src_reg, Reg
// The result is the number of characters copied before the first incompatible character was found.
// If precise is true, the processing stops exactly at this point. Otherwise, the result may be off
// by a few bytes. The result always indicates the number of copied characters.
// When used as a character index, the returned value points to the first incompatible character.
//
// Note: Does not behave exactly like package private StringUTF16 compress java implementation in case of failure:
// - Different number of characters may have been written to dead array (if precise is false).
// - Returns a number <cnt instead of 0. (Result gets compared with cnt.)
unsigned int MacroAssembler::string_compress(Register result, Register src, Register dst, Register cnt,
Register tmp, bool precise) {
assert_different_registers(Z_R0, Z_R1, src, dst, cnt, tmp);
assert_different_registers(Z_R0, Z_R1, result, src, dst, cnt, tmp);
if (precise) {
BLOCK_COMMENT("encode_iso_array {");
@ -5027,7 +5052,7 @@ unsigned int MacroAssembler::string_compress(Register result, Register src, Regi
z_vo(Vtmp1, Vtmp1, Vtmp2);
z_vn(Vtmp1, Vtmp1, Vmask);
z_vceqhs(Vtmp1, Vtmp1, Vzero); // high half of all chars must be zero for successful compress.
z_brne(VectorBreak); // break vector loop, incompatible character found.
z_bvnt(VectorBreak); // break vector loop if not all vector elements compare eq -> incompatible character found.
// re-process data from current iteration in break handler.
//---< pack & store characters >---
@ -5094,24 +5119,28 @@ unsigned int MacroAssembler::string_compress(Register result, Register src, Regi
z_tmll(Rcnt, min_cnt-1);
z_brnaz(ScalarShortcut); // if all bits zero, there is nothing left to do for scalar loop.
// Rix == 0 in all cases.
z_sllg(Z_R1, Rcnt, 1); // # src bytes already processed. Only lower 32 bits are valid!
// Z_R1 contents must be treated as unsigned operand! For huge strings,
// (Rcnt >= 2**30), the value may spill into the sign bit by sllg.
z_lgfr(result, Rcnt); // all characters processed.
z_sgfr(Rdst, Rcnt); // restore ptr
z_sgfr(Rsrc, Rcnt); // restore ptr, double the element count for Rsrc restore
z_sgfr(Rsrc, Rcnt);
z_slgfr(Rdst, Rcnt); // restore ptr
z_slgfr(Rsrc, Z_R1); // restore ptr, double the element count for Rsrc restore
z_bru(AllDone);
bind(UnrolledBreak);
z_lgfr(Z_R0, Rcnt); // # chars processed in total after unrolled loop
z_nilf(Z_R0, ~(min_cnt-1));
z_sll(Rix, log_min_cnt); // # chars processed so far in UnrolledLoop, excl. current iteration.
z_sr(Z_R0, Rix); // correct # chars processed in total.
z_sll(Rix, log_min_cnt); // # chars not yet processed in UnrolledLoop (due to break), broken iteration not included.
z_sr(Z_R0, Rix); // fix # chars processed OK so far.
if (!precise) {
z_lgfr(result, Z_R0);
z_sllg(Z_R1, Z_R0, 1); // # src bytes already processed. Only lower 32 bits are valid!
// Z_R1 contents must be treated as unsigned operand! For huge strings,
// (Rcnt >= 2**30), the value may spill into the sign bit by sllg.
z_aghi(result, min_cnt/2); // min_cnt/2 characters have already been written
// but ptrs were not updated yet.
z_sgfr(Rdst, Z_R0); // restore ptr
z_sgfr(Rsrc, Z_R0); // restore ptr, double the element count for Rsrc restore
z_sgfr(Rsrc, Z_R0);
z_slgfr(Rdst, Z_R0); // restore ptr
z_slgfr(Rsrc, Z_R1); // restore ptr, double the element count for Rsrc restore
z_bru(AllDone);
}
bind(UnrolledDone);
@ -5165,7 +5194,7 @@ unsigned int MacroAssembler::string_compress(Register result, Register src, Regi
z_sr(Rix, Z_R0);
}
z_lgfr(result, Rcnt); // # processed characters (if all runs ok).
z_brz(ScalarDone);
z_brz(ScalarDone); // uses CC from Rix calculation
bind(ScalarLoop);
z_llh(Z_R1, 0, Z_R0, Rsrc);
@ -6452,27 +6481,6 @@ void MacroAssembler::translate_tt(Register r1, Register r2, uint m3) {
Assembler::z_brc(Assembler::bcondOverflow /* CC==3 (iterate) */, retry);
}
void MacroAssembler::generate_safepoint_check(Label& slow_path, Register scratch, bool may_relocate) {
if (scratch == noreg) scratch = Z_R1;
address Astate = SafepointSynchronize::address_of_state();
BLOCK_COMMENT("safepoint check:");
if (may_relocate) {
ptrdiff_t total_distance = Astate - this->pc();
if (RelAddr::is_in_range_of_RelAddr32(total_distance)) {
RelocationHolder rspec = external_word_Relocation::spec(Astate);
(this)->relocate(rspec, relocInfo::pcrel_addr_format);
load_absolute_address(scratch, Astate);
} else {
load_const_optimized(scratch, Astate);
}
} else {
load_absolute_address(scratch, Astate);
}
z_cli(/*SafepointSynchronize::sz_state()*/4-1, scratch, SafepointSynchronize::_not_synchronized);
z_brne(slow_path);
}
void MacroAssembler::generate_type_profiling(const Register Rdata,
const Register Rreceiver_klass,

View File

@ -260,8 +260,6 @@ class MacroAssembler: public Assembler {
//
// Constants, loading constants, TOC support
//
// Safepoint check factored out.
void generate_safepoint_check(Label& slow_path, Register scratch = noreg, bool may_relocate = true);
// Load generic address: d <- base(a) + index(a) + disp(a).
inline void load_address(Register d, const Address &a);
@ -443,6 +441,9 @@ class MacroAssembler: public Assembler {
// Get current PC + offset. Offset given in bytes, must be even!
address get_PC(Register result, int64_t offset);
// Get size of instruction at pc (which must point to valid code).
void instr_size(Register size, Register pc);
// Accessing, and in particular modifying, a stack location is only safe if
// the stack pointer (Z_SP) is set such that the accessed stack location is
// in the reserved range.
@ -641,6 +642,9 @@ class MacroAssembler: public Assembler {
// Support for serializing memory accesses between threads.
void serialize_memory(Register thread, Register tmp1, Register tmp2);
// Check if safepoint requested and if so branch
void safepoint_poll(Label& slow_path, Register temp_reg);
// Stack overflow checking
void bang_stack_with_offset(int offset);

View File

@ -919,8 +919,12 @@ void MachEpilogNode::emit(CodeBuffer &cbuf, PhaseRegAlloc *ra_) const {
// Touch the polling page.
if (need_polling) {
AddressLiteral pp(os::get_polling_page());
__ load_const_optimized(Z_R1_scratch, pp);
if (SafepointMechanism::uses_thread_local_poll()) {
__ z_lg(Z_R1_scratch, Address(Z_thread, Thread::polling_page_offset()));
} else {
AddressLiteral pp(os::get_polling_page());
__ load_const_optimized(Z_R1_scratch, pp);
}
// We need to mark the code position where the load from the safepoint
// polling page was emitted as relocInfo::poll_return_type here.
__ relocate(relocInfo::poll_return_type);

View File

@ -2165,7 +2165,7 @@ nmethod *SharedRuntime::generate_native_wrapper(MacroAssembler *masm,
__ serialize_memory(Z_thread, Z_R1, Z_R2);
}
}
__ generate_safepoint_check(sync, Z_R1, true);
__ safepoint_poll(sync, Z_R1);
__ load_and_test_int(Z_R0, Address(Z_thread, JavaThread::suspend_flags_offset()));
__ z_bre(no_block);
@ -3190,12 +3190,18 @@ SafepointBlob* SharedRuntime::generate_handler_blob(address call_ptr, int poll_t
bool cause_return = (poll_type == POLL_AT_RETURN);
// Make room for return address (or push it again)
if (!cause_return)
if (!cause_return) {
__ z_lg(Z_R14, Address(Z_thread, JavaThread::saved_exception_pc_offset()));
}
// Save registers, fpu state, and flags
map = RegisterSaver::save_live_registers(masm, RegisterSaver::all_registers);
if (SafepointMechanism::uses_thread_local_poll() && !cause_return) {
// Keep a copy of the return pc to detect if it gets modified.
__ z_lgr(Z_R6, Z_R14);
}
// The following is basically a call_VM. However, we need the precise
// address of the call in order to generate an oopmap. Hence, we do all the
// work outselves.
@ -3231,6 +3237,21 @@ SafepointBlob* SharedRuntime::generate_handler_blob(address call_ptr, int poll_t
// No exception case
__ bind(noException);
if (SafepointMechanism::uses_thread_local_poll() && !cause_return) {
Label no_adjust;
// If our stashed return pc was modified by the runtime we avoid touching it
const int offset_of_return_pc = _z_abi16(return_pc) + RegisterSaver::live_reg_frame_size(RegisterSaver::all_registers);
__ z_cg(Z_R6, offset_of_return_pc, Z_SP);
__ z_brne(no_adjust);
// Adjust return pc forward to step over the safepoint poll instruction
__ instr_size(Z_R1_scratch, Z_R6);
__ z_agr(Z_R6, Z_R1_scratch);
__ z_stg(Z_R6, offset_of_return_pc, Z_SP);
__ bind(no_adjust);
}
// Normal exit, restore registers and exit.
RegisterSaver::restore_live_registers(masm, RegisterSaver::all_registers);

View File

@ -1633,7 +1633,7 @@ address TemplateInterpreterGenerator::generate_native_entry(bool synchronized) {
// Check for safepoint operation in progress and/or pending suspend requests.
{
Label Continue, do_safepoint;
__ generate_safepoint_check(do_safepoint, Z_R1, true);
__ safepoint_poll(do_safepoint, Z_R1);
// Check for suspend.
__ load_and_test_int(Z_R0/*suspend_flags*/, thread_(suspend_flags));
__ z_bre(Continue); // 0 -> no flag set -> not suspended
@ -1937,7 +1937,7 @@ address TemplateInterpreterGenerator::generate_CRC32_update_entry() {
Label slow_path;
// If we need a safepoint check, generate full interpreter entry.
__ generate_safepoint_check(slow_path, Z_R1, false);
__ safepoint_poll(slow_path, Z_R1);
BLOCK_COMMENT("CRC32_update {");
@ -1990,7 +1990,7 @@ address TemplateInterpreterGenerator::generate_CRC32_updateBytes_entry(AbstractI
Label slow_path;
// If we need a safepoint check, generate full interpreter entry.
__ generate_safepoint_check(slow_path, Z_R1, false);
__ safepoint_poll(slow_path, Z_R1);
// We don't generate local frame and don't align stack because
// we call stub code and there is no safepoint on this path.

View File

@ -1853,7 +1853,7 @@ void TemplateTable::branch(bool is_jsr, bool is_wide) {
// Push return address for "ret" on stack.
__ push_ptr(Z_tos);
// And away we go!
__ dispatch_next(vtos);
__ dispatch_next(vtos, 0 , true);
return;
}
@ -1961,7 +1961,7 @@ void TemplateTable::branch(bool is_jsr, bool is_wide) {
// Z_tos: Return bci for jsr's, unused otherwise.
// Z_bytecode: target bytecode
// Z_bcp: target bcp
__ dispatch_only(vtos);
__ dispatch_only(vtos, true);
// Out-of-line code runtime calls.
if (UseLoopCounter) {
@ -2072,7 +2072,7 @@ void TemplateTable::ret() {
__ get_method(Z_tos);
__ mem2reg_opt(Z_R1_scratch, Address(Z_tos, Method::const_offset()));
__ load_address(Z_bcp, Address(Z_R1_scratch, Z_tmp_1, ConstMethod::codes_offset()));
__ dispatch_next(vtos);
__ dispatch_next(vtos, 0 , true);
}
void TemplateTable::wide_ret() {
@ -2085,7 +2085,7 @@ void TemplateTable::wide_ret() {
__ get_method(Z_tos);
__ mem2reg_opt(Z_R1_scratch, Address(Z_tos, Method::const_offset()));
__ load_address(Z_bcp, Address(Z_R1_scratch, Z_tmp_1, ConstMethod::codes_offset()));
__ dispatch_next(vtos);
__ dispatch_next(vtos, 0, true);
}
void TemplateTable::tableswitch () {
@ -2129,7 +2129,7 @@ void TemplateTable::tableswitch () {
// Load next bytecode.
__ z_llgc(Z_bytecode, Address(Z_bcp, index));
__ z_agr(Z_bcp, index); // Advance bcp.
__ dispatch_only(vtos);
__ dispatch_only(vtos, true);
// Handle default.
__ bind(default_case);
@ -2193,7 +2193,7 @@ void TemplateTable::fast_linearswitch () {
// Load next bytecode.
__ z_llgc(Z_bytecode, Address(Z_bcp, offset, 0));
__ z_agr(Z_bcp, offset); // Advance bcp.
__ dispatch_only(vtos);
__ dispatch_only(vtos, true);
}
@ -2302,7 +2302,7 @@ void TemplateTable::fast_binaryswitch() {
// Load next bytecode.
__ z_llgc(Z_bytecode, Address(Z_bcp, j));
__ z_agr(Z_bcp, j); // Advance bcp.
__ dispatch_only(vtos);
__ dispatch_only(vtos, true);
// default case -> j = default offset
__ bind(default_case);
@ -2312,7 +2312,7 @@ void TemplateTable::fast_binaryswitch() {
// Load next bytecode.
__ z_llgc(Z_bytecode, Address(Z_bcp, j));
__ z_agr(Z_bcp, j); // Advance bcp.
__ dispatch_only(vtos);
__ dispatch_only(vtos, true);
}
void TemplateTable::_return(TosState state) {
@ -2333,6 +2333,17 @@ void TemplateTable::_return(TosState state) {
__ bind(skip_register_finalizer);
}
if (SafepointMechanism::uses_thread_local_poll() && _desc->bytecode() != Bytecodes::_return_register_finalizer) {
Label no_safepoint;
const Address poll_byte_addr(Z_thread, in_bytes(Thread::polling_page_offset()) + 7 /* Big Endian */);
__ z_tm(poll_byte_addr, SafepointMechanism::poll_bit());
__ z_braz(no_safepoint);
__ push(state);
__ call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::at_safepoint));
__ pop(state);
__ bind(no_safepoint);
}
if (state == itos) {
// Narrow result if state is itos but result type is smaller.
// Need to narrow in the return bytecode rather than in generate_return_entry

View File

@ -5157,8 +5157,8 @@ class StubGenerator: public StubCodeGenerator {
const Register gxp = G1; // Need to use global registers across RWs.
const Register gyp = G2;
const Register gzp = G3;
const Register offs = G4;
const Register disp = G5;
const Register disp = G4;
const Register offs = G5;
__ mov(xptr, gxp);
__ mov(yptr, gyp);
@ -5569,8 +5569,8 @@ class StubGenerator: public StubCodeGenerator {
// for (int i = xn; i >= 0; i--)
__ bind(L_loop_i);
__ cmp_and_br_short(xpc, xp,// i >= 0
Assembler::less, Assembler::pn, L_exit_loop_i);
__ cmp_and_brx_short(xpc, xp,// i >= 0
Assembler::lessUnsigned, Assembler::pn, L_exit_loop_i);
__ lduw(xpc, 0, rt); // u64 x = xp[i]
__ lduw(xpc, 4, rx); // ...
__ sllx(rt, 32, rt);
@ -5598,8 +5598,8 @@ class StubGenerator: public StubCodeGenerator {
__ bind(L_loop_j);
__ cmp_and_br_short(ypc, yp,// j >= 0
Assembler::less, Assembler::pn, L_exit);
__ cmp_and_brx_short(ypc, yp,// j >= 0
Assembler::lessUnsigned, Assembler::pn, L_exit);
__ clr(rc); // u64 c = 0
__ lduw(ypc, 0, rt); // u64 y = yp[j] (= *ypc)
__ lduw(ypc, 4, ry); // ...
@ -5615,8 +5615,8 @@ class StubGenerator: public StubCodeGenerator {
__ bind(L_loop_i2);
__ cmp_and_br_short(xpc, xp,// i >= 0
Assembler::less, Assembler::pn, L_exit_loop_i2);
__ cmp_and_brx_short(xpc, xp,// i >= 0
Assembler::lessUnsigned, Assembler::pn, L_exit_loop_i2);
__ lduw(xpc, 0, rt); // u64 x = xp[i] (= *xpc)
__ lduw(xpc, 4, rx); // ...
__ sllx(rt, 32, rt);

View File

@ -7449,6 +7449,27 @@ void Assembler::blendvpd(XMMRegister dst, XMMRegister nds, XMMRegister src1, XMM
emit_int8((unsigned char)(0xF0 & src2_enc<<4));
}
void Assembler::cmpps(XMMRegister dst, XMMRegister nds, XMMRegister src, int cop, int vector_len) {
assert(VM_Version::supports_avx(), "");
assert(!VM_Version::supports_evex(), "");
InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ false, /* uses_vl */ false);
int encode = simd_prefix_and_encode(dst, nds, src, VEX_SIMD_NONE, VEX_OPCODE_0F, &attributes);
emit_int8((unsigned char)0xC2);
emit_int8((unsigned char)(0xC0 | encode));
emit_int8((unsigned char)(0xF & cop));
}
void Assembler::blendvps(XMMRegister dst, XMMRegister nds, XMMRegister src1, XMMRegister src2, int vector_len) {
assert(VM_Version::supports_avx(), "");
assert(!VM_Version::supports_evex(), "");
InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ false, /* uses_vl */ false);
int encode = vex_prefix_and_encode(dst->encoding(), nds->encoding(), src1->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_3A, &attributes);
emit_int8((unsigned char)0x4A);
emit_int8((unsigned char)(0xC0 | encode));
int src2_enc = src2->encoding();
emit_int8((unsigned char)(0xF0 & src2_enc<<4));
}
void Assembler::vpblendd(XMMRegister dst, XMMRegister nds, XMMRegister src, int imm8, int vector_len) {
assert(VM_Version::supports_avx2(), "");
InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ false, /* uses_vl */ false);

View File

@ -2114,9 +2114,11 @@ private:
// runtime code and native libraries.
void vzeroupper();
// AVX support for vectorized conditional move (double). The following two instructions used only coupled.
// AVX support for vectorized conditional move (float/double). The following two instructions used only coupled.
void cmppd(XMMRegister dst, XMMRegister nds, XMMRegister src, int cop, int vector_len);
void blendvpd(XMMRegister dst, XMMRegister nds, XMMRegister src1, XMMRegister src2, int vector_len);
void cmpps(XMMRegister dst, XMMRegister nds, XMMRegister src, int cop, int vector_len);
void blendvps(XMMRegister dst, XMMRegister nds, XMMRegister src1, XMMRegister src2, int vector_len);
void vpblendd(XMMRegister dst, XMMRegister nds, XMMRegister src, int imm8, int vector_len);
protected:

View File

@ -1263,6 +1263,7 @@ const bool Matcher::match_rule_supported(int opcode) {
if (!VM_Version::supports_cx8())
ret_value = false;
break;
case Op_CMoveVF:
case Op_CMoveVD:
if (UseAVX < 1 || UseAVX > 2)
ret_value = false;
@ -1304,6 +1305,9 @@ const bool Matcher::match_rule_supported_vector(int opcode, int vlen) {
if ((vlen == 32) && (VM_Version::supports_avx512bw() == false))
ret_value = false;
break;
case Op_CMoveVF:
if (vlen != 8)
ret_value = false;
case Op_CMoveVD:
if (vlen != 4)
ret_value = false;
@ -8170,6 +8174,22 @@ instruct vmul8D_mem(vecZ dst, vecZ src, memory mem) %{
ins_pipe( pipe_slow );
%}
instruct vcmov8F_reg(vecY dst, vecY src1, vecY src2, immI8 cop, cmpOp_vcmppd copnd) %{
predicate(UseAVX > 0 && UseAVX < 3 && n->as_Vector()->length() == 8);
match(Set dst (CMoveVF (Binary copnd cop) (Binary src1 src2)));
effect(TEMP dst, USE src1, USE src2);
format %{ "cmpps.$copnd $dst, $src1, $src2 ! vcmovevf, cond=$cop\n\t"
"blendvps $dst,$src1,$src2,$dst ! vcmovevf\n\t"
%}
ins_encode %{
int vector_len = 1;
int cond = (Assembler::Condition)($copnd$$cmpcode);
__ cmpps($dst$$XMMRegister, $src1$$XMMRegister, $src2$$XMMRegister, cond, vector_len);
__ blendvps($dst$$XMMRegister, $src1$$XMMRegister, $src2$$XMMRegister, $dst$$XMMRegister, vector_len);
%}
ins_pipe( pipe_slow );
%}
instruct vcmov4D_reg(vecY dst, vecY src1, vecY src2, immI8 cop, cmpOp_vcmppd copnd) %{
predicate(UseAVX > 0 && UseAVX < 3 && n->as_Vector()->length() == 4);
match(Set dst (CMoveVD (Binary copnd cop) (Binary src1 src2)));

View File

@ -243,8 +243,9 @@ char* os::map_memory_to_file(char* base, size_t size, int fd) {
assert(fd != -1, "File descriptor is not valid");
// allocate space for the file
if (util_posix_fallocate(fd, 0, (off_t)size) != 0) {
vm_exit_during_initialization(err_msg("Error in mapping Java heap at the given filesystem directory."));
int ret = util_posix_fallocate(fd, 0, (off_t)size);
if (ret != 0) {
vm_exit_during_initialization(err_msg("Error in mapping Java heap at the given filesystem directory. error(%d)", ret));
return NULL;
}
@ -256,12 +257,13 @@ char* os::map_memory_to_file(char* base, size_t size, int fd) {
char* addr = (char*)mmap(base, size, prot, flags, fd, 0);
if (addr == MAP_FAILED) {
warning("Failed mmap to file. (%s)", os::strerror(errno));
return NULL;
}
if (base != NULL && addr != base) {
if (!os::release_memory(addr, size)) {
warning("Could not release memory on unsuccessful file mapping");
}
}
return NULL;
}
return addr;

View File

@ -4164,7 +4164,7 @@ bool MatchRule::is_vector() const {
"AddVB","AddVS","AddVI","AddVL","AddVF","AddVD",
"SubVB","SubVS","SubVI","SubVL","SubVF","SubVD",
"MulVS","MulVI","MulVL","MulVF","MulVD",
"CMoveVD",
"CMoveVD", "CMoveVF",
"DivVF","DivVD",
"AbsVF","AbsVD",
"NegVF","NegVD",

View File

@ -1439,6 +1439,9 @@ void GraphBuilder::call_register_finalizer() {
}
if (needs_check) {
// Not a trivial method because C2 can do better with inlined check.
compilation()->set_would_profile(true);
// Perform the registration of finalizable objects.
ValueStack* state_before = copy_state_for_exception();
load_local(objectType, 0);
@ -3556,6 +3559,9 @@ void GraphBuilder::build_graph_for_intrinsic(ciMethod* callee, bool ignore_retur
}
bool GraphBuilder::try_inline_intrinsics(ciMethod* callee, bool ignore_return) {
// Not a trivial method because C2 may do intrinsics better.
compilation()->set_would_profile(true);
// For calling is_intrinsic_available we need to transition to
// the '_thread_in_vm' state because is_intrinsic_available()
// accesses critical VM-internal data.

View File

@ -899,64 +899,18 @@ bool ciEnv::system_dictionary_modification_counter_changed() {
void ciEnv::validate_compile_task_dependencies(ciMethod* target) {
if (failing()) return; // no need for further checks
// First, check non-klass dependencies as we might return early and
// not check klass dependencies if the system dictionary
// modification counter hasn't changed (see below).
for (Dependencies::DepStream deps(dependencies()); deps.next(); ) {
if (deps.is_klass_type()) continue; // skip klass dependencies
Klass* witness = deps.check_dependency();
if (witness != NULL) {
if (deps.type() == Dependencies::call_site_target_value) {
_inc_decompile_count_on_failure = false;
record_failure("call site target change");
} else {
record_failure("invalid non-klass dependency");
}
return;
}
}
// Klass dependencies must be checked when the system dictionary
// changes. If logging is enabled all violated dependences will be
// recorded in the log. In debug mode check dependencies even if
// the system dictionary hasn't changed to verify that no invalid
// dependencies were inserted. Any violated dependences in this
// case are dumped to the tty.
bool counter_changed = system_dictionary_modification_counter_changed();
bool verify_deps = trueInDebug;
if (!counter_changed && !verify_deps) return;
int klass_violations = 0;
for (Dependencies::DepStream deps(dependencies()); deps.next(); ) {
if (!deps.is_klass_type()) continue; // skip non-klass dependencies
Klass* witness = deps.check_dependency();
if (witness != NULL) {
klass_violations++;
if (!counter_changed) {
// Dependence failed but counter didn't change. Log a message
// describing what failed and allow the assert at the end to
// trigger.
deps.print_dependency(witness);
} else if (xtty == NULL) {
// If we're not logging then a single violation is sufficient,
// otherwise we want to log all the dependences which were
// violated.
break;
}
Dependencies::DepType result = dependencies()->validate_dependencies(_task, counter_changed);
if (result != Dependencies::end_marker) {
if (result == Dependencies::call_site_target_value) {
_inc_decompile_count_on_failure = false;
record_failure("call site target change");
} else if (Dependencies::is_klass_type(result)) {
record_failure("invalid non-klass dependency");
} else {
record_failure("concurrent class loading");
}
}
if (klass_violations != 0) {
#ifdef ASSERT
if (!counter_changed && !PrintCompilation) {
// Print out the compile task that failed
_task->print_tty();
}
#endif
assert(counter_changed, "failed dependencies, but counter didn't change");
record_failure("concurrent class loading");
}
}
// ------------------------------------------------------------------

View File

@ -30,6 +30,8 @@
#include "classfile/javaClasses.inline.hpp"
#include "code/dependencies.hpp"
#include "compiler/compileLog.hpp"
#include "compiler/compileBroker.hpp"
#include "compiler/compileTask.hpp"
#include "memory/resourceArea.hpp"
#include "oops/oop.inline.hpp"
#include "oops/objArrayKlass.hpp"
@ -620,6 +622,72 @@ void Dependencies::check_valid_dependency_type(DepType dept) {
guarantee(FIRST_TYPE <= dept && dept < TYPE_LIMIT, "invalid dependency type: %d", (int) dept);
}
Dependencies::DepType Dependencies::validate_dependencies(CompileTask* task, bool counter_changed, char** failure_detail) {
// First, check non-klass dependencies as we might return early and
// not check klass dependencies if the system dictionary
// modification counter hasn't changed (see below).
for (Dependencies::DepStream deps(this); deps.next(); ) {
if (deps.is_klass_type()) continue; // skip klass dependencies
Klass* witness = deps.check_dependency();
if (witness != NULL) {
return deps.type();
}
}
// Klass dependencies must be checked when the system dictionary
// changes. If logging is enabled all violated dependences will be
// recorded in the log. In debug mode check dependencies even if
// the system dictionary hasn't changed to verify that no invalid
// dependencies were inserted. Any violated dependences in this
// case are dumped to the tty.
if (!counter_changed && !trueInDebug) {
return end_marker;
}
int klass_violations = 0;
DepType result = end_marker;
for (Dependencies::DepStream deps(this); deps.next(); ) {
if (!deps.is_klass_type()) continue; // skip non-klass dependencies
Klass* witness = deps.check_dependency();
if (witness != NULL) {
if (klass_violations == 0) {
result = deps.type();
if (failure_detail != NULL && klass_violations == 0) {
// Use a fixed size buffer to prevent the string stream from
// resizing in the context of an inner resource mark.
char* buffer = NEW_RESOURCE_ARRAY(char, O_BUFLEN);
stringStream st(buffer, O_BUFLEN);
deps.print_dependency(witness, true, &st);
*failure_detail = st.as_string();
}
}
klass_violations++;
if (!counter_changed) {
// Dependence failed but counter didn't change. Log a message
// describing what failed and allow the assert at the end to
// trigger.
deps.print_dependency(witness);
} else if (xtty == NULL) {
// If we're not logging then a single violation is sufficient,
// otherwise we want to log all the dependences which were
// violated.
break;
}
}
}
if (klass_violations != 0) {
#ifdef ASSERT
if (task != NULL && !counter_changed && !PrintCompilation) {
// Print out the compile task that failed
task->print_tty();
}
#endif
assert(counter_changed, "failed dependencies, but counter didn't change");
}
return result;
}
// for the sake of the compiler log, print out current dependencies:
void Dependencies::log_all_dependencies() {
if (log() == NULL) return;

View File

@ -457,6 +457,8 @@ class Dependencies: public ResourceObj {
void copy_to(nmethod* nm);
DepType validate_dependencies(CompileTask* task, bool counter_changed, char** failure_detail = NULL);
void log_all_dependencies();
void log_dependency(DepType dept, GrowableArray<ciBaseObject*>* args) {

View File

@ -98,9 +98,9 @@ void G1Arguments::initialize_flags() {
// Enable loop strip mining to offer better pause time guarantees
if (FLAG_IS_DEFAULT(UseCountedLoopSafepoints)) {
FLAG_SET_DEFAULT(UseCountedLoopSafepoints, true);
}
if (UseCountedLoopSafepoints && FLAG_IS_DEFAULT(LoopStripMiningIter)) {
FLAG_SET_DEFAULT(LoopStripMiningIter, 1000);
if (FLAG_IS_DEFAULT(LoopStripMiningIter)) {
FLAG_SET_DEFAULT(LoopStripMiningIter, 1000);
}
}
#endif
}

View File

@ -410,8 +410,8 @@ methodHandle JVMCIEnv::get_method_by_index(const constantPoolHandle& cpool,
// ------------------------------------------------------------------
// Check for changes to the system dictionary during compilation
// class loads, evolution, breakpoints
JVMCIEnv::CodeInstallResult JVMCIEnv::check_for_system_dictionary_modification(Dependencies* dependencies, Handle compiled_code,
JVMCIEnv* env, char** failure_detail) {
JVMCIEnv::CodeInstallResult JVMCIEnv::validate_compile_task_dependencies(Dependencies* dependencies, Handle compiled_code,
JVMCIEnv* env, char** failure_detail) {
// If JVMTI capabilities were enabled during compile, the compilation is invalidated.
if (env != NULL) {
if (!env->_jvmti_can_hotswap_or_post_breakpoint && JvmtiExport::can_hotswap_or_post_breakpoint()) {
@ -422,37 +422,20 @@ JVMCIEnv::CodeInstallResult JVMCIEnv::check_for_system_dictionary_modification(D
// Dependencies must be checked when the system dictionary changes
// or if we don't know whether it has changed (i.e., env == NULL).
// In debug mode, always check dependencies.
bool counter_changed = env != NULL && env->_system_dictionary_modification_counter != SystemDictionary::number_of_modifications();
bool verify_deps = env == NULL || trueInDebug || JavaAssertions::enabled(SystemDictionary::HotSpotInstalledCode_klass()->name()->as_C_string(), true);
if (!counter_changed && !verify_deps) {
bool counter_changed = env == NULL || env->_system_dictionary_modification_counter != SystemDictionary::number_of_modifications();
CompileTask* task = env == NULL ? NULL : env->task();
Dependencies::DepType result = dependencies->validate_dependencies(task, counter_changed, failure_detail);
if (result == Dependencies::end_marker) {
return JVMCIEnv::ok;
}
for (Dependencies::DepStream deps(dependencies); deps.next(); ) {
Klass* witness = deps.check_dependency();
if (witness != NULL) {
// Use a fixed size buffer to prevent the string stream from
// resizing in the context of an inner resource mark.
char* buffer = NEW_RESOURCE_ARRAY(char, O_BUFLEN);
stringStream st(buffer, O_BUFLEN);
deps.print_dependency(witness, true, &st);
*failure_detail = st.as_string();
if (env == NULL || counter_changed || deps.type() == Dependencies::evol_method) {
return JVMCIEnv::dependencies_failed;
} else {
// The dependencies were invalid at the time of installation
// without any intervening modification of the system
// dictionary. That means they were invalidly constructed.
return JVMCIEnv::dependencies_invalid;
}
}
if (LogCompilation) {
deps.log_dependency();
}
if (!Dependencies::is_klass_type(result) || counter_changed) {
return JVMCIEnv::dependencies_failed;
}
return JVMCIEnv::ok;
// The dependencies were invalid at the time of installation
// without any intervening modification of the system
// dictionary. That means they were invalidly constructed.
return JVMCIEnv::dependencies_invalid;
}
// ------------------------------------------------------------------
@ -492,8 +475,15 @@ JVMCIEnv::CodeInstallResult JVMCIEnv::register_method(
// Encode the dependencies now, so we can check them right away.
dependencies->encode_content_bytes();
// Record the dependencies for the current compile in the log
if (LogCompilation) {
for (Dependencies::DepStream deps(dependencies); deps.next(); ) {
deps.log_dependency();
}
}
// Check for {class loads, evolution, breakpoints} during compilation
result = check_for_system_dictionary_modification(dependencies, compiled_code, env, &failure_detail);
result = validate_compile_task_dependencies(dependencies, compiled_code, env, &failure_detail);
if (result != JVMCIEnv::ok) {
// While not a true deoptimization, it is a preemptive decompile.
MethodData* mdp = method()->method_data();

View File

@ -138,8 +138,8 @@ private:
// Helper routine for determining the validity of a compilation
// with respect to concurrent class loading.
static JVMCIEnv::CodeInstallResult check_for_system_dictionary_modification(Dependencies* target, Handle compiled_code,
JVMCIEnv* env, char** failure_detail);
static JVMCIEnv::CodeInstallResult validate_compile_task_dependencies(Dependencies* target, Handle compiled_code,
JVMCIEnv* env, char** failure_detail);
public:
CompileTask* task() { return _task; }

View File

@ -195,6 +195,9 @@
product(bool, UseSubwordForMaxVector, true, \
"Use Subword Analysis to set maximum vector size") \
\
product(bool, UseVectorCmov, false, \
"Use Vectorized Cmov") \
\
develop(intx, UnrollLimitForProfileCheck, 1, \
"Don't use profile_trip_cnt() to restrict unrolling until " \
"unrolling would push the number of unrolled iterations above " \

View File

@ -66,6 +66,7 @@ macro(ConstraintCast)
macro(CMoveD)
macro(CMoveVD)
macro(CMoveF)
macro(CMoveVF)
macro(CMoveI)
macro(CMoveL)
macro(CMoveP)

View File

@ -528,13 +528,12 @@ Node *PhaseIdealLoop::conditional_move( Node *region ) {
BasicType bt = phi->type()->basic_type();
switch (bt) {
case T_DOUBLE:
case T_FLOAT:
if (C->use_cmove()) {
continue; //TODO: maybe we want to add some cost
}
case T_FLOAT: {
cost += Matcher::float_cmove_cost(); // Could be very expensive
break;
}
case T_LONG: {
cost += Matcher::long_cmove_cost(); // May encodes as 2 CMOV's
}
@ -613,8 +612,9 @@ Node *PhaseIdealLoop::conditional_move( Node *region ) {
}
// Check for highly predictable branch. No point in CMOV'ing if
// we are going to predict accurately all the time.
if (C->use_cmove() && cmp_op == Op_CmpD) ;//keep going
else if (iff->_prob < infrequent_prob ||
if (C->use_cmove() && (cmp_op == Op_CmpF || cmp_op == Op_CmpD)) {
//keep going
} else if (iff->_prob < infrequent_prob ||
iff->_prob > (1.0f - infrequent_prob))
return NULL;

View File

@ -2267,6 +2267,7 @@ void Matcher::find_shared( Node *n ) {
case Op_CMoveL:
case Op_CMoveN:
case Op_CMoveP:
case Op_CMoveVF:
case Op_CMoveVD: {
// Restructure into a binary tree for Matching. It's possible that
// we could move this code up next to the graph reshaping for IfNodes

View File

@ -58,7 +58,7 @@ SuperWord::SuperWord(PhaseIdealLoop* phase) :
_mem_slice_tail(arena(), 8, 0, NULL), // memory slice tails
_node_info(arena(), 8, 0, SWNodeInfo::initial), // info needed per node
_clone_map(phase->C->clone_map()), // map of nodes created in cloning
_cmovev_kit(_arena, this), // map to facilitate CMoveVD creation
_cmovev_kit(_arena, this), // map to facilitate CMoveV creation
_align_to_ref(NULL), // memory reference to align vectors to
_disjoint_ptrs(arena(), 8, 0, OrderedPair::initial), // runtime disambiguated pointer pairs
_dg(_arena), // dependence graph
@ -511,8 +511,7 @@ void SuperWord::SLP_extract() {
combine_packs();
construct_my_pack_map();
if (_do_vector_loop) {
if (UseVectorCmov) {
merge_packs_to_cmovd();
}
@ -1249,8 +1248,8 @@ void SuperWord::set_alignment(Node* s1, Node* s2, int align) {
//------------------------------data_size---------------------------
int SuperWord::data_size(Node* s) {
Node* use = NULL; //test if the node is a candidate for CMoveVD optimization, then return the size of CMov
if (_do_vector_loop) {
Node* use = NULL; //test if the node is a candidate for CMoveV optimization, then return the size of CMov
if (UseVectorCmov) {
use = _cmovev_kit.is_Bool_candidate(s);
if (use != NULL) {
return data_size(use);
@ -1260,6 +1259,7 @@ int SuperWord::data_size(Node* s) {
return data_size(use);
}
}
int bsize = type2aelembytes(velt_basic_type(s));
assert(bsize != 0, "valid size");
return bsize;
@ -1718,6 +1718,9 @@ Node_List* CMoveKit::make_cmovevd_pack(Node_List* cmovd_pk) {
if (!cmovd->is_CMove()) {
return NULL;
}
if (cmovd->Opcode() != Op_CMoveF && cmovd->Opcode() != Op_CMoveD) {
return NULL;
}
if (pack(cmovd) != NULL) { // already in the cmov pack
return NULL;
}
@ -2377,7 +2380,13 @@ void SuperWord::output() {
}
BasicType bt = velt_basic_type(n);
const TypeVect* vt = TypeVect::make(bt, vlen);
vn = new CMoveVDNode(cc, src1, src2, vt);
assert(bt == T_FLOAT || bt == T_DOUBLE, "Only vectorization for FP cmovs is supported");
if (bt == T_FLOAT) {
vn = new CMoveVFNode(cc, src1, src2, vt);
} else {
assert(bt == T_DOUBLE, "Expected double");
vn = new CMoveVDNode(cc, src1, src2, vt);
}
NOT_PRODUCT(if(is_trace_cmov()) {tty->print("SWPointer::output: created new CMove node %d: ", vn->_idx); vn->dump();})
} else if (opc == Op_FmaD || opc == Op_FmaF) {
// Promote operands to vector

View File

@ -92,6 +92,9 @@ int VectorNode::opcode(int sopc, BasicType bt) {
case Op_FmaF:
assert(bt == T_FLOAT, "must be");
return Op_FmaVF;
case Op_CMoveF:
assert(bt == T_FLOAT, "must be");
return Op_CMoveVF;
case Op_CMoveD:
assert(bt == T_DOUBLE, "must be");
return Op_CMoveVD;

View File

@ -277,8 +277,16 @@ public:
virtual int Opcode() const;
};
//------------------------------CMoveVFNode--------------------------------------
// Vector float conditional move
class CMoveVFNode : public VectorNode {
public:
CMoveVFNode(Node* in1, Node* in2, Node* in3, const TypeVect* vt) : VectorNode(in1, in2, in3, vt) {}
virtual int Opcode() const;
};
//------------------------------CMoveVDNode--------------------------------------
// Vector multiply double
// Vector double conditional move
class CMoveVDNode : public VectorNode {
public:
CMoveVDNode(Node* in1, Node* in2, Node* in3, const TypeVect* vt) : VectorNode(in1, in2, in3, vt) {}

View File

@ -224,7 +224,13 @@ address NativeLookup::lookup_critical_style(const methodHandle& method, char* pu
st.print_raw(long_name);
if (os_style) os::print_jni_name_suffix_on(&st, args_size);
char* jni_name = st.as_string();
return (address)os::dll_lookup(dll, jni_name);
address critical_entry = (address)os::dll_lookup(dll, jni_name);
// Close the handle to avoid keeping the library alive if the native method holder is unloaded.
// This is fine because the library is still kept alive by JNI (see JVM_LoadLibrary). As soon
// as the holder class and the library are unloaded (see JVM_UnloadLibrary), the native wrapper
// that calls 'critical_entry' becomes unreachable and is unloaded as well.
os::dll_unload(dll);
return critical_entry;
}
}
@ -245,7 +251,6 @@ address NativeLookup::lookup_entry(const methodHandle& method, bool& in_base_lib
+ (method->is_static() ? 1 : 0) // class for static methods
+ method->size_of_parameters(); // actual parameters
// 1) Try JNI short style
entry = lookup_style(method, pure_name, "", args_size, true, in_base_library, CHECK_NULL);
if (entry != NULL) return entry;

View File

@ -674,6 +674,14 @@ static bool lookup_special_flag(const char *flag_name, size_t skip_index) {
return false;
}
// Verifies the correctness of the entries in the special_jvm_flags table.
// If there is a semantic error (i.e. a bug in the table) such as the obsoletion
// version being earlier than the deprecation version, then a warning is issued
// and verification fails - by returning false. If it is detected that the table
// is out of date, with respect to the current version, then a warning is issued
// but verification does not fail. This allows the VM to operate when the version
// is first updated, without needing to update all the impacted flags at the
// same time.
static bool verify_special_jvm_flags() {
bool success = true;
for (size_t i = 0; special_jvm_flags[i].name != NULL; i++) {
@ -710,7 +718,6 @@ static bool verify_special_jvm_flags() {
if (!version_less_than(JDK_Version::current(), flag.obsolete_in)) {
if (Flag::find_flag(flag.name) != NULL) {
warning("Global variable for obsolete special flag entry \"%s\" should be removed", flag.name);
success = false;
}
}
}
@ -720,7 +727,6 @@ static bool verify_special_jvm_flags() {
if (!version_less_than(JDK_Version::current(), flag.expired_in)) {
if (Flag::find_flag(flag.name) != NULL) {
warning("Global variable for expired flag entry \"%s\" should be removed", flag.name);
success = false;
}
}
}

View File

@ -357,7 +357,7 @@ void print_statistics() {
MemTracker::final_report(tty);
}
Threads::log_smr_statistics();
ThreadsSMRSupport::log_smr_statistics();
}
#else // PRODUCT MODE STATISTICS
@ -399,7 +399,7 @@ void print_statistics() {
Method::print_touched_methods(tty);
}
Threads::log_smr_statistics();
ThreadsSMRSupport::log_smr_statistics();
}
#endif

File diff suppressed because it is too large Load Diff

View File

@ -58,6 +58,7 @@
class ThreadSafepointState;
class ThreadsList;
class ThreadsSMRSupport;
class NestedThreadsList;
class JvmtiThreadState;
@ -103,7 +104,6 @@ class WorkerThread;
// - WatcherThread
class Thread: public ThreadShadow {
friend class Threads;
friend class VMStructs;
friend class JVMCIVMStructs;
private:
@ -121,12 +121,14 @@ class Thread: public ThreadShadow {
protected:
// Support for forcing alignment of thread objects for biased locking
void* _real_malloc_address;
// JavaThread lifecycle support:
friend class ScanHazardPtrGatherProtectedThreadsClosure;
friend class ScanHazardPtrGatherThreadsListClosure;
friend class ScanHazardPtrPrintMatchingThreadsClosure;
friend class ThreadsListHandle;
friend class ThreadsListSetter;
friend class ScanHazardPtrGatherProtectedThreadsClosure; // for cmpxchg_threads_hazard_ptr(), get_threads_hazard_ptr(), is_hazard_ptr_tagged() access
friend class ScanHazardPtrGatherThreadsListClosure; // for get_nested_threads_hazard_ptr(), get_threads_hazard_ptr(), untag_hazard_ptr() access
friend class ScanHazardPtrPrintMatchingThreadsClosure; // for get_threads_hazard_ptr(), is_hazard_ptr_tagged() access
friend class ThreadsListSetter; // for get_threads_hazard_ptr() access
friend class ThreadsSMRSupport; // for get_threads_hazard_ptr() access
ThreadsList* volatile _threads_hazard_ptr;
ThreadsList* cmpxchg_threads_hazard_ptr(ThreadsList* exchange_value, ThreadsList* compare_value);
ThreadsList* get_threads_hazard_ptr();
@ -2126,62 +2128,18 @@ inline CompilerThread* CompilerThread::current() {
class Threads: AllStatic {
friend class VMStructs;
private:
// Safe Memory Reclamation (SMR) support:
// The coordination between Threads::release_stable_list() and
// Threads::smr_delete() uses the smr_delete_lock in order to
// reduce the traffic on the Threads_lock.
static Monitor* _smr_delete_lock;
// The '_cnt', '_max' and '_times" fields are enabled via
// -XX:+EnableThreadSMRStatistics (see thread.cpp for a
// description about each field):
static uint _smr_delete_lock_wait_cnt;
static uint _smr_delete_lock_wait_max;
// The smr_delete_notify flag is used for proper double-check
// locking in order to reduce the traffic on the smr_delete_lock.
static volatile uint _smr_delete_notify;
static volatile uint _smr_deleted_thread_cnt;
static volatile uint _smr_deleted_thread_time_max;
static volatile uint _smr_deleted_thread_times;
static ThreadsList* volatile _smr_java_thread_list;
static uint64_t _smr_java_thread_list_alloc_cnt;
static uint64_t _smr_java_thread_list_free_cnt;
static uint _smr_java_thread_list_max;
static uint _smr_nested_thread_list_max;
static volatile uint _smr_tlh_cnt;
static volatile uint _smr_tlh_time_max;
static volatile uint _smr_tlh_times;
static ThreadsList* _smr_to_delete_list;
static uint _smr_to_delete_list_cnt;
static uint _smr_to_delete_list_max;
static JavaThread* _thread_list;
static int _number_of_threads;
static int _number_of_non_daemon_threads;
static int _return_code;
static int _thread_claim_parity;
static JavaThread* _thread_list;
static int _number_of_threads;
static int _number_of_non_daemon_threads;
static int _return_code;
static int _thread_claim_parity;
#ifdef ASSERT
static bool _vm_complete;
static bool _vm_complete;
#endif
static void initialize_java_lang_classes(JavaThread* main_thread, TRAPS);
static void initialize_jsr292_core_classes(TRAPS);
static ThreadsList *acquire_stable_list_fast_path(Thread *self);
static ThreadsList *acquire_stable_list_nested_path(Thread *self);
static void add_smr_deleted_thread_times(uint add_value);
static void clear_smr_delete_notify();
static ThreadsList* get_smr_java_thread_list();
static void inc_smr_deleted_thread_cnt();
static void release_stable_list_fast_path(Thread *self);
static void release_stable_list_nested_path(Thread *self);
static void release_stable_list_wake_up(char *log_str);
static void set_smr_delete_notify();
static Monitor* smr_delete_lock() { return _smr_delete_lock; }
static bool smr_delete_notify();
static void smr_free_list(ThreadsList* threads);
static void update_smr_deleted_thread_time_max(uint new_value);
static ThreadsList* xchg_smr_java_thread_list(ThreadsList* new_list);
public:
// Thread management
// force_daemon is a concession to JNI, where we may need to add a
@ -2191,19 +2149,6 @@ class Threads: AllStatic {
static void threads_do(ThreadClosure* tc);
static void possibly_parallel_threads_do(bool is_par, ThreadClosure* tc);
// SMR support:
static ThreadsList *acquire_stable_list(Thread *self, bool is_ThreadsListSetter);
static void release_stable_list(Thread *self);
static bool is_a_protected_JavaThread(JavaThread *thread);
static bool is_a_protected_JavaThread_with_lock(JavaThread *thread) {
MutexLockerEx ml(Threads_lock->owned_by_self() ? NULL : Threads_lock);
return is_a_protected_JavaThread(thread);
}
static void smr_delete(JavaThread *thread);
static void inc_smr_tlh_cnt();
static void update_smr_tlh_time_max(uint new_value);
static void add_smr_tlh_times(uint add_value);
// Initializes the vm and creates the vm thread
static jint create_vm(JavaVMInitArgs* args, bool* canTryAgain);
static void convert_vm_init_libraries_to_agents();
@ -2264,10 +2209,7 @@ class Threads: AllStatic {
// Verification
static void verify();
static void log_smr_statistics();
static void print_on(outputStream* st, bool print_stacks, bool internal_format, bool print_concurrent_locks);
static void print_smr_info_on(outputStream* st);
static void print_smr_info_elements_on(outputStream* st, ThreadsList* t_list);
static void print(bool print_stacks, bool internal_format) {
// this function is only used by debug.cpp
print_on(tty, print_stacks, internal_format, false /* no concurrent lock printed */);

View File

@ -28,7 +28,6 @@
#include "runtime/atomic.hpp"
#include "runtime/os.inline.hpp"
#include "runtime/thread.hpp"
#include "runtime/threadSMR.hpp"
inline void Thread::set_suspend_flag(SuspendFlags f) {
assert(sizeof(jint) == sizeof(_suspend_flags), "size mismatch");
@ -212,26 +211,4 @@ inline void JavaThread::set_terminated_value() {
OrderAccess::release_store((volatile jint *) &_terminated, (jint) _thread_terminated);
}
inline void Threads::add_smr_tlh_times(uint add_value) {
Atomic::add(add_value, &_smr_tlh_times);
}
inline void Threads::inc_smr_tlh_cnt() {
Atomic::inc(&_smr_tlh_cnt);
}
inline void Threads::update_smr_tlh_time_max(uint new_value) {
while (true) {
uint cur_value = _smr_tlh_time_max;
if (new_value <= cur_value) {
// No need to update max value so we're done.
break;
}
if (Atomic::cmpxchg(new_value, &_smr_tlh_time_max, cur_value) == cur_value) {
// Updated max value so we're done. Otherwise try it all again.
break;
}
}
}
#endif // SHARE_VM_RUNTIME_THREAD_INLINE_HPP

File diff suppressed because it is too large Load Diff

View File

@ -77,11 +77,77 @@
// longer protected by a ThreadsListHandle.
// SMR Support for the Threads class.
//
class ThreadsSMRSupport : AllStatic {
// The coordination between ThreadsSMRSupport::release_stable_list() and
// ThreadsSMRSupport::smr_delete() uses the smr_delete_lock in order to
// reduce the traffic on the Threads_lock.
static Monitor* _smr_delete_lock;
// The '_cnt', '_max' and '_times" fields are enabled via
// -XX:+EnableThreadSMRStatistics (see thread.cpp for a
// description about each field):
static uint _smr_delete_lock_wait_cnt;
static uint _smr_delete_lock_wait_max;
// The smr_delete_notify flag is used for proper double-check
// locking in order to reduce the traffic on the smr_delete_lock.
static volatile uint _smr_delete_notify;
static volatile uint _smr_deleted_thread_cnt;
static volatile uint _smr_deleted_thread_time_max;
static volatile uint _smr_deleted_thread_times;
static ThreadsList* volatile _smr_java_thread_list;
static uint64_t _smr_java_thread_list_alloc_cnt;
static uint64_t _smr_java_thread_list_free_cnt;
static uint _smr_java_thread_list_max;
static uint _smr_nested_thread_list_max;
static volatile uint _smr_tlh_cnt;
static volatile uint _smr_tlh_time_max;
static volatile uint _smr_tlh_times;
static ThreadsList* _smr_to_delete_list;
static uint _smr_to_delete_list_cnt;
static uint _smr_to_delete_list_max;
static ThreadsList *acquire_stable_list_fast_path(Thread *self);
static ThreadsList *acquire_stable_list_nested_path(Thread *self);
static void add_smr_deleted_thread_times(uint add_value);
static void add_smr_tlh_times(uint add_value);
static void clear_smr_delete_notify();
static void inc_smr_deleted_thread_cnt();
static void inc_smr_java_thread_list_alloc_cnt();
static void inc_smr_tlh_cnt();
static bool is_a_protected_JavaThread(JavaThread *thread);
static void release_stable_list_fast_path(Thread *self);
static void release_stable_list_nested_path(Thread *self);
static void release_stable_list_wake_up(char *log_str);
static void set_smr_delete_notify();
static Monitor* smr_delete_lock() { return _smr_delete_lock; }
static bool smr_delete_notify();
static void smr_free_list(ThreadsList* threads);
static void update_smr_deleted_thread_time_max(uint new_value);
static void update_smr_java_thread_list_max(uint new_value);
static void update_smr_tlh_time_max(uint new_value);
static ThreadsList* xchg_smr_java_thread_list(ThreadsList* new_list);
public:
static ThreadsList *acquire_stable_list(Thread *self, bool is_ThreadsListSetter);
static void add_thread(JavaThread *thread);
static ThreadsList* get_smr_java_thread_list();
static bool is_a_protected_JavaThread_with_lock(JavaThread *thread);
static void release_stable_list(Thread *self);
static void remove_thread(JavaThread *thread);
static void smr_delete(JavaThread *thread);
static void update_smr_tlh_stats(uint millis);
// Logging and printing support:
static void log_smr_statistics();
static void print_smr_info_elements_on(outputStream* st, ThreadsList* t_list);
static void print_smr_info_on(outputStream* st);
};
// A fast list of JavaThreads.
//
class ThreadsList : public CHeapObj<mtThread> {
friend class ScanHazardPtrGatherProtectedThreadsClosure;
friend class Threads;
friend class ThreadsSMRSupport; // for next_list(), set_next_list() access
const uint _length;
ThreadsList* _next_list;
@ -93,6 +159,9 @@ class ThreadsList : public CHeapObj<mtThread> {
ThreadsList *next_list() const { return _next_list; }
void set_next_list(ThreadsList *list) { _next_list = list; }
static ThreadsList* add_thread(ThreadsList* list, JavaThread* java_thread);
static ThreadsList* remove_thread(ThreadsList* list, JavaThread* java_thread);
public:
ThreadsList(int entries);
~ThreadsList();
@ -110,9 +179,6 @@ public:
int find_index_of_JavaThread(JavaThread* target);
JavaThread* find_JavaThread_from_java_tid(jlong java_tid) const;
bool includes(const JavaThread * const p) const;
static ThreadsList* add_thread(ThreadsList* list, JavaThread* java_thread);
static ThreadsList* remove_thread(ThreadsList* list, JavaThread* java_thread);
};
// Linked list of ThreadsLists to support nested ThreadsListHandles.

View File

@ -52,6 +52,32 @@ inline void ThreadsList::threads_do(T *cl) const {
}
}
// These three inlines are private to ThreadsSMRSupport, but
// they are called by public inline update_smr_tlh_stats() below:
inline void ThreadsSMRSupport::add_smr_tlh_times(uint add_value) {
Atomic::add(add_value, &_smr_tlh_times);
}
inline void ThreadsSMRSupport::inc_smr_tlh_cnt() {
Atomic::inc(&_smr_tlh_cnt);
}
inline void ThreadsSMRSupport::update_smr_tlh_time_max(uint new_value) {
while (true) {
uint cur_value = _smr_tlh_time_max;
if (new_value <= cur_value) {
// No need to update max value so we're done.
break;
}
if (Atomic::cmpxchg(new_value, &_smr_tlh_time_max, cur_value) == cur_value) {
// Updated max value so we're done. Otherwise try it all again.
break;
}
}
}
inline ThreadsList* ThreadsListSetter::list() {
ThreadsList *ret = _target->get_threads_hazard_ptr();
assert(ret != NULL, "hazard ptr should be set");
@ -59,4 +85,19 @@ inline ThreadsList* ThreadsListSetter::list() {
return ret;
}
inline ThreadsList* ThreadsSMRSupport::get_smr_java_thread_list() {
return (ThreadsList*)OrderAccess::load_acquire(&_smr_java_thread_list);
}
inline bool ThreadsSMRSupport::is_a_protected_JavaThread_with_lock(JavaThread *thread) {
MutexLockerEx ml(Threads_lock->owned_by_self() ? NULL : Threads_lock);
return is_a_protected_JavaThread(thread);
}
inline void ThreadsSMRSupport::update_smr_tlh_stats(uint millis) {
ThreadsSMRSupport::inc_smr_tlh_cnt();
ThreadsSMRSupport::add_smr_tlh_times(millis);
ThreadsSMRSupport::update_smr_tlh_time_max(millis);
}
#endif // SHARE_VM_RUNTIME_THREADSMR_INLINE_HPP

View File

@ -1991,6 +1991,7 @@ typedef PaddedEnd<ObjectMonitor> PaddedObjectMonitor;
declare_c2_type(MulVDNode, VectorNode) \
declare_c2_type(FmaVDNode, VectorNode) \
declare_c2_type(FmaVFNode, VectorNode) \
declare_c2_type(CMoveVFNode, VectorNode) \
declare_c2_type(CMoveVDNode, VectorNode) \
declare_c2_type(MulReductionVDNode, ReductionNode) \
declare_c2_type(DivVFNode, VectorNode) \

View File

@ -29,6 +29,7 @@
#include "memory/allocation.hpp"
#include "oops/oop.hpp"
#include "runtime/thread.hpp"
#include "runtime/threadSMR.hpp"
#include "code/codeCache.hpp"
// The following classes are used for operations

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -48,14 +48,14 @@ unsigned int Abstract_VM_Version::_L1_data_cache_line_size = 0;
#error HOTSPOT_VERSION_STRING must be defined
#endif
#ifndef VERSION_MAJOR
#error VERSION_MAJOR must be defined
#ifndef VERSION_FEATURE
#error VERSION_FEATURE must be defined
#endif
#ifndef VERSION_MINOR
#error VERSION_MINOR must be defined
#ifndef VERSION_INTERIM
#error VERSION_INTERIM must be defined
#endif
#ifndef VERSION_SECURITY
#error VERSION_SECURITY must be defined
#ifndef VERSION_UPDATE
#error VERSION_UPDATE must be defined
#endif
#ifndef VERSION_PATCH
#error VERSION_PATCH must be defined
@ -76,9 +76,9 @@ unsigned int Abstract_VM_Version::_L1_data_cache_line_size = 0;
// HOTSPOT_VERSION_STRING equals the JDK VERSION_STRING (unless overridden
// in a standalone build).
int Abstract_VM_Version::_vm_major_version = VERSION_MAJOR;
int Abstract_VM_Version::_vm_minor_version = VERSION_MINOR;
int Abstract_VM_Version::_vm_security_version = VERSION_SECURITY;
int Abstract_VM_Version::_vm_major_version = VERSION_FEATURE;
int Abstract_VM_Version::_vm_minor_version = VERSION_INTERIM;
int Abstract_VM_Version::_vm_security_version = VERSION_UPDATE;
int Abstract_VM_Version::_vm_patch_version = VERSION_PATCH;
int Abstract_VM_Version::_vm_build_number = VERSION_BUILD;
unsigned int Abstract_VM_Version::_parallel_worker_threads = 0;

View File

@ -33,6 +33,7 @@
#include "runtime/objectMonitor.inline.hpp"
#include "runtime/perfData.hpp"
#include "runtime/thread.hpp"
#include "runtime/threadSMR.hpp"
#include "services/management.hpp"
#include "services/serviceUtil.hpp"

View File

@ -899,81 +899,68 @@ public class Runtime {
*
* <h2><a id="verNum">Version numbers</a></h2>
*
* <p> A <em>version number</em>, {@code $VNUM}, is a non-empty sequence
* of elements separated by period characters (U+002E). An element is
* either zero, or an unsigned integer numeral without leading zeros. The
* final element in a version number must not be zero. The format is:
* </p>
* <p> A <em>version number</em>, {@code $VNUM}, is a non-empty sequence of
* elements separated by period characters (U+002E). An element is either
* zero, or an unsigned integer numeral without leading zeros. The final
* element in a version number must not be zero. When an element is
* incremented, all subsequent elements are removed. The format is: </p>
*
* <blockquote><pre>
* [1-9][0-9]*((\.0)*\.[1-9][0-9]*)*
* [1-9][0-9]*((\.0)*\.[1-9][0-9]*)*
* </pre></blockquote>
*
* <p> The sequence may be of arbitrary length but the first three
* elements are assigned specific meanings, as follows:</p>
* <p> The sequence may be of arbitrary length but the first four elements
* are assigned specific meanings, as follows:</p>
*
* <blockquote><pre>
* $MAJOR.$MINOR.$SECURITY
* $FEATURE.$INTERIM.$UPDATE.$PATCH
* </pre></blockquote>
*
* <ul>
*
* <li><p> <a id="major">{@code $MAJOR}</a> --- The major version
* number, incremented for a major release that contains significant new
* features as specified in a new edition of the Java&#160;SE Platform
* Specification, <em>e.g.</em>, <a
* href="https://jcp.org/en/jsr/detail?id=337">JSR 337</a> for
* Java&#160;SE&#160;8. Features may be removed in a major release, given
* advance notice at least one major release ahead of time, and
* incompatible changes may be made when justified. The {@code $MAJOR}
* version number of JDK&#160;8 is {@code 8}; the {@code $MAJOR} version
* number of JDK&#160;9 is {@code 9}. When {@code $MAJOR} is incremented,
* all subsequent elements are removed. </p></li>
* <li><p> <a id="FEATURE">{@code $FEATURE}</a> &#x2014; The
* feature-release counter, incremented for every feature release
* regardless of release content. Features may be added in a feature
* release; they may also be removed, if advance notice was given at least
* one feature release ahead of time. Incompatible changes may be made
* when justified. </p></li>
*
* <li><p> <a id="minor">{@code $MINOR}</a> --- The minor version
* number, incremented for a minor update release that may contain
* compatible bug fixes, revisions to standard APIs mandated by a
* <a href="https://jcp.org/en/procedures/jcp2#5.3">Maintenance Release</a>
* of the relevant Platform Specification, and implementation features
* outside the scope of that Specification such as new JDK-specific APIs,
* additional service providers, new garbage collectors, and ports to new
* hardware architectures. </p></li>
* <li><p> <a id="INTERIM">{@code $INTERIM}</a> &#x2014; The
* interim-release counter, incremented for non-feature releases that
* contain compatible bug fixes and enhancements but no incompatible
* changes, no feature removals, and no changes to standard APIs.
* </p></li>
*
* <li><p> <a id="security">{@code $SECURITY}</a> --- The security
* level, incremented for a security update release that contains critical
* fixes including those necessary to improve security. {@code $SECURITY}
* is <strong>not</strong> reset when {@code $MINOR} is incremented. A
* higher value of {@code $SECURITY} for a given {@code $MAJOR} value,
* therefore, always indicates a more secure release, regardless of the
* value of {@code $MINOR}. </p></li>
* <li><p> <a id="UPDATE">{@code $UPDATE}</a> &#x2014; The update-release
* counter, incremented for compatible update releases that fix security
* issues, regressions, and bugs in newer features. </p></li>
*
* <li><p> <a id="PATCH">{@code $PATCH}</a> &#x2014; The emergency
* patch-release counter, incremented only when it's necessary to produce
* an emergency release to fix a critical issue. </p></li>
*
* </ul>
*
* <p> The fourth and later elements of a version number are free for use
* by downstream consumers of this code base. Such a consumer may,
* <em>e.g.</em>, use the fourth element to identify patch releases which
* contain a small number of critical non-security fixes in addition to
* the security fixes in the corresponding security release. </p>
* <p> The fifth and later elements of a version number are free for use by
* platform implementors, to identify implementor-specific patch
* releases. </p>
*
* <p> The version number does not include trailing zero elements;
* <em>i.e.</em>, {@code $SECURITY} is omitted if it has the value zero,
* and {@code $MINOR} is omitted if both {@code $MINOR} and {@code
* $SECURITY} have the value zero. </p>
* <p> A version number never has trailing zero elements. If an element
* and all those that follow it logically have the value zero then all of
* them are omitted. </p>
*
* <p> The sequence of numerals in a version number is compared to another
* such sequence in numerical, pointwise fashion; <em>e.g.</em>, {@code
* 9.9.1} is less than {@code 9.10.3}. If one sequence is shorter than
* another then the missing elements of the shorter sequence are
* considered to be less than the corresponding elements of the longer
* sequence; <em>e.g.</em>, {@code 9.1.2} is less than {@code 9.1.2.1}.
* </p>
* 10.0.4} is less than {@code 10.1.2}. If one sequence is shorter than
* another then the missing elements of the shorter sequence are considered
* to be less than the corresponding elements of the longer sequence;
* <em>e.g.</em>, {@code 10.0.2} is less than {@code 10.0.2.1}. </p>
*
* <h2><a id="verStr">Version strings</a></h2>
*
* <p> A <em>version string</em>, {@code $VSTR}, consists of a version
* number {@code $VNUM}, as described above, optionally followed by
* pre-release and build information, in one of the following formats:
* </p>
* <p> A <em>version string</em>, {@code $VSTR}, is a version number {@code
* $VNUM}, as described above, optionally followed by pre-release and build
* information, in one of the following formats: </p>
*
* <blockquote><pre>
* $VNUM(-$PRE)?\+$BUILD(-$OPT)?
@ -986,19 +973,19 @@ public class Runtime {
* <ul>
*
* <li><p> <a id="pre">{@code $PRE}</a>, matching {@code ([a-zA-Z0-9]+)}
* --- A pre-release identifier. Typically {@code ea}, for a
* potentially unstable early-access release under active development,
* or {@code internal}, for an internal developer build. </p></li>
* &#x2014; A pre-release identifier. Typically {@code ea}, for a
* potentially unstable early-access release under active development, or
* {@code internal}, for an internal developer build. </p></li>
*
* <li><p> <a id="build">{@code $BUILD}</a>, matching {@code
* (0|[1-9][0-9]*)} --- The build number, incremented for each promoted
* (0|[1-9][0-9]*)} &#x2014; The build number, incremented for each promoted
* build. {@code $BUILD} is reset to {@code 1} when any portion of {@code
* $VNUM} is incremented. </p></li>
*
* <li><p> <a id="opt">{@code $OPT}</a>, matching {@code
* ([-a-zA-Z0-9.]+)} --- Additional build information, if desired. In
* the case of an {@code internal} build this will often contain the date
* and time of the build. </p></li>
* <li><p> <a id="opt">{@code $OPT}</a>, matching {@code ([-a-zA-Z0-9.]+)}
* &#x2014; Additional build information, if desired. In the case of an
* {@code internal} build this will often contain the date and time of the
* build. </p></li>
*
* </ul>
*
@ -1082,7 +1069,7 @@ public class Runtime {
throw new NullPointerException();
// Shortcut to avoid initializing VersionPattern when creating
// major version constants during startup
// feature-version constants during startup
if (isSimpleNumber(s)) {
return new Version(List.of(Integer.parseInt(s)),
Optional.empty(), Optional.empty(), Optional.empty());
@ -1139,43 +1126,114 @@ public class Runtime {
}
/**
* Returns the <a href="#major">major</a> version number.
* Returns the value of the <a href="#FEATURE">feature</a> element of
* the version number.
*
* @return The major version number
* @return The value of the feature element
*
* @since 10
*/
public int major() {
public int feature() {
return version.get(0);
}
/**
* Returns the <a href="#minor">minor</a> version number or zero if it
* was not set.
* Returns the value of the <a href="#INTERIM">interim</a> element of
* the version number, or zero if it is absent.
*
* @return The minor version number or zero if it was not set
* @return The value of the interim element, or zero
*
* @since 10
*/
public int minor() {
public int interim() {
return (version.size() > 1 ? version.get(1) : 0);
}
/**
* Returns the <a href="#security">security</a> version number or zero
* if it was not set.
* Returns the value of the <a href="#UPDATE">update</a> element of the
* version number, or zero if it is absent.
*
* @return The security version number or zero if it was not set
* @return The value of the update element, or zero
*
* @since 10
*/
public int security() {
public int update() {
return (version.size() > 2 ? version.get(2) : 0);
}
/**
* Returns an unmodifiable {@link java.util.List List} of the
* integer numerals contained in the <a href="#verNum">version
* number</a>. The {@code List} always contains at least one
* element corresponding to the <a href="#major">major version
* number</a>.
* Returns the value of the <a href="#PATCH">patch</a> element of the
* version number, or zero if it is absent.
*
* @return An unmodifiable list of the integer numerals
* contained in the version number
* @return The value of the patch element, or zero
*
* @since 10
*/
public int patch() {
return (version.size() > 3 ? version.get(3) : 0);
}
/**
* Returns the value of the major element of the version number.
*
* @deprecated As of Java&nbsp;SE 10, the first element of a version
* number is not the major-release number but the feature-release
* counter, incremented for every time-based release. Use the {@link
* #feature()} method in preference to this method. For compatibility,
* this method returns the value of the <a href="FEATURE">feature</a>
* element.
*
* @return The value of the feature element
*/
@Deprecated(since = "10")
public int major() {
return feature();
}
/**
* Returns the value of the minor element of the version number, or
* zero if it is absent.
*
* @deprecated As of Java&nbsp;SE 10, the second element of a version
* number is not the minor-release number but the interim-release
* counter, incremented for every interim release. Use the {@link
* #interim()} method in preference to this method. For compatibility,
* this method returns the value of the <a href="INTERIM">interim</a>
* element, or zero if it is absent.
*
* @return The value of the interim element, or zero
*/
@Deprecated(since = "10")
public int minor() {
return interim();
}
/**
* Returns the value of the security element of the version number, or
* zero if it is absent.
*
* @deprecated As of Java&nbsp;SE 10, the third element of a version
* number is not the security level but the update-release counter,
* incremented for every update release. Use the {@link #update()}
* method in preference to this method. For compatibility, this method
* returns the value of the <a href="UPDATE">update</a> element, or
* zero if it is absent.
*
* @return The value of the update element, or zero
*/
@Deprecated(since = "10")
public int security() {
return update();
}
/**
* Returns an unmodifiable {@link java.util.List List} of the integers
* represented in the <a href="#verNum">version number</a>. The {@code
* List} always contains at least one element corresponding to the <a
* href="#feature">feature version number</a>.
*
* @return An unmodifiable list of the integers
* represented in the version number
*/
public List<Integer> version() {
return version;

View File

@ -550,8 +550,10 @@ public final class System {
* System properties. The following properties are guaranteed to be defined:
* <dl>
* <dt>java.version <dd>Java version number
* <dt>java.version.date <dd>Java version date
* <dt>java.vendor <dd>Java vendor specific string
* <dt>java.vendor.url <dd>Java vendor URL
* <dt>java.vendor.version <dd>Java vendor version
* <dt>java.home <dd>Java installation directory
* <dt>java.class.version <dd>Java class version number
* <dt>java.class.path <dd>Java classpath
@ -591,12 +593,18 @@ public final class System {
* </thead>
* <tbody>
* <tr><th scope="row"><code>java.version</code></th>
* <td>Java Runtime Environment version which may be interpreted
* <td>Java Runtime Environment version, which may be interpreted
* as a {@link Runtime.Version}</td></tr>
* <tr><th scope="row"><code>java.version.date</code></th>
* <td>Java Runtime Environment version date, in ISO-8601 YYYY-MM-DD
* format, which may be interpreted as a {@link
* java.time.LocalDate}</td></tr>
* <tr><th scope="row"><code>java.vendor</code></th>
* <td>Java Runtime Environment vendor</td></tr>
* <tr><th scope="row"><code>java.vendor.url</code></th>
* <td>Java vendor URL</td></tr>
* <tr><th scope="row"><code>java.vendor.version</code></th>
* <td>Java vendor version</td></tr>
* <tr><th scope="row"><code>java.home</code></th>
* <td>Java installation directory</td></tr>
* <tr><th scope="row"><code>java.vm.specification.version</code></th>

View File

@ -32,13 +32,15 @@ import java.util.Optional;
class VersionProps {
private static final String launcher_name =
"@@LAUNCHER_NAME@@";
private static final String java_version =
"@@VERSION_SHORT@@";
private static final String java_version_date =
"@@VERSION_DATE@@";
private static final String java_runtime_name =
"@@RUNTIME_NAME@@";
@ -57,14 +59,27 @@ class VersionProps {
private static final String VERSION_OPT =
"@@VERSION_OPT@@";
private static final boolean isLTS =
"@@VERSION_OPT@@".startsWith("LTS");
private static final String VENDOR_VERSION_STRING =
"@@VENDOR_VERSION_STRING@@";
private static final String vendor_version =
(VENDOR_VERSION_STRING.length() > 0
? " " + VENDOR_VERSION_STRING : "");
static {
init();
}
public static void init() {
System.setProperty("java.version", java_version);
System.setProperty("java.version.date", java_version_date);
System.setProperty("java.runtime.version", java_runtime_version);
System.setProperty("java.runtime.name", java_runtime_name);
if (VENDOR_VERSION_STRING.length() > 0)
System.setProperty("java.vendor.version", VENDOR_VERSION_STRING);
}
private static int parseVersionNumber(String version, int prevIndex, int index) {
@ -162,31 +177,36 @@ class VersionProps {
/* First line: platform version. */
if (err) {
ps.println(launcher_name + " version \"" + java_version + "\"");
ps.println(launcher_name + " version \"" + java_version + "\""
+ " " + java_version_date
+ (isLTS ? " LTS" : ""));
} else {
/* Use a format more in line with GNU conventions */
ps.println(launcher_name + " " + java_version);
ps.println(launcher_name + " " + java_version
+ " " + java_version_date
+ (isLTS ? " LTS" : ""));
}
/* Second line: runtime version (ie, libraries). */
String jdk_debug_level = System.getProperty("jdk.debug", "release");
/* Debug level is not printed for "release" builds */
if ("release".equals(jdk_debug_level)) {
/* Do not show debug level "release" builds */
jdk_debug_level = "";
} else {
jdk_debug_level = jdk_debug_level + " ";
}
ps.print(java_runtime_name + " (" + jdk_debug_level + "build " + java_runtime_version);
ps.println(')');
ps.println(java_runtime_name + vendor_version
+ " (" + jdk_debug_level + "build " + java_runtime_version + ")");
/* Third line: JVM information. */
String java_vm_name = System.getProperty("java.vm.name");
String java_vm_version = System.getProperty("java.vm.version");
String java_vm_info = System.getProperty("java.vm.info");
ps.println(java_vm_name + " (" + jdk_debug_level + "build " + java_vm_version + ", " +
java_vm_info + ")");
ps.println(java_vm_name + vendor_version
+ " (" + jdk_debug_level + "build " + java_vm_version + ", "
+ java_vm_info + ")");
}
}

View File

@ -32,8 +32,9 @@ import java.util.stream.Stream;
/**
* A container object which may or may not contain a non-{@code null} value.
* If a value is present, {@code isPresent()} returns {@code true} and
* {@code get()} returns the value.
* If a value is present, {@code isPresent()} returns {@code true}. If no
* value is present, the object is considered <i>empty</i> and
* {@code isPresent()} returns {@code false}.
*
* <p>Additional methods that depend on the presence or absence of a contained
* value are provided, such as {@link #orElse(Object) orElse()}
@ -137,14 +138,10 @@ public final class Optional<T> {
* {@code NoSuchElementException}.
*
* @apiNote
* The methods {@link #orElse(Object) orElse} and
* {@link #orElseGet(Supplier) orElseGet}
* are generally preferable to this method, as they return a substitute
* value if the value is absent, instead of throwing an exception.
* The preferred alternative to this method is {@link #orElseThrow()}.
*
* @return the non-{@code null} value described by this {@code Optional}
* @throws NoSuchElementException if no value is present
* @see Optional#isPresent()
*/
public T get() {
if (value == null) {
@ -361,6 +358,21 @@ public final class Optional<T> {
return value != null ? value : supplier.get();
}
/**
* If a value is present, returns the value, otherwise throws
* {@code NoSuchElementException}.
*
* @return the non-{@code null} value described by this {@code Optional}
* @throws NoSuchElementException if no value is present
* @since 10
*/
public T orElseThrow() {
if (value == null) {
throw new NoSuchElementException("No value present");
}
return value;
}
/**
* If a value is present, returns the value, otherwise throws an exception
* produced by the exception supplying function.

View File

@ -30,9 +30,10 @@ import java.util.function.Supplier;
import java.util.stream.DoubleStream;
/**
* A container object which may or may not contain a {@code double} value. If a
* value is present, {@code isPresent()} returns {@code true} and
* {@code getAsDouble()} returns the value.
* A container object which may or may not contain a {@code double} value.
* If a value is present, {@code isPresent()} returns {@code true}. If no
* value is present, the object is considered <i>empty</i> and
* {@code isPresent()} returns {@code false}.
*
* <p>Additional methods that depend on the presence or absence of a contained
* value are provided, such as {@link #orElse(double) orElse()}
@ -117,14 +118,10 @@ public final class OptionalDouble {
* {@code NoSuchElementException}.
*
* @apiNote
* The methods {@link #orElse(double) orElse} and
* {@link #orElseGet(DoubleSupplier) orElseGet}
* are generally preferable to this method, as they return a substitute
* value if the value is absent, instead of throwing an exception.
* The preferred alternative to this method is {@link #orElseThrow()}.
*
* @return the value described by this {@code OptionalDouble}
* @throws NoSuchElementException if no value is present
* @see OptionalDouble#isPresent()
*/
public double getAsDouble() {
if (!isPresent) {
@ -225,6 +222,21 @@ public final class OptionalDouble {
return isPresent ? value : supplier.getAsDouble();
}
/**
* If a value is present, returns the value, otherwise throws
* {@code NoSuchElementException}.
*
* @return the value described by this {@code OptionalDouble}
* @throws NoSuchElementException if no value is present
* @since 10
*/
public double orElseThrow() {
if (!isPresent) {
throw new NoSuchElementException("No value present");
}
return value;
}
/**
* If a value is present, returns the value, otherwise throws an exception
* produced by the exception supplying function.

View File

@ -30,9 +30,10 @@ import java.util.function.Supplier;
import java.util.stream.IntStream;
/**
* A container object which may or may not contain an {@code int} value. If a
* value is present, {@code isPresent()} returns {@code true} and
* {@code getAsInt()} returns the value.
* A container object which may or may not contain an {@code int} value.
* If a value is present, {@code isPresent()} returns {@code true}. If no
* value is present, the object is considered <i>empty</i> and
* {@code isPresent()} returns {@code false}.
*
* <p>Additional methods that depend on the presence or absence of a contained
* value are provided, such as {@link #orElse(int) orElse()}
@ -117,14 +118,10 @@ public final class OptionalInt {
* {@code NoSuchElementException}.
*
* @apiNote
* The methods {@link #orElse(int) orElse} and
* {@link #orElseGet(IntSupplier) orElseGet}
* are generally preferable to this method, as they return a substitute
* value if the value is absent, instead of throwing an exception.
* The preferred alternative to this method is {@link #orElseThrow()}.
*
* @return the value described by this {@code OptionalInt}
* @throws NoSuchElementException if no value is present
* @see OptionalInt#isPresent()
*/
public int getAsInt() {
if (!isPresent) {
@ -224,6 +221,21 @@ public final class OptionalInt {
return isPresent ? value : supplier.getAsInt();
}
/**
* If a value is present, returns the value, otherwise throws
* {@code NoSuchElementException}.
*
* @return the value described by this {@code OptionalInt}
* @throws NoSuchElementException if no value is present
* @since 10
*/
public int orElseThrow() {
if (!isPresent) {
throw new NoSuchElementException("No value present");
}
return value;
}
/**
* If a value is present, returns the value, otherwise throws an exception
* produced by the exception supplying function.

View File

@ -30,9 +30,10 @@ import java.util.function.Supplier;
import java.util.stream.LongStream;
/**
* A container object which may or may not contain a {@code long} value. If a
* value is present, {@code isPresent()} returns {@code true} and
* {@code getAsLong()} returns the value.
* A container object which may or may not contain a {@code long} value.
* If a value is present, {@code isPresent()} returns {@code true}. If no
* value is present, the object is considered <i>empty</i> and
* {@code isPresent()} returns {@code false}.
*
* <p>Additional methods that depend on the presence or absence of a contained
* value are provided, such as {@link #orElse(long) orElse()}
@ -117,14 +118,10 @@ public final class OptionalLong {
* {@code NoSuchElementException}.
*
* @apiNote
* The methods {@link #orElse(long) orElse} and
* {@link #orElseGet(LongSupplier) orElseGet}
* are generally preferable to this method, as they return a substitute
* value if the value is absent, instead of throwing an exception.
* The preferred alternative to this method is {@link #orElseThrow()}.
*
* @return the value described by this {@code OptionalLong}
* @throws NoSuchElementException if no value is present
* @see OptionalLong#isPresent()
*/
public long getAsLong() {
if (!isPresent) {
@ -224,6 +221,21 @@ public final class OptionalLong {
return isPresent ? value : supplier.getAsLong();
}
/**
* If a value is present, returns the value, otherwise throws
* {@code NoSuchElementException}.
*
* @return the value described by this {@code OptionalLong}
* @throws NoSuchElementException if no value is present
* @since 10
*/
public long orElseThrow() {
if (!isPresent) {
throw new NoSuchElementException("No value present");
}
return value;
}
/**
* If a value is present, returns the value, otherwise throws an exception
* produced by the exception supplying function.

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -112,9 +112,9 @@ import java.util.zip.ZipFile;
* <li>
* {@code jdk.util.jar.version} can be assigned a value that is the
* {@code String} representation of a non-negative integer
* {@code <= Runtime.version().major()}. The value is used to set the effective
* {@code <= Runtime.version().feature()}. The value is used to set the effective
* runtime version to something other than the default value obtained by
* evaluating {@code Runtime.version().major()}. The effective runtime version
* evaluating {@code Runtime.version().feature()}. The effective runtime version
* is the version that the {@link JarFile#JarFile(File, boolean, int, Runtime.Version)}
* constructor uses when the value of the last argument is
* {@code JarFile.runtimeVersion()}.
@ -143,7 +143,7 @@ import java.util.zip.ZipFile;
public
class JarFile extends ZipFile {
private final static Runtime.Version BASE_VERSION;
private final static int BASE_VERSION_MAJOR;
private final static int BASE_VERSION_FEATURE;
private final static Runtime.Version RUNTIME_VERSION;
private final static boolean MULTI_RELEASE_ENABLED;
private final static boolean MULTI_RELEASE_FORCED;
@ -153,7 +153,7 @@ class JarFile extends ZipFile {
private boolean jvInitialized;
private boolean verify;
private final Runtime.Version version; // current version
private final int versionMajor; // version.major()
private final int versionFeature; // version.feature()
private boolean isMultiRelease; // is jar multi-release?
// indicates if Class-Path attribute present
@ -170,14 +170,14 @@ class JarFile extends ZipFile {
JUZFA = jdk.internal.misc.SharedSecrets.getJavaUtilZipFileAccess();
// multi-release jar file versions >= 9
BASE_VERSION = Runtime.Version.parse(Integer.toString(8));
BASE_VERSION_MAJOR = BASE_VERSION.major();
BASE_VERSION_FEATURE = BASE_VERSION.feature();
String jarVersion = GetPropertyAction.privilegedGetProperty("jdk.util.jar.version");
int runtimeVersion = Runtime.version().major();
int runtimeVersion = Runtime.version().feature();
if (jarVersion != null) {
int jarVer = Integer.parseInt(jarVersion);
runtimeVersion = (jarVer > runtimeVersion)
? runtimeVersion
: Math.max(jarVer, BASE_VERSION_MAJOR);
: Math.max(jarVer, BASE_VERSION_FEATURE);
}
RUNTIME_VERSION = Runtime.Version.parse(Integer.toString(runtimeVersion));
String enableMultiRelease = GetPropertyAction
@ -224,10 +224,10 @@ class JarFile extends ZipFile {
* Returns the version that represents the effective runtime versioned
* configuration of a multi-release jar file.
* <p>
* By default the major version number of the returned {@code Version} will
* be equal to the major version number of {@code Runtime.version()}.
* By default the feature version number of the returned {@code Version} will
* be equal to the feature version number of {@code Runtime.version()}.
* However, if the {@code jdk.util.jar.version} property is set, the
* returned {@code Version} is derived from that property and major version
* returned {@code Version} is derived from that property and feature version
* numbers may not be equal.
*
* @return the version that represents the runtime versioned configuration
@ -322,7 +322,7 @@ class JarFile extends ZipFile {
* <p>
* The canonical form derived from the version parameter is
* {@code Runtime.Version.parse(Integer.toString(n))} where {@code n} is
* {@code Math.max(version.major(), JarFile.baseVersion().major())}.
* {@code Math.max(version.feature(), JarFile.baseVersion().feature())}.
*
* @param file the jar file to be opened for reading
* @param verify whether or not to verify the jar file if
@ -341,17 +341,17 @@ class JarFile extends ZipFile {
super(file, mode);
this.verify = verify;
Objects.requireNonNull(version);
if (MULTI_RELEASE_FORCED || version.major() == RUNTIME_VERSION.major()) {
if (MULTI_RELEASE_FORCED || version.feature() == RUNTIME_VERSION.feature()) {
// This deals with the common case where the value from JarFile.runtimeVersion() is passed
this.version = RUNTIME_VERSION;
} else if (version.major() <= BASE_VERSION_MAJOR) {
} else if (version.feature() <= BASE_VERSION_FEATURE) {
// This also deals with the common case where the value from JarFile.baseVersion() is passed
this.version = BASE_VERSION;
} else {
// Canonicalize
this.version = Runtime.Version.parse(Integer.toString(version.major()));
this.version = Runtime.Version.parse(Integer.toString(version.feature()));
}
this.versionMajor = this.version.major();
this.versionFeature = this.version.feature();
}
/**
@ -579,7 +579,7 @@ class JarFile extends ZipFile {
// filter out dir META-INF/versions/ and META-INF/versions/*/
// and any entry with version > 'version'
if (index == -1 || index == (name.length() - 1) ||
Integer.parseInt(name, off, index, 10) > versionMajor) {
Integer.parseInt(name, off, index, 10) > versionFeature) {
return null;
}
} catch (NumberFormatException x) {
@ -592,11 +592,11 @@ class JarFile extends ZipFile {
}
private JarEntry getVersionedEntry(String name, JarEntry je) {
if (BASE_VERSION_MAJOR < versionMajor) {
if (BASE_VERSION_FEATURE < versionFeature) {
if (!name.startsWith(META_INF)) {
// search for versioned entry
int v = versionMajor;
while (v > BASE_VERSION_MAJOR) {
int v = versionFeature;
while (v > BASE_VERSION_FEATURE) {
JarFileEntry vje = getEntry0(META_INF_VERSIONS + v + "/" + name);
if (vje != null) {
return vje.withBasename(name);
@ -673,7 +673,7 @@ class JarFile extends ZipFile {
}
JarFileEntry realEntry() {
if (isMultiRelease() && versionMajor != BASE_VERSION_MAJOR) {
if (isMultiRelease() && versionFeature != BASE_VERSION_FEATURE) {
String entryName = super.getName();
return entryName == basename || entryName.equals(basename) ?
this : new JarFileEntry(entryName, this);

View File

@ -25,6 +25,9 @@
package java.util.zip;
import java.lang.ref.Cleaner.Cleanable;
import jdk.internal.ref.CleanerFactory;
/**
* This class provides support for general purpose compression using the
* popular ZLIB compression library. The ZLIB compression library was
@ -88,7 +91,7 @@ package java.util.zip;
public class Deflater {
private final ZStreamRef zsRef;
private final DeflaterZStreamRef zsRef;
private byte[] buf = new byte[0];
private int off, len;
private int level, strategy;
@ -183,9 +186,8 @@ public class Deflater {
public Deflater(int level, boolean nowrap) {
this.level = level;
this.strategy = DEFAULT_STRATEGY;
this.zsRef = ZStreamRef.get(this,
() -> init(level, DEFAULT_STRATEGY, nowrap),
Deflater::end);
this.zsRef = DeflaterZStreamRef.get(this,
init(level, DEFAULT_STRATEGY, nowrap));
}
/**
@ -591,4 +593,75 @@ public class Deflater {
private static native int getAdler(long addr);
private static native void reset(long addr);
private static native void end(long addr);
/**
* A reference to the native zlib's z_stream structure. It also
* serves as the "cleaner" to clean up the native resource when
* the Deflater is ended, closed or cleaned.
*/
static class DeflaterZStreamRef implements Runnable {
private long address;
private final Cleanable cleanable;
private DeflaterZStreamRef(Deflater owner, long addr) {
this.cleanable = (owner != null) ? CleanerFactory.cleaner().register(owner, this) : null;
this.address = addr;
}
long address() {
return address;
}
void clean() {
cleanable.clean();
}
public synchronized void run() {
long addr = address;
address = 0;
if (addr != 0) {
end(addr);
}
}
/*
* If {@code Deflater} has been subclassed and the {@code end} method is
* overridden, uses {@code finalizer} mechanism for resource cleanup. So
* {@code end} method can be called when the {@code Deflater} is unreachable.
* This mechanism will be removed when the {@code finalize} method is
* removed from {@code Deflater}.
*/
static DeflaterZStreamRef get(Deflater owner, long addr) {
Class<?> clz = owner.getClass();
while (clz != Deflater.class) {
try {
clz.getDeclaredMethod("end");
return new FinalizableZStreamRef(owner, addr);
} catch (NoSuchMethodException nsme) {}
clz = clz.getSuperclass();
}
return new DeflaterZStreamRef(owner, addr);
}
private static class FinalizableZStreamRef extends DeflaterZStreamRef {
final Deflater owner;
FinalizableZStreamRef (Deflater owner, long addr) {
super(null, addr);
this.owner = owner;
}
@Override
void clean() {
run();
}
@Override
@SuppressWarnings("deprecation")
protected void finalize() {
owner.end();
}
}
}
}

View File

@ -25,6 +25,9 @@
package java.util.zip;
import java.lang.ref.Cleaner.Cleanable;
import jdk.internal.ref.CleanerFactory;
/**
* This class provides support for general purpose decompression using the
* popular ZLIB compression library. The ZLIB compression library was
@ -88,7 +91,7 @@ package java.util.zip;
public class Inflater {
private final ZStreamRef zsRef;
private final InflaterZStreamRef zsRef;
private byte[] buf = defaultBuf;
private int off, len;
private boolean finished;
@ -115,7 +118,7 @@ public class Inflater {
* @param nowrap if true then support GZIP compatible compression
*/
public Inflater(boolean nowrap) {
this.zsRef = ZStreamRef.get(this, () -> init(nowrap), Inflater::end);
this.zsRef = InflaterZStreamRef.get(this, init(nowrap));
}
/**
@ -428,4 +431,75 @@ public class Inflater {
private static native int getAdler(long addr);
private static native void reset(long addr);
private static native void end(long addr);
/**
* A reference to the native zlib's z_stream structure. It also
* serves as the "cleaner" to clean up the native resource when
* the Inflater is ended, closed or cleaned.
*/
static class InflaterZStreamRef implements Runnable {
private long address;
private final Cleanable cleanable;
private InflaterZStreamRef(Inflater owner, long addr) {
this.cleanable = (owner != null) ? CleanerFactory.cleaner().register(owner, this) : null;
this.address = addr;
}
long address() {
return address;
}
void clean() {
cleanable.clean();
}
public synchronized void run() {
long addr = address;
address = 0;
if (addr != 0) {
end(addr);
}
}
/*
* If {@code Inflater} has been subclassed and the {@code end} method is
* overridden, uses {@code finalizer} mechanism for resource cleanup. So
* {@code end} method can be called when the {@code Inflater} is unreachable.
* This mechanism will be removed when the {@code finalize} method is
* removed from {@code Inflater}.
*/
static InflaterZStreamRef get(Inflater owner, long addr) {
Class<?> clz = owner.getClass();
while (clz != Inflater.class) {
try {
clz.getDeclaredMethod("end");
return new FinalizableZStreamRef(owner, addr);
} catch (NoSuchMethodException nsme) {}
clz = clz.getSuperclass();
}
return new InflaterZStreamRef(owner, addr);
}
private static class FinalizableZStreamRef extends InflaterZStreamRef {
final Inflater owner;
FinalizableZStreamRef(Inflater owner, long addr) {
super(null, addr);
this.owner = owner;
}
@Override
void clean() {
run();
}
@Override
@SuppressWarnings("deprecation")
protected void finalize() {
owner.end();
}
}
}
}

View File

@ -1,113 +0,0 @@
/*
* Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 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
* questions.
*/
package java.util.zip;
import java.util.function.LongConsumer;
import java.util.function.LongSupplier;
import java.lang.ref.Cleaner.Cleanable;
import jdk.internal.ref.CleanerFactory;
/**
* A reference to the native zlib's z_stream structure. It also
* serves as the "cleaner" to clean up the native resource when
* the deflater or infalter is ended, closed or cleaned.
*/
class ZStreamRef implements Runnable {
private LongConsumer end;
private long address;
private final Cleanable cleanable;
private ZStreamRef (Object owner, LongSupplier addr, LongConsumer end) {
this.cleanable = CleanerFactory.cleaner().register(owner, this);
this.end = end;
this.address = addr.getAsLong();
}
long address() {
return address;
}
void clean() {
cleanable.clean();
}
public synchronized void run() {
long addr = address;
address = 0;
if (addr != 0) {
end.accept(addr);
}
}
private ZStreamRef (LongSupplier addr, LongConsumer end) {
this.cleanable = null;
this.end = end;
this.address = addr.getAsLong();
}
/*
* If {@code Inflater/Deflater} has been subclassed and the {@code end} method
* is overridden, uses {@code finalizer} mechanism for resource cleanup. So
* {@code end} method can be called when the {@code Inflater/Deflater} is
* unreachable. This mechanism will be removed when the {@code finalize} method
* is removed from {@code Inflater/Deflater}.
*/
static ZStreamRef get(Object owner, LongSupplier addr, LongConsumer end) {
Class<?> clz = owner.getClass();
while (clz != Deflater.class && clz != Inflater.class) {
try {
clz.getDeclaredMethod("end");
return new FinalizableZStreamRef(owner, addr, end);
} catch (NoSuchMethodException nsme) {}
clz = clz.getSuperclass();
}
return new ZStreamRef(owner, addr, end);
}
private static class FinalizableZStreamRef extends ZStreamRef {
final Object owner;
FinalizableZStreamRef (Object owner, LongSupplier addr, LongConsumer end) {
super(addr, end);
this.owner = owner;
}
@Override
void clean() {
run();
}
@Override
@SuppressWarnings("deprecation")
protected void finalize() {
if (owner instanceof Inflater)
((Inflater)owner).end();
else
((Deflater)owner).end();
}
}
}

View File

@ -412,6 +412,21 @@ class ZipFile implements ZipConstants, Closeable {
}
}
private static class InflaterCleanupAction implements Runnable {
private final Inflater inf;
private final CleanableResource res;
InflaterCleanupAction(Inflater inf, CleanableResource res) {
this.inf = inf;
this.res = res;
}
@Override
public void run() {
res.releaseInflater(inf);
}
}
private class ZipFileInflaterInputStream extends InflaterInputStream {
private volatile boolean closeRequested;
private boolean eof = false;
@ -427,8 +442,8 @@ class ZipFile implements ZipConstants, Closeable {
Inflater inf, int size) {
super(zfin, inf, size);
this.cleanable = CleanerFactory.cleaner().register(this,
() -> res.releaseInflater(inf));
}
new InflaterCleanupAction(inf, res));
}
public void close() throws IOException {
if (closeRequested)

View File

@ -1058,11 +1058,6 @@ public final class Main {
System.err.println(form.format(source));
keyPass = storePass;
}
if (newPass != null && !Arrays.equals(storePass, newPass)) {
Object[] source = {"-new"};
System.err.println(form.format(source));
newPass = storePass;
}
if (destKeyPass != null && !Arrays.equals(storePass, destKeyPass)) {
Object[] source = {"-destkeypass"};
System.err.println(form.format(source));
@ -1243,10 +1238,7 @@ public final class Main {
doSelfCert(alias, dname, sigAlgName);
kssave = true;
} else if (command == STOREPASSWD) {
storePassNew = newPass;
if (storePassNew == null) {
storePassNew = getNewPasswd("keystore password", storePass);
}
doChangeStorePasswd();
kssave = true;
} else if (command == GENCERT) {
if (alias == null) {
@ -2258,8 +2250,9 @@ public final class Main {
newPass = destKeyPass;
pp = new PasswordProtection(destKeyPass);
} else if (objs.snd != null) {
newPass = objs.snd;
pp = new PasswordProtection(objs.snd);
newPass = P12KEYSTORE.equalsIgnoreCase(storetype) ?
storePass : objs.snd;
pp = new PasswordProtection(newPass);
}
try {
@ -2762,6 +2755,28 @@ public final class Main {
}
}
}
private void doChangeStorePasswd() throws Exception {
storePassNew = newPass;
if (storePassNew == null) {
storePassNew = getNewPasswd("keystore password", storePass);
}
if (P12KEYSTORE.equalsIgnoreCase(storetype)) {
// When storetype is PKCS12, we need to change all keypass as well
for (String alias : Collections.list(keyStore.aliases())) {
if (!keyStore.isCertificateEntry(alias)) {
// keyPass should be either null or same with storePass,
// but keep it in case one day we want to "normalize"
// a PKCS12 keystore having different passwords.
Pair<Entry, char[]> objs
= recoverEntry(keyStore, alias, storePass, keyPass);
keyStore.setEntry(alias, objs.fst,
new PasswordProtection(storePassNew));
}
}
}
}
/**
* Creates a self-signed certificate, and stores it as a single-element
* certificate chain.

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -34,9 +34,9 @@
JNIEXPORT void
JDK_GetVersionInfo0(jdk_version_info* info, size_t info_size) {
/* These VERSION_* macros are given by the build system */
const unsigned int version_major = VERSION_MAJOR;
const unsigned int version_minor = VERSION_MINOR;
const unsigned int version_security = VERSION_SECURITY;
const unsigned int version_major = VERSION_FEATURE;
const unsigned int version_minor = VERSION_INTERIM;
const unsigned int version_security = VERSION_UPDATE;
const unsigned int version_patch = VERSION_PATCH;
const unsigned int version_build = VERSION_BUILD;

View File

@ -56,7 +56,7 @@ public enum SourceVersion {
* 1.7: diamond syntax, try-with-resources, etc.
* 1.8: lambda expressions and default methods
* 9: modules, small cleanups to 1.7 and 1.8 changes
* 10: to-be-determined changes
* 10: local-variable type inference (var)
*/
/**
@ -157,6 +157,9 @@ public enum SourceVersion {
* The version recognized by the Java Platform, Standard Edition
* 10.
*
* Additions in this release include local-variable type inference
* ({@code var}).
*
* @since 10
*/
RELEASE_10;

View File

@ -1,383 +0,0 @@
/*
* Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 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
* questions.
*/
package com.sun.tools.javah;
import java.io.ByteArrayOutputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.io.UnsupportedEncodingException;
import java.nio.file.NoSuchFileException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Set;
import java.util.Stack;
import javax.annotation.processing.ProcessingEnvironment;
import javax.lang.model.element.ExecutableElement;
import javax.lang.model.element.Modifier;
import javax.lang.model.element.TypeElement;
import javax.lang.model.element.VariableElement;
import javax.lang.model.util.ElementFilter;
import javax.lang.model.util.Elements;
import javax.lang.model.util.Types;
import javax.tools.FileObject;
import javax.tools.JavaFileManager;
import javax.tools.JavaFileObject;
import javax.tools.StandardLocation;
/**
* An abstraction for generating support files required by native methods.
* Subclasses are for specific native interfaces. At the time of its
* original writing, this interface is rich enough to support JNI and the
* old 1.0-style native method interface.
*
* <p><b>This is NOT part of any supported API.
* If you write code that depends on this, you do so at your own
* risk. This code and its internal interfaces are subject to change
* or deletion without notice.</b></p>
*
* @author Sucheta Dambalkar(Revised)
*/
public abstract class Gen {
protected String lineSep = System.getProperty("line.separator");
protected ProcessingEnvironment processingEnvironment;
protected Types types;
protected Elements elems;
protected Mangle mangler;
protected Util util;
protected Gen(Util util) {
this.util = util;
}
/*
* List of classes for which we must generate output.
*/
protected Set<TypeElement> classes;
static private final boolean isWindows =
System.getProperty("os.name").startsWith("Windows");
/**
* Override this abstract method, generating content for the named
* class into the outputstream.
*/
protected abstract void write(OutputStream o, TypeElement clazz) throws Util.Exit;
/**
* Override this method to provide a list of #include statements
* required by the native interface.
*/
protected abstract String getIncludes();
/*
* Output location.
*/
protected JavaFileManager fileManager;
protected JavaFileObject outFile;
public void setFileManager(JavaFileManager fm) {
fileManager = fm;
}
public void setOutFile(JavaFileObject outFile) {
this.outFile = outFile;
}
public void setClasses(Set<TypeElement> classes) {
this.classes = classes;
}
void setProcessingEnvironment(ProcessingEnvironment pEnv) {
processingEnvironment = pEnv;
elems = pEnv.getElementUtils();
types = pEnv.getTypeUtils();
mangler = new Mangle(elems, types);
}
/*
* Smartness with generated files.
*/
protected boolean force = false;
public void setForce(boolean state) {
force = state;
}
/**
* We explicitly need to write ASCII files because that is what C
* compilers understand.
*/
protected PrintWriter wrapWriter(OutputStream o) throws Util.Exit {
try {
return new PrintWriter(new OutputStreamWriter(o, "ISO8859_1"), true);
} catch (UnsupportedEncodingException use) {
util.bug("encoding.iso8859_1.not.found");
return null; /* dead code */
}
}
/**
* After initializing state of an instance, use this method to start
* processing.
*
* Buffer size chosen as an approximation from a single sampling of:
* expr `du -sk` / `ls *.h | wc -l`
*/
public void run() throws IOException, ClassNotFoundException, Util.Exit {
int i = 0;
if (outFile != null) {
/* Everything goes to one big file... */
ByteArrayOutputStream bout = new ByteArrayOutputStream(8192);
writeFileTop(bout); /* only once */
for (TypeElement t: classes) {
write(bout, t);
}
writeIfChanged(bout.toByteArray(), outFile);
} else {
/* Each class goes to its own file... */
for (TypeElement t: classes) {
ByteArrayOutputStream bout = new ByteArrayOutputStream(8192);
writeFileTop(bout);
write(bout, t);
writeIfChanged(bout.toByteArray(), getFileObject(t.getQualifiedName()));
}
}
}
/*
* Write the contents of byte[] b to a file named file. Writing
* is done if either the file doesn't exist or if the contents are
* different.
*/
private void writeIfChanged(byte[] b, FileObject file) throws IOException {
boolean mustWrite = false;
String event = "[No need to update file ";
if (force) {
mustWrite = true;
event = "[Forcefully writing file ";
} else {
InputStream in;
byte[] a;
try {
// regrettably, there's no API to get the length in bytes
// for a FileObject, so we can't short-circuit reading the
// file here
in = file.openInputStream();
a = readBytes(in);
if (!Arrays.equals(a, b)) {
mustWrite = true;
event = "[Overwriting file ";
}
} catch (FileNotFoundException | NoSuchFileException e) {
mustWrite = true;
event = "[Creating file ";
}
}
if (util.verbose)
util.log(event + file + "]");
if (mustWrite) {
OutputStream out = file.openOutputStream();
out.write(b); /* No buffering, just one big write! */
out.close();
}
}
protected byte[] readBytes(InputStream in) throws IOException {
try {
byte[] array = new byte[in.available() + 1];
int offset = 0;
int n;
while ((n = in.read(array, offset, array.length - offset)) != -1) {
offset += n;
if (offset == array.length)
array = Arrays.copyOf(array, array.length * 2);
}
return Arrays.copyOf(array, offset);
} finally {
in.close();
}
}
protected String defineForStatic(TypeElement c, VariableElement f)
throws Util.Exit {
CharSequence cnamedoc = c.getQualifiedName();
CharSequence fnamedoc = f.getSimpleName();
String cname = mangler.mangle(cnamedoc, Mangle.Type.CLASS);
String fname = mangler.mangle(fnamedoc, Mangle.Type.FIELDSTUB);
if (!f.getModifiers().contains(Modifier.STATIC))
util.bug("tried.to.define.non.static");
if (f.getModifiers().contains(Modifier.FINAL)) {
Object value = null;
value = f.getConstantValue();
if (value != null) { /* so it is a ConstantExpression */
String constString = null;
if ((value instanceof Integer)
|| (value instanceof Byte)
|| (value instanceof Short)) {
/* covers byte, short, int */
constString = value.toString() + "L";
} else if (value instanceof Boolean) {
constString = ((Boolean) value) ? "1L" : "0L";
} else if (value instanceof Character) {
Character ch = (Character) value;
constString = String.valueOf(((int) ch) & 0xffff) + "L";
} else if (value instanceof Long) {
// Visual C++ supports the i64 suffix, not LL.
if (isWindows)
constString = value.toString() + "i64";
else
constString = value.toString() + "LL";
} else if (value instanceof Float) {
/* bug for bug */
float fv = ((Float)value).floatValue();
if (Float.isInfinite(fv))
constString = ((fv < 0) ? "-" : "") + "Inff";
else
constString = value.toString() + "f";
} else if (value instanceof Double) {
/* bug for bug */
double d = ((Double)value).doubleValue();
if (Double.isInfinite(d))
constString = ((d < 0) ? "-" : "") + "InfD";
else
constString = value.toString();
}
if (constString != null) {
StringBuilder s = new StringBuilder("#undef ");
s.append(cname); s.append("_"); s.append(fname); s.append(lineSep);
s.append("#define "); s.append(cname); s.append("_");
s.append(fname); s.append(" "); s.append(constString);
return s.toString();
}
}
}
return null;
}
/*
* Deal with the C pre-processor.
*/
protected String cppGuardBegin() {
return "#ifdef __cplusplus" + lineSep + "extern \"C\" {" + lineSep + "#endif";
}
protected String cppGuardEnd() {
return "#ifdef __cplusplus" + lineSep + "}" + lineSep + "#endif";
}
protected String guardBegin(String cname) {
return "/* Header for class " + cname + " */" + lineSep + lineSep +
"#ifndef _Included_" + cname + lineSep +
"#define _Included_" + cname;
}
protected String guardEnd(String cname) {
return "#endif";
}
/*
* File name and file preamble related operations.
*/
protected void writeFileTop(OutputStream o) throws Util.Exit {
PrintWriter pw = wrapWriter(o);
pw.println("/* DO NOT EDIT THIS FILE - it is machine generated */" + lineSep +
getIncludes());
}
protected String baseFileName(CharSequence className) {
return mangler.mangle(className, Mangle.Type.CLASS);
}
protected FileObject getFileObject(CharSequence className) throws IOException {
String name = baseFileName(className) + getFileSuffix();
return fileManager.getFileForOutput(StandardLocation.SOURCE_OUTPUT, "", name, null);
}
protected String getFileSuffix() {
return ".h";
}
/**
* Including super classes' fields.
*/
List<VariableElement> getAllFields(TypeElement subclazz) {
List<VariableElement> fields = new ArrayList<>();
TypeElement cd = null;
Stack<TypeElement> s = new Stack<>();
cd = subclazz;
while (true) {
s.push(cd);
TypeElement c = (TypeElement) (types.asElement(cd.getSuperclass()));
if (c == null)
break;
cd = c;
}
while (!s.empty()) {
cd = s.pop();
fields.addAll(ElementFilter.fieldsIn(cd.getEnclosedElements()));
}
return fields;
}
// c.f. MethodDoc.signature
String signature(ExecutableElement e) {
StringBuilder sb = new StringBuilder("(");
String sep = "";
for (VariableElement p: e.getParameters()) {
sb.append(sep);
sb.append(types.erasure(p.asType()).toString());
sep = ",";
}
sb.append(")");
return sb.toString();
}
}

Some files were not shown because too many files have changed in this diff Show More