--- a/.hgtags Wed Dec 13 14:21:12 2017 -0800
+++ b/.hgtags Mon Dec 18 10:28:43 2017 -0800
@@ -460,3 +460,5 @@
bbd692ad4fa300ecca7939ffbe3b1d5e52a28cc6 jdk-10+33
89deac44e51517841491ba86ff44aa82a5ca96b3 jdk-10+34
d8c634b016c628622c9abbdc6bf50509e5dedbec jdk-10+35
+0ee20aad71c4f33c426372b4c8bcc1235ce2ec08 jdk-11+0
+959f2f7cbaa6d2ee45d50029744efb219721576c jdk-10+36
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/ADDITIONAL_LICENSE_INFO Mon Dec 18 10:28:43 2017 -0800
@@ -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.
--- a/make/MacBundles.gmk Wed Dec 13 14:21:12 2017 -0800
+++ b/make/MacBundles.gmk Mon Dec 18 10:28:43 2017 -0800
@@ -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 @@
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
--- a/make/ReleaseFile.gmk Wed Dec 13 14:21:12 2017 -0800
+++ b/make/ReleaseFile.gmk Mon Dec 18 10:28:43 2017 -0800
@@ -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 @@
$(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
--- a/make/autoconf/flags.m4 Wed Dec 13 14:21:12 2017 -0800
+++ b/make/autoconf/flags.m4 Mon Dec 18 10:28:43 2017 -0800
@@ -313,7 +313,7 @@
-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 @@
-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 \
--- a/make/autoconf/generated-configure.sh Wed Dec 13 14:21:12 2017 -0800
+++ b/make/autoconf/generated-configure.sh Mon Dec 18 10:28:43 2017 -0800
@@ -887,6 +887,8 @@
BOOT_JDK
JAVA_CHECK
JAVAC_CHECK
+VENDOR_VERSION_STRING
+VERSION_DATE
VERSION_IS_GA
VERSION_SHORT
VERSION_STRING
@@ -896,9 +898,9 @@
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_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
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 @@
docdir
oldincludedir
includedir
+runstatedir
localstatedir
sharedstatedir
sysconfdir
@@ -1143,14 +1144,19 @@
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 @@
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 @@
| -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 @@
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 @@
--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 @@
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 @@
[<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 @@
#
-# 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 @@
#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 @@
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 @@
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 @@
+
+# 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 @@
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
- fi
- if test "x$VERSION_SECURITY" = x; then
- VERSION_SECURITY=0
+ if test "x$VERSION_INTERIM" = x; then
+ VERSION_INTERIM=0
+ fi
+ 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 @@
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
-else
- with_version_major_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
+# 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_feature_present=false
+fi
+
+
+ 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
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
- 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;}
- fi
- VERSION_MAJOR=$cleaned_value
+ 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_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_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"
- 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
-else
- with_version_minor_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
+ VERSION_FEATURE="$DEFAULT_VERSION_FEATURE"
+ fi
+ fi
+
+
+# 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_interim_present=false
+fi
+
+
+ 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
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
- 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;}
- fi
- VERSION_MINOR=$cleaned_value
+ 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_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_INTERIM=$cleaned_value
fi
else
if test "x$NO_DEFAULT_VERSION_PARTS" != xtrue; then
# Default is 0, if unspecified
- VERSION_MINOR=$DEFAULT_VERSION_MINOR
- 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
-else
- with_version_security_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
+ VERSION_INTERIM=$DEFAULT_VERSION_INTERIM
+ fi
+ fi
+
+
+# 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_update_present=false
+fi
+
+
+ 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
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
- 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;}
- fi
- VERSION_SECURITY=$cleaned_value
+ 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_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_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 @@
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 @@
# 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 @@
+
+
###############################################################################
#
# Setup BootJDK, used to bootstrap the build.
@@ -50669,7 +50744,7 @@
-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 @@
-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 @@
-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 \
--- a/make/autoconf/jdk-version.m4 Wed Dec 13 14:21:12 2017 -0800
+++ b/make/autoconf/jdk-version.m4 Mon Dec 18 10:28:43 2017 -0800
@@ -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 @@
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 @@
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 @@
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 @@
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 @@
# 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_SUBST(VERSION_STRING)
AC_SUBST(VERSION_SHORT)
AC_SUBST(VERSION_IS_GA)
+ AC_SUBST(VERSION_DATE)
+ AC_SUBST(VENDOR_VERSION_STRING)
])
--- a/make/autoconf/platform.m4 Wed Dec 13 14:21:12 2017 -0800
+++ b/make/autoconf/platform.m4 Mon Dec 18 10:28:43 2017 -0800
@@ -388,13 +388,6 @@
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
--- a/make/autoconf/spec.gmk.in Wed Dec 13 14:21:12 2017 -0800
+++ b/make/autoconf/spec.gmk.in Mon Dec 18 10:28:43 2017 -0800
@@ -78,7 +78,6 @@
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 @@
## 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_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 @@
-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
--- a/make/autoconf/version-numbers Wed Dec 13 14:21:12 2017 -0800
+++ b/make/autoconf/version-numbers Mon Dec 18 10:28:43 2017 -0800
@@ -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
--- a/make/conf/jib-profiles.js Wed Dec 13 14:21:12 2017 -0800
+++ b/make/conf/jib-profiles.js Mon Dec 18 10:28:43 2017 -0800
@@ -1050,17 +1050,17 @@
* 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);
--- a/make/copy/Copy-java.base.gmk Wed Dec 13 14:21:12 2017 -0800
+++ b/make/copy/Copy-java.base.gmk Mon Dec 18 10:28:43 2017 -0800
@@ -28,24 +28,6 @@
$(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 @@
# 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, \
))
--- a/make/copy/Copy-java.desktop.gmk Wed Dec 13 14:21:12 2017 -0800
+++ b/make/copy/Copy-java.desktop.gmk Mon Dec 18 10:28:43 2017 -0800
@@ -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 @@
################################################################################
-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.
--- a/make/copy/Copy-jdk.accessibility.gmk Wed Dec 13 14:21:12 2017 -0800
+++ b/make/copy/Copy-jdk.accessibility.gmk Mon Dec 18 10:28:43 2017 -0800
@@ -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
-
################################################################################
+# Include CopyCommon.gmk to get exported header files to be properly copied.
-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
-
-################################################################################
+include CopyCommon.gmk
--- a/make/copy/Copy-jdk.jdwp.agent.gmk Wed Dec 13 14:21:12 2017 -0800
+++ b/make/copy/Copy-jdk.jdwp.agent.gmk Mon Dec 18 10:28:43 2017 -0800
@@ -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
-
################################################################################
+# Include CopyCommon.gmk to get exported header files to be properly copied.
-TARGETS := $(INCLUDE_DST_DIR)/jdwpTransport.h
-
-$(INCLUDE_DST_DIR)/%.h: $(TOPDIR)/src/jdk.jdwp.agent/share/native/include/%.h
- $(call install-file)
-
-################################################################################
+include CopyCommon.gmk
--- a/make/copy/CopyCommon.gmk Wed Dec 13 14:21:12 2017 -0800
+++ b/make/copy/CopyCommon.gmk Mon Dec 18 10:28:43 2017 -0800
@@ -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.
+#
+
+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_DST_OS_DIR := $(INCLUDE_DST_DIR)/win32
+ INCLUDE_TARGET_OS_SUBDIR := win32
else ifeq ($(OPENJDK_TARGET_OS), macosx)
- INCLUDE_DST_OS_DIR := $(INCLUDE_DST_DIR)/darwin
+ 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
--- a/make/gensrc/GensrcMisc.gmk Wed Dec 13 14:21:12 2017 -0800
+++ b/make/gensrc/GensrcMisc.gmk Mon Dec 18 10:28:43 2017 -0800
@@ -38,7 +38,9 @@
@@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)
--- a/make/gensrc/GensrcX11Wrappers.gmk Wed Dec 13 14:21:12 2017 -0800
+++ b/make/gensrc/GensrcX11Wrappers.gmk Mon Dec 18 10:28:43 2017 -0800
@@ -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 @@
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 \
--- a/make/hotspot/lib/CompileJvm.gmk Wed Dec 13 14:21:12 2017 -0800
+++ b/make/hotspot/lib/CompileJvm.gmk Mon Dec 18 10:28:43 2017 -0800
@@ -57,9 +57,10 @@
$(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 \
#
--- a/make/hotspot/lib/CompileLibjsig.gmk Wed Dec 13 14:21:12 2017 -0800
+++ b/make/hotspot/lib/CompileLibjsig.gmk Mon Dec 18 10:28:43 2017 -0800
@@ -57,7 +57,7 @@
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)
--- a/make/jprt.properties Wed Dec 13 14:21:12 2017 -0800
+++ b/make/jprt.properties Mon Dec 18 10:28:43 2017 -0800
@@ -177,6 +177,7 @@
# 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} \
--- a/make/launcher/Launcher-jdk.compiler.gmk Wed Dec 13 14:21:12 2017 -0800
+++ b/make/launcher/Launcher-jdk.compiler.gmk Mon Dec 18 10:28:43 2017 -0800
@@ -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 @@
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, \
--- a/make/lib/Lib-java.management.gmk Wed Dec 13 14:21:12 2017 -0800
+++ b/make/lib/Lib-java.management.gmk Mon Dec 18 10:28:43 2017 -0800
@@ -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 @@
################################################################################
-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) \
--- a/src/hotspot/cpu/ppc/c1_LIRAssembler_ppc.cpp Wed Dec 13 14:21:12 2017 -0800
+++ b/src/hotspot/cpu/ppc/c1_LIRAssembler_ppc.cpp Mon Dec 18 10:28:43 2017 -0800
@@ -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 @@
__ 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 @@
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;
}
--- a/src/hotspot/cpu/ppc/globalDefinitions_ppc.hpp Wed Dec 13 14:21:12 2017 -0800
+++ b/src/hotspot/cpu/ppc/globalDefinitions_ppc.hpp Mon Dec 18 10:28:43 2017 -0800
@@ -54,4 +54,6 @@
#define SUPPORT_RESERVED_STACK_AREA
+#define THREAD_LOCAL_POLL
+
#endif // CPU_PPC_VM_GLOBALDEFINITIONS_PPC_HPP
--- a/src/hotspot/cpu/ppc/globals_ppc.hpp Wed Dec 13 14:21:12 2017 -0800
+++ b/src/hotspot/cpu/ppc/globals_ppc.hpp Mon Dec 18 10:28:43 2017 -0800
@@ -83,7 +83,7 @@
// 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 @@
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.") \
--- a/src/hotspot/cpu/ppc/interp_masm_ppc.hpp Wed Dec 13 14:21:12 2017 -0800
+++ b/src/hotspot/cpu/ppc/interp_masm_ppc.hpp Mon Dec 18 10:28:43 2017 -0800
@@ -57,10 +57,10 @@
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);
--- a/src/hotspot/cpu/ppc/interp_masm_ppc_64.cpp Wed Dec 13 14:21:12 2017 -0800
+++ b/src/hotspot/cpu/ppc/interp_masm_ppc_64.cpp Mon Dec 18 10:28:43 2017 -0800
@@ -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::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 @@
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::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);
--- a/src/hotspot/cpu/ppc/macroAssembler_ppc.cpp Wed Dec 13 14:21:12 2017 -0800
+++ b/src/hotspot/cpu/ppc/macroAssembler_ppc.cpp Mon Dec 18 10:28:43 2017 -0800
@@ -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 @@
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
--- a/src/hotspot/cpu/ppc/macroAssembler_ppc.hpp Wed Dec 13 14:21:12 2017 -0800
+++ b/src/hotspot/cpu/ppc/macroAssembler_ppc.hpp Mon Dec 18 10:28:43 2017 -0800
@@ -647,6 +647,9 @@
// 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);
--- a/src/hotspot/cpu/ppc/ppc.ad Wed Dec 13 14:21:12 2017 -0800
+++ b/src/hotspot/cpu/ppc/ppc.ad Mon Dec 18 10:28:43 2017 -0800
@@ -1577,11 +1577,10 @@
}
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 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 @@
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
--- a/src/hotspot/cpu/ppc/sharedRuntime_ppc.cpp Wed Dec 13 14:21:12 2017 -0800
+++ b/src/hotspot/cpu/ppc/sharedRuntime_ppc.cpp Mon Dec 18 10:28:43 2017 -0800
@@ -214,6 +214,7 @@
// 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 @@
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 @@
}
// 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 @@
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 @@
}
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 @@
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 @@
// 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 @@
// 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 @@
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 @@
// 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,
--- a/src/hotspot/cpu/ppc/templateInterpreterGenerator_ppc.cpp Wed Dec 13 14:21:12 2017 -0800
+++ b/src/hotspot/cpu/ppc/templateInterpreterGenerator_ppc.cpp Mon Dec 18 10:28:43 2017 -0800
@@ -1535,23 +1535,17 @@
// 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));
+ __ cmpwi(CCR1, suspend_flags, 0);
+ __ beq(CCR1, sync_check_done);
- 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 @@
// 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 @@
// 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 @@
// 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)
--- a/src/hotspot/cpu/ppc/templateTable_ppc_64.cpp Wed Dec 13 14:21:12 2017 -0800
+++ b/src/hotspot/cpu/ppc/templateTable_ppc_64.cpp Mon Dec 18 10:28:43 2017 -0800
@@ -1630,7 +1630,7 @@
// 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 @@
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 @@
}
__ 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 @@
__ 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 @@
__ 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 @@
__ bind(Ldispatch);
__ add(R14_bcp, Roffset, R14_bcp);
- __ dispatch_next(vtos);
+ __ dispatch_next(vtos, 0, true);
}
void TemplateTable::lookupswitch() {
@@ -1960,7 +1956,7 @@
__ 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 @@
__ 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 @@
__ 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.
--- a/src/hotspot/cpu/s390/assembler_s390.hpp Wed Dec 13 14:21:12 2017 -0800
+++ b/src/hotspot/cpu/s390/assembler_s390.hpp Mon Dec 18 10:28:43 2017 -0800
@@ -1459,6 +1459,10 @@
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 @@
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);
--- a/src/hotspot/cpu/s390/assembler_s390.inline.hpp Wed Dec 13 14:21:12 2017 -0800
+++ b/src/hotspot/cpu/s390/assembler_s390.inline.hpp Mon Dec 18 10:28:43 2017 -0800
@@ -1315,23 +1315,28 @@
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)); }
--- a/src/hotspot/cpu/s390/c1_LIRAssembler_s390.cpp Wed Dec 13 14:21:12 2017 -0800
+++ b/src/hotspot/cpu/s390/c1_LIRAssembler_s390.cpp Mon Dec 18 10:28:43 2017 -0800
@@ -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 @@
(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 @@
}
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;
}
--- a/src/hotspot/cpu/s390/globalDefinitions_s390.hpp Wed Dec 13 14:21:12 2017 -0800
+++ b/src/hotspot/cpu/s390/globalDefinitions_s390.hpp Mon Dec 18 10:28:43 2017 -0800
@@ -54,4 +54,6 @@
#define SUPPORT_RESERVED_STACK_AREA
+#define THREAD_LOCAL_POLL
+
#endif // CPU_S390_VM_GLOBALDEFINITIONS_S390_HPP
--- a/src/hotspot/cpu/s390/globals_s390.hpp Wed Dec 13 14:21:12 2017 -0800
+++ b/src/hotspot/cpu/s390/globals_s390.hpp Mon Dec 18 10:28:43 2017 -0800
@@ -85,7 +85,7 @@
// 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) \
\
--- a/src/hotspot/cpu/s390/interp_masm_s390.cpp Wed Dec 13 14:21:12 2017 -0800
+++ b/src/hotspot/cpu/s390/interp_masm_s390.cpp Mon Dec 18 10:28:43 2017 -0800
@@ -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 @@
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 @@
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 @@
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) {
--- a/src/hotspot/cpu/s390/interp_masm_s390.hpp Wed Dec 13 14:21:12 2017 -0800
+++ b/src/hotspot/cpu/s390/interp_masm_s390.hpp Mon Dec 18 10:28:43 2017 -0800
@@ -49,7 +49,7 @@
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 @@
// 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);
--- a/src/hotspot/cpu/s390/macroAssembler_s390.cpp Wed Dec 13 14:21:12 2017 -0800
+++ b/src/hotspot/cpu/s390/macroAssembler_s390.cpp Mon Dec 18 10:28:43 2017 -0800
@@ -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 @@
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 @@
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 @@
// 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 @@
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 @@
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 @@
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 @@
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,
--- a/src/hotspot/cpu/s390/macroAssembler_s390.hpp Wed Dec 13 14:21:12 2017 -0800
+++ b/src/hotspot/cpu/s390/macroAssembler_s390.hpp Mon Dec 18 10:28:43 2017 -0800
@@ -260,8 +260,6 @@
//
// 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 @@
// 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 @@
// 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);
--- a/src/hotspot/cpu/s390/s390.ad Wed Dec 13 14:21:12 2017 -0800
+++ b/src/hotspot/cpu/s390/s390.ad Mon Dec 18 10:28:43 2017 -0800
@@ -919,8 +919,12 @@
// 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);
--- a/src/hotspot/cpu/s390/sharedRuntime_s390.cpp Wed Dec 13 14:21:12 2017 -0800
+++ b/src/hotspot/cpu/s390/sharedRuntime_s390.cpp Mon Dec 18 10:28:43 2017 -0800
@@ -2165,7 +2165,7 @@
__ 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 @@
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 @@
// 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);
--- a/src/hotspot/cpu/s390/templateInterpreterGenerator_s390.cpp Wed Dec 13 14:21:12 2017 -0800
+++ b/src/hotspot/cpu/s390/templateInterpreterGenerator_s390.cpp Mon Dec 18 10:28:43 2017 -0800
@@ -1633,7 +1633,7 @@
// 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 @@
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 @@
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.
--- a/src/hotspot/cpu/s390/templateTable_s390.cpp Wed Dec 13 14:21:12 2017 -0800
+++ b/src/hotspot/cpu/s390/templateTable_s390.cpp Mon Dec 18 10:28:43 2017 -0800
@@ -1853,7 +1853,7 @@
// 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 @@
// 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 @@
__ 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 @@
__ 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 @@
// 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 @@
// 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 @@
// 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 @@
// 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 @@
__ 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
--- a/src/hotspot/cpu/sparc/stubGenerator_sparc.cpp Wed Dec 13 14:21:12 2017 -0800
+++ b/src/hotspot/cpu/sparc/stubGenerator_sparc.cpp Mon Dec 18 10:28:43 2017 -0800
@@ -5157,8 +5157,8 @@
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 @@
// 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 @@
__ 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 @@
__ 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);
--- a/src/hotspot/cpu/x86/assembler_x86.cpp Wed Dec 13 14:21:12 2017 -0800
+++ b/src/hotspot/cpu/x86/assembler_x86.cpp Mon Dec 18 10:28:43 2017 -0800
@@ -7449,6 +7449,27 @@
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);
--- a/src/hotspot/cpu/x86/assembler_x86.hpp Wed Dec 13 14:21:12 2017 -0800
+++ b/src/hotspot/cpu/x86/assembler_x86.hpp Mon Dec 18 10:28:43 2017 -0800
@@ -2114,9 +2114,11 @@
// 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:
--- a/src/hotspot/cpu/x86/x86.ad Wed Dec 13 14:21:12 2017 -0800
+++ b/src/hotspot/cpu/x86/x86.ad Mon Dec 18 10:28:43 2017 -0800
@@ -1263,6 +1263,7 @@
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 @@
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 @@
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)));
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/hotspot/os/posix/include/jvm_md.h Mon Dec 18 10:28:43 2017 -0800
@@ -0,0 +1,100 @@
+/*
+ * Copyright (c) 1997, 2012, 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.
+ */
+
+#ifndef _JAVASOFT_JVM_MD_H_
+#define _JAVASOFT_JVM_MD_H_
+
+/*
+ * This file is currently collecting system-specific dregs for the
+ * JNI conversion, which should be sorted out later.
+ */
+
+#include <dirent.h> /* For DIR */
+#include <sys/param.h> /* For MAXPATHLEN */
+#include <unistd.h> /* For F_OK, R_OK, W_OK */
+#include <stddef.h> /* For ptrdiff_t */
+#include <stdint.h> /* For uintptr_t */
+
+#define JNI_ONLOAD_SYMBOLS {"JNI_OnLoad"}
+#define JNI_ONUNLOAD_SYMBOLS {"JNI_OnUnload"}
+#define JVM_ONLOAD_SYMBOLS {"JVM_OnLoad"}
+#define AGENT_ONLOAD_SYMBOLS {"Agent_OnLoad"}
+#define AGENT_ONUNLOAD_SYMBOLS {"Agent_OnUnload"}
+#define AGENT_ONATTACH_SYMBOLS {"Agent_OnAttach"}
+
+#define JNI_LIB_PREFIX "lib"
+#ifdef __APPLE__
+#define JNI_LIB_SUFFIX ".dylib"
+#define VERSIONED_JNI_LIB_NAME(NAME, VERSION) JNI_LIB_PREFIX NAME "." VERSION JNI_LIB_SUFFIX
+#else
+#define JNI_LIB_SUFFIX ".so"
+#define VERSIONED_JNI_LIB_NAME(NAME, VERSION) JNI_LIB_PREFIX NAME JNI_LIB_SUFFIX "." VERSION
+#endif
+#define JNI_LIB_NAME(NAME) JNI_LIB_PREFIX NAME JNI_LIB_SUFFIX
+
+#if defined(AIX) || defined(SOLARIS)
+#define JVM_MAXPATHLEN MAXPATHLEN
+#else
+// Hack: MAXPATHLEN is 4095 on some Linux and 4096 on others. This may
+// cause problems if JVM and the rest of JDK are built on different
+// Linux releases. Here we define JVM_MAXPATHLEN to be MAXPATHLEN + 1,
+// so buffers declared in VM are always >= 4096.
+#define JVM_MAXPATHLEN MAXPATHLEN + 1
+#endif
+
+#define JVM_R_OK R_OK
+#define JVM_W_OK W_OK
+#define JVM_X_OK X_OK
+#define JVM_F_OK F_OK
+
+/*
+ * File I/O
+ */
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <signal.h>
+
+/* Signals */
+
+#include <sys/socket.h> // for socklen_t
+
+#define JVM_SIGINT SIGINT
+#define JVM_SIGTERM SIGTERM
+
+#define BREAK_SIGNAL SIGQUIT /* Thread dumping support. */
+#ifdef SOLARIS
+#define ASYNC_SIGNAL SIGJVM2 /* Event-based suspend/resume support */
+#endif // SOLARIS
+#define SHUTDOWN1_SIGNAL SIGHUP /* Shutdown Hooks support. */
+#define SHUTDOWN2_SIGNAL SIGINT
+#define SHUTDOWN3_SIGNAL SIGTERM
+
+/* With 1.4.1 libjsig added versioning: used in os_solaris.cpp and jsig.c */
+#define JSIG_VERSION_1_4_1 0x30140100
+
+#endif /* !_JAVASOFT_JVM_MD_H_ */
--- a/src/hotspot/os/posix/os_posix.cpp Wed Dec 13 14:21:12 2017 -0800
+++ b/src/hotspot/os/posix/os_posix.cpp Mon Dec 18 10:28:43 2017 -0800
@@ -243,8 +243,9 @@
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* 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;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/hotspot/os/windows/include/jvm_md.h Mon Dec 18 10:28:43 2017 -0800
@@ -0,0 +1,102 @@
+/*
+ * Copyright (c) 1997, 2008, 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.
+ */
+
+#ifndef _JAVASOFT_JVM_MD_H_
+#define _JAVASOFT_JVM_MD_H_
+
+/*
+ * This file is currently collecting system-specific dregs for the
+ * JNI conversion, which should be sorted out later.
+ */
+
+#include <windows.h>
+#include <windef.h>
+#include <winbase.h>
+
+#include "jni.h"
+
+typedef int socklen_t;
+
+#define JNI_ONLOAD_SYMBOLS {"_JNI_OnLoad@8", "JNI_OnLoad"}
+#define JNI_ONUNLOAD_SYMBOLS {"_JNI_OnUnload@8", "JNI_OnUnload"}
+#define JVM_ONLOAD_SYMBOLS {"_JVM_OnLoad@12", "JVM_OnLoad"}
+#define AGENT_ONLOAD_SYMBOLS {"_Agent_OnLoad@12", "Agent_OnLoad"}
+#define AGENT_ONUNLOAD_SYMBOLS {"_Agent_OnUnload@4", "Agent_OnUnload"}
+#define AGENT_ONATTACH_SYMBOLS {"_Agent_OnAttach@12", "Agent_OnAttach"}
+
+#define JNI_LIB_PREFIX ""
+#define JNI_LIB_SUFFIX ".dll"
+
+struct dirent {
+ char d_name[MAX_PATH];
+};
+
+typedef struct {
+ struct dirent dirent;
+ char *path;
+ HANDLE handle;
+ WIN32_FIND_DATA find_data;
+} DIR;
+
+#include <stddef.h> /* For uintptr_t */
+#include <stdlib.h>
+
+#define JVM_MAXPATHLEN _MAX_PATH
+
+#define JVM_R_OK 4
+#define JVM_W_OK 2
+#define JVM_X_OK 1
+#define JVM_F_OK 0
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+JNIEXPORT void * JNICALL
+JVM_GetThreadInterruptEvent();
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif /* __cplusplus */
+
+/*
+ * File I/O
+ */
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <signal.h>
+
+/* Signals */
+
+#define JVM_SIGINT SIGINT
+#define JVM_SIGTERM SIGTERM
+
+#define SHUTDOWN1_SIGNAL SIGINT /* Shutdown Hooks support. */
+#define SHUTDOWN2_SIGNAL SIGTERM
+
+#endif /* !_JAVASOFT_JVM_MD_H_ */
--- a/src/hotspot/share/adlc/formssel.cpp Wed Dec 13 14:21:12 2017 -0800
+++ b/src/hotspot/share/adlc/formssel.cpp Mon Dec 18 10:28:43 2017 -0800
@@ -4164,7 +4164,7 @@
"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",
--- a/src/hotspot/share/c1/c1_GraphBuilder.cpp Wed Dec 13 14:21:12 2017 -0800
+++ b/src/hotspot/share/c1/c1_GraphBuilder.cpp Mon Dec 18 10:28:43 2017 -0800
@@ -1439,6 +1439,9 @@
}
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 @@
}
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.
--- a/src/hotspot/share/ci/ciEnv.cpp Wed Dec 13 14:21:12 2017 -0800
+++ b/src/hotspot/share/ci/ciEnv.cpp Mon Dec 18 10:28:43 2017 -0800
@@ -899,64 +899,18 @@
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;
+ bool counter_changed = system_dictionary_modification_counter_changed();
+ 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");
}
}
-
- // 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;
- }
- }
- }
-
- 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");
- }
}
// ------------------------------------------------------------------
--- a/src/hotspot/share/code/dependencies.cpp Wed Dec 13 14:21:12 2017 -0800
+++ b/src/hotspot/share/code/dependencies.cpp Mon Dec 18 10:28:43 2017 -0800
@@ -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 @@
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;
--- a/src/hotspot/share/code/dependencies.hpp Wed Dec 13 14:21:12 2017 -0800
+++ b/src/hotspot/share/code/dependencies.hpp Mon Dec 18 10:28:43 2017 -0800
@@ -457,6 +457,8 @@
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) {
--- a/src/hotspot/share/gc/g1/g1Arguments.cpp Wed Dec 13 14:21:12 2017 -0800
+++ b/src/hotspot/share/gc/g1/g1Arguments.cpp Mon Dec 18 10:28:43 2017 -0800
@@ -98,9 +98,9 @@
// 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
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/hotspot/share/include/jmm.h Mon Dec 18 10:28:43 2017 -0800
@@ -0,0 +1,345 @@
+/*
+ * Copyright (c) 2003, 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
+ * 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.
+ */
+
+#ifndef _JAVA_JMM_H_
+#define _JAVA_JMM_H_
+
+/*
+ * This is a private interface used by JDK for JVM monitoring
+ * and management.
+ *
+ * Bump the version number when either of the following happens:
+ *
+ * 1. There is a change in functions in JmmInterface.
+ *
+ * 2. There is a change in the contract between VM and Java classes.
+ */
+
+#include "jni.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+enum {
+ JMM_VERSION_1 = 0x20010000,
+ JMM_VERSION_1_0 = 0x20010000,
+ JMM_VERSION_1_1 = 0x20010100, // JDK 6
+ JMM_VERSION_1_2 = 0x20010200, // JDK 7
+ JMM_VERSION_1_2_1 = 0x20010201, // JDK 7 GA
+ JMM_VERSION_1_2_2 = 0x20010202,
+ JMM_VERSION_2 = 0x20020000, // JDK 10
+ JMM_VERSION = 0x20020000
+};
+
+typedef struct {
+ unsigned int isLowMemoryDetectionSupported : 1;
+ unsigned int isCompilationTimeMonitoringSupported : 1;
+ unsigned int isThreadContentionMonitoringSupported : 1;
+ unsigned int isCurrentThreadCpuTimeSupported : 1;
+ unsigned int isOtherThreadCpuTimeSupported : 1;
+ unsigned int isObjectMonitorUsageSupported : 1;
+ unsigned int isSynchronizerUsageSupported : 1;
+ unsigned int isThreadAllocatedMemorySupported : 1;
+ unsigned int isRemoteDiagnosticCommandsSupported : 1;
+ unsigned int : 22;
+} jmmOptionalSupport;
+
+typedef enum {
+ JMM_CLASS_LOADED_COUNT = 1, /* Total number of loaded classes */
+ JMM_CLASS_UNLOADED_COUNT = 2, /* Total number of unloaded classes */
+ JMM_THREAD_TOTAL_COUNT = 3, /* Total number of threads that have been started */
+ JMM_THREAD_LIVE_COUNT = 4, /* Current number of live threads */
+ JMM_THREAD_PEAK_COUNT = 5, /* Peak number of live threads */
+ JMM_THREAD_DAEMON_COUNT = 6, /* Current number of daemon threads */
+ JMM_JVM_INIT_DONE_TIME_MS = 7, /* Time when the JVM finished initialization */
+ JMM_COMPILE_TOTAL_TIME_MS = 8, /* Total accumulated time spent in compilation */
+ JMM_GC_TIME_MS = 9, /* Total accumulated time spent in collection */
+ JMM_GC_COUNT = 10, /* Total number of collections */
+ JMM_JVM_UPTIME_MS = 11, /* The JVM uptime in milliseconds */
+
+ JMM_INTERNAL_ATTRIBUTE_INDEX = 100,
+ JMM_CLASS_LOADED_BYTES = 101, /* Number of bytes loaded instance classes */
+ JMM_CLASS_UNLOADED_BYTES = 102, /* Number of bytes unloaded instance classes */
+ JMM_TOTAL_CLASSLOAD_TIME_MS = 103, /* Accumulated VM class loader time (TraceClassLoadingTime) */
+ JMM_VM_GLOBAL_COUNT = 104, /* Number of VM internal flags */
+ JMM_SAFEPOINT_COUNT = 105, /* Total number of safepoints */
+ JMM_TOTAL_SAFEPOINTSYNC_TIME_MS = 106, /* Accumulated time spent getting to safepoints */
+ JMM_TOTAL_STOPPED_TIME_MS = 107, /* Accumulated time spent at safepoints */
+ JMM_TOTAL_APP_TIME_MS = 108, /* Accumulated time spent in Java application */
+ JMM_VM_THREAD_COUNT = 109, /* Current number of VM internal threads */
+ JMM_CLASS_INIT_TOTAL_COUNT = 110, /* Number of classes for which initializers were run */
+ JMM_CLASS_INIT_TOTAL_TIME_MS = 111, /* Accumulated time spent in class initializers */
+ JMM_METHOD_DATA_SIZE_BYTES = 112, /* Size of method data in memory */
+ JMM_CLASS_VERIFY_TOTAL_TIME_MS = 113, /* Accumulated time spent in class verifier */
+ JMM_SHARED_CLASS_LOADED_COUNT = 114, /* Number of shared classes loaded */
+ JMM_SHARED_CLASS_UNLOADED_COUNT = 115, /* Number of shared classes unloaded */
+ JMM_SHARED_CLASS_LOADED_BYTES = 116, /* Number of bytes loaded shared classes */
+ JMM_SHARED_CLASS_UNLOADED_BYTES = 117, /* Number of bytes unloaded shared classes */
+
+ JMM_OS_ATTRIBUTE_INDEX = 200,
+ JMM_OS_PROCESS_ID = 201, /* Process id of the JVM */
+ JMM_OS_MEM_TOTAL_PHYSICAL_BYTES = 202, /* Physical memory size */
+
+ JMM_GC_EXT_ATTRIBUTE_INFO_SIZE = 401 /* the size of the GC specific attributes for a given GC memory manager */
+} jmmLongAttribute;
+
+typedef enum {
+ JMM_VERBOSE_GC = 21,
+ JMM_VERBOSE_CLASS = 22,
+ JMM_THREAD_CONTENTION_MONITORING = 23,
+ JMM_THREAD_CPU_TIME = 24,
+ JMM_THREAD_ALLOCATED_MEMORY = 25
+} jmmBoolAttribute;
+
+
+enum {
+ JMM_THREAD_STATE_FLAG_SUSPENDED = 0x00100000,
+ JMM_THREAD_STATE_FLAG_NATIVE = 0x00400000
+};
+
+#define JMM_THREAD_STATE_FLAG_MASK 0xFFF00000
+
+typedef enum {
+ JMM_STAT_PEAK_THREAD_COUNT = 801,
+ JMM_STAT_THREAD_CONTENTION_COUNT = 802,
+ JMM_STAT_THREAD_CONTENTION_TIME = 803,
+ JMM_STAT_THREAD_CONTENTION_STAT = 804,
+ JMM_STAT_PEAK_POOL_USAGE = 805,
+ JMM_STAT_GC_STAT = 806
+} jmmStatisticType;
+
+typedef enum {
+ JMM_USAGE_THRESHOLD_HIGH = 901,
+ JMM_USAGE_THRESHOLD_LOW = 902,
+ JMM_COLLECTION_USAGE_THRESHOLD_HIGH = 903,
+ JMM_COLLECTION_USAGE_THRESHOLD_LOW = 904
+} jmmThresholdType;
+
+/* Should match what is allowed in globals.hpp */
+typedef enum {
+ JMM_VMGLOBAL_TYPE_UNKNOWN = 0,
+ JMM_VMGLOBAL_TYPE_JBOOLEAN = 1,
+ JMM_VMGLOBAL_TYPE_JSTRING = 2,
+ JMM_VMGLOBAL_TYPE_JLONG = 3,
+ JMM_VMGLOBAL_TYPE_JDOUBLE = 4
+} jmmVMGlobalType;
+
+typedef enum {
+ JMM_VMGLOBAL_ORIGIN_DEFAULT = 1, /* Default value */
+ JMM_VMGLOBAL_ORIGIN_COMMAND_LINE = 2, /* Set at command line (or JNI invocation) */
+ JMM_VMGLOBAL_ORIGIN_MANAGEMENT = 3, /* Set via management interface */
+ JMM_VMGLOBAL_ORIGIN_ENVIRON_VAR = 4, /* Set via environment variables */
+ JMM_VMGLOBAL_ORIGIN_CONFIG_FILE = 5, /* Set via config file (such as .hotspotrc) */
+ JMM_VMGLOBAL_ORIGIN_ERGONOMIC = 6, /* Set via ergonomic */
+ JMM_VMGLOBAL_ORIGIN_ATTACH_ON_DEMAND = 7, /* Set via attach */
+ JMM_VMGLOBAL_ORIGIN_OTHER = 99 /* Set via some other mechanism */
+} jmmVMGlobalOrigin;
+
+typedef struct {
+ jstring name;
+ jvalue value;
+ jmmVMGlobalType type; /* Data type */
+ jmmVMGlobalOrigin origin; /* Default or non-default value */
+ unsigned int writeable : 1; /* dynamically writeable */
+ unsigned int external : 1; /* external supported interface */
+ unsigned int reserved : 30;
+ void *reserved1;
+ void *reserved2;
+} jmmVMGlobal;
+
+typedef struct {
+ const char* name;
+ char type;
+ const char* description;
+} jmmExtAttributeInfo;
+
+/* Caller has to set the following fields before calling GetLastGCStat
+ * o usage_before_gc - array of MemoryUsage objects
+ * o usage_after_gc - array of MemoryUsage objects
+ * o gc_ext_attribute_values_size - size of gc_ext_atttribute_values array
+ * o gc_ext_attribtue_values - array of jvalues
+ */
+typedef struct {
+ jlong gc_index; /* Index of the collections */
+ jlong start_time; /* Start time of the GC */
+ jlong end_time; /* End time of the GC */
+ jobjectArray usage_before_gc; /* Memory usage array before GC */
+ jobjectArray usage_after_gc; /* Memory usage array after GC */
+ jint gc_ext_attribute_values_size; /* set by the caller of GetGCStat */
+ jvalue* gc_ext_attribute_values; /* Array of jvalue for GC extension attributes */
+ jint num_gc_ext_attributes; /* number of GC extension attribute values s are filled */
+ /* -1 indicates gc_ext_attribute_values is not big enough */
+} jmmGCStat;
+
+typedef struct {
+ const char* name; /* Name of the diagnostic command */
+ const char* description; /* Short description */
+ const char* impact; /* Impact on the JVM */
+ const char* permission_class; /* Class name of the required permission if any */
+ const char* permission_name; /* Permission name of the required permission if any */
+ const char* permission_action; /* Action name of the required permission if any*/
+ int num_arguments; /* Number of supported options or arguments */
+ jboolean enabled; /* True if the diagnostic command can be invoked, false otherwise*/
+} dcmdInfo;
+
+typedef struct {
+ const char* name; /* Option/Argument name*/
+ const char* description; /* Short description */
+ const char* type; /* Type: STRING, BOOLEAN, etc. */
+ const char* default_string; /* Default value in a parsable string */
+ jboolean mandatory; /* True if the option/argument is mandatory */
+ jboolean option; /* True if it is an option, false if it is an argument */
+ /* (see diagnosticFramework.hpp for option/argument definitions) */
+ jboolean multiple; /* True is the option can be specified several time */
+ int position; /* Expected position for this argument (this field is */
+ /* meaningless for options) */
+} dcmdArgInfo;
+
+typedef struct jmmInterface_1_ {
+ void* reserved1;
+ void* reserved2;
+
+ jint (JNICALL *GetVersion) (JNIEnv *env);
+
+ jint (JNICALL *GetOptionalSupport) (JNIEnv *env,
+ jmmOptionalSupport* support_ptr);
+
+ jint (JNICALL *GetThreadInfo) (JNIEnv *env,
+ jlongArray ids,
+ jint maxDepth,
+ jobjectArray infoArray);
+
+ jobjectArray (JNICALL *GetMemoryPools) (JNIEnv* env, jobject mgr);
+
+ jobjectArray (JNICALL *GetMemoryManagers) (JNIEnv* env, jobject pool);
+
+ jobject (JNICALL *GetMemoryPoolUsage) (JNIEnv* env, jobject pool);
+ jobject (JNICALL *GetPeakMemoryPoolUsage) (JNIEnv* env, jobject pool);
+
+ void (JNICALL *GetThreadAllocatedMemory)
+ (JNIEnv *env,
+ jlongArray ids,
+ jlongArray sizeArray);
+
+ jobject (JNICALL *GetMemoryUsage) (JNIEnv* env, jboolean heap);
+
+ jlong (JNICALL *GetLongAttribute) (JNIEnv *env, jobject obj, jmmLongAttribute att);
+ jboolean (JNICALL *GetBoolAttribute) (JNIEnv *env, jmmBoolAttribute att);
+ jboolean (JNICALL *SetBoolAttribute) (JNIEnv *env, jmmBoolAttribute att, jboolean flag);
+
+ jint (JNICALL *GetLongAttributes) (JNIEnv *env,
+ jobject obj,
+ jmmLongAttribute* atts,
+ jint count,
+ jlong* result);
+
+ jobjectArray (JNICALL *FindCircularBlockedThreads) (JNIEnv *env);
+
+ // Not used in JDK 6 or JDK 7
+ jlong (JNICALL *GetThreadCpuTime) (JNIEnv *env, jlong thread_id);
+
+ jobjectArray (JNICALL *GetVMGlobalNames) (JNIEnv *env);
+ jint (JNICALL *GetVMGlobals) (JNIEnv *env,
+ jobjectArray names,
+ jmmVMGlobal *globals,
+ jint count);
+
+ jint (JNICALL *GetInternalThreadTimes) (JNIEnv *env,
+ jobjectArray names,
+ jlongArray times);
+
+ jboolean (JNICALL *ResetStatistic) (JNIEnv *env,
+ jvalue obj,
+ jmmStatisticType type);
+
+ void (JNICALL *SetPoolSensor) (JNIEnv *env,
+ jobject pool,
+ jmmThresholdType type,
+ jobject sensor);
+
+ jlong (JNICALL *SetPoolThreshold) (JNIEnv *env,
+ jobject pool,
+ jmmThresholdType type,
+ jlong threshold);
+ jobject (JNICALL *GetPoolCollectionUsage) (JNIEnv* env, jobject pool);
+
+ jint (JNICALL *GetGCExtAttributeInfo) (JNIEnv *env,
+ jobject mgr,
+ jmmExtAttributeInfo *ext_info,
+ jint count);
+ void (JNICALL *GetLastGCStat) (JNIEnv *env,
+ jobject mgr,
+ jmmGCStat *gc_stat);
+
+ jlong (JNICALL *GetThreadCpuTimeWithKind)
+ (JNIEnv *env,
+ jlong thread_id,
+ jboolean user_sys_cpu_time);
+ void (JNICALL *GetThreadCpuTimesWithKind)
+ (JNIEnv *env,
+ jlongArray ids,
+ jlongArray timeArray,
+ jboolean user_sys_cpu_time);
+
+ jint (JNICALL *DumpHeap0) (JNIEnv *env,
+ jstring outputfile,
+ jboolean live);
+ jobjectArray (JNICALL *FindDeadlocks) (JNIEnv *env,
+ jboolean object_monitors_only);
+ void (JNICALL *SetVMGlobal) (JNIEnv *env,
+ jstring flag_name,
+ jvalue new_value);
+ void* reserved6;
+ jobjectArray (JNICALL *DumpThreads) (JNIEnv *env,
+ jlongArray ids,
+ jboolean lockedMonitors,
+ jboolean lockedSynchronizers,
+ jint maxDepth);
+ void (JNICALL *SetGCNotificationEnabled) (JNIEnv *env,
+ jobject mgr,
+ jboolean enabled);
+ jobjectArray (JNICALL *GetDiagnosticCommands) (JNIEnv *env);
+ void (JNICALL *GetDiagnosticCommandInfo)
+ (JNIEnv *env,
+ jobjectArray cmds,
+ dcmdInfo *infoArray);
+ void (JNICALL *GetDiagnosticCommandArgumentsInfo)
+ (JNIEnv *env,
+ jstring commandName,
+ dcmdArgInfo *infoArray);
+ jstring (JNICALL *ExecuteDiagnosticCommand)
+ (JNIEnv *env,
+ jstring command);
+ void (JNICALL *SetDiagnosticFrameworkNotificationEnabled)
+ (JNIEnv *env,
+ jboolean enabled);
+} JmmInterface;
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif /* __cplusplus */
+
+#endif /* !_JAVA_JMM_H_ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/hotspot/share/include/jvm.h Mon Dec 18 10:28:43 2017 -0800
@@ -0,0 +1,1328 @@
+/*
+ * 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
+ * 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.
+ */
+
+#ifndef _JAVASOFT_JVM_H_
+#define _JAVASOFT_JVM_H_
+
+#include <sys/stat.h>
+
+#include "jni.h"
+#include "jvm_md.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * This file contains additional functions exported from the VM.
+ * These functions are complementary to the standard JNI support.
+ * There are three parts to this file:
+ *
+ * First, this file contains the VM-related functions needed by native
+ * libraries in the standard Java API. For example, the java.lang.Object
+ * class needs VM-level functions that wait for and notify monitors.
+ *
+ * Second, this file contains the functions and constant definitions
+ * needed by the byte code verifier and class file format checker.
+ * These functions allow the verifier and format checker to be written
+ * in a VM-independent way.
+ *
+ * Third, this file contains various I/O and network operations needed
+ * by the standard Java I/O and network APIs.
+ */
+
+/*
+ * Bump the version number when either of the following happens:
+ *
+ * 1. There is a change in JVM_* functions.
+ *
+ * 2. There is a change in the contract between VM and Java classes.
+ * For example, if the VM relies on a new private field in Thread
+ * class.
+ */
+
+#define JVM_INTERFACE_VERSION 5
+
+JNIEXPORT jint JNICALL
+JVM_GetInterfaceVersion(void);
+
+/*************************************************************************
+ PART 1: Functions for Native Libraries
+ ************************************************************************/
+/*
+ * java.lang.Object
+ */
+JNIEXPORT jint JNICALL
+JVM_IHashCode(JNIEnv *env, jobject obj);
+
+JNIEXPORT void JNICALL
+JVM_MonitorWait(JNIEnv *env, jobject obj, jlong ms);
+
+JNIEXPORT void JNICALL
+JVM_MonitorNotify(JNIEnv *env, jobject obj);
+
+JNIEXPORT void JNICALL
+JVM_MonitorNotifyAll(JNIEnv *env, jobject obj);
+
+JNIEXPORT jobject JNICALL
+JVM_Clone(JNIEnv *env, jobject obj);
+
+/*
+ * java.lang.String
+ */
+JNIEXPORT jstring JNICALL
+JVM_InternString(JNIEnv *env, jstring str);
+
+/*
+ * java.lang.System
+ */
+JNIEXPORT jlong JNICALL
+JVM_CurrentTimeMillis(JNIEnv *env, jclass ignored);
+
+JNIEXPORT jlong JNICALL
+JVM_NanoTime(JNIEnv *env, jclass ignored);
+
+JNIEXPORT jlong JNICALL
+JVM_GetNanoTimeAdjustment(JNIEnv *env, jclass ignored, jlong offset_secs);
+
+JNIEXPORT void JNICALL
+JVM_ArrayCopy(JNIEnv *env, jclass ignored, jobject src, jint src_pos,
+ jobject dst, jint dst_pos, jint length);
+
+JNIEXPORT jobject JNICALL
+JVM_InitProperties(JNIEnv *env, jobject p);
+
+
+/*
+ * java.lang.Runtime
+ */
+JNIEXPORT void JNICALL
+JVM_Halt(jint code);
+
+JNIEXPORT void JNICALL
+JVM_GC(void);
+
+/* Returns the number of real-time milliseconds that have elapsed since the
+ * least-recently-inspected heap object was last inspected by the garbage
+ * collector.
+ *
+ * For simple stop-the-world collectors this value is just the time
+ * since the most recent collection. For generational collectors it is the
+ * time since the oldest generation was most recently collected. Other
+ * collectors are free to return a pessimistic estimate of the elapsed time, or
+ * simply the time since the last full collection was performed.
+ *
+ * Note that in the presence of reference objects, a given object that is no
+ * longer strongly reachable may have to be inspected multiple times before it
+ * can be reclaimed.
+ */
+JNIEXPORT jlong JNICALL
+JVM_MaxObjectInspectionAge(void);
+
+JNIEXPORT jlong JNICALL
+JVM_TotalMemory(void);
+
+JNIEXPORT jlong JNICALL
+JVM_FreeMemory(void);
+
+JNIEXPORT jlong JNICALL
+JVM_MaxMemory(void);
+
+JNIEXPORT jint JNICALL
+JVM_ActiveProcessorCount(void);
+
+JNIEXPORT void * JNICALL
+JVM_LoadLibrary(const char *name);
+
+JNIEXPORT void JNICALL
+JVM_UnloadLibrary(void * handle);
+
+JNIEXPORT void * JNICALL
+JVM_FindLibraryEntry(void *handle, const char *name);
+
+JNIEXPORT jboolean JNICALL
+JVM_IsSupportedJNIVersion(jint version);
+
+JNIEXPORT jobjectArray JNICALL
+JVM_GetVmArguments(JNIEnv *env);
+
+
+/*
+ * java.lang.Throwable
+ */
+JNIEXPORT void JNICALL
+JVM_FillInStackTrace(JNIEnv *env, jobject throwable);
+
+/*
+ * java.lang.StackTraceElement
+ */
+JNIEXPORT void JNICALL
+JVM_InitStackTraceElementArray(JNIEnv *env, jobjectArray elements, jobject throwable);
+
+JNIEXPORT void JNICALL
+JVM_InitStackTraceElement(JNIEnv* env, jobject element, jobject stackFrameInfo);
+
+/*
+ * java.lang.StackWalker
+ */
+enum {
+ JVM_STACKWALK_FILL_CLASS_REFS_ONLY = 0x2,
+ JVM_STACKWALK_GET_CALLER_CLASS = 0x04,
+ JVM_STACKWALK_SHOW_HIDDEN_FRAMES = 0x20,
+ JVM_STACKWALK_FILL_LIVE_STACK_FRAMES = 0x100
+};
+
+JNIEXPORT jobject JNICALL
+JVM_CallStackWalk(JNIEnv *env, jobject stackStream, jlong mode,
+ jint skip_frames, jint frame_count, jint start_index,
+ jobjectArray frames);
+
+JNIEXPORT jint JNICALL
+JVM_MoreStackWalk(JNIEnv *env, jobject stackStream, jlong mode, jlong anchor,
+ jint frame_count, jint start_index,
+ jobjectArray frames);
+
+/*
+ * java.lang.Thread
+ */
+JNIEXPORT void JNICALL
+JVM_StartThread(JNIEnv *env, jobject thread);
+
+JNIEXPORT void JNICALL
+JVM_StopThread(JNIEnv *env, jobject thread, jobject exception);
+
+JNIEXPORT jboolean JNICALL
+JVM_IsThreadAlive(JNIEnv *env, jobject thread);
+
+JNIEXPORT void JNICALL
+JVM_SuspendThread(JNIEnv *env, jobject thread);
+
+JNIEXPORT void JNICALL
+JVM_ResumeThread(JNIEnv *env, jobject thread);
+
+JNIEXPORT void JNICALL
+JVM_SetThreadPriority(JNIEnv *env, jobject thread, jint prio);
+
+JNIEXPORT void JNICALL
+JVM_Yield(JNIEnv *env, jclass threadClass);
+
+JNIEXPORT void JNICALL
+JVM_Sleep(JNIEnv *env, jclass threadClass, jlong millis);
+
+JNIEXPORT jobject JNICALL
+JVM_CurrentThread(JNIEnv *env, jclass threadClass);
+
+JNIEXPORT jint JNICALL
+JVM_CountStackFrames(JNIEnv *env, jobject thread);
+
+JNIEXPORT void JNICALL
+JVM_Interrupt(JNIEnv *env, jobject thread);
+
+JNIEXPORT jboolean JNICALL
+JVM_IsInterrupted(JNIEnv *env, jobject thread, jboolean clearInterrupted);
+
+JNIEXPORT jboolean JNICALL
+JVM_HoldsLock(JNIEnv *env, jclass threadClass, jobject obj);
+
+JNIEXPORT void JNICALL
+JVM_DumpAllStacks(JNIEnv *env, jclass unused);
+
+JNIEXPORT jobjectArray JNICALL
+JVM_GetAllThreads(JNIEnv *env, jclass dummy);
+
+JNIEXPORT void JNICALL
+JVM_SetNativeThreadName(JNIEnv *env, jobject jthread, jstring name);
+
+/* getStackTrace() and getAllStackTraces() method */
+JNIEXPORT jobjectArray JNICALL
+JVM_DumpThreads(JNIEnv *env, jclass threadClass, jobjectArray threads);
+
+/*
+ * java.lang.SecurityManager
+ */
+JNIEXPORT jobjectArray JNICALL
+JVM_GetClassContext(JNIEnv *env);
+
+/*
+ * java.lang.Package
+ */
+JNIEXPORT jstring JNICALL
+JVM_GetSystemPackage(JNIEnv *env, jstring name);
+
+JNIEXPORT jobjectArray JNICALL
+JVM_GetSystemPackages(JNIEnv *env);
+
+/*
+ * java.lang.ref.Reference
+ */
+JNIEXPORT jobject JNICALL
+JVM_GetAndClearReferencePendingList(JNIEnv *env);
+
+JNIEXPORT jboolean JNICALL
+JVM_HasReferencePendingList(JNIEnv *env);
+
+JNIEXPORT void JNICALL
+JVM_WaitForReferencePendingList(JNIEnv *env);
+
+/*
+ * java.io.ObjectInputStream
+ */
+JNIEXPORT jobject JNICALL
+JVM_LatestUserDefinedLoader(JNIEnv *env);
+
+/*
+ * java.lang.reflect.Array
+ */
+JNIEXPORT jint JNICALL
+JVM_GetArrayLength(JNIEnv *env, jobject arr);
+
+JNIEXPORT jobject JNICALL
+JVM_GetArrayElement(JNIEnv *env, jobject arr, jint index);
+
+JNIEXPORT jvalue JNICALL
+JVM_GetPrimitiveArrayElement(JNIEnv *env, jobject arr, jint index, jint wCode);
+
+JNIEXPORT void JNICALL
+JVM_SetArrayElement(JNIEnv *env, jobject arr, jint index, jobject val);
+
+JNIEXPORT void JNICALL
+JVM_SetPrimitiveArrayElement(JNIEnv *env, jobject arr, jint index, jvalue v,
+ unsigned char vCode);
+
+JNIEXPORT jobject JNICALL
+JVM_NewArray(JNIEnv *env, jclass eltClass, jint length);
+
+JNIEXPORT jobject JNICALL
+JVM_NewMultiArray(JNIEnv *env, jclass eltClass, jintArray dim);
+
+/*
+ * java.lang.Class and java.lang.ClassLoader
+ */
+
+#define JVM_CALLER_DEPTH -1
+
+/*
+ * Returns the immediate caller class of the native method invoking
+ * JVM_GetCallerClass. The Method.invoke and other frames due to
+ * reflection machinery are skipped.
+ *
+ * The depth parameter must be -1 (JVM_DEPTH). The caller is expected
+ * to be marked with sun.reflect.CallerSensitive. The JVM will throw
+ * an error if it is not marked propertly.
+ */
+JNIEXPORT jclass JNICALL
+JVM_GetCallerClass(JNIEnv *env, int depth);
+
+
+/*
+ * Find primitive classes
+ * utf: class name
+ */
+JNIEXPORT jclass JNICALL
+JVM_FindPrimitiveClass(JNIEnv *env, const char *utf);
+
+
+/*
+ * Find a class from a boot class loader. Returns NULL if class not found.
+ */
+JNIEXPORT jclass JNICALL
+JVM_FindClassFromBootLoader(JNIEnv *env, const char *name);
+
+/*
+ * Find a class from a given class loader. Throws ClassNotFoundException.
+ * name: name of class
+ * init: whether initialization is done
+ * loader: class loader to look up the class. This may not be the same as the caller's
+ * class loader.
+ * caller: initiating class. The initiating class may be null when a security
+ * manager is not installed.
+ */
+JNIEXPORT jclass JNICALL
+JVM_FindClassFromCaller(JNIEnv *env, const char *name, jboolean init,
+ jobject loader, jclass caller);
+
+/*
+ * Find a class from a given class.
+ */
+JNIEXPORT jclass JNICALL
+JVM_FindClassFromClass(JNIEnv *env, const char *name, jboolean init,
+ jclass from);
+
+/* Find a loaded class cached by the VM */
+JNIEXPORT jclass JNICALL
+JVM_FindLoadedClass(JNIEnv *env, jobject loader, jstring name);
+
+/* Define a class */
+JNIEXPORT jclass JNICALL
+JVM_DefineClass(JNIEnv *env, const char *name, jobject loader, const jbyte *buf,
+ jsize len, jobject pd);
+
+/* Define a class with a source (added in JDK1.5) */
+JNIEXPORT jclass JNICALL
+JVM_DefineClassWithSource(JNIEnv *env, const char *name, jobject loader,
+ const jbyte *buf, jsize len, jobject pd,
+ const char *source);
+
+/*
+ * Module support funcions
+ */
+
+/*
+ * Define a module with the specified packages and bind the module to the
+ * given class loader.
+ * module: module to define
+ * is_open: specifies if module is open (currently ignored)
+ * version: the module version
+ * location: the module location
+ * packages: list of packages in the module
+ * num_packages: number of packages in the module
+ */
+JNIEXPORT void JNICALL
+JVM_DefineModule(JNIEnv *env, jobject module, jboolean is_open, jstring version,
+ jstring location, const char* const* packages, jsize num_packages);
+
+/*
+ * Set the boot loader's unnamed module.
+ * module: boot loader's unnamed module
+ */
+JNIEXPORT void JNICALL
+JVM_SetBootLoaderUnnamedModule(JNIEnv *env, jobject module);
+
+/*
+ * Do a qualified export of a package.
+ * from_module: module containing the package to export
+ * package: name of the package to export
+ * to_module: module to export the package to
+ */
+JNIEXPORT void JNICALL
+JVM_AddModuleExports(JNIEnv *env, jobject from_module, const char* package, jobject to_module);
+
+/*
+ * Do an export of a package to all unnamed modules.
+ * from_module: module containing the package to export
+ * package: name of the package to export to all unnamed modules
+ */
+JNIEXPORT void JNICALL
+JVM_AddModuleExportsToAllUnnamed(JNIEnv *env, jobject from_module, const char* package);
+
+/*
+ * Do an unqualified export of a package.
+ * from_module: module containing the package to export
+ * package: name of the package to export
+ */
+JNIEXPORT void JNICALL
+JVM_AddModuleExportsToAll(JNIEnv *env, jobject from_module, const char* package);
+
+/*
+ * Add a module to the list of modules that a given module can read.
+ * from_module: module requesting read access
+ * source_module: module that from_module wants to read
+ */
+JNIEXPORT void JNICALL
+JVM_AddReadsModule(JNIEnv *env, jobject from_module, jobject source_module);
+
+/*
+ * Reflection support functions
+ */
+
+JNIEXPORT jstring JNICALL
+JVM_GetClassName(JNIEnv *env, jclass cls);
+
+JNIEXPORT jobjectArray JNICALL
+JVM_GetClassInterfaces(JNIEnv *env, jclass cls);
+
+JNIEXPORT jboolean JNICALL
+JVM_IsInterface(JNIEnv *env, jclass cls);
+
+JNIEXPORT jobjectArray JNICALL
+JVM_GetClassSigners(JNIEnv *env, jclass cls);
+
+JNIEXPORT void JNICALL
+JVM_SetClassSigners(JNIEnv *env, jclass cls, jobjectArray signers);
+
+JNIEXPORT jobject JNICALL
+JVM_GetProtectionDomain(JNIEnv *env, jclass cls);
+
+JNIEXPORT jboolean JNICALL
+JVM_IsArrayClass(JNIEnv *env, jclass cls);
+
+JNIEXPORT jboolean JNICALL
+JVM_IsPrimitiveClass(JNIEnv *env, jclass cls);
+
+JNIEXPORT jint JNICALL
+JVM_GetClassModifiers(JNIEnv *env, jclass cls);
+
+JNIEXPORT jobjectArray JNICALL
+JVM_GetDeclaredClasses(JNIEnv *env, jclass ofClass);
+
+JNIEXPORT jclass JNICALL
+JVM_GetDeclaringClass(JNIEnv *env, jclass ofClass);
+
+JNIEXPORT jstring JNICALL
+JVM_GetSimpleBinaryName(JNIEnv *env, jclass ofClass);
+
+/* Generics support (JDK 1.5) */
+JNIEXPORT jstring JNICALL
+JVM_GetClassSignature(JNIEnv *env, jclass cls);
+
+/* Annotations support (JDK 1.5) */
+JNIEXPORT jbyteArray JNICALL
+JVM_GetClassAnnotations(JNIEnv *env, jclass cls);
+
+/* Type use annotations support (JDK 1.8) */
+
+JNIEXPORT jbyteArray JNICALL
+JVM_GetClassTypeAnnotations(JNIEnv *env, jclass cls);
+
+JNIEXPORT jbyteArray JNICALL
+JVM_GetFieldTypeAnnotations(JNIEnv *env, jobject field);
+
+JNIEXPORT jbyteArray JNICALL
+JVM_GetMethodTypeAnnotations(JNIEnv *env, jobject method);
+
+/*
+ * New (JDK 1.4) reflection implementation
+ */
+
+JNIEXPORT jobjectArray JNICALL
+JVM_GetClassDeclaredMethods(JNIEnv *env, jclass ofClass, jboolean publicOnly);
+
+JNIEXPORT jobjectArray JNICALL
+JVM_GetClassDeclaredFields(JNIEnv *env, jclass ofClass, jboolean publicOnly);
+
+JNIEXPORT jobjectArray JNICALL
+JVM_GetClassDeclaredConstructors(JNIEnv *env, jclass ofClass, jboolean publicOnly);
+
+/* Differs from JVM_GetClassModifiers in treatment of inner classes.
+ This returns the access flags for the class as specified in the
+ class file rather than searching the InnerClasses attribute (if
+ present) to find the source-level access flags. Only the values of
+ the low 13 bits (i.e., a mask of 0x1FFF) are guaranteed to be
+ valid. */
+JNIEXPORT jint JNICALL
+JVM_GetClassAccessFlags(JNIEnv *env, jclass cls);
+
+/* The following two reflection routines are still needed due to startup time issues */
+/*
+ * java.lang.reflect.Method
+ */
+JNIEXPORT jobject JNICALL
+JVM_InvokeMethod(JNIEnv *env, jobject method, jobject obj, jobjectArray args0);
+
+/*
+ * java.lang.reflect.Constructor
+ */
+JNIEXPORT jobject JNICALL
+JVM_NewInstanceFromConstructor(JNIEnv *env, jobject c, jobjectArray args0);
+
+/*
+ * Constant pool access; currently used to implement reflective access to annotations (JDK 1.5)
+ */
+
+JNIEXPORT jobject JNICALL
+JVM_GetClassConstantPool(JNIEnv *env, jclass cls);
+
+JNIEXPORT jint JNICALL JVM_ConstantPoolGetSize
+(JNIEnv *env, jobject unused, jobject jcpool);
+
+JNIEXPORT jclass JNICALL JVM_ConstantPoolGetClassAt
+(JNIEnv *env, jobject unused, jobject jcpool, jint index);
+
+JNIEXPORT jclass JNICALL JVM_ConstantPoolGetClassAtIfLoaded
+(JNIEnv *env, jobject unused, jobject jcpool, jint index);
+
+JNIEXPORT jint JNICALL JVM_ConstantPoolGetClassRefIndexAt
+(JNIEnv *env, jobject obj, jobject unused, jint index);
+
+JNIEXPORT jobject JNICALL JVM_ConstantPoolGetMethodAt
+(JNIEnv *env, jobject unused, jobject jcpool, jint index);
+
+JNIEXPORT jobject JNICALL JVM_ConstantPoolGetMethodAtIfLoaded
+(JNIEnv *env, jobject unused, jobject jcpool, jint index);
+
+JNIEXPORT jobject JNICALL JVM_ConstantPoolGetFieldAt
+(JNIEnv *env, jobject unused, jobject jcpool, jint index);
+
+JNIEXPORT jobject JNICALL JVM_ConstantPoolGetFieldAtIfLoaded
+(JNIEnv *env, jobject unused, jobject jcpool, jint index);
+
+JNIEXPORT jobjectArray JNICALL JVM_ConstantPoolGetMemberRefInfoAt
+(JNIEnv *env, jobject unused, jobject jcpool, jint index);
+
+JNIEXPORT jint JNICALL JVM_ConstantPoolGetNameAndTypeRefIndexAt
+(JNIEnv *env, jobject obj, jobject unused, jint index);
+
+JNIEXPORT jobjectArray JNICALL JVM_ConstantPoolGetNameAndTypeRefInfoAt
+(JNIEnv *env, jobject obj, jobject unused, jint index);
+
+JNIEXPORT jint JNICALL JVM_ConstantPoolGetIntAt
+(JNIEnv *env, jobject unused, jobject jcpool, jint index);
+
+JNIEXPORT jlong JNICALL JVM_ConstantPoolGetLongAt
+(JNIEnv *env, jobject unused, jobject jcpool, jint index);
+
+JNIEXPORT jfloat JNICALL JVM_ConstantPoolGetFloatAt
+(JNIEnv *env, jobject unused, jobject jcpool, jint index);
+
+JNIEXPORT jdouble JNICALL JVM_ConstantPoolGetDoubleAt
+(JNIEnv *env, jobject unused, jobject jcpool, jint index);
+
+JNIEXPORT jstring JNICALL JVM_ConstantPoolGetStringAt
+(JNIEnv *env, jobject unused, jobject jcpool, jint index);
+
+JNIEXPORT jstring JNICALL JVM_ConstantPoolGetUTF8At
+(JNIEnv *env, jobject unused, jobject jcpool, jint index);
+
+JNIEXPORT jbyte JNICALL JVM_ConstantPoolGetTagAt
+(JNIEnv *env, jobject unused, jobject jcpool, jint index);
+
+/*
+ * Parameter reflection
+ */
+
+JNIEXPORT jobjectArray JNICALL
+JVM_GetMethodParameters(JNIEnv *env, jobject method);
+
+/*
+ * java.security.*
+ */
+
+JNIEXPORT jobject JNICALL
+JVM_DoPrivileged(JNIEnv *env, jclass cls,
+ jobject action, jobject context, jboolean wrapException);
+
+JNIEXPORT jobject JNICALL
+JVM_GetInheritedAccessControlContext(JNIEnv *env, jclass cls);
+
+JNIEXPORT jobject JNICALL
+JVM_GetStackAccessControlContext(JNIEnv *env, jclass cls);
+
+/*
+ * Signal support, used to implement the shutdown sequence. Every VM must
+ * support JVM_SIGINT and JVM_SIGTERM, raising the former for user interrupts
+ * (^C) and the latter for external termination (kill, system shutdown, etc.).
+ * Other platform-dependent signal values may also be supported.
+ */
+
+JNIEXPORT void * JNICALL
+JVM_RegisterSignal(jint sig, void *handler);
+
+JNIEXPORT jboolean JNICALL
+JVM_RaiseSignal(jint sig);
+
+JNIEXPORT jint JNICALL
+JVM_FindSignal(const char *name);
+
+/*
+ * Retrieve the assertion directives for the specified class.
+ */
+JNIEXPORT jboolean JNICALL
+JVM_DesiredAssertionStatus(JNIEnv *env, jclass unused, jclass cls);
+
+/*
+ * Retrieve the assertion directives from the VM.
+ */
+JNIEXPORT jobject JNICALL
+JVM_AssertionStatusDirectives(JNIEnv *env, jclass unused);
+
+/*
+ * java.util.concurrent.atomic.AtomicLong
+ */
+JNIEXPORT jboolean JNICALL
+JVM_SupportsCX8(void);
+
+/*
+ * com.sun.dtrace.jsdt support
+ */
+
+#define JVM_TRACING_DTRACE_VERSION 1
+
+/*
+ * Structure to pass one probe description to JVM
+ */
+typedef struct {
+ jmethodID method;
+ jstring function;
+ jstring name;
+ void* reserved[4]; // for future use
+} JVM_DTraceProbe;
+
+/**
+ * Encapsulates the stability ratings for a DTrace provider field
+ */
+typedef struct {
+ jint nameStability;
+ jint dataStability;
+ jint dependencyClass;
+} JVM_DTraceInterfaceAttributes;
+
+/*
+ * Structure to pass one provider description to JVM
+ */
+typedef struct {
+ jstring name;
+ JVM_DTraceProbe* probes;
+ jint probe_count;
+ JVM_DTraceInterfaceAttributes providerAttributes;
+ JVM_DTraceInterfaceAttributes moduleAttributes;
+ JVM_DTraceInterfaceAttributes functionAttributes;
+ JVM_DTraceInterfaceAttributes nameAttributes;
+ JVM_DTraceInterfaceAttributes argsAttributes;
+ void* reserved[4]; // for future use
+} JVM_DTraceProvider;
+
+/*
+ * Get the version number the JVM was built with
+ */
+JNIEXPORT jint JNICALL
+JVM_DTraceGetVersion(JNIEnv* env);
+
+/*
+ * Register new probe with given signature, return global handle
+ *
+ * The version passed in is the version that the library code was
+ * built with.
+ */
+JNIEXPORT jlong JNICALL
+JVM_DTraceActivate(JNIEnv* env, jint version, jstring module_name,
+ jint providers_count, JVM_DTraceProvider* providers);
+
+/*
+ * Check JSDT probe
+ */
+JNIEXPORT jboolean JNICALL
+JVM_DTraceIsProbeEnabled(JNIEnv* env, jmethodID method);
+
+/*
+ * Destroy custom DOF
+ */
+JNIEXPORT void JNICALL
+JVM_DTraceDispose(JNIEnv* env, jlong activation_handle);
+
+/*
+ * Check to see if DTrace is supported by OS
+ */
+JNIEXPORT jboolean JNICALL
+JVM_DTraceIsSupported(JNIEnv* env);
+
+/*************************************************************************
+ PART 2: Support for the Verifier and Class File Format Checker
+ ************************************************************************/
+/*
+ * Return the class name in UTF format. The result is valid
+ * until JVM_ReleaseUTf is called.
+ *
+ * The caller must treat the string as a constant and not modify it
+ * in any way.
+ */
+JNIEXPORT const char * JNICALL
+JVM_GetClassNameUTF(JNIEnv *env, jclass cb);
+
+/*
+ * Returns the constant pool types in the buffer provided by "types."
+ */
+JNIEXPORT void JNICALL
+JVM_GetClassCPTypes(JNIEnv *env, jclass cb, unsigned char *types);
+
+/*
+ * Returns the number of Constant Pool entries.
+ */
+JNIEXPORT jint JNICALL
+JVM_GetClassCPEntriesCount(JNIEnv *env, jclass cb);
+
+/*
+ * Returns the number of *declared* fields or methods.
+ */
+JNIEXPORT jint JNICALL
+JVM_GetClassFieldsCount(JNIEnv *env, jclass cb);
+
+JNIEXPORT jint JNICALL
+JVM_GetClassMethodsCount(JNIEnv *env, jclass cb);
+
+/*
+ * Returns the CP indexes of exceptions raised by a given method.
+ * Places the result in the given buffer.
+ *
+ * The method is identified by method_index.
+ */
+JNIEXPORT void JNICALL
+JVM_GetMethodIxExceptionIndexes(JNIEnv *env, jclass cb, jint method_index,
+ unsigned short *exceptions);
+/*
+ * Returns the number of exceptions raised by a given method.
+ * The method is identified by method_index.
+ */
+JNIEXPORT jint JNICALL
+JVM_GetMethodIxExceptionsCount(JNIEnv *env, jclass cb, jint method_index);
+
+/*
+ * Returns the byte code sequence of a given method.
+ * Places the result in the given buffer.
+ *
+ * The method is identified by method_index.
+ */
+JNIEXPORT void JNICALL
+JVM_GetMethodIxByteCode(JNIEnv *env, jclass cb, jint method_index,
+ unsigned char *code);
+
+/*
+ * Returns the length of the byte code sequence of a given method.
+ * The method is identified by method_index.
+ */
+JNIEXPORT jint JNICALL
+JVM_GetMethodIxByteCodeLength(JNIEnv *env, jclass cb, jint method_index);
+
+/*
+ * A structure used to a capture exception table entry in a Java method.
+ */
+typedef struct {
+ jint start_pc;
+ jint end_pc;
+ jint handler_pc;
+ jint catchType;
+} JVM_ExceptionTableEntryType;
+
+/*
+ * Returns the exception table entry at entry_index of a given method.
+ * Places the result in the given buffer.
+ *
+ * The method is identified by method_index.
+ */
+JNIEXPORT void JNICALL
+JVM_GetMethodIxExceptionTableEntry(JNIEnv *env, jclass cb, jint method_index,
+ jint entry_index,
+ JVM_ExceptionTableEntryType *entry);
+
+/*
+ * Returns the length of the exception table of a given method.
+ * The method is identified by method_index.
+ */
+JNIEXPORT jint JNICALL
+JVM_GetMethodIxExceptionTableLength(JNIEnv *env, jclass cb, int index);
+
+/*
+ * Returns the modifiers of a given field.
+ * The field is identified by field_index.
+ */
+JNIEXPORT jint JNICALL
+JVM_GetFieldIxModifiers(JNIEnv *env, jclass cb, int index);
+
+/*
+ * Returns the modifiers of a given method.
+ * The method is identified by method_index.
+ */
+JNIEXPORT jint JNICALL
+JVM_GetMethodIxModifiers(JNIEnv *env, jclass cb, int index);
+
+/*
+ * Returns the number of local variables of a given method.
+ * The method is identified by method_index.
+ */
+JNIEXPORT jint JNICALL
+JVM_GetMethodIxLocalsCount(JNIEnv *env, jclass cb, int index);
+
+/*
+ * Returns the number of arguments (including this pointer) of a given method.
+ * The method is identified by method_index.
+ */
+JNIEXPORT jint JNICALL
+JVM_GetMethodIxArgsSize(JNIEnv *env, jclass cb, int index);
+
+/*
+ * Returns the maximum amount of stack (in words) used by a given method.
+ * The method is identified by method_index.
+ */
+JNIEXPORT jint JNICALL
+JVM_GetMethodIxMaxStack(JNIEnv *env, jclass cb, int index);
+
+/*
+ * Is a given method a constructor.
+ * The method is identified by method_index.
+ */
+JNIEXPORT jboolean JNICALL
+JVM_IsConstructorIx(JNIEnv *env, jclass cb, int index);
+
+/*
+ * Is the given method generated by the VM.
+ * The method is identified by method_index.
+ */
+JNIEXPORT jboolean JNICALL
+JVM_IsVMGeneratedMethodIx(JNIEnv *env, jclass cb, int index);
+
+/*
+ * Returns the name of a given method in UTF format.
+ * The result remains valid until JVM_ReleaseUTF is called.
+ *
+ * The caller must treat the string as a constant and not modify it
+ * in any way.
+ */
+JNIEXPORT const char * JNICALL
+JVM_GetMethodIxNameUTF(JNIEnv *env, jclass cb, jint index);
+
+/*
+ * Returns the signature of a given method in UTF format.
+ * The result remains valid until JVM_ReleaseUTF is called.
+ *
+ * The caller must treat the string as a constant and not modify it
+ * in any way.
+ */
+JNIEXPORT const char * JNICALL
+JVM_GetMethodIxSignatureUTF(JNIEnv *env, jclass cb, jint index);
+
+/*
+ * Returns the name of the field referred to at a given constant pool
+ * index.
+ *
+ * The result is in UTF format and remains valid until JVM_ReleaseUTF
+ * is called.
+ *
+ * The caller must treat the string as a constant and not modify it
+ * in any way.
+ */
+JNIEXPORT const char * JNICALL
+JVM_GetCPFieldNameUTF(JNIEnv *env, jclass cb, jint index);
+
+/*
+ * Returns the name of the method referred to at a given constant pool
+ * index.
+ *
+ * The result is in UTF format and remains valid until JVM_ReleaseUTF
+ * is called.
+ *
+ * The caller must treat the string as a constant and not modify it
+ * in any way.
+ */
+JNIEXPORT const char * JNICALL
+JVM_GetCPMethodNameUTF(JNIEnv *env, jclass cb, jint index);
+
+/*
+ * Returns the signature of the method referred to at a given constant pool
+ * index.
+ *
+ * The result is in UTF format and remains valid until JVM_ReleaseUTF
+ * is called.
+ *
+ * The caller must treat the string as a constant and not modify it
+ * in any way.
+ */
+JNIEXPORT const char * JNICALL
+JVM_GetCPMethodSignatureUTF(JNIEnv *env, jclass cb, jint index);
+
+/*
+ * Returns the signature of the field referred to at a given constant pool
+ * index.
+ *
+ * The result is in UTF format and remains valid until JVM_ReleaseUTF
+ * is called.
+ *
+ * The caller must treat the string as a constant and not modify it
+ * in any way.
+ */
+JNIEXPORT const char * JNICALL
+JVM_GetCPFieldSignatureUTF(JNIEnv *env, jclass cb, jint index);
+
+/*
+ * Returns the class name referred to at a given constant pool index.
+ *
+ * The result is in UTF format and remains valid until JVM_ReleaseUTF
+ * is called.
+ *
+ * The caller must treat the string as a constant and not modify it
+ * in any way.
+ */
+JNIEXPORT const char * JNICALL
+JVM_GetCPClassNameUTF(JNIEnv *env, jclass cb, jint index);
+
+/*
+ * Returns the class name referred to at a given constant pool index.
+ *
+ * The constant pool entry must refer to a CONSTANT_Fieldref.
+ *
+ * The result is in UTF format and remains valid until JVM_ReleaseUTF
+ * is called.
+ *
+ * The caller must treat the string as a constant and not modify it
+ * in any way.
+ */
+JNIEXPORT const char * JNICALL
+JVM_GetCPFieldClassNameUTF(JNIEnv *env, jclass cb, jint index);
+
+/*
+ * Returns the class name referred to at a given constant pool index.
+ *
+ * The constant pool entry must refer to CONSTANT_Methodref or
+ * CONSTANT_InterfaceMethodref.
+ *
+ * The result is in UTF format and remains valid until JVM_ReleaseUTF
+ * is called.
+ *
+ * The caller must treat the string as a constant and not modify it
+ * in any way.
+ */
+JNIEXPORT const char * JNICALL
+JVM_GetCPMethodClassNameUTF(JNIEnv *env, jclass cb, jint index);
+
+/*
+ * Returns the modifiers of a field in calledClass. The field is
+ * referred to in class cb at constant pool entry index.
+ *
+ * The caller must treat the string as a constant and not modify it
+ * in any way.
+ *
+ * Returns -1 if the field does not exist in calledClass.
+ */
+JNIEXPORT jint JNICALL
+JVM_GetCPFieldModifiers(JNIEnv *env, jclass cb, int index, jclass calledClass);
+
+/*
+ * Returns the modifiers of a method in calledClass. The method is
+ * referred to in class cb at constant pool entry index.
+ *
+ * Returns -1 if the method does not exist in calledClass.
+ */
+JNIEXPORT jint JNICALL
+JVM_GetCPMethodModifiers(JNIEnv *env, jclass cb, int index, jclass calledClass);
+
+/*
+ * Releases the UTF string obtained from the VM.
+ */
+JNIEXPORT void JNICALL
+JVM_ReleaseUTF(const char *utf);
+
+/*
+ * Compare if two classes are in the same package.
+ */
+JNIEXPORT jboolean JNICALL
+JVM_IsSameClassPackage(JNIEnv *env, jclass class1, jclass class2);
+
+/* Get classfile constants */
+#include "classfile_constants.h"
+
+/*
+ * A function defined by the byte-code verifier and called by the VM.
+ * This is not a function implemented in the VM.
+ *
+ * Returns JNI_FALSE if verification fails. A detailed error message
+ * will be places in msg_buf, whose length is specified by buf_len.
+ */
+typedef jboolean (*verifier_fn_t)(JNIEnv *env,
+ jclass cb,
+ char * msg_buf,
+ jint buf_len);
+
+
+/*
+ * Support for a VM-independent class format checker.
+ */
+typedef struct {
+ unsigned long code; /* byte code */
+ unsigned long excs; /* exceptions */
+ unsigned long etab; /* catch table */
+ unsigned long lnum; /* line number */
+ unsigned long lvar; /* local vars */
+} method_size_info;
+
+typedef struct {
+ unsigned int constants; /* constant pool */
+ unsigned int fields;
+ unsigned int methods;
+ unsigned int interfaces;
+ unsigned int fields2; /* number of static 2-word fields */
+ unsigned int innerclasses; /* # of records in InnerClasses attr */
+
+ method_size_info clinit; /* memory used in clinit */
+ method_size_info main; /* used everywhere else */
+} class_size_info;
+
+/*
+ * Functions defined in libjava.so to perform string conversions.
+ *
+ */
+
+typedef jstring (*to_java_string_fn_t)(JNIEnv *env, char *str);
+
+typedef char *(*to_c_string_fn_t)(JNIEnv *env, jstring s, jboolean *b);
+
+/* This is the function defined in libjava.so that performs class
+ * format checks. This functions fills in size information about
+ * the class file and returns:
+ *
+ * 0: good
+ * -1: out of memory
+ * -2: bad format
+ * -3: unsupported version
+ * -4: bad class name
+ */
+
+typedef jint (*check_format_fn_t)(char *class_name,
+ unsigned char *data,
+ unsigned int data_size,
+ class_size_info *class_size,
+ char *message_buffer,
+ jint buffer_length,
+ jboolean measure_only,
+ jboolean check_relaxed);
+
+#define JVM_RECOGNIZED_CLASS_MODIFIERS (JVM_ACC_PUBLIC | \
+ JVM_ACC_FINAL | \
+ JVM_ACC_SUPER | \
+ JVM_ACC_INTERFACE | \
+ JVM_ACC_ABSTRACT | \
+ JVM_ACC_ANNOTATION | \
+ JVM_ACC_ENUM | \
+ JVM_ACC_SYNTHETIC)
+
+#define JVM_RECOGNIZED_FIELD_MODIFIERS (JVM_ACC_PUBLIC | \
+ JVM_ACC_PRIVATE | \
+ JVM_ACC_PROTECTED | \
+ JVM_ACC_STATIC | \
+ JVM_ACC_FINAL | \
+ JVM_ACC_VOLATILE | \
+ JVM_ACC_TRANSIENT | \
+ JVM_ACC_ENUM | \
+ JVM_ACC_SYNTHETIC)
+
+#define JVM_RECOGNIZED_METHOD_MODIFIERS (JVM_ACC_PUBLIC | \
+ JVM_ACC_PRIVATE | \
+ JVM_ACC_PROTECTED | \
+ JVM_ACC_STATIC | \
+ JVM_ACC_FINAL | \
+ JVM_ACC_SYNCHRONIZED | \
+ JVM_ACC_BRIDGE | \
+ JVM_ACC_VARARGS | \
+ JVM_ACC_NATIVE | \
+ JVM_ACC_ABSTRACT | \
+ JVM_ACC_STRICT | \
+ JVM_ACC_SYNTHETIC)
+
+/*
+ * This is the function defined in libjava.so to perform path
+ * canonicalization. VM call this function before opening jar files
+ * to load system classes.
+ *
+ */
+
+typedef int (*canonicalize_fn_t)(JNIEnv *env, char *orig, char *out, int len);
+
+/*************************************************************************
+ PART 3: I/O and Network Support
+ ************************************************************************/
+
+/*
+ * Convert a pathname into native format. This function does syntactic
+ * cleanup, such as removing redundant separator characters. It modifies
+ * the given pathname string in place.
+ */
+JNIEXPORT char * JNICALL
+JVM_NativePath(char *);
+
+/*
+ * The standard printing functions supported by the Java VM. (Should they
+ * be renamed to JVM_* in the future?
+ */
+
+/* jio_snprintf() and jio_vsnprintf() behave like snprintf(3) and vsnprintf(3),
+ * respectively, with the following differences:
+ * - The string written to str is always zero-terminated, also in case of
+ * truncation (count is too small to hold the result string), unless count
+ * is 0. In case of truncation count-1 characters are written and '\0'
+ * appendend.
+ * - If count is too small to hold the whole string, -1 is returned across
+ * all platforms. */
+
+JNIEXPORT int
+jio_vsnprintf(char *str, size_t count, const char *fmt, va_list args);
+
+JNIEXPORT int
+jio_snprintf(char *str, size_t count, const char *fmt, ...);
+
+JNIEXPORT int
+jio_fprintf(FILE *, const char *fmt, ...);
+
+JNIEXPORT int
+jio_vfprintf(FILE *, const char *fmt, va_list args);
+
+
+JNIEXPORT void * JNICALL
+JVM_RawMonitorCreate(void);
+
+JNIEXPORT void JNICALL
+JVM_RawMonitorDestroy(void *mon);
+
+JNIEXPORT jint JNICALL
+JVM_RawMonitorEnter(void *mon);
+
+JNIEXPORT void JNICALL
+JVM_RawMonitorExit(void *mon);
+
+/*
+ * java.lang.management support
+ */
+JNIEXPORT void* JNICALL
+JVM_GetManagement(jint version);
+
+/*
+ * com.sun.tools.attach.VirtualMachine support
+ *
+ * Initialize the agent properties with the properties maintained in the VM.
+ */
+JNIEXPORT jobject JNICALL
+JVM_InitAgentProperties(JNIEnv *env, jobject agent_props);
+
+JNIEXPORT jstring JNICALL
+JVM_GetTemporaryDirectory(JNIEnv *env);
+
+/* Generics reflection support.
+ *
+ * Returns information about the given class's EnclosingMethod
+ * attribute, if present, or null if the class had no enclosing
+ * method.
+ *
+ * If non-null, the returned array contains three elements. Element 0
+ * is the java.lang.Class of which the enclosing method is a member,
+ * and elements 1 and 2 are the java.lang.Strings for the enclosing
+ * method's name and descriptor, respectively.
+ */
+JNIEXPORT jobjectArray JNICALL
+JVM_GetEnclosingMethodInfo(JNIEnv* env, jclass ofClass);
+
+/* =========================================================================
+ * The following defines a private JVM interface that the JDK can query
+ * for the JVM version and capabilities. sun.misc.Version defines
+ * the methods for getting the VM version and its capabilities.
+ *
+ * When a new bit is added, the following should be updated to provide
+ * access to the new capability:
+ * HS: JVM_GetVersionInfo and Abstract_VM_Version class
+ * SDK: Version class
+ *
+ * Similary, a private JDK interface JDK_GetVersionInfo0 is defined for
+ * JVM to query for the JDK version and capabilities.
+ *
+ * When a new bit is added, the following should be updated to provide
+ * access to the new capability:
+ * HS: JDK_Version class
+ * SDK: JDK_GetVersionInfo0
+ *
+ * ==========================================================================
+ */
+typedef struct {
+ unsigned int jvm_version; /* Encoded $VNUM as specified by JEP-223 */
+ unsigned int patch_version : 8; /* JEP-223 patch version */
+ unsigned int reserved3 : 8;
+ unsigned int reserved1 : 16;
+ unsigned int reserved2;
+
+ /* The following bits represents JVM supports that JDK has dependency on.
+ * JDK can use these bits to determine which JVM version
+ * and support it has to maintain runtime compatibility.
+ *
+ * When a new bit is added in a minor or update release, make sure
+ * the new bit is also added in the main/baseline.
+ */
+ unsigned int is_attach_supported : 1;
+ unsigned int : 31;
+ unsigned int : 32;
+ unsigned int : 32;
+} jvm_version_info;
+
+#define JVM_VERSION_MAJOR(version) ((version & 0xFF000000) >> 24)
+#define JVM_VERSION_MINOR(version) ((version & 0x00FF0000) >> 16)
+#define JVM_VERSION_SECURITY(version) ((version & 0x0000FF00) >> 8)
+#define JVM_VERSION_BUILD(version) ((version & 0x000000FF))
+
+JNIEXPORT void JNICALL
+JVM_GetVersionInfo(JNIEnv* env, jvm_version_info* info, size_t info_size);
+
+typedef struct {
+ unsigned int jdk_version; /* Encoded $VNUM as specified by JEP-223 */
+ unsigned int patch_version : 8; /* JEP-223 patch version */
+ unsigned int reserved3 : 8;
+ unsigned int reserved1 : 16;
+ unsigned int reserved2;
+
+ /* The following bits represents new JDK supports that VM has dependency on.
+ * VM implementation can use these bits to determine which JDK version
+ * and support it has to maintain runtime compatibility.
+ *
+ * When a new bit is added in a minor or update release, make sure
+ * the new bit is also added in the main/baseline.
+ */
+ unsigned int thread_park_blocker : 1;
+ unsigned int post_vm_init_hook_enabled : 1;
+ unsigned int pending_list_uses_discovered_field : 1;
+ unsigned int : 29;
+ unsigned int : 32;
+ unsigned int : 32;
+} jdk_version_info;
+
+#define JDK_VERSION_MAJOR(version) ((version & 0xFF000000) >> 24)
+#define JDK_VERSION_MINOR(version) ((version & 0x00FF0000) >> 16)
+#define JDK_VERSION_SECURITY(version) ((version & 0x0000FF00) >> 8)
+#define JDK_VERSION_BUILD(version) ((version & 0x000000FF))
+
+/*
+ * This is the function JDK_GetVersionInfo0 defined in libjava.so
+ * that is dynamically looked up by JVM.
+ */
+typedef void (*jdk_version_info_fn_t)(jdk_version_info* info, size_t info_size);
+
+/*
+ * This structure is used by the launcher to get the default thread
+ * stack size from the VM using JNI_GetDefaultJavaVMInitArgs() with a
+ * version of 1.1. As it is not supported otherwise, it has been removed
+ * from jni.h
+ */
+typedef struct JDK1_1InitArgs {
+ jint version;
+
+ char **properties;
+ jint checkSource;
+ jint nativeStackSize;
+ jint javaStackSize;
+ jint minHeapSize;
+ jint maxHeapSize;
+ jint verifyMode;
+ char *classpath;
+
+ jint (JNICALL *vfprintf)(FILE *fp, const char *format, va_list args);
+ void (JNICALL *exit)(jint code);
+ void (JNICALL *abort)(void);
+
+ jint enableClassGC;
+ jint enableVerboseGC;
+ jint disableAsyncGC;
+ jint verbose;
+ jboolean debugging;
+ jint debugPort;
+} JDK1_1InitArgs;
+
+
+#ifdef __cplusplus
+} /* extern "C" */
+
+#endif /* __cplusplus */
+
+#endif /* !_JAVASOFT_JVM_H_ */
--- a/src/hotspot/share/jvmci/jvmciEnv.cpp Wed Dec 13 14:21:12 2017 -0800
+++ b/src/hotspot/share/jvmci/jvmciEnv.cpp Mon Dec 18 10:28:43 2017 -0800
@@ -410,8 +410,8 @@
// ------------------------------------------------------------------
// 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 @@
// 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 @@
// 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();
--- a/src/hotspot/share/jvmci/jvmciEnv.hpp Wed Dec 13 14:21:12 2017 -0800
+++ b/src/hotspot/share/jvmci/jvmciEnv.hpp Mon Dec 18 10:28:43 2017 -0800
@@ -138,8 +138,8 @@
// 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; }
--- a/src/hotspot/share/opto/c2_globals.hpp Wed Dec 13 14:21:12 2017 -0800
+++ b/src/hotspot/share/opto/c2_globals.hpp Mon Dec 18 10:28:43 2017 -0800
@@ -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 " \
--- a/src/hotspot/share/opto/classes.hpp Wed Dec 13 14:21:12 2017 -0800
+++ b/src/hotspot/share/opto/classes.hpp Mon Dec 18 10:28:43 2017 -0800
@@ -66,6 +66,7 @@
macro(CMoveD)
macro(CMoveVD)
macro(CMoveF)
+macro(CMoveVF)
macro(CMoveI)
macro(CMoveL)
macro(CMoveP)
--- a/src/hotspot/share/opto/loopopts.cpp Wed Dec 13 14:21:12 2017 -0800
+++ b/src/hotspot/share/opto/loopopts.cpp Mon Dec 18 10:28:43 2017 -0800
@@ -528,13 +528,12 @@
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 @@
}
// 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;
--- a/src/hotspot/share/opto/matcher.cpp Wed Dec 13 14:21:12 2017 -0800
+++ b/src/hotspot/share/opto/matcher.cpp Mon Dec 18 10:28:43 2017 -0800
@@ -2267,6 +2267,7 @@
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
--- a/src/hotspot/share/opto/superword.cpp Wed Dec 13 14:21:12 2017 -0800
+++ b/src/hotspot/share/opto/superword.cpp Mon Dec 18 10:28:43 2017 -0800
@@ -58,7 +58,7 @@
_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 @@
combine_packs();
construct_my_pack_map();
-
- if (_do_vector_loop) {
+ if (UseVectorCmov) {
merge_packs_to_cmovd();
}
@@ -1249,8 +1248,8 @@
//------------------------------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 @@
return data_size(use);
}
}
+
int bsize = type2aelembytes(velt_basic_type(s));
assert(bsize != 0, "valid size");
return bsize;
@@ -1718,6 +1718,9 @@
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 @@
}
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
--- a/src/hotspot/share/opto/vectornode.cpp Wed Dec 13 14:21:12 2017 -0800
+++ b/src/hotspot/share/opto/vectornode.cpp Mon Dec 18 10:28:43 2017 -0800
@@ -92,6 +92,9 @@
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;
--- a/src/hotspot/share/opto/vectornode.hpp Wed Dec 13 14:21:12 2017 -0800
+++ b/src/hotspot/share/opto/vectornode.hpp Mon Dec 18 10:28:43 2017 -0800
@@ -277,8 +277,16 @@
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) {}
--- a/src/hotspot/share/prims/nativeLookup.cpp Wed Dec 13 14:21:12 2017 -0800
+++ b/src/hotspot/share/prims/nativeLookup.cpp Mon Dec 18 10:28:43 2017 -0800
@@ -224,7 +224,13 @@
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 @@
+ (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;
--- a/src/hotspot/share/runtime/arguments.cpp Wed Dec 13 14:21:12 2017 -0800
+++ b/src/hotspot/share/runtime/arguments.cpp Mon Dec 18 10:28:43 2017 -0800
@@ -674,6 +674,14 @@
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 @@
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 @@
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;
}
}
}
--- a/src/hotspot/share/runtime/java.cpp Wed Dec 13 14:21:12 2017 -0800
+++ b/src/hotspot/share/runtime/java.cpp Mon Dec 18 10:28:43 2017 -0800
@@ -357,7 +357,7 @@
MemTracker::final_report(tty);
}
- Threads::log_smr_statistics();
+ ThreadsSMRSupport::log_smr_statistics();
}
#else // PRODUCT MODE STATISTICS
@@ -399,7 +399,7 @@
Method::print_touched_methods(tty);
}
- Threads::log_smr_statistics();
+ ThreadsSMRSupport::log_smr_statistics();
}
#endif
--- a/src/hotspot/share/runtime/thread.cpp Wed Dec 13 14:21:12 2017 -0800
+++ b/src/hotspot/share/runtime/thread.cpp Mon Dec 18 10:28:43 2017 -0800
@@ -107,7 +107,6 @@
#include "utilities/events.hpp"
#include "utilities/macros.hpp"
#include "utilities/preserveException.hpp"
-#include "utilities/resourceHash.hpp"
#include "utilities/vmError.hpp"
#if INCLUDE_ALL_GCS
#include "gc/cms/concurrentMarkSweepThread.hpp"
@@ -207,7 +206,7 @@
void JavaThread::smr_delete() {
if (_on_thread_list) {
- Threads::smr_delete(this);
+ ThreadsSMRSupport::smr_delete(this);
} else {
delete this;
}
@@ -419,7 +418,7 @@
assert(!thread->is_Java_thread() || Thread::current() == thread ||
!((JavaThread *) thread)->on_thread_list() ||
SafepointSynchronize::is_at_safepoint() ||
- Threads::is_a_protected_JavaThread_with_lock((JavaThread *) thread),
+ ThreadsSMRSupport::is_a_protected_JavaThread_with_lock((JavaThread *) thread),
"possibility of dangling Thread pointer");
}
#endif
@@ -3443,103 +3442,15 @@
// would like. We are actively migrating Threads_lock uses to other
// mechanisms in order to reduce Threads_lock contention.
-JavaThread* Threads::_thread_list = NULL;
-int Threads::_number_of_threads = 0;
-int Threads::_number_of_non_daemon_threads = 0;
-int Threads::_return_code = 0;
-int Threads::_thread_claim_parity = 0;
-size_t JavaThread::_stack_size_at_create = 0;
-// Safe Memory Reclamation (SMR) support:
-Monitor* Threads::_smr_delete_lock =
- new Monitor(Monitor::special, "smr_delete_lock",
- false /* allow_vm_block */,
- Monitor::_safepoint_check_never);
-// The '_cnt', '_max' and '_times" fields are enabled via
-// -XX:+EnableThreadSMRStatistics:
-
-// # of parallel threads in _smr_delete_lock->wait().
-// Impl note: Hard to imagine > 64K waiting threads so this could be 16-bit,
-// but there is no nice 16-bit _FORMAT support.
-uint Threads::_smr_delete_lock_wait_cnt = 0;
-
-// Max # of parallel threads in _smr_delete_lock->wait().
-// Impl note: See _smr_delete_lock_wait_cnt note.
-uint Threads::_smr_delete_lock_wait_max = 0;
-
-// Flag to indicate when an _smr_delete_lock->notify() is needed.
-// Impl note: See _smr_delete_lock_wait_cnt note.
-volatile uint Threads::_smr_delete_notify = 0;
-
-// # of threads deleted over VM lifetime.
-// Impl note: Atomically incremented over VM lifetime so use unsigned for more
-// range. Unsigned 64-bit would be more future proof, but 64-bit atomic inc
-// isn't available everywhere (or is it?).
-volatile uint Threads::_smr_deleted_thread_cnt = 0;
-
-// Max time in millis to delete a thread.
-// Impl note: 16-bit might be too small on an overloaded machine. Use
-// unsigned since this is a time value. Set via Atomic::cmpxchg() in a
-// loop for correctness.
-volatile uint Threads::_smr_deleted_thread_time_max = 0;
-
-// Cumulative time in millis to delete threads.
-// Impl note: Atomically added to over VM lifetime so use unsigned for more
-// range. Unsigned 64-bit would be more future proof, but 64-bit atomic inc
-// isn't available everywhere (or is it?).
-volatile uint Threads::_smr_deleted_thread_times = 0;
-
-ThreadsList* volatile Threads::_smr_java_thread_list = new ThreadsList(0);
-
-// # of ThreadsLists allocated over VM lifetime.
-// Impl note: We allocate a new ThreadsList for every thread create and
-// every thread delete so we need a bigger type than the
-// _smr_deleted_thread_cnt field.
-uint64_t Threads::_smr_java_thread_list_alloc_cnt = 1;
-
-// # of ThreadsLists freed over VM lifetime.
-// Impl note: See _smr_java_thread_list_alloc_cnt note.
-uint64_t Threads::_smr_java_thread_list_free_cnt = 0;
-
-// Max size ThreadsList allocated.
-// Impl note: Max # of threads alive at one time should fit in unsigned 32-bit.
-uint Threads::_smr_java_thread_list_max = 0;
-
-// Max # of nested ThreadsLists for a thread.
-// Impl note: Hard to imagine > 64K nested ThreadsLists so this could be
-// 16-bit, but there is no nice 16-bit _FORMAT support.
-uint Threads::_smr_nested_thread_list_max = 0;
-
-// # of ThreadsListHandles deleted over VM lifetime.
-// Impl note: Atomically incremented over VM lifetime so use unsigned for
-// more range. There will be fewer ThreadsListHandles than threads so
-// unsigned 32-bit should be fine.
-volatile uint Threads::_smr_tlh_cnt = 0;
-
-// Max time in millis to delete a ThreadsListHandle.
-// Impl note: 16-bit might be too small on an overloaded machine. Use
-// unsigned since this is a time value. Set via Atomic::cmpxchg() in a
-// loop for correctness.
-volatile uint Threads::_smr_tlh_time_max = 0;
-
-// Cumulative time in millis to delete ThreadsListHandles.
-// Impl note: Atomically added to over VM lifetime so use unsigned for more
-// range. Unsigned 64-bit would be more future proof, but 64-bit atomic inc
-// isn't available everywhere (or is it?).
-volatile uint Threads::_smr_tlh_times = 0;
-
-ThreadsList* Threads::_smr_to_delete_list = NULL;
-
-// # of parallel ThreadsLists on the to-delete list.
-// Impl note: Hard to imagine > 64K ThreadsLists needing to be deleted so
-// this could be 16-bit, but there is no nice 16-bit _FORMAT support.
-uint Threads::_smr_to_delete_list_cnt = 0;
-
-// Max # of parallel ThreadsLists on the to-delete list.
-// Impl note: See _smr_to_delete_list_cnt note.
-uint Threads::_smr_to_delete_list_max = 0;
+JavaThread* Threads::_thread_list = NULL;
+int Threads::_number_of_threads = 0;
+int Threads::_number_of_non_daemon_threads = 0;
+int Threads::_return_code = 0;
+int Threads::_thread_claim_parity = 0;
+size_t JavaThread::_stack_size_at_create = 0;
#ifdef ASSERT
-bool Threads::_vm_complete = false;
+bool Threads::_vm_complete = false;
#endif
static inline void *prefetch_and_load_ptr(void **addr, intx prefetch_interval) {
@@ -3561,12 +3472,8 @@
MACRO_current_p++, \
X = (JavaThread*)prefetch_and_load_ptr((void**)MACRO_current_p, (intx)MACRO_scan_interval))
-inline ThreadsList* Threads::get_smr_java_thread_list() {
- return (ThreadsList*)OrderAccess::load_acquire(&_smr_java_thread_list);
-}
-
// All JavaThreads
-#define ALL_JAVA_THREADS(X) DO_JAVA_THREADS(get_smr_java_thread_list(), X)
+#define ALL_JAVA_THREADS(X) DO_JAVA_THREADS(ThreadsSMRSupport::get_smr_java_thread_list(), X)
// All JavaThreads + all non-JavaThreads (i.e., every thread in the system)
void Threads::threads_do(ThreadClosure* tc) {
@@ -3667,240 +3574,6 @@
vmSymbols::void_method_signature(), CHECK);
}
-// Safe Memory Reclamation (SMR) support:
-//
-
-// Acquire a stable ThreadsList.
-//
-ThreadsList *Threads::acquire_stable_list(Thread *self, bool is_ThreadsListSetter) {
- assert(self != NULL, "sanity check");
- // acquire_stable_list_nested_path() will grab the Threads_lock
- // so let's make sure the ThreadsListHandle is in a safe place.
- // ThreadsListSetter cannot make this check on this code path.
- debug_only(if (!is_ThreadsListSetter && StrictSafepointChecks) self->check_for_valid_safepoint_state(/* potential_vm_operation */ false);)
-
- if (self->get_threads_hazard_ptr() == NULL) {
- // The typical case is first.
- return acquire_stable_list_fast_path(self);
- }
-
- // The nested case is rare.
- return acquire_stable_list_nested_path(self);
-}
-
-// Fast path (and lock free) way to acquire a stable ThreadsList.
-//
-ThreadsList *Threads::acquire_stable_list_fast_path(Thread *self) {
- assert(self != NULL, "sanity check");
- assert(self->get_threads_hazard_ptr() == NULL, "sanity check");
- assert(self->get_nested_threads_hazard_ptr() == NULL,
- "cannot have a nested hazard ptr with a NULL regular hazard ptr");
-
- ThreadsList* threads;
-
- // Stable recording of a hazard ptr for SMR. This code does not use
- // locks so its use of the _smr_java_thread_list & _threads_hazard_ptr
- // fields is racy relative to code that uses those fields with locks.
- // OrderAccess and Atomic functions are used to deal with those races.
- //
- while (true) {
- threads = get_smr_java_thread_list();
-
- // Publish a tagged hazard ptr to denote that the hazard ptr is not
- // yet verified as being stable. Due to the fence after the hazard
- // ptr write, it will be sequentially consistent w.r.t. the
- // sequentially consistent writes of the ThreadsList, even on
- // non-multiple copy atomic machines where stores can be observed
- // in different order from different observer threads.
- ThreadsList* unverified_threads = Thread::tag_hazard_ptr(threads);
- self->set_threads_hazard_ptr(unverified_threads);
-
- // If _smr_java_thread_list has changed, we have lost a race with
- // Threads::add() or Threads::remove() and have to try again.
- if (get_smr_java_thread_list() != threads) {
- continue;
- }
-
- // We try to remove the tag which will verify the hazard ptr as
- // being stable. This exchange can race with a scanning thread
- // which might invalidate the tagged hazard ptr to keep it from
- // being followed to access JavaThread ptrs. If we lose the race,
- // we simply retry. If we win the race, then the stable hazard
- // ptr is officially published.
- if (self->cmpxchg_threads_hazard_ptr(threads, unverified_threads) == unverified_threads) {
- break;
- }
- }
-
- // A stable hazard ptr has been published letting other threads know
- // that the ThreadsList and the JavaThreads reachable from this list
- // are protected and hence they should not be deleted until everyone
- // agrees it is safe to do so.
-
- return threads;
-}
-
-// Acquire a nested stable ThreadsList; this is rare so it uses
-// Threads_lock.
-//
-ThreadsList *Threads::acquire_stable_list_nested_path(Thread *self) {
- assert(self != NULL, "sanity check");
- assert(self->get_threads_hazard_ptr() != NULL,
- "cannot have a NULL regular hazard ptr when acquiring a nested hazard ptr");
-
- // The thread already has a hazard ptr (ThreadsList ref) so we need
- // to create a nested ThreadsListHandle with the current ThreadsList
- // since it might be different than our current hazard ptr. The need
- // for a nested ThreadsListHandle is rare so we do this while holding
- // the Threads_lock so we don't race with the scanning code; the code
- // is so much simpler this way.
-
- NestedThreadsList* node;
- {
- // Only grab the Threads_lock if we don't already own it.
- MutexLockerEx ml(Threads_lock->owned_by_self() ? NULL : Threads_lock);
- node = new NestedThreadsList(get_smr_java_thread_list());
- // We insert at the front of the list to match up with the delete
- // in release_stable_list().
- node->set_next(self->get_nested_threads_hazard_ptr());
- self->set_nested_threads_hazard_ptr(node);
- if (EnableThreadSMRStatistics) {
- self->inc_nested_threads_hazard_ptr_cnt();
- if (self->nested_threads_hazard_ptr_cnt() > _smr_nested_thread_list_max) {
- _smr_nested_thread_list_max = self->nested_threads_hazard_ptr_cnt();
- }
- }
- }
- log_debug(thread, smr)("tid=" UINTX_FORMAT ": Threads::acquire_stable_list: add NestedThreadsList node containing ThreadsList=" INTPTR_FORMAT, os::current_thread_id(), p2i(node->t_list()));
-
- return node->t_list();
-}
-
-inline void Threads::add_smr_deleted_thread_times(uint add_value) {
- Atomic::add(add_value, &_smr_deleted_thread_times);
-}
-
-inline void Threads::inc_smr_deleted_thread_cnt() {
- Atomic::inc(&_smr_deleted_thread_cnt);
-}
-
-// Release a stable ThreadsList.
-//
-void Threads::release_stable_list(Thread *self) {
- assert(self != NULL, "sanity check");
- // release_stable_list_nested_path() will grab the Threads_lock
- // so let's make sure the ThreadsListHandle is in a safe place.
- debug_only(if (StrictSafepointChecks) self->check_for_valid_safepoint_state(/* potential_vm_operation */ false);)
-
- if (self->get_nested_threads_hazard_ptr() == NULL) {
- // The typical case is first.
- release_stable_list_fast_path(self);
- return;
- }
-
- // The nested case is rare.
- release_stable_list_nested_path(self);
-}
-
-// Fast path way to release a stable ThreadsList. The release portion
-// is lock-free, but the wake up portion is not.
-//
-void Threads::release_stable_list_fast_path(Thread *self) {
- assert(self != NULL, "sanity check");
- assert(self->get_threads_hazard_ptr() != NULL, "sanity check");
- assert(self->get_nested_threads_hazard_ptr() == NULL,
- "cannot have a nested hazard ptr when releasing a regular hazard ptr");
-
- // After releasing the hazard ptr, other threads may go ahead and
- // free up some memory temporarily used by a ThreadsList snapshot.
- self->set_threads_hazard_ptr(NULL);
-
- // We use double-check locking to reduce traffic on the system
- // wide smr_delete_lock.
- if (Threads::smr_delete_notify()) {
- // An exiting thread might be waiting in smr_delete(); we need to
- // check with smr_delete_lock to be sure.
- release_stable_list_wake_up((char *) "regular hazard ptr");
- }
-}
-
-// Release a nested stable ThreadsList; this is rare so it uses
-// Threads_lock.
-//
-void Threads::release_stable_list_nested_path(Thread *self) {
- assert(self != NULL, "sanity check");
- assert(self->get_nested_threads_hazard_ptr() != NULL, "sanity check");
- assert(self->get_threads_hazard_ptr() != NULL,
- "must have a regular hazard ptr to have nested hazard ptrs");
-
- // We have a nested ThreadsListHandle so we have to release it first.
- // The need for a nested ThreadsListHandle is rare so we do this while
- // holding the Threads_lock so we don't race with the scanning code;
- // the code is so much simpler this way.
-
- NestedThreadsList *node;
- {
- // Only grab the Threads_lock if we don't already own it.
- MutexLockerEx ml(Threads_lock->owned_by_self() ? NULL : Threads_lock);
- // We remove from the front of the list to match up with the insert
- // in acquire_stable_list().
- node = self->get_nested_threads_hazard_ptr();
- self->set_nested_threads_hazard_ptr(node->next());
- if (EnableThreadSMRStatistics) {
- self->dec_nested_threads_hazard_ptr_cnt();
- }
- }
-
- // An exiting thread might be waiting in smr_delete(); we need to
- // check with smr_delete_lock to be sure.
- release_stable_list_wake_up((char *) "nested hazard ptr");
-
- log_debug(thread, smr)("tid=" UINTX_FORMAT ": Threads::release_stable_list: delete NestedThreadsList node containing ThreadsList=" INTPTR_FORMAT, os::current_thread_id(), p2i(node->t_list()));
-
- delete node;
-}
-
-// Wake up portion of the release stable ThreadsList protocol;
-// uses the smr_delete_lock().
-//
-void Threads::release_stable_list_wake_up(char *log_str) {
- assert(log_str != NULL, "sanity check");
-
- // Note: smr_delete_lock is held in smr_delete() for the entire
- // hazard ptr search so that we do not lose this notify() if
- // the exiting thread has to wait. That code path also holds
- // Threads_lock (which was grabbed before smr_delete_lock) so that
- // threads_do() can be called. This means the system can't start a
- // safepoint which means this thread can't take too long to get to
- // a safepoint because of being blocked on smr_delete_lock.
- //
- MonitorLockerEx ml(Threads::smr_delete_lock(), Monitor::_no_safepoint_check_flag);
- if (Threads::smr_delete_notify()) {
- // Notify any exiting JavaThreads that are waiting in smr_delete()
- // that we've released a ThreadsList.
- ml.notify_all();
- log_debug(thread, smr)("tid=" UINTX_FORMAT ": Threads::release_stable_list notified %s", os::current_thread_id(), log_str);
- }
-}
-
-inline void Threads::update_smr_deleted_thread_time_max(uint new_value) {
- while (true) {
- uint cur_value = _smr_deleted_thread_time_max;
- if (new_value <= cur_value) {
- // No need to update max value so we're done.
- break;
- }
- if (Atomic::cmpxchg(new_value, &_smr_deleted_thread_time_max, cur_value) == cur_value) {
- // Updated max value so we're done. Otherwise try it all again.
- break;
- }
- }
-}
-
-inline ThreadsList* Threads::xchg_smr_java_thread_list(ThreadsList* new_list) {
- return (ThreadsList*)Atomic::xchg(new_list, &_smr_java_thread_list);
-}
-
void Threads::initialize_java_lang_classes(JavaThread* main_thread, TRAPS) {
TraceTime timer("Initialize java.lang classes", TRACETIME_LOG(Info, startuptime));
@@ -4666,501 +4339,6 @@
return JNI_FALSE;
}
-// Hash table of pointers found by a scan. Used for collecting hazard
-// pointers (ThreadsList references). Also used for collecting JavaThreads
-// that are indirectly referenced by hazard ptrs. An instance of this
-// class only contains one type of pointer.
-//
-class ThreadScanHashtable : public CHeapObj<mtThread> {
- private:
- static bool ptr_equals(void * const& s1, void * const& s2) {
- return s1 == s2;
- }
-
- static unsigned int ptr_hash(void * const& s1) {
- // 2654435761 = 2^32 * Phi (golden ratio)
- return (unsigned int)(((uint32_t)(uintptr_t)s1) * 2654435761u);
- }
-
- int _table_size;
- // ResourceHashtable SIZE is specified at compile time so our
- // dynamic _table_size is unused for now; 1031 is the first prime
- // after 1024.
- typedef ResourceHashtable<void *, int, &ThreadScanHashtable::ptr_hash,
- &ThreadScanHashtable::ptr_equals, 1031,
- ResourceObj::C_HEAP, mtThread> PtrTable;
- PtrTable * _ptrs;
-
- public:
- // ResourceHashtable is passed to various functions and populated in
- // different places so we allocate it using C_HEAP to make it immune
- // from any ResourceMarks that happen to be in the code paths.
- ThreadScanHashtable(int table_size) : _table_size(table_size), _ptrs(new (ResourceObj::C_HEAP, mtThread) PtrTable()) {}
-
- ~ThreadScanHashtable() { delete _ptrs; }
-
- bool has_entry(void *pointer) {
- int *val_ptr = _ptrs->get(pointer);
- return val_ptr != NULL && *val_ptr == 1;
- }
-
- void add_entry(void *pointer) {
- _ptrs->put(pointer, 1);
- }
-};
-
-// Closure to gather JavaThreads indirectly referenced by hazard ptrs
-// (ThreadsList references) into a hash table. This closure handles part 2
-// of the dance - adding all the JavaThreads referenced by the hazard
-// pointer (ThreadsList reference) to the hash table.
-//
-class AddThreadHazardPointerThreadClosure : public ThreadClosure {
- private:
- ThreadScanHashtable *_table;
-
- public:
- AddThreadHazardPointerThreadClosure(ThreadScanHashtable *table) : _table(table) {}
-
- virtual void do_thread(Thread *thread) {
- if (!_table->has_entry((void*)thread)) {
- // The same JavaThread might be on more than one ThreadsList or
- // more than one thread might be using the same ThreadsList. In
- // either case, we only need a single entry for a JavaThread.
- _table->add_entry((void*)thread);
- }
- }
-};
-
-// Closure to gather JavaThreads indirectly referenced by hazard ptrs
-// (ThreadsList references) into a hash table. This closure handles part 1
-// of the dance - hazard ptr chain walking and dispatch to another
-// closure.
-//
-class ScanHazardPtrGatherProtectedThreadsClosure : public ThreadClosure {
- private:
- ThreadScanHashtable *_table;
- public:
- ScanHazardPtrGatherProtectedThreadsClosure(ThreadScanHashtable *table) : _table(table) {}
-
- virtual void do_thread(Thread *thread) {
- assert_locked_or_safepoint(Threads_lock);
-
- if (thread == NULL) return;
-
- // This code races with Threads::acquire_stable_list() which is
- // lock-free so we have to handle some special situations.
- //
- ThreadsList *current_list = NULL;
- while (true) {
- current_list = thread->get_threads_hazard_ptr();
- // No hazard ptr so nothing more to do.
- if (current_list == NULL) {
- assert(thread->get_nested_threads_hazard_ptr() == NULL,
- "cannot have a nested hazard ptr with a NULL regular hazard ptr");
- return;
- }
-
- // If the hazard ptr is verified as stable (since it is not tagged),
- // then it is safe to use.
- if (!Thread::is_hazard_ptr_tagged(current_list)) break;
-
- // The hazard ptr is tagged as not yet verified as being stable
- // so we are racing with acquire_stable_list(). This exchange
- // attempts to invalidate the hazard ptr. If we win the race,
- // then we can ignore this unstable hazard ptr and the other
- // thread will retry the attempt to publish a stable hazard ptr.
- // If we lose the race, then we retry our attempt to look at the
- // hazard ptr.
- if (thread->cmpxchg_threads_hazard_ptr(NULL, current_list) == current_list) return;
- }
-
- // The current JavaThread has a hazard ptr (ThreadsList reference)
- // which might be _smr_java_thread_list or it might be an older
- // ThreadsList that has been removed but not freed. In either case,
- // the hazard ptr is protecting all the JavaThreads on that
- // ThreadsList.
- AddThreadHazardPointerThreadClosure add_cl(_table);
- current_list->threads_do(&add_cl);
-
- // Any NestedThreadsLists are also protecting JavaThreads so
- // gather those also; the ThreadsLists may be different.
- for (NestedThreadsList* node = thread->get_nested_threads_hazard_ptr();
- node != NULL; node = node->next()) {
- node->t_list()->threads_do(&add_cl);
- }
- }
-};
-
-// Closure to print JavaThreads that have a hazard ptr (ThreadsList
-// reference) that contains an indirect reference to a specific JavaThread.
-//
-class ScanHazardPtrPrintMatchingThreadsClosure : public ThreadClosure {
- private:
- JavaThread *_thread;
- public:
- ScanHazardPtrPrintMatchingThreadsClosure(JavaThread *thread) : _thread(thread) {}
-
- virtual void do_thread(Thread *thread) {
- assert_locked_or_safepoint(Threads_lock);
-
- if (thread == NULL) return;
- ThreadsList *current_list = thread->get_threads_hazard_ptr();
- if (current_list == NULL) {
- assert(thread->get_nested_threads_hazard_ptr() == NULL,
- "cannot have a nested hazard ptr with a NULL regular hazard ptr");
- return;
- }
- // If the hazard ptr is unverified, then ignore it.
- if (Thread::is_hazard_ptr_tagged(current_list)) return;
-
- // The current JavaThread has a hazard ptr (ThreadsList reference)
- // which might be _smr_java_thread_list or it might be an older
- // ThreadsList that has been removed but not freed. In either case,
- // the hazard ptr is protecting all the JavaThreads on that
- // ThreadsList, but we only care about matching a specific JavaThread.
- DO_JAVA_THREADS(current_list, p) {
- if (p == _thread) {
- log_debug(thread, smr)("tid=" UINTX_FORMAT ": Threads::smr_delete: thread1=" INTPTR_FORMAT " has a hazard pointer for thread2=" INTPTR_FORMAT, os::current_thread_id(), p2i(thread), p2i(_thread));
- break;
- }
- }
-
- // Any NestedThreadsLists are also protecting JavaThreads so
- // check those also; the ThreadsLists may be different.
- for (NestedThreadsList* node = thread->get_nested_threads_hazard_ptr();
- node != NULL; node = node->next()) {
- DO_JAVA_THREADS(node->t_list(), p) {
- if (p == _thread) {
- log_debug(thread, smr)("tid=" UINTX_FORMAT ": Threads::smr_delete: thread1=" INTPTR_FORMAT " has a nested hazard pointer for thread2=" INTPTR_FORMAT, os::current_thread_id(), p2i(thread), p2i(_thread));
- return;
- }
- }
- }
- }
-};
-
-// Return true if the specified JavaThread is protected by a hazard
-// pointer (ThreadsList reference). Otherwise, returns false.
-//
-bool Threads::is_a_protected_JavaThread(JavaThread *thread) {
- assert_locked_or_safepoint(Threads_lock);
-
- // Hash table size should be first power of two higher than twice
- // the length of the Threads list.
- int hash_table_size = MIN2(_number_of_threads, 32) << 1;
- hash_table_size--;
- hash_table_size |= hash_table_size >> 1;
- hash_table_size |= hash_table_size >> 2;
- hash_table_size |= hash_table_size >> 4;
- hash_table_size |= hash_table_size >> 8;
- hash_table_size |= hash_table_size >> 16;
- hash_table_size++;
-
- // Gather a hash table of the JavaThreads indirectly referenced by
- // hazard ptrs.
- ThreadScanHashtable *scan_table = new ThreadScanHashtable(hash_table_size);
- ScanHazardPtrGatherProtectedThreadsClosure scan_cl(scan_table);
- Threads::threads_do(&scan_cl);
-
- bool thread_is_protected = false;
- if (scan_table->has_entry((void*)thread)) {
- thread_is_protected = true;
- }
- delete scan_table;
- return thread_is_protected;
-}
-
-// Safely delete a JavaThread when it is no longer in use by a
-// ThreadsListHandle.
-//
-void Threads::smr_delete(JavaThread *thread) {
- assert(!Threads_lock->owned_by_self(), "sanity");
-
- bool has_logged_once = false;
- elapsedTimer timer;
- if (EnableThreadSMRStatistics) {
- timer.start();
- }
-
- while (true) {
- {
- // No safepoint check because this JavaThread is not on the
- // Threads list.
- MutexLockerEx ml(Threads_lock, Mutex::_no_safepoint_check_flag);
- // Cannot use a MonitorLockerEx helper here because we have
- // to drop the Threads_lock first if we wait.
- Threads::smr_delete_lock()->lock_without_safepoint_check();
- // Set the smr_delete_notify flag after we grab smr_delete_lock
- // and before we scan hazard ptrs because we're doing
- // double-check locking in release_stable_list().
- Threads::set_smr_delete_notify();
-
- if (!is_a_protected_JavaThread(thread)) {
- // This is the common case.
- Threads::clear_smr_delete_notify();
- Threads::smr_delete_lock()->unlock();
- break;
- }
- if (!has_logged_once) {
- has_logged_once = true;
- log_debug(thread, smr)("tid=" UINTX_FORMAT ": Threads::smr_delete: thread=" INTPTR_FORMAT " is not deleted.", os::current_thread_id(), p2i(thread));
- if (log_is_enabled(Debug, os, thread)) {
- ScanHazardPtrPrintMatchingThreadsClosure scan_cl(thread);
- Threads::threads_do(&scan_cl);
- }
- }
- } // We have to drop the Threads_lock to wait or delete the thread
-
- if (EnableThreadSMRStatistics) {
- _smr_delete_lock_wait_cnt++;
- if (_smr_delete_lock_wait_cnt > _smr_delete_lock_wait_max) {
- _smr_delete_lock_wait_max = _smr_delete_lock_wait_cnt;
- }
- }
- // Wait for a release_stable_list() call before we check again. No
- // safepoint check, no timeout, and not as suspend equivalent flag
- // because this JavaThread is not on the Threads list.
- Threads::smr_delete_lock()->wait(Mutex::_no_safepoint_check_flag, 0,
- !Mutex::_as_suspend_equivalent_flag);
- if (EnableThreadSMRStatistics) {
- _smr_delete_lock_wait_cnt--;
- }
-
- Threads::clear_smr_delete_notify();
- Threads::smr_delete_lock()->unlock();
- // Retry the whole scenario.
- }
-
- if (ThreadLocalHandshakes) {
- // The thread is about to be deleted so cancel any handshake.
- thread->cancel_handshake();
- }
-
- delete thread;
- if (EnableThreadSMRStatistics) {
- timer.stop();
- uint millis = (uint)timer.milliseconds();
- Threads::inc_smr_deleted_thread_cnt();
- Threads::add_smr_deleted_thread_times(millis);
- Threads::update_smr_deleted_thread_time_max(millis);
- }
-
- log_debug(thread, smr)("tid=" UINTX_FORMAT ": Threads::smr_delete: thread=" INTPTR_FORMAT " is deleted.", os::current_thread_id(), p2i(thread));
-}
-
-bool Threads::smr_delete_notify() {
- // Use load_acquire() in order to see any updates to _smr_delete_notify
- // earlier than when smr_delete_lock is grabbed.
- return (OrderAccess::load_acquire(&_smr_delete_notify) != 0);
-}
-
-// set_smr_delete_notify() and clear_smr_delete_notify() are called
-// under the protection of the smr_delete_lock, but we also use an
-// Atomic operation to ensure the memory update is seen earlier than
-// when the smr_delete_lock is dropped.
-//
-void Threads::set_smr_delete_notify() {
- Atomic::inc(&_smr_delete_notify);
-}
-
-void Threads::clear_smr_delete_notify() {
- Atomic::dec(&_smr_delete_notify);
-}
-
-// Closure to gather hazard ptrs (ThreadsList references) into a hash table.
-//
-class ScanHazardPtrGatherThreadsListClosure : public ThreadClosure {
- private:
- ThreadScanHashtable *_table;
- public:
- ScanHazardPtrGatherThreadsListClosure(ThreadScanHashtable *table) : _table(table) {}
-
- virtual void do_thread(Thread* thread) {
- assert_locked_or_safepoint(Threads_lock);
-
- if (thread == NULL) return;
- ThreadsList *threads = thread->get_threads_hazard_ptr();
- if (threads == NULL) {
- assert(thread->get_nested_threads_hazard_ptr() == NULL,
- "cannot have a nested hazard ptr with a NULL regular hazard ptr");
- return;
- }
- // In this closure we always ignore the tag that might mark this
- // hazard ptr as not yet verified. If we happen to catch an
- // unverified hazard ptr that is subsequently discarded (not
- // published), then the only side effect is that we might keep a
- // to-be-deleted ThreadsList alive a little longer.
- threads = Thread::untag_hazard_ptr(threads);
- if (!_table->has_entry((void*)threads)) {
- _table->add_entry((void*)threads);
- }
-
- // Any NestedThreadsLists are also protecting JavaThreads so
- // gather those also; the ThreadsLists may be different.
- for (NestedThreadsList* node = thread->get_nested_threads_hazard_ptr();
- node != NULL; node = node->next()) {
- threads = node->t_list();
- if (!_table->has_entry((void*)threads)) {
- _table->add_entry((void*)threads);
- }
- }
- }
-};
-
-// Safely free a ThreadsList after a Threads::add() or Threads::remove().
-// The specified ThreadsList may not get deleted during this call if it
-// is still in-use (referenced by a hazard ptr). Other ThreadsLists
-// in the chain may get deleted by this call if they are no longer in-use.
-void Threads::smr_free_list(ThreadsList* threads) {
- assert_locked_or_safepoint(Threads_lock);
-
- threads->set_next_list(_smr_to_delete_list);
- _smr_to_delete_list = threads;
- if (EnableThreadSMRStatistics) {
- _smr_to_delete_list_cnt++;
- if (_smr_to_delete_list_cnt > _smr_to_delete_list_max) {
- _smr_to_delete_list_max = _smr_to_delete_list_cnt;
- }
- }
-
- // Hash table size should be first power of two higher than twice the length of the ThreadsList
- int hash_table_size = MIN2(_number_of_threads, 32) << 1;
- hash_table_size--;
- hash_table_size |= hash_table_size >> 1;
- hash_table_size |= hash_table_size >> 2;
- hash_table_size |= hash_table_size >> 4;
- hash_table_size |= hash_table_size >> 8;
- hash_table_size |= hash_table_size >> 16;
- hash_table_size++;
-
- // Gather a hash table of the current hazard ptrs:
- ThreadScanHashtable *scan_table = new ThreadScanHashtable(hash_table_size);
- ScanHazardPtrGatherThreadsListClosure scan_cl(scan_table);
- Threads::threads_do(&scan_cl);
-
- // Walk through the linked list of pending freeable ThreadsLists
- // and free the ones that are not referenced from hazard ptrs.
- ThreadsList* current = _smr_to_delete_list;
- ThreadsList* prev = NULL;
- ThreadsList* next = NULL;
- bool threads_is_freed = false;
- while (current != NULL) {
- next = current->next_list();
- if (!scan_table->has_entry((void*)current)) {
- // This ThreadsList is not referenced by a hazard ptr.
- if (prev != NULL) {
- prev->set_next_list(next);
- }
- if (_smr_to_delete_list == current) {
- _smr_to_delete_list = next;
- }
-
- log_debug(thread, smr)("tid=" UINTX_FORMAT ": Threads::smr_free_list: threads=" INTPTR_FORMAT " is freed.", os::current_thread_id(), p2i(current));
- if (current == threads) threads_is_freed = true;
- delete current;
- if (EnableThreadSMRStatistics) {
- _smr_java_thread_list_free_cnt++;
- _smr_to_delete_list_cnt--;
- }
- } else {
- prev = current;
- }
- current = next;
- }
-
- if (!threads_is_freed) {
- // Only report "is not freed" on the original call to
- // smr_free_list() for this ThreadsList.
- log_debug(thread, smr)("tid=" UINTX_FORMAT ": Threads::smr_free_list: threads=" INTPTR_FORMAT " is not freed.", os::current_thread_id(), p2i(threads));
- }
-
- delete scan_table;
-}
-
-// Remove a JavaThread from a ThreadsList. The returned ThreadsList is a
-// new copy of the specified ThreadsList with the specified JavaThread
-// removed.
-ThreadsList *ThreadsList::remove_thread(ThreadsList* list, JavaThread* java_thread) {
- assert(list->_length > 0, "sanity");
-
- uint i = 0;
- DO_JAVA_THREADS(list, current) {
- if (current == java_thread) {
- break;
- }
- i++;
- }
- assert(i < list->_length, "did not find JavaThread on the list");
- const uint index = i;
- const uint new_length = list->_length - 1;
- const uint head_length = index;
- const uint tail_length = (new_length >= index) ? (new_length - index) : 0;
- ThreadsList *const new_list = new ThreadsList(new_length);
-
- if (head_length > 0) {
- Copy::disjoint_words((HeapWord*)list->_threads, (HeapWord*)new_list->_threads, head_length);
- }
- if (tail_length > 0) {
- Copy::disjoint_words((HeapWord*)list->_threads + index + 1, (HeapWord*)new_list->_threads + index, tail_length);
- }
-
- return new_list;
-}
-
-// Add a JavaThread to a ThreadsList. The returned ThreadsList is a
-// new copy of the specified ThreadsList with the specified JavaThread
-// appended to the end.
-ThreadsList *ThreadsList::add_thread(ThreadsList *list, JavaThread *java_thread) {
- const uint index = list->_length;
- const uint new_length = index + 1;
- const uint head_length = index;
- ThreadsList *const new_list = new ThreadsList(new_length);
-
- if (head_length > 0) {
- Copy::disjoint_words((HeapWord*)list->_threads, (HeapWord*)new_list->_threads, head_length);
- }
- *(JavaThread**)(new_list->_threads + index) = java_thread;
-
- return new_list;
-}
-
-int ThreadsList::find_index_of_JavaThread(JavaThread *target) {
- if (target == NULL) {
- return -1;
- }
- for (uint i = 0; i < length(); i++) {
- if (target == thread_at(i)) {
- return (int)i;
- }
- }
- return -1;
-}
-
-JavaThread* ThreadsList::find_JavaThread_from_java_tid(jlong java_tid) const {
- DO_JAVA_THREADS(this, thread) {
- oop tobj = thread->threadObj();
- // Ignore the thread if it hasn't run yet, has exited
- // or is starting to exit.
- if (tobj != NULL && !thread->is_exiting() &&
- java_tid == java_lang_Thread::thread_id(tobj)) {
- // found a match
- return thread;
- }
- }
- return NULL;
-}
-
-bool ThreadsList::includes(const JavaThread * const p) const {
- if (p == NULL) {
- return false;
- }
- DO_JAVA_THREADS(this, q) {
- if (q == p) {
- return true;
- }
- }
- return false;
-}
void Threads::add(JavaThread* p, bool force_daemon) {
// The threads lock must be owned at this point
@@ -5189,18 +4367,7 @@
ThreadService::add_thread(p, daemon);
// Maintain fast thread list
- ThreadsList *new_list = ThreadsList::add_thread(get_smr_java_thread_list(), p);
- if (EnableThreadSMRStatistics) {
- _smr_java_thread_list_alloc_cnt++;
- if (new_list->length() > _smr_java_thread_list_max) {
- _smr_java_thread_list_max = new_list->length();
- }
- }
- // Initial _smr_java_thread_list will not generate a "Threads::add" mesg.
- log_debug(thread, smr)("tid=" UINTX_FORMAT ": Threads::add: new ThreadsList=" INTPTR_FORMAT, os::current_thread_id(), p2i(new_list));
-
- ThreadsList *old_list = xchg_smr_java_thread_list(new_list);
- smr_free_list(old_list);
+ ThreadsSMRSupport::add_thread(p);
// Possible GC point.
Events::log(p, "Thread added: " INTPTR_FORMAT, p2i(p));
@@ -5215,20 +4382,10 @@
// that we do not remove thread without safepoint code notice
{ MutexLocker ml(Threads_lock);
- assert(get_smr_java_thread_list()->includes(p), "p must be present");
+ assert(ThreadsSMRSupport::get_smr_java_thread_list()->includes(p), "p must be present");
// Maintain fast thread list
- ThreadsList *new_list = ThreadsList::remove_thread(get_smr_java_thread_list(), p);
- if (EnableThreadSMRStatistics) {
- _smr_java_thread_list_alloc_cnt++;
- // This list is smaller so no need to check for a "longest" update.
- }
-
- // Final _smr_java_thread_list will not generate a "Threads::remove" mesg.
- log_debug(thread, smr)("tid=" UINTX_FORMAT ": Threads::remove: new ThreadsList=" INTPTR_FORMAT, os::current_thread_id(), p2i(new_list));
-
- ThreadsList *old_list = xchg_smr_java_thread_list(new_list);
- smr_free_list(old_list);
+ ThreadsSMRSupport::remove_thread(p);
JavaThread* current = _thread_list;
JavaThread* prev = NULL;
@@ -5453,7 +4610,7 @@
}
#endif // INCLUDE_SERVICES
- print_smr_info_on(st);
+ ThreadsSMRSupport::print_smr_info_on(st);
st->cr();
ALL_JAVA_THREADS(p) {
@@ -5486,101 +4643,6 @@
st->flush();
}
-// Log Threads class SMR info.
-void Threads::log_smr_statistics() {
- LogTarget(Info, thread, smr) log;
- if (log.is_enabled()) {
- LogStream out(log);
- print_smr_info_on(&out);
- }
-}
-
-// Print Threads class SMR info.
-void Threads::print_smr_info_on(outputStream* st) {
- // Only grab the Threads_lock if we don't already own it
- // and if we are not reporting an error.
- MutexLockerEx ml((Threads_lock->owned_by_self() || VMError::is_error_reported()) ? NULL : Threads_lock);
-
- st->print_cr("Threads class SMR info:");
- st->print_cr("_smr_java_thread_list=" INTPTR_FORMAT ", length=%u, "
- "elements={", p2i(_smr_java_thread_list),
- _smr_java_thread_list->length());
- print_smr_info_elements_on(st, _smr_java_thread_list);
- st->print_cr("}");
- if (_smr_to_delete_list != NULL) {
- st->print_cr("_smr_to_delete_list=" INTPTR_FORMAT ", length=%u, "
- "elements={", p2i(_smr_to_delete_list),
- _smr_to_delete_list->length());
- print_smr_info_elements_on(st, _smr_to_delete_list);
- st->print_cr("}");
- for (ThreadsList *t_list = _smr_to_delete_list->next_list();
- t_list != NULL; t_list = t_list->next_list()) {
- st->print("next-> " INTPTR_FORMAT ", length=%u, "
- "elements={", p2i(t_list), t_list->length());
- print_smr_info_elements_on(st, t_list);
- st->print_cr("}");
- }
- }
- if (!EnableThreadSMRStatistics) {
- return;
- }
- st->print_cr("_smr_java_thread_list_alloc_cnt=" UINT64_FORMAT ","
- "_smr_java_thread_list_free_cnt=" UINT64_FORMAT ","
- "_smr_java_thread_list_max=%u, "
- "_smr_nested_thread_list_max=%u",
- _smr_java_thread_list_alloc_cnt,
- _smr_java_thread_list_free_cnt,
- _smr_java_thread_list_max,
- _smr_nested_thread_list_max);
- if (_smr_tlh_cnt > 0) {
- st->print_cr("_smr_tlh_cnt=%u"
- ", _smr_tlh_times=%u"
- ", avg_smr_tlh_time=%0.2f"
- ", _smr_tlh_time_max=%u",
- _smr_tlh_cnt, _smr_tlh_times,
- ((double) _smr_tlh_times / _smr_tlh_cnt),
- _smr_tlh_time_max);
- }
- if (_smr_deleted_thread_cnt > 0) {
- st->print_cr("_smr_deleted_thread_cnt=%u"
- ", _smr_deleted_thread_times=%u"
- ", avg_smr_deleted_thread_time=%0.2f"
- ", _smr_deleted_thread_time_max=%u",
- _smr_deleted_thread_cnt, _smr_deleted_thread_times,
- ((double) _smr_deleted_thread_times / _smr_deleted_thread_cnt),
- _smr_deleted_thread_time_max);
- }
- st->print_cr("_smr_delete_lock_wait_cnt=%u, _smr_delete_lock_wait_max=%u",
- _smr_delete_lock_wait_cnt, _smr_delete_lock_wait_max);
- st->print_cr("_smr_to_delete_list_cnt=%u, _smr_to_delete_list_max=%u",
- _smr_to_delete_list_cnt, _smr_to_delete_list_max);
-}
-
-// Print ThreadsList elements (4 per line).
-void Threads::print_smr_info_elements_on(outputStream* st,
- ThreadsList* t_list) {
- uint cnt = 0;
- JavaThreadIterator jti(t_list);
- for (JavaThread *jt = jti.first(); jt != NULL; jt = jti.next()) {
- st->print(INTPTR_FORMAT, p2i(jt));
- if (cnt < t_list->length() - 1) {
- // Separate with comma or comma-space except for the last one.
- if (((cnt + 1) % 4) == 0) {
- // Four INTPTR_FORMAT fit on an 80 column line so end the
- // current line with just a comma.
- st->print_cr(",");
- } else {
- // Not the last one on the current line so use comma-space:
- st->print(", ");
- }
- } else {
- // Last one so just end the current line.
- st->cr();
- }
- cnt++;
- }
-}
-
void Threads::print_on_error(Thread* this_thread, outputStream* st, Thread* current, char* buf,
int buflen, bool* found_current) {
if (this_thread != NULL) {
@@ -5617,7 +4679,7 @@
// memory (even in resource area), it might deadlock the error handler.
void Threads::print_on_error(outputStream* st, Thread* current, char* buf,
int buflen) {
- print_smr_info_on(st);
+ ThreadsSMRSupport::print_smr_info_on(st);
st->cr();
bool found_current = false;
--- a/src/hotspot/share/runtime/thread.hpp Wed Dec 13 14:21:12 2017 -0800
+++ b/src/hotspot/share/runtime/thread.hpp Mon Dec 18 10:28:43 2017 -0800
@@ -58,6 +58,7 @@
class ThreadSafepointState;
class ThreadsList;
+class ThreadsSMRSupport;
class NestedThreadsList;
class JvmtiThreadState;
@@ -103,7 +104,6 @@
// - WatcherThread
class Thread: public ThreadShadow {
- friend class Threads;
friend class VMStructs;
friend class JVMCIVMStructs;
private:
@@ -121,12 +121,14 @@
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 @@
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 @@
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 @@
// 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 */);
--- a/src/hotspot/share/runtime/thread.inline.hpp Wed Dec 13 14:21:12 2017 -0800
+++ b/src/hotspot/share/runtime/thread.inline.hpp Mon Dec 18 10:28:43 2017 -0800
@@ -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 @@
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
--- a/src/hotspot/share/runtime/threadSMR.cpp Wed Dec 13 14:21:12 2017 -0800
+++ b/src/hotspot/share/runtime/threadSMR.cpp Mon Dec 18 10:28:43 2017 -0800
@@ -23,10 +23,357 @@
*/
#include "precompiled.hpp"
+#include "logging/logStream.hpp"
#include "memory/allocation.inline.hpp"
#include "runtime/thread.inline.hpp"
-#include "runtime/threadSMR.hpp"
+#include "runtime/threadSMR.inline.hpp"
#include "services/threadService.hpp"
+#include "utilities/globalDefinitions.hpp"
+#include "utilities/resourceHash.hpp"
+
+Monitor* ThreadsSMRSupport::_smr_delete_lock =
+ new Monitor(Monitor::special, "smr_delete_lock",
+ false /* allow_vm_block */,
+ Monitor::_safepoint_check_never);
+// The '_cnt', '_max' and '_times" fields are enabled via
+// -XX:+EnableThreadSMRStatistics:
+
+// # of parallel threads in _smr_delete_lock->wait().
+// Impl note: Hard to imagine > 64K waiting threads so this could be 16-bit,
+// but there is no nice 16-bit _FORMAT support.
+uint ThreadsSMRSupport::_smr_delete_lock_wait_cnt = 0;
+
+// Max # of parallel threads in _smr_delete_lock->wait().
+// Impl note: See _smr_delete_lock_wait_cnt note.
+uint ThreadsSMRSupport::_smr_delete_lock_wait_max = 0;
+
+// Flag to indicate when an _smr_delete_lock->notify() is needed.
+// Impl note: See _smr_delete_lock_wait_cnt note.
+volatile uint ThreadsSMRSupport::_smr_delete_notify = 0;
+
+// # of threads deleted over VM lifetime.
+// Impl note: Atomically incremented over VM lifetime so use unsigned for more
+// range. Unsigned 64-bit would be more future proof, but 64-bit atomic inc
+// isn't available everywhere (or is it?).
+volatile uint ThreadsSMRSupport::_smr_deleted_thread_cnt = 0;
+
+// Max time in millis to delete a thread.
+// Impl note: 16-bit might be too small on an overloaded machine. Use
+// unsigned since this is a time value. Set via Atomic::cmpxchg() in a
+// loop for correctness.
+volatile uint ThreadsSMRSupport::_smr_deleted_thread_time_max = 0;
+
+// Cumulative time in millis to delete threads.
+// Impl note: Atomically added to over VM lifetime so use unsigned for more
+// range. Unsigned 64-bit would be more future proof, but 64-bit atomic inc
+// isn't available everywhere (or is it?).
+volatile uint ThreadsSMRSupport::_smr_deleted_thread_times = 0;
+
+ThreadsList* volatile ThreadsSMRSupport::_smr_java_thread_list = new ThreadsList(0);
+
+// # of ThreadsLists allocated over VM lifetime.
+// Impl note: We allocate a new ThreadsList for every thread create and
+// every thread delete so we need a bigger type than the
+// _smr_deleted_thread_cnt field.
+uint64_t ThreadsSMRSupport::_smr_java_thread_list_alloc_cnt = 1;
+
+// # of ThreadsLists freed over VM lifetime.
+// Impl note: See _smr_java_thread_list_alloc_cnt note.
+uint64_t ThreadsSMRSupport::_smr_java_thread_list_free_cnt = 0;
+
+// Max size ThreadsList allocated.
+// Impl note: Max # of threads alive at one time should fit in unsigned 32-bit.
+uint ThreadsSMRSupport::_smr_java_thread_list_max = 0;
+
+// Max # of nested ThreadsLists for a thread.
+// Impl note: Hard to imagine > 64K nested ThreadsLists so this could be
+// 16-bit, but there is no nice 16-bit _FORMAT support.
+uint ThreadsSMRSupport::_smr_nested_thread_list_max = 0;
+
+// # of ThreadsListHandles deleted over VM lifetime.
+// Impl note: Atomically incremented over VM lifetime so use unsigned for
+// more range. There will be fewer ThreadsListHandles than threads so
+// unsigned 32-bit should be fine.
+volatile uint ThreadsSMRSupport::_smr_tlh_cnt = 0;
+
+// Max time in millis to delete a ThreadsListHandle.
+// Impl note: 16-bit might be too small on an overloaded machine. Use
+// unsigned since this is a time value. Set via Atomic::cmpxchg() in a
+// loop for correctness.
+volatile uint ThreadsSMRSupport::_smr_tlh_time_max = 0;
+
+// Cumulative time in millis to delete ThreadsListHandles.
+// Impl note: Atomically added to over VM lifetime so use unsigned for more
+// range. Unsigned 64-bit would be more future proof, but 64-bit atomic inc
+// isn't available everywhere (or is it?).
+volatile uint ThreadsSMRSupport::_smr_tlh_times = 0;
+
+ThreadsList* ThreadsSMRSupport::_smr_to_delete_list = NULL;
+
+// # of parallel ThreadsLists on the to-delete list.
+// Impl note: Hard to imagine > 64K ThreadsLists needing to be deleted so
+// this could be 16-bit, but there is no nice 16-bit _FORMAT support.
+uint ThreadsSMRSupport::_smr_to_delete_list_cnt = 0;
+
+// Max # of parallel ThreadsLists on the to-delete list.
+// Impl note: See _smr_to_delete_list_cnt note.
+uint ThreadsSMRSupport::_smr_to_delete_list_max = 0;
+
+
+// 'inline' functions first so the definitions are before first use:
+
+inline void ThreadsSMRSupport::add_smr_deleted_thread_times(uint add_value) {
+ Atomic::add(add_value, &_smr_deleted_thread_times);
+}
+
+inline void ThreadsSMRSupport::inc_smr_deleted_thread_cnt() {
+ Atomic::inc(&_smr_deleted_thread_cnt);
+}
+
+inline void ThreadsSMRSupport::inc_smr_java_thread_list_alloc_cnt() {
+ _smr_java_thread_list_alloc_cnt++;
+}
+
+inline void ThreadsSMRSupport::update_smr_deleted_thread_time_max(uint new_value) {
+ while (true) {
+ uint cur_value = _smr_deleted_thread_time_max;
+ if (new_value <= cur_value) {
+ // No need to update max value so we're done.
+ break;
+ }
+ if (Atomic::cmpxchg(new_value, &_smr_deleted_thread_time_max, cur_value) == cur_value) {
+ // Updated max value so we're done. Otherwise try it all again.
+ break;
+ }
+ }
+}
+
+inline void ThreadsSMRSupport::update_smr_java_thread_list_max(uint new_value) {
+ if (new_value > _smr_java_thread_list_max) {
+ _smr_java_thread_list_max = new_value;
+ }
+}
+
+inline ThreadsList* ThreadsSMRSupport::xchg_smr_java_thread_list(ThreadsList* new_list) {
+ return (ThreadsList*)Atomic::xchg(new_list, &_smr_java_thread_list);
+}
+
+
+// Hash table of pointers found by a scan. Used for collecting hazard
+// pointers (ThreadsList references). Also used for collecting JavaThreads
+// that are indirectly referenced by hazard ptrs. An instance of this
+// class only contains one type of pointer.
+//
+class ThreadScanHashtable : public CHeapObj<mtThread> {
+ private:
+ static bool ptr_equals(void * const& s1, void * const& s2) {
+ return s1 == s2;
+ }
+
+ static unsigned int ptr_hash(void * const& s1) {
+ // 2654435761 = 2^32 * Phi (golden ratio)
+ return (unsigned int)(((uint32_t)(uintptr_t)s1) * 2654435761u);
+ }
+
+ int _table_size;
+ // ResourceHashtable SIZE is specified at compile time so our
+ // dynamic _table_size is unused for now; 1031 is the first prime
+ // after 1024.
+ typedef ResourceHashtable<void *, int, &ThreadScanHashtable::ptr_hash,
+ &ThreadScanHashtable::ptr_equals, 1031,
+ ResourceObj::C_HEAP, mtThread> PtrTable;
+ PtrTable * _ptrs;
+
+ public:
+ // ResourceHashtable is passed to various functions and populated in
+ // different places so we allocate it using C_HEAP to make it immune
+ // from any ResourceMarks that happen to be in the code paths.
+ ThreadScanHashtable(int table_size) : _table_size(table_size), _ptrs(new (ResourceObj::C_HEAP, mtThread) PtrTable()) {}
+
+ ~ThreadScanHashtable() { delete _ptrs; }
+
+ bool has_entry(void *pointer) {
+ int *val_ptr = _ptrs->get(pointer);
+ return val_ptr != NULL && *val_ptr == 1;
+ }
+
+ void add_entry(void *pointer) {
+ _ptrs->put(pointer, 1);
+ }
+};
+
+// Closure to gather JavaThreads indirectly referenced by hazard ptrs
+// (ThreadsList references) into a hash table. This closure handles part 2
+// of the dance - adding all the JavaThreads referenced by the hazard
+// pointer (ThreadsList reference) to the hash table.
+//
+class AddThreadHazardPointerThreadClosure : public ThreadClosure {
+ private:
+ ThreadScanHashtable *_table;
+
+ public:
+ AddThreadHazardPointerThreadClosure(ThreadScanHashtable *table) : _table(table) {}
+
+ virtual void do_thread(Thread *thread) {
+ if (!_table->has_entry((void*)thread)) {
+ // The same JavaThread might be on more than one ThreadsList or
+ // more than one thread might be using the same ThreadsList. In
+ // either case, we only need a single entry for a JavaThread.
+ _table->add_entry((void*)thread);
+ }
+ }
+};
+
+// Closure to gather JavaThreads indirectly referenced by hazard ptrs
+// (ThreadsList references) into a hash table. This closure handles part 1
+// of the dance - hazard ptr chain walking and dispatch to another
+// closure.
+//
+class ScanHazardPtrGatherProtectedThreadsClosure : public ThreadClosure {
+ private:
+ ThreadScanHashtable *_table;
+ public:
+ ScanHazardPtrGatherProtectedThreadsClosure(ThreadScanHashtable *table) : _table(table) {}
+
+ virtual void do_thread(Thread *thread) {
+ assert_locked_or_safepoint(Threads_lock);
+
+ if (thread == NULL) return;
+
+ // This code races with ThreadsSMRSupport::acquire_stable_list() which
+ // is lock-free so we have to handle some special situations.
+ //
+ ThreadsList *current_list = NULL;
+ while (true) {
+ current_list = thread->get_threads_hazard_ptr();
+ // No hazard ptr so nothing more to do.
+ if (current_list == NULL) {
+ assert(thread->get_nested_threads_hazard_ptr() == NULL,
+ "cannot have a nested hazard ptr with a NULL regular hazard ptr");
+ return;
+ }
+
+ // If the hazard ptr is verified as stable (since it is not tagged),
+ // then it is safe to use.
+ if (!Thread::is_hazard_ptr_tagged(current_list)) break;
+
+ // The hazard ptr is tagged as not yet verified as being stable
+ // so we are racing with acquire_stable_list(). This exchange
+ // attempts to invalidate the hazard ptr. If we win the race,
+ // then we can ignore this unstable hazard ptr and the other
+ // thread will retry the attempt to publish a stable hazard ptr.
+ // If we lose the race, then we retry our attempt to look at the
+ // hazard ptr.
+ if (thread->cmpxchg_threads_hazard_ptr(NULL, current_list) == current_list) return;
+ }
+
+ // The current JavaThread has a hazard ptr (ThreadsList reference)
+ // which might be _smr_java_thread_list or it might be an older
+ // ThreadsList that has been removed but not freed. In either case,
+ // the hazard ptr is protecting all the JavaThreads on that
+ // ThreadsList.
+ AddThreadHazardPointerThreadClosure add_cl(_table);
+ current_list->threads_do(&add_cl);
+
+ // Any NestedThreadsLists are also protecting JavaThreads so
+ // gather those also; the ThreadsLists may be different.
+ for (NestedThreadsList* node = thread->get_nested_threads_hazard_ptr();
+ node != NULL; node = node->next()) {
+ node->t_list()->threads_do(&add_cl);
+ }
+ }
+};
+
+// Closure to gather hazard ptrs (ThreadsList references) into a hash table.
+//
+class ScanHazardPtrGatherThreadsListClosure : public ThreadClosure {
+ private:
+ ThreadScanHashtable *_table;
+ public:
+ ScanHazardPtrGatherThreadsListClosure(ThreadScanHashtable *table) : _table(table) {}
+
+ virtual void do_thread(Thread* thread) {
+ assert_locked_or_safepoint(Threads_lock);
+
+ if (thread == NULL) return;
+ ThreadsList *threads = thread->get_threads_hazard_ptr();
+ if (threads == NULL) {
+ assert(thread->get_nested_threads_hazard_ptr() == NULL,
+ "cannot have a nested hazard ptr with a NULL regular hazard ptr");
+ return;
+ }
+ // In this closure we always ignore the tag that might mark this
+ // hazard ptr as not yet verified. If we happen to catch an
+ // unverified hazard ptr that is subsequently discarded (not
+ // published), then the only side effect is that we might keep a
+ // to-be-deleted ThreadsList alive a little longer.
+ threads = Thread::untag_hazard_ptr(threads);
+ if (!_table->has_entry((void*)threads)) {
+ _table->add_entry((void*)threads);
+ }
+
+ // Any NestedThreadsLists are also protecting JavaThreads so
+ // gather those also; the ThreadsLists may be different.
+ for (NestedThreadsList* node = thread->get_nested_threads_hazard_ptr();
+ node != NULL; node = node->next()) {
+ threads = node->t_list();
+ if (!_table->has_entry((void*)threads)) {
+ _table->add_entry((void*)threads);
+ }
+ }
+ }
+};
+
+// Closure to print JavaThreads that have a hazard ptr (ThreadsList
+// reference) that contains an indirect reference to a specific JavaThread.
+//
+class ScanHazardPtrPrintMatchingThreadsClosure : public ThreadClosure {
+ private:
+ JavaThread *_thread;
+ public:
+ ScanHazardPtrPrintMatchingThreadsClosure(JavaThread *thread) : _thread(thread) {}
+
+ virtual void do_thread(Thread *thread) {
+ assert_locked_or_safepoint(Threads_lock);
+
+ if (thread == NULL) return;
+ ThreadsList *current_list = thread->get_threads_hazard_ptr();
+ if (current_list == NULL) {
+ assert(thread->get_nested_threads_hazard_ptr() == NULL,
+ "cannot have a nested hazard ptr with a NULL regular hazard ptr");
+ return;
+ }
+ // If the hazard ptr is unverified, then ignore it.
+ if (Thread::is_hazard_ptr_tagged(current_list)) return;
+
+ // The current JavaThread has a hazard ptr (ThreadsList reference)
+ // which might be _smr_java_thread_list or it might be an older
+ // ThreadsList that has been removed but not freed. In either case,
+ // the hazard ptr is protecting all the JavaThreads on that
+ // ThreadsList, but we only care about matching a specific JavaThread.
+ JavaThreadIterator jti(current_list);
+ for (JavaThread *p = jti.first(); p != NULL; p = jti.next()) {
+ if (p == _thread) {
+ log_debug(thread, smr)("tid=" UINTX_FORMAT ": ThreadsSMRSupport::smr_delete: thread1=" INTPTR_FORMAT " has a hazard pointer for thread2=" INTPTR_FORMAT, os::current_thread_id(), p2i(thread), p2i(_thread));
+ break;
+ }
+ }
+
+ // Any NestedThreadsLists are also protecting JavaThreads so
+ // check those also; the ThreadsLists may be different.
+ for (NestedThreadsList* node = thread->get_nested_threads_hazard_ptr();
+ node != NULL; node = node->next()) {
+ JavaThreadIterator jti(node->t_list());
+ for (JavaThread *p = jti.first(); p != NULL; p = jti.next()) {
+ if (p == _thread) {
+ log_debug(thread, smr)("tid=" UINTX_FORMAT ": ThreadsSMRSupport::smr_delete: thread1=" INTPTR_FORMAT " has a nested hazard pointer for thread2=" INTPTR_FORMAT, os::current_thread_id(), p2i(thread), p2i(_thread));
+ return;
+ }
+ }
+ }
+ }
+};
+
// 'entries + 1' so we always have at least one entry.
ThreadsList::ThreadsList(int entries) : _length(entries), _threads(NEW_C_HEAP_ARRAY(JavaThread*, entries + 1, mtThread)), _next_list(NULL) {
@@ -37,20 +384,87 @@
FREE_C_HEAP_ARRAY(JavaThread*, _threads);
}
-ThreadsListSetter::~ThreadsListSetter() {
- if (_target_needs_release) {
- // The hazard ptr in the target needs to be released.
- Threads::release_stable_list(_target);
+// Add a JavaThread to a ThreadsList. The returned ThreadsList is a
+// new copy of the specified ThreadsList with the specified JavaThread
+// appended to the end.
+ThreadsList *ThreadsList::add_thread(ThreadsList *list, JavaThread *java_thread) {
+ const uint index = list->_length;
+ const uint new_length = index + 1;
+ const uint head_length = index;
+ ThreadsList *const new_list = new ThreadsList(new_length);
+
+ if (head_length > 0) {
+ Copy::disjoint_words((HeapWord*)list->_threads, (HeapWord*)new_list->_threads, head_length);
}
+ *(JavaThread**)(new_list->_threads + index) = java_thread;
+
+ return new_list;
+}
+
+int ThreadsList::find_index_of_JavaThread(JavaThread *target) {
+ if (target == NULL) {
+ return -1;
+ }
+ for (uint i = 0; i < length(); i++) {
+ if (target == thread_at(i)) {
+ return (int)i;
+ }
+ }
+ return -1;
}
-void ThreadsListSetter::set() {
- assert(_target->get_threads_hazard_ptr() == NULL, "hazard ptr should not already be set");
- (void) Threads::acquire_stable_list(_target, /* is_ThreadsListSetter */ true);
- _target_needs_release = true;
+JavaThread* ThreadsList::find_JavaThread_from_java_tid(jlong java_tid) const {
+ for (uint i = 0; i < length(); i++) {
+ JavaThread* thread = thread_at(i);
+ oop tobj = thread->threadObj();
+ // Ignore the thread if it hasn't run yet, has exited
+ // or is starting to exit.
+ if (tobj != NULL && !thread->is_exiting() &&
+ java_tid == java_lang_Thread::thread_id(tobj)) {
+ // found a match
+ return thread;
+ }
+ }
+ return NULL;
}
-ThreadsListHandle::ThreadsListHandle(Thread *self) : _list(Threads::acquire_stable_list(self, /* is_ThreadsListSetter */ false)), _self(self) {
+bool ThreadsList::includes(const JavaThread * const p) const {
+ if (p == NULL) {
+ return false;
+ }
+ for (uint i = 0; i < length(); i++) {
+ if (thread_at(i) == p) {
+ return true;
+ }
+ }
+ return false;
+}
+
+// Remove a JavaThread from a ThreadsList. The returned ThreadsList is a
+// new copy of the specified ThreadsList with the specified JavaThread
+// removed.
+ThreadsList *ThreadsList::remove_thread(ThreadsList* list, JavaThread* java_thread) {
+ assert(list->_length > 0, "sanity");
+
+ uint i = (uint)list->find_index_of_JavaThread(java_thread);
+ assert(i < list->_length, "did not find JavaThread on the list");
+ const uint index = i;
+ const uint new_length = list->_length - 1;
+ const uint head_length = index;
+ const uint tail_length = (new_length >= index) ? (new_length - index) : 0;
+ ThreadsList *const new_list = new ThreadsList(new_length);
+
+ if (head_length > 0) {
+ Copy::disjoint_words((HeapWord*)list->_threads, (HeapWord*)new_list->_threads, head_length);
+ }
+ if (tail_length > 0) {
+ Copy::disjoint_words((HeapWord*)list->_threads + index + 1, (HeapWord*)new_list->_threads + index, tail_length);
+ }
+
+ return new_list;
+}
+
+ThreadsListHandle::ThreadsListHandle(Thread *self) : _list(ThreadsSMRSupport::acquire_stable_list(self, /* is_ThreadsListSetter */ false)), _self(self) {
assert(self == Thread::current(), "sanity check");
if (EnableThreadSMRStatistics) {
_timer.start();
@@ -58,13 +472,11 @@
}
ThreadsListHandle::~ThreadsListHandle() {
- Threads::release_stable_list(_self);
+ ThreadsSMRSupport::release_stable_list(_self);
if (EnableThreadSMRStatistics) {
_timer.stop();
uint millis = (uint)_timer.milliseconds();
- Threads::inc_smr_tlh_cnt();
- Threads::add_smr_tlh_times(millis);
- Threads::update_smr_tlh_time_max(millis);
+ ThreadsSMRSupport::update_smr_tlh_stats(millis);
}
}
@@ -119,3 +531,546 @@
*jt_pp = java_thread;
return true;
}
+
+ThreadsListSetter::~ThreadsListSetter() {
+ if (_target_needs_release) {
+ // The hazard ptr in the target needs to be released.
+ ThreadsSMRSupport::release_stable_list(_target);
+ }
+}
+
+void ThreadsListSetter::set() {
+ assert(_target->get_threads_hazard_ptr() == NULL, "hazard ptr should not already be set");
+ (void) ThreadsSMRSupport::acquire_stable_list(_target, /* is_ThreadsListSetter */ true);
+ _target_needs_release = true;
+}
+
+// Acquire a stable ThreadsList.
+//
+ThreadsList *ThreadsSMRSupport::acquire_stable_list(Thread *self, bool is_ThreadsListSetter) {
+ assert(self != NULL, "sanity check");
+ // acquire_stable_list_nested_path() will grab the Threads_lock
+ // so let's make sure the ThreadsListHandle is in a safe place.
+ // ThreadsListSetter cannot make this check on this code path.
+ debug_only(if (!is_ThreadsListSetter && StrictSafepointChecks) self->check_for_valid_safepoint_state(/* potential_vm_operation */ false);)
+
+ if (self->get_threads_hazard_ptr() == NULL) {
+ // The typical case is first.
+ return acquire_stable_list_fast_path(self);
+ }
+
+ // The nested case is rare.
+ return acquire_stable_list_nested_path(self);
+}
+
+// Fast path (and lock free) way to acquire a stable ThreadsList.
+//
+ThreadsList *ThreadsSMRSupport::acquire_stable_list_fast_path(Thread *self) {
+ assert(self != NULL, "sanity check");
+ assert(self->get_threads_hazard_ptr() == NULL, "sanity check");
+ assert(self->get_nested_threads_hazard_ptr() == NULL,
+ "cannot have a nested hazard ptr with a NULL regular hazard ptr");
+
+ ThreadsList* threads;
+
+ // Stable recording of a hazard ptr for SMR. This code does not use
+ // locks so its use of the _smr_java_thread_list & _threads_hazard_ptr
+ // fields is racy relative to code that uses those fields with locks.
+ // OrderAccess and Atomic functions are used to deal with those races.
+ //
+ while (true) {
+ threads = get_smr_java_thread_list();
+
+ // Publish a tagged hazard ptr to denote that the hazard ptr is not
+ // yet verified as being stable. Due to the fence after the hazard
+ // ptr write, it will be sequentially consistent w.r.t. the
+ // sequentially consistent writes of the ThreadsList, even on
+ // non-multiple copy atomic machines where stores can be observed
+ // in different order from different observer threads.
+ ThreadsList* unverified_threads = Thread::tag_hazard_ptr(threads);
+ self->set_threads_hazard_ptr(unverified_threads);
+
+ // If _smr_java_thread_list has changed, we have lost a race with
+ // Threads::add() or Threads::remove() and have to try again.
+ if (get_smr_java_thread_list() != threads) {
+ continue;
+ }
+
+ // We try to remove the tag which will verify the hazard ptr as
+ // being stable. This exchange can race with a scanning thread
+ // which might invalidate the tagged hazard ptr to keep it from
+ // being followed to access JavaThread ptrs. If we lose the race,
+ // we simply retry. If we win the race, then the stable hazard
+ // ptr is officially published.
+ if (self->cmpxchg_threads_hazard_ptr(threads, unverified_threads) == unverified_threads) {
+ break;
+ }
+ }
+
+ // A stable hazard ptr has been published letting other threads know
+ // that the ThreadsList and the JavaThreads reachable from this list
+ // are protected and hence they should not be deleted until everyone
+ // agrees it is safe to do so.
+
+ return threads;
+}
+
+// Acquire a nested stable ThreadsList; this is rare so it uses
+// Threads_lock.
+//
+ThreadsList *ThreadsSMRSupport::acquire_stable_list_nested_path(Thread *self) {
+ assert(self != NULL, "sanity check");
+ assert(self->get_threads_hazard_ptr() != NULL,
+ "cannot have a NULL regular hazard ptr when acquiring a nested hazard ptr");
+
+ // The thread already has a hazard ptr (ThreadsList ref) so we need
+ // to create a nested ThreadsListHandle with the current ThreadsList
+ // since it might be different than our current hazard ptr. The need
+ // for a nested ThreadsListHandle is rare so we do this while holding
+ // the Threads_lock so we don't race with the scanning code; the code
+ // is so much simpler this way.
+
+ NestedThreadsList* node;
+ {
+ // Only grab the Threads_lock if we don't already own it.
+ MutexLockerEx ml(Threads_lock->owned_by_self() ? NULL : Threads_lock);
+ node = new NestedThreadsList(get_smr_java_thread_list());
+ // We insert at the front of the list to match up with the delete
+ // in release_stable_list().
+ node->set_next(self->get_nested_threads_hazard_ptr());
+ self->set_nested_threads_hazard_ptr(node);
+ if (EnableThreadSMRStatistics) {
+ self->inc_nested_threads_hazard_ptr_cnt();
+ if (self->nested_threads_hazard_ptr_cnt() > _smr_nested_thread_list_max) {
+ _smr_nested_thread_list_max = self->nested_threads_hazard_ptr_cnt();
+ }
+ }
+ }
+ log_debug(thread, smr)("tid=" UINTX_FORMAT ": ThreadsSMRSupport::acquire_stable_list: add NestedThreadsList node containing ThreadsList=" INTPTR_FORMAT, os::current_thread_id(), p2i(node->t_list()));
+
+ return node->t_list();
+}
+
+void ThreadsSMRSupport::add_thread(JavaThread *thread){
+ ThreadsList *new_list = ThreadsList::add_thread(ThreadsSMRSupport::get_smr_java_thread_list(), thread);
+ if (EnableThreadSMRStatistics) {
+ ThreadsSMRSupport::inc_smr_java_thread_list_alloc_cnt();
+ ThreadsSMRSupport::update_smr_java_thread_list_max(new_list->length());
+ }
+ // Initial _smr_java_thread_list will not generate a "Threads::add" mesg.
+ log_debug(thread, smr)("tid=" UINTX_FORMAT ": Threads::add: new ThreadsList=" INTPTR_FORMAT, os::current_thread_id(), p2i(new_list));
+
+ ThreadsList *old_list = ThreadsSMRSupport::xchg_smr_java_thread_list(new_list);
+ ThreadsSMRSupport::smr_free_list(old_list);
+}
+
+// set_smr_delete_notify() and clear_smr_delete_notify() are called
+// under the protection of the smr_delete_lock, but we also use an
+// Atomic operation to ensure the memory update is seen earlier than
+// when the smr_delete_lock is dropped.
+//
+void ThreadsSMRSupport::clear_smr_delete_notify() {
+ Atomic::dec(&_smr_delete_notify);
+}
+
+// Return true if the specified JavaThread is protected by a hazard
+// pointer (ThreadsList reference). Otherwise, returns false.
+//
+bool ThreadsSMRSupport::is_a_protected_JavaThread(JavaThread *thread) {
+ assert_locked_or_safepoint(Threads_lock);
+
+ // Hash table size should be first power of two higher than twice
+ // the length of the Threads list.
+ int hash_table_size = MIN2((int)get_smr_java_thread_list()->length(), 32) << 1;
+ hash_table_size--;
+ hash_table_size |= hash_table_size >> 1;
+ hash_table_size |= hash_table_size >> 2;
+ hash_table_size |= hash_table_size >> 4;
+ hash_table_size |= hash_table_size >> 8;
+ hash_table_size |= hash_table_size >> 16;
+ hash_table_size++;
+
+ // Gather a hash table of the JavaThreads indirectly referenced by
+ // hazard ptrs.
+ ThreadScanHashtable *scan_table = new ThreadScanHashtable(hash_table_size);
+ ScanHazardPtrGatherProtectedThreadsClosure scan_cl(scan_table);
+ Threads::threads_do(&scan_cl);
+
+ bool thread_is_protected = false;
+ if (scan_table->has_entry((void*)thread)) {
+ thread_is_protected = true;
+ }
+ delete scan_table;
+ return thread_is_protected;
+}
+
+// Release a stable ThreadsList.
+//
+void ThreadsSMRSupport::release_stable_list(Thread *self) {
+ assert(self != NULL, "sanity check");
+ // release_stable_list_nested_path() will grab the Threads_lock
+ // so let's make sure the ThreadsListHandle is in a safe place.
+ debug_only(if (StrictSafepointChecks) self->check_for_valid_safepoint_state(/* potential_vm_operation */ false);)
+
+ if (self->get_nested_threads_hazard_ptr() == NULL) {
+ // The typical case is first.
+ release_stable_list_fast_path(self);
+ return;
+ }
+
+ // The nested case is rare.
+ release_stable_list_nested_path(self);
+}
+
+// Fast path way to release a stable ThreadsList. The release portion
+// is lock-free, but the wake up portion is not.
+//
+void ThreadsSMRSupport::release_stable_list_fast_path(Thread *self) {
+ assert(self != NULL, "sanity check");
+ assert(self->get_threads_hazard_ptr() != NULL, "sanity check");
+ assert(self->get_nested_threads_hazard_ptr() == NULL,
+ "cannot have a nested hazard ptr when releasing a regular hazard ptr");
+
+ // After releasing the hazard ptr, other threads may go ahead and
+ // free up some memory temporarily used by a ThreadsList snapshot.
+ self->set_threads_hazard_ptr(NULL);
+
+ // We use double-check locking to reduce traffic on the system
+ // wide smr_delete_lock.
+ if (ThreadsSMRSupport::smr_delete_notify()) {
+ // An exiting thread might be waiting in smr_delete(); we need to
+ // check with smr_delete_lock to be sure.
+ release_stable_list_wake_up((char *) "regular hazard ptr");
+ }
+}
+
+// Release a nested stable ThreadsList; this is rare so it uses
+// Threads_lock.
+//
+void ThreadsSMRSupport::release_stable_list_nested_path(Thread *self) {
+ assert(self != NULL, "sanity check");
+ assert(self->get_nested_threads_hazard_ptr() != NULL, "sanity check");
+ assert(self->get_threads_hazard_ptr() != NULL,
+ "must have a regular hazard ptr to have nested hazard ptrs");
+
+ // We have a nested ThreadsListHandle so we have to release it first.
+ // The need for a nested ThreadsListHandle is rare so we do this while
+ // holding the Threads_lock so we don't race with the scanning code;
+ // the code is so much simpler this way.
+
+ NestedThreadsList *node;
+ {
+ // Only grab the Threads_lock if we don't already own it.
+ MutexLockerEx ml(Threads_lock->owned_by_self() ? NULL : Threads_lock);
+ // We remove from the front of the list to match up with the insert
+ // in acquire_stable_list().
+ node = self->get_nested_threads_hazard_ptr();
+ self->set_nested_threads_hazard_ptr(node->next());
+ if (EnableThreadSMRStatistics) {
+ self->dec_nested_threads_hazard_ptr_cnt();
+ }
+ }
+
+ // An exiting thread might be waiting in smr_delete(); we need to
+ // check with smr_delete_lock to be sure.
+ release_stable_list_wake_up((char *) "nested hazard ptr");
+
+ log_debug(thread, smr)("tid=" UINTX_FORMAT ": ThreadsSMRSupport::release_stable_list: delete NestedThreadsList node containing ThreadsList=" INTPTR_FORMAT, os::current_thread_id(), p2i(node->t_list()));
+
+ delete node;
+}
+
+// Wake up portion of the release stable ThreadsList protocol;
+// uses the smr_delete_lock().
+//
+void ThreadsSMRSupport::release_stable_list_wake_up(char *log_str) {
+ assert(log_str != NULL, "sanity check");
+
+ // Note: smr_delete_lock is held in smr_delete() for the entire
+ // hazard ptr search so that we do not lose this notify() if
+ // the exiting thread has to wait. That code path also holds
+ // Threads_lock (which was grabbed before smr_delete_lock) so that
+ // threads_do() can be called. This means the system can't start a
+ // safepoint which means this thread can't take too long to get to
+ // a safepoint because of being blocked on smr_delete_lock.
+ //
+ MonitorLockerEx ml(ThreadsSMRSupport::smr_delete_lock(), Monitor::_no_safepoint_check_flag);
+ if (ThreadsSMRSupport::smr_delete_notify()) {
+ // Notify any exiting JavaThreads that are waiting in smr_delete()
+ // that we've released a ThreadsList.
+ ml.notify_all();
+ log_debug(thread, smr)("tid=" UINTX_FORMAT ": ThreadsSMRSupport::release_stable_list notified %s", os::current_thread_id(), log_str);
+ }
+}
+
+void ThreadsSMRSupport::remove_thread(JavaThread *thread) {
+ ThreadsList *new_list = ThreadsList::remove_thread(ThreadsSMRSupport::get_smr_java_thread_list(), thread);
+ if (EnableThreadSMRStatistics) {
+ ThreadsSMRSupport::inc_smr_java_thread_list_alloc_cnt();
+ // This list is smaller so no need to check for a "longest" update.
+ }
+
+ // Final _smr_java_thread_list will not generate a "Threads::remove" mesg.
+ log_debug(thread, smr)("tid=" UINTX_FORMAT ": Threads::remove: new ThreadsList=" INTPTR_FORMAT, os::current_thread_id(), p2i(new_list));
+
+ ThreadsList *old_list = ThreadsSMRSupport::xchg_smr_java_thread_list(new_list);
+ ThreadsSMRSupport::smr_free_list(old_list);
+}
+
+// See note for clear_smr_delete_notify().
+//
+void ThreadsSMRSupport::set_smr_delete_notify() {
+ Atomic::inc(&_smr_delete_notify);
+}
+
+// Safely delete a JavaThread when it is no longer in use by a
+// ThreadsListHandle.
+//
+void ThreadsSMRSupport::smr_delete(JavaThread *thread) {
+ assert(!Threads_lock->owned_by_self(), "sanity");
+
+ bool has_logged_once = false;
+ elapsedTimer timer;
+ if (EnableThreadSMRStatistics) {
+ timer.start();
+ }
+
+ while (true) {
+ {
+ // No safepoint check because this JavaThread is not on the
+ // Threads list.
+ MutexLockerEx ml(Threads_lock, Mutex::_no_safepoint_check_flag);
+ // Cannot use a MonitorLockerEx helper here because we have
+ // to drop the Threads_lock first if we wait.
+ ThreadsSMRSupport::smr_delete_lock()->lock_without_safepoint_check();
+ // Set the smr_delete_notify flag after we grab smr_delete_lock
+ // and before we scan hazard ptrs because we're doing
+ // double-check locking in release_stable_list().
+ ThreadsSMRSupport::set_smr_delete_notify();
+
+ if (!is_a_protected_JavaThread(thread)) {
+ // This is the common case.
+ ThreadsSMRSupport::clear_smr_delete_notify();
+ ThreadsSMRSupport::smr_delete_lock()->unlock();
+ break;
+ }
+ if (!has_logged_once) {
+ has_logged_once = true;
+ log_debug(thread, smr)("tid=" UINTX_FORMAT ": ThreadsSMRSupport::smr_delete: thread=" INTPTR_FORMAT " is not deleted.", os::current_thread_id(), p2i(thread));
+ if (log_is_enabled(Debug, os, thread)) {
+ ScanHazardPtrPrintMatchingThreadsClosure scan_cl(thread);
+ Threads::threads_do(&scan_cl);
+ }
+ }
+ } // We have to drop the Threads_lock to wait or delete the thread
+
+ if (EnableThreadSMRStatistics) {
+ _smr_delete_lock_wait_cnt++;
+ if (_smr_delete_lock_wait_cnt > _smr_delete_lock_wait_max) {
+ _smr_delete_lock_wait_max = _smr_delete_lock_wait_cnt;
+ }
+ }
+ // Wait for a release_stable_list() call before we check again. No
+ // safepoint check, no timeout, and not as suspend equivalent flag
+ // because this JavaThread is not on the Threads list.
+ ThreadsSMRSupport::smr_delete_lock()->wait(Mutex::_no_safepoint_check_flag, 0,
+ !Mutex::_as_suspend_equivalent_flag);
+ if (EnableThreadSMRStatistics) {
+ _smr_delete_lock_wait_cnt--;
+ }
+
+ ThreadsSMRSupport::clear_smr_delete_notify();
+ ThreadsSMRSupport::smr_delete_lock()->unlock();
+ // Retry the whole scenario.
+ }
+
+ if (ThreadLocalHandshakes) {
+ // The thread is about to be deleted so cancel any handshake.
+ thread->cancel_handshake();
+ }
+
+ delete thread;
+ if (EnableThreadSMRStatistics) {
+ timer.stop();
+ uint millis = (uint)timer.milliseconds();
+ ThreadsSMRSupport::inc_smr_deleted_thread_cnt();
+ ThreadsSMRSupport::add_smr_deleted_thread_times(millis);
+ ThreadsSMRSupport::update_smr_deleted_thread_time_max(millis);
+ }
+
+ log_debug(thread, smr)("tid=" UINTX_FORMAT ": ThreadsSMRSupport::smr_delete: thread=" INTPTR_FORMAT " is deleted.", os::current_thread_id(), p2i(thread));
+}
+
+bool ThreadsSMRSupport::smr_delete_notify() {
+ // Use load_acquire() in order to see any updates to _smr_delete_notify
+ // earlier than when smr_delete_lock is grabbed.
+ return (OrderAccess::load_acquire(&_smr_delete_notify) != 0);
+}
+
+// Safely free a ThreadsList after a Threads::add() or Threads::remove().
+// The specified ThreadsList may not get deleted during this call if it
+// is still in-use (referenced by a hazard ptr). Other ThreadsLists
+// in the chain may get deleted by this call if they are no longer in-use.
+void ThreadsSMRSupport::smr_free_list(ThreadsList* threads) {
+ assert_locked_or_safepoint(Threads_lock);
+
+ threads->set_next_list(_smr_to_delete_list);
+ _smr_to_delete_list = threads;
+ if (EnableThreadSMRStatistics) {
+ _smr_to_delete_list_cnt++;
+ if (_smr_to_delete_list_cnt > _smr_to_delete_list_max) {
+ _smr_to_delete_list_max = _smr_to_delete_list_cnt;
+ }
+ }
+
+ // Hash table size should be first power of two higher than twice the length of the ThreadsList
+ int hash_table_size = MIN2((int)get_smr_java_thread_list()->length(), 32) << 1;
+ hash_table_size--;
+ hash_table_size |= hash_table_size >> 1;
+ hash_table_size |= hash_table_size >> 2;
+ hash_table_size |= hash_table_size >> 4;
+ hash_table_size |= hash_table_size >> 8;
+ hash_table_size |= hash_table_size >> 16;
+ hash_table_size++;
+
+ // Gather a hash table of the current hazard ptrs:
+ ThreadScanHashtable *scan_table = new ThreadScanHashtable(hash_table_size);
+ ScanHazardPtrGatherThreadsListClosure scan_cl(scan_table);
+ Threads::threads_do(&scan_cl);
+
+ // Walk through the linked list of pending freeable ThreadsLists
+ // and free the ones that are not referenced from hazard ptrs.
+ ThreadsList* current = _smr_to_delete_list;
+ ThreadsList* prev = NULL;
+ ThreadsList* next = NULL;
+ bool threads_is_freed = false;
+ while (current != NULL) {
+ next = current->next_list();
+ if (!scan_table->has_entry((void*)current)) {
+ // This ThreadsList is not referenced by a hazard ptr.
+ if (prev != NULL) {
+ prev->set_next_list(next);
+ }
+ if (_smr_to_delete_list == current) {
+ _smr_to_delete_list = next;
+ }
+
+ log_debug(thread, smr)("tid=" UINTX_FORMAT ": ThreadsSMRSupport::smr_free_list: threads=" INTPTR_FORMAT " is freed.", os::current_thread_id(), p2i(current));
+ if (current == threads) threads_is_freed = true;
+ delete current;
+ if (EnableThreadSMRStatistics) {
+ _smr_java_thread_list_free_cnt++;
+ _smr_to_delete_list_cnt--;
+ }
+ } else {
+ prev = current;
+ }
+ current = next;
+ }
+
+ if (!threads_is_freed) {
+ // Only report "is not freed" on the original call to
+ // smr_free_list() for this ThreadsList.
+ log_debug(thread, smr)("tid=" UINTX_FORMAT ": ThreadsSMRSupport::smr_free_list: threads=" INTPTR_FORMAT " is not freed.", os::current_thread_id(), p2i(threads));
+ }
+
+ delete scan_table;
+}
+
+
+// Debug, logging, and printing stuff at the end:
+
+// Log Threads class SMR info.
+void ThreadsSMRSupport::log_smr_statistics() {
+ LogTarget(Info, thread, smr) log;
+ if (log.is_enabled()) {
+ LogStream out(log);
+ print_smr_info_on(&out);
+ }
+}
+
+// Print Threads class SMR info.
+void ThreadsSMRSupport::print_smr_info_on(outputStream* st) {
+ // Only grab the Threads_lock if we don't already own it
+ // and if we are not reporting an error.
+ MutexLockerEx ml((Threads_lock->owned_by_self() || VMError::is_error_reported()) ? NULL : Threads_lock);
+
+ st->print_cr("Threads class SMR info:");
+ st->print_cr("_smr_java_thread_list=" INTPTR_FORMAT ", length=%u, "
+ "elements={", p2i(_smr_java_thread_list),
+ _smr_java_thread_list->length());
+ print_smr_info_elements_on(st, _smr_java_thread_list);
+ st->print_cr("}");
+ if (_smr_to_delete_list != NULL) {
+ st->print_cr("_smr_to_delete_list=" INTPTR_FORMAT ", length=%u, "
+ "elements={", p2i(_smr_to_delete_list),
+ _smr_to_delete_list->length());
+ print_smr_info_elements_on(st, _smr_to_delete_list);
+ st->print_cr("}");
+ for (ThreadsList *t_list = _smr_to_delete_list->next_list();
+ t_list != NULL; t_list = t_list->next_list()) {
+ st->print("next-> " INTPTR_FORMAT ", length=%u, "
+ "elements={", p2i(t_list), t_list->length());
+ print_smr_info_elements_on(st, t_list);
+ st->print_cr("}");
+ }
+ }
+ if (!EnableThreadSMRStatistics) {
+ return;
+ }
+ st->print_cr("_smr_java_thread_list_alloc_cnt=" UINT64_FORMAT ","
+ "_smr_java_thread_list_free_cnt=" UINT64_FORMAT ","
+ "_smr_java_thread_list_max=%u, "
+ "_smr_nested_thread_list_max=%u",
+ _smr_java_thread_list_alloc_cnt,
+ _smr_java_thread_list_free_cnt,
+ _smr_java_thread_list_max,
+ _smr_nested_thread_list_max);
+ if (_smr_tlh_cnt > 0) {
+ st->print_cr("_smr_tlh_cnt=%u"
+ ", _smr_tlh_times=%u"
+ ", avg_smr_tlh_time=%0.2f"
+ ", _smr_tlh_time_max=%u",
+ _smr_tlh_cnt, _smr_tlh_times,
+ ((double) _smr_tlh_times / _smr_tlh_cnt),
+ _smr_tlh_time_max);
+ }
+ if (_smr_deleted_thread_cnt > 0) {
+ st->print_cr("_smr_deleted_thread_cnt=%u"
+ ", _smr_deleted_thread_times=%u"
+ ", avg_smr_deleted_thread_time=%0.2f"
+ ", _smr_deleted_thread_time_max=%u",
+ _smr_deleted_thread_cnt, _smr_deleted_thread_times,
+ ((double) _smr_deleted_thread_times / _smr_deleted_thread_cnt),
+ _smr_deleted_thread_time_max);
+ }
+ st->print_cr("_smr_delete_lock_wait_cnt=%u, _smr_delete_lock_wait_max=%u",
+ _smr_delete_lock_wait_cnt, _smr_delete_lock_wait_max);
+ st->print_cr("_smr_to_delete_list_cnt=%u, _smr_to_delete_list_max=%u",
+ _smr_to_delete_list_cnt, _smr_to_delete_list_max);
+}
+
+// Print ThreadsList elements (4 per line).
+void ThreadsSMRSupport::print_smr_info_elements_on(outputStream* st,
+ ThreadsList* t_list) {
+ uint cnt = 0;
+ JavaThreadIterator jti(t_list);
+ for (JavaThread *jt = jti.first(); jt != NULL; jt = jti.next()) {
+ st->print(INTPTR_FORMAT, p2i(jt));
+ if (cnt < t_list->length() - 1) {
+ // Separate with comma or comma-space except for the last one.
+ if (((cnt + 1) % 4) == 0) {
+ // Four INTPTR_FORMAT fit on an 80 column line so end the
+ // current line with just a comma.
+ st->print_cr(",");
+ } else {
+ // Not the last one on the current line so use comma-space:
+ st->print(", ");
+ }
+ } else {
+ // Last one so just end the current line.
+ st->cr();
+ }
+ cnt++;
+ }
+}
--- a/src/hotspot/share/runtime/threadSMR.hpp Wed Dec 13 14:21:12 2017 -0800
+++ b/src/hotspot/share/runtime/threadSMR.hpp Mon Dec 18 10:28:43 2017 -0800
@@ -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 @@
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 @@
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.
--- a/src/hotspot/share/runtime/threadSMR.inline.hpp Wed Dec 13 14:21:12 2017 -0800
+++ b/src/hotspot/share/runtime/threadSMR.inline.hpp Mon Dec 18 10:28:43 2017 -0800
@@ -52,6 +52,32 @@
}
}
+// 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 @@
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
--- a/src/hotspot/share/runtime/vmStructs.cpp Wed Dec 13 14:21:12 2017 -0800
+++ b/src/hotspot/share/runtime/vmStructs.cpp Mon Dec 18 10:28:43 2017 -0800
@@ -1991,6 +1991,7 @@
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) \
--- a/src/hotspot/share/runtime/vm_operations.hpp Wed Dec 13 14:21:12 2017 -0800
+++ b/src/hotspot/share/runtime/vm_operations.hpp Mon Dec 18 10:28:43 2017 -0800
@@ -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
--- a/src/hotspot/share/runtime/vm_version.cpp Wed Dec 13 14:21:12 2017 -0800
+++ b/src/hotspot/share/runtime/vm_version.cpp Mon Dec 18 10:28:43 2017 -0800
@@ -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 @@
#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 @@
// 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;
--- a/src/hotspot/share/services/threadService.hpp Wed Dec 13 14:21:12 2017 -0800
+++ b/src/hotspot/share/services/threadService.hpp Mon Dec 18 10:28:43 2017 -0800
@@ -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"
--- a/src/java.base/share/classes/java/lang/Runtime.java Wed Dec 13 14:21:12 2017 -0800
+++ b/src/java.base/share/classes/java/lang/Runtime.java Mon Dec 18 10:28:43 2017 -0800
@@ -899,81 +899,68 @@
*
* <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 SE Platform
- * Specification, <em>e.g.</em>, <a
- * href="https://jcp.org/en/jsr/detail?id=337">JSR 337</a> for
- * Java SE 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 8 is {@code 8}; the {@code $MAJOR} version
- * number of JDK 9 is {@code 9}. When {@code $MAJOR} is incremented,
- * all subsequent elements are removed. </p></li>
+ * <li><p> <a id="FEATURE">{@code $FEATURE}</a> — 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> — 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> — 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> — 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 @@
* <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>
+ * — 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]*)} — 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.]+)}
+ * — 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 @@
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 @@
}
/**
- * 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 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 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.
*
- * @return An unmodifiable list of the integer numerals
- * contained in the version number
+ * @deprecated As of Java 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 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;
--- a/src/java.base/share/classes/java/lang/System.java Wed Dec 13 14:21:12 2017 -0800
+++ b/src/java.base/share/classes/java/lang/System.java Mon Dec 18 10:28:43 2017 -0800
@@ -550,8 +550,10 @@
* 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 @@
* </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>
--- a/src/java.base/share/classes/java/lang/VersionProps.java.template Wed Dec 13 14:21:12 2017 -0800
+++ b/src/java.base/share/classes/java/lang/VersionProps.java.template Mon Dec 18 10:28:43 2017 -0800
@@ -32,13 +32,15 @@
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 @@
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 @@
/* 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 + ")");
+
}
}
--- a/src/java.base/share/classes/java/util/Optional.java Wed Dec 13 14:21:12 2017 -0800
+++ b/src/java.base/share/classes/java/util/Optional.java Mon Dec 18 10:28:43 2017 -0800
@@ -32,8 +32,9 @@
/**
* 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 @@
* {@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) {
@@ -362,6 +359,21 @@
}
/**
+ * 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.
*
--- a/src/java.base/share/classes/java/util/OptionalDouble.java Wed Dec 13 14:21:12 2017 -0800
+++ b/src/java.base/share/classes/java/util/OptionalDouble.java Mon Dec 18 10:28:43 2017 -0800
@@ -30,9 +30,10 @@
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 @@
* {@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) {
@@ -226,6 +223,21 @@
}
/**
+ * 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.
*
--- a/src/java.base/share/classes/java/util/OptionalInt.java Wed Dec 13 14:21:12 2017 -0800
+++ b/src/java.base/share/classes/java/util/OptionalInt.java Mon Dec 18 10:28:43 2017 -0800
@@ -30,9 +30,10 @@
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 @@
* {@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) {
@@ -225,6 +222,21 @@
}
/**
+ * 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.
*
--- a/src/java.base/share/classes/java/util/OptionalLong.java Wed Dec 13 14:21:12 2017 -0800
+++ b/src/java.base/share/classes/java/util/OptionalLong.java Mon Dec 18 10:28:43 2017 -0800
@@ -30,9 +30,10 @@
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 @@
* {@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) {
@@ -225,6 +222,21 @@
}
/**
+ * 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.
*
--- a/src/java.base/share/classes/java/util/jar/JarFile.java Wed Dec 13 14:21:12 2017 -0800
+++ b/src/java.base/share/classes/java/util/jar/JarFile.java Mon Dec 18 10:28:43 2017 -0800
@@ -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 @@
* <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 @@
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 @@
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 @@
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 @@
* 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 @@
* <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 @@
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 @@
// 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 @@
}
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 @@
}
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);
--- a/src/java.base/share/classes/java/util/zip/Deflater.java Wed Dec 13 14:21:12 2017 -0800
+++ b/src/java.base/share/classes/java/util/zip/Deflater.java Mon Dec 18 10:28:43 2017 -0800
@@ -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 @@
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 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 @@
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();
+ }
+ }
+ }
}
--- a/src/java.base/share/classes/java/util/zip/Inflater.java Wed Dec 13 14:21:12 2017 -0800
+++ b/src/java.base/share/classes/java/util/zip/Inflater.java Mon Dec 18 10:28:43 2017 -0800
@@ -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 @@
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 @@
* @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 @@
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();
+ }
+ }
+ }
}
--- a/src/java.base/share/classes/java/util/zip/ZStreamRef.java Wed Dec 13 14:21:12 2017 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -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();
- }
- }
-}
--- a/src/java.base/share/classes/java/util/zip/ZipFile.java Wed Dec 13 14:21:12 2017 -0800
+++ b/src/java.base/share/classes/java/util/zip/ZipFile.java Mon Dec 18 10:28:43 2017 -0800
@@ -412,6 +412,21 @@
}
}
+ 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 @@
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)
--- a/src/java.base/share/classes/sun/security/tools/keytool/Main.java Wed Dec 13 14:21:12 2017 -0800
+++ b/src/java.base/share/classes/sun/security/tools/keytool/Main.java Mon Dec 18 10:28:43 2017 -0800
@@ -1058,11 +1058,6 @@
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 @@
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 @@
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 @@
}
}
}
+
+ 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.
--- a/src/java.base/share/native/include/jvm.h Wed Dec 13 14:21:12 2017 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1328 +0,0 @@
-/*
- * 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
- * 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.
- */
-
-#ifndef _JAVASOFT_JVM_H_
-#define _JAVASOFT_JVM_H_
-
-#include <sys/stat.h>
-
-#include "jni.h"
-#include "jvm_md.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
- * This file contains additional functions exported from the VM.
- * These functions are complementary to the standard JNI support.
- * There are three parts to this file:
- *
- * First, this file contains the VM-related functions needed by native
- * libraries in the standard Java API. For example, the java.lang.Object
- * class needs VM-level functions that wait for and notify monitors.
- *
- * Second, this file contains the functions and constant definitions
- * needed by the byte code verifier and class file format checker.
- * These functions allow the verifier and format checker to be written
- * in a VM-independent way.
- *
- * Third, this file contains various I/O and network operations needed
- * by the standard Java I/O and network APIs.
- */
-
-/*
- * Bump the version number when either of the following happens:
- *
- * 1. There is a change in JVM_* functions.
- *
- * 2. There is a change in the contract between VM and Java classes.
- * For example, if the VM relies on a new private field in Thread
- * class.
- */
-
-#define JVM_INTERFACE_VERSION 5
-
-JNIEXPORT jint JNICALL
-JVM_GetInterfaceVersion(void);
-
-/*************************************************************************
- PART 1: Functions for Native Libraries
- ************************************************************************/
-/*
- * java.lang.Object
- */
-JNIEXPORT jint JNICALL
-JVM_IHashCode(JNIEnv *env, jobject obj);
-
-JNIEXPORT void JNICALL
-JVM_MonitorWait(JNIEnv *env, jobject obj, jlong ms);
-
-JNIEXPORT void JNICALL
-JVM_MonitorNotify(JNIEnv *env, jobject obj);
-
-JNIEXPORT void JNICALL
-JVM_MonitorNotifyAll(JNIEnv *env, jobject obj);
-
-JNIEXPORT jobject JNICALL
-JVM_Clone(JNIEnv *env, jobject obj);
-
-/*
- * java.lang.String
- */
-JNIEXPORT jstring JNICALL
-JVM_InternString(JNIEnv *env, jstring str);
-
-/*
- * java.lang.System
- */
-JNIEXPORT jlong JNICALL
-JVM_CurrentTimeMillis(JNIEnv *env, jclass ignored);
-
-JNIEXPORT jlong JNICALL
-JVM_NanoTime(JNIEnv *env, jclass ignored);
-
-JNIEXPORT jlong JNICALL
-JVM_GetNanoTimeAdjustment(JNIEnv *env, jclass ignored, jlong offset_secs);
-
-JNIEXPORT void JNICALL
-JVM_ArrayCopy(JNIEnv *env, jclass ignored, jobject src, jint src_pos,
- jobject dst, jint dst_pos, jint length);
-
-JNIEXPORT jobject JNICALL
-JVM_InitProperties(JNIEnv *env, jobject p);
-
-
-/*
- * java.lang.Runtime
- */
-JNIEXPORT void JNICALL
-JVM_Halt(jint code);
-
-JNIEXPORT void JNICALL
-JVM_GC(void);
-
-/* Returns the number of real-time milliseconds that have elapsed since the
- * least-recently-inspected heap object was last inspected by the garbage
- * collector.
- *
- * For simple stop-the-world collectors this value is just the time
- * since the most recent collection. For generational collectors it is the
- * time since the oldest generation was most recently collected. Other
- * collectors are free to return a pessimistic estimate of the elapsed time, or
- * simply the time since the last full collection was performed.
- *
- * Note that in the presence of reference objects, a given object that is no
- * longer strongly reachable may have to be inspected multiple times before it
- * can be reclaimed.
- */
-JNIEXPORT jlong JNICALL
-JVM_MaxObjectInspectionAge(void);
-
-JNIEXPORT jlong JNICALL
-JVM_TotalMemory(void);
-
-JNIEXPORT jlong JNICALL
-JVM_FreeMemory(void);
-
-JNIEXPORT jlong JNICALL
-JVM_MaxMemory(void);
-
-JNIEXPORT jint JNICALL
-JVM_ActiveProcessorCount(void);
-
-JNIEXPORT void * JNICALL
-JVM_LoadLibrary(const char *name);
-
-JNIEXPORT void JNICALL
-JVM_UnloadLibrary(void * handle);
-
-JNIEXPORT void * JNICALL
-JVM_FindLibraryEntry(void *handle, const char *name);
-
-JNIEXPORT jboolean JNICALL
-JVM_IsSupportedJNIVersion(jint version);
-
-JNIEXPORT jobjectArray JNICALL
-JVM_GetVmArguments(JNIEnv *env);
-
-
-/*
- * java.lang.Throwable
- */
-JNIEXPORT void JNICALL
-JVM_FillInStackTrace(JNIEnv *env, jobject throwable);
-
-/*
- * java.lang.StackTraceElement
- */
-JNIEXPORT void JNICALL
-JVM_InitStackTraceElementArray(JNIEnv *env, jobjectArray elements, jobject throwable);
-
-JNIEXPORT void JNICALL
-JVM_InitStackTraceElement(JNIEnv* env, jobject element, jobject stackFrameInfo);
-
-/*
- * java.lang.StackWalker
- */
-enum {
- JVM_STACKWALK_FILL_CLASS_REFS_ONLY = 0x2,
- JVM_STACKWALK_GET_CALLER_CLASS = 0x04,
- JVM_STACKWALK_SHOW_HIDDEN_FRAMES = 0x20,
- JVM_STACKWALK_FILL_LIVE_STACK_FRAMES = 0x100
-};
-
-JNIEXPORT jobject JNICALL
-JVM_CallStackWalk(JNIEnv *env, jobject stackStream, jlong mode,
- jint skip_frames, jint frame_count, jint start_index,
- jobjectArray frames);
-
-JNIEXPORT jint JNICALL
-JVM_MoreStackWalk(JNIEnv *env, jobject stackStream, jlong mode, jlong anchor,
- jint frame_count, jint start_index,
- jobjectArray frames);
-
-/*
- * java.lang.Thread
- */
-JNIEXPORT void JNICALL
-JVM_StartThread(JNIEnv *env, jobject thread);
-
-JNIEXPORT void JNICALL
-JVM_StopThread(JNIEnv *env, jobject thread, jobject exception);
-
-JNIEXPORT jboolean JNICALL
-JVM_IsThreadAlive(JNIEnv *env, jobject thread);
-
-JNIEXPORT void JNICALL
-JVM_SuspendThread(JNIEnv *env, jobject thread);
-
-JNIEXPORT void JNICALL
-JVM_ResumeThread(JNIEnv *env, jobject thread);
-
-JNIEXPORT void JNICALL
-JVM_SetThreadPriority(JNIEnv *env, jobject thread, jint prio);
-
-JNIEXPORT void JNICALL
-JVM_Yield(JNIEnv *env, jclass threadClass);
-
-JNIEXPORT void JNICALL
-JVM_Sleep(JNIEnv *env, jclass threadClass, jlong millis);
-
-JNIEXPORT jobject JNICALL
-JVM_CurrentThread(JNIEnv *env, jclass threadClass);
-
-JNIEXPORT jint JNICALL
-JVM_CountStackFrames(JNIEnv *env, jobject thread);
-
-JNIEXPORT void JNICALL
-JVM_Interrupt(JNIEnv *env, jobject thread);
-
-JNIEXPORT jboolean JNICALL
-JVM_IsInterrupted(JNIEnv *env, jobject thread, jboolean clearInterrupted);
-
-JNIEXPORT jboolean JNICALL
-JVM_HoldsLock(JNIEnv *env, jclass threadClass, jobject obj);
-
-JNIEXPORT void JNICALL
-JVM_DumpAllStacks(JNIEnv *env, jclass unused);
-
-JNIEXPORT jobjectArray JNICALL
-JVM_GetAllThreads(JNIEnv *env, jclass dummy);
-
-JNIEXPORT void JNICALL
-JVM_SetNativeThreadName(JNIEnv *env, jobject jthread, jstring name);
-
-/* getStackTrace() and getAllStackTraces() method */
-JNIEXPORT jobjectArray JNICALL
-JVM_DumpThreads(JNIEnv *env, jclass threadClass, jobjectArray threads);
-
-/*
- * java.lang.SecurityManager
- */
-JNIEXPORT jobjectArray JNICALL
-JVM_GetClassContext(JNIEnv *env);
-
-/*
- * java.lang.Package
- */
-JNIEXPORT jstring JNICALL
-JVM_GetSystemPackage(JNIEnv *env, jstring name);
-
-JNIEXPORT jobjectArray JNICALL
-JVM_GetSystemPackages(JNIEnv *env);
-
-/*
- * java.lang.ref.Reference
- */
-JNIEXPORT jobject JNICALL
-JVM_GetAndClearReferencePendingList(JNIEnv *env);
-
-JNIEXPORT jboolean JNICALL
-JVM_HasReferencePendingList(JNIEnv *env);
-
-JNIEXPORT void JNICALL
-JVM_WaitForReferencePendingList(JNIEnv *env);
-
-/*
- * java.io.ObjectInputStream
- */
-JNIEXPORT jobject JNICALL
-JVM_LatestUserDefinedLoader(JNIEnv *env);
-
-/*
- * java.lang.reflect.Array
- */
-JNIEXPORT jint JNICALL
-JVM_GetArrayLength(JNIEnv *env, jobject arr);
-
-JNIEXPORT jobject JNICALL
-JVM_GetArrayElement(JNIEnv *env, jobject arr, jint index);
-
-JNIEXPORT jvalue JNICALL
-JVM_GetPrimitiveArrayElement(JNIEnv *env, jobject arr, jint index, jint wCode);
-
-JNIEXPORT void JNICALL
-JVM_SetArrayElement(JNIEnv *env, jobject arr, jint index, jobject val);
-
-JNIEXPORT void JNICALL
-JVM_SetPrimitiveArrayElement(JNIEnv *env, jobject arr, jint index, jvalue v,
- unsigned char vCode);
-
-JNIEXPORT jobject JNICALL
-JVM_NewArray(JNIEnv *env, jclass eltClass, jint length);
-
-JNIEXPORT jobject JNICALL
-JVM_NewMultiArray(JNIEnv *env, jclass eltClass, jintArray dim);
-
-/*
- * java.lang.Class and java.lang.ClassLoader
- */
-
-#define JVM_CALLER_DEPTH -1
-
-/*
- * Returns the immediate caller class of the native method invoking
- * JVM_GetCallerClass. The Method.invoke and other frames due to
- * reflection machinery are skipped.
- *
- * The depth parameter must be -1 (JVM_DEPTH). The caller is expected
- * to be marked with sun.reflect.CallerSensitive. The JVM will throw
- * an error if it is not marked propertly.
- */
-JNIEXPORT jclass JNICALL
-JVM_GetCallerClass(JNIEnv *env, int depth);
-
-
-/*
- * Find primitive classes
- * utf: class name
- */
-JNIEXPORT jclass JNICALL
-JVM_FindPrimitiveClass(JNIEnv *env, const char *utf);
-
-
-/*
- * Find a class from a boot class loader. Returns NULL if class not found.
- */
-JNIEXPORT jclass JNICALL
-JVM_FindClassFromBootLoader(JNIEnv *env, const char *name);
-
-/*
- * Find a class from a given class loader. Throws ClassNotFoundException.
- * name: name of class
- * init: whether initialization is done
- * loader: class loader to look up the class. This may not be the same as the caller's
- * class loader.
- * caller: initiating class. The initiating class may be null when a security
- * manager is not installed.
- */
-JNIEXPORT jclass JNICALL
-JVM_FindClassFromCaller(JNIEnv *env, const char *name, jboolean init,
- jobject loader, jclass caller);
-
-/*
- * Find a class from a given class.
- */
-JNIEXPORT jclass JNICALL
-JVM_FindClassFromClass(JNIEnv *env, const char *name, jboolean init,
- jclass from);
-
-/* Find a loaded class cached by the VM */
-JNIEXPORT jclass JNICALL
-JVM_FindLoadedClass(JNIEnv *env, jobject loader, jstring name);
-
-/* Define a class */
-JNIEXPORT jclass JNICALL
-JVM_DefineClass(JNIEnv *env, const char *name, jobject loader, const jbyte *buf,
- jsize len, jobject pd);
-
-/* Define a class with a source (added in JDK1.5) */
-JNIEXPORT jclass JNICALL
-JVM_DefineClassWithSource(JNIEnv *env, const char *name, jobject loader,
- const jbyte *buf, jsize len, jobject pd,
- const char *source);
-
-/*
- * Module support funcions
- */
-
-/*
- * Define a module with the specified packages and bind the module to the
- * given class loader.
- * module: module to define
- * is_open: specifies if module is open (currently ignored)
- * version: the module version
- * location: the module location
- * packages: list of packages in the module
- * num_packages: number of packages in the module
- */
-JNIEXPORT void JNICALL
-JVM_DefineModule(JNIEnv *env, jobject module, jboolean is_open, jstring version,
- jstring location, const char* const* packages, jsize num_packages);
-
-/*
- * Set the boot loader's unnamed module.
- * module: boot loader's unnamed module
- */
-JNIEXPORT void JNICALL
-JVM_SetBootLoaderUnnamedModule(JNIEnv *env, jobject module);
-
-/*
- * Do a qualified export of a package.
- * from_module: module containing the package to export
- * package: name of the package to export
- * to_module: module to export the package to
- */
-JNIEXPORT void JNICALL
-JVM_AddModuleExports(JNIEnv *env, jobject from_module, const char* package, jobject to_module);
-
-/*
- * Do an export of a package to all unnamed modules.
- * from_module: module containing the package to export
- * package: name of the package to export to all unnamed modules
- */
-JNIEXPORT void JNICALL
-JVM_AddModuleExportsToAllUnnamed(JNIEnv *env, jobject from_module, const char* package);
-
-/*
- * Do an unqualified export of a package.
- * from_module: module containing the package to export
- * package: name of the package to export
- */
-JNIEXPORT void JNICALL
-JVM_AddModuleExportsToAll(JNIEnv *env, jobject from_module, const char* package);
-
-/*
- * Add a module to the list of modules that a given module can read.
- * from_module: module requesting read access
- * source_module: module that from_module wants to read
- */
-JNIEXPORT void JNICALL
-JVM_AddReadsModule(JNIEnv *env, jobject from_module, jobject source_module);
-
-/*
- * Reflection support functions
- */
-
-JNIEXPORT jstring JNICALL
-JVM_GetClassName(JNIEnv *env, jclass cls);
-
-JNIEXPORT jobjectArray JNICALL
-JVM_GetClassInterfaces(JNIEnv *env, jclass cls);
-
-JNIEXPORT jboolean JNICALL
-JVM_IsInterface(JNIEnv *env, jclass cls);
-
-JNIEXPORT jobjectArray JNICALL
-JVM_GetClassSigners(JNIEnv *env, jclass cls);
-
-JNIEXPORT void JNICALL
-JVM_SetClassSigners(JNIEnv *env, jclass cls, jobjectArray signers);
-
-JNIEXPORT jobject JNICALL
-JVM_GetProtectionDomain(JNIEnv *env, jclass cls);
-
-JNIEXPORT jboolean JNICALL
-JVM_IsArrayClass(JNIEnv *env, jclass cls);
-
-JNIEXPORT jboolean JNICALL
-JVM_IsPrimitiveClass(JNIEnv *env, jclass cls);
-
-JNIEXPORT jint JNICALL
-JVM_GetClassModifiers(JNIEnv *env, jclass cls);
-
-JNIEXPORT jobjectArray JNICALL
-JVM_GetDeclaredClasses(JNIEnv *env, jclass ofClass);
-
-JNIEXPORT jclass JNICALL
-JVM_GetDeclaringClass(JNIEnv *env, jclass ofClass);
-
-JNIEXPORT jstring JNICALL
-JVM_GetSimpleBinaryName(JNIEnv *env, jclass ofClass);
-
-/* Generics support (JDK 1.5) */
-JNIEXPORT jstring JNICALL
-JVM_GetClassSignature(JNIEnv *env, jclass cls);
-
-/* Annotations support (JDK 1.5) */
-JNIEXPORT jbyteArray JNICALL
-JVM_GetClassAnnotations(JNIEnv *env, jclass cls);
-
-/* Type use annotations support (JDK 1.8) */
-
-JNIEXPORT jbyteArray JNICALL
-JVM_GetClassTypeAnnotations(JNIEnv *env, jclass cls);
-
-JNIEXPORT jbyteArray JNICALL
-JVM_GetFieldTypeAnnotations(JNIEnv *env, jobject field);
-
-JNIEXPORT jbyteArray JNICALL
-JVM_GetMethodTypeAnnotations(JNIEnv *env, jobject method);
-
-/*
- * New (JDK 1.4) reflection implementation
- */
-
-JNIEXPORT jobjectArray JNICALL
-JVM_GetClassDeclaredMethods(JNIEnv *env, jclass ofClass, jboolean publicOnly);
-
-JNIEXPORT jobjectArray JNICALL
-JVM_GetClassDeclaredFields(JNIEnv *env, jclass ofClass, jboolean publicOnly);
-
-JNIEXPORT jobjectArray JNICALL
-JVM_GetClassDeclaredConstructors(JNIEnv *env, jclass ofClass, jboolean publicOnly);
-
-/* Differs from JVM_GetClassModifiers in treatment of inner classes.
- This returns the access flags for the class as specified in the
- class file rather than searching the InnerClasses attribute (if
- present) to find the source-level access flags. Only the values of
- the low 13 bits (i.e., a mask of 0x1FFF) are guaranteed to be
- valid. */
-JNIEXPORT jint JNICALL
-JVM_GetClassAccessFlags(JNIEnv *env, jclass cls);
-
-/* The following two reflection routines are still needed due to startup time issues */
-/*
- * java.lang.reflect.Method
- */
-JNIEXPORT jobject JNICALL
-JVM_InvokeMethod(JNIEnv *env, jobject method, jobject obj, jobjectArray args0);
-
-/*
- * java.lang.reflect.Constructor
- */
-JNIEXPORT jobject JNICALL
-JVM_NewInstanceFromConstructor(JNIEnv *env, jobject c, jobjectArray args0);
-
-/*
- * Constant pool access; currently used to implement reflective access to annotations (JDK 1.5)
- */
-
-JNIEXPORT jobject JNICALL
-JVM_GetClassConstantPool(JNIEnv *env, jclass cls);
-
-JNIEXPORT jint JNICALL JVM_ConstantPoolGetSize
-(JNIEnv *env, jobject unused, jobject jcpool);
-
-JNIEXPORT jclass JNICALL JVM_ConstantPoolGetClassAt
-(JNIEnv *env, jobject unused, jobject jcpool, jint index);
-
-JNIEXPORT jclass JNICALL JVM_ConstantPoolGetClassAtIfLoaded
-(JNIEnv *env, jobject unused, jobject jcpool, jint index);
-
-JNIEXPORT jint JNICALL JVM_ConstantPoolGetClassRefIndexAt
-(JNIEnv *env, jobject obj, jobject unused, jint index);
-
-JNIEXPORT jobject JNICALL JVM_ConstantPoolGetMethodAt
-(JNIEnv *env, jobject unused, jobject jcpool, jint index);
-
-JNIEXPORT jobject JNICALL JVM_ConstantPoolGetMethodAtIfLoaded
-(JNIEnv *env, jobject unused, jobject jcpool, jint index);
-
-JNIEXPORT jobject JNICALL JVM_ConstantPoolGetFieldAt
-(JNIEnv *env, jobject unused, jobject jcpool, jint index);
-
-JNIEXPORT jobject JNICALL JVM_ConstantPoolGetFieldAtIfLoaded
-(JNIEnv *env, jobject unused, jobject jcpool, jint index);
-
-JNIEXPORT jobjectArray JNICALL JVM_ConstantPoolGetMemberRefInfoAt
-(JNIEnv *env, jobject unused, jobject jcpool, jint index);
-
-JNIEXPORT jint JNICALL JVM_ConstantPoolGetNameAndTypeRefIndexAt
-(JNIEnv *env, jobject obj, jobject unused, jint index);
-
-JNIEXPORT jobjectArray JNICALL JVM_ConstantPoolGetNameAndTypeRefInfoAt
-(JNIEnv *env, jobject obj, jobject unused, jint index);
-
-JNIEXPORT jint JNICALL JVM_ConstantPoolGetIntAt
-(JNIEnv *env, jobject unused, jobject jcpool, jint index);
-
-JNIEXPORT jlong JNICALL JVM_ConstantPoolGetLongAt
-(JNIEnv *env, jobject unused, jobject jcpool, jint index);
-
-JNIEXPORT jfloat JNICALL JVM_ConstantPoolGetFloatAt
-(JNIEnv *env, jobject unused, jobject jcpool, jint index);
-
-JNIEXPORT jdouble JNICALL JVM_ConstantPoolGetDoubleAt
-(JNIEnv *env, jobject unused, jobject jcpool, jint index);
-
-JNIEXPORT jstring JNICALL JVM_ConstantPoolGetStringAt
-(JNIEnv *env, jobject unused, jobject jcpool, jint index);
-
-JNIEXPORT jstring JNICALL JVM_ConstantPoolGetUTF8At
-(JNIEnv *env, jobject unused, jobject jcpool, jint index);
-
-JNIEXPORT jbyte JNICALL JVM_ConstantPoolGetTagAt
-(JNIEnv *env, jobject unused, jobject jcpool, jint index);
-
-/*
- * Parameter reflection
- */
-
-JNIEXPORT jobjectArray JNICALL
-JVM_GetMethodParameters(JNIEnv *env, jobject method);
-
-/*
- * java.security.*
- */
-
-JNIEXPORT jobject JNICALL
-JVM_DoPrivileged(JNIEnv *env, jclass cls,
- jobject action, jobject context, jboolean wrapException);
-
-JNIEXPORT jobject JNICALL
-JVM_GetInheritedAccessControlContext(JNIEnv *env, jclass cls);
-
-JNIEXPORT jobject JNICALL
-JVM_GetStackAccessControlContext(JNIEnv *env, jclass cls);
-
-/*
- * Signal support, used to implement the shutdown sequence. Every VM must
- * support JVM_SIGINT and JVM_SIGTERM, raising the former for user interrupts
- * (^C) and the latter for external termination (kill, system shutdown, etc.).
- * Other platform-dependent signal values may also be supported.
- */
-
-JNIEXPORT void * JNICALL
-JVM_RegisterSignal(jint sig, void *handler);
-
-JNIEXPORT jboolean JNICALL
-JVM_RaiseSignal(jint sig);
-
-JNIEXPORT jint JNICALL
-JVM_FindSignal(const char *name);
-
-/*
- * Retrieve the assertion directives for the specified class.
- */
-JNIEXPORT jboolean JNICALL
-JVM_DesiredAssertionStatus(JNIEnv *env, jclass unused, jclass cls);
-
-/*
- * Retrieve the assertion directives from the VM.
- */
-JNIEXPORT jobject JNICALL
-JVM_AssertionStatusDirectives(JNIEnv *env, jclass unused);
-
-/*
- * java.util.concurrent.atomic.AtomicLong
- */
-JNIEXPORT jboolean JNICALL
-JVM_SupportsCX8(void);
-
-/*
- * com.sun.dtrace.jsdt support
- */
-
-#define JVM_TRACING_DTRACE_VERSION 1
-
-/*
- * Structure to pass one probe description to JVM
- */
-typedef struct {
- jmethodID method;
- jstring function;
- jstring name;
- void* reserved[4]; // for future use
-} JVM_DTraceProbe;
-
-/**
- * Encapsulates the stability ratings for a DTrace provider field
- */
-typedef struct {
- jint nameStability;
- jint dataStability;
- jint dependencyClass;
-} JVM_DTraceInterfaceAttributes;
-
-/*
- * Structure to pass one provider description to JVM
- */
-typedef struct {
- jstring name;
- JVM_DTraceProbe* probes;
- jint probe_count;
- JVM_DTraceInterfaceAttributes providerAttributes;
- JVM_DTraceInterfaceAttributes moduleAttributes;
- JVM_DTraceInterfaceAttributes functionAttributes;
- JVM_DTraceInterfaceAttributes nameAttributes;
- JVM_DTraceInterfaceAttributes argsAttributes;
- void* reserved[4]; // for future use
-} JVM_DTraceProvider;
-
-/*
- * Get the version number the JVM was built with
- */
-JNIEXPORT jint JNICALL
-JVM_DTraceGetVersion(JNIEnv* env);
-
-/*
- * Register new probe with given signature, return global handle
- *
- * The version passed in is the version that the library code was
- * built with.
- */
-JNIEXPORT jlong JNICALL
-JVM_DTraceActivate(JNIEnv* env, jint version, jstring module_name,
- jint providers_count, JVM_DTraceProvider* providers);
-
-/*
- * Check JSDT probe
- */
-JNIEXPORT jboolean JNICALL
-JVM_DTraceIsProbeEnabled(JNIEnv* env, jmethodID method);
-
-/*
- * Destroy custom DOF
- */
-JNIEXPORT void JNICALL
-JVM_DTraceDispose(JNIEnv* env, jlong activation_handle);
-
-/*
- * Check to see if DTrace is supported by OS
- */
-JNIEXPORT jboolean JNICALL
-JVM_DTraceIsSupported(JNIEnv* env);
-
-/*************************************************************************
- PART 2: Support for the Verifier and Class File Format Checker
- ************************************************************************/
-/*
- * Return the class name in UTF format. The result is valid
- * until JVM_ReleaseUTf is called.
- *
- * The caller must treat the string as a constant and not modify it
- * in any way.
- */
-JNIEXPORT const char * JNICALL
-JVM_GetClassNameUTF(JNIEnv *env, jclass cb);
-
-/*
- * Returns the constant pool types in the buffer provided by "types."
- */
-JNIEXPORT void JNICALL
-JVM_GetClassCPTypes(JNIEnv *env, jclass cb, unsigned char *types);
-
-/*
- * Returns the number of Constant Pool entries.
- */
-JNIEXPORT jint JNICALL
-JVM_GetClassCPEntriesCount(JNIEnv *env, jclass cb);
-
-/*
- * Returns the number of *declared* fields or methods.
- */
-JNIEXPORT jint JNICALL
-JVM_GetClassFieldsCount(JNIEnv *env, jclass cb);
-
-JNIEXPORT jint JNICALL
-JVM_GetClassMethodsCount(JNIEnv *env, jclass cb);
-
-/*
- * Returns the CP indexes of exceptions raised by a given method.
- * Places the result in the given buffer.
- *
- * The method is identified by method_index.
- */
-JNIEXPORT void JNICALL
-JVM_GetMethodIxExceptionIndexes(JNIEnv *env, jclass cb, jint method_index,
- unsigned short *exceptions);
-/*
- * Returns the number of exceptions raised by a given method.
- * The method is identified by method_index.
- */
-JNIEXPORT jint JNICALL
-JVM_GetMethodIxExceptionsCount(JNIEnv *env, jclass cb, jint method_index);
-
-/*
- * Returns the byte code sequence of a given method.
- * Places the result in the given buffer.
- *
- * The method is identified by method_index.
- */
-JNIEXPORT void JNICALL
-JVM_GetMethodIxByteCode(JNIEnv *env, jclass cb, jint method_index,
- unsigned char *code);
-
-/*
- * Returns the length of the byte code sequence of a given method.
- * The method is identified by method_index.
- */
-JNIEXPORT jint JNICALL
-JVM_GetMethodIxByteCodeLength(JNIEnv *env, jclass cb, jint method_index);
-
-/*
- * A structure used to a capture exception table entry in a Java method.
- */
-typedef struct {
- jint start_pc;
- jint end_pc;
- jint handler_pc;
- jint catchType;
-} JVM_ExceptionTableEntryType;
-
-/*
- * Returns the exception table entry at entry_index of a given method.
- * Places the result in the given buffer.
- *
- * The method is identified by method_index.
- */
-JNIEXPORT void JNICALL
-JVM_GetMethodIxExceptionTableEntry(JNIEnv *env, jclass cb, jint method_index,
- jint entry_index,
- JVM_ExceptionTableEntryType *entry);
-
-/*
- * Returns the length of the exception table of a given method.
- * The method is identified by method_index.
- */
-JNIEXPORT jint JNICALL
-JVM_GetMethodIxExceptionTableLength(JNIEnv *env, jclass cb, int index);
-
-/*
- * Returns the modifiers of a given field.
- * The field is identified by field_index.
- */
-JNIEXPORT jint JNICALL
-JVM_GetFieldIxModifiers(JNIEnv *env, jclass cb, int index);
-
-/*
- * Returns the modifiers of a given method.
- * The method is identified by method_index.
- */
-JNIEXPORT jint JNICALL
-JVM_GetMethodIxModifiers(JNIEnv *env, jclass cb, int index);
-
-/*
- * Returns the number of local variables of a given method.
- * The method is identified by method_index.
- */
-JNIEXPORT jint JNICALL
-JVM_GetMethodIxLocalsCount(JNIEnv *env, jclass cb, int index);
-
-/*
- * Returns the number of arguments (including this pointer) of a given method.
- * The method is identified by method_index.
- */
-JNIEXPORT jint JNICALL
-JVM_GetMethodIxArgsSize(JNIEnv *env, jclass cb, int index);
-
-/*
- * Returns the maximum amount of stack (in words) used by a given method.
- * The method is identified by method_index.
- */
-JNIEXPORT jint JNICALL
-JVM_GetMethodIxMaxStack(JNIEnv *env, jclass cb, int index);
-
-/*
- * Is a given method a constructor.
- * The method is identified by method_index.
- */
-JNIEXPORT jboolean JNICALL
-JVM_IsConstructorIx(JNIEnv *env, jclass cb, int index);
-
-/*
- * Is the given method generated by the VM.
- * The method is identified by method_index.
- */
-JNIEXPORT jboolean JNICALL
-JVM_IsVMGeneratedMethodIx(JNIEnv *env, jclass cb, int index);
-
-/*
- * Returns the name of a given method in UTF format.
- * The result remains valid until JVM_ReleaseUTF is called.
- *
- * The caller must treat the string as a constant and not modify it
- * in any way.
- */
-JNIEXPORT const char * JNICALL
-JVM_GetMethodIxNameUTF(JNIEnv *env, jclass cb, jint index);
-
-/*
- * Returns the signature of a given method in UTF format.
- * The result remains valid until JVM_ReleaseUTF is called.
- *
- * The caller must treat the string as a constant and not modify it
- * in any way.
- */
-JNIEXPORT const char * JNICALL
-JVM_GetMethodIxSignatureUTF(JNIEnv *env, jclass cb, jint index);
-
-/*
- * Returns the name of the field referred to at a given constant pool
- * index.
- *
- * The result is in UTF format and remains valid until JVM_ReleaseUTF
- * is called.
- *
- * The caller must treat the string as a constant and not modify it
- * in any way.
- */
-JNIEXPORT const char * JNICALL
-JVM_GetCPFieldNameUTF(JNIEnv *env, jclass cb, jint index);
-
-/*
- * Returns the name of the method referred to at a given constant pool
- * index.
- *
- * The result is in UTF format and remains valid until JVM_ReleaseUTF
- * is called.
- *
- * The caller must treat the string as a constant and not modify it
- * in any way.
- */
-JNIEXPORT const char * JNICALL
-JVM_GetCPMethodNameUTF(JNIEnv *env, jclass cb, jint index);
-
-/*
- * Returns the signature of the method referred to at a given constant pool
- * index.
- *
- * The result is in UTF format and remains valid until JVM_ReleaseUTF
- * is called.
- *
- * The caller must treat the string as a constant and not modify it
- * in any way.
- */
-JNIEXPORT const char * JNICALL
-JVM_GetCPMethodSignatureUTF(JNIEnv *env, jclass cb, jint index);
-
-/*
- * Returns the signature of the field referred to at a given constant pool
- * index.
- *
- * The result is in UTF format and remains valid until JVM_ReleaseUTF
- * is called.
- *
- * The caller must treat the string as a constant and not modify it
- * in any way.
- */
-JNIEXPORT const char * JNICALL
-JVM_GetCPFieldSignatureUTF(JNIEnv *env, jclass cb, jint index);
-
-/*
- * Returns the class name referred to at a given constant pool index.
- *
- * The result is in UTF format and remains valid until JVM_ReleaseUTF
- * is called.
- *
- * The caller must treat the string as a constant and not modify it
- * in any way.
- */
-JNIEXPORT const char * JNICALL
-JVM_GetCPClassNameUTF(JNIEnv *env, jclass cb, jint index);
-
-/*
- * Returns the class name referred to at a given constant pool index.
- *
- * The constant pool entry must refer to a CONSTANT_Fieldref.
- *
- * The result is in UTF format and remains valid until JVM_ReleaseUTF
- * is called.
- *
- * The caller must treat the string as a constant and not modify it
- * in any way.
- */
-JNIEXPORT const char * JNICALL
-JVM_GetCPFieldClassNameUTF(JNIEnv *env, jclass cb, jint index);
-
-/*
- * Returns the class name referred to at a given constant pool index.
- *
- * The constant pool entry must refer to CONSTANT_Methodref or
- * CONSTANT_InterfaceMethodref.
- *
- * The result is in UTF format and remains valid until JVM_ReleaseUTF
- * is called.
- *
- * The caller must treat the string as a constant and not modify it
- * in any way.
- */
-JNIEXPORT const char * JNICALL
-JVM_GetCPMethodClassNameUTF(JNIEnv *env, jclass cb, jint index);
-
-/*
- * Returns the modifiers of a field in calledClass. The field is
- * referred to in class cb at constant pool entry index.
- *
- * The caller must treat the string as a constant and not modify it
- * in any way.
- *
- * Returns -1 if the field does not exist in calledClass.
- */
-JNIEXPORT jint JNICALL
-JVM_GetCPFieldModifiers(JNIEnv *env, jclass cb, int index, jclass calledClass);
-
-/*
- * Returns the modifiers of a method in calledClass. The method is
- * referred to in class cb at constant pool entry index.
- *
- * Returns -1 if the method does not exist in calledClass.
- */
-JNIEXPORT jint JNICALL
-JVM_GetCPMethodModifiers(JNIEnv *env, jclass cb, int index, jclass calledClass);
-
-/*
- * Releases the UTF string obtained from the VM.
- */
-JNIEXPORT void JNICALL
-JVM_ReleaseUTF(const char *utf);
-
-/*
- * Compare if two classes are in the same package.
- */
-JNIEXPORT jboolean JNICALL
-JVM_IsSameClassPackage(JNIEnv *env, jclass class1, jclass class2);
-
-/* Get classfile constants */
-#include "classfile_constants.h"
-
-/*
- * A function defined by the byte-code verifier and called by the VM.
- * This is not a function implemented in the VM.
- *
- * Returns JNI_FALSE if verification fails. A detailed error message
- * will be places in msg_buf, whose length is specified by buf_len.
- */
-typedef jboolean (*verifier_fn_t)(JNIEnv *env,
- jclass cb,
- char * msg_buf,
- jint buf_len);
-
-
-/*
- * Support for a VM-independent class format checker.
- */
-typedef struct {
- unsigned long code; /* byte code */
- unsigned long excs; /* exceptions */
- unsigned long etab; /* catch table */
- unsigned long lnum; /* line number */
- unsigned long lvar; /* local vars */
-} method_size_info;
-
-typedef struct {
- unsigned int constants; /* constant pool */
- unsigned int fields;
- unsigned int methods;
- unsigned int interfaces;
- unsigned int fields2; /* number of static 2-word fields */
- unsigned int innerclasses; /* # of records in InnerClasses attr */
-
- method_size_info clinit; /* memory used in clinit */
- method_size_info main; /* used everywhere else */
-} class_size_info;
-
-/*
- * Functions defined in libjava.so to perform string conversions.
- *
- */
-
-typedef jstring (*to_java_string_fn_t)(JNIEnv *env, char *str);
-
-typedef char *(*to_c_string_fn_t)(JNIEnv *env, jstring s, jboolean *b);
-
-/* This is the function defined in libjava.so that performs class
- * format checks. This functions fills in size information about
- * the class file and returns:
- *
- * 0: good
- * -1: out of memory
- * -2: bad format
- * -3: unsupported version
- * -4: bad class name
- */
-
-typedef jint (*check_format_fn_t)(char *class_name,
- unsigned char *data,
- unsigned int data_size,
- class_size_info *class_size,
- char *message_buffer,
- jint buffer_length,
- jboolean measure_only,
- jboolean check_relaxed);
-
-#define JVM_RECOGNIZED_CLASS_MODIFIERS (JVM_ACC_PUBLIC | \
- JVM_ACC_FINAL | \
- JVM_ACC_SUPER | \
- JVM_ACC_INTERFACE | \
- JVM_ACC_ABSTRACT | \
- JVM_ACC_ANNOTATION | \
- JVM_ACC_ENUM | \
- JVM_ACC_SYNTHETIC)
-
-#define JVM_RECOGNIZED_FIELD_MODIFIERS (JVM_ACC_PUBLIC | \
- JVM_ACC_PRIVATE | \
- JVM_ACC_PROTECTED | \
- JVM_ACC_STATIC | \
- JVM_ACC_FINAL | \
- JVM_ACC_VOLATILE | \
- JVM_ACC_TRANSIENT | \
- JVM_ACC_ENUM | \
- JVM_ACC_SYNTHETIC)
-
-#define JVM_RECOGNIZED_METHOD_MODIFIERS (JVM_ACC_PUBLIC | \
- JVM_ACC_PRIVATE | \
- JVM_ACC_PROTECTED | \
- JVM_ACC_STATIC | \
- JVM_ACC_FINAL | \
- JVM_ACC_SYNCHRONIZED | \
- JVM_ACC_BRIDGE | \
- JVM_ACC_VARARGS | \
- JVM_ACC_NATIVE | \
- JVM_ACC_ABSTRACT | \
- JVM_ACC_STRICT | \
- JVM_ACC_SYNTHETIC)
-
-/*
- * This is the function defined in libjava.so to perform path
- * canonicalization. VM call this function before opening jar files
- * to load system classes.
- *
- */
-
-typedef int (*canonicalize_fn_t)(JNIEnv *env, char *orig, char *out, int len);
-
-/*************************************************************************
- PART 3: I/O and Network Support
- ************************************************************************/
-
-/*
- * Convert a pathname into native format. This function does syntactic
- * cleanup, such as removing redundant separator characters. It modifies
- * the given pathname string in place.
- */
-JNIEXPORT char * JNICALL
-JVM_NativePath(char *);
-
-/*
- * The standard printing functions supported by the Java VM. (Should they
- * be renamed to JVM_* in the future?
- */
-
-/* jio_snprintf() and jio_vsnprintf() behave like snprintf(3) and vsnprintf(3),
- * respectively, with the following differences:
- * - The string written to str is always zero-terminated, also in case of
- * truncation (count is too small to hold the result string), unless count
- * is 0. In case of truncation count-1 characters are written and '\0'
- * appendend.
- * - If count is too small to hold the whole string, -1 is returned across
- * all platforms. */
-
-JNIEXPORT int
-jio_vsnprintf(char *str, size_t count, const char *fmt, va_list args);
-
-JNIEXPORT int
-jio_snprintf(char *str, size_t count, const char *fmt, ...);
-
-JNIEXPORT int
-jio_fprintf(FILE *, const char *fmt, ...);
-
-JNIEXPORT int
-jio_vfprintf(FILE *, const char *fmt, va_list args);
-
-
-JNIEXPORT void * JNICALL
-JVM_RawMonitorCreate(void);
-
-JNIEXPORT void JNICALL
-JVM_RawMonitorDestroy(void *mon);
-
-JNIEXPORT jint JNICALL
-JVM_RawMonitorEnter(void *mon);
-
-JNIEXPORT void JNICALL
-JVM_RawMonitorExit(void *mon);
-
-/*
- * java.lang.management support
- */
-JNIEXPORT void* JNICALL
-JVM_GetManagement(jint version);
-
-/*
- * com.sun.tools.attach.VirtualMachine support
- *
- * Initialize the agent properties with the properties maintained in the VM.
- */
-JNIEXPORT jobject JNICALL
-JVM_InitAgentProperties(JNIEnv *env, jobject agent_props);
-
-JNIEXPORT jstring JNICALL
-JVM_GetTemporaryDirectory(JNIEnv *env);
-
-/* Generics reflection support.
- *
- * Returns information about the given class's EnclosingMethod
- * attribute, if present, or null if the class had no enclosing
- * method.
- *
- * If non-null, the returned array contains three elements. Element 0
- * is the java.lang.Class of which the enclosing method is a member,
- * and elements 1 and 2 are the java.lang.Strings for the enclosing
- * method's name and descriptor, respectively.
- */
-JNIEXPORT jobjectArray JNICALL
-JVM_GetEnclosingMethodInfo(JNIEnv* env, jclass ofClass);
-
-/* =========================================================================
- * The following defines a private JVM interface that the JDK can query
- * for the JVM version and capabilities. sun.misc.Version defines
- * the methods for getting the VM version and its capabilities.
- *
- * When a new bit is added, the following should be updated to provide
- * access to the new capability:
- * HS: JVM_GetVersionInfo and Abstract_VM_Version class
- * SDK: Version class
- *
- * Similary, a private JDK interface JDK_GetVersionInfo0 is defined for
- * JVM to query for the JDK version and capabilities.
- *
- * When a new bit is added, the following should be updated to provide
- * access to the new capability:
- * HS: JDK_Version class
- * SDK: JDK_GetVersionInfo0
- *
- * ==========================================================================
- */
-typedef struct {
- unsigned int jvm_version; /* Encoded $VNUM as specified by JEP-223 */
- unsigned int patch_version : 8; /* JEP-223 patch version */
- unsigned int reserved3 : 8;
- unsigned int reserved1 : 16;
- unsigned int reserved2;
-
- /* The following bits represents JVM supports that JDK has dependency on.
- * JDK can use these bits to determine which JVM version
- * and support it has to maintain runtime compatibility.
- *
- * When a new bit is added in a minor or update release, make sure
- * the new bit is also added in the main/baseline.
- */
- unsigned int is_attach_supported : 1;
- unsigned int : 31;
- unsigned int : 32;
- unsigned int : 32;
-} jvm_version_info;
-
-#define JVM_VERSION_MAJOR(version) ((version & 0xFF000000) >> 24)
-#define JVM_VERSION_MINOR(version) ((version & 0x00FF0000) >> 16)
-#define JVM_VERSION_SECURITY(version) ((version & 0x0000FF00) >> 8)
-#define JVM_VERSION_BUILD(version) ((version & 0x000000FF))
-
-JNIEXPORT void JNICALL
-JVM_GetVersionInfo(JNIEnv* env, jvm_version_info* info, size_t info_size);
-
-typedef struct {
- unsigned int jdk_version; /* Encoded $VNUM as specified by JEP-223 */
- unsigned int patch_version : 8; /* JEP-223 patch version */
- unsigned int reserved3 : 8;
- unsigned int reserved1 : 16;
- unsigned int reserved2;
-
- /* The following bits represents new JDK supports that VM has dependency on.
- * VM implementation can use these bits to determine which JDK version
- * and support it has to maintain runtime compatibility.
- *
- * When a new bit is added in a minor or update release, make sure
- * the new bit is also added in the main/baseline.
- */
- unsigned int thread_park_blocker : 1;
- unsigned int post_vm_init_hook_enabled : 1;
- unsigned int pending_list_uses_discovered_field : 1;
- unsigned int : 29;
- unsigned int : 32;
- unsigned int : 32;
-} jdk_version_info;
-
-#define JDK_VERSION_MAJOR(version) ((version & 0xFF000000) >> 24)
-#define JDK_VERSION_MINOR(version) ((version & 0x00FF0000) >> 16)
-#define JDK_VERSION_SECURITY(version) ((version & 0x0000FF00) >> 8)
-#define JDK_VERSION_BUILD(version) ((version & 0x000000FF))
-
-/*
- * This is the function JDK_GetVersionInfo0 defined in libjava.so
- * that is dynamically looked up by JVM.
- */
-typedef void (*jdk_version_info_fn_t)(jdk_version_info* info, size_t info_size);
-
-/*
- * This structure is used by the launcher to get the default thread
- * stack size from the VM using JNI_GetDefaultJavaVMInitArgs() with a
- * version of 1.1. As it is not supported otherwise, it has been removed
- * from jni.h
- */
-typedef struct JDK1_1InitArgs {
- jint version;
-
- char **properties;
- jint checkSource;
- jint nativeStackSize;
- jint javaStackSize;
- jint minHeapSize;
- jint maxHeapSize;
- jint verifyMode;
- char *classpath;
-
- jint (JNICALL *vfprintf)(FILE *fp, const char *format, va_list args);
- void (JNICALL *exit)(jint code);
- void (JNICALL *abort)(void);
-
- jint enableClassGC;
- jint enableVerboseGC;
- jint disableAsyncGC;
- jint verbose;
- jboolean debugging;
- jint debugPort;
-} JDK1_1InitArgs;
-
-
-#ifdef __cplusplus
-} /* extern "C" */
-
-#endif /* __cplusplus */
-
-#endif /* !_JAVASOFT_JVM_H_ */
--- a/src/java.base/share/native/libjava/jdk_util.c Wed Dec 13 14:21:12 2017 -0800
+++ b/src/java.base/share/native/libjava/jdk_util.c Mon Dec 18 10:28:43 2017 -0800
@@ -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;
--- a/src/java.base/unix/native/include/jvm_md.h Wed Dec 13 14:21:12 2017 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,100 +0,0 @@
-/*
- * Copyright (c) 1997, 2012, 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.
- */
-
-#ifndef _JAVASOFT_JVM_MD_H_
-#define _JAVASOFT_JVM_MD_H_
-
-/*
- * This file is currently collecting system-specific dregs for the
- * JNI conversion, which should be sorted out later.
- */
-
-#include <dirent.h> /* For DIR */
-#include <sys/param.h> /* For MAXPATHLEN */
-#include <unistd.h> /* For F_OK, R_OK, W_OK */
-#include <stddef.h> /* For ptrdiff_t */
-#include <stdint.h> /* For uintptr_t */
-
-#define JNI_ONLOAD_SYMBOLS {"JNI_OnLoad"}
-#define JNI_ONUNLOAD_SYMBOLS {"JNI_OnUnload"}
-#define JVM_ONLOAD_SYMBOLS {"JVM_OnLoad"}
-#define AGENT_ONLOAD_SYMBOLS {"Agent_OnLoad"}
-#define AGENT_ONUNLOAD_SYMBOLS {"Agent_OnUnload"}
-#define AGENT_ONATTACH_SYMBOLS {"Agent_OnAttach"}
-
-#define JNI_LIB_PREFIX "lib"
-#ifdef __APPLE__
-#define JNI_LIB_SUFFIX ".dylib"
-#define VERSIONED_JNI_LIB_NAME(NAME, VERSION) JNI_LIB_PREFIX NAME "." VERSION JNI_LIB_SUFFIX
-#else
-#define JNI_LIB_SUFFIX ".so"
-#define VERSIONED_JNI_LIB_NAME(NAME, VERSION) JNI_LIB_PREFIX NAME JNI_LIB_SUFFIX "." VERSION
-#endif
-#define JNI_LIB_NAME(NAME) JNI_LIB_PREFIX NAME JNI_LIB_SUFFIX
-
-#if defined(AIX) || defined(SOLARIS)
-#define JVM_MAXPATHLEN MAXPATHLEN
-#else
-// Hack: MAXPATHLEN is 4095 on some Linux and 4096 on others. This may
-// cause problems if JVM and the rest of JDK are built on different
-// Linux releases. Here we define JVM_MAXPATHLEN to be MAXPATHLEN + 1,
-// so buffers declared in VM are always >= 4096.
-#define JVM_MAXPATHLEN MAXPATHLEN + 1
-#endif
-
-#define JVM_R_OK R_OK
-#define JVM_W_OK W_OK
-#define JVM_X_OK X_OK
-#define JVM_F_OK F_OK
-
-/*
- * File I/O
- */
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <signal.h>
-
-/* Signals */
-
-#include <sys/socket.h> // for socklen_t
-
-#define JVM_SIGINT SIGINT
-#define JVM_SIGTERM SIGTERM
-
-#define BREAK_SIGNAL SIGQUIT /* Thread dumping support. */
-#ifdef SOLARIS
-#define ASYNC_SIGNAL SIGJVM2 /* Event-based suspend/resume support */
-#endif // SOLARIS
-#define SHUTDOWN1_SIGNAL SIGHUP /* Shutdown Hooks support. */
-#define SHUTDOWN2_SIGNAL SIGINT
-#define SHUTDOWN3_SIGNAL SIGTERM
-
-/* With 1.4.1 libjsig added versioning: used in os_solaris.cpp and jsig.c */
-#define JSIG_VERSION_1_4_1 0x30140100
-
-#endif /* !_JAVASOFT_JVM_MD_H_ */
--- a/src/java.base/windows/native/include/jvm_md.h Wed Dec 13 14:21:12 2017 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,102 +0,0 @@
-/*
- * Copyright (c) 1997, 2008, 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.
- */
-
-#ifndef _JAVASOFT_JVM_MD_H_
-#define _JAVASOFT_JVM_MD_H_
-
-/*
- * This file is currently collecting system-specific dregs for the
- * JNI conversion, which should be sorted out later.
- */
-
-#include <windows.h>
-#include <windef.h>
-#include <winbase.h>
-
-#include "jni.h"
-
-typedef int socklen_t;
-
-#define JNI_ONLOAD_SYMBOLS {"_JNI_OnLoad@8", "JNI_OnLoad"}
-#define JNI_ONUNLOAD_SYMBOLS {"_JNI_OnUnload@8", "JNI_OnUnload"}
-#define JVM_ONLOAD_SYMBOLS {"_JVM_OnLoad@12", "JVM_OnLoad"}
-#define AGENT_ONLOAD_SYMBOLS {"_Agent_OnLoad@12", "Agent_OnLoad"}
-#define AGENT_ONUNLOAD_SYMBOLS {"_Agent_OnUnload@4", "Agent_OnUnload"}
-#define AGENT_ONATTACH_SYMBOLS {"_Agent_OnAttach@12", "Agent_OnAttach"}
-
-#define JNI_LIB_PREFIX ""
-#define JNI_LIB_SUFFIX ".dll"
-
-struct dirent {
- char d_name[MAX_PATH];
-};
-
-typedef struct {
- struct dirent dirent;
- char *path;
- HANDLE handle;
- WIN32_FIND_DATA find_data;
-} DIR;
-
-#include <stddef.h> /* For uintptr_t */
-#include <stdlib.h>
-
-#define JVM_MAXPATHLEN _MAX_PATH
-
-#define JVM_R_OK 4
-#define JVM_W_OK 2
-#define JVM_X_OK 1
-#define JVM_F_OK 0
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-JNIEXPORT void * JNICALL
-JVM_GetThreadInterruptEvent();
-
-#ifdef __cplusplus
-} /* extern "C" */
-#endif /* __cplusplus */
-
-/*
- * File I/O
- */
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <signal.h>
-
-/* Signals */
-
-#define JVM_SIGINT SIGINT
-#define JVM_SIGTERM SIGTERM
-
-#define SHUTDOWN1_SIGNAL SIGINT /* Shutdown Hooks support. */
-#define SHUTDOWN2_SIGNAL SIGTERM
-
-#endif /* !_JAVASOFT_JVM_MD_H_ */
--- a/src/java.compiler/share/classes/javax/lang/model/SourceVersion.java Wed Dec 13 14:21:12 2017 -0800
+++ b/src/java.compiler/share/classes/javax/lang/model/SourceVersion.java Mon Dec 18 10:28:43 2017 -0800
@@ -56,7 +56,7 @@
* 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 @@
* 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;
--- a/src/java.management/share/native/include/jmm.h Wed Dec 13 14:21:12 2017 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,345 +0,0 @@
-/*
- * Copyright (c) 2003, 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
- * 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.
- */
-
-#ifndef _JAVA_JMM_H_
-#define _JAVA_JMM_H_
-
-/*
- * This is a private interface used by JDK for JVM monitoring
- * and management.
- *
- * Bump the version number when either of the following happens:
- *
- * 1. There is a change in functions in JmmInterface.
- *
- * 2. There is a change in the contract between VM and Java classes.
- */
-
-#include "jni.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-enum {
- JMM_VERSION_1 = 0x20010000,
- JMM_VERSION_1_0 = 0x20010000,
- JMM_VERSION_1_1 = 0x20010100, // JDK 6
- JMM_VERSION_1_2 = 0x20010200, // JDK 7
- JMM_VERSION_1_2_1 = 0x20010201, // JDK 7 GA
- JMM_VERSION_1_2_2 = 0x20010202,
- JMM_VERSION_2 = 0x20020000, // JDK 10
- JMM_VERSION = 0x20020000
-};
-
-typedef struct {
- unsigned int isLowMemoryDetectionSupported : 1;
- unsigned int isCompilationTimeMonitoringSupported : 1;
- unsigned int isThreadContentionMonitoringSupported : 1;
- unsigned int isCurrentThreadCpuTimeSupported : 1;
- unsigned int isOtherThreadCpuTimeSupported : 1;
- unsigned int isObjectMonitorUsageSupported : 1;
- unsigned int isSynchronizerUsageSupported : 1;
- unsigned int isThreadAllocatedMemorySupported : 1;
- unsigned int isRemoteDiagnosticCommandsSupported : 1;
- unsigned int : 22;
-} jmmOptionalSupport;
-
-typedef enum {
- JMM_CLASS_LOADED_COUNT = 1, /* Total number of loaded classes */
- JMM_CLASS_UNLOADED_COUNT = 2, /* Total number of unloaded classes */
- JMM_THREAD_TOTAL_COUNT = 3, /* Total number of threads that have been started */
- JMM_THREAD_LIVE_COUNT = 4, /* Current number of live threads */
- JMM_THREAD_PEAK_COUNT = 5, /* Peak number of live threads */
- JMM_THREAD_DAEMON_COUNT = 6, /* Current number of daemon threads */
- JMM_JVM_INIT_DONE_TIME_MS = 7, /* Time when the JVM finished initialization */
- JMM_COMPILE_TOTAL_TIME_MS = 8, /* Total accumulated time spent in compilation */
- JMM_GC_TIME_MS = 9, /* Total accumulated time spent in collection */
- JMM_GC_COUNT = 10, /* Total number of collections */
- JMM_JVM_UPTIME_MS = 11, /* The JVM uptime in milliseconds */
-
- JMM_INTERNAL_ATTRIBUTE_INDEX = 100,
- JMM_CLASS_LOADED_BYTES = 101, /* Number of bytes loaded instance classes */
- JMM_CLASS_UNLOADED_BYTES = 102, /* Number of bytes unloaded instance classes */
- JMM_TOTAL_CLASSLOAD_TIME_MS = 103, /* Accumulated VM class loader time (TraceClassLoadingTime) */
- JMM_VM_GLOBAL_COUNT = 104, /* Number of VM internal flags */
- JMM_SAFEPOINT_COUNT = 105, /* Total number of safepoints */
- JMM_TOTAL_SAFEPOINTSYNC_TIME_MS = 106, /* Accumulated time spent getting to safepoints */
- JMM_TOTAL_STOPPED_TIME_MS = 107, /* Accumulated time spent at safepoints */
- JMM_TOTAL_APP_TIME_MS = 108, /* Accumulated time spent in Java application */
- JMM_VM_THREAD_COUNT = 109, /* Current number of VM internal threads */
- JMM_CLASS_INIT_TOTAL_COUNT = 110, /* Number of classes for which initializers were run */
- JMM_CLASS_INIT_TOTAL_TIME_MS = 111, /* Accumulated time spent in class initializers */
- JMM_METHOD_DATA_SIZE_BYTES = 112, /* Size of method data in memory */
- JMM_CLASS_VERIFY_TOTAL_TIME_MS = 113, /* Accumulated time spent in class verifier */
- JMM_SHARED_CLASS_LOADED_COUNT = 114, /* Number of shared classes loaded */
- JMM_SHARED_CLASS_UNLOADED_COUNT = 115, /* Number of shared classes unloaded */
- JMM_SHARED_CLASS_LOADED_BYTES = 116, /* Number of bytes loaded shared classes */
- JMM_SHARED_CLASS_UNLOADED_BYTES = 117, /* Number of bytes unloaded shared classes */
-
- JMM_OS_ATTRIBUTE_INDEX = 200,
- JMM_OS_PROCESS_ID = 201, /* Process id of the JVM */
- JMM_OS_MEM_TOTAL_PHYSICAL_BYTES = 202, /* Physical memory size */
-
- JMM_GC_EXT_ATTRIBUTE_INFO_SIZE = 401 /* the size of the GC specific attributes for a given GC memory manager */
-} jmmLongAttribute;
-
-typedef enum {
- JMM_VERBOSE_GC = 21,
- JMM_VERBOSE_CLASS = 22,
- JMM_THREAD_CONTENTION_MONITORING = 23,
- JMM_THREAD_CPU_TIME = 24,
- JMM_THREAD_ALLOCATED_MEMORY = 25
-} jmmBoolAttribute;
-
-
-enum {
- JMM_THREAD_STATE_FLAG_SUSPENDED = 0x00100000,
- JMM_THREAD_STATE_FLAG_NATIVE = 0x00400000
-};
-
-#define JMM_THREAD_STATE_FLAG_MASK 0xFFF00000
-
-typedef enum {
- JMM_STAT_PEAK_THREAD_COUNT = 801,
- JMM_STAT_THREAD_CONTENTION_COUNT = 802,
- JMM_STAT_THREAD_CONTENTION_TIME = 803,
- JMM_STAT_THREAD_CONTENTION_STAT = 804,
- JMM_STAT_PEAK_POOL_USAGE = 805,
- JMM_STAT_GC_STAT = 806
-} jmmStatisticType;
-
-typedef enum {
- JMM_USAGE_THRESHOLD_HIGH = 901,
- JMM_USAGE_THRESHOLD_LOW = 902,
- JMM_COLLECTION_USAGE_THRESHOLD_HIGH = 903,
- JMM_COLLECTION_USAGE_THRESHOLD_LOW = 904
-} jmmThresholdType;
-
-/* Should match what is allowed in globals.hpp */
-typedef enum {
- JMM_VMGLOBAL_TYPE_UNKNOWN = 0,
- JMM_VMGLOBAL_TYPE_JBOOLEAN = 1,
- JMM_VMGLOBAL_TYPE_JSTRING = 2,
- JMM_VMGLOBAL_TYPE_JLONG = 3,
- JMM_VMGLOBAL_TYPE_JDOUBLE = 4
-} jmmVMGlobalType;
-
-typedef enum {
- JMM_VMGLOBAL_ORIGIN_DEFAULT = 1, /* Default value */
- JMM_VMGLOBAL_ORIGIN_COMMAND_LINE = 2, /* Set at command line (or JNI invocation) */
- JMM_VMGLOBAL_ORIGIN_MANAGEMENT = 3, /* Set via management interface */
- JMM_VMGLOBAL_ORIGIN_ENVIRON_VAR = 4, /* Set via environment variables */
- JMM_VMGLOBAL_ORIGIN_CONFIG_FILE = 5, /* Set via config file (such as .hotspotrc) */
- JMM_VMGLOBAL_ORIGIN_ERGONOMIC = 6, /* Set via ergonomic */
- JMM_VMGLOBAL_ORIGIN_ATTACH_ON_DEMAND = 7, /* Set via attach */
- JMM_VMGLOBAL_ORIGIN_OTHER = 99 /* Set via some other mechanism */
-} jmmVMGlobalOrigin;
-
-typedef struct {
- jstring name;
- jvalue value;
- jmmVMGlobalType type; /* Data type */
- jmmVMGlobalOrigin origin; /* Default or non-default value */
- unsigned int writeable : 1; /* dynamically writeable */
- unsigned int external : 1; /* external supported interface */
- unsigned int reserved : 30;
- void *reserved1;
- void *reserved2;
-} jmmVMGlobal;
-
-typedef struct {
- const char* name;
- char type;
- const char* description;
-} jmmExtAttributeInfo;
-
-/* Caller has to set the following fields before calling GetLastGCStat
- * o usage_before_gc - array of MemoryUsage objects
- * o usage_after_gc - array of MemoryUsage objects
- * o gc_ext_attribute_values_size - size of gc_ext_atttribute_values array
- * o gc_ext_attribtue_values - array of jvalues
- */
-typedef struct {
- jlong gc_index; /* Index of the collections */
- jlong start_time; /* Start time of the GC */
- jlong end_time; /* End time of the GC */
- jobjectArray usage_before_gc; /* Memory usage array before GC */
- jobjectArray usage_after_gc; /* Memory usage array after GC */
- jint gc_ext_attribute_values_size; /* set by the caller of GetGCStat */
- jvalue* gc_ext_attribute_values; /* Array of jvalue for GC extension attributes */
- jint num_gc_ext_attributes; /* number of GC extension attribute values s are filled */
- /* -1 indicates gc_ext_attribute_values is not big enough */
-} jmmGCStat;
-
-typedef struct {
- const char* name; /* Name of the diagnostic command */
- const char* description; /* Short description */
- const char* impact; /* Impact on the JVM */
- const char* permission_class; /* Class name of the required permission if any */
- const char* permission_name; /* Permission name of the required permission if any */
- const char* permission_action; /* Action name of the required permission if any*/
- int num_arguments; /* Number of supported options or arguments */
- jboolean enabled; /* True if the diagnostic command can be invoked, false otherwise*/
-} dcmdInfo;
-
-typedef struct {
- const char* name; /* Option/Argument name*/
- const char* description; /* Short description */
- const char* type; /* Type: STRING, BOOLEAN, etc. */
- const char* default_string; /* Default value in a parsable string */
- jboolean mandatory; /* True if the option/argument is mandatory */
- jboolean option; /* True if it is an option, false if it is an argument */
- /* (see diagnosticFramework.hpp for option/argument definitions) */
- jboolean multiple; /* True is the option can be specified several time */
- int position; /* Expected position for this argument (this field is */
- /* meaningless for options) */
-} dcmdArgInfo;
-
-typedef struct jmmInterface_1_ {
- void* reserved1;
- void* reserved2;
-
- jint (JNICALL *GetVersion) (JNIEnv *env);
-
- jint (JNICALL *GetOptionalSupport) (JNIEnv *env,
- jmmOptionalSupport* support_ptr);
-
- jint (JNICALL *GetThreadInfo) (JNIEnv *env,
- jlongArray ids,
- jint maxDepth,
- jobjectArray infoArray);
-
- jobjectArray (JNICALL *GetMemoryPools) (JNIEnv* env, jobject mgr);
-
- jobjectArray (JNICALL *GetMemoryManagers) (JNIEnv* env, jobject pool);
-
- jobject (JNICALL *GetMemoryPoolUsage) (JNIEnv* env, jobject pool);
- jobject (JNICALL *GetPeakMemoryPoolUsage) (JNIEnv* env, jobject pool);
-
- void (JNICALL *GetThreadAllocatedMemory)
- (JNIEnv *env,
- jlongArray ids,
- jlongArray sizeArray);
-
- jobject (JNICALL *GetMemoryUsage) (JNIEnv* env, jboolean heap);
-
- jlong (JNICALL *GetLongAttribute) (JNIEnv *env, jobject obj, jmmLongAttribute att);
- jboolean (JNICALL *GetBoolAttribute) (JNIEnv *env, jmmBoolAttribute att);
- jboolean (JNICALL *SetBoolAttribute) (JNIEnv *env, jmmBoolAttribute att, jboolean flag);
-
- jint (JNICALL *GetLongAttributes) (JNIEnv *env,
- jobject obj,
- jmmLongAttribute* atts,
- jint count,
- jlong* result);
-
- jobjectArray (JNICALL *FindCircularBlockedThreads) (JNIEnv *env);
-
- // Not used in JDK 6 or JDK 7
- jlong (JNICALL *GetThreadCpuTime) (JNIEnv *env, jlong thread_id);
-
- jobjectArray (JNICALL *GetVMGlobalNames) (JNIEnv *env);
- jint (JNICALL *GetVMGlobals) (JNIEnv *env,
- jobjectArray names,
- jmmVMGlobal *globals,
- jint count);
-
- jint (JNICALL *GetInternalThreadTimes) (JNIEnv *env,
- jobjectArray names,
- jlongArray times);
-
- jboolean (JNICALL *ResetStatistic) (JNIEnv *env,
- jvalue obj,
- jmmStatisticType type);
-
- void (JNICALL *SetPoolSensor) (JNIEnv *env,
- jobject pool,
- jmmThresholdType type,
- jobject sensor);
-
- jlong (JNICALL *SetPoolThreshold) (JNIEnv *env,
- jobject pool,
- jmmThresholdType type,
- jlong threshold);
- jobject (JNICALL *GetPoolCollectionUsage) (JNIEnv* env, jobject pool);
-
- jint (JNICALL *GetGCExtAttributeInfo) (JNIEnv *env,
- jobject mgr,
- jmmExtAttributeInfo *ext_info,
- jint count);
- void (JNICALL *GetLastGCStat) (JNIEnv *env,
- jobject mgr,
- jmmGCStat *gc_stat);
-
- jlong (JNICALL *GetThreadCpuTimeWithKind)
- (JNIEnv *env,
- jlong thread_id,
- jboolean user_sys_cpu_time);
- void (JNICALL *GetThreadCpuTimesWithKind)
- (JNIEnv *env,
- jlongArray ids,
- jlongArray timeArray,
- jboolean user_sys_cpu_time);
-
- jint (JNICALL *DumpHeap0) (JNIEnv *env,
- jstring outputfile,
- jboolean live);
- jobjectArray (JNICALL *FindDeadlocks) (JNIEnv *env,
- jboolean object_monitors_only);
- void (JNICALL *SetVMGlobal) (JNIEnv *env,
- jstring flag_name,
- jvalue new_value);
- void* reserved6;
- jobjectArray (JNICALL *DumpThreads) (JNIEnv *env,
- jlongArray ids,
- jboolean lockedMonitors,
- jboolean lockedSynchronizers,
- jint maxDepth);
- void (JNICALL *SetGCNotificationEnabled) (JNIEnv *env,
- jobject mgr,
- jboolean enabled);
- jobjectArray (JNICALL *GetDiagnosticCommands) (JNIEnv *env);
- void (JNICALL *GetDiagnosticCommandInfo)
- (JNIEnv *env,
- jobjectArray cmds,
- dcmdInfo *infoArray);
- void (JNICALL *GetDiagnosticCommandArgumentsInfo)
- (JNIEnv *env,
- jstring commandName,
- dcmdArgInfo *infoArray);
- jstring (JNICALL *ExecuteDiagnosticCommand)
- (JNIEnv *env,
- jstring command);
- void (JNICALL *SetDiagnosticFrameworkNotificationEnabled)
- (JNIEnv *env,
- jboolean enabled);
-} JmmInterface;
-
-#ifdef __cplusplus
-} /* extern "C" */
-#endif /* __cplusplus */
-
-#endif /* !_JAVA_JMM_H_ */
--- a/src/jdk.compiler/share/classes/com/sun/tools/javah/Gen.java Wed Dec 13 14:21:12 2017 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -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();
- }
-}
-
--- a/src/jdk.compiler/share/classes/com/sun/tools/javah/InternalError.java Wed Dec 13 14:21:12 2017 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,40 +0,0 @@
-/*
- * Copyright (c) 2007, 2008, 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;
-
-/**
- * <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>
- */
-public class InternalError extends Error {
- private static final long serialVersionUID = 8411861562497165022L;
- InternalError(String msg, Throwable cause) {
- super("Internal error: " + msg);
- initCause(cause);
- }
-}
--- a/src/jdk.compiler/share/classes/com/sun/tools/javah/JNI.java Wed Dec 13 14:21:12 2017 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,185 +0,0 @@
-/*
- * Copyright (c) 2002, 2010, 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.OutputStream;
-import java.io.PrintWriter;
-import java.util.ArrayList;
-import java.util.List;
-import javax.lang.model.element.Element;
-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.type.ArrayType;
-import javax.lang.model.type.TypeMirror;
-import javax.lang.model.util.ElementFilter;
-
-
-/**
- * Header file generator for JNI.
- *
- * <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 class JNI extends Gen {
- JNI(Util util) {
- super(util);
- }
-
- public String getIncludes() {
- return "#include <jni.h>";
- }
-
- public void write(OutputStream o, TypeElement clazz) throws Util.Exit {
- try {
- String cname = mangler.mangle(clazz.getQualifiedName(), Mangle.Type.CLASS);
- PrintWriter pw = wrapWriter(o);
- pw.println(guardBegin(cname));
- pw.println(cppGuardBegin());
-
- /* Write statics. */
- List<VariableElement> classfields = getAllFields(clazz);
-
- for (VariableElement v: classfields) {
- if (!v.getModifiers().contains(Modifier.STATIC))
- continue;
- String s = null;
- s = defineForStatic(clazz, v);
- if (s != null) {
- pw.println(s);
- }
- }
-
- /* Write methods. */
- List<ExecutableElement> classmethods = ElementFilter.methodsIn(clazz.getEnclosedElements());
- for (ExecutableElement md: classmethods) {
- if(md.getModifiers().contains(Modifier.NATIVE)){
- TypeMirror mtr = types.erasure(md.getReturnType());
- String sig = signature(md);
- TypeSignature newtypesig = new TypeSignature(elems);
- CharSequence methodName = md.getSimpleName();
- boolean longName = false;
- for (ExecutableElement md2: classmethods) {
- if ((md2 != md)
- && (methodName.equals(md2.getSimpleName()))
- && (md2.getModifiers().contains(Modifier.NATIVE)))
- longName = true;
-
- }
- pw.println("/*");
- pw.println(" * Class: " + cname);
- pw.println(" * Method: " +
- mangler.mangle(methodName, Mangle.Type.FIELDSTUB));
- pw.println(" * Signature: " + newtypesig.getTypeSignature(sig, mtr));
- pw.println(" */");
- pw.println("JNIEXPORT " + jniType(mtr) +
- " JNICALL " +
- mangler.mangleMethod(md, clazz,
- (longName) ?
- Mangle.Type.METHOD_JNI_LONG :
- Mangle.Type.METHOD_JNI_SHORT));
- pw.print(" (JNIEnv *, ");
- List<? extends VariableElement> paramargs = md.getParameters();
- List<TypeMirror> args = new ArrayList<>();
- for (VariableElement p: paramargs) {
- args.add(types.erasure(p.asType()));
- }
- if (md.getModifiers().contains(Modifier.STATIC))
- pw.print("jclass");
- else
- pw.print("jobject");
-
- for (TypeMirror arg: args) {
- pw.print(", ");
- pw.print(jniType(arg));
- }
- pw.println(");" + lineSep);
- }
- }
- pw.println(cppGuardEnd());
- pw.println(guardEnd(cname));
- } catch (TypeSignature.SignatureException e) {
- util.error("jni.sigerror", e.getMessage());
- }
- }
-
-
- protected final String jniType(TypeMirror t) throws Util.Exit {
- TypeElement throwable = elems.getTypeElement("java.lang.Throwable");
- TypeElement jClass = elems.getTypeElement("java.lang.Class");
- TypeElement jString = elems.getTypeElement("java.lang.String");
- Element tclassDoc = types.asElement(t);
-
-
- switch (t.getKind()) {
- case ARRAY: {
- TypeMirror ct = ((ArrayType) t).getComponentType();
- switch (ct.getKind()) {
- case BOOLEAN: return "jbooleanArray";
- case BYTE: return "jbyteArray";
- case CHAR: return "jcharArray";
- case SHORT: return "jshortArray";
- case INT: return "jintArray";
- case LONG: return "jlongArray";
- case FLOAT: return "jfloatArray";
- case DOUBLE: return "jdoubleArray";
- case ARRAY:
- case DECLARED: return "jobjectArray";
- default: throw new Error(ct.toString());
- }
- }
-
- case VOID: return "void";
- case BOOLEAN: return "jboolean";
- case BYTE: return "jbyte";
- case CHAR: return "jchar";
- case SHORT: return "jshort";
- case INT: return "jint";
- case LONG: return "jlong";
- case FLOAT: return "jfloat";
- case DOUBLE: return "jdouble";
-
- case DECLARED: {
- if (tclassDoc.equals(jString))
- return "jstring";
- else if (types.isAssignable(t, throwable.asType()))
- return "jthrowable";
- else if (types.isAssignable(t, jClass.asType()))
- return "jclass";
- else
- return "jobject";
- }
- }
-
- util.bug("jni.unknown.type");
- return null; /* dead code. */
- }
-}
--- a/src/jdk.compiler/share/classes/com/sun/tools/javah/JavahFileManager.java Wed Dec 13 14:21:12 2017 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,59 +0,0 @@
-/*
- * Copyright (c) 2007, 2016, 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.PrintWriter;
-import java.nio.charset.Charset;
-import javax.tools.DiagnosticListener;
-import javax.tools.JavaFileObject;
-
-import com.sun.tools.javac.file.JavacFileManager;
-import com.sun.tools.javac.util.Context;
-
-/**
- * javah's implementation of JavaFileManager.
- *
- * <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>
- */
-class JavahFileManager extends JavacFileManager {
- private JavahFileManager(Context context, Charset charset) {
- super(context, true, charset);
- setSymbolFileEnabled(false);
- }
-
- static JavahFileManager create(final DiagnosticListener<? super JavaFileObject> dl, PrintWriter log) {
- Context javac_context = new Context();
-
- if (dl != null)
- javac_context.put(DiagnosticListener.class, dl);
- javac_context.put(com.sun.tools.javac.util.Log.errKey, log);
-
- return new JavahFileManager(javac_context, null);
- }
-}
--- a/src/jdk.compiler/share/classes/com/sun/tools/javah/JavahTask.java Wed Dec 13 14:21:12 2017 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,775 +0,0 @@
-/*
- * Copyright (c) 2002, 2016, 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.File;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.io.PrintWriter;
-import java.io.Writer;
-import java.nio.file.NoSuchFileException;
-import java.text.MessageFormat;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.LinkedHashSet;
-import java.util.List;
-import java.util.Locale;
-import java.util.Map;
-import java.util.MissingResourceException;
-import java.util.Objects;
-import java.util.ResourceBundle;
-import java.util.Set;
-
-import javax.annotation.processing.AbstractProcessor;
-import javax.annotation.processing.Messager;
-import javax.annotation.processing.ProcessingEnvironment;
-import javax.annotation.processing.RoundEnvironment;
-import javax.annotation.processing.SupportedAnnotationTypes;
-import javax.lang.model.SourceVersion;
-import javax.lang.model.element.ExecutableElement;
-import javax.lang.model.element.TypeElement;
-import javax.lang.model.element.VariableElement;
-import javax.lang.model.type.ArrayType;
-import javax.lang.model.type.DeclaredType;
-import javax.lang.model.type.TypeMirror;
-import javax.lang.model.type.TypeVisitor;
-import javax.lang.model.util.ElementFilter;
-import javax.lang.model.util.SimpleTypeVisitor9;
-import javax.lang.model.util.Types;
-import javax.tools.Diagnostic;
-import javax.tools.DiagnosticListener;
-import javax.tools.JavaCompiler;
-import javax.tools.JavaCompiler.CompilationTask;
-import javax.tools.JavaFileManager;
-import javax.tools.JavaFileObject;
-import javax.tools.StandardJavaFileManager;
-import javax.tools.StandardLocation;
-import javax.tools.ToolProvider;
-
-import com.sun.tools.javac.code.Symbol.CompletionFailure;
-import com.sun.tools.javac.main.CommandLine;
-import com.sun.tools.javac.util.DefinedBy;
-import com.sun.tools.javac.util.DefinedBy.Api;
-
-import static javax.tools.Diagnostic.Kind.*;
-
-
-/**
- * Javah generates support files for native methods.
- * Parse commandline options and invokes javadoc to execute those commands.
- *
- * <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
- * @author Jonathan Gibbons
- */
-public class JavahTask implements NativeHeaderTool.NativeHeaderTask {
- public class BadArgs extends Exception {
- private static final long serialVersionUID = 1479361270874789045L;
- BadArgs(String key, Object... args) {
- super(JavahTask.this.getMessage(key, args));
- this.key = key;
- this.args = args;
- }
-
- BadArgs showUsage(boolean b) {
- showUsage = b;
- return this;
- }
-
- final String key;
- final Object[] args;
- boolean showUsage;
- }
-
- static abstract class Option {
- Option(boolean hasArg, String... aliases) {
- this.hasArg = hasArg;
- this.aliases = aliases;
- }
-
- boolean isHidden() {
- return false;
- }
-
- boolean matches(String opt) {
- for (String a: aliases) {
- if (a.equals(opt))
- return true;
- }
- return false;
- }
-
- boolean ignoreRest() {
- return false;
- }
-
- abstract void process(JavahTask task, String opt, String arg) throws BadArgs;
-
- final boolean hasArg;
- final String[] aliases;
- }
-
- static abstract class HiddenOption extends Option {
- HiddenOption(boolean hasArg, String... aliases) {
- super(hasArg, aliases);
- }
-
- @Override
- boolean isHidden() {
- return true;
- }
- }
-
- static final Option[] recognizedOptions = {
- new Option(true, "-o") {
- void process(JavahTask task, String opt, String arg) {
- task.ofile = new File(arg);
- }
- },
-
- new Option(true, "-d") {
- void process(JavahTask task, String opt, String arg) {
- task.odir = new File(arg);
- }
- },
-
- new HiddenOption(true, "-td") {
- void process(JavahTask task, String opt, String arg) {
- // ignored; for backwards compatibility
- }
- },
-
- new Option(false, "-v", "-verbose") {
- void process(JavahTask task, String opt, String arg) {
- task.verbose = true;
- }
- },
-
- new Option(false, "-h", "-help", "--help", "-?") {
- void process(JavahTask task, String opt, String arg) {
- task.help = true;
- }
- },
-
- new HiddenOption(false, "-trace") {
- void process(JavahTask task, String opt, String arg) {
- task.trace = true;
- }
- },
-
- new Option(false, "-version") {
- void process(JavahTask task, String opt, String arg) {
- task.version = true;
- }
- },
-
- new HiddenOption(false, "-fullversion") {
- void process(JavahTask task, String opt, String arg) {
- task.fullVersion = true;
- }
- },
-
- new Option(false, "-jni") {
- void process(JavahTask task, String opt, String arg) {
- task.jni = true;
- }
- },
-
- new Option(false, "-force") {
- void process(JavahTask task, String opt, String arg) {
- task.force = true;
- }
- },
-
- new HiddenOption(false, "-Xnew") {
- void process(JavahTask task, String opt, String arg) {
- // we're already using the new javah
- }
- },
-
- new HiddenOption(false, "-llni", "-Xllni") {
- void process(JavahTask task, String opt, String arg) {
- task.llni = true;
- }
- },
-
- new HiddenOption(false, "-llnidouble") {
- void process(JavahTask task, String opt, String arg) {
- task.llni = true;
- task.doubleAlign = true;
- }
- },
-
- new HiddenOption(false) {
- boolean matches(String opt) {
- return opt.startsWith("-XD");
- }
- void process(JavahTask task, String opt, String arg) {
- task.javac_extras.add(opt);
- }
- },
- };
-
- JavahTask() {
- }
-
- JavahTask(Writer out,
- JavaFileManager fileManager,
- DiagnosticListener<? super JavaFileObject> diagnosticListener,
- Iterable<String> options,
- Iterable<String> classes) {
- this();
- this.log = getPrintWriterForWriter(out);
- this.fileManager = fileManager;
- this.diagnosticListener = diagnosticListener;
-
- try {
- handleOptions(options, false);
- } catch (BadArgs e) {
- throw new IllegalArgumentException(e.getMessage());
- }
-
- this.classes = new ArrayList<>();
- if (classes != null) {
- for (String classname: classes) {
- Objects.requireNonNull(classname);
- this.classes.add(classname);
- }
- }
- }
-
- public void setLocale(Locale locale) {
- if (locale == null)
- locale = Locale.getDefault();
- task_locale = locale;
- }
-
- public void setLog(PrintWriter log) {
- this.log = log;
- }
-
- public void setLog(OutputStream s) {
- setLog(getPrintWriterForStream(s));
- }
-
- static PrintWriter getPrintWriterForStream(OutputStream s) {
- return new PrintWriter(s, true);
- }
-
- static PrintWriter getPrintWriterForWriter(Writer w) {
- if (w == null)
- return getPrintWriterForStream(null);
- else if (w instanceof PrintWriter)
- return (PrintWriter) w;
- else
- return new PrintWriter(w, true);
- }
-
- public void setDiagnosticListener(DiagnosticListener<? super JavaFileObject> dl) {
- diagnosticListener = dl;
- }
-
- public void setDiagnosticListener(OutputStream s) {
- setDiagnosticListener(getDiagnosticListenerForStream(s));
- }
-
- private DiagnosticListener<JavaFileObject> getDiagnosticListenerForStream(OutputStream s) {
- return getDiagnosticListenerForWriter(getPrintWriterForStream(s));
- }
-
- private DiagnosticListener<JavaFileObject> getDiagnosticListenerForWriter(Writer w) {
- final PrintWriter pw = getPrintWriterForWriter(w);
- return diagnostic -> {
- if (diagnostic.getKind() == Diagnostic.Kind.ERROR) {
- pw.print(getMessage("err.prefix"));
- pw.print(" ");
- }
- pw.println(diagnostic.getMessage(null));
- };
- }
-
- int run(String[] args) {
- try {
- handleOptions(args);
- boolean ok = run();
- return ok ? 0 : 1;
- } catch (BadArgs e) {
- diagnosticListener.report(createDiagnostic(e.key, e.args));
- return 1;
- } catch (InternalError e) {
- diagnosticListener.report(createDiagnostic("err.internal.error", e.getMessage()));
- return 1;
- } catch (Util.Exit e) {
- return e.exitValue;
- } finally {
- log.flush();
- }
- }
-
- public void handleOptions(String[] args) throws BadArgs {
- handleOptions(Arrays.asList(args), true);
- }
-
- private void handleOptions(Iterable<String> args, boolean allowClasses) throws BadArgs {
- if (log == null) {
- log = getPrintWriterForStream(System.out);
- if (diagnosticListener == null)
- diagnosticListener = getDiagnosticListenerForStream(System.err);
- } else {
- if (diagnosticListener == null)
- diagnosticListener = getDiagnosticListenerForWriter(log);
- }
-
- if (fileManager == null)
- fileManager = getDefaultFileManager(diagnosticListener, log);
-
- Iterator<String> iter = expandAtArgs(args).iterator();
- noArgs = !iter.hasNext();
-
- while (iter.hasNext()) {
- String arg = iter.next();
- if (arg.startsWith("-"))
- handleOption(arg, iter);
- else if (allowClasses) {
- if (classes == null)
- classes = new ArrayList<>();
- classes.add(arg);
- while (iter.hasNext())
- classes.add(iter.next());
- } else
- throw new BadArgs("err.unknown.option", arg).showUsage(true);
- }
-
- if ((classes == null || classes.size() == 0) &&
- !(noArgs || help || version || fullVersion)) {
- throw new BadArgs("err.no.classes.specified");
- }
-
- if (jni && llni)
- throw new BadArgs("jni.llni.mixed");
-
- if (odir != null && ofile != null)
- throw new BadArgs("dir.file.mixed");
- }
-
- private void handleOption(String name, Iterator<String> rest) throws BadArgs {
- for (Option o: recognizedOptions) {
- if (o.matches(name)) {
- if (o.hasArg) {
- if (rest.hasNext())
- o.process(this, name, rest.next());
- else
- throw new BadArgs("err.missing.arg", name).showUsage(true);
- } else
- o.process(this, name, null);
-
- if (o.ignoreRest()) {
- while (rest.hasNext())
- rest.next();
- }
- return;
- }
- }
-
- if (fileManager.handleOption(name, rest))
- return;
-
- throw new BadArgs("err.unknown.option", name).showUsage(true);
- }
-
- private Iterable<String> expandAtArgs(Iterable<String> args) throws BadArgs {
- try {
- List<String> l = new ArrayList<>();
- for (String arg: args) l.add(arg);
- return Arrays.asList(CommandLine.parse(l.toArray(new String[l.size()])));
- } catch (FileNotFoundException | NoSuchFileException e) {
- throw new BadArgs("at.args.file.not.found", e.getLocalizedMessage());
- } catch (IOException e) {
- throw new BadArgs("at.args.io.exception", e.getLocalizedMessage());
- }
- }
-
- public Boolean call() {
- return run();
- }
-
- public boolean run() throws Util.Exit {
-
- if (!javac_extras.contains("-XDsuppress-tool-removal-message")) {
- log.println(getMessage("javah.misc.Deprecation"));
- }
-
- Util util = new Util(log, diagnosticListener);
-
- if (noArgs || help) {
- showHelp();
- return help; // treat noArgs as an error for purposes of exit code
- }
-
- if (version || fullVersion) {
- showVersion(fullVersion);
- return true;
- }
-
- util.verbose = verbose;
-
- Gen g;
-
- if (llni)
- g = new LLNI(doubleAlign, util);
- else {
- g = new JNI(util);
- }
-
- if (ofile != null) {
- if (!(fileManager instanceof StandardJavaFileManager)) {
- diagnosticListener.report(createDiagnostic("err.cant.use.option.for.fm", "-o"));
- return false;
- }
- Iterable<? extends JavaFileObject> iter =
- ((StandardJavaFileManager) fileManager).getJavaFileObjectsFromFiles(Collections.singleton(ofile));
- JavaFileObject fo = iter.iterator().next();
- g.setOutFile(fo);
- } else {
- if (odir != null) {
- if (!(fileManager instanceof StandardJavaFileManager)) {
- diagnosticListener.report(createDiagnostic("err.cant.use.option.for.fm", "-d"));
- return false;
- }
-
- if (!odir.exists())
- if (!odir.mkdirs())
- util.error("cant.create.dir", odir.toString());
- try {
- ((StandardJavaFileManager) fileManager).setLocation(StandardLocation.CLASS_OUTPUT, Collections.singleton(odir));
- } catch (IOException e) {
- Object msg = e.getLocalizedMessage();
- if (msg == null) {
- msg = e;
- }
- diagnosticListener.report(createDiagnostic("err.ioerror", odir, msg));
- return false;
- }
- }
- g.setFileManager(fileManager);
- }
-
- /*
- * Force set to false will turn off smarts about checking file
- * content before writing.
- */
- g.setForce(force);
-
- if (fileManager instanceof JavahFileManager)
- ((JavahFileManager) fileManager).setSymbolFileEnabled(false);
-
- JavaCompiler c = ToolProvider.getSystemJavaCompiler();
- List<String> opts = new ArrayList<>();
- opts.add("-proc:only");
- opts.addAll(javac_extras);
-
- CompilationTask t;
- try {
- t = c.getTask(log, fileManager, diagnosticListener, opts, classes, null);
- } catch (IllegalArgumentException e) {
- util.error("bad.arg", e.getMessage());
- return false;
- }
-
- JavahProcessor p = new JavahProcessor(g);
- t.setProcessors(Collections.singleton(p));
-
- boolean ok = t.call();
- if (p.exit != null)
- throw new Util.Exit(p.exit);
- return ok;
-
- }
-
- static StandardJavaFileManager getDefaultFileManager(final DiagnosticListener<? super JavaFileObject> dl, PrintWriter log) {
- return JavahFileManager.create(dl, log);
- }
-
- private void showHelp() {
- log.println(getMessage("main.usage", progname));
-
- for (Option o: recognizedOptions) {
- if (o.isHidden())
- continue;
- String name = o.aliases[0].substring(1); // there must always be at least one name
- log.println(getMessage("main.opt." + name));
- }
-
- String[] fmOptions = {
- "--module-path", "--system",
- "--class-path", "-classpath", "-cp",
- "-bootclasspath"
- };
-
- for (String o: fmOptions) {
- if (fileManager.isSupportedOption(o) == -1)
- continue;
- String name = o.replaceAll("^-+", "").replaceAll("-+", "_");
- log.println(getMessage("main.opt." + name));
- }
-
- log.println(getMessage("main.usage.foot"));
- }
-
- private void showVersion(boolean full) {
- log.println(version(full));
- }
-
- private static final String versionRBName = "com.sun.tools.javah.resources.version";
- private static ResourceBundle versionRB;
-
- private String version(boolean full) {
- String msgKey = (full ? "javah.fullVersion" : "javah.version");
- String versionKey = (full ? "full" : "release");
- // versionKey=product: mm.nn.oo[-milestone]
- // versionKey=full: mm.mm.oo[-milestone]-build
- if (versionRB == null) {
- try {
- versionRB = ResourceBundle.getBundle(versionRBName);
- } catch (MissingResourceException e) {
- return getMessage("version.resource.missing", System.getProperty("java.version"));
- }
- }
- try {
- return getMessage(msgKey, "javah", versionRB.getString(versionKey));
- }
- catch (MissingResourceException e) {
- return getMessage("version.unknown", System.getProperty("java.version"));
- }
- }
-
- private Diagnostic<JavaFileObject> createDiagnostic(final String key, final Object... args) {
- return new Diagnostic<JavaFileObject>() {
- @DefinedBy(Api.COMPILER)
- public Kind getKind() {
- return Diagnostic.Kind.ERROR;
- }
-
- @DefinedBy(Api.COMPILER)
- public JavaFileObject getSource() {
- return null;
- }
-
- @DefinedBy(Api.COMPILER)
- public long getPosition() {
- return Diagnostic.NOPOS;
- }
-
- @DefinedBy(Api.COMPILER)
- public long getStartPosition() {
- return Diagnostic.NOPOS;
- }
-
- @DefinedBy(Api.COMPILER)
- public long getEndPosition() {
- return Diagnostic.NOPOS;
- }
-
- @DefinedBy(Api.COMPILER)
- public long getLineNumber() {
- return Diagnostic.NOPOS;
- }
-
- @DefinedBy(Api.COMPILER)
- public long getColumnNumber() {
- return Diagnostic.NOPOS;
- }
-
- @DefinedBy(Api.COMPILER)
- public String getCode() {
- return key;
- }
-
- @DefinedBy(Api.COMPILER)
- public String getMessage(Locale locale) {
- return JavahTask.this.getMessage(locale, key, args);
- }
-
- };
- }
-
- private String getMessage(String key, Object... args) {
- return getMessage(task_locale, key, args);
- }
-
- private String getMessage(Locale locale, String key, Object... args) {
- if (bundles == null) {
- // could make this a HashMap<Locale,SoftReference<ResourceBundle>>
- // and for efficiency, keep a hard reference to the bundle for the task
- // locale
- bundles = new HashMap<>();
- }
-
- if (locale == null)
- locale = Locale.getDefault();
-
- ResourceBundle b = bundles.get(locale);
- if (b == null) {
- try {
- b = ResourceBundle.getBundle("com.sun.tools.javah.resources.l10n", locale);
- bundles.put(locale, b);
- } catch (MissingResourceException e) {
- throw new InternalError("Cannot find javah resource bundle for locale " + locale, e);
- }
- }
-
- try {
- return MessageFormat.format(b.getString(key), args);
- } catch (MissingResourceException e) {
- return key;
- //throw new InternalError(e, key);
- }
- }
-
- File ofile;
- File odir;
- String bootcp;
- String usercp;
- List<String> classes;
- boolean verbose;
- boolean noArgs;
- boolean help;
- boolean trace;
- boolean version;
- boolean fullVersion;
- boolean jni;
- boolean llni;
- boolean doubleAlign;
- boolean force;
- Set<String> javac_extras = new LinkedHashSet<>();
-
- PrintWriter log;
- JavaFileManager fileManager;
- DiagnosticListener<? super JavaFileObject> diagnosticListener;
- Locale task_locale;
- Map<Locale, ResourceBundle> bundles;
-
- private static final String progname = "javah";
-
- @SupportedAnnotationTypes("*")
- class JavahProcessor extends AbstractProcessor {
- private Messager messager;
-
- JavahProcessor(Gen g) {
- this.g = g;
- }
-
- @Override @DefinedBy(Api.ANNOTATION_PROCESSING)
- public SourceVersion getSupportedSourceVersion() {
- // since this is co-bundled with javac, we can assume it supports
- // the latest source version
- return SourceVersion.latest();
- }
-
- @Override @DefinedBy(Api.ANNOTATION_PROCESSING)
- public void init(ProcessingEnvironment pEnv) {
- super.init(pEnv);
- messager = processingEnv.getMessager();
- }
-
- @DefinedBy(Api.ANNOTATION_PROCESSING)
- public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
- try {
- Set<TypeElement> classes = getAllClasses(ElementFilter.typesIn(roundEnv.getRootElements()));
- if (classes.size() > 0) {
- checkMethodParameters(classes);
- g.setProcessingEnvironment(processingEnv);
- g.setClasses(classes);
- g.run();
- }
- } catch (CompletionFailure cf) {
- messager.printMessage(ERROR, getMessage("class.not.found", cf.sym.getQualifiedName().toString()));
- } catch (ClassNotFoundException cnfe) {
- messager.printMessage(ERROR, getMessage("class.not.found", cnfe.getMessage()));
- } catch (IOException ioe) {
- messager.printMessage(ERROR, getMessage("io.exception", ioe.getMessage()));
- } catch (Util.Exit e) {
- exit = e;
- }
-
- return true;
- }
-
- private Set<TypeElement> getAllClasses(Set<? extends TypeElement> classes) {
- Set<TypeElement> allClasses = new LinkedHashSet<>();
- getAllClasses0(classes, allClasses);
- return allClasses;
- }
-
- private void getAllClasses0(Iterable<? extends TypeElement> classes, Set<TypeElement> allClasses) {
- for (TypeElement c: classes) {
- allClasses.add(c);
- getAllClasses0(ElementFilter.typesIn(c.getEnclosedElements()), allClasses);
- }
- }
-
- // 4942232:
- // check that classes exist for all the parameters of native methods
- private void checkMethodParameters(Set<TypeElement> classes) {
- Types types = processingEnv.getTypeUtils();
- for (TypeElement te: classes) {
- for (ExecutableElement ee: ElementFilter.methodsIn(te.getEnclosedElements())) {
- for (VariableElement ve: ee.getParameters()) {
- TypeMirror tm = ve.asType();
- checkMethodParametersVisitor.visit(tm, types);
- }
- }
- }
- }
-
- private TypeVisitor<Void,Types> checkMethodParametersVisitor =
- new SimpleTypeVisitor9<Void,Types>() {
- @Override @DefinedBy(Api.LANGUAGE_MODEL)
- public Void visitArray(ArrayType t, Types types) {
- visit(t.getComponentType(), types);
- return null;
- }
- @Override @DefinedBy(Api.LANGUAGE_MODEL)
- public Void visitDeclared(DeclaredType t, Types types) {
- t.asElement().getKind(); // ensure class exists
- for (TypeMirror st: types.directSupertypes(t))
- visit(st, types);
- return null;
- }
- };
-
- private Gen g;
- private Util.Exit exit;
- }
-}
--- a/src/jdk.compiler/share/classes/com/sun/tools/javah/JavahTool.java Wed Dec 13 14:21:12 2017 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,89 +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 com.sun.tools.javah;
-
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.io.Writer;
-import java.nio.charset.Charset;
-import java.util.Arrays;
-import java.util.EnumSet;
-import java.util.Locale;
-import java.util.Set;
-import javax.lang.model.SourceVersion;
-import javax.tools.DiagnosticListener;
-import javax.tools.JavaFileManager;
-import javax.tools.JavaFileObject;
-import javax.tools.StandardJavaFileManager;
-
-import com.sun.tools.javac.util.DefinedBy;
-import com.sun.tools.javac.util.DefinedBy.Api;
-
-/*
- * <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>
- */
-public class JavahTool implements NativeHeaderTool {
-
- public NativeHeaderTask getTask(Writer out,
- JavaFileManager fileManager,
- DiagnosticListener<? super JavaFileObject> diagnosticListener,
- Iterable<String> options,
- Iterable<String> classes) {
- return new JavahTask(out, fileManager, diagnosticListener, options, classes);
- }
-
- public StandardJavaFileManager getStandardFileManager(DiagnosticListener<? super JavaFileObject> diagnosticListener, Locale locale, Charset charset) {
- return JavahTask.getDefaultFileManager(diagnosticListener, null);
- }
-
- @DefinedBy(Api.COMPILER)
- public int run(InputStream in, OutputStream out, OutputStream err, String... arguments) {
- JavahTask t = new JavahTask(
- JavahTask.getPrintWriterForStream(out),
- null,
- null,
- Arrays.asList(arguments),
- null);
- return (t.run() ? 0 : 1);
- }
-
- @DefinedBy(Api.COMPILER)
- public Set<SourceVersion> getSourceVersions() {
- return EnumSet.allOf(SourceVersion.class);
- }
-
- @DefinedBy(Api.COMPILER)
- public int isSupportedOption(String option) {
- for (JavahTask.Option opt : JavahTask.recognizedOptions) {
- if (opt.matches(option))
- return (opt.hasArg ? 1 : 0);
- }
- return -1;
- }
-}
--- a/src/jdk.compiler/share/classes/com/sun/tools/javah/LLNI.java Wed Dec 13 14:21:12 2017 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,685 +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.OutputStream;
-import java.io.PrintWriter;
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-
-import java.util.Set;
-import javax.lang.model.element.Element;
-import javax.lang.model.element.ExecutableElement;
-import javax.lang.model.element.Modifier;
-import javax.lang.model.element.Name;
-import javax.lang.model.element.TypeElement;
-import javax.lang.model.element.VariableElement;
-import javax.lang.model.type.ArrayType;
-import javax.lang.model.type.PrimitiveType;
-import javax.lang.model.type.TypeKind;
-import javax.lang.model.type.TypeMirror;
-import javax.lang.model.type.TypeVisitor;
-import javax.lang.model.util.ElementFilter;
-import javax.lang.model.util.SimpleTypeVisitor9;
-
-import com.sun.tools.javac.util.DefinedBy;
-import com.sun.tools.javac.util.DefinedBy.Api;
-
-/*
- * <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 class LLNI extends Gen {
-
- protected final char innerDelim = '$'; /* For inner classes */
- protected Set<String> doneHandleTypes;
- List<VariableElement> fields;
- List<ExecutableElement> methods;
- private boolean doubleAlign;
- private int padFieldNum = 0;
-
- LLNI(boolean doubleAlign, Util util) {
- super(util);
- this.doubleAlign = doubleAlign;
- }
-
- protected String getIncludes() {
- return "";
- }
-
- protected void write(OutputStream o, TypeElement clazz) throws Util.Exit {
- try {
- String cname = mangleClassName(clazz.getQualifiedName().toString());
- PrintWriter pw = wrapWriter(o);
- fields = ElementFilter.fieldsIn(clazz.getEnclosedElements());
- methods = ElementFilter.methodsIn(clazz.getEnclosedElements());
- generateDeclsForClass(pw, clazz, cname);
- // FIXME check if errors occurred on the PrintWriter and throw exception if so
- } catch (TypeSignature.SignatureException e) {
- util.error("llni.sigerror", e.getMessage());
- }
- }
-
- protected void generateDeclsForClass(PrintWriter pw,
- TypeElement clazz, String cname)
- throws TypeSignature.SignatureException, Util.Exit {
- doneHandleTypes = new HashSet<>();
- /* The following handle types are predefined in "typedefs.h". Suppress
- inclusion in the output by generating them "into the blue" here. */
- genHandleType(null, "java.lang.Class");
- genHandleType(null, "java.lang.ClassLoader");
- genHandleType(null, "java.lang.Object");
- genHandleType(null, "java.lang.String");
- genHandleType(null, "java.lang.Thread");
- genHandleType(null, "java.lang.ThreadGroup");
- genHandleType(null, "java.lang.Throwable");
-
- pw.println("/* LLNI Header for class " + clazz.getQualifiedName() + " */" + lineSep);
- pw.println("#ifndef _Included_" + cname);
- pw.println("#define _Included_" + cname);
- pw.println("#include \"typedefs.h\"");
- pw.println("#include \"llni.h\"");
- pw.println("#include \"jni.h\"" + lineSep);
-
- forwardDecls(pw, clazz);
- structSectionForClass(pw, clazz, cname);
- methodSectionForClass(pw, clazz, cname);
- pw.println("#endif");
- }
-
- protected void genHandleType(PrintWriter pw, String clazzname) {
- String cname = mangleClassName(clazzname);
- if (!doneHandleTypes.contains(cname)) {
- doneHandleTypes.add(cname);
- if (pw != null) {
- pw.println("#ifndef DEFINED_" + cname);
- pw.println(" #define DEFINED_" + cname);
- pw.println(" GEN_HANDLE_TYPES(" + cname + ");");
- pw.println("#endif" + lineSep);
- }
- }
- }
-
- protected String mangleClassName(String s) {
- return s.replace('.', '_')
- .replace('/', '_')
- .replace(innerDelim, '_');
- }
-
- protected void forwardDecls(PrintWriter pw, TypeElement clazz)
- throws TypeSignature.SignatureException {
- TypeElement object = elems.getTypeElement("java.lang.Object");
- if (clazz.equals(object))
- return;
-
- genHandleType(pw, clazz.getQualifiedName().toString());
- TypeElement superClass = (TypeElement) (types.asElement(clazz.getSuperclass()));
-
- if (superClass != null) {
- String superClassName = superClass.getQualifiedName().toString();
- forwardDecls(pw, superClass);
- }
-
- for (VariableElement field: fields) {
-
- if (!field.getModifiers().contains(Modifier.STATIC)) {
- TypeMirror t = types.erasure(field.asType());
- TypeSignature newTypeSig = new TypeSignature(elems);
- String tname = newTypeSig.qualifiedTypeName(t);
- String sig = newTypeSig.getTypeSignature(tname);
-
- if (sig.charAt(0) != '[')
- forwardDeclsFromSig(pw, sig);
- }
- }
-
- for (ExecutableElement method: methods) {
-
- if (method.getModifiers().contains(Modifier.NATIVE)) {
- TypeMirror retType = types.erasure(method.getReturnType());
- String typesig = signature(method);
- TypeSignature newTypeSig = new TypeSignature(elems);
- String sig = newTypeSig.getTypeSignature(typesig, retType);
-
- if (sig.charAt(0) != '[')
- forwardDeclsFromSig(pw, sig);
-
- }
- }
- }
-
- protected void forwardDeclsFromSig(PrintWriter pw, String sig) {
- int len = sig.length();
- int i = sig.charAt(0) == '(' ? 1 : 0;
-
- /* Skip the initial "(". */
- while (i < len) {
- if (sig.charAt(i) == 'L') {
- int j = i + 1;
- while (sig.charAt(j) != ';') j++;
- genHandleType(pw, sig.substring(i + 1, j));
- i = j + 1;
- } else {
- i++;
- }
- }
- }
-
- protected void structSectionForClass(PrintWriter pw,
- TypeElement jclazz, String cname) {
-
- String jname = jclazz.getQualifiedName().toString();
-
- if (cname.equals("java_lang_Object")) {
- pw.println("/* struct java_lang_Object is defined in typedefs.h. */");
- pw.println();
- return;
- }
- pw.println("#if !defined(__i386)");
- pw.println("#pragma pack(4)");
- pw.println("#endif");
- pw.println();
- pw.println("struct " + cname + " {");
- pw.println(" ObjHeader h;");
- pw.print(fieldDefs(jclazz, cname));
-
- if (jname.equals("java.lang.Class"))
- pw.println(" Class *LLNI_mask(cClass);" +
- " /* Fake field; don't access (see oobj.h) */");
- pw.println("};" + lineSep + lineSep + "#pragma pack()");
- pw.println();
- return;
- }
-
- private static class FieldDefsRes {
- public String className; /* Name of the current class. */
- public FieldDefsRes parent;
- public String s;
- public int byteSize;
- public boolean bottomMost;
- public boolean printedOne = false;
-
- FieldDefsRes(TypeElement clazz, FieldDefsRes parent, boolean bottomMost) {
- this.className = clazz.getQualifiedName().toString();
- this.parent = parent;
- this.bottomMost = bottomMost;
- int byteSize = 0;
- if (parent == null) this.s = "";
- else this.s = parent.s;
- }
- }
-
- /* Returns "true" iff added a field. */
- private boolean doField(FieldDefsRes res, VariableElement field,
- String cname, boolean padWord) {
-
- String fieldDef = addStructMember(field, cname, padWord);
- if (fieldDef != null) {
- if (!res.printedOne) { /* add separator */
- if (res.bottomMost) {
- if (res.s.length() != 0)
- res.s = res.s + " /* local members: */" + lineSep;
- } else {
- res.s = res.s + " /* inherited members from " +
- res.className + ": */" + lineSep;
- }
- res.printedOne = true;
- }
- res.s = res.s + fieldDef;
- return true;
- }
-
- // Otherwise.
- return false;
- }
-
- private int doTwoWordFields(FieldDefsRes res, TypeElement clazz,
- int offset, String cname, boolean padWord) {
- boolean first = true;
- List<VariableElement> fields = ElementFilter.fieldsIn(clazz.getEnclosedElements());
-
- for (VariableElement field: fields) {
- TypeKind tk = field.asType().getKind();
- boolean twoWords = (tk == TypeKind.LONG || tk == TypeKind.DOUBLE);
- if (twoWords && doField(res, field, cname, first && padWord)) {
- offset += 8; first = false;
- }
- }
- return offset;
- }
-
- String fieldDefs(TypeElement clazz, String cname) {
- FieldDefsRes res = fieldDefs(clazz, cname, true);
- return res.s;
- }
-
- FieldDefsRes fieldDefs(TypeElement clazz, String cname,
- boolean bottomMost){
- FieldDefsRes res;
- int offset;
- boolean didTwoWordFields = false;
-
- TypeElement superclazz = (TypeElement) types.asElement(clazz.getSuperclass());
-
- if (superclazz != null) {
- String supername = superclazz.getQualifiedName().toString();
- res = new FieldDefsRes(clazz,
- fieldDefs(superclazz, cname, false),
- bottomMost);
- offset = res.parent.byteSize;
- } else {
- res = new FieldDefsRes(clazz, null, bottomMost);
- offset = 0;
- }
-
- List<VariableElement> fields = ElementFilter.fieldsIn(clazz.getEnclosedElements());
-
- for (VariableElement field: fields) {
-
- if (doubleAlign && !didTwoWordFields && (offset % 8) == 0) {
- offset = doTwoWordFields(res, clazz, offset, cname, false);
- didTwoWordFields = true;
- }
-
- TypeKind tk = field.asType().getKind();
- boolean twoWords = (tk == TypeKind.LONG || tk == TypeKind.DOUBLE);
-
- if (!doubleAlign || !twoWords) {
- if (doField(res, field, cname, false)) offset += 4;
- }
-
- }
-
- if (doubleAlign && !didTwoWordFields) {
- if ((offset % 8) != 0) offset += 4;
- offset = doTwoWordFields(res, clazz, offset, cname, true);
- }
-
- res.byteSize = offset;
- return res;
- }
-
- /* OVERRIDE: This method handles instance fields */
- protected String addStructMember(VariableElement member, String cname,
- boolean padWord) {
- String res = null;
-
- if (member.getModifiers().contains(Modifier.STATIC)) {
- res = addStaticStructMember(member, cname);
- // if (res == null) /* JNI didn't handle it, print comment. */
- // res = " /* Inaccessible static: " + member + " */" + lineSep;
- } else {
- TypeMirror mt = types.erasure(member.asType());
- if (padWord) res = " java_int padWord" + padFieldNum++ + ";" + lineSep;
- res = " " + llniType(mt, false, false) + " " + llniFieldName(member);
- if (isLongOrDouble(mt)) res = res + "[2]";
- res = res + ";" + lineSep;
- }
- return res;
- }
-
- static private final boolean isWindows =
- System.getProperty("os.name").startsWith("Windows");
-
- /*
- * This method only handles static final fields.
- */
- protected String addStaticStructMember(VariableElement field, String cname) {
- String res = null;
- Object exp = null;
-
- if (!field.getModifiers().contains(Modifier.STATIC))
- return res;
- if (!field.getModifiers().contains(Modifier.FINAL))
- return res;
-
- exp = field.getConstantValue();
-
- if (exp != null) {
- /* Constant. */
-
- String cn = cname + "_" + field.getSimpleName();
- String suffix = null;
- long val = 0;
- /* Can only handle int, long, float, and double fields. */
- if (exp instanceof Byte
- || exp instanceof Short
- || exp instanceof Integer) {
- suffix = "L";
- val = ((Number)exp).intValue();
- }
- else if (exp instanceof Long) {
- // Visual C++ supports the i64 suffix, not LL
- suffix = isWindows ? "i64" : "LL";
- val = ((Long)exp).longValue();
- }
- else if (exp instanceof Float) suffix = "f";
- else if (exp instanceof Double) suffix = "";
- else if (exp instanceof Character) {
- suffix = "L";
- Character ch = (Character) exp;
- val = ((int) ch) & 0xffff;
- }
- if (suffix != null) {
- // Some compilers will generate a spurious warning
- // for the integer constants for Integer.MIN_VALUE
- // and Long.MIN_VALUE so we handle them specially.
- if ((suffix.equals("L") && (val == Integer.MIN_VALUE)) ||
- (suffix.equals("LL") && (val == Long.MIN_VALUE))) {
- res = " #undef " + cn + lineSep
- + " #define " + cn
- + " (" + (val + 1) + suffix + "-1)" + lineSep;
- } else if (suffix.equals("L") || suffix.endsWith("LL")) {
- res = " #undef " + cn + lineSep
- + " #define " + cn + " " + val + suffix + lineSep;
- } else {
- res = " #undef " + cn + lineSep
- + " #define " + cn + " " + exp + suffix + lineSep;
- }
- }
- }
- return res;
- }
-
- protected void methodSectionForClass(PrintWriter pw,
- TypeElement clazz, String cname)
- throws TypeSignature.SignatureException, Util.Exit {
- String methods = methodDecls(clazz, cname);
-
- if (methods.length() != 0) {
- pw.println("/* Native method declarations: */" + lineSep);
- pw.println("#ifdef __cplusplus");
- pw.println("extern \"C\" {");
- pw.println("#endif" + lineSep);
- pw.println(methods);
- pw.println("#ifdef __cplusplus");
- pw.println("}");
- pw.println("#endif");
- }
- }
-
- protected String methodDecls(TypeElement clazz, String cname)
- throws TypeSignature.SignatureException, Util.Exit {
-
- String res = "";
- for (ExecutableElement method: methods) {
- if (method.getModifiers().contains(Modifier.NATIVE))
- res = res + methodDecl(method, clazz, cname);
- }
- return res;
- }
-
- protected String methodDecl(ExecutableElement method,
- TypeElement clazz, String cname)
- throws TypeSignature.SignatureException, Util.Exit {
- String res = null;
-
- TypeMirror retType = types.erasure(method.getReturnType());
- String typesig = signature(method);
- TypeSignature newTypeSig = new TypeSignature(elems);
- String sig = newTypeSig.getTypeSignature(typesig, retType);
- boolean longName = needLongName(method, clazz);
-
- if (sig.charAt(0) != '(')
- util.error("invalid.method.signature", sig);
-
-
- res = "JNIEXPORT " + jniType(retType) + " JNICALL" + lineSep + jniMethodName(method, cname, longName)
- + "(JNIEnv *, " + cRcvrDecl(method, cname);
- List<? extends VariableElement> params = method.getParameters();
- List<TypeMirror> argTypes = new ArrayList<>();
- for (VariableElement p: params){
- argTypes.add(types.erasure(p.asType()));
- }
-
- /* It would have been nice to include the argument names in the
- declaration, but there seems to be a bug in the "BinaryField"
- class, causing the getArguments() method to return "null" for
- most (non-constructor) methods. */
- for (TypeMirror argType: argTypes)
- res = res + ", " + jniType(argType);
- res = res + ");" + lineSep;
- return res;
- }
-
- protected final boolean needLongName(ExecutableElement method,
- TypeElement clazz) {
- Name methodName = method.getSimpleName();
- for (ExecutableElement memberMethod: methods) {
- if ((memberMethod != method) &&
- memberMethod.getModifiers().contains(Modifier.NATIVE) &&
- (methodName.equals(memberMethod.getSimpleName())))
- return true;
- }
- return false;
- }
-
- protected final String jniMethodName(ExecutableElement method, String cname,
- boolean longName)
- throws TypeSignature.SignatureException {
- String res = "Java_" + cname + "_" + method.getSimpleName();
-
- if (longName) {
- TypeMirror mType = types.erasure(method.getReturnType());
- List<? extends VariableElement> params = method.getParameters();
- List<TypeMirror> argTypes = new ArrayList<>();
- for (VariableElement param: params) {
- argTypes.add(types.erasure(param.asType()));
- }
-
- res = res + "__";
- for (TypeMirror t: argTypes) {
- String tname = t.toString();
- TypeSignature newTypeSig = new TypeSignature(elems);
- String sig = newTypeSig.getTypeSignature(tname);
- res = res + nameToIdentifier(sig);
- }
- }
- return res;
- }
-
- // copied from JNI.java
- protected final String jniType(TypeMirror t) throws Util.Exit {
- TypeElement throwable = elems.getTypeElement("java.lang.Throwable");
- TypeElement jClass = elems.getTypeElement("java.lang.Class");
- TypeElement jString = elems.getTypeElement("java.lang.String");
- Element tclassDoc = types.asElement(t);
-
- switch (t.getKind()) {
- case ARRAY: {
- TypeMirror ct = ((ArrayType) t).getComponentType();
- switch (ct.getKind()) {
- case BOOLEAN: return "jbooleanArray";
- case BYTE: return "jbyteArray";
- case CHAR: return "jcharArray";
- case SHORT: return "jshortArray";
- case INT: return "jintArray";
- case LONG: return "jlongArray";
- case FLOAT: return "jfloatArray";
- case DOUBLE: return "jdoubleArray";
- case ARRAY:
- case DECLARED: return "jobjectArray";
- default: throw new Error(ct.toString());
- }
- }
-
- case VOID: return "void";
- case BOOLEAN: return "jboolean";
- case BYTE: return "jbyte";
- case CHAR: return "jchar";
- case SHORT: return "jshort";
- case INT: return "jint";
- case LONG: return "jlong";
- case FLOAT: return "jfloat";
- case DOUBLE: return "jdouble";
-
- case DECLARED: {
- if (tclassDoc.equals(jString))
- return "jstring";
- else if (types.isAssignable(t, throwable.asType()))
- return "jthrowable";
- else if (types.isAssignable(t, jClass.asType()))
- return "jclass";
- else
- return "jobject";
- }
- }
-
- util.bug("jni.unknown.type");
- return null; /* dead code. */
- }
-
- protected String llniType(TypeMirror t, boolean handleize, boolean longDoubleOK) {
- String res = null;
-
- switch (t.getKind()) {
- case ARRAY: {
- TypeMirror ct = ((ArrayType) t).getComponentType();
- switch (ct.getKind()) {
- case BOOLEAN: res = "IArrayOfBoolean"; break;
- case BYTE: res = "IArrayOfByte"; break;
- case CHAR: res = "IArrayOfChar"; break;
- case SHORT: res = "IArrayOfShort"; break;
- case INT: res = "IArrayOfInt"; break;
- case LONG: res = "IArrayOfLong"; break;
- case FLOAT: res = "IArrayOfFloat"; break;
- case DOUBLE: res = "IArrayOfDouble"; break;
- case ARRAY:
- case DECLARED: res = "IArrayOfRef"; break;
- default: throw new Error(ct.getKind() + " " + ct);
- }
- if (!handleize) res = "DEREFERENCED_" + res;
- break;
- }
-
- case VOID:
- res = "void";
- break;
-
- case BOOLEAN:
- case BYTE:
- case CHAR:
- case SHORT:
- case INT:
- res = "java_int" ;
- break;
-
- case LONG:
- res = longDoubleOK ? "java_long" : "val32 /* java_long */";
- break;
-
- case FLOAT:
- res = "java_float";
- break;
-
- case DOUBLE:
- res = longDoubleOK ? "java_double" : "val32 /* java_double */";
- break;
-
- case DECLARED:
- TypeElement e = (TypeElement) types.asElement(t);
- res = "I" + mangleClassName(e.getQualifiedName().toString());
- if (!handleize) res = "DEREFERENCED_" + res;
- break;
-
- default:
- throw new Error(t.getKind() + " " + t); // FIXME
- }
-
- return res;
- }
-
- protected final String cRcvrDecl(Element field, String cname) {
- return (field.getModifiers().contains(Modifier.STATIC) ? "jclass" : "jobject");
- }
-
- protected String maskName(String s) {
- return "LLNI_mask(" + s + ")";
- }
-
- protected String llniFieldName(VariableElement field) {
- return maskName(field.getSimpleName().toString());
- }
-
- protected final boolean isLongOrDouble(TypeMirror t) {
- TypeVisitor<Boolean,Void> v = new SimpleTypeVisitor9<Boolean,Void>() {
- @DefinedBy(Api.LANGUAGE_MODEL)
- public Boolean defaultAction(TypeMirror t, Void p){
- return false;
- }
- @DefinedBy(Api.LANGUAGE_MODEL)
- public Boolean visitArray(ArrayType t, Void p) {
- return visit(t.getComponentType(), p);
- }
- @DefinedBy(Api.LANGUAGE_MODEL)
- public Boolean visitPrimitive(PrimitiveType t, Void p) {
- TypeKind tk = t.getKind();
- return (tk == TypeKind.LONG || tk == TypeKind.DOUBLE);
- }
- };
- return v.visit(t, null);
- }
-
- /* Do unicode to ansi C identifier conversion.
- %%% This may not be right, but should be called more often. */
- protected final String nameToIdentifier(String name) {
- int len = name.length();
- StringBuilder buf = new StringBuilder(len);
- for (int i = 0; i < len; i++) {
- char c = name.charAt(i);
- if (isASCIILetterOrDigit(c))
- buf.append(c);
- else if (c == '/')
- buf.append('_');
- else if (c == '.')
- buf.append('_');
- else if (c == '_')
- buf.append("_1");
- else if (c == ';')
- buf.append("_2");
- else if (c == '[')
- buf.append("_3");
- else
- buf.append("_0" + ((int)c));
- }
- return new String(buf);
- }
-
- protected final boolean isASCIILetterOrDigit(char c) {
- if (((c >= 'A') && (c <= 'Z')) ||
- ((c >= 'a') && (c <= 'z')) ||
- ((c >= '0') && (c <= '9')))
- return true;
- else
- return false;
- }
-}
-
--- a/src/jdk.compiler/share/classes/com/sun/tools/javah/Main.java Wed Dec 13 14:21:12 2017 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,61 +0,0 @@
-/*
- * Copyright (c) 2007, 2008, 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.PrintWriter;
-
-/**
- * Main entry point.
- *
- * <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>
- */
-public class Main {
- /**
- * Main entry point for the launcher.
- * Note: This method calls System.exit.
- * @param args command line arguments
- */
- public static void main(String[] args) {
- JavahTask t = new JavahTask();
- int rc = t.run(args);
- System.exit(rc);
- }
-
- /**
- * Entry point that does <i>not</i> call System.exit.
- * @param args command line arguments
- * @param out output stream
- * @return an exit code. 0 means success, non-zero means an error occurred.
- */
- public static int run(String[] args, PrintWriter out) {
- JavahTask t = new JavahTask();
- t.setLog(out);
- return t.run(args);
- }
-}
--- a/src/jdk.compiler/share/classes/com/sun/tools/javah/Mangle.java Wed Dec 13 14:21:12 2017 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,189 +0,0 @@
-/*
- * Copyright (c) 2002, 2012, 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 javax.lang.model.element.ExecutableElement;
-import javax.lang.model.element.TypeElement;
-import javax.lang.model.element.VariableElement;
-import javax.lang.model.util.Elements;
-import javax.lang.model.util.Types;
-
-/**
- * A utility for mangling java identifiers into C names. Should make
- * this more fine grained and distribute the functionality to the
- * generators.
- *
- * <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 class Mangle {
-
- public static class Type {
- public static final int CLASS = 1;
- public static final int FIELDSTUB = 2;
- public static final int FIELD = 3;
- public static final int JNI = 4;
- public static final int SIGNATURE = 5;
- public static final int METHOD_JDK_1 = 6;
- public static final int METHOD_JNI_SHORT = 7;
- public static final int METHOD_JNI_LONG = 8;
- }
-
- private Elements elems;
- private Types types;
-
- Mangle(Elements elems, Types types) {
- this.elems = elems;
- this.types = types;
- }
-
- public final String mangle(CharSequence name, int mtype) {
- StringBuilder result = new StringBuilder(100);
- int length = name.length();
-
- for (int i = 0; i < length; i++) {
- char ch = name.charAt(i);
- if (isalnum(ch)) {
- result.append(ch);
- } else if ((ch == '.') &&
- mtype == Mangle.Type.CLASS) {
- result.append('_');
- } else if (( ch == '$') &&
- mtype == Mangle.Type.CLASS) {
- result.append('_');
- result.append('_');
- } else if (ch == '_' && mtype == Mangle.Type.FIELDSTUB) {
- result.append('_');
- } else if (ch == '_' && mtype == Mangle.Type.CLASS) {
- result.append('_');
- } else if (mtype == Mangle.Type.JNI) {
- String esc = null;
- if (ch == '_')
- esc = "_1";
- else if (ch == '.')
- esc = "_";
- else if (ch == ';')
- esc = "_2";
- else if (ch == '[')
- esc = "_3";
- if (esc != null) {
- result.append(esc);
- } else {
- result.append(mangleChar(ch));
- }
- } else if (mtype == Mangle.Type.SIGNATURE) {
- if (isprint(ch)) {
- result.append(ch);
- } else {
- result.append(mangleChar(ch));
- }
- } else {
- result.append(mangleChar(ch));
- }
- }
-
- return result.toString();
- }
-
- public String mangleMethod(ExecutableElement method, TypeElement clazz,
- int mtype) throws TypeSignature.SignatureException {
- StringBuilder result = new StringBuilder(100);
- result.append("Java_");
-
- if (mtype == Mangle.Type.METHOD_JDK_1) {
- result.append(mangle(clazz.getQualifiedName(), Mangle.Type.CLASS));
- result.append('_');
- result.append(mangle(method.getSimpleName(),
- Mangle.Type.FIELD));
- result.append("_stub");
- return result.toString();
- }
-
- /* JNI */
- result.append(mangle(getInnerQualifiedName(clazz), Mangle.Type.JNI));
- result.append('_');
- result.append(mangle(method.getSimpleName(),
- Mangle.Type.JNI));
- if (mtype == Mangle.Type.METHOD_JNI_LONG) {
- result.append("__");
- String typesig = signature(method);
- TypeSignature newTypeSig = new TypeSignature(elems);
- String sig = newTypeSig.getTypeSignature(typesig, method.getReturnType());
- sig = sig.substring(1);
- sig = sig.substring(0, sig.lastIndexOf(')'));
- sig = sig.replace('/', '.');
- result.append(mangle(sig, Mangle.Type.JNI));
- }
-
- return result.toString();
- }
- //where
- private String getInnerQualifiedName(TypeElement clazz) {
- return elems.getBinaryName(clazz).toString();
- }
-
- public final String mangleChar(char ch) {
- String s = Integer.toHexString(ch);
- int nzeros = 5 - s.length();
- char[] result = new char[6];
- result[0] = '_';
- for (int i = 1; i <= nzeros; i++)
- result[i] = '0';
- for (int i = nzeros+1, j = 0; i < 6; i++, j++)
- result[i] = s.charAt(j);
- return new String(result);
- }
-
- // Warning: duplicated in Gen
- private 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();
- }
-
- /* Warning: Intentional ASCII operation. */
- private static boolean isalnum(char ch) {
- return ch <= 0x7f && /* quick test */
- ((ch >= 'A' && ch <= 'Z') ||
- (ch >= 'a' && ch <= 'z') ||
- (ch >= '0' && ch <= '9'));
- }
-
- /* Warning: Intentional ASCII operation. */
- private static boolean isprint(char ch) {
- return ch >= 32 && ch <= 126;
- }
-}
--- a/src/jdk.compiler/share/classes/com/sun/tools/javah/NativeHeaderTool.java Wed Dec 13 14:21:12 2017 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,149 +0,0 @@
-/*
- * Copyright (c) 2005, 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; //javax.tools;
-
-import java.io.Writer;
-import java.nio.charset.Charset;
-import java.util.Locale;
-import java.util.concurrent.Callable;
-import javax.tools.Diagnostic;
-import javax.tools.DiagnosticListener;
-import javax.tools.JavaFileManager;
-import javax.tools.JavaFileObject;
-import javax.tools.OptionChecker;
-import javax.tools.StandardJavaFileManager;
-import javax.tools.StandardLocation;
-import javax.tools.Tool;
-
-/**
- * This class is intended to be put in javax.tools.
- *
- * @see DiagnosticListener
- * @see Diagnostic
- * @see JavaFileManager
- * @since 1.7
- *
- * <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>
- */
-public interface NativeHeaderTool extends Tool, OptionChecker {
-
- /**
- * Creates a future for a native header task with the given
- * components and arguments. The task might not have
- * completed as described in the NativeHeaderTask interface.
- *
- * <p>If a file manager is provided, it must be able to handle all
- * locations defined in {@link StandardLocation}.
- *
- * @param out a Writer for additional output from the task;
- * use {@code System.err} if {@code null}
- * @param fileManager a file manager; if {@code null} use the
- * task's standard filemanager
- * @param diagnosticListener a diagnostic listener; if {@code
- * null} use the compiler's default method for reporting
- * diagnostics
- * @param options task options, {@code null} means no options
- * @param classes class names for which native headers should be generated
- * @return an object representing the task to be done
- * @throws RuntimeException if an unrecoverable error
- * occurred in a user supplied component. The
- * {@linkplain Throwable#getCause() cause} will be the error in
- * user code.
- * @throws IllegalArgumentException if any of the given
- * compilation units are of other kind than
- * {@linkplain JavaFileObject.Kind#SOURCE source}
- */
- NativeHeaderTask getTask(Writer out,
- JavaFileManager fileManager,
- DiagnosticListener<? super JavaFileObject> diagnosticListener,
- Iterable<String> options,
- Iterable<String> classes);
-
- /**
- * Returns a new instance of the standard file manager implementation
- * for this tool. The file manager will use the given diagnostic
- * listener for producing any non-fatal diagnostics. Fatal errors
- * will be signalled with the appropriate exceptions.
- *
- * <p>The standard file manager will be automatically reopened if
- * it is accessed after calls to {@code flush} or {@code close}.
- * The standard file manager must be usable with other tools.
- *
- * @param diagnosticListener a diagnostic listener for non-fatal
- * diagnostics; if {@code null} use the tool's default method
- * for reporting diagnostics
- * @param locale the locale to apply when formatting diagnostics;
- * {@code null} means the {@linkplain Locale#getDefault() default locale}.
- * @param charset the character set used for decoding bytes; if
- * {@code null} use the platform default
- * @return the standard file manager
- */
- StandardJavaFileManager getStandardFileManager(
- DiagnosticListener<? super JavaFileObject> diagnosticListener,
- Locale locale,
- Charset charset);
-
- /**
- * Interface representing a future for a native header task. The
- * task has not yet started. To start the task, call
- * the {@linkplain #call call} method.
- *
- * <p>Before calling the call method, additional aspects of the
- * task can be configured, for example, by calling the
- * {@linkplain #setLocale setLocale} method.
- */
- interface NativeHeaderTask extends Callable<Boolean> {
-
- /**
- * Set the locale to be applied when formatting diagnostics and
- * other localized data.
- *
- * @param locale the locale to apply; {@code null} means apply no
- * locale
- * @throws IllegalStateException if the task has started
- */
- void setLocale(Locale locale);
-
- /**
- * Performs this native header task. The task may only
- * be performed once. Subsequent calls to this method throw
- * IllegalStateException.
- *
- * @return true if and only all the files were processed without errors;
- * false otherwise
- *
- * @throws RuntimeException if an unrecoverable error occurred
- * in a user-supplied component. The
- * {@linkplain Throwable#getCause() cause} will be the error
- * in user code.
- * @throws IllegalStateException if called more than once
- */
- Boolean call();
- }
-}
--- a/src/jdk.compiler/share/classes/com/sun/tools/javah/TypeSignature.java Wed Dec 13 14:21:12 2017 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,283 +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.util.*;
-import javax.lang.model.element.Name;
-import javax.lang.model.element.TypeElement;
-import javax.lang.model.type.ArrayType;
-import javax.lang.model.type.DeclaredType;
-import javax.lang.model.type.NoType;
-import javax.lang.model.type.PrimitiveType;
-import javax.lang.model.type.TypeKind;
-import javax.lang.model.type.TypeMirror;
-import javax.lang.model.type.TypeVariable;
-import javax.lang.model.type.TypeVisitor;
-import javax.lang.model.util.Elements;
-import javax.lang.model.util.SimpleTypeVisitor9;
-
-import com.sun.tools.javac.util.DefinedBy;
-import com.sun.tools.javac.util.DefinedBy.Api;
-
-/**
- * Returns internal type signature.
- *
- * <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
- */
-
-public class TypeSignature {
- static class SignatureException extends Exception {
- private static final long serialVersionUID = 1L;
- SignatureException(String reason) {
- super(reason);
- }
- }
-
- Elements elems;
-
- /* Signature Characters */
-
- private static final String SIG_VOID = "V";
- private static final String SIG_BOOLEAN = "Z";
- private static final String SIG_BYTE = "B";
- private static final String SIG_CHAR = "C";
- private static final String SIG_SHORT = "S";
- private static final String SIG_INT = "I";
- private static final String SIG_LONG = "J";
- private static final String SIG_FLOAT = "F";
- private static final String SIG_DOUBLE = "D";
- private static final String SIG_ARRAY = "[";
- private static final String SIG_CLASS = "L";
-
-
-
- public TypeSignature(Elements elems){
- this.elems = elems;
- }
-
- /*
- * Returns the type signature of a field according to JVM specs
- */
- public String getTypeSignature(String javasignature) throws SignatureException {
- return getParamJVMSignature(javasignature);
- }
-
- /*
- * Returns the type signature of a method according to JVM specs
- */
- public String getTypeSignature(String javasignature, TypeMirror returnType)
- throws SignatureException {
- String signature = null; //Java type signature.
- String typeSignature = null; //Internal type signature.
- List<String> params = new ArrayList<>(); //List of parameters.
- String paramsig = null; //Java parameter signature.
- String paramJVMSig = null; //Internal parameter signature.
- String returnSig = null; //Java return type signature.
- String returnJVMType = null; //Internal return type signature.
- int dimensions = 0; //Array dimension.
-
- int startIndex = -1;
- int endIndex = -1;
- StringTokenizer st = null;
- int i = 0;
-
- // Gets the actual java signature without parentheses.
- if (javasignature != null) {
- startIndex = javasignature.indexOf("(");
- endIndex = javasignature.indexOf(")");
- }
-
- if (((startIndex != -1) && (endIndex != -1))
- &&(startIndex+1 < javasignature.length())
- &&(endIndex < javasignature.length())) {
- signature = javasignature.substring(startIndex+1, endIndex);
- }
-
- // Separates parameters.
- if (signature != null) {
- if (signature.contains(",")) {
- st = new StringTokenizer(signature, ",");
- if (st != null) {
- while (st.hasMoreTokens()) {
- params.add(st.nextToken());
- }
- }
- } else {
- params.add(signature);
- }
- }
-
- /* JVM type signature. */
- typeSignature = "(";
-
- // Gets indivisual internal parameter signature.
- while (params.isEmpty() != true) {
- paramsig = params.remove(i).trim();
- paramJVMSig = getParamJVMSignature(paramsig);
- if (paramJVMSig != null) {
- typeSignature += paramJVMSig;
- }
- }
-
- typeSignature += ")";
-
- // Get internal return type signature.
-
- returnJVMType = "";
- if (returnType != null) {
- dimensions = dimensions(returnType);
- }
-
- //Gets array dimension of return type.
- while (dimensions-- > 0) {
- returnJVMType += "[";
- }
- if (returnType != null) {
- returnSig = qualifiedTypeName(returnType);
- returnJVMType += getComponentType(returnSig);
- } else {
- System.out.println("Invalid return type.");
- }
-
- typeSignature += returnJVMType;
-
- return typeSignature;
- }
-
- /*
- * Returns internal signature of a parameter.
- */
- private String getParamJVMSignature(String paramsig) throws SignatureException {
- String paramJVMSig = "";
- String componentType ="";
-
- if(paramsig != null){
-
- if(paramsig.contains("[]")) {
- // Gets array dimension.
- int endindex = paramsig.indexOf("[]");
- componentType = paramsig.substring(0, endindex);
- String dimensionString = paramsig.substring(endindex);
- if(dimensionString != null){
- while(dimensionString.contains("[]")){
- paramJVMSig += "[";
- int beginindex = dimensionString.indexOf("]") + 1;
- if(beginindex < dimensionString.length()){
- dimensionString = dimensionString.substring(beginindex);
- }else
- dimensionString = "";
- }
- }
- } else componentType = paramsig;
-
- paramJVMSig += getComponentType(componentType);
- }
- return paramJVMSig;
- }
-
- /*
- * Returns internal signature of a component.
- */
- private String getComponentType(String componentType) throws SignatureException {
-
- String JVMSig = "";
-
- if(componentType != null){
- switch (componentType) {
- case "void": JVMSig += SIG_VOID; break;
- case "boolean": JVMSig += SIG_BOOLEAN; break;
- case "byte": JVMSig += SIG_BYTE; break;
- case "char": JVMSig += SIG_CHAR; break;
- case "short": JVMSig += SIG_SHORT; break;
- case "int": JVMSig += SIG_INT; break;
- case "long": JVMSig += SIG_LONG; break;
- case "float": JVMSig += SIG_FLOAT; break;
- case "double": JVMSig += SIG_DOUBLE; break;
- default:
- if (!componentType.equals("")) {
- TypeElement classNameDoc = elems.getTypeElement(componentType);
-
- if (classNameDoc == null) {
- throw new SignatureException(componentType);
- }
- else {
- String classname = classNameDoc.getQualifiedName().toString();
- String newclassname = classname.replace('.', '/');
- JVMSig += "L";
- JVMSig += newclassname;
- JVMSig += ";";
- }
- }
- break;
- }
- }
- return JVMSig;
- }
-
- int dimensions(TypeMirror t) {
- if (t.getKind() != TypeKind.ARRAY)
- return 0;
- return 1 + dimensions(((ArrayType) t).getComponentType());
- }
-
-
- String qualifiedTypeName(TypeMirror type) {
- TypeVisitor<Name, Void> v = new SimpleTypeVisitor9<Name, Void>() {
- @Override @DefinedBy(Api.LANGUAGE_MODEL)
- public Name visitArray(ArrayType t, Void p) {
- return t.getComponentType().accept(this, p);
- }
-
- @Override @DefinedBy(Api.LANGUAGE_MODEL)
- public Name visitDeclared(DeclaredType t, Void p) {
- return ((TypeElement) t.asElement()).getQualifiedName();
- }
-
- @Override @DefinedBy(Api.LANGUAGE_MODEL)
- public Name visitPrimitive(PrimitiveType t, Void p) {
- return elems.getName(t.toString());
- }
-
- @Override @DefinedBy(Api.LANGUAGE_MODEL)
- public Name visitNoType(NoType t, Void p) {
- if (t.getKind() == TypeKind.VOID)
- return elems.getName("void");
- return defaultAction(t, p);
- }
-
- @Override @DefinedBy(Api.LANGUAGE_MODEL)
- public Name visitTypeVariable(TypeVariable t, Void p) {
- return t.getUpperBound().accept(this, p);
- }
- };
- return v.visit(type).toString();
- }
-}
--- a/src/jdk.compiler/share/classes/com/sun/tools/javah/Util.java Wed Dec 13 14:21:12 2017 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,184 +0,0 @@
-/*
- * Copyright (c) 2002, 2016, 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.PrintWriter;
-import java.text.MessageFormat;
-import java.util.Locale;
-import java.util.ResourceBundle;
-import java.util.MissingResourceException;
-import javax.tools.Diagnostic;
-import javax.tools.Diagnostic.Kind;
-import javax.tools.DiagnosticListener;
-import javax.tools.JavaFileObject;
-
-import com.sun.tools.javac.util.DefinedBy;
-import com.sun.tools.javac.util.DefinedBy.Api;
-
-/**
- * Messages, verbose and error handling support.
- *
- * For errors, the failure modes are:
- * error -- User did something wrong
- * bug -- Bug has occurred in javah
- * fatal -- We can't even find resources, so bail fast, don't localize
- *
- * <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>
- */
-public class Util {
- /** Exit is used to replace the use of System.exit in the original javah.
- */
- public static class Exit extends Error {
- private static final long serialVersionUID = 430820978114067221L;
- Exit(int exitValue) {
- this(exitValue, null);
- }
-
- Exit(int exitValue, Throwable cause) {
- super(cause);
- this.exitValue = exitValue;
- this.cause = cause;
- }
-
- Exit(Exit e) {
- this(e.exitValue, e.cause);
- }
-
- public final int exitValue;
- public final Throwable cause;
- }
-
- /*
- * Help for verbosity.
- */
- public boolean verbose = false;
-
- public PrintWriter log;
- public DiagnosticListener<? super JavaFileObject> dl;
-
- Util(PrintWriter log, DiagnosticListener<? super JavaFileObject> dl) {
- this.log = log;
- this.dl = dl;
- }
-
- public void log(String s) {
- log.println(s);
- }
-
- /*
- * Help for loading localized messages.
- */
- private ResourceBundle m;
-
- private void initMessages() throws Exit {
- try {
- m = ResourceBundle.getBundle("com.sun.tools.javah.resources.l10n");
- } catch (MissingResourceException mre) {
- fatal("Error loading resources. Please file a bug report.", mre);
- }
- }
-
- private String getText(String key, Object... args) throws Exit {
- if (m == null)
- initMessages();
- try {
- return MessageFormat.format(m.getString(key), args);
- } catch (MissingResourceException e) {
- fatal("Key " + key + " not found in resources.", e);
- }
- return null; /* dead code */
- }
-
- /*
- * Failure modes.
- */
- public void bug(String key) throws Exit {
- bug(key, null);
- }
-
- public void bug(String key, Exception e) throws Exit {
- dl.report(createDiagnostic(Diagnostic.Kind.ERROR, key));
- dl.report(createDiagnostic(Diagnostic.Kind.NOTE, "bug.report"));
- throw new Exit(11, e);
- }
-
- public void error(String key, Object... args) throws Exit {
- dl.report(createDiagnostic(Diagnostic.Kind.ERROR, key, args));
- throw new Exit(15);
- }
-
- private void fatal(String msg, Exception e) throws Exit {
- dl.report(createDiagnostic(Diagnostic.Kind.ERROR, "", msg));
- throw new Exit(10, e);
- }
-
- private Diagnostic<JavaFileObject> createDiagnostic(
- final Diagnostic.Kind kind, final String code, final Object... args) {
- return new Diagnostic<JavaFileObject>() {
- @DefinedBy(Api.COMPILER)
- public String getCode() {
- return code;
- }
- @DefinedBy(Api.COMPILER)
- public long getColumnNumber() {
- return Diagnostic.NOPOS;
- }
- @DefinedBy(Api.COMPILER)
- public long getEndPosition() {
- return Diagnostic.NOPOS;
- }
- @DefinedBy(Api.COMPILER)
- public Kind getKind() {
- return kind;
- }
- @DefinedBy(Api.COMPILER)
- public long getLineNumber() {
- return Diagnostic.NOPOS;
- }
- @DefinedBy(Api.COMPILER)
- public String getMessage(Locale locale) {
- if (code.length() == 0)
- return (String) args[0];
- return getText(code, args); // FIXME locale
- }
- @DefinedBy(Api.COMPILER)
- public long getPosition() {
- return Diagnostic.NOPOS;
- }
- @DefinedBy(Api.COMPILER)
- public JavaFileObject getSource() {
- return null;
- }
- @DefinedBy(Api.COMPILER)
- public long getStartPosition() {
- return Diagnostic.NOPOS;
- }
- };
- }
-}
--- a/src/jdk.compiler/share/classes/com/sun/tools/javah/resources/l10n.properties Wed Dec 13 14:21:12 2017 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,178 +0,0 @@
-#
-# Copyright (c) 1998, 2016, 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.
-#
-
-#
-# User errors, command line errors.
-#
-cant.create.dir=\
- The directory {0} could not be create for output.
-at.args.cant.read=\
- Can''t read command line arguments from file {1}.
-at.args.file.not.found=\
- Can''t find file {0}.
-at.args.io.exception=\
- The following I/O problem was encountered when processing an @ \
- argument on the command line: {0}.
-bad.arg=\
- Bad argument: {0}
-old.jni.mixed=\
- Can''t mix options -jni and -old. Try -help.
-old.llni.mixed=\
- Can''t mix options -old and -llni. Try -help.
-old.not.supported=\
- Option -old not supported by this version of javah.
-invalid.method.signature=\
- Invalid method signature: {0}
-jni.llni.mixed=\
- Can''t mix options -jni and -llni. Try -help.
-jni.no.stubs=\
- JNI does not require stubs, please refer to the JNI documentation.
-jni.sigerror=\
- Cannot determine signature for {0}
-dir.file.mixed=\
- Can''t mix options -d and -o. Try -help.
-no.classes.specified=\
- No classes were specified on the command line. Try -help.
-no.outputfile.specified=\
- No outputfile was specified on the command line. Try -help.
-no.outputdir.specified=\
- No output directory was specified on the command line. Try -help.
-no.classpath.specified=\
- No classpath was specified on the command line. Try -help.
-no.bootclasspath.specified=\
- No bootclasspath was specified on the command line. Try -help.
-unknown.option=\
- {0} is an illegal argument\n
-tracing.not.supported=\
- Warning: Tracing is no longer supported. Instead, use\
- -verbose:jni option of the virtual machine.
-
-main.usage=\
-Usage: \n\
-\ javah [options] <classes>\n\
-where [options] include:
-
-main.opt.o=\
-\ -o <file> Output file (only one of -d or -o may be used)
-
-main.opt.d=\
-\ -d <dir> Output directory
-
-main.opt.v=\
-\ -v -verbose Enable verbose output
-
-main.opt.h=\
-\ -h --help -? Print this message
-
-main.opt.version=\
-\ -version Print version information
-
-main.opt.jni=\
-\ -jni Generate JNI-style header file (default)
-
-main.opt.force=\
-\ -force Always write output files
-
-main.opt.module_path=\
-\ --module-path <path> Path from which to load application modules
-
-main.opt.upgrade_module_path=\
-\ --upgrade_module-path <path> Path from which to load application modules
-
-main.opt.classpath=\
-\ -classpath <path> Path from which to load classes
-
-main.opt.class_path=\
-\ --class-path <path> Path from which to load classes
-
-main.opt.cp=\
-\ -cp <path> Path from which to load classes
-
-main.opt.bootclasspath=\
-\ -bootclasspath <path> Path from which to load bootstrap classes
-
-main.opt.system=\
-\ --system <jdk> Specify where to find system modules
-
-main.usage.foot=\n\
-GNU-style options may use '=' instead whitespace to separate the name of an option\n\
-from its value.\n\
-\n\
-Each class must be specified by its fully qualified names, optionally\n\
-prefixed by a module name followed by '/'. Examples:\n\
-\ java.lang.Object\n\
-\ java.base/java.io.File\n\
-
-#
-# Version string.
-#
-javah.version={0} version "{1}"
-javah.fullVersion={0} full version "{1}"
-
-#
-# These should have better diagnostics.
-#
-super.class.not.found=\
- A required super class {0} could not be found.
-class.not.found=\
- Class {0} could not be found.
-io.exception=\
- Can''t recover from an I/O error with the following message: \
- {0}.
-
-#
-# Problems in the guts of javah.
-#
-encoding.iso8859_1.not.found=\
- ISO8859_1 converter was not found for output. This is \
- probably due to an error in the installation installation.
-tried.to.define.non.static=\
- Tried to generate #define for non-static field.
-jni.unknown.type=\
- An unknown type encountered (JNI).
-unknown.array.type=\
- An unknown array type encountered when generating old style headers.
-unknown.type.for.field=\
- An unknown type encountered when generating old style headers.
-unknown.type.in.method.signature=\
- An unknown type eccountered when generating old style stubs.
-
-
-err.prefix=Error:
-err.cant.use.option.for.fm=Can't use {0} option with given file manager
-err.internal.error=Internal error: {0}
-err.ioerror=IO error: {0}
-err.missing.arg=value missing for {0}
-err.no.classes.specified=no classes specified
-err.unknown.option=unknown option: {0}
-
-#
-# miscellaneous strings
-#
-javah.misc.Deprecation=\
- \nWarning:\u0020The javah tool is planned to be removed in the next major\n\
- JDK release. The tool has been superseded by the ''-h'' option added\n\
- to javac in JDK 8. Users are recommended to migrate to using the\n\
- javac ''-h'' option; see the javac man page for more information.\n
--- a/src/jdk.compiler/share/classes/com/sun/tools/javah/resources/l10n_ja.properties Wed Dec 13 14:21:12 2017 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,116 +0,0 @@
-#
-# Copyright (c) 1998, 2016, 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.
-#
-
-#
-# User errors, command line errors.
-#
-cant.create.dir=\u51FA\u529B\u7528\u306E\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA{0}\u3092\u4F5C\u6210\u3067\u304D\u307E\u305B\u3093\u3002
-at.args.cant.read=\u30D5\u30A1\u30A4\u30EB{1}\u304B\u3089\u30B3\u30DE\u30F3\u30C9\u30E9\u30A4\u30F3\u5F15\u6570\u3092\u8AAD\u307F\u8FBC\u3081\u307E\u305B\u3093\u3002
-at.args.file.not.found=\u30D5\u30A1\u30A4\u30EB{0}\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093\u3002
-at.args.io.exception=\u30B3\u30DE\u30F3\u30C9\u30E9\u30A4\u30F3\u306E@\u5F15\u6570\u306E\u51E6\u7406\u4E2D\u306B\u3001\u6B21\u306E\u5165\u51FA\u529B\u306E\u554F\u984C\u304C\u767A\u751F\u3057\u307E\u3057\u305F: {0}\u3002
-bad.arg=\u7121\u52B9\u306A\u5F15\u6570: {0}
-old.jni.mixed=\u30AA\u30D7\u30B7\u30E7\u30F3-jni\u3068-old\u3092\u540C\u6642\u306B\u4F7F\u7528\u3059\u308B\u3053\u3068\u306F\u3067\u304D\u307E\u305B\u3093\u3002-help\u3067\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002
-old.llni.mixed=\u30AA\u30D7\u30B7\u30E7\u30F3-old\u3068-llni\u3092\u540C\u6642\u306B\u4F7F\u7528\u3059\u308B\u3053\u3068\u306F\u3067\u304D\u307E\u305B\u3093\u3002-help\u3067\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002
-old.not.supported=\u3053\u306E\u30D0\u30FC\u30B8\u30E7\u30F3\u306Ejavah\u3067\u306F\u30AA\u30D7\u30B7\u30E7\u30F3-old\u306F\u30B5\u30DD\u30FC\u30C8\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002
-invalid.method.signature=\u7121\u52B9\u306A\u30E1\u30BD\u30C3\u30C9\u30FB\u30B7\u30B0\u30CB\u30C1\u30E3: {0}
-jni.llni.mixed=\u30AA\u30D7\u30B7\u30E7\u30F3-jni\u3068-llni\u3092\u540C\u6642\u306B\u4F7F\u7528\u3059\u308B\u3053\u3068\u306F\u3067\u304D\u307E\u305B\u3093\u3002-help\u3067\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002
-jni.no.stubs=JNI\u306F\u30B9\u30BF\u30D6\u3092\u5FC5\u8981\u3068\u3057\u307E\u305B\u3093\u3002JNI\u306E\u30C9\u30AD\u30E5\u30E1\u30F3\u30C8\u3092\u53C2\u7167\u3057\u3066\u304F\u3060\u3055\u3044\u3002
-jni.sigerror={0}\u306E\u7F72\u540D\u3092\u5224\u5B9A\u3067\u304D\u307E\u305B\u3093
-dir.file.mixed=\u30AA\u30D7\u30B7\u30E7\u30F3-d\u3068-o\u3092\u540C\u6642\u306B\u4F7F\u7528\u3059\u308B\u3053\u3068\u306F\u3067\u304D\u307E\u305B\u3093\u3002-help\u3067\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002
-no.classes.specified=\u30B3\u30DE\u30F3\u30C9\u30E9\u30A4\u30F3\u3067\u30AF\u30E9\u30B9\u304C\u6307\u5B9A\u3055\u308C\u307E\u305B\u3093\u3067\u3057\u305F\u3002-help\u3067\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002
-no.outputfile.specified=\u30B3\u30DE\u30F3\u30C9\u30E9\u30A4\u30F3\u3067\u51FA\u529B\u30D5\u30A1\u30A4\u30EB\u304C\u6307\u5B9A\u3055\u308C\u307E\u305B\u3093\u3067\u3057\u305F\u3002-help\u3067\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002
-no.outputdir.specified=\u30B3\u30DE\u30F3\u30C9\u30E9\u30A4\u30F3\u3067\u51FA\u529B\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u304C\u6307\u5B9A\u3055\u308C\u307E\u305B\u3093\u3067\u3057\u305F\u3002-help\u3067\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002
-no.classpath.specified=\u30B3\u30DE\u30F3\u30C9\u30E9\u30A4\u30F3\u3067\u30AF\u30E9\u30B9\u30D1\u30B9\u304C\u6307\u5B9A\u3055\u308C\u307E\u305B\u3093\u3067\u3057\u305F\u3002-help\u3067\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002
-no.bootclasspath.specified=\u30B3\u30DE\u30F3\u30C9\u30E9\u30A4\u30F3\u3067\u30D6\u30FC\u30C8\u30FB\u30AF\u30E9\u30B9\u30D1\u30B9\u304C\u6307\u5B9A\u3055\u308C\u307E\u305B\u3093\u3067\u3057\u305F\u3002-help\u3067\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002
-unknown.option={0}\u306F\u4E0D\u6B63\u306A\u5F15\u6570\u3067\u3059\n
-tracing.not.supported=\u8B66\u544A: \u30C8\u30EC\u30FC\u30B9\u306F\u73FE\u5728\u306F\u30B5\u30DD\u30FC\u30C8\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002\u304B\u308F\u308A\u306B\u3001Virtual Machine\u306E-verbose:jni\u30AA\u30D7\u30B7\u30E7\u30F3\u3092\u4F7F\u7528\u3057\u3066\u304F\u3060\u3055\u3044\u3002
-
-main.usage=\u4F7F\u7528\u65B9\u6CD5: \n javah [options] <classes>\n[options]\u306B\u306F\u6B21\u306E\u3082\u306E\u304C\u3042\u308A\u307E\u3059\u3002
-
-main.opt.o=\ -o <file> \u51FA\u529B\u30D5\u30A1\u30A4\u30EB(-d\u304B-o\u306E\u3069\u3061\u3089\u304B\u4E00\u65B9\u3092\u4F7F\u7528\u3059\u308B)
-
-main.opt.d=\ -d <dir> \u51FA\u529B\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA
-
-main.opt.v=\ -v -verbose \u8A73\u7D30\u306A\u51FA\u529B\u3092\u884C\u3046
-
-main.opt.h=\ -h --help -? \u3053\u306E\u30E1\u30C3\u30BB\u30FC\u30B8\u3092\u8868\u793A\u3059\u308B
-
-main.opt.version=\ -version \u30D0\u30FC\u30B8\u30E7\u30F3\u60C5\u5831\u3092\u8868\u793A\u3059\u308B
-
-main.opt.jni=\ -jni JNI\u5F62\u5F0F\u306E\u30D8\u30C3\u30C0\u30FC\u30FB\u30D5\u30A1\u30A4\u30EB\u3092\u751F\u6210\u3059\u308B(\u30C7\u30D5\u30A9\u30EB\u30C8)
-
-main.opt.force=\ -force \u5E38\u306B\u51FA\u529B\u30D5\u30A1\u30A4\u30EB\u3092\u66F8\u304D\u8FBC\u3080
-
-main.opt.module_path=\ --module-path <path> \u30A2\u30D7\u30EA\u30B1\u30FC\u30B7\u30E7\u30F3\u30FB\u30E2\u30B8\u30E5\u30FC\u30EB\u3092\u30ED\u30FC\u30C9\u3059\u308B\u30D1\u30B9
-
-main.opt.upgrade_module_path=\ --upgrade_module-path <path> \u30A2\u30D7\u30EA\u30B1\u30FC\u30B7\u30E7\u30F3\u30FB\u30E2\u30B8\u30E5\u30FC\u30EB\u3092\u30ED\u30FC\u30C9\u3059\u308B\u30D1\u30B9
-
-main.opt.classpath=\ -classpath <path> \u30AF\u30E9\u30B9\u3092\u30ED\u30FC\u30C9\u3059\u308B\u30D1\u30B9
-
-main.opt.class_path=\ --class-path <path> \u30AF\u30E9\u30B9\u3092\u30ED\u30FC\u30C9\u3059\u308B\u30D1\u30B9
-
-main.opt.cp=\ -cp <path> \u30AF\u30E9\u30B9\u3092\u30ED\u30FC\u30C9\u3059\u308B\u30D1\u30B9
-
-main.opt.bootclasspath=\ -bootclasspath <path> \u30D6\u30FC\u30C8\u30B9\u30C8\u30E9\u30C3\u30D7\u30FB\u30AF\u30E9\u30B9\u3092\u30ED\u30FC\u30C9\u3059\u308B\u30D1\u30B9
-
-main.opt.system=\ --system <jdk> \u30B7\u30B9\u30C6\u30E0\u30FB\u30E2\u30B8\u30E5\u30FC\u30EB\u3092\u691C\u7D22\u3059\u308B\u5834\u6240\u3092\u6307\u5B9A\u3059\u308B
-
-main.usage.foot=\nGNU\u30B9\u30BF\u30A4\u30EB\u30FB\u30AA\u30D7\u30B7\u30E7\u30F3\u3067\u306F\u3001\u30AA\u30D7\u30B7\u30E7\u30F3\u306E\u540D\u524D\u3068\u305D\u306E\u5024\u3092\u533A\u5207\u308B\u305F\u3081\u306B\u7A7A\u767D\u3067\u306F\u306A\u304F'='\u3092\n\u4F7F\u7528\u3067\u304D\u307E\u3059\u3002\n\n\u5404\u30AF\u30E9\u30B9\u306F\u3001\u305D\u306E\u5B8C\u5168\u4FEE\u98FE\u540D\u3067\u6307\u5B9A\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u3001\u30AA\u30D7\u30B7\u30E7\u30F3\u3067\u30E2\u30B8\u30E5\u30FC\u30EB\u540D\u306E\n\u63A5\u982D\u8F9E\u306B\u7D9A\u3051\u3066'/'\u3092\u6307\u5B9A\u3057\u307E\u3059\u3002\u4F8B:\n java.lang.Object\n java.base/java.io.File\n
-#
-# Version string.
-#
-javah.version={0}\u30D0\u30FC\u30B8\u30E7\u30F3"{1}"
-javah.fullVersion={0}\u30D5\u30EB\u30FB\u30D0\u30FC\u30B8\u30E7\u30F3"{1}"
-
-#
-# These should have better diagnostics.
-#
-super.class.not.found=\u8981\u6C42\u3055\u308C\u305F\u30B9\u30FC\u30D1\u30FC\u30FB\u30AF\u30E9\u30B9{0}\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093\u3002
-class.not.found=\u30AF\u30E9\u30B9{0}\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093\u3002
-io.exception=\u30E1\u30C3\u30BB\u30FC\u30B8{0}\u306E\u5165\u51FA\u529B\u30A8\u30E9\u30FC\u304B\u3089\u56DE\u5FA9\u3067\u304D\u307E\u305B\u3093\u3002
-
-#
-# Problems in the guts of javah.
-#
-encoding.iso8859_1.not.found=\u51FA\u529B\u7528\u306EISO8859_1\u30B3\u30F3\u30D0\u30FC\u30BF\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093\u3002\u30A4\u30F3\u30B9\u30C8\u30FC\u30EB\u306B\u30A8\u30E9\u30FC\u304C\u3042\u308B\u53EF\u80FD\u6027\u304C\u3042\u308A\u307E\u3059\u3002
-tried.to.define.non.static=static\u3067\u306A\u3044\u30D5\u30A3\u30FC\u30EB\u30C9\u306B#define\u3092\u751F\u6210\u3057\u3088\u3046\u3068\u3057\u307E\u3057\u305F\u3002
-jni.unknown.type=\u4E0D\u660E\u306A\u578B\u304C\u691C\u51FA\u3055\u308C\u307E\u3057\u305F(JNI)\u3002
-unknown.array.type=\u53E4\u3044\u5F62\u5F0F\u306E\u30D8\u30C3\u30C0\u30FC\u3092\u751F\u6210\u3057\u3066\u3044\u308B\u3068\u304D\u306B\u4E0D\u660E\u306A\u914D\u5217\u306E\u578B\u304C\u691C\u51FA\u3055\u308C\u307E\u3057\u305F\u3002
-unknown.type.for.field=\u53E4\u3044\u5F62\u5F0F\u306E\u30D8\u30C3\u30C0\u30FC\u3092\u751F\u6210\u3057\u3066\u3044\u308B\u3068\u304D\u306B\u4E0D\u660E\u306A\u578B\u304C\u691C\u51FA\u3055\u308C\u307E\u3057\u305F\u3002
-unknown.type.in.method.signature=\u53E4\u3044\u5F62\u5F0F\u306E\u30B9\u30BF\u30D6\u3092\u751F\u6210\u3057\u3066\u3044\u308B\u3068\u304D\u306B\u4E0D\u660E\u306A\u578B\u304C\u691C\u51FA\u3055\u308C\u307E\u3057\u305F\u3002
-
-
-err.prefix=\u30A8\u30E9\u30FC:
-err.cant.use.option.for.fm=\u6307\u5B9A\u3055\u308C\u305F\u30D5\u30A1\u30A4\u30EB\u30FB\u30DE\u30CD\u30FC\u30B8\u30E3\u3067{0}\u30AA\u30D7\u30B7\u30E7\u30F3\u3092\u4F7F\u7528\u3067\u304D\u307E\u305B\u3093
-err.internal.error=\u5185\u90E8\u30A8\u30E9\u30FC: {0}
-err.ioerror=\u5165\u51FA\u529B\u30A8\u30E9\u30FC: {0}
-err.missing.arg={0}\u306E\u5024\u304C\u3042\u308A\u307E\u305B\u3093
-err.no.classes.specified=\u30AF\u30E9\u30B9\u304C\u6307\u5B9A\u3055\u308C\u3066\u3044\u307E\u305B\u3093
-err.unknown.option=\u4E0D\u660E\u306A\u30AA\u30D7\u30B7\u30E7\u30F3: {0}
-
-#
-# miscellaneous strings
-#
-javah.misc.Deprecation=\n\u8B66\u544A: javah\u30C4\u30FC\u30EB\u306F\u6B21\u56DE\u306EJDK\u30E1\u30B8\u30E3\u30FC\u30FB\u30EA\u30EA\u30FC\u30B9\u3067\u524A\u9664\u3055\u308C\u308B\u4E88\u5B9A\u3067\u3059\u3002\n\u3053\u306E\u30C4\u30FC\u30EB\u306FJDK 8\u3067javac\u306B\u8FFD\u52A0\u3055\u308C\u305F''-h''\u30AA\u30D7\u30B7\u30E7\u30F3\u306B\u3088\u3063\u3066\u7F6E\u304D\u63DB\u3048\u3089\u308C\u307E\u3057\u305F\u3002\n\u30E6\u30FC\u30B6\u30FC\u306Fjavac ''-h''\u30AA\u30D7\u30B7\u30E7\u30F3\u306E\u4F7F\u7528\u306B\u79FB\u884C\u3059\u308B\u3053\u3068\u3092\u304A\u85A6\u3081\u3057\u307E\u3059\u3002\n\u8A73\u7D30\u306F\u3001javac man\u30DA\u30FC\u30B8\u3092\u53C2\u7167\u3057\u3066\u304F\u3060\u3055\u3044\u3002\n
--- a/src/jdk.compiler/share/classes/com/sun/tools/javah/resources/l10n_zh_CN.properties Wed Dec 13 14:21:12 2017 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,116 +0,0 @@
-#
-# Copyright (c) 1998, 2016, 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.
-#
-
-#
-# User errors, command line errors.
-#
-cant.create.dir=\u65E0\u6CD5\u4E3A\u8F93\u51FA\u521B\u5EFA\u76EE\u5F55 {0}\u3002
-at.args.cant.read=\u65E0\u6CD5\u4ECE\u6587\u4EF6{1}\u4E2D\u8BFB\u53D6\u547D\u4EE4\u884C\u53C2\u6570\u3002
-at.args.file.not.found=\u627E\u4E0D\u5230\u6587\u4EF6{0}\u3002
-at.args.io.exception=\u5904\u7406\u547D\u4EE4\u884C\u4E2D\u7684 @ \u53C2\u6570\u65F6, \u9047\u5230\u4EE5\u4E0B I/O \u95EE\u9898: {0}\u3002
-bad.arg=\u9519\u8BEF\u53C2\u6570: {0}
-old.jni.mixed=\u4E0D\u80FD\u6DF7\u7528\u9009\u9879 -jni \u548C -old\u3002\u8BF7\u5C1D\u8BD5\u4F7F\u7528 -help\u3002
-old.llni.mixed=\u4E0D\u80FD\u6DF7\u7528\u9009\u9879 -old \u548C -llni\u3002\u8BF7\u5C1D\u8BD5\u4F7F\u7528 -help\u3002
-old.not.supported=\u6B64\u7248\u672C\u7684 javah \u4E0D\u652F\u6301\u9009\u9879 -old\u3002
-invalid.method.signature=\u65E0\u6548\u7684\u65B9\u6CD5\u7B7E\u540D: {0}
-jni.llni.mixed=\u4E0D\u80FD\u6DF7\u7528\u9009\u9879 -jni \u548C -llni\u3002\u8BF7\u5C1D\u8BD5\u4F7F\u7528 -help\u3002
-jni.no.stubs=JNI \u4E0D\u9700\u8981\u5B58\u6839, \u8BF7\u53C2\u9605 JNI \u6587\u6863\u3002
-jni.sigerror=\u65E0\u6CD5\u786E\u5B9A{0}\u7684\u7B7E\u540D
-dir.file.mixed=\u4E0D\u80FD\u6DF7\u7528\u9009\u9879 -d \u548C -o\u3002\u8BF7\u5C1D\u8BD5\u4F7F\u7528 -help\u3002
-no.classes.specified=\u672A\u5728\u547D\u4EE4\u884C\u4E2D\u6307\u5B9A\u4EFB\u4F55\u7C7B\u3002\u8BF7\u5C1D\u8BD5\u4F7F\u7528 -help\u3002
-no.outputfile.specified=\u672A\u5728\u547D\u4EE4\u884C\u4E2D\u6307\u5B9A\u4EFB\u4F55\u8F93\u51FA\u6587\u4EF6\u3002\u8BF7\u5C1D\u8BD5\u4F7F\u7528 -help\u3002
-no.outputdir.specified=\u672A\u5728\u547D\u4EE4\u884C\u4E2D\u6307\u5B9A\u4EFB\u4F55\u8F93\u51FA\u76EE\u5F55\u3002\u8BF7\u5C1D\u8BD5\u4F7F\u7528 -help\u3002
-no.classpath.specified=\u672A\u5728\u547D\u4EE4\u884C\u4E2D\u6307\u5B9A\u4EFB\u4F55\u7C7B\u8DEF\u5F84\u3002\u8BF7\u5C1D\u8BD5\u4F7F\u7528 -help\u3002
-no.bootclasspath.specified=\u672A\u5728\u547D\u4EE4\u884C\u4E2D\u6307\u5B9A\u4EFB\u4F55\u5F15\u5BFC\u7C7B\u8DEF\u5F84\u3002\u8BF7\u5C1D\u8BD5\u4F7F\u7528 -help\u3002
-unknown.option={0}\u662F\u975E\u6CD5\u53C2\u6570\n
-tracing.not.supported=\u8B66\u544A: \u4E0D\u518D\u652F\u6301\u8DDF\u8E2A\u3002\u8BF7\u4F7F\u7528\u865A\u62DF\u673A\u7684 -verbose:jni \u9009\u9879\u3002
-
-main.usage=\u7528\u6CD5: \n javah [options] <classes>\n\u5176\u4E2D, [options] \u5305\u62EC:
-
-main.opt.o=\ -o <file> \u8F93\u51FA\u6587\u4EF6 (\u53EA\u80FD\u4F7F\u7528 -d \u6216 -o \u4E4B\u4E00)
-
-main.opt.d=\ -d <dir> \u8F93\u51FA\u76EE\u5F55
-
-main.opt.v=\ -v -verbose \u542F\u7528\u8BE6\u7EC6\u8F93\u51FA
-
-main.opt.h=\ -h --help -? \u8F93\u51FA\u6B64\u6D88\u606F
-
-main.opt.version=\ -version \u8F93\u51FA\u7248\u672C\u4FE1\u606F
-
-main.opt.jni=\ -jni \u751F\u6210 JNI \u6837\u5F0F\u7684\u6807\u5934\u6587\u4EF6 (\u9ED8\u8BA4\u503C)
-
-main.opt.force=\ -force \u59CB\u7EC8\u5199\u5165\u8F93\u51FA\u6587\u4EF6
-
-main.opt.module_path=\ --module-path <\u8DEF\u5F84> \u4ECE\u4E2D\u52A0\u8F7D\u5E94\u7528\u7A0B\u5E8F\u6A21\u5757\u7684\u8DEF\u5F84
-
-main.opt.upgrade_module_path=\ --upgrade_module-path <\u8DEF\u5F84> \u4ECE\u4E2D\u52A0\u8F7D\u5E94\u7528\u7A0B\u5E8F\u6A21\u5757\u7684\u8DEF\u5F84
-
-main.opt.classpath=\ -classpath <path> \u4ECE\u4E2D\u52A0\u8F7D\u7C7B\u7684\u8DEF\u5F84
-
-main.opt.class_path=\ --class-path <\u8DEF\u5F84> \u4ECE\u4E2D\u52A0\u8F7D\u7C7B\u7684\u8DEF\u5F84
-
-main.opt.cp=\ -cp <path> \u4ECE\u4E2D\u52A0\u8F7D\u7C7B\u7684\u8DEF\u5F84
-
-main.opt.bootclasspath=\ -bootclasspath <path> \u4ECE\u4E2D\u52A0\u8F7D\u5F15\u5BFC\u7C7B\u7684\u8DEF\u5F84
-
-main.opt.system=\ --system <jdk> \u6307\u5B9A\u67E5\u627E\u7CFB\u7EDF\u6A21\u5757\u7684\u4F4D\u7F6E
-
-main.usage.foot=\nGNU \u6837\u5F0F\u7684\u9009\u9879\u53EF\u4F7F\u7528 '=' (\u800C\u975E\u7A7A\u767D) \u6765\u5206\u9694\u9009\u9879\u540D\u79F0\n\u53CA\u5176\u503C\u3002\n\n\u6BCF\u4E2A\u7C7B\u5FC5\u987B\u7531\u5176\u5168\u9650\u5B9A\u540D\u79F0\u6307\u5B9A, \n\u53EF\u4EE5\u9009\u62E9\u6027\u5730\u4F7F\u7528\u6A21\u5757\u540D\u540E\u8DDF '/' \u4F5C\u4E3A\u524D\u7F00\u3002\u793A\u4F8B:\n java.lang.Object\n java.base/java.io.File\n
-#
-# Version string.
-#
-javah.version={0}\u7248\u672C "{1}"
-javah.fullVersion={0}\u5B8C\u6574\u7248\u672C "{1}"
-
-#
-# These should have better diagnostics.
-#
-super.class.not.found=\u627E\u4E0D\u5230\u6240\u9700\u7684\u8D85\u7C7B{0}\u3002
-class.not.found=\u627E\u4E0D\u5230\u7C7B{0}\u3002
-io.exception=\u65E0\u6CD5\u4ECE I/O \u9519\u8BEF\u4E2D\u6062\u590D, \u6D88\u606F\u4E3A: {0}\u3002
-
-#
-# Problems in the guts of javah.
-#
-encoding.iso8859_1.not.found=\u627E\u4E0D\u5230\u7528\u4E8E\u8F93\u51FA\u7684 ISO8859_1 \u8F6C\u6362\u5668\u3002\u8FD9\u53EF\u80FD\u662F\u56E0\u4E3A\u5B89\u88C5\u8FC7\u7A0B\u4E2D\u51FA\u73B0\u4E86\u9519\u8BEF\u3002
-tried.to.define.non.static=\u5C1D\u8BD5\u4E3A\u975E\u9759\u6001\u5B57\u6BB5\u751F\u6210 #define\u3002
-jni.unknown.type=\u9047\u5230\u672A\u77E5\u7C7B\u578B (JNI)\u3002
-unknown.array.type=\u751F\u6210\u65E7\u6837\u5F0F\u7684\u6807\u5934\u65F6\u9047\u5230\u672A\u77E5\u7684\u6570\u7EC4\u7C7B\u578B\u3002
-unknown.type.for.field=\u751F\u6210\u65E7\u6837\u5F0F\u7684\u6807\u5934\u65F6\u9047\u5230\u672A\u77E5\u7684\u7C7B\u578B\u3002
-unknown.type.in.method.signature=\u751F\u6210\u65E7\u6837\u5F0F\u7684\u5B58\u6839\u65F6\u9047\u5230\u672A\u77E5\u7684\u7C7B\u578B\u3002
-
-
-err.prefix=\u9519\u8BEF:
-err.cant.use.option.for.fm=\u4E0D\u80FD\u5C06{0}\u9009\u9879\u4E0E\u7ED9\u5B9A\u7684\u6587\u4EF6\u7BA1\u7406\u5668\u4E00\u8D77\u4F7F\u7528
-err.internal.error=\u5185\u90E8\u9519\u8BEF: {0}
-err.ioerror=IO \u9519\u8BEF: {0}
-err.missing.arg={0}\u7F3A\u5C11\u503C
-err.no.classes.specified=\u672A\u6307\u5B9A\u7C7B
-err.unknown.option=\u672A\u77E5\u9009\u9879: {0}
-
-#
-# miscellaneous strings
-#
-javah.misc.Deprecation=\n\u8B66\u544A: \u5DF2\u8BA1\u5212\u5728\u4E0B\u4E00\u4E2A JDK \u4E3B\u53D1\u884C\u7248\u4E2D\u5220\u9664 javah\n\u5DE5\u5177\u3002\u8BE5\u5DE5\u5177\u5728 JDK 8 \u4E2D\u5DF2\u7531\u6DFB\u52A0\u5230 javac \u7684\n''-h'' \u9009\u9879\u53D6\u4EE3\u3002\u5EFA\u8BAE\u7528\u6237\u6539\u4E3A\u4F7F\u7528 javac ''-h''\n\u9009\u9879; \u6709\u5173\u8BE6\u7EC6\u4FE1\u606F, \u8BF7\u67E5\u770B javac \u5E2E\u52A9\u9875\u3002\n
--- a/src/jdk.compiler/share/classes/com/sun/tools/javah/resources/version.properties-template Wed Dec 13 14:21:12 2017 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,28 +0,0 @@
-#
-# Copyright (c) 2005, 2010, 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.
-#
-
-jdk=$(JDK_VERSION)
-full=$(FULL_VERSION)
-release=$(RELEASE)
--- a/src/jdk.compiler/share/classes/module-info.java Wed Dec 13 14:21:12 2017 -0800
+++ b/src/jdk.compiler/share/classes/module-info.java Mon Dec 18 10:28:43 2017 -0800
@@ -26,8 +26,7 @@
/**
* Defines the implementation of the
* {@linkplain javax.tools.ToolProvider#getSystemJavaCompiler system Java compiler}
- * and its command line equivalent, <em>{@index javac javac tool}</em>,
- * as well as <em>{@index javah javah tool}</em>.
+ * and its command line equivalent, <em>{@index javac javac tool}</em>.
*
* <h2 style="font-family:'DejaVu Sans Mono', monospace; font-style:italic">javac</h2>
*
@@ -56,17 +55,9 @@
* {@code jdk.zipfs} module, must be available if the compiler is to be able
* to read JAR files.
*
- * <h2 style="font-family:'DejaVu Sans Mono', monospace; font-style:italic">javah</h2>
- *
- * <p>
- * <em>javah</em> only exists as a command line tool, and does not provide any
- * direct API. As of JDK 9, it has been deprecated.
- * Use the {@code -h} option in <em>javac</em> instead.</p>
- *
* <dl style="font-family:'DejaVu Sans', Arial, Helvetica, sans serif">
* <dt class="simpleTagLabel">Tool Guides:
- * <dd>{@extLink javac_tool_reference javac},
- * {@extLink javah_tool_reference javah}
+ * <dd>{@extLink javac_tool_reference javac}
* </dl>
*
* @provides java.util.spi.ToolProvider
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/Contents.java Wed Dec 13 14:21:12 2017 -0800
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/Contents.java Mon Dec 18 10:28:43 2017 -0800
@@ -96,6 +96,7 @@
public final Content errors;
public final Content exception;
public final Content exceptions;
+ public final Content exportedTo;
public final Content fieldLabel;
public final Content fieldDetailsLabel;
public final Content fieldSummaryLabel;
@@ -147,6 +148,7 @@
public final Content noFramesLabel;
public final Content noScriptMessage;
public final Content openModuleLabel;
+ public final Content openedTo;
public final Content overridesLabel;
public final Content overviewLabel;
public final Content packageHierarchies;
@@ -229,6 +231,7 @@
errors = getContent("doclet.Errors");
exception = getContent("doclet.Exception");
exceptions = getContent("doclet.Exceptions");
+ exportedTo = getContent("doclet.ExportedTo");
fieldDetailsLabel = getContent("doclet.Field_Detail");
fieldSummaryLabel = getContent("doclet.Field_Summary");
fieldLabel = getContent("doclet.Field");
@@ -279,6 +282,7 @@
nextPackageLabel = getNonBreakContent("doclet.Next_Package");
noFramesLabel = getNonBreakContent("doclet.No_Frames");
noScriptMessage = getContent("doclet.No_Script_Message");
+ openedTo = getContent("doclet.OpenedTo");
openModuleLabel = getContent("doclet.Open_Module");
overridesLabel = getContent("doclet.Overrides");
overviewLabel = getContent("doclet.Overview");
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java Wed Dec 13 14:21:12 2017 -0800
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java Mon Dec 18 10:28:43 2017 -0800
@@ -1119,7 +1119,7 @@
(label == null) || label.isEmpty() ? defaultLabel : label,
strong,
resources.getText("doclet.Href_Class_Or_Interface_Title", packageName),
- "");
+ "", true);
}
}
return null;
@@ -1137,6 +1137,11 @@
DocPaths.PACKAGE_SUMMARY.getPath());
}
+ public DocLink getCrossModuleLink(String mdleName) {
+ return configuration.extern.getExternalLink(mdleName, pathToRoot,
+ DocPaths.moduleSummary(mdleName).getPath());
+ }
+
/**
* Get the class link.
*
@@ -1411,13 +1416,14 @@
new StringContent(refPackage.getQualifiedName()));
return getPackageLink(refPackage, label);
} else {
- // @see is not referencing an included class or package. Check for cross links.
+ // @see is not referencing an included class, module or package. Check for cross links.
Content classCrossLink;
- DocLink packageCrossLink = getCrossPackageLink(refClassName);
- if (packageCrossLink != null) {
- // Package cross link found
- return Links.createLink(packageCrossLink,
- (label.isEmpty() ? text : label));
+ DocLink elementCrossLink = (configuration.extern.isModule(refClassName))
+ ? getCrossModuleLink(refClassName) : getCrossPackageLink(refClassName);
+ if (elementCrossLink != null) {
+ // Element cross link found
+ return Links.createLink(elementCrossLink,
+ (label.isEmpty() ? text : label), true);
} else if ((classCrossLink = getCrossClassLink(refClassName,
refMemName, label, false, !isLinkPlain)) != null) {
// Class cross link found (possibly to a member in the class)
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleWriterImpl.java Wed Dec 13 14:21:12 2017 -0800
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleWriterImpl.java Mon Dec 18 10:28:43 2017 -0800
@@ -106,21 +106,34 @@
= new TreeMap<>(utils.makeModuleComparator());
/**
- * Map of packages exported by this module and the modules it has been exported to.
+ * Details about a package in a module.
+ * A package may be not exported, or exported to some modules, or exported to all modules.
+ * A package may be not opened, or opened to some modules, or opened to all modules.
+ * A package that is neither exported or opened to any modules is a concealed package.
+ * An open module opens all its packages to all modules.
*/
- private final Map<PackageElement, SortedSet<ModuleElement>> exportedPackages
- = new TreeMap<>(utils.makePackageComparator());
+ class PackageEntry {
+ /**
+ * Summary of package exports:
+ * If null, the package is not exported to any modules;
+ * if empty, the package is exported to all modules;
+ * otherwise, the package is exported to these modules.
+ */
+ Set<ModuleElement> exportedTo;
+
+ /**
+ * Summary of package opens:
+ * If null, the package is not opened to any modules;
+ * if empty, the package is opened to all modules;
+ * otherwise, the package is opened to these modules.
+ */
+ Set<ModuleElement> openedTo;
+ }
/**
- * Map of opened packages by this module and the modules it has been opened to.
+ * Map of packages of this module, and details of whether they are exported or opened.
*/
- private final Map<PackageElement, SortedSet<ModuleElement>> openedPackages
- = new TreeMap<>(utils.makePackageComparator());
-
- /**
- * Set of concealed packages of this module.
- */
- private final SortedSet<PackageElement> concealedPackages = new TreeSet<>(utils.makePackageComparator());
+ private final Map<PackageElement, PackageEntry> packages = new TreeMap<>(utils.makePackageComparator());
/**
* Map of indirect modules (transitive closure) and their exported packages.
@@ -284,51 +297,52 @@
}
});
- // Get all packages for the module and put it in the concealed packages set.
- utils.getModulePackageMap().getOrDefault(mdle, Collections.emptySet()).forEach((pkg) -> {
- if (shouldDocument(pkg) && moduleMode == ModuleMode.ALL) {
- concealedPackages.add(pkg);
+ // Get all packages if module is open or if displaying concealed modules
+ for (PackageElement pkg : utils.getModulePackageMap().getOrDefault(mdle, Collections.emptySet())) {
+ if (shouldDocument(pkg) && (mdle.isOpen() || moduleMode == ModuleMode.ALL)) {
+ PackageEntry e = new PackageEntry();
+ if (mdle.isOpen()) {
+ e.openedTo = Collections.emptySet();
+ }
+ packages.put(pkg, e);
}
- });
+ };
- // Get all exported packages for the module using the exports directive for the module.
- (ElementFilter.exportsIn(mdle.getDirectives())).forEach((directive) -> {
+ // Get all exported packages for the module, using the exports directive for the module.
+ for (ModuleElement.ExportsDirective directive : ElementFilter.exportsIn(mdle.getDirectives())) {
PackageElement p = directive.getPackage();
if (shouldDocument(p)) {
- SortedSet<ModuleElement> mdleList = new TreeSet<>(utils.makeModuleComparator());
List<? extends ModuleElement> targetMdles = directive.getTargetModules();
- if (targetMdles != null) {
- mdleList.addAll(targetMdles);
- }
- // Qualified exports should not be displayed in the api mode. So if mdleList is empty,
- // its exported to all modules and hence can be added.
- if (moduleMode == ModuleMode.ALL || mdleList.isEmpty()) {
- exportedPackages.put(p, mdleList);
- }
- if (moduleMode == ModuleMode.ALL) {
- concealedPackages.remove(p);
+ // Include package if in details mode, or exported to all (i.e. targetModules == null)
+ if (moduleMode == ModuleMode.ALL || targetMdles == null) {
+ PackageEntry packageEntry = packages.computeIfAbsent(p, pkg -> new PackageEntry());
+ SortedSet<ModuleElement> mdleList = new TreeSet<>(utils.makeModuleComparator());
+ if (targetMdles != null) {
+ mdleList.addAll(targetMdles);
+ }
+ packageEntry.exportedTo = mdleList;
}
}
- });
- // Get all opened packages for the module using the opens directive for the module.
- (ElementFilter.opensIn(mdle.getDirectives())).forEach((directive) -> {
+ }
+
+ // Get all opened packages for the module, using the opens directive for the module.
+ // If it is an open module, there will be no separate opens directives.
+ for (ModuleElement.OpensDirective directive : ElementFilter.opensIn(mdle.getDirectives())) {
PackageElement p = directive.getPackage();
if (shouldDocument(p)) {
- SortedSet<ModuleElement> mdleList = new TreeSet<>(utils.makeModuleComparator());
List<? extends ModuleElement> targetMdles = directive.getTargetModules();
- if (targetMdles != null) {
- mdleList.addAll(targetMdles);
- }
- // Qualified opens should not be displayed in the api mode. So if mdleList is empty,
- // it is opened to all modules and hence can be added.
- if (moduleMode == ModuleMode.ALL || mdleList.isEmpty()) {
- openedPackages.put(p, mdleList);
- }
- if (moduleMode == ModuleMode.ALL) {
- concealedPackages.remove(p);
+ // Include package if in details mode, or opened to all (i.e. targetModules == null)
+ if (moduleMode == ModuleMode.ALL || targetMdles == null) {
+ PackageEntry packageEntry = packages.computeIfAbsent(p, pkg -> new PackageEntry());
+ SortedSet<ModuleElement> mdleList = new TreeSet<>(utils.makeModuleComparator());
+ if (targetMdles != null) {
+ mdleList.addAll(targetMdles);
+ }
+ packageEntry.openedTo = mdleList;
}
}
- });
+ }
+
// Get all the exported and opened packages, for the transitive closure of the module, to be displayed in
// the indirect packages tables.
dependentModules.forEach((module, mod) -> {
@@ -348,15 +362,19 @@
indirectPackages.put(module, exportPkgList);
}
SortedSet<PackageElement> openPkgList = new TreeSet<>(utils.makePackageComparator());
- (ElementFilter.opensIn(module.getDirectives())).forEach((directive) -> {
- PackageElement pkg = directive.getPackage();
- if (shouldDocument(pkg)) {
- // Qualified opens are not displayed in API mode
- if (moduleMode == ModuleMode.ALL || directive.getTargetModules() == null) {
- openPkgList.add(pkg);
+ if (module.isOpen()) {
+ openPkgList.addAll(utils.getModulePackageMap().getOrDefault(module, Collections.emptySet()));
+ } else {
+ (ElementFilter.opensIn(module.getDirectives())).forEach((directive) -> {
+ PackageElement pkg = directive.getPackage();
+ if (shouldDocument(pkg)) {
+ // Qualified opens are not displayed in API mode
+ if (moduleMode == ModuleMode.ALL || directive.getTargetModules() == null) {
+ openPkgList.add(pkg);
+ }
}
- }
- });
+ });
+ }
// If none of the indirect modules have opened packages to be displayed, we should not be
// displaying the table and so it should not be added to the map.
if (!openPkgList.isEmpty()) {
@@ -556,13 +574,13 @@
@Override
public void addPackagesSummary(Content summaryContentTree) {
- if (display(exportedPackages) || display(openedPackages) || display(concealedPackages)
+ if (display(packages)
|| display(indirectPackages) || display(indirectOpenPackages)) {
HtmlTree li = new HtmlTree(HtmlTag.LI);
li.setStyle(HtmlStyle.blockList);
addSummaryHeader(HtmlConstants.START_OF_PACKAGES_SUMMARY, SectionName.PACKAGES,
contents.navPackages, li);
- if (display(exportedPackages) || display(openedPackages) || display(concealedPackages)) {
+ if (display(packages)) {
String tableSummary = resources.getText("doclet.Member_Table_Summary",
resources.getText("doclet.Packages_Summary"),
resources.getText("doclet.packages"));
@@ -607,77 +625,115 @@
Table table = new Table(configuration.htmlVersion, HtmlStyle.packagesSummary)
.setSummary(tableSummary)
.setDefaultTab(resources.getText("doclet.All_Packages"))
- .addTab(resources.getText("doclet.Exported_Packages_Summary"),
- e -> exportedPackages.containsKey((PackageElement) e))
- .addTab(resources.getText("doclet.Opened_Packages_Summary"),
- e -> openedPackages.containsKey((PackageElement) e))
- .addTab(resources.getText("doclet.Concealed_Packages_Summary"),
- e -> concealedPackages.contains((PackageElement) e))
+ .addTab(resources.getText("doclet.Exported_Packages_Summary"), this::isExported)
+ .addTab(resources.getText("doclet.Opened_Packages_Summary"), this::isOpened)
+ .addTab(resources.getText("doclet.Concealed_Packages_Summary"), this::isConcealed)
.setTabScript(i -> String.format("showPkgs(%d);", i))
.setTabScriptVariable("packages");
- if (configuration.docEnv.getModuleMode() == ModuleMode.API) {
- table.setHeader(new TableHeader(contents.packageLabel, contents.descriptionLabel))
- .setColumnStyles(HtmlStyle.colFirst, HtmlStyle.colLast);
- } else {
- table.setHeader(new TableHeader(contents.packageLabel, contents.moduleLabel, contents.descriptionLabel))
- .setColumnStyles(HtmlStyle.colFirst, HtmlStyle.colSecond, HtmlStyle.colLast);
+ // Determine whether to show the "Exported To" and "Opened To" columns,
+ // based on whether such columns would provide "useful" info.
+ int numExports = 0;
+ int numUnqualifiedExports = 0;
+ int numOpens = 0;
+ int numUnqualifiedOpens = 0;
+
+ for (PackageEntry e : packages.values()) {
+ if (e.exportedTo != null) {
+ numExports++;
+ if (e.exportedTo.isEmpty()) {
+ numUnqualifiedExports++;
+ }
+ }
+ if (e.openedTo != null) {
+ numOpens++;
+ if (e.openedTo.isEmpty()) {
+ numUnqualifiedOpens++;
+ }
+ }
}
- addPackageTableRows(table);
+ boolean showExportedTo = numExports > 0 && (numOpens > 0 || numUnqualifiedExports < packages.size());
+ boolean showOpenedTo = numOpens > 0 && (numExports > 0 || numUnqualifiedOpens < packages.size());
+
+ // Create the table header and column styles.
+ List<Content> colHeaders = new ArrayList<>();
+ List<HtmlStyle> colStyles = new ArrayList<>();
+ colHeaders.add(contents.packageLabel);
+ colStyles.add(HtmlStyle.colFirst);
+
+ if (showExportedTo) {
+ colHeaders.add(contents.exportedTo);
+ colStyles.add(HtmlStyle.colSecond);
+ }
+
+ if (showOpenedTo) {
+ colHeaders.add(contents.openedTo);
+ colStyles.add(HtmlStyle.colSecond);
+ }
+
+ colHeaders.add(contents.descriptionLabel);
+ colStyles.add(HtmlStyle.colLast);
+
+ table.setHeader(new TableHeader(colHeaders).styles(colStyles))
+ .setColumnStyles(colStyles);
+
+ // Add the table rows, based on the "packages" map.
+ for (Map.Entry<PackageElement, PackageEntry> e : packages.entrySet()) {
+ PackageElement pkg = e.getKey();
+ PackageEntry entry = e.getValue();
+ List<Content> row = new ArrayList<>();
+ Content pkgLinkContent = getPackageLink(pkg, new StringContent(utils.getPackageName(pkg)));
+ row.add(pkgLinkContent);
+
+ if (showExportedTo) {
+ row.add(getPackageExportOpensTo(entry.exportedTo));
+ }
+ if (showOpenedTo) {
+ row.add(getPackageExportOpensTo(entry.openedTo));
+ }
+ Content summary = new ContentBuilder();
+ addSummaryComment(pkg, summary);
+ row.add(summary);
+
+ table.addRow(pkg, row);
+ }
+
li.addContent(table.toContent());
if (table.needsScript()) {
mainBodyScript.append(table.getScript());
}
}
- /**
- * Get the package table rows.
- *
- * @return a content object
- */
- private void addPackageTableRows(Table table) {
- addPackageTableRows(table, exportedPackages);
- addPackageTableRows(table, openedPackages);
- // Show concealed packages only in "all" mode.
- if (moduleMode == ModuleMode.ALL) {
- for (PackageElement pkg : concealedPackages) {
- Content pkgLinkContent = getPackageLink(pkg, new StringContent(utils.getPackageName(pkg)));
- Content noModules = new StringContent(resources.getText("doclet.None"));
- Content summary = new ContentBuilder();
- addSummaryComment(pkg, summary);
- table.addRow(pkg, pkgLinkContent, noModules, summary);
- }
- }
+ private boolean isExported(Element e) {
+ PackageEntry entry = packages.get((PackageElement) e);
+ return (entry != null) && (entry.exportedTo != null);
+ }
+
+ private boolean isOpened(Element e) {
+ PackageEntry entry = packages.get((PackageElement) e);
+ return (entry != null) && (entry.openedTo != null);
+ }
+
+ private boolean isConcealed(Element e) {
+ PackageEntry entry = packages.get((PackageElement) e);
+ return (entry != null) && (entry.exportedTo == null) && (entry.openedTo == null);
}
- private void addPackageTableRows(Table table, Map<PackageElement,SortedSet<ModuleElement>> ap) {
- for (Map.Entry<PackageElement, SortedSet<ModuleElement>> entry : ap.entrySet()) {
- List<Content> row = new ArrayList<>();
- PackageElement pkg = entry.getKey();
- SortedSet<ModuleElement> mdleList = entry.getValue();
- Content pkgLinkContent = getPackageLink(pkg, new StringContent(utils.getPackageName(pkg)));
- row.add(pkgLinkContent);
-
- if (moduleMode == ModuleMode.ALL) {
- Content modules = new ContentBuilder();
- if (!mdleList.isEmpty()) {
- for (ModuleElement m : mdleList) {
- if (!modules.isEmpty()) {
- modules.addContent(new HtmlTree(HtmlTag.BR));
- }
- modules.addContent(getModuleLink(m, new StringContent(m.getQualifiedName())));
- }
- } else {
- Content allModules = new StringContent(resources.getText("doclet.All_Modules"));
- modules.addContent(allModules);
+ private Content getPackageExportOpensTo(Set<ModuleElement> modules) {
+ if (modules == null) {
+ return new StringContent(resources.getText("doclet.None"));
+ } else if (modules.isEmpty()) {
+ return new StringContent(resources.getText("doclet.All_Modules"));
+ } else {
+ Content list = new ContentBuilder();
+ for (ModuleElement m : modules) {
+ if (!list.isEmpty()) {
+ list.addContent(new StringContent(", "));
}
- row.add(modules);
+ list.addContent(getModuleLink(m, new StringContent(m.getQualifiedName())));
}
- Content summary = new ContentBuilder();
- addSummaryComment(pkg, summary);
- row.add(summary);
- table.addRow(pkg, row);
+ return list;
}
}
@@ -692,14 +748,14 @@
ModuleElement m = entry.getKey();
SortedSet<PackageElement> pkgList = entry.getValue();
Content moduleLinkContent = getModuleLink(m, new StringContent(m.getQualifiedName()));
- Content packages = new ContentBuilder();
+ Content list = new ContentBuilder();
String sep = "";
for (PackageElement pkg : pkgList) {
- packages.addContent(sep);
- packages.addContent(getPackageLink(pkg, new StringContent(utils.getPackageName(pkg))));
+ list.addContent(sep);
+ list.addContent(getPackageLink(pkg, new StringContent(utils.getPackageName(pkg))));
sep = " ";
}
- table.addRow(moduleLinkContent, packages);
+ table.addRow(moduleLinkContent, list);
}
}
@@ -898,7 +954,7 @@
? Links.createLink(SectionName.MODULES, contents.navModules)
: contents.navModules);
addNavGap(liNav);
- liNav.addContent((display(exportedPackages) || display(openedPackages) || display(concealedPackages)
+ liNav.addContent((display(packages)
|| display(indirectPackages) || display(indirectOpenPackages))
? Links.createLink(SectionName.PACKAGES, contents.navPackages)
: contents.navPackages);
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlStyle.java Wed Dec 13 14:21:12 2017 -0800
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlStyle.java Mon Dec 18 10:28:43 2017 -0800
@@ -63,6 +63,7 @@
details,
docSummary,
emphasizedPhrase,
+ externalLink,
fixedNav,
header,
horizontal,
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/Links.java Wed Dec 13 14:21:12 2017 -0800
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/Links.java Mon Dec 18 10:28:43 2017 -0800
@@ -259,6 +259,24 @@
*/
public static Content createLink(DocLink link, Content label, boolean strong,
String title, String target) {
+ return createLink(link, label, strong, title, target, false);
+ }
+
+ /**
+ * Creates a link of the form {@code <a href="link" title="title" target="target">label</a>}.
+ * If {@code strong} is set, the label will be wrapped in
+ * {@code <span style="typeNameLink">...</span>}.
+ *
+ * @param link the details for the link
+ * @param label the content for the link
+ * @param strong whether to wrap the {@code label} in a SPAN element
+ * @param title the title for the link
+ * @param target the target for the link, or null
+ * @param isExternal is the link external to the generated documentation
+ * @return a content tree for the link
+ */
+ public static Content createLink(DocLink link, Content label, boolean strong,
+ String title, String target, boolean isExternal) {
Content body = label;
if (strong) {
body = HtmlTree.SPAN(HtmlStyle.typeNameLink, body);
@@ -270,9 +288,26 @@
if (target != null && target.length() != 0) {
l.addAttr(HtmlAttr.TARGET, target);
}
+ if (isExternal) {
+ l.setStyle(HtmlStyle.externalLink);
+ }
return l;
}
+ /**
+ * Creates a link.
+ *
+ * @param link the details for the link
+ * @param label the content for the link
+ * @param isExternal is the link external to the generated documentation
+ * @return a content tree for the link
+ */
+ public static Content createLink(DocLink link, Content label, boolean isExternal) {
+ HtmlTree anchor = HtmlTree.A(link.toString(), label);
+ anchor.setStyle(HtmlStyle.externalLink);
+ return anchor;
+ }
+
/**
* Converts a name to a valid HTML name (id).
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/TableHeader.java Wed Dec 13 14:21:12 2017 -0800
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/TableHeader.java Mon Dec 18 10:28:43 2017 -0800
@@ -77,6 +77,14 @@
}
/**
+ * Creates a header row, with specified content for each cell.
+ * @param headerCellContents a content object for each header cell
+ */
+ public TableHeader(List<Content> headerCellContents) {
+ this.cellContents = headerCellContents;
+ }
+
+ /**
* Set the style class names for each header cell.
* The number of names must match the number of cells given to the constructor.
* @param styles the style class names
@@ -91,6 +99,20 @@
}
/**
+ * Set the style class names for each header cell.
+ * The number of names must match the number of cells given to the constructor.
+ * @param styles the style class names
+ * @return this object
+ */
+ public TableHeader styles(List<HtmlStyle> styles) {
+ if (styles.size() != cellContents.size()) {
+ throw new IllegalStateException();
+ }
+ this.styles = styles;
+ return this;
+ }
+
+ /**
* Converts this header to a {@link Content} object, for use in an {@link HtmlTree}.
* @return a Content object
*/
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/AbstractDoclet.java Wed Dec 13 14:21:12 2017 -0800
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/AbstractDoclet.java Mon Dec 18 10:28:43 2017 -0800
@@ -42,7 +42,7 @@
import jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException;
import jdk.javadoc.internal.doclets.toolkit.util.UncheckedDocletException;
import jdk.javadoc.internal.doclets.toolkit.util.InternalException;
-import jdk.javadoc.internal.doclets.toolkit.util.PackageListWriter;
+import jdk.javadoc.internal.doclets.toolkit.util.ElementListWriter;
import jdk.javadoc.internal.doclets.toolkit.util.ResourceIOException;
import jdk.javadoc.internal.doclets.toolkit.util.SimpleDocletException;
import jdk.javadoc.internal.doclets.toolkit.util.Utils;
@@ -210,7 +210,7 @@
generateClassFiles(docEnv, classtree);
- PackageListWriter.generate(configuration);
+ ElementListWriter.generate(configuration);
generatePackageFiles(classtree);
generateModuleFiles();
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/doclets.properties Wed Dec 13 14:21:12 2017 -0800
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/doclets.properties Mon Dec 18 10:28:43 2017 -0800
@@ -145,6 +145,8 @@
doclet.Exception=Exception
doclet.exception=exception
doclet.exceptions=exceptions
+doclet.ExportedTo=Exported To Modules
+doclet.OpenedTo=Opened To Modules
doclet.Package_private=(package private)
doclet.Nested_Classes_Interfaces_Inherited_From_Class=Nested classes/interfaces inherited from class
doclet.Nested_Classes_Interfaces_Inherited_From_Interface=Nested classes/interfaces inherited from interface
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/CommentHelper.java Wed Dec 13 14:21:12 2017 -0800
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/CommentHelper.java Mon Dec 18 10:28:43 2017 -0800
@@ -31,6 +31,7 @@
import javax.lang.model.element.Element;
import javax.lang.model.element.ExecutableElement;
+import javax.lang.model.element.ModuleElement;
import javax.lang.model.element.PackageElement;
import javax.lang.model.element.TypeElement;
import javax.lang.model.type.TypeMirror;
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/DocPaths.java Wed Dec 13 14:21:12 2017 -0800
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/DocPaths.java Mon Dec 18 10:28:43 2017 -0800
@@ -62,6 +62,9 @@
/** The name of the subdirectory for user-provided additional documentation files. */
public static final DocPath DOC_FILES = DocPath.create("doc-files");
+ /** The name of the file for the element list. */
+ public static final DocPath ELEMENT_LIST = DocPath.create("element-list");
+
/** The name of the image file showing a magnifying glass on the search box. */
public static final DocPath GLASS_IMG = DocPath.create("glass.png");
@@ -149,7 +152,7 @@
/** The name of the file for the package frame. */
public static final DocPath PACKAGE_FRAME = DocPath.create("package-frame.html");
- /** The name of the file for the package list. */
+ /** The name of the file for the package list. This is to support the legacy mode. */
public static final DocPath PACKAGE_LIST = DocPath.create("package-list");
/** The name of the package search index file. */
@@ -182,7 +185,12 @@
/** The name of the file for the module summary. */
public static DocPath moduleSummary(ModuleElement mdle) {
- return DocPath.create(mdle.getQualifiedName() + "-summary.html");
+ return DocPaths.moduleSummary(mdle.getQualifiedName().toString());
+ }
+
+ /** The name of the file for the module summary. */
+ public static DocPath moduleSummary(String mdleName) {
+ return DocPath.create(mdleName + "-summary.html");
}
/** The name of the file for the module frame. */
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/DocletConstants.java Wed Dec 13 14:21:12 2017 -0800
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/DocletConstants.java Mon Dec 18 10:28:43 2017 -0800
@@ -54,6 +54,16 @@
public static final String DEFAULT_PACKAGE_NAME = "<Unnamed>";
/**
+ * The default module or a package name.
+ */
+ public static final String DEFAULT_ELEMENT_NAME = "<Unnamed>";
+
+ /**
+ * The module prefix in the element-list file.
+ */
+ public static final String MODULE_PREFIX = "module:";
+
+ /**
* The default package file name.
*/
public static final String DEFAULT_PACKAGE_FILE_NAME = "default";
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/ElementListWriter.java Mon Dec 18 10:28:43 2017 -0800
@@ -0,0 +1,102 @@
+/*
+ * 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
+ * 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 jdk.javadoc.internal.doclets.toolkit.util;
+
+import java.io.*;
+
+import javax.lang.model.element.ModuleElement;
+import javax.lang.model.element.PackageElement;
+
+import jdk.javadoc.doclet.DocletEnvironment;
+import jdk.javadoc.internal.doclets.toolkit.BaseConfiguration;
+
+
+/**
+ * Write out the element index.
+ *
+ * <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>
+ *
+ * @author Atul M Dambalkar
+ */
+public class ElementListWriter {
+
+ private final BaseConfiguration configuration;
+ private final Utils utils;
+ private final DocFile file;
+
+ /**
+ * Constructor.
+ *
+ * @param configuration the current configuration of the doclet.
+ */
+ public ElementListWriter(BaseConfiguration configuration) {
+ file = DocFile.createFileForOutput(configuration, DocPaths.ELEMENT_LIST);
+ this.configuration = configuration;
+ this.utils = configuration.utils;
+ }
+
+ /**
+ * Generate the element index.
+ *
+ * @param configuration the current configuration of the doclet.
+ * @throws DocFileIOException if there is a problem writing the output
+ */
+ public static void generate(BaseConfiguration configuration) throws DocFileIOException {
+ ElementListWriter elemgen = new ElementListWriter(configuration);
+ elemgen.generateElementListFile(configuration.docEnv);
+ }
+
+ protected void generateElementListFile(DocletEnvironment docEnv) throws DocFileIOException {
+ try (BufferedWriter out = new BufferedWriter(file.openWriter())) {
+ if (configuration.showModules) {
+ for (ModuleElement mdle : configuration.modulePackages.keySet()) {
+ if (!(configuration.nodeprecated && utils.isDeprecated(mdle))) {
+ out.write(DocletConstants.MODULE_PREFIX + mdle.toString());
+ out.newLine();
+ for (PackageElement pkg : configuration.modulePackages.get(mdle)) {
+ out.write(pkg.toString());
+ out.newLine();
+ }
+ }
+ }
+ } else {
+ for (PackageElement pkg : configuration.packages) {
+ // if the -nodeprecated option is set and the package is marked as
+ // deprecated, do not include it in the packages list.
+ if (!(configuration.nodeprecated && utils.isDeprecated(pkg))) {
+ out.write(pkg.toString());
+ out.newLine();
+ }
+ }
+ }
+ } catch (IOException e) {
+ throw new DocFileIOException(file, DocFileIOException.Mode.WRITE, e);
+ }
+ }
+}
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Extern.java Wed Dec 13 14:21:12 2017 -0800
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Extern.java Mon Dec 18 10:28:43 2017 -0800
@@ -56,10 +56,10 @@
public class Extern {
/**
- * Map package names onto Extern Item objects.
+ * Map element names onto Extern Item objects.
* Lazily initialized.
*/
- private Map<String, Item> packageToItemMap;
+ private Map<String, Item> elementToItemMap;
/**
* The global configuration information for this run.
@@ -77,12 +77,12 @@
private class Item {
/**
- * Package name, found in the "package-list" file in the {@link path}.
+ * Element name, found in the "element-list" file in the {@link path}.
*/
- final String packageName;
+ final String elementName;
/**
- * The URL or the directory path at which the package documentation will be
+ * The URL or the directory path at which the element documentation will be
* avaliable.
*/
final String path;
@@ -93,33 +93,40 @@
final boolean relative;
/**
- * Constructor to build a Extern Item object and map it with the package name.
- * If the same package name is found in the map, then the first mapped
+ * If the item is a module then true else if it is a package then false.
+ */
+ boolean isModule = false;
+
+ /**
+ * Constructor to build a Extern Item object and map it with the element name.
+ * If the same element name is found in the map, then the first mapped
* Item object or offline location will be retained.
*
- * @param packageName Package name found in the "package-list" file.
- * @param path URL or Directory path from where the "package-list"
+ * @param elementName Element name found in the "element-list" file.
+ * @param path URL or Directory path from where the "element-list"
* file is picked.
* @param relative True if path is URL, false if directory path.
+ * @param isModule True if the item is a module. False if it is a package.
*/
- Item(String packageName, String path, boolean relative) {
- this.packageName = packageName;
+ Item(String elementName, String path, boolean relative, boolean isModule) {
+ this.elementName = elementName;
this.path = path;
this.relative = relative;
- if (packageToItemMap == null) {
- packageToItemMap = new HashMap<>();
+ this.isModule = isModule;
+ if (elementToItemMap == null) {
+ elementToItemMap = new HashMap<>();
}
- if (!packageToItemMap.containsKey(packageName)) { // save the previous
- packageToItemMap.put(packageName, this); // mapped location
+ if (!elementToItemMap.containsKey(elementName)) { // save the previous
+ elementToItemMap.put(elementName, this); // mapped location
}
}
/**
- * String representation of "this" with packagename and the path.
+ * String representation of "this" with elementname and the path.
*/
@Override
public String toString() {
- return packageName + (relative? " -> " : " => ") + path;
+ return elementName + (relative? " -> " : " => ") + path;
}
}
@@ -134,31 +141,42 @@
* @return true if the element is externally documented
*/
public boolean isExternal(Element element) {
- if (packageToItemMap == null) {
+ if (elementToItemMap == null) {
return false;
}
PackageElement pe = configuration.utils.containingPackage(element);
if (pe.isUnnamed()) {
return false;
}
- return packageToItemMap.get(configuration.utils.getPackageName(pe)) != null;
+ return elementToItemMap.get(configuration.utils.getPackageName(pe)) != null;
+ }
+
+ /**
+ * Determine if a element item is a module or not.
+ *
+ * @param elementName name of the element.
+ * @return true if the element is a module
+ */
+ public boolean isModule(String elementName) {
+ Item elem = findElementItem(elementName);
+ return (elem == null) ? false : elem.isModule;
}
/**
* Convert a link to be an external link if appropriate.
*
- * @param pkgName The package name.
+ * @param elemName The element name.
* @param relativepath The relative path.
* @param filename The link to convert.
* @return if external return converted link else return null
*/
- public DocLink getExternalLink(String pkgName, DocPath relativepath, String filename) {
- return getExternalLink(pkgName, relativepath, filename, null);
+ public DocLink getExternalLink(String elemName, DocPath relativepath, String filename) {
+ return getExternalLink(elemName, relativepath, filename, null);
}
- public DocLink getExternalLink(String pkgName, DocPath relativepath, String filename,
+ public DocLink getExternalLink(String elemName, DocPath relativepath, String filename,
String memberName) {
- Item fnd = findPackageItem(pkgName);
+ Item fnd = findElementItem(elemName);
if (fnd == null)
return null;
@@ -170,56 +188,56 @@
}
/**
- * Build the extern package list from given URL or the directory path,
+ * Build the extern element list from given URL or the directory path,
* as specified with the "-link" flag.
* Flag error if the "-link" or "-linkoffline" option is already used.
*
* @param url URL or Directory path.
* @param reporter The <code>DocErrorReporter</code> used to report errors.
* @return true if successful, false otherwise
- * @throws DocFileIOException if there is a problem reading a package list file
+ * @throws DocFileIOException if there is a problem reading a element list file
*/
public boolean link(String url, Reporter reporter) throws DocFileIOException {
return link(url, url, reporter, false);
}
/**
- * Build the extern package list from given URL or the directory path,
+ * Build the extern element list from given URL or the directory path,
* as specified with the "-linkoffline" flag.
* Flag error if the "-link" or "-linkoffline" option is already used.
*
* @param url URL or Directory path.
- * @param pkglisturl This can be another URL for "package-list" or ordinary
+ * @param elemlisturl This can be another URL for "element-list" or ordinary
* file.
* @param reporter The <code>DocErrorReporter</code> used to report errors.
* @return true if successful, false otherwise
- * @throws DocFileIOException if there is a problem reading a package list file
+ * @throws DocFileIOException if there is a problem reading the element list file
*/
- public boolean link(String url, String pkglisturl, Reporter reporter) throws DocFileIOException {
- return link(url, pkglisturl, reporter, true);
+ public boolean link(String url, String elemlisturl, Reporter reporter) throws DocFileIOException {
+ return link(url, elemlisturl, reporter, true);
}
/*
- * Build the extern package list from given URL or the directory path.
+ * Build the extern element list from given URL or the directory path.
* Flag error if the "-link" or "-linkoffline" option is already used.
*
* @param url URL or Directory path.
- * @param pkglisturl This can be another URL for "package-list" or ordinary
+ * @param elemlisturl This can be another URL for "element-list" or ordinary
* file.
* @param reporter The <code>DocErrorReporter</code> used to report errors.
* @param linkoffline True if -linkoffline is used and false if -link is used.
* @return true if successful, false otherwise
- * @throws DocFileIOException if there is a problem reading a package list file
+ * @throws DocFileIOException if there is a problem reading the element list file
*/
- private boolean link(String url, String pkglisturl, Reporter reporter, boolean linkoffline)
+ private boolean link(String url, String elemlisturl, Reporter reporter, boolean linkoffline)
throws DocFileIOException {
this.linkoffline = linkoffline;
try {
url = adjustEndFileSeparator(url);
- if (isUrl(pkglisturl)) {
- readPackageListFromURL(url, toURL(adjustEndFileSeparator(pkglisturl)));
+ if (isUrl(elemlisturl)) {
+ readElementListFromURL(url, toURL(adjustEndFileSeparator(elemlisturl)));
} else {
- readPackageListFromFile(url, DocFile.createFileForInput(configuration, pkglisturl));
+ readElementListFromFile(url, DocFile.createFileForInput(configuration, elemlisturl));
}
return true;
} catch (Fault f) {
@@ -245,15 +263,15 @@
}
/**
- * Get the Extern Item object associated with this package name.
+ * Get the Extern Item object associated with this element name.
*
- * @param pkgName Package name.
+ * @param elemName Element name.
*/
- private Item findPackageItem(String pkgName) {
- if (packageToItemMap == null) {
+ private Item findElementItem(String elemName) {
+ if (elementToItemMap == null) {
return null;
}
- return packageToItemMap.get(pkgName);
+ return elementToItemMap.get(elemName);
}
/**
@@ -264,42 +282,75 @@
}
/**
+ * Fetch the URL and read the "element-list" file.
+ *
+ * @param urlpath Path to the elements.
+ * @param elemlisturlpath URL or the path to the "element-list" file.
+ */
+ private void readElementListFromURL(String urlpath, URL elemlisturlpath) throws Fault {
+ try {
+ URL link = elemlisturlpath.toURI().resolve(DocPaths.ELEMENT_LIST.getPath()).toURL();
+ readElementList(link.openStream(), urlpath, false);
+ } catch (URISyntaxException | MalformedURLException exc) {
+ throw new Fault(configuration.getText("doclet.MalformedURL", elemlisturlpath.toString()), exc);
+ } catch (IOException exc) {
+ readAlternateURL(urlpath, elemlisturlpath);
+ }
+ }
+
+ /**
* Fetch the URL and read the "package-list" file.
*
* @param urlpath Path to the packages.
- * @param pkglisturlpath URL or the path to the "package-list" file.
+ * @param elemlisturlpath URL or the path to the "package-list" file.
*/
- private void readPackageListFromURL(String urlpath, URL pkglisturlpath) throws Fault {
+ private void readAlternateURL(String urlpath, URL elemlisturlpath) throws Fault {
try {
- URL link = pkglisturlpath.toURI().resolve(DocPaths.PACKAGE_LIST.getPath()).toURL();
- readPackageList(link.openStream(), urlpath, false);
+ URL link = elemlisturlpath.toURI().resolve(DocPaths.PACKAGE_LIST.getPath()).toURL();
+ readElementList(link.openStream(), urlpath, false);
} catch (URISyntaxException | MalformedURLException exc) {
- throw new Fault(configuration.getText("doclet.MalformedURL", pkglisturlpath.toString()), exc);
+ throw new Fault(configuration.getText("doclet.MalformedURL", elemlisturlpath.toString()), exc);
} catch (IOException exc) {
- throw new Fault(configuration.getText("doclet.URL_error", pkglisturlpath.toString()), exc);
+ throw new Fault(configuration.getText("doclet.URL_error", elemlisturlpath.toString()), exc);
}
}
/**
- * Read the "package-list" file which is available locally.
+ * Read the "element-list" file which is available locally.
*
- * @param path URL or directory path to the packages.
- * @param pkgListPath Path to the local "package-list" file.
+ * @param path URL or directory path to the elements.
+ * @param elemListPath Path to the local "element-list" file.
* @throws Fault if an error occurs that can be treated as a warning
- * @throws DocFileIOException if there is a problem opening the package list file
+ * @throws DocFileIOException if there is a problem opening the element list file
*/
- private void readPackageListFromFile(String path, DocFile pkgListPath)
+ private void readElementListFromFile(String path, DocFile elemListPath)
throws Fault, DocFileIOException {
- DocFile file = pkgListPath.resolve(DocPaths.PACKAGE_LIST);
+ DocFile file = elemListPath.resolve(DocPaths.ELEMENT_LIST);
if (! (file.isAbsolute() || linkoffline)){
file = file.resolveAgainst(DocumentationTool.Location.DOCUMENTATION_OUTPUT);
}
+ if (file.exists()) {
+ readElementList(file, path);
+ } else {
+ DocFile file1 = elemListPath.resolve(DocPaths.PACKAGE_LIST);
+ if (!(file1.isAbsolute() || linkoffline)) {
+ file1 = file1.resolveAgainst(DocumentationTool.Location.DOCUMENTATION_OUTPUT);
+ }
+ if (file1.exists()) {
+ readElementList(file1, path);
+ } else {
+ throw new Fault(configuration.getText("doclet.File_error", file.getPath()), null);
+ }
+ }
+ }
+
+ private void readElementList(DocFile file, String path) throws Fault, DocFileIOException {
try {
- if (file.exists() && file.canRead()) {
- boolean pathIsRelative =
- !isUrl(path)
+ if (file.canRead()) {
+ boolean pathIsRelative
+ = !isUrl(path)
&& !DocFile.createFileForInput(configuration, path).isAbsolute();
- readPackageList(file.openInputStream(), path, pathIsRelative);
+ readElementList(file.openInputStream(), path, pathIsRelative);
} else {
throw new Fault(configuration.getText("doclet.File_error", file.getPath()), null);
}
@@ -309,33 +360,32 @@
}
/**
- * Read the file "package-list" and for each package name found, create
- * Extern object and associate it with the package name in the map.
+ * Read the file "element-list" and for each element name found, create
+ * Extern object and associate it with the element name in the map.
*
- * @param input InputStream from the "package-list" file.
- * @param path URL or the directory path to the packages.
+ * @param input InputStream from the "element-list" file.
+ * @param path URL or the directory path to the elements.
* @param relative Is path relative?
* @throws IOException if there is a problem reading or closing the stream
*/
- private void readPackageList(InputStream input, String path, boolean relative)
+ private void readElementList(InputStream input, String path, boolean relative)
throws IOException {
try (BufferedReader in = new BufferedReader(new InputStreamReader(input))) {
- StringBuilder strbuf = new StringBuilder();
- int c;
- while ((c = in.read()) >= 0) {
- char ch = (char) c;
- if (ch == '\n' || ch == '\r') {
- if (strbuf.length() > 0) {
- String packname = strbuf.toString();
- String packpath = path
- + packname.replace('.', '/') + '/';
- Item ignore = new Item(packname, packpath, relative);
- strbuf.setLength(0);
+ in.lines().forEach((elemname) -> {
+ if (elemname.length() > 0) {
+ boolean module;
+ String elempath;
+ if (elemname.startsWith(DocletConstants.MODULE_PREFIX)) {
+ elemname = elemname.replace(DocletConstants.MODULE_PREFIX, "");
+ elempath = path;
+ module = true;
+ } else {
+ elempath = path + elemname.replace('.', '/') + '/';
+ module = false;
}
- } else {
- strbuf.append(ch);
+ Item ignore = new Item(elemname, elempath, relative, module);
}
- }
+ });
}
}
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/PackageListWriter.java Wed Dec 13 14:21:12 2017 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,88 +0,0 @@
-/*
- * 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
- * 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 jdk.javadoc.internal.doclets.toolkit.util;
-
-import java.io.*;
-
-import javax.lang.model.element.PackageElement;
-
-import jdk.javadoc.doclet.DocletEnvironment;
-import jdk.javadoc.internal.doclets.toolkit.BaseConfiguration;
-
-
-/**
- * Write out the package index.
- *
- * <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>
- *
- * @author Atul M Dambalkar
- */
-public class PackageListWriter {
-
- private final BaseConfiguration configuration;
- private final Utils utils;
- private final DocFile file;
-
- /**
- * Constructor.
- *
- * @param configuration the current configuration of the doclet.
- */
- public PackageListWriter(BaseConfiguration configuration) {
- file = DocFile.createFileForOutput(configuration, DocPaths.PACKAGE_LIST);
- this.configuration = configuration;
- this.utils = configuration.utils;
- }
-
- /**
- * Generate the package index.
- *
- * @param configuration the current configuration of the doclet.
- * @throws DocFileIOException if there is a problem writing the output
- */
- public static void generate(BaseConfiguration configuration) throws DocFileIOException {
- PackageListWriter packgen = new PackageListWriter(configuration);
- packgen.generatePackageListFile(configuration.docEnv);
- }
-
- protected void generatePackageListFile(DocletEnvironment docEnv) throws DocFileIOException {
- try (BufferedWriter out = new BufferedWriter(file.openWriter())) {
- for (PackageElement pkg : configuration.packages) {
- // if the -nodeprecated option is set and the package is marked as
- // deprecated, do not include it in the packages list.
- if (!(configuration.nodeprecated && utils.isDeprecated(pkg))) {
- out.write(pkg.toString());
- out.newLine();
- }
- }
- } catch (IOException e) {
- throw new DocFileIOException(file, DocFileIOException.Mode.WRITE, e);
- }
- }
-}
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Utils.java Wed Dec 13 14:21:12 2017 -0800
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Utils.java Mon Dec 18 10:28:43 2017 -0800
@@ -2673,7 +2673,8 @@
}
/**
- * package name, an unnamed package is returned as <Unnamed>
+ * Get the package name for a given package element. An unnamed package is returned as <Unnamed>
+ *
* @param pkg
* @return
*/
@@ -2684,6 +2685,19 @@
return pkg.getQualifiedName().toString();
}
+ /**
+ * Get the module name for a given module element. An unnamed module is returned as <Unnamed>
+ *
+ * @param mdle a ModuleElement
+ * @return
+ */
+ public String getModuleName(ModuleElement mdle) {
+ if (mdle == null || mdle.isUnnamed()) {
+ return DocletConstants.DEFAULT_ELEMENT_NAME;
+ }
+ return mdle.getQualifiedName().toString();
+ }
+
public boolean isAttribute(DocTree doctree) {
return isKind(doctree, ATTRIBUTE);
}
--- a/src/jdk.jconsole/share/classes/sun/tools/jconsole/AboutDialog.java Wed Dec 13 14:21:12 2017 -0800
+++ b/src/jdk.jconsole/share/classes/sun/tools/jconsole/AboutDialog.java Mon Dec 18 10:28:43 2017 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 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
@@ -181,7 +181,7 @@
}
private static String getOnlineDocUrl() {
- String version = Integer.toString(Runtime.version().major());
+ String version = Integer.toString(Runtime.version().feature());
return Resources.format(Messages.HELP_ABOUT_DIALOG_USER_GUIDE_LINK_URL,
version);
}
--- a/src/jdk.jdeps/share/classes/com/sun/tools/jdeprscan/TraverseProc.java Wed Dec 13 14:21:12 2017 -0800
+++ b/src/jdk.jdeps/share/classes/com/sun/tools/jdeprscan/TraverseProc.java Mon Dec 18 10:28:43 2017 -0800
@@ -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
@@ -45,14 +45,14 @@
import javax.lang.model.element.TypeElement;
import javax.lang.model.util.Elements;
-import static javax.lang.model.SourceVersion.RELEASE_9;
+import static javax.lang.model.SourceVersion.RELEASE_10;
import javax.lang.model.element.Element;
import javax.lang.model.element.ElementKind;
import javax.lang.model.element.Modifier;
import javax.lang.model.element.PackageElement;
import javax.tools.Diagnostic;
-@SupportedSourceVersion(RELEASE_9)
+@SupportedSourceVersion(RELEASE_10)
@SupportedAnnotationTypes("*")
public class TraverseProc extends AbstractProcessor {
Elements elements;
--- a/src/jdk.jdeps/share/classes/com/sun/tools/jdeprscan/readme.md Wed Dec 13 14:21:12 2017 -0800
+++ b/src/jdk.jdeps/share/classes/com/sun/tools/jdeprscan/readme.md Mon Dec 18 10:28:43 2017 -0800
@@ -1,6 +1,6 @@
<!--
-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
@@ -62,7 +62,7 @@
Prints out the set of deprecated APIs.
- --release 6|7|8|9
+ --release 6|7|8|9|10
Specifies the Java SE release that is the source of
the list of deprecated APIs. If no --release option is
--- a/src/jdk.jdeps/share/classes/com/sun/tools/jdeprscan/resources/jdeprscan.properties Wed Dec 13 14:21:12 2017 -0800
+++ b/src/jdk.jdeps/share/classes/com/sun/tools/jdeprscan/resources/jdeprscan.properties Mon Dec 18 10:28:43 2017 -0800
@@ -7,7 +7,7 @@
\ --full-version\n\
\ -h --help\n\
\ -l --list\n\
-\ --release 6|7|8|9\n\
+\ --release 6|7|8|9|10\n\
\ -v --verbose\n\
\ --version
--- a/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/JlinkTask.java Wed Dec 13 14:21:12 2017 -0800
+++ b/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/JlinkTask.java Mon Dec 18 10:28:43 2017 -0800
@@ -448,13 +448,14 @@
// java.base version is different than the current runtime version
version = Runtime.Version.parse(v.toString());
- if (Runtime.version().major() != version.major() ||
- Runtime.version().minor() != version.minor()) {
+ if (Runtime.version().feature() != version.feature() ||
+ Runtime.version().interim() != version.interim())
+ {
// jlink version and java.base version do not match.
// We do not (yet) support this mode.
throw new IllegalArgumentException(taskHelper.getMessage("err.jlink.version.mismatch",
- Runtime.version().major(), Runtime.version().minor(),
- version.major(), version.minor()));
+ Runtime.version().feature(), Runtime.version().interim(),
+ version.feature(), version.interim()));
}
}
--- a/src/jdk.scripting.nashorn.shell/share/classes/jdk/nashorn/tools/jjs/Main.java Wed Dec 13 14:21:12 2017 -0800
+++ b/src/jdk.scripting.nashorn.shell/share/classes/jdk/nashorn/tools/jjs/Main.java Mon Dec 18 10:28:43 2017 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 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
@@ -299,7 +299,7 @@
private static String JAVADOC_BASE = "https://docs.oracle.com/javase/%d/docs/api/";
private static void openBrowserForJavadoc(ScriptFunction browse, String relativeUrl) {
try {
- final URI uri = new URI(String.format(JAVADOC_BASE, Runtime.version().major()) + relativeUrl);
+ final URI uri = new URI(String.format(JAVADOC_BASE, Runtime.version().feature()) + relativeUrl);
ScriptRuntime.apply(browse, null, uri);
} catch (Exception ignored) {
}
--- a/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/AssignSymbols.java Wed Dec 13 14:21:12 2017 -0800
+++ b/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/AssignSymbols.java Mon Dec 18 10:28:43 2017 -0800
@@ -796,7 +796,7 @@
args.add(strictFlagNode);
} else {
- return LiteralNode.newInstance(unaryNode, true);
+ throw new AssertionError("Unexpected delete with " + rhs.getClass().getName() + " expression");
}
return new RuntimeNode(unaryNode, request, args);
}
--- a/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/Lower.java Wed Dec 13 14:21:12 2017 -0800
+++ b/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/Lower.java Mon Dec 18 10:28:43 2017 -0800
@@ -228,6 +228,16 @@
return super.leaveIndexNode(indexNode);
}
+ @Override
+ public Node leaveDELETE(final UnaryNode delete) {
+ final Expression expression = delete.getExpression();
+ if (expression instanceof IdentNode || expression instanceof BaseNode) {
+ return delete;
+ }
+ return new BinaryNode(Token.recast(delete.getToken(), TokenType.COMMARIGHT), expression,
+ LiteralNode.newInstance(delete.getToken(), delete.getFinish(), true));
+ }
+
// If expression is a primitive literal that is not an array index and does return its string value. Else return null.
private static String getConstantPropertyName(final Expression expression) {
if (expression instanceof LiteralNode.PrimitiveLiteralNode) {
--- a/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeJavaImporter.java Wed Dec 13 14:21:12 2017 -0800
+++ b/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeJavaImporter.java Mon Dec 18 10:28:43 2017 -0800
@@ -43,6 +43,7 @@
import jdk.nashorn.internal.runtime.ScriptObject;
import jdk.nashorn.internal.runtime.ScriptRuntime;
import jdk.nashorn.internal.runtime.UnwarrantedOptimismException;
+import jdk.nashorn.internal.runtime.WithObject;
import jdk.nashorn.internal.runtime.linker.NashornCallSiteDescriptor;
/**
@@ -106,10 +107,35 @@
*/
@Function(attributes = Attribute.NOT_ENUMERABLE)
public static Object __noSuchProperty__(final Object self, final Object name) {
- if (! (self instanceof NativeJavaImporter)) {
- throw typeError("not.a.java.importer", ScriptRuntime.safeToString(self));
+ final NativeJavaImporter javaImporter = getJavaImporter(self);
+ if (javaImporter != null) {
+ return javaImporter.createProperty(JSType.toString(name));
}
- return ((NativeJavaImporter)self).createProperty(JSType.toString(name));
+ throw typeError("not.a.java.importer", ScriptRuntime.safeToString(self));
+ }
+
+ private static NativeJavaImporter getJavaImporter(Object self) {
+ final NativeJavaImporter expression;
+ if (self instanceof NativeJavaImporter) {
+ expression = (NativeJavaImporter)self;
+ } else if (self instanceof ScriptObject) {
+ expression = getJavaImporterInScope((ScriptObject)self);
+ } else {
+ expression = null;
+ }
+ return expression;
+ }
+
+ private static NativeJavaImporter getJavaImporterInScope(ScriptObject self) {
+ for (ScriptObject obj = self; obj != null; obj = obj.getProto()) {
+ if (obj instanceof WithObject) {
+ final ScriptObject expression = ((WithObject)obj).getExpression();
+ if (expression instanceof NativeJavaImporter) {
+ return (NativeJavaImporter)expression;
+ }
+ }
+ }
+ return null;
}
/**
--- a/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/parser/Parser.java Wed Dec 13 14:21:12 2017 -0800
+++ b/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/parser/Parser.java Mon Dec 18 10:28:43 2017 -0800
@@ -4404,15 +4404,6 @@
final long unaryToken = token;
switch (type) {
- case DELETE: {
- next();
- final Expression expr = unaryExpression();
- if (expr instanceof BaseNode || expr instanceof IdentNode) {
- return new UnaryNode(unaryToken, expr);
- }
- appendStatement(new ExpressionStatement(unaryLine, unaryToken, finish, expr));
- return LiteralNode.newInstance(unaryToken, finish, true);
- }
case ADD:
case SUB: {
final TokenType opType = type;
@@ -4420,6 +4411,7 @@
final Expression expr = unaryExpression();
return new UnaryNode(Token.recast(unaryToken, (opType == TokenType.ADD) ? TokenType.POS : TokenType.NEG), expr);
}
+ case DELETE:
case VOID:
case TYPEOF:
case BIT_NOT:
--- a/src/jdk.zipfs/share/classes/jdk/nio/zipfs/JarFileSystem.java Wed Dec 13 14:21:12 2017 -0800
+++ b/src/jdk.zipfs/share/classes/jdk/nio/zipfs/JarFileSystem.java Mon Dec 18 10:28:43 2017 -0800
@@ -70,14 +70,14 @@
if (o instanceof String) {
String s = (String)o;
if (s.equals("runtime")) {
- version = Runtime.version().major();
+ version = Runtime.version().feature();
} else {
version = Integer.parseInt(s);
}
} else if (o instanceof Integer) {
version = (Integer)o;
} else if (o instanceof Version) {
- version = ((Version)o).major();
+ version = ((Version)o).feature();
} else {
throw new IllegalArgumentException("env parameter must be String, Integer, "
+ "or Version");
--- a/test/hotspot/jtreg/compiler/loopopts/UseCountedLoopSafepointsTest.java Wed Dec 13 14:21:12 2017 -0800
+++ b/test/hotspot/jtreg/compiler/loopopts/UseCountedLoopSafepointsTest.java Mon Dec 18 10:28:43 2017 -0800
@@ -62,7 +62,7 @@
try {
oa = ProcessTools.executeTestJvm("-XX:+UnlockDiagnosticVMOptions", "-Xbootclasspath/a:.",
"-XX:" + (enabled ? "+" : "-") + "UseCountedLoopSafepoints",
- "-XX:LoopStripMiningIter=" + (enabled ? "1" : "0"), "-XX:+WhiteBoxAPI",
+ "-XX:+WhiteBoxAPI",
"-XX:-Inline", "-Xbatch", "-XX:+PrintIdeal", "-XX:LoopUnrollLimit=0",
"-XX:CompileOnly=" + UseCountedLoopSafepoints.class.getName() + "::testMethod",
UseCountedLoopSafepoints.class.getName());
--- a/test/hotspot/jtreg/compiler/whitebox/LockCompilationTest.java Wed Dec 13 14:21:12 2017 -0800
+++ b/test/hotspot/jtreg/compiler/whitebox/LockCompilationTest.java Mon Dec 18 10:28:43 2017 -0800
@@ -33,6 +33,7 @@
* sun.hotspot.WhiteBox$WhiteBoxPermission
* @run main/othervm -Xbootclasspath/a:. -Xmixed -XX:+UnlockDiagnosticVMOptions
* -XX:+WhiteBoxAPI -XX:-UseCounterDecay
+ * -XX:CompileCommand=compileonly,*SimpleTestCaseHelper::method
* compiler.whitebox.LockCompilationTest
*/
@@ -46,20 +47,7 @@
// This case waits for 5 seconds and verifies that the method hasn't been
// compiled during that time. Only do that for one of the test cases.
- // Only compile SimpleTestCaseHelper.method and exclude all other to ensure no
- // contention on the compile queue causes problems.
- String directive =
- "[{ match:\"*SimpleTestCaseHelper.method\", Exclude:false}, " +
- " { match:\"*.*\", Exclude:true}]";
- if (WHITE_BOX.addCompilerDirective(directive) != 2) {
- throw new RuntimeException("Could not add directive");
- }
- try {
- CompilerWhiteBoxTest.main(LockCompilationTest::new, new String[] {"METHOD_TEST"});
- } finally {
- WHITE_BOX.removeCompilerDirective(2);
- }
-
+ CompilerWhiteBoxTest.main(LockCompilationTest::new, new String[] {"METHOD_TEST"});
}
private LockCompilationTest(TestCase testCase) {
--- a/test/hotspot/jtreg/runtime/handshake/HandshakeTransitionTest.java Wed Dec 13 14:21:12 2017 -0800
+++ b/test/hotspot/jtreg/runtime/handshake/HandshakeTransitionTest.java Mon Dec 18 10:28:43 2017 -0800
@@ -49,6 +49,14 @@
public static void main(String[] args) throws Exception {
String lib = System.getProperty("test.nativepath");
WhiteBox wb = WhiteBox.getWhiteBox();
+ Boolean useJVMCICompiler = wb.getBooleanVMFlag("UseJVMCICompiler");
+ String useJVMCICompilerStr;
+ if (useJVMCICompiler != null) {
+ useJVMCICompilerStr = useJVMCICompiler ? "-XX:+UseJVMCICompiler" : "-XX:-UseJVMCICompiler";
+ } else {
+ // pass something innocuous
+ useJVMCICompilerStr = "-XX:+UnlockExperimentalVMOptions";
+ }
ProcessBuilder pb =
ProcessTools.createJavaProcessBuilder(
true,
@@ -60,7 +68,7 @@
"-XX:ConcGCThreads=1",
"-XX:CICompilerCount=2",
"-XX:+UnlockExperimentalVMOptions",
- (wb.getBooleanVMFlag("UseJVMCICompiler") ? "-XX:+UseJVMCICompiler" : "-XX:-UseJVMCICompiler"),
+ useJVMCICompilerStr,
"HandshakeTransitionTest$Test");
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/serviceability/sa/ClhsdbSource.java Mon Dec 18 10:28:43 2017 -0800
@@ -0,0 +1,84 @@
+/*
+ * Copyright (c) 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * 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.
+ */
+
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import jdk.test.lib.apps.LingeredApp;
+
+/*
+ * @test
+ * @bug 8192823
+ * @summary Test clhsdb source command
+ * @library /test/lib
+ * @run main/othervm ClhsdbSource
+ */
+
+public class ClhsdbSource {
+
+ public static void main(String[] args) throws Exception {
+ System.out.println("Starting ClhsdbSource test");
+
+ LingeredApp theApp = null;
+ try {
+ ClhsdbLauncher test = new ClhsdbLauncher();
+ theApp = LingeredApp.startApp();
+ System.out.println("Started LingeredApp with pid " + theApp.getPid());
+
+ Path file = Paths.get("clhsdb_cmd_file");
+ Files.write(file, "jstack -v\nhelp".getBytes());
+ List<String> cmds = List.of("source clhsdb_cmd_file");
+
+ Map<String, List<String>> expStrMap = new HashMap<>();
+ expStrMap.put("source clhsdb_cmd_file", List.of(
+ "No deadlocks found",
+ "Common-Cleaner",
+ "Signal Dispatcher",
+ "java.lang.ref.Finalizer$FinalizerThread.run",
+ "java.lang.ref.Reference",
+ "Method*",
+ "LingeredApp.main",
+ "Available commands:",
+ "attach pid | exec core",
+ "intConstant [ name [ value ] ]",
+ "type [ type [ name super isOop isInteger isUnsigned size ] ]",
+ "symboltable name"));
+
+ Map<String, List<String>> unExpStrMap = new HashMap<>();
+ unExpStrMap.put("source clhsdb_cmd_file", List.of(
+ "No such file or directory"));
+
+ test.run(theApp.getPid(), cmds, expStrMap, unExpStrMap);
+ Files.delete(file);
+ } catch (Exception ex) {
+ throw new RuntimeException("Test ERROR " + ex, ex);
+ } finally {
+ LingeredApp.stopApp(theApp);
+ }
+ System.out.println("Test PASSED");
+ }
+}
--- a/test/jdk/ProblemList.txt Wed Dec 13 14:21:12 2017 -0800
+++ b/test/jdk/ProblemList.txt Mon Dec 18 10:28:43 2017 -0800
@@ -314,7 +314,6 @@
tools/pack200/CommandLineTests.java 8059906 generic-all
tools/launcher/FXLauncherTest.java 8068049 linux-all,macosx-all
-tools/launcher/TestXcheckJNIWarnings.java 8190984 solaris-all
tools/jimage/JImageExtractTest.java 8170120 generic-all
tools/jimage/JImageListTest.java 8170120 generic-all
--- a/test/jdk/java/lang/ClassLoader/nativeLibrary/NativeLibraryTest.java Wed Dec 13 14:21:12 2017 -0800
+++ b/test/jdk/java/lang/ClassLoader/nativeLibrary/NativeLibraryTest.java Mon Dec 18 10:28:43 2017 -0800
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 8164512
+ * @bug 8164512 8191360
* @summary verify if the native library is unloaded when the class loader is GC'ed
* @build p.Test
* @run main/othervm/native -Xcheck:jni NativeLibraryTest
--- a/test/jdk/java/lang/Runtime/Version/Basic.java Wed Dec 13 14:21:12 2017 -0800
+++ b/test/jdk/java/lang/Runtime/Version/Basic.java Mon Dec 18 10:28:43 2017 -0800
@@ -38,6 +38,7 @@
import static java.lang.System.out;
public class Basic {
+
private static final Class<? extends Throwable> IAE
= IllegalArgumentException.class;
private static final Class<? extends Throwable> NPE
@@ -51,17 +52,19 @@
public static void main(String ... args) {
- //// Tests for parse(), major(), minor(), security(), pre(),
- //// build(), optional(), version(), toString()
- // v M m sec pre bld opt
+ //// Tests for parse(), feature(), interim(), update(), patch(),
+ //// pre(), build(), optional(), version(), and toString()
+ // v f i u p pre bld opt
// $VNUM
- test("9", 9, 0, 0, "", 0, "");
- test("9.1", 9, 1, 0, "", 0, "");
- test("9.0.1", 9, 0, 1, "", 0, "");
- test("404.1.2", 404, 1, 2, "", 0, "");
- test("9.1.2.3", 9, 1, 2, "", 0, "");
- test("1000.0.0.0.0.0.99999999", 1000, 0, 0, "", 0, "");
+ test("9", 9, 0, 0, 0, "", 0, "");
+ test("9.1", 9, 1, 0, 0, "", 0, "");
+ test("9.0.1", 9, 0, 1, 0, "", 0, "");
+ test("9.0.0.1", 9, 0, 0, 1, "", 0, "");
+ test("9.0.0.0.1", 9, 0, 0, 0, "", 0, "");
+ test("404.1.2", 404, 1, 2, 0, "", 0, "");
+ test("9.1.2.3", 9, 1, 2, 3, "", 0, "");
+ test("1000.0.0.0.0.0.99999999", 1000, 0, 0, 0, "", 0, "");
tryCatch(null, NPE);
tryCatch("", IAE);
@@ -75,23 +78,23 @@
tryCatch(TOO_BIG_STR, NFE);
// $PRE
- test("9-ea", 9, 0, 0, "ea", 0, "");
- test("9-internal", 9, 0, 0, "internal", 0, "");
- test("9-0", 9, 0, 0, "0", 0, "");
- test("9.2.7-8", 9, 2, 7, "8", 0, "");
- test("1-ALL", 1, 0, 0, "ALL", 0, "");
- test("2.3.4.5-1a", 2, 3, 4, "1a", 0, "");
- test("1-" + TOO_BIG_STR, 1, 0, 0, TOO_BIG_STR, 0, "");
+ test("9-ea", 9, 0, 0, 0, "ea", 0, "");
+ test("9-internal", 9, 0, 0, 0, "internal", 0, "");
+ test("9-0", 9, 0, 0, 0, "0", 0, "");
+ test("9.2.7-8", 9, 2, 7, 0, "8", 0, "");
+ test("1-ALL", 1, 0, 0, 0, "ALL", 0, "");
+ test("2.3.4.5-1a", 2, 3, 4, 5, "1a", 0, "");
+ test("1-" + TOO_BIG_STR, 1, 0, 0, 0, TOO_BIG_STR, 0, "");
tryCatch("9:-ea", IAE);
tryCatch("3.14159-", IAE);
tryCatch("3.14159-%", IAE);
// $BUILD
- test("9+0", 9, 0, 0, "", 0, "");
- test("3.14+9999900", 3, 14, 0, "", 9999900, "");
- test("9-pre+105", 9, 0, 0, "pre", 105, "");
- test("6.0.42-8beta+4", 6, 0, 42, "8beta", 4, "");
+ test("9+0", 9, 0, 0, 0, "", 0, "");
+ test("3.14+9999900", 3, 14, 0, 0, "", 9999900, "");
+ test("9-pre+105", 9, 0, 0, 0, "pre", 105, "");
+ test("6.0.42-8beta+4", 6, 0, 42, 0, "8beta", 4, "");
tryCatch("9+", IAE);
tryCatch("7+a", IAE);
@@ -101,13 +104,13 @@
tryCatch("1+" + TOO_BIG_STR, NFE);
// $OPT
- test("9+-foo", 9, 0, 0, "", 0, "foo");
- test("9-pre-opt", 9, 0, 0, "pre", 0, "opt");
- test("42+---bar", 42, 0, 0, "", 0, "--bar");
- test("2.91+-8061493-", 2, 91, 0, "", 0, "8061493-");
- test("24+-foo.bar", 24, 0, 0, "", 0, "foo.bar");
- test("9-ribbit+17-...", 9, 0, 0, "ribbit", 17, "...");
- test("7+1-" + TOO_BIG_STR, 7,0, 0, "", 1, TOO_BIG_STR);
+ test("9+-foo", 9, 0, 0, 0, "", 0, "foo");
+ test("9-pre-opt", 9, 0, 0, 0, "pre", 0, "opt");
+ test("42+---bar", 42, 0, 0, 0, "", 0, "--bar");
+ test("2.91+-8061493-", 2, 91, 0, 0, "", 0, "8061493-");
+ test("24+-foo.bar", 24, 0, 0, 0, "", 0, "foo.bar");
+ test("9-ribbit+17-...", 9, 0, 0, 0, "ribbit", 17, "...");
+ test("7+1-" + TOO_BIG_STR, 7,0, 0, 0, "", 1, TOO_BIG_STR);
tryCatch("9-pre+-opt", IAE);
tryCatch("1.4142+-", IAE);
@@ -127,6 +130,8 @@
testEHC("9", "8", false, false, 1, 1);
testEHC("10.512.1", "10.512.2", false, false, -1, -1);
+ testEHC("10.512.0.1", "10.512.0.2", false, false, -1, -1);
+ testEHC("10.512.0.0.1", "10.512.0.0.2", false, false, -1, -1);
testEHC("512.10.1", "512.11.1", false, false, -1, -1);
// $OPT comparison
@@ -164,17 +169,21 @@
}
- private static void test(String s, Integer major, Integer minor,
- Integer sec, String pre, Integer build,
- String opt)
+ private static void test(String s, Integer feature, Integer interim,
+ Integer update, Integer patch,
+ String pre, Integer build, String opt)
{
Version v = testParse(s);
testStr(v.toString(), s);
- testInt(v.major(), major);
- testInt(v.minor(), minor);
- testInt(v.security(), sec);
+ testInt(v.feature(), feature);
+ testInt(v.major(), feature);
+ testInt(v.interim(), interim);
+ testInt(v.minor(), interim);
+ testInt(v.update(), update);
+ testInt(v.security(), update);
+ testInt(v.patch(), patch);
testStr((v.pre().isPresent() ? v.pre().get() : ""), pre);
testInt((v.build().isPresent() ? v.build().get() : 0), build);
testStr((v.optional().isPresent() ? v.optional().get() : ""), opt);
@@ -381,4 +390,5 @@
first = x;
}
}
+
}
--- a/test/jdk/java/util/Optional/Basic.java Wed Dec 13 14:21:12 2017 -0800
+++ b/test/jdk/java/util/Optional/Basic.java Mon Dec 18 10:28:43 2017 -0800
@@ -132,6 +132,13 @@
Boolean got = empty.orElseThrow(ObscureException::new);
}
+ @Test(expectedExceptions=NoSuchElementException.class)
+ public void testEmptyOrElseThrowNoArg() throws Exception {
+ Optional<Boolean> empty = Optional.empty();
+
+ Boolean got = empty.orElseThrow();
+ }
+
@Test(groups = "unit")
public void testPresent() {
Optional<Boolean> empty = Optional.empty();
@@ -147,6 +154,7 @@
assertTrue(!present.toString().equals(presentEmptyString.toString()));
assertTrue(-1 != present.toString().indexOf(Boolean.TRUE.toString()));
assertSame(Boolean.TRUE, present.get());
+ assertSame(Boolean.TRUE, present.orElseThrow());
AtomicBoolean presentCheck = new AtomicBoolean();
present.ifPresent(v -> presentCheck.set(true));
@@ -191,6 +199,7 @@
instance = Optional.ofNullable("Duke");
assertTrue(instance.isPresent());
assertEquals(instance.get(), "Duke");
+ assertEquals(instance.orElseThrow(), "Duke");
}
@Test(groups = "unit")
@@ -214,11 +223,13 @@
result = duke.filter(s -> s.startsWith("D"));
assertTrue(result.isPresent());
assertEquals(result.get(), "Duke");
+ assertEquals(result.orElseThrow(), "Duke");
Optional<String> emptyString = Optional.of("");
result = emptyString.filter(String::isEmpty);
assertTrue(result.isPresent());
assertEquals(result.get(), "");
+ assertEquals(result.orElseThrow(), "");
}
@Test(groups = "unit")
@@ -287,6 +298,7 @@
l = duke.flatMap(s -> Optional.of(s.length()));
assertTrue(l.isPresent());
assertEquals(l.get().intValue(), 4);
+ assertEquals(l.orElseThrow().intValue(), 4);
// Verify same instance
l = duke.flatMap(s -> fixture);
--- a/test/jdk/java/util/Optional/BasicDouble.java Wed Dec 13 14:21:12 2017 -0800
+++ b/test/jdk/java/util/Optional/BasicDouble.java Mon Dec 18 10:28:43 2017 -0800
@@ -124,6 +124,13 @@
double got = empty.orElseThrow(ObscureException::new);
}
+ @Test(expectedExceptions=NoSuchElementException.class)
+ public void testEmptyOrElseThrowNoArg() throws Exception {
+ OptionalDouble empty = OptionalDouble.empty();
+
+ double got = empty.orElseThrow();
+ }
+
@Test(groups = "unit")
public void testPresent() {
OptionalDouble empty = OptionalDouble.empty();
@@ -137,7 +144,9 @@
assertTrue(Double.hashCode(1.0) == present.hashCode());
assertFalse(present.toString().isEmpty());
assertTrue(-1 != present.toString().indexOf(Double.toString(present.getAsDouble()).toString()));
+ assertTrue(-1 != present.toString().indexOf(Double.toString(present.orElseThrow()).toString()));
assertEquals(1.0, present.getAsDouble());
+ assertEquals(1.0, present.orElseThrow());
AtomicBoolean presentCheck = new AtomicBoolean();
present.ifPresent(v -> presentCheck.set(true));
--- a/test/jdk/java/util/Optional/BasicInt.java Wed Dec 13 14:21:12 2017 -0800
+++ b/test/jdk/java/util/Optional/BasicInt.java Mon Dec 18 10:28:43 2017 -0800
@@ -124,6 +124,13 @@
int got = empty.orElseThrow(ObscureException::new);
}
+ @Test(expectedExceptions=NoSuchElementException.class)
+ public void testEmptyOrElseThrowNoArg() throws Exception {
+ OptionalInt empty = OptionalInt.empty();
+
+ int got = empty.orElseThrow();
+ }
+
@Test(groups = "unit")
public void testPresent() {
OptionalInt empty = OptionalInt.empty();
@@ -137,7 +144,9 @@
assertTrue(Integer.hashCode(1) == present.hashCode());
assertFalse(present.toString().isEmpty());
assertTrue(-1 != present.toString().indexOf(Integer.toString(present.getAsInt()).toString()));
+ assertTrue(-1 != present.toString().indexOf(Integer.toString(present.orElseThrow()).toString()));
assertEquals(1, present.getAsInt());
+ assertEquals(1, present.orElseThrow());
AtomicBoolean presentCheck = new AtomicBoolean();
present.ifPresent(v -> presentCheck.set(true));
--- a/test/jdk/java/util/Optional/BasicLong.java Wed Dec 13 14:21:12 2017 -0800
+++ b/test/jdk/java/util/Optional/BasicLong.java Mon Dec 18 10:28:43 2017 -0800
@@ -124,6 +124,13 @@
long got = empty.orElseThrow(ObscureException::new);
}
+ @Test(expectedExceptions=NoSuchElementException.class)
+ public void testEmptyOrElseThrowNoArg() throws Exception {
+ OptionalLong empty = OptionalLong.empty();
+
+ long got = empty.orElseThrow();
+ }
+
@Test(groups = "unit")
public void testPresent() {
OptionalLong empty = OptionalLong.empty();
@@ -137,7 +144,9 @@
assertTrue(Long.hashCode(1) == present.hashCode());
assertFalse(present.toString().isEmpty());
assertTrue(-1 != present.toString().indexOf(Long.toString(present.getAsLong()).toString()));
+ assertTrue(-1 != present.toString().indexOf(Long.toString(present.orElseThrow()).toString()));
assertEquals(1L, present.getAsLong());
+ assertEquals(1L, present.orElseThrow());
AtomicBoolean presentCheck = new AtomicBoolean();
present.ifPresent(v -> presentCheck.set(true));
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/sun/security/tools/keytool/JKStoPKCS12.java Mon Dec 18 10:28:43 2017 -0800
@@ -0,0 +1,119 @@
+/*
+ * Copyright (c) 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * 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.
+ */
+
+/*
+ * @test
+ * @bug 8010125 8192988
+ * @summary keytool should support -storepasswd for pkcs12 keystores
+ * @library /test/lib
+ * @build jdk.test.lib.SecurityTools
+ * jdk.test.lib.Utils
+ * jdk.test.lib.Asserts
+ * jdk.test.lib.JDKToolFinder
+ * jdk.test.lib.JDKToolLauncher
+ * jdk.test.lib.Platform
+ * jdk.test.lib.process.*
+ * @run main JKStoPKCS12
+ */
+
+import jdk.test.lib.Asserts;
+import jdk.test.lib.SecurityTools;
+import jdk.test.lib.process.OutputAnalyzer;
+
+import java.io.File;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.security.KeyStore;
+import java.util.Collections;
+
+public class JKStoPKCS12 {
+
+ static String srcStorePass, srcKeyPass;
+
+ public static void main(String[] args) throws Exception {
+
+ // Part 1: JKS keystore with same storepass and keypass
+ genJKS("pass1111", "pass1111");
+
+ // Change storepass, keypass also changes
+ convert("pass2222", null);
+ // You can keep storepass unchanged
+ convert("pass1111", null);
+ // Or change storepass and keypass both, explicitly
+ convert("pass2222", "pass2222");
+
+ // Part 2: JKS keystore with different storepass and keypass
+ Files.delete(Paths.get("jks"));
+ genJKS("pass1111", "pass2222");
+
+ // Can use old keypass as new storepass so new storepass and keypass are same
+ convert("pass2222", null);
+ // Or specify both storepass and keypass to brand new ones
+ convert("pass3333", "pass3333");
+ // Or change storepass, keypass also changes. Remember to provide srckeypass
+ convert("pass1111", null);
+ }
+
+ // Generate JKS keystore with srcStorePass and srcKeyPass
+ static void genJKS(String storePass, String keyPass)
+ throws Exception {
+ srcStorePass = storePass;
+ srcKeyPass = keyPass;
+ kt("-genkeypair -keystore jks -storetype jks "
+ + "-alias me -dname CN=Me -keyalg rsa "
+ + "-storepass " + srcStorePass + " -keypass " + srcKeyPass)
+ .shouldHaveExitValue(0);
+ }
+
+ // Convert JKS to PKCS12 with destStorePass and destKeyPass (optional)
+ static void convert(String destStorePass, String destKeyPass)
+ throws Exception {
+
+ String cmd = "-importkeystore -noprompt"
+ + " -srcstoretype jks -srckeystore jks"
+ + " -destkeystore p12 -deststoretype pkcs12"
+ + " -srcstorepass " + srcStorePass
+ + " -deststorepass " + destStorePass;
+
+ // Must import by alias (-srckeypass not available when importing all)
+ if (!srcStorePass.equals(srcKeyPass)) {
+ cmd += " -srcalias me";
+ cmd += " -srckeypass " + srcKeyPass;
+ }
+ if (destKeyPass != null) {
+ cmd += " -destkeypass " + destKeyPass;
+ }
+
+ kt(cmd).shouldHaveExitValue(0);
+
+ // Confirms the storepass and keypass are all correct
+ KeyStore.getInstance(new File("p12"), destStorePass.toCharArray())
+ .getKey("me", destStorePass.toCharArray());
+
+ Files.delete(Paths.get("p12"));
+ }
+
+ static OutputAnalyzer kt(String arg) throws Exception {
+ return SecurityTools.keytool(arg);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/sun/security/tools/keytool/PKCS12Passwd.java Mon Dec 18 10:28:43 2017 -0800
@@ -0,0 +1,163 @@
+/*
+ * Copyright (c) 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * 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.
+ */
+
+/*
+ * @test
+ * @bug 8192988
+ * @summary keytool should support -storepasswd for pkcs12 keystores
+ * @library /test/lib
+ * @build jdk.test.lib.SecurityTools
+ * jdk.test.lib.Utils
+ * jdk.test.lib.Asserts
+ * jdk.test.lib.JDKToolFinder
+ * jdk.test.lib.JDKToolLauncher
+ * jdk.test.lib.Platform
+ * jdk.test.lib.process.*
+ * @run main PKCS12Passwd
+ */
+
+import jdk.test.lib.Asserts;
+import jdk.test.lib.SecurityTools;
+import jdk.test.lib.process.OutputAnalyzer;
+
+import java.io.File;
+import java.security.KeyStore;
+import java.util.Collections;
+
+public class PKCS12Passwd {
+
+ public static void main(String[] args) throws Exception {
+
+ // A PrivateKeyEntry
+ kt("-genkeypair -alias a -dname CN=A")
+ .shouldHaveExitValue(0);
+
+ // A TrustedCertificateEntry (genkeypair, export, delete, import)
+ kt("-genkeypair -alias b -dname CN=B")
+ .shouldHaveExitValue(0);
+ kt("-exportcert -alias b -file b.cert")
+ .shouldHaveExitValue(0);
+ kt("-delete -alias b")
+ .shouldHaveExitValue(0);
+ kt("-list -alias b")
+ .shouldHaveExitValue(1);
+ kt("-importcert -alias b -file b.cert -noprompt")
+ .shouldHaveExitValue(0);
+
+ // A SecretKeyEntry
+ kt("-genseckey -keyalg AES -keysize 256 -alias c")
+ .shouldHaveExitValue(0);
+
+ // Change password
+
+ // 1. Using -importkeystore
+ ktFull("-importkeystore -srckeystore ks -destkeystore ks2 "
+ + "-srcstoretype pkcs12 -deststoretype pkcs12 "
+ + "-srcstorepass changeit -deststorepass newpass")
+ .shouldHaveExitValue(0);
+
+ check("ks2", "newpass", "newpass");
+
+ // 2. Using -storepasswd
+ kt("-storepasswd -new newpass")
+ .shouldHaveExitValue(0)
+ .shouldNotContain("Ignoring user-specified");
+
+ check("ks", "newpass", "newpass");
+
+ // Other facts. Not necessarily the correct thing.
+
+ // A PKCS12 keystore can be loaded as a JKS, and it follows JKS rules
+ // which means the storepass and keypass can be changed separately!
+
+ ktFull("-genkeypair -alias a -dname CN=A -storetype pkcs12 "
+ + "-storepass changeit -keypass changeit -keystore p12")
+ .shouldHaveExitValue(0);
+
+ // Only storepass is changed
+ ktFull("-storepasswd -storepass changeit -new newpass "
+ + "-keystore p12 -storetype jks")
+ .shouldHaveExitValue(0);
+
+ check("p12", "newpass", "changeit");
+
+ // Only keypass is changed
+ ktFull("-keypasswd -storepass newpass -keypass changeit -new newpass "
+ + "-keystore p12 -storetype jks -alias a")
+ .shouldHaveExitValue(0);
+
+ check("p12", "newpass", "newpass");
+
+ // Conversely, a JKS keystore can be laoded as a PKCS12, and it follows
+ // PKCS12 rules that both passwords are changed at the same time and
+ // some commands are rejected.
+
+ ktFull("-genkeypair -alias a -dname CN=A -storetype jks "
+ + "-storepass changeit -keypass changeit -keystore jks")
+ .shouldHaveExitValue(0);
+
+ // Both storepass and keypass changed.
+ ktFull("-storepasswd -storepass changeit -new newpass "
+ + "-keystore jks -storetype pkcs12")
+ .shouldHaveExitValue(0);
+
+ check("jks", "newpass", "newpass");
+
+ // -keypasswd is not available for pkcs12
+ ktFull("-keypasswd -storepass newpass -keypass newpass -new newerpass "
+ + "-keystore jks -storetype pkcs12 -alias a")
+ .shouldHaveExitValue(1);
+
+ // but available for JKS
+ ktFull("-keypasswd -storepass newpass -keypass newpass -new newerpass "
+ + "-keystore jks -alias a")
+ .shouldHaveExitValue(0);
+
+ check("jks", "newpass", "newerpass");
+ }
+
+ // Makes sure we can load entries in a keystore
+ static void check(String file, String storePass, String keyPass)
+ throws Exception {
+
+ KeyStore ks = KeyStore.getInstance(
+ new File(file), storePass.toCharArray());
+
+ for (String a : Collections.list(ks.aliases())) {
+ if (ks.isCertificateEntry(a)) {
+ ks.getCertificate(a);
+ } else {
+ ks.getEntry(a,
+ new KeyStore.PasswordProtection(keyPass.toCharArray()));
+ }
+ }
+ }
+
+ static OutputAnalyzer kt(String arg) throws Exception {
+ return ktFull("-keystore ks -storepass changeit " + arg);
+ }
+
+ static OutputAnalyzer ktFull(String arg) throws Exception {
+ return SecurityTools.keytool("-debug " + arg);
+ }
+}
--- a/test/jdk/sun/security/tools/keytool/p12importks.sh Wed Dec 13 14:21:12 2017 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,118 +0,0 @@
-#
-# Copyright (c) 2013, 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.
-#
-# 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.
-#
-
-# @test
-# @bug 8010125
-# @summary keytool -importkeystore could create a pkcs12 keystore with
-# different storepass and keypass
-#
-
-if [ "${TESTJAVA}" = "" ] ; then
- JAVAC_CMD=`which javac`
- TESTJAVA=`dirname $JAVAC_CMD`/..
-fi
-
-# set platform-dependent variables
-OS=`uname -s`
-case "$OS" in
- Windows_* )
- FS="\\"
- ;;
- * )
- FS="/"
- ;;
-esac
-
-LANG=C
-KT="$TESTJAVA${FS}bin${FS}keytool ${TESTTOOLVMOPTS}"
-
-# Part 1: JKS keystore with same storepass and keypass
-
-rm jks 2> /dev/null
-$KT -genkeypair -keystore jks -storetype jks -alias me -dname CN=Me \
- -keyalg rsa -storepass pass1111 -keypass pass1111 || exit 11
-
-# Cannot only change storepass
-rm p12 2> /dev/null
-$KT -importkeystore -noprompt \
- -srcstoretype jks -srckeystore jks -destkeystore p12 -deststoretype pkcs12 \
- -srcstorepass pass1111 \
- -deststorepass pass2222 \
- && exit 12
-
-# You can keep storepass unchanged
-rm p12 2> /dev/null
-$KT -importkeystore -noprompt \
- -srcstoretype jks -srckeystore jks -destkeystore p12 -deststoretype pkcs12 \
- -srcstorepass pass1111 \
- -deststorepass pass1111 \
- || exit 13
-$KT -certreq -storetype pkcs12 -keystore p12 -alias me \
- -storepass pass1111 -keypass pass1111 || exit 14
-
-# Or change storepass and keypass both
-rm p12 2> /dev/null
-$KT -importkeystore -noprompt \
- -srcstoretype jks -srckeystore jks -destkeystore p12 -deststoretype pkcs12 \
- -srcstorepass pass1111 \
- -deststorepass pass2222 -destkeypass pass2222 \
- || exit 15
-$KT -certreq -storetype pkcs12 -keystore p12 -alias me \
- -storepass pass2222 -keypass pass2222 || exit 16
-
-# Part 2: JKS keystore with different storepass and keypass
-# Must import by alias (-srckeypass is not available when importing all)
-
-rm jks 2> /dev/null
-$KT -genkeypair -keystore jks -storetype jks -alias me -dname CN=Me \
- -keyalg rsa -storepass pass1111 -keypass pass2222 || exit 21
-
-# Can use old keypass as new storepass so new storepass and keypass are same
-rm p12 2> /dev/null
-$KT -importkeystore -noprompt -srcalias me \
- -srcstoretype jks -srckeystore jks -destkeystore p12 -deststoretype pkcs12 \
- -srcstorepass pass1111 -srckeypass pass2222 \
- -deststorepass pass2222 \
- || exit 22
-$KT -certreq -storetype pkcs12 -keystore p12 -alias me \
- -storepass pass2222 -keypass pass2222 || exit 23
-
-# Or specify both storepass and keypass to brand new ones
-rm p12 2> /dev/null
-$KT -importkeystore -noprompt -srcalias me \
- -srcstoretype jks -srckeystore jks -destkeystore p12 -deststoretype pkcs12 \
- -srcstorepass pass1111 -srckeypass pass2222 \
- -deststorepass pass3333 -destkeypass pass3333 \
- || exit 24
-$KT -certreq -storetype pkcs12 -keystore p12 -alias me \
- -storepass pass3333 -keypass pass3333 || exit 25
-
-# Anyway you cannot make new storepass and keypass different
-rm p12 2> /dev/null
-$KT -importkeystore -noprompt -srcalias me \
- -srcstoretype jks -srckeystore jks -destkeystore p12 -deststoretype pkcs12 \
- -srcstorepass pass1111 -srckeypass pass2222 \
- -deststorepass pass1111 \
- && exit 26
-
-exit 0
--- a/test/jdk/tools/launcher/ToolsOpts.java Wed Dec 13 14:21:12 2017 -0800
+++ b/test/jdk/tools/launcher/ToolsOpts.java Mon Dec 18 10:28:43 2017 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 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
@@ -24,7 +24,7 @@
/*
* @test
* @bug 8002091
- * @summary Test options patterns for javac,javah,javap and javadoc using
+ * @summary Test options patterns for javac,javap and javadoc using
* javac as a test launcher. Create a dummy javac and intercept options to check
* reception of options as passed through the launcher without having to launch
* javac. Only -J and -cp ./* options should be consumed by the launcher.
--- a/test/langtools/jdk/javadoc/doclet/lib/JavadocTester.java Wed Dec 13 14:21:12 2017 -0800
+++ b/test/langtools/jdk/javadoc/doclet/lib/JavadocTester.java Mon Dec 18 10:28:43 2017 -0800
@@ -236,6 +236,9 @@
/** The current run of javadoc. Incremented when javadoc is called. */
private int javadocRunNum = 0;
+ /** The current subtest number for this run of javadoc. Incremented when checking(...) is called. */
+ private int javadocTestNum = 0;
+
/** Marker annotation for test methods to be invoked by runTests. */
@Retention(RetentionPolicy.RUNTIME)
@interface Test { }
@@ -295,11 +298,11 @@
fileContentCache.clear();
javadocRunNum++;
+ javadocTestNum = 0; // reset counter for this run of javadoc
if (javadocRunNum == 1) {
out.println("Running javadoc...");
} else {
- out.println("Running javadoc (run "
- + javadocRunNum + ")...");
+ out.println("Running javadoc (run "+ javadocRunNum + ")...");
}
outputDir = new File(".");
@@ -441,8 +444,7 @@
* Check for content in (or not in) the generated output.
* Within the search strings, the newline character \n
* will be translated to the platform newline character sequence.
- * @param path a path within the most recent output directory
- * or the name of one of the output buffers, identifying
+ * @param path a path within the most recent output directory, identifying
* where to look for the search strings.
* @param expectedFound true if all of the search strings are expected
* to be found, or false if all of the strings are expected to be
@@ -451,15 +453,13 @@
*/
public void checkOutput(String path, boolean expectedFound, String... strings) {
// Read contents of file
- String fileString;
try {
- fileString = readFile(outputDir, path);
+ String fileString = readFile(outputDir, path);
+ checkOutput(new File(outputDir, path).getPath(), fileString, expectedFound, strings);
} catch (Error e) {
checking("Read file");
failed("Error reading file: " + e);
- return;
}
- checkOutput(path, fileString, expectedFound, strings);
}
/**
@@ -476,6 +476,7 @@
checkOutput(output.toString(), outputMap.get(output), expectedFound, strings);
}
+ // NOTE: path may be the name of an Output stream as well as a file path
private void checkOutput(String path, String fileString, boolean expectedFound, String... strings) {
for (String stringToFind : strings) {
// log.logCheckOutput(path, expectedFound, stringToFind);
@@ -484,25 +485,27 @@
boolean isFound = findString(fileString, stringToFind);
if (isFound == expectedFound) {
passed(path + ": following text " + (isFound ? "found:" : "not found:") + "\n"
- + stringToFind + "\n");
+ + stringToFind);
} else {
failed(path + ": following text " + (isFound ? "found:" : "not found:") + "\n"
- + stringToFind + "\n");
+ + stringToFind);
}
}
}
/**
- * Get the content of the one of the output streams written by
- * javadoc.
+ * Get the content of the one of the output streams written by javadoc.
+ * @param output the name of the output stream
+ * @return the content of the output stream
*/
public String getOutput(Output output) {
return outputMap.get(output);
}
/**
- * Get the content of the one of the output streams written by
- * javadoc.
+ * Get the content of the one of the output streams written by javadoc.
+ * @param output the name of the output stream
+ * @return the content of the output stream, as a line of lines
*/
public List<String> getOutputLines(Output output) {
String text = outputMap.get(output);
@@ -534,9 +537,9 @@
File file = new File(outputDir, path);
boolean isFound = file.exists();
if (isFound == expectedFound) {
- passed(path + ": file " + (isFound ? "found:" : "not found:") + "\n");
+ passed(file, "file " + (isFound ? "found:" : "not found:") + "\n");
} else {
- failed(path + ": file " + (isFound ? "found:" : "not found:") + "\n");
+ failed(file, "file " + (isFound ? "found:" : "not found:") + "\n");
}
}
}
@@ -548,20 +551,21 @@
* @param strings the strings whose order to check
*/
public void checkOrder(String path, String... strings) {
+ File file = new File(outputDir, path);
String fileString = readOutputFile(path);
int prevIndex = -1;
for (String s : strings) {
s = s.replace("\n", NL); // normalize new lines
int currentIndex = fileString.indexOf(s, prevIndex + 1);
- checking(s + " at index " + currentIndex);
+ checking("file: " + file + ": " + s + " at index " + currentIndex);
if (currentIndex == -1) {
- failed(s + " not found.");
+ failed(file, s + " not found.");
continue;
}
if (currentIndex > prevIndex) {
- passed(s + " is in the correct order");
+ passed(file, s + " is in the correct order");
} else {
- failed("file: " + path + ": " + s + " is in the wrong order.");
+ failed(file, s + " is in the wrong order.");
}
prevIndex = currentIndex;
}
@@ -575,19 +579,20 @@
* @param strings ensure each are unique
*/
public void checkUnique(String path, String... strings) {
+ File file = new File(outputDir, path);
String fileString = readOutputFile(path);
for (String s : strings) {
int currentIndex = fileString.indexOf(s);
checking(s + " at index " + currentIndex);
if (currentIndex == -1) {
- failed(s + " not found.");
+ failed(file, s + " not found.");
continue;
}
int nextindex = fileString.indexOf(s, currentIndex + s.length());
if (nextindex == -1) {
- passed(s + " is unique");
+ passed(file, s + " is unique");
} else {
- failed(s + " is not unique, found at " + nextindex);
+ failed(file, s + " is not unique, found at " + nextindex);
}
}
}
@@ -702,16 +707,35 @@
protected void checking(String message) {
numTestsRun++;
- print("Starting subtest " + numTestsRun, message);
+ javadocTestNum++;
+ print("Starting subtest " + javadocRunNum + "." + javadocTestNum, message);
+ }
+
+ protected void passed(File file, String message) {
+ passed(file + ": " + message);
}
protected void passed(String message) {
numTestsPassed++;
print("Passed", message);
+ out.println();
+ }
+
+ protected void failed(File file, String message) {
+ failed(file + ": " + message);
}
protected void failed(String message) {
print("FAILED", message);
+ StackWalker.getInstance().walk(s -> {
+ s.dropWhile(f -> f.getMethodName().equals("failed"))
+ .takeWhile(f -> !f.getMethodName().equals("runTests"))
+ .forEach(f -> out.println(" at "
+ + f.getClassName() + "." + f.getMethodName()
+ + "(" + f.getFileName() + ":" + f.getLineNumber() + ")"));
+ return null;
+ });
+ out.println();
}
private void print(String prefix, String message) {
@@ -720,7 +744,10 @@
else {
out.print(prefix);
out.print(": ");
- out.println(message.replace("\n", NL));
+ out.print(message.replace("\n", NL));
+ if (!(message.endsWith("\n") || message.endsWith(NL))) {
+ out.println();
+ }
}
}
--- a/test/langtools/jdk/javadoc/doclet/testClassCrossReferences/TestClassCrossReferences.java Wed Dec 13 14:21:12 2017 -0800
+++ b/test/langtools/jdk/javadoc/doclet/testClassCrossReferences/TestClassCrossReferences.java Mon Dec 18 10:28:43 2017 -0800
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 4652655 4857717 8025633 8026567 8071982
+ * @bug 4652655 4857717 8025633 8026567 8071982 8164407
* @summary This test verifies that class cross references work properly.
* @author jamieh
* @library ../lib
@@ -52,16 +52,16 @@
checkExit(Exit.OK);
checkOutput("C.html", true,
- "<a href=\"" + uri + "java/math/package-summary.html?is-external=true\">"
+ "<a href=\"" + uri + "java/math/package-summary.html?is-external=true\" class=\"externalLink\">"
+ "<code>Link to math package</code></a>",
"<a href=\"" + uri + "javax/swing/text/AbstractDocument.AttributeContext.html?is-external=true\" "
- + "title=\"class or interface in javax.swing.text\"><code>Link to AttributeContext innerclass</code></a>",
+ + "title=\"class or interface in javax.swing.text\" class=\"externalLink\"><code>Link to AttributeContext innerclass</code></a>",
"<a href=\"" + uri + "java/math/BigDecimal.html?is-external=true\" "
- + "title=\"class or interface in java.math\"><code>Link to external class BigDecimal</code></a>",
+ + "title=\"class or interface in java.math\" class=\"externalLink\"><code>Link to external class BigDecimal</code></a>",
"<a href=\"" + uri + "java/math/BigInteger.html?is-external=true#gcd-java.math.BigInteger-\" "
- + "title=\"class or interface in java.math\"><code>Link to external member gcd</code></a>",
+ + "title=\"class or interface in java.math\" class=\"externalLink\"><code>Link to external member gcd</code></a>",
"<a href=\"" + uri + "javax/tools/SimpleJavaFileObject.html?is-external=true#URI\" "
- + "title=\"class or interface in javax.tools\"><code>Link to external member URI</code></a>",
+ + "title=\"class or interface in javax.tools\" class=\"externalLink\"><code>Link to external member URI</code></a>",
"<dl>\n"
+ "<dt><span class=\"overrideSpecifyLabel\">Overrides:</span></dt>\n"
+ "<dd><code>toString</code> in class <code>java.lang.Object</code></dd>\n"
--- a/test/langtools/jdk/javadoc/doclet/testDocRootInlineTag/TestDocRootInlineTag.java Wed Dec 13 14:21:12 2017 -0800
+++ b/test/langtools/jdk/javadoc/doclet/testDocRootInlineTag/TestDocRootInlineTag.java Mon Dec 18 10:28:43 2017 -0800
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 4369014 4851991
+ * @bug 4369014 4851991 8164407
* @summary Determine if the docRoot inline tag works properly.
* If docRoot performs as documented, the test passes.
* Make sure that the docRoot tag works with the -bottom option.
@@ -54,10 +54,10 @@
checkOutput("TestDocRootTag.html", true,
"<a href=\"" + uri + "/java/io/File.html?is-external=true\" "
- + "title=\"class or interface in java.io\"><code>File</code></a>",
+ + "title=\"class or interface in java.io\" class=\"externalLink\"><code>File</code></a>",
"<a href=\"./glossary.html\">glossary</a>",
"<a href=\"" + uri + "/java/io/File.html?is-external=true\" "
- + "title=\"class or interface in java.io\"><code>Second File Link</code></a>",
+ + "title=\"class or interface in java.io\" class=\"externalLink\"><code>Second File Link</code></a>",
"The value of @docRoot is \"./\"");
checkOutput("index-all.html", true,
--- a/test/langtools/jdk/javadoc/doclet/testExternalOverridenMethod/TestExternalOverridenMethod.java Wed Dec 13 14:21:12 2017 -0800
+++ b/test/langtools/jdk/javadoc/doclet/testExternalOverridenMethod/TestExternalOverridenMethod.java Mon Dec 18 10:28:43 2017 -0800
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 4857717 8025633 8026567
+ * @bug 4857717 8025633 8026567 8164407
* @summary Test to make sure that externally overriden and implemented methods
* are documented properly. The method should still include "implements" or
* "overrides" documentation even though the method is external.
@@ -53,14 +53,14 @@
checkOutput("pkg/XReader.html", true,
"<dt><span class=\"overrideSpecifyLabel\">Overrides:</span></dt>\n"
+ "<dd><code><a href=\"" + uri + "/java/io/FilterReader.html?is-external=true#read--\" "
- + "title=\"class or interface in java.io\">read</a></code> in class <code>"
+ + "title=\"class or interface in java.io\" class=\"externalLink\">read</a></code> in class <code>"
+ "<a href=\"" + uri + "/java/io/FilterReader.html?is-external=true\" "
- + "title=\"class or interface in java.io\">FilterReader</a></code></dd>",
+ + "title=\"class or interface in java.io\" class=\"externalLink\">FilterReader</a></code></dd>",
"<dt><span class=\"overrideSpecifyLabel\">Specified by:</span></dt>\n"
+ "<dd><code><a href=\"" + uri + "/java/io/DataInput.html?is-external=true#readInt--\" "
- + "title=\"class or interface in java.io\">readInt</a></code> in interface <code>"
+ + "title=\"class or interface in java.io\" class=\"externalLink\">readInt</a></code> in interface <code>"
+ "<a href=\"" + uri + "/java/io/DataInput.html?is-external=true\" "
- + "title=\"class or interface in java.io\">DataInput</a></code></dd>"
+ + "title=\"class or interface in java.io\" class=\"externalLink\">DataInput</a></code></dd>"
);
}
}
--- a/test/langtools/jdk/javadoc/doclet/testLinkOption/TestLinkOption.java Wed Dec 13 14:21:12 2017 -0800
+++ b/test/langtools/jdk/javadoc/doclet/testLinkOption/TestLinkOption.java Mon Dec 18 10:28:43 2017 -0800
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 4720957 5020118 8026567 8038976 8184969
+ * @bug 4720957 5020118 8026567 8038976 8184969 8164407
* @summary Test to make sure that -link and -linkoffline link to
* right files, and URLs with and without trailing slash are accepted.
* @author jamieh
@@ -70,26 +70,26 @@
checkOutput("pkg/C.html", true,
"<a href=\"" + url + "java/lang/String.html?is-external=true\" "
- + "title=\"class or interface in java.lang\"><code>Link to String Class</code></a>",
+ + "title=\"class or interface in java.lang\" class=\"externalLink\"><code>Link to String Class</code></a>",
//Make sure the parameters are indented properly when the -link option is used.
"(int p1,\n"
+ " int p2,\n"
+ " int p3)",
"(int p1,\n"
+ " int p2,\n"
- + " <a href=\"" + url + "java/lang/Object.html?is-external=true\" title=\"class or interface in java.lang\">"
+ + " <a href=\"" + url + "java/lang/Object.html?is-external=true\" title=\"class or interface in java.lang\" class=\"externalLink\">"
+ "Object</a> p3)");
checkOutput("pkg/B.html", true,
"<div class=\"block\">A method with html tag the method "
+ "<a href=\"" + url + "java/lang/ClassLoader.html?is-external=true#getSystemClassLoader--\""
- + " title=\"class or interface in java.lang\"><code><tt>getSystemClassLoader()</tt>"
+ + " title=\"class or interface in java.lang\" class=\"externalLink\"><code><tt>getSystemClassLoader()</tt>"
+ "</code></a> as the parent class loader.</div>",
"<div class=\"block\">is equivalent to invoking <code>"
+ "<a href=\"../pkg/B.html#createTempFile-java.lang.String-java.lang.String-java.io.File-\">"
+ "<code>createTempFile(prefix, suffix, null)</code></a></code>.</div>",
"<a href=\"" + url + "java/lang/String.html?is-external=true\" "
- + "title=\"class or interface in java.lang\">Link-Plain to String Class</a>",
+ + "title=\"class or interface in java.lang\" class=\"externalLink\">Link-Plain to String Class</a>",
"<code><tt>getSystemClassLoader()</tt></code>",
"<code>createTempFile(prefix, suffix, null)</code>",
"<dd><a href=\"http://www.ietf.org/rfc/rfc2279.txt\"><i>RFC 2279: UTF-8, a\n" +
@@ -106,7 +106,7 @@
checkOutput("mylib/lang/StringBuilderChild.html", true,
"<pre>public abstract class <span class=\"typeNameLabel\">StringBuilderChild</span>\n"
+ "extends <a href=\"" + url + "java/lang/Object.html?is-external=true\" "
- + "title=\"class or interface in java.lang\">Object</a></pre>"
+ + "title=\"class or interface in java.lang\" class=\"externalLink\">Object</a></pre>"
);
// Generate the documentation using -linkoffline and a relative path as the first parameter.
@@ -120,7 +120,7 @@
checkExit(Exit.OK);
checkOutput("pkg2/C2.html", true,
"This is a link to <a href=\"../../" + out1 + "/pkg/C.html?is-external=true\" " +
- "title=\"class or interface in pkg\"><code>Class C</code></a>."
+ "title=\"class or interface in pkg\" class=\"externalLink\"><code>Class C</code></a>."
);
String out3 = "out3";
@@ -149,10 +149,10 @@
+ "<div class=\"block\">Test links.\n"
+ " <br>\n"
+ " <a href=\"../../out2/pkg2/C2.html?is-external=true\" "
- + "title=\"class or interface in pkg2\"><code>link to pkg2.C2</code></a>\n"
+ + "title=\"class or interface in pkg2\" class=\"externalLink\"><code>link to pkg2.C2</code></a>\n"
+ " <br>\n"
+ " <a href=\"../../out1/mylib/lang/StringBuilderChild.html?is-external=true\" "
- + "title=\"class or interface in mylib.lang\">"
+ + "title=\"class or interface in mylib.lang\" class=\"externalLink\">"
+ "<code>link to mylib.lang.StringBuilderChild</code></a>.</div>\n"
);
@@ -169,10 +169,10 @@
+ "<div class=\"block\">Test links.\n"
+ " <br>\n"
+ " <a href=\"../../copy/out2/pkg2/C2.html?is-external=true\" "
- + "title=\"class or interface in pkg2\"><code>link to pkg2.C2</code></a>\n"
+ + "title=\"class or interface in pkg2\" class=\"externalLink\"><code>link to pkg2.C2</code></a>\n"
+ " <br>\n"
+ " <a href=\"../../copy/out1/mylib/lang/StringBuilderChild.html?is-external=true\" "
- + "title=\"class or interface in mylib.lang\">"
+ + "title=\"class or interface in mylib.lang\" class=\"externalLink\">"
+ "<code>link to mylib.lang.StringBuilderChild</code></a>.</div>\n"
);
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/jdk/javadoc/doclet/testModules/TestModulePackages.java Mon Dec 18 10:28:43 2017 -0800
@@ -0,0 +1,488 @@
+/*
+ * 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * 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.
+ */
+
+/*
+ * @test
+ * @bug 8178070
+ * @summary Test packages table in module summary pages
+ * @library /tools/lib ../lib
+ * @modules jdk.compiler/com.sun.tools.javac.api
+ * jdk.compiler/com.sun.tools.javac.main
+ * jdk.javadoc/jdk.javadoc.internal.tool
+ * @build toolbox.ModuleBuilder toolbox.ToolBox JavadocTester
+ * @run main TestModulePackages
+ */
+
+import java.io.IOException;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.Set;
+
+import toolbox.ModuleBuilder;
+import toolbox.ToolBox;
+
+public class TestModulePackages extends JavadocTester {
+ enum TabKind { EXPORTS, OPENS, CONCEALED };
+ enum ColKind { EXPORTED_TO, OPENED_TO };
+
+ public static void main(String... args) throws Exception {
+ TestModulePackages tester = new TestModulePackages();
+ tester.runTests(m -> new Object[] { Paths.get(m.getName()) });
+ }
+
+ private final ToolBox tb;
+
+ public TestModulePackages() {
+ tb = new ToolBox();
+ }
+
+ // @Test: See: https://bugs.openjdk.java.net/browse/JDK-8193107
+ public void empty(Path base) throws Exception {
+ Path src = base.resolve("src");
+ new ModuleBuilder(tb, "m")
+ .comment("empty module")
+ .write(src);
+
+ javadoc("-d", base.resolve("out").toString(),
+ "-quiet",
+ "-noindex",
+ "--module-source-path", src.toString(),
+ "--module", "m");
+
+ checkExit(Exit.OK);
+ checkOutput("m-summary.html", false,
+ "<h3>Packages</h3>\n"
+ + "<table class=\"packagesSummary\" summary=\"Packages table, "
+ + "listing packages, and an explanation\">");
+ }
+
+ @Test
+ public void exportSingle(Path base) throws Exception {
+ Path src = base.resolve("src");
+ new ModuleBuilder(tb, "m")
+ .comment("exports single package to all")
+ .exports("p")
+ .classes("package p; public class C { }")
+ .write(src);
+
+ javadoc("-d", base.resolve("out").toString(),
+ "-quiet",
+ "-noindex",
+ "--module-source-path", src.toString(),
+ "--module", "m");
+
+ checkExit(Exit.OK);
+ checkCaption("m", TabKind.EXPORTS);
+ checkTableHead("m");
+ checkPackageRow("m", "p", "i0", null, null, " ");
+ }
+
+ @Test
+ public void exportMultiple(Path base) throws Exception {
+ Path src = base.resolve("src");
+ new ModuleBuilder(tb, "m")
+ .comment("exports multiple packages to all")
+ .exports("p")
+ .exports("q")
+ .classes("package p; public class C { }")
+ .classes("package q; public class D { }")
+ .write(src);
+
+ javadoc("-d", base.resolve("out").toString(),
+ "-quiet",
+ "-noindex",
+ "--module-source-path", src.toString(),
+ "--module", "m");
+
+ checkExit(Exit.OK);
+ checkCaption("m", TabKind.EXPORTS);
+ checkTableHead("m");
+ checkPackageRow("m", "p", "i0", null, null, " ");
+ checkPackageRow("m", "q", "i1", null, null, " ");
+ }
+
+ @Test
+ public void exportSomeQualified(Path base) throws Exception {
+ Path src = base.resolve("src");
+ new ModuleBuilder(tb, "m")
+ .comment("exports multiple packages, some qualified")
+ .exports("p")
+ .exportsTo("q", "other")
+ .classes("package p; public class C { }")
+ .classes("package q; public class D { }")
+ .write(src);
+
+ new ModuleBuilder(tb, "other")
+ .comment("dummy module for target of export")
+ .write(src);
+
+ javadoc("-d", base.resolve("out-api").toString(),
+ "-quiet",
+ "-noindex",
+ "--module-source-path", src.toString(),
+ "--module", "m,other");
+
+ checkExit(Exit.OK);
+ checkCaption("m", TabKind.EXPORTS);
+ checkTableHead("m");
+ checkPackageRow("m", "p", "i0", null, null, " ");
+
+ javadoc("-d", base.resolve("out-all").toString(),
+ "-quiet",
+ "-noindex",
+ "--show-module-contents", "all",
+ "--module-source-path", src.toString(),
+ "--module", "m,other");
+
+ checkExit(Exit.OK);
+ checkCaption("m", TabKind.EXPORTS);
+ checkTableHead("m", ColKind.EXPORTED_TO);
+ checkPackageRow("m", "p", "i0", "All Modules", null, " ");
+ checkPackageRow("m", "q", "i1",
+ "<a href=\"other-summary.html\">other</a>", null, " ");
+ }
+
+ @Test
+ public void exportWithConcealed(Path base) throws Exception {
+ Path src = base.resolve("src");
+ new ModuleBuilder(tb, "m")
+ .comment("exports package, has concealed package")
+ .exports("p")
+ .classes("package p; public class C { }")
+ .classes("package q; public class D { }")
+ .write(src);
+
+ javadoc("-d", base.resolve("out-api").toString(),
+ "-quiet",
+ "-noindex",
+ "--module-source-path", src.toString(),
+ "--module", "m");
+
+ checkExit(Exit.OK);
+ checkCaption("m", TabKind.EXPORTS);
+ checkTableHead("m");
+ checkPackageRow("m", "p", "i0", null, null, " ");
+
+ javadoc("-d", base.resolve("out-all").toString(),
+ "-quiet",
+ "-noindex",
+ "--show-module-contents", "all",
+ "--show-packages", "all",
+ "--module-source-path", src.toString(),
+ "--module", "m");
+
+ checkExit(Exit.OK);
+ checkCaption("m", TabKind.EXPORTS, TabKind.CONCEALED);
+ checkTableHead("m", ColKind.EXPORTED_TO);
+ checkPackageRow("m", "p", "i0", "All Modules", null, " ");
+ checkPackageRow("m", "q", "i1", "None", null, " ");
+ }
+
+ @Test
+ public void exportOpenWithConcealed(Path base) throws Exception {
+ Path src = base.resolve("src");
+ new ModuleBuilder(tb, "m")
+ .comment("exports and opens qual and unqual, with concealed")
+ .exports("e.all")
+ .exportsTo("e.other", "other")
+ .opens("o.all")
+ .opensTo("o.other", "other")
+ .exports("eo")
+ .opens("eo")
+ .classes("package e.all; public class CEAll { }")
+ .classes("package e.other; public class CEOther { }")
+ .classes("package o.all; public class COAll { }")
+ .classes("package o.other; public class COOther { }")
+ .classes("package eo; public class CEO { }")
+ .classes("package c; public class C { }")
+ .write(src);
+
+ new ModuleBuilder(tb, "other")
+ .comment("dummy module for target of export and open")
+ .write(src);
+
+ javadoc("-d", base.resolve("out-api").toString(),
+ "-quiet",
+ "-noindex",
+ "--module-source-path", src.toString(),
+ "--module", "m,other");
+
+ checkExit(Exit.OK);
+ checkCaption("m", TabKind.EXPORTS, TabKind.OPENS);
+ checkTableHead("m", ColKind.EXPORTED_TO, ColKind.OPENED_TO);
+ checkPackageRow("m", "e.all", "i0", "All Modules", "None", " ");
+ checkPackageRow("m", "eo", "i1", "All Modules", "All Modules", " ");
+
+ javadoc("-d", base.resolve("out-all").toString(),
+ "-quiet",
+ "-noindex",
+ "--show-module-contents", "all",
+ "--show-packages", "all",
+ "--module-source-path", src.toString(),
+ "--module", "m,other");
+
+ checkExit(Exit.OK);
+ checkCaption("m", TabKind.EXPORTS, TabKind.OPENS, TabKind.CONCEALED);
+ checkTableHead("m", ColKind.EXPORTED_TO, ColKind.OPENED_TO);
+ checkPackageRow("m", "c", "i0", "None", "None", " ");
+ checkPackageRow("m", "e.all", "i1", "All Modules", "None", " ");
+ checkPackageRow("m", "e.other", "i2",
+ "<a href=\"other-summary.html\">other</a>", "None", " ");
+ checkPackageRow("m", "eo", "i3", "All Modules", "All Modules", " ");
+ checkPackageRow("m", "o.all", "i4", "None", "All Modules", " ");
+ checkPackageRow("m", "o.other", "i5", "None",
+ "<a href=\"other-summary.html\">other</a>", " ");
+ }
+
+ @Test
+ public void openModule(Path base) throws Exception {
+ Path src = base.resolve("src");
+ new ModuleBuilder(tb, true, "m")
+ .comment("open module")
+ .classes("/** implicitly open package */ package p;")
+ .classes("package p; public class C { } ")
+ .classes("/** implicitly open package */ package q;")
+ .classes("package q; public class D { }")
+ .write(src);
+
+ javadoc("-d", base.resolve("out").toString(),
+ "-quiet",
+ "-noindex",
+ "--show-packages", "all", // required, to show open packages; see JDK-8193107
+ "--module-source-path", src.toString(),
+ "--module", "m");
+
+ checkExit(Exit.OK);
+ checkCaption("m", TabKind.OPENS);
+ checkTableHead("m");
+ checkPackageRow("m", "p", "i0", null, null,
+ "\n<div class=\"block\">implicitly open package</div>\n");
+ checkPackageRow("m", "q", "i1", null, null,
+ "\n<div class=\"block\">implicitly open package</div>\n");
+ }
+ @Test
+ public void openSingle(Path base) throws Exception {
+ Path src = base.resolve("src");
+ new ModuleBuilder(tb, "m")
+ .comment("opens single package to all")
+ .opens("p")
+ .classes("package p; public class C { }")
+ .write(src);
+
+ javadoc("-d", base.resolve("out").toString(),
+ "-quiet",
+ "-noindex",
+ "--show-packages", "all", // required, to show open packages; see JDK-8193107
+ "--module-source-path", src.toString(),
+ "--module", "m");
+
+ checkExit(Exit.OK);
+ checkCaption("m", TabKind.OPENS);
+ checkTableHead("m");
+ checkPackageRow("m", "p", "i0", null, null, " ");
+ }
+
+ @Test
+ public void openMultiple(Path base) throws Exception {
+ Path src = base.resolve("src");
+ new ModuleBuilder(tb, "m")
+ .comment("opens multiple packages to all")
+ .opens("p")
+ .opens("q")
+ .classes("package p; public class C { }")
+ .classes("package q; public class D { }")
+ .write(src);
+
+ javadoc("-d", base.resolve("out").toString(),
+ "-quiet",
+ "-noindex",
+ "--show-packages", "all", // required, to show open packages; see JDK-8193107
+ "--module-source-path", src.toString(),
+ "--module", "m");
+
+ checkExit(Exit.OK);
+ checkCaption("m", TabKind.OPENS);
+ checkTableHead("m");
+ checkPackageRow("m", "p", "i0", null, null, " ");
+ checkPackageRow("m", "q", "i1", null, null, " ");
+ }
+
+ @Test
+ public void openSomeQualified(Path base) throws Exception {
+ Path src = base.resolve("src");
+ new ModuleBuilder(tb, "m")
+ .comment("opens multiple packages, some qualified")
+ .opens("p")
+ .opensTo("q", "other")
+ .classes("package p; public class C { }")
+ .classes("package q; public class D { }")
+ .write(src);
+
+ new ModuleBuilder(tb, "other")
+ .comment("dummy module for target of export")
+ .write(src);
+
+ javadoc("-d", base.resolve("out-api").toString(),
+ "-quiet",
+ "-noindex",
+ "--show-packages", "all", // required, to show open packages; see JDK-8193107
+ "--module-source-path", src.toString(),
+ "--module", "m,other");
+
+ checkExit(Exit.OK);
+ checkCaption("m", TabKind.OPENS);
+ checkTableHead("m");
+ checkPackageRow("m", "p", "i0", null, null, " ");
+
+ javadoc("-d", base.resolve("out-all").toString(),
+ "-quiet",
+ "-noindex",
+ "--show-packages", "all", // required, to show open packages; see JDK-8193107
+ "--show-module-contents", "all",
+ "--module-source-path", src.toString(),
+ "--module", "m,other");
+
+ checkExit(Exit.OK);
+ checkCaption("m", TabKind.OPENS);
+ checkTableHead("m", ColKind.OPENED_TO);
+ checkPackageRow("m", "p", "i0", null, "All Modules", " ");
+ checkPackageRow("m", "q", "i1", null,
+ "<a href=\"other-summary.html\">other</a>", " ");
+ }
+
+ @Test
+ public void openWithConcealed(Path base) throws Exception {
+ Path src = base.resolve("src");
+ new ModuleBuilder(tb, "m")
+ .comment("opens package, has concealed package")
+ .opens("p")
+ .classes("package p; public class C { }")
+ .classes("package q; public class D { }")
+ .write(src);
+
+ javadoc("-d", base.resolve("out-api").toString(),
+ "-quiet",
+ "-noindex",
+ "--show-packages", "all", // required, to show open packages; see JDK-8193107
+ "--module-source-path", src.toString(),
+ "--module", "m");
+
+ checkExit(Exit.OK);
+ checkCaption("m", TabKind.OPENS);
+ checkTableHead("m");
+ checkPackageRow("m", "p", "i0", null, null, " ");
+
+ javadoc("-d", base.resolve("out-all").toString(),
+ "-quiet",
+ "-noindex",
+ "--show-module-contents", "all",
+ "--show-packages", "all",
+ "--module-source-path", src.toString(),
+ "--module", "m");
+
+ checkExit(Exit.OK);
+ checkCaption("m", TabKind.OPENS, TabKind.CONCEALED);
+ checkTableHead("m", ColKind.OPENED_TO);
+ checkPackageRow("m", "p", "i0", null, "All Modules", " ");
+ checkPackageRow("m", "q", "i1", null, "None", " ");
+ }
+
+
+ private void checkCaption(String moduleName, TabKind... kinds) {
+ String expect;
+ if (kinds.length > 1) {
+ Set<TabKind> kindSet = Set.of(kinds);
+ StringBuilder sb = new StringBuilder();
+ sb.append("<caption>"
+ + "<span id=\"t0\" class=\"activeTableTab\">"
+ + "<span>All Packages</span>"
+ + "<span class=\"tabEnd\"> </span></span>");
+ if (kindSet.contains(TabKind.EXPORTS)) {
+ sb.append("<span id=\"t1\" class=\"tableTab\">"
+ + "<span><a href=\"javascript:showPkgs(1);\">Exports</a></span>"
+ + "<span class=\"tabEnd\"> </span></span>");
+ }
+ if (kindSet.contains(TabKind.OPENS)) {
+ sb.append("<span id=\"t2\" class=\"tableTab\">"
+ + "<span><a href=\"javascript:showPkgs(2);\">Opens</a></span>"
+ + "<span class=\"tabEnd\"> </span></span>");
+ }
+ if (kindSet.contains(TabKind.CONCEALED)) {
+ sb.append("<span id=\"t3\" class=\"tableTab\"><span>"
+ + "<a href=\"javascript:showPkgs(4);\">Concealed</a></span>"
+ + "<span class=\"tabEnd\"> </span></span>");
+ }
+ sb.append("</caption>");
+ expect = sb.toString();
+ } else {
+ TabKind k = kinds[0];
+ String name = k.toString().charAt(0) + k.toString().substring(1).toLowerCase();
+ expect = "<caption>"
+ + "<span>" + name + "</span>"
+ + "<span class=\"tabEnd\"> </span>"
+ + "</caption>";
+ }
+
+ checkOutput(moduleName + "-summary.html", true, expect);
+ }
+
+
+ private void checkTableHead(String moduleName, ColKind... kinds) {
+ Set<ColKind> kindSet = Set.of(kinds);
+ StringBuilder sb = new StringBuilder();
+ sb.append("<tr>\n"
+ + "<th class=\"colFirst\" scope=\"col\">Package</th>\n");
+ if (kindSet.contains(ColKind.EXPORTED_TO)) {
+ sb.append("<th class=\"colSecond\" scope=\"col\">Exported To Modules</th>\n");
+ }
+ if (kindSet.contains(ColKind.OPENED_TO)) {
+ sb.append("<th class=\"colSecond\" scope=\"col\">Opened To Modules</th>\n");
+ }
+ sb.append("<th class=\"colLast\" scope=\"col\">Description</th>\n"
+ + "</tr>");
+
+ checkOutput(moduleName + "-summary.html", true, sb.toString());
+ }
+
+ private void checkPackageRow(String moduleName, String packageName,
+ String id, String exportedTo, String openedTo, String desc) {
+ StringBuilder sb = new StringBuilder();
+ int idNum = Integer.parseInt(id.substring(1));
+ String color = (idNum % 2 == 1 ? "rowColor" : "altColor");
+ sb.append("<tr class=\"" + color + "\" id=\"" + id + "\">\n"
+ + "<th class=\"colFirst\" scope=\"row\">"
+ + "<a href=\"" + packageName.replace('.', '/') + "/package-summary.html\">"
+ + packageName + "</a></th>\n");
+ if (exportedTo != null) {
+ sb.append("<td class=\"colSecond\">" + exportedTo + "</td>\n");
+ }
+ if (openedTo != null) {
+ sb.append("<td class=\"colSecond\">" + openedTo + "</td>\n");
+ }
+ sb.append("<td class=\"colLast\">" + desc + "</td>");
+
+ checkOutput(moduleName + "-summary.html", true, sb.toString());
+ }
+
+}
+
--- a/test/langtools/jdk/javadoc/doclet/testModules/TestModules.java Wed Dec 13 14:21:12 2017 -0800
+++ b/test/langtools/jdk/javadoc/doclet/testModules/TestModules.java Mon Dec 18 10:28:43 2017 -0800
@@ -26,6 +26,7 @@
* @bug 8154119 8154262 8156077 8157987 8154261 8154817 8135291 8155995 8162363
* 8168766 8168688 8162674 8160196 8175799 8174974 8176778 8177562 8175218
* 8175823 8166306 8178043 8181622 8183511 8169819 8074407 8183037 8191464
+ 8164407
* @summary Test modules support in javadoc.
* @author bpatel
* @library ../lib
@@ -45,7 +46,7 @@
*/
@Test
void testHtml4() {
- javadoc("-d", "out", "-use",
+ javadoc("-d", "out", "-use", "-Xdoclint:none",
"-overview", testSrc("overview.html"),
"--module-source-path", testSrc,
"--module", "moduleA,moduleB",
@@ -67,7 +68,7 @@
*/
@Test
void testHtml5() {
- javadoc("-d", "out-html5", "-html5", "-use",
+ javadoc("-d", "out-html5", "-html5", "-use", "-Xdoclint:none",
"-overview", testSrc("overview.html"),
"--module-source-path", testSrc,
"--module", "moduleA,moduleB",
@@ -89,7 +90,7 @@
*/
@Test
void testHtml4NoComment() {
- javadoc("-d", "out-nocomment", "-nocomment", "-use",
+ javadoc("-d", "out-nocomment", "-nocomment", "-use", "-Xdoclint:none",
"-overview", testSrc("overview.html"),
"--module-source-path", testSrc,
"--module", "moduleA,moduleB",
@@ -107,7 +108,7 @@
*/
@Test
void testHtml5NoComment() {
- javadoc("-d", "out-html5-nocomment", "-nocomment", "-html5", "-use",
+ javadoc("-d", "out-html5-nocomment", "-nocomment", "-html5", "-use", "-Xdoclint:none",
"-overview", testSrc("overview.html"),
"--module-source-path", testSrc,
"--module", "moduleA,moduleB",
@@ -158,7 +159,7 @@
*/
@Test
void testJDTagsInModules() {
- javadoc("-d", "out-mdltags", "-author", "-version",
+ javadoc("-d", "out-mdltags", "-author", "-version", "-Xdoclint:none",
"-tag", "regular:a:Regular Tag:",
"-tag", "moduletag:s:Module Tag:",
"--module-source-path", testSrc,
@@ -173,7 +174,7 @@
*/
@Test
void testModuleSummary() {
- javadoc("-d", "out-moduleSummary", "-use",
+ javadoc("-d", "out-moduleSummary", "-use", "-Xdoclint:none",
"--module-source-path", testSrc,
"--module", "moduleA,moduleB",
"testpkgmdlA", "testpkgmdlB", "moduleB/testpkg2mdlB");
@@ -200,7 +201,7 @@
*/
@Test
void testModuleFilesAndLinks() {
- javadoc("-d", "out-modulelinks",
+ javadoc("-d", "out-modulelinks", "-Xdoclint:none",
"--module-source-path", testSrc,
"--module", "moduleA,moduleB",
"testpkgmdlA", "testpkgmdlB");
@@ -214,7 +215,7 @@
*/
@Test
void testModuleDeprecation() {
- javadoc("-d", "out-moduledepr",
+ javadoc("-d", "out-moduledepr", "-Xdoclint:none",
"-tag", "regular:a:Regular Tag:",
"-tag", "moduletag:s:Module Tag:",
"--module-source-path", testSrc,
@@ -229,7 +230,7 @@
*/
@Test
void testModuleAnnotation() {
- javadoc("-d", "out-moduleanno",
+ javadoc("-d", "out-moduleanno", "-Xdoclint:none",
"--module-source-path", testSrc,
"--module", "moduleA,moduleB",
"testpkgmdlA", "testpkgmdlB");
@@ -242,7 +243,7 @@
*/
@Test
void testApiMode() {
- javadoc("-d", "out-api", "-use", "--show-module-contents=api", "-author", "-version",
+ javadoc("-d", "out-api", "-use", "--show-module-contents=api", "-author", "-version", "-Xdoclint:none",
"-tag", "regular:a:Regular Tag:",
"-tag", "moduletag:s:Module Tag:",
"--module-source-path", testSrc,
@@ -261,7 +262,7 @@
*/
@Test
void testAllMode() {
- javadoc("-d", "out-all", "-use", "--show-module-contents=all", "-author", "-version",
+ javadoc("-d", "out-all", "-use", "--show-module-contents=all", "-author", "-version", "-Xdoclint:none",
"-tag", "regular:a:Regular Tag:",
"-tag", "moduletag:s:Module Tag:",
"--module-source-path", testSrc,
@@ -319,7 +320,7 @@
*/
@Test
void testSingleModuleMultiplePkg() {
- javadoc("-d", "out-singlemodmultiplepkg", "--show-module-contents=all",
+ javadoc("-d", "out-singlemodmultiplepkg", "--show-module-contents=all", "-Xdoclint:none",
"--module-source-path", testSrc,
"--module", "moduleB",
"testpkg2mdlB", "testpkgmdlB");
@@ -332,7 +333,7 @@
*/
@Test
void testGroupOption() {
- javadoc("-d", "out-group", "--show-module-contents=all",
+ javadoc("-d", "out-group", "--show-module-contents=all", "-Xdoclint:none",
"-tag", "regular:a:Regular Tag:",
"-tag", "moduletag:s:Module Tag:",
"--module-source-path", testSrc,
@@ -353,7 +354,7 @@
*/
@Test
void testGroupOptionOrdering() {
- javadoc("-d", "out-groupOrder", "--show-module-contents=all",
+ javadoc("-d", "out-groupOrder", "--show-module-contents=all", "-Xdoclint:none",
"-tag", "regular:a:Regular Tag:",
"-tag", "moduletag:s:Module Tag:",
"--module-source-path", testSrc,
@@ -373,7 +374,7 @@
*/
@Test
void testUnnamedModuleGroupOption() {
- javadoc("-d", "out-groupnomodule", "-use",
+ javadoc("-d", "out-groupnomodule", "-use", "-Xdoclint:none",
"-overview", testSrc("overview.html"),
"-sourcepath", testSrc,
"-group", "Package Group 0", "testpkgnomodule",
@@ -390,7 +391,7 @@
*/
@Test
void testGroupOptionPackageOrdering() {
- javadoc("-d", "out-groupPkgOrder", "-use",
+ javadoc("-d", "out-groupPkgOrder", "-use", "-Xdoclint:none",
"-overview", testSrc("overview.html"),
"-sourcepath", testSrc,
"-group", "Z Group", "testpkgnomodule",
@@ -405,7 +406,7 @@
*/
@Test
void testGroupOptionSingleModule() {
- javadoc("-d", "out-groupsinglemodule", "-use",
+ javadoc("-d", "out-groupsinglemodule", "-use", "-Xdoclint:none",
"--module-source-path", testSrc,
"-group", "Module Group B", "moduleB*",
"--module", "moduleB",
@@ -419,7 +420,7 @@
*/
@Test
void testModuleName() {
- javadoc("-d", "out-modulename", "-use",
+ javadoc("-d", "out-modulename", "-use", "-Xdoclint:none",
"--module-source-path", testSrc,
"--module", "moduleB,test.moduleFullName",
"testpkg2mdlB", "testpkgmdlB", "testpkgmdlfullname");
@@ -427,6 +428,21 @@
checkModuleName(true);
}
+ /**
+ * Test -linkoffline option.
+ */
+ @Test
+ void testLinkOffline() {
+ String url = "https://docs.oracle.com/javase/9/docs/api/";
+ javadoc("-d", "out-linkoffline", "-use", "--show-module-contents=all", "-Xdoclint:none",
+ "--module-source-path", testSrc,
+ "--module", "moduleA,moduleB",
+ "-linkoffline", url, testSrc + "/jdk",
+ "testpkgmdlA", "testpkgmdlB", "testpkg3mdlB");
+ checkExit(Exit.OK);
+ checkLinkOffline();
+ }
+
void checkDescription(boolean found) {
checkOutput("moduleA-summary.html", found,
"<!-- ============ MODULE DESCRIPTION =========== -->\n"
@@ -978,7 +994,7 @@
+ "</tr>\n"
+ "</tbody>\n"
+ "</table>");
- checkOutput("moduletags-summary.html", found,
+ checkOutput("moduletags-summary.html", true,
"<th class=\"colFirst\" scope=\"row\"><a href=\"testpkgmdltags/package-summary.html\">testpkgmdltags</a></th>\n"
+ "<td class=\"colLast\"> </td>");
}
@@ -1009,6 +1025,7 @@
"<li><a href=\"#module.description\">Description</a> | <a href=\"#modules.summary\">"
+ "Modules</a> | <a href=\"#packages.summary\">Packages</a> | <a href=\"#services.summary\">Services</a></li>",
"<th class=\"colFirst\" scope=\"row\"><a href=\"testpkgmdlB/package-summary.html\">testpkgmdlB</a></th>\n"
+ + "<td class=\"colSecond\">None</td>\n"
+ "<td class=\"colSecond\">All Modules</td>\n"
+ "<td class=\"colLast\"> </td>",
"<td class=\"colFirst\"> </td>\n"
@@ -1029,12 +1046,11 @@
"<caption><span>Exports</span><span class=\"tabEnd\"> </span></caption>\n"
+ "<tr>\n"
+ "<th class=\"colFirst\" scope=\"col\">Package</th>\n"
- + "<th class=\"colSecond\" scope=\"col\">Module</th>\n"
+ + "<th class=\"colSecond\" scope=\"col\">Exported To Modules</th>\n"
+ "<th class=\"colLast\" scope=\"col\">Description</th>\n"
+ "</tr>");
- checkOutput("moduletags-summary.html", found,
+ checkOutput("moduletags-summary.html", true,
"<th class=\"colFirst\" scope=\"row\"><a href=\"testpkgmdltags/package-summary.html\">testpkgmdltags</a></th>\n"
- + "<td class=\"colSecond\">All Modules</td>\n"
+ "<td class=\"colLast\"> </td>");
}
@@ -1205,4 +1221,16 @@
+ "</dd>\n"
+ "</dl>");
}
+
+ void checkLinkOffline() {
+ checkOutput("testpkg3mdlB/package-summary.html", true,
+ "<a href=\"https://docs.oracle.com/javase/9/docs/api/java/lang/String.html?is-external=true\" "
+ + "title=\"class or interface in java.lang\" class=\"externalLink\"><code>Link to String Class</code></a>");
+ checkOutput("testpkg3mdlB/package-summary.html", true,
+ "<a href=\"https://docs.oracle.com/javase/9/docs/api/java/lang/package-summary.html?is-external=true\" "
+ + "class=\"externalLink\"><code>Link to java.lang package</code></a>");
+ checkOutput("testpkg3mdlB/package-summary.html", true,
+ "<a href=\"https://docs.oracle.com/javase/9/docs/api/java.base-summary.html?is-external=true\" "
+ + "class=\"externalLink\"><code>Link to java.base module</code></a>");
}
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/jdk/javadoc/doclet/testModules/jdk/element-list Mon Dec 18 10:28:43 2017 -0800
@@ -0,0 +1,343 @@
+module:java.activation
+javax.activation
+module:java.base
+java.io
+java.lang
+java.lang.annotation
+java.lang.invoke
+java.lang.module
+java.lang.ref
+java.lang.reflect
+java.math
+java.net
+java.net.spi
+java.nio
+java.nio.channels
+java.nio.channels.spi
+java.nio.charset
+java.nio.charset.spi
+java.nio.file
+java.nio.file.attribute
+java.nio.file.spi
+java.security
+java.security.acl
+java.security.cert
+java.security.interfaces
+java.security.spec
+java.text
+java.text.spi
+java.time
+java.time.chrono
+java.time.format
+java.time.temporal
+java.time.zone
+java.util
+java.util.concurrent
+java.util.concurrent.atomic
+java.util.concurrent.locks
+java.util.function
+java.util.jar
+java.util.regex
+java.util.spi
+java.util.stream
+java.util.zip
+javax.crypto
+javax.crypto.interfaces
+javax.crypto.spec
+javax.net
+javax.net.ssl
+javax.security.auth
+javax.security.auth.callback
+javax.security.auth.login
+javax.security.auth.spi
+javax.security.auth.x500
+javax.security.cert
+module:java.compiler
+javax.annotation.processing
+javax.lang.model
+javax.lang.model.element
+javax.lang.model.type
+javax.lang.model.util
+javax.tools
+module:java.corba
+javax.activity
+javax.rmi
+javax.rmi.CORBA
+org.omg.CORBA
+org.omg.CORBA_2_3
+org.omg.CORBA_2_3.portable
+org.omg.CORBA.DynAnyPackage
+org.omg.CORBA.ORBPackage
+org.omg.CORBA.portable
+org.omg.CORBA.TypeCodePackage
+org.omg.CosNaming
+org.omg.CosNaming.NamingContextExtPackage
+org.omg.CosNaming.NamingContextPackage
+org.omg.Dynamic
+org.omg.DynamicAny
+org.omg.DynamicAny.DynAnyFactoryPackage
+org.omg.DynamicAny.DynAnyPackage
+org.omg.IOP
+org.omg.IOP.CodecFactoryPackage
+org.omg.IOP.CodecPackage
+org.omg.Messaging
+org.omg.PortableInterceptor
+org.omg.PortableInterceptor.ORBInitInfoPackage
+org.omg.PortableServer
+org.omg.PortableServer.CurrentPackage
+org.omg.PortableServer.POAManagerPackage
+org.omg.PortableServer.POAPackage
+org.omg.PortableServer.portable
+org.omg.PortableServer.ServantLocatorPackage
+org.omg.SendingContext
+org.omg.stub.java.rmi
+module:java.datatransfer
+java.awt.datatransfer
+module:java.desktop
+java.applet
+java.awt
+java.awt.color
+java.awt.desktop
+java.awt.dnd
+java.awt.event
+java.awt.font
+java.awt.geom
+java.awt.im
+java.awt.im.spi
+java.awt.image
+java.awt.image.renderable
+java.awt.print
+java.beans
+java.beans.beancontext
+javax.accessibility
+javax.imageio
+javax.imageio.event
+javax.imageio.metadata
+javax.imageio.plugins.bmp
+javax.imageio.plugins.jpeg
+javax.imageio.plugins.tiff
+javax.imageio.spi
+javax.imageio.stream
+javax.print
+javax.print.attribute
+javax.print.attribute.standard
+javax.print.event
+javax.sound.midi
+javax.sound.midi.spi
+javax.sound.sampled
+javax.sound.sampled.spi
+javax.swing
+javax.swing.border
+javax.swing.colorchooser
+javax.swing.event
+javax.swing.filechooser
+javax.swing.plaf
+javax.swing.plaf.basic
+javax.swing.plaf.metal
+javax.swing.plaf.multi
+javax.swing.plaf.nimbus
+javax.swing.plaf.synth
+javax.swing.table
+javax.swing.text
+javax.swing.text.html
+javax.swing.text.html.parser
+javax.swing.text.rtf
+javax.swing.tree
+javax.swing.undo
+module:java.instrument
+java.lang.instrument
+module:java.logging
+java.util.logging
+module:java.management
+java.lang.management
+javax.management
+javax.management.loading
+javax.management.modelmbean
+javax.management.monitor
+javax.management.openmbean
+javax.management.relation
+javax.management.remote
+javax.management.timer
+module:java.management.rmi
+javax.management.remote.rmi
+module:java.naming
+javax.naming
+javax.naming.directory
+javax.naming.event
+javax.naming.ldap
+javax.naming.spi
+module:java.prefs
+java.util.prefs
+module:java.rmi
+java.rmi
+java.rmi.activation
+java.rmi.dgc
+java.rmi.registry
+java.rmi.server
+javax.rmi.ssl
+module:java.scripting
+javax.script
+module:java.se
+module:java.se.ee
+module:java.security.jgss
+javax.security.auth.kerberos
+org.ietf.jgss
+module:java.security.sasl
+javax.security.sasl
+module:java.smartcardio
+javax.smartcardio
+module:java.sql
+java.sql
+javax.sql
+javax.transaction.xa
+module:java.sql.rowset
+javax.sql.rowset
+javax.sql.rowset.serial
+javax.sql.rowset.spi
+module:java.transaction
+javax.transaction
+module:java.xml
+javax.xml
+javax.xml.catalog
+javax.xml.datatype
+javax.xml.namespace
+javax.xml.parsers
+javax.xml.stream
+javax.xml.stream.events
+javax.xml.stream.util
+javax.xml.transform
+javax.xml.transform.dom
+javax.xml.transform.sax
+javax.xml.transform.stax
+javax.xml.transform.stream
+javax.xml.validation
+javax.xml.xpath
+org.w3c.dom
+org.w3c.dom.bootstrap
+org.w3c.dom.events
+org.w3c.dom.ls
+org.w3c.dom.ranges
+org.w3c.dom.traversal
+org.w3c.dom.views
+org.xml.sax
+org.xml.sax.ext
+org.xml.sax.helpers
+module:java.xml.bind
+javax.xml.bind
+javax.xml.bind.annotation
+javax.xml.bind.annotation.adapters
+javax.xml.bind.attachment
+javax.xml.bind.helpers
+javax.xml.bind.util
+module:java.xml.crypto
+javax.xml.crypto
+javax.xml.crypto.dom
+javax.xml.crypto.dsig
+javax.xml.crypto.dsig.dom
+javax.xml.crypto.dsig.keyinfo
+javax.xml.crypto.dsig.spec
+module:java.xml.ws
+javax.jws
+javax.jws.soap
+javax.xml.soap
+javax.xml.ws
+javax.xml.ws.handler
+javax.xml.ws.handler.soap
+javax.xml.ws.http
+javax.xml.ws.soap
+javax.xml.ws.spi
+javax.xml.ws.spi.http
+javax.xml.ws.wsaddressing
+module:java.xml.ws.annotation
+javax.annotation
+module:jdk.accessibility
+com.sun.java.accessibility.util
+module:jdk.attach
+com.sun.tools.attach
+com.sun.tools.attach.spi
+module:jdk.charsets
+module:jdk.compiler
+com.sun.source.doctree
+com.sun.source.tree
+com.sun.source.util
+com.sun.tools.javac
+module:jdk.crypto.cryptoki
+module:jdk.crypto.ec
+module:jdk.dynalink
+jdk.dynalink
+jdk.dynalink.beans
+jdk.dynalink.linker
+jdk.dynalink.linker.support
+jdk.dynalink.support
+module:jdk.editpad
+module:jdk.hotspot.agent
+module:jdk.httpserver
+com.sun.net.httpserver
+com.sun.net.httpserver.spi
+module:jdk.incubator.httpclient
+jdk.incubator.http
+module:jdk.jartool
+com.sun.jarsigner
+jdk.security.jarsigner
+module:jdk.javadoc
+com.sun.javadoc
+com.sun.tools.javadoc
+jdk.javadoc.doclet
+module:jdk.jcmd
+module:jdk.jconsole
+com.sun.tools.jconsole
+module:jdk.jdeps
+module:jdk.jdi
+com.sun.jdi
+com.sun.jdi.connect
+com.sun.jdi.connect.spi
+com.sun.jdi.event
+com.sun.jdi.request
+module:jdk.jdwp.agent
+module:jdk.jfr
+jdk.jfr
+jdk.jfr.consumer
+module:jdk.jlink
+module:jdk.jshell
+jdk.jshell
+jdk.jshell.execution
+jdk.jshell.spi
+jdk.jshell.tool
+module:jdk.jsobject
+netscape.javascript
+module:jdk.jstatd
+module:jdk.localedata
+module:jdk.management
+com.sun.management
+module:jdk.management.agent
+module:jdk.management.cmm
+jdk.management.cmm
+module:jdk.management.jfr
+jdk.management.jfr
+module:jdk.management.resource
+jdk.management.resource
+module:jdk.naming.dns
+module:jdk.naming.rmi
+module:jdk.net
+jdk.net
+module:jdk.pack
+module:jdk.rmic
+module:jdk.scripting.nashorn
+jdk.nashorn.api.scripting
+jdk.nashorn.api.tree
+module:jdk.sctp
+com.sun.nio.sctp
+module:jdk.security.auth
+com.sun.security.auth
+com.sun.security.auth.callback
+com.sun.security.auth.login
+com.sun.security.auth.module
+module:jdk.security.jgss
+com.sun.security.jgss
+module:jdk.snmp
+module:jdk.xml.dom
+org.w3c.dom.css
+org.w3c.dom.html
+org.w3c.dom.stylesheets
+org.w3c.dom.xpath
+module:jdk.zipfs
--- a/test/langtools/jdk/javadoc/doclet/testModules/moduleB/module-info.java Wed Dec 13 14:21:12 2017 -0800
+++ b/test/langtools/jdk/javadoc/doclet/testModules/moduleB/module-info.java Mon Dec 18 10:28:43 2017 -0800
@@ -36,6 +36,7 @@
opens testpkgmdlB;
exports testpkg2mdlB to moduleA;
+ exports testpkg3mdlB to moduleA;
uses testpkgmdlB.TestClassInModuleB;
uses testpkgmdlB.TestClass2InModuleB;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/jdk/javadoc/doclet/testModules/moduleB/testpkg3mdlB/TestClassLinkOption.java Mon Dec 18 10:28:43 2017 -0800
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 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
+ * 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 testpkg3mdlB;
+
+/**
+ * {@link java.lang.String Link to String Class}.<br>
+ * {@link java.lang Link to java.lang package}.<br>
+ * {@link java.base Link to java.base module}.
+ *
+ * @author bhavespa
+ */
+public class TestClassLinkOption {
+ public String testMethod() {
+ return "foo";
+ }
+}
--- a/test/langtools/jdk/javadoc/doclet/testTitleInHref/TestTitleInHref.java Wed Dec 13 14:21:12 2017 -0800
+++ b/test/langtools/jdk/javadoc/doclet/testTitleInHref/TestTitleInHref.java Mon Dec 18 10:28:43 2017 -0800
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 4714257
+ * @bug 4714257 8164407
* @summary Test to make sure that the title attribute shows up in links.
* @author jamieh
* @library ../lib
@@ -55,7 +55,7 @@
"<a href=\"../pkg/Interface.html\" title=\"interface in pkg\">",
//Test to make sure that the title shows up in cross link shows up
"<a href=\"" + uri + "/java/io/File.html?is-external=true\" "
- + "title=\"class or interface in java.io\">"
+ + "title=\"class or interface in java.io\" class=\"externalLink\">"
+ "<code>This is a cross link to class File</code></a>");
}
}
--- a/test/langtools/jdk/javadoc/tool/api/basic/APITest.java Wed Dec 13 14:21:12 2017 -0800
+++ b/test/langtools/jdk/javadoc/tool/api/basic/APITest.java Mon Dec 18 10:28:43 2017 -0800
@@ -227,7 +227,7 @@
"member-search-index.js",
"member-search-index.zip",
"overview-tree.html",
- "package-list",
+ "element-list",
"package-search-index.js",
"package-search-index.zip",
"pkg/C.html",
--- a/test/langtools/tools/javac/T8152360/DeprecateJavahTest.java Wed Dec 13 14:21:12 2017 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,79 +0,0 @@
-/*
- * Copyright (c) 2016, 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.
- *
- * 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.
- */
-
-/*
- * @test
- * @bug 8152360
- * @summary deprecate javah
- * @library /tools/lib
- * @modules jdk.compiler/com.sun.tools.javac.api
- * jdk.compiler/com.sun.tools.javac.main
- * jdk.compiler/com.sun.tools.javah
- * @build toolbox.ToolBox toolbox.JavahTask
- * @run main DeprecateJavahTest
- */
-
-import toolbox.JavahTask;
-import toolbox.Task;
-import toolbox.ToolBox;
-
-public class DeprecateJavahTest {
- public static void main(String... args) throws Exception {
- new DeprecateJavahTest().run();
- }
-
- ToolBox tb = new ToolBox();
-
- void printDeprecationWarning() throws Exception {
- String output = new JavahTask(tb)
- .options("-version")
- .run()
- .writeAll()
- .getOutput(Task.OutputKind.DIRECT);
-
- if (!output.contains(
- "Warning: The javah tool is planned to be removed in the next major\n" +
- "JDK release. The tool has been superseded by the '-h' option added\n" +
- "to javac in JDK 8. Users are recommended to migrate to using the\n" +
- "javac '-h' option; see the javac man page for more information.")) {
- throw new Exception("test failed");
- }
- }
-
- void dontPrintDeprecationWarning() throws Exception {
- String output = new JavahTask(tb)
- .options("-version", "-XDsuppress-tool-removal-message")
- .run()
- .writeAll()
- .getOutput(Task.OutputKind.DIRECT);
-
- if (!output.startsWith("javah version")) {
- throw new Exception("test failed");
- }
- }
-
- void run() throws Exception {
- printDeprecationWarning();
- dontPrintDeprecationWarning();
- }
-}
--- a/test/langtools/tools/javac/nativeHeaders/javahComparison/CompareTest.java Wed Dec 13 14:21:12 2017 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,170 +0,0 @@
-/*
- * Copyright (c) 2007, 2016, 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.
- *
- * 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.
- */
-
-/*
- * @test
- * @bug 7150368 8003412 8000407 8031545
- * @summary javac should include basic ability to generate native headers
- * @modules jdk.compiler/com.sun.tools.javah
- */
-
-import java.io.File;
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.nio.file.Files;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-public class CompareTest {
- public static void main(String... args) throws Exception {
- new CompareTest().run();
- }
-
- void run() throws Exception {
- File srcDir = new File(System.getProperty("test.src"));
- File classesDir = new File("classes");
- classesDir.mkdirs();
- File javacHeaders = new File("headers.javac");
- javacHeaders.mkdirs();
- File javahHeaders = new File("headers.javah");
- javahHeaders.mkdirs();
-
- List<String> javacArgs = new ArrayList<String>();
- javacArgs.add("-d");
- javacArgs.add(classesDir.getPath());
- javacArgs.add("-h");
- javacArgs.add(javacHeaders.getPath());
- javacArgs.add("-XDjavah:full");
-
- for (File f: srcDir.listFiles()) {
- if (f.getName().matches("TestClass[0-9]+\\.java")) {
- sourceFileCount++;
- javacArgs.add(f.getPath());
- }
- }
-
- int rc = com.sun.tools.javac.Main.compile(javacArgs.toArray(new String[javacArgs.size()]));
- if (rc != 0)
- throw new Exception("javac failed; rc=" + rc);
-
- List<String> javahArgs = new ArrayList<String>();
- javahArgs.add("-d");
- javahArgs.add(javahHeaders.getPath());
-
- for (File f: classesDir.listFiles()) {
- if (f.getName().endsWith(".class")) {
- javahArgs.add(inferBinaryName(f));
- }
- }
-
- PrintWriter pw = new PrintWriter(System.out, true);
- rc = com.sun.tools.javah.Main.run(javahArgs.toArray(new String[javahArgs.size()]), pw);
- if (rc != 0)
- throw new Exception("javah failed; rc=" + rc);
-
- compare(javahHeaders, javacHeaders);
-
- int javahHeaderCount = javahHeaders.list().length;
- int javacHeaderCount = javacHeaders.list().length;
-
- System.out.println(sourceFileCount + " .java files found");
- System.out.println(javacHeaderCount + " .h files generated by javac");
- System.out.println(javahHeaderCount + " .h files generated by javah");
- System.out.println(compareCount + " header files compared");
-
- if (javacHeaderCount != javahHeaderCount || javacHeaderCount != compareCount)
- error("inconsistent counts");
-
- if (errors > 0)
- throw new Exception(errors + " errors occurred");
- }
-
- String inferBinaryName(File file) {
- String name = file.getName();
- return name.substring(0, name.length() - ".class".length()).replace("$", ".");
- }
-
- /** Compare two directories.
- * @param f1 The golden directory
- * @param f2 The directory to be compared
- */
- void compare(File f1, File f2) {
- compare(f1, f2, null);
- }
-
- /** Compare two files or directories
- * @param f1 The golden directory
- * @param f2 The directory to be compared
- * @param p An optional path identifying a file within the two directories
- */
- void compare(File f1, File f2, String p) {
- File f1p = (p == null ? f1 : new File(f1, p));
- File f2p = (p == null ? f2 : new File(f2, p));
- if (f1p.isDirectory() && f2p.isDirectory()) {
- Set<String> children = new HashSet<String>();
- children.addAll(Arrays.asList(f1p.list()));
- children.addAll(Arrays.asList(f2p.list()));
- for (String c: children) {
- compare(f1, f2, new File(p, c).getPath()); // null-safe for p
- }
- }
- else if (f1p.isFile() && f2p.isFile()) {
- System.out.println("checking " + p);
- compareCount++;
- String s1 = read(f1p);
- String s2 = read(f2p);
- if (!s1.equals(s2)) {
- System.out.println("File: " + f1p + "\n" + s1);
- System.out.println("File: " + f2p + "\n" + s2);
- error("Files differ: " + f1p + " " + f2p);
- }
- }
- else if (f1p.exists() && !f2p.exists())
- error("Only in " + f1 + ": " + p);
- else if (f2p.exists() && !f1p.exists())
- error("Only in " + f2 + ": " + p);
- else
- error("Files differ: " + f1p + " " + f2p);
- }
-
- private String read(File f) {
- try {
- return new String(Files.readAllBytes(f.toPath()));
- } catch (IOException e) {
- error("error reading " + f + ": " + e);
- return "";
- }
- }
-
- private void error(String msg) {
- System.out.println(msg);
- errors++;
- }
-
- private int errors;
- private int compareCount;
- private int sourceFileCount;
-}
--- a/test/langtools/tools/javac/nativeHeaders/javahComparison/TestClass1.java Wed Dec 13 14:21:12 2017 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,477 +0,0 @@
-/*
- * Copyright (c) 2007, 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.
- *
- * 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.
- */
-
-import java.util.List;
-
-public class TestClass1 {
- // simple types
- byte b;
- short s;
- int i;
- long l;
- float f;
- double d;
- Object o;
- String t;
- List<String> g;
-
- // constants
- static final byte bc = 0;
- static final short sc = 0;
- static final int ic = 0;
- static final long lc = 0;
- static final float fc = 0;
- static final double dc = 0;
- static final Object oc = null;
- static final String tc = "";
- static final List<String> gc = null;
-
- // simple arrays
- byte[] ba;
- short[] sa; // not handled corrected by javah v6
- int[] ia;
- long[] la;
- float[] fa;
- double[] da;
- Object[] oa;
- String[] ta;
- List<String>[] ga;
-
- // multidimensional arrays
- byte[][] baa;
- short[][] saa;
- int[][] iaa;
- long[][] laa;
- float[][] faa;
- double[][] daa;
- Object[][] oaa;
- String[][] taa;
- List<String>[] gaa;
-
- // simple Java methods
- byte bm() { return 0; }
- short sm() { return 0; }
- int im() { return 0; }
- long lm() { return 0; }
- float fm() { return 0; }
- double dm() { return 0; }
- Object om() { return null; }
- String tm() { return ""; }
- List<String> gm() { return null; }
- void vm() { }
- byte[] bam() { return null; }
- short[] sam() { return null; }
- int[] iam() { return null; }
- long[] lam() { return null; }
- float[] fam() { return null; }
- double[] dam() { return null; }
- Object[] oam() { return null; }
- String[] tam() { return null; }
- List<String>[] gam() { return null; }
- byte[][] baam() { return null; }
- short[][] saam() { return null; }
- int[][] iaam() { return null; }
- long[][] laam() { return null; }
- float[][] faam() { return null; }
- double[][] daam() { return null; }
- Object[][] oaam() { return null; }
- String[][] taam() { return null; }
- List<String>[] gaam() { return null; }
-
- // simple native methods
- native byte bmn();
- native short smn();
- native int imn();
- native long lmn();
- native float fmn();
- native double dmn();
- native Object omn();
- native String tmn();
- native List<String> gmn();
- native void vmn();
- native byte[] bamn();
- native short[] samn();
- native int[] iamn();
- native long[] lamn();
- native float[] famn();
- native double[] damn();
- native Object[] oamn();
- native String[] tamn();
- native List<String>[] gamn();
- native byte[][] baamn();
- native short[][] saamn();
- native int[][] iaamn();
- native long[][] laamn();
- native float[][] faamn();
- native double[][] daamn();
- native Object[][] oaamn();
- native String[][] taamn();
- native List<String>[] gaamn();
-
- // overloaded Java methods
- byte bmo() { return 0; }
- short smo() { return 0; }
- int imo() { return 0; }
- long lmo() { return 0; }
- float fmo() { return 0; }
- double dmo() { return 0; }
- Object omo() { return null; }
- String tmo() { return ""; }
- List<String> gmo() { return null; }
- void vmo() { }
-
- byte bmo(int i) { return 0; }
- short smo(int i) { return 0; }
- int imo(int i) { return 0; }
- long lmo(int i) { return 0; }
- float fmo(int i) { return 0; }
- double dmo(int i) { return 0; }
- Object omo(int i) { return null; }
- String tmo(int i) { return ""; }
- List<String> gmo(int i) { return null; }
- void vmo(int i) { }
-
- // overloaded native methods
- native byte bmno();
- native short smno();
- native int imno();
- native long lmno();
- native float fmno();
- native double dmno();
- native Object omno();
- native String tmno();
- native List<String> gmno();
- native void vmno();
- native Inner1 icmno();
-
- native byte bmno(int i);
- native short smno(int i);
- native int imno(int i);
- native long lmno(int i);
- native float fmno(int i);
- native double dmno(int i);
- native Object omno(int i);
- native String tmno(int i);
- native List<String> gmno(int i);
- native void vmno(int i);
- native Inner1 icmno(Inner1 in1);
-
- // arg types for Java methods
- void mb(byte b) { }
- void ms(short s) { }
- void mi(int i) { }
- void ml(long l) { }
- void mf(float f) { }
- void md(double d) { }
- void mo(Object o) { }
- void mt(String t) { }
- void mg(List<String> g) { }
-
- // arg types for native methods
- native void mbn(byte b);
- native void msn(short s);
- native void min(int i);
- native void mln(long l);
- native void mfn(float f);
- native void mdn(double d);
- native void mon(Object o);
- native void mtn(String t);
- native void mgn(List<String> g);
-
- static class Inner1 {
- // simple types
- byte b;
- short s;
- int i;
- long l;
- float f;
- double d;
- Object o;
- String t;
- List<String> g;
-
- // constants
- static final byte bc = 0;
- static final short sc = 0;
- static final int ic = 0;
- static final long lc = 0;
- static final float fc = 0;
- static final double dc = 0;
- static final Object oc = null;
- static final String tc = "";
- static final List<String> gc = null;
-
- // simple arrays
- byte[] ba;
- // short[] sa; // not handled corrected by javah v6
- int[] ia;
- long[] la;
- float[] fa;
- double[] da;
- Object[] oa;
- String[] ta;
- List<String>[] ga;
-
- // multidimensional arrays
- byte[][] baa;
- short[][] saa;
- int[][] iaa;
- long[][] laa;
- float[][] faa;
- double[][] daa;
- Object[][] oaa;
- String[][] taa;
- List<String>[] gaa;
-
- // simple Java methods
- byte bm() { return 0; }
- short sm() { return 0; }
- int im() { return 0; }
- long lm() { return 0; }
- float fm() { return 0; }
- double dm() { return 0; }
- Object om() { return null; }
- String tm() { return ""; }
- List<String> gm() { return null; }
- void vm() { }
-
- // simple native methods
- native byte bmn();
- native short smn();
- native int imn();
- native long lmn();
- native float fmn();
- native double dmn();
- native Object omn();
- native String tmn();
- native List<String> gmn();
- native void vmn();
-
- // overloaded Java methods
- byte bmo() { return 0; }
- short smo() { return 0; }
- int imo() { return 0; }
- long lmo() { return 0; }
- float fmo() { return 0; }
- double dmo() { return 0; }
- Object omo() { return null; }
- String tmo() { return ""; }
- List<String> gmo() { return null; }
- void vmo() { }
-
- byte bmo(int i) { return 0; }
- short smo(int i) { return 0; }
- int imo(int i) { return 0; }
- long lmo(int i) { return 0; }
- float fmo(int i) { return 0; }
- double dmo(int i) { return 0; }
- Object omo(int i) { return null; }
- String tmo(int i) { return ""; }
- List<String> gmo(int i) { return null; }
- void vmo(int i) { }
-
- // overloaded native methods
- native byte bmno();
- native short smno();
- native int imno();
- native long lmno();
- native float fmno();
- native double dmno();
- native Object omno();
- native String tmno();
- native List<String> gmno();
- native void vmno();
-
- native byte bmno(int i);
- native short smno(int i);
- native int imno(int i);
- native long lmno(int i);
- native float fmno(int i);
- native double dmno(int i);
- native Object omno(int i);
- native String tmno(int i);
- native List<String> gmno(int i);
- native void vmno(int i);
-
- // arg types for Java methods
- void mb(byte b) { }
- void ms(short s) { }
- void mi(int i) { }
- void ml(long l) { }
- void mf(float f) { }
- void md(double d) { }
- void mo(Object o) { }
- void mt(String t) { }
- void mg(List<String> g) { }
-
- // arg types for native methods
- native void mbn(byte b);
- native void msn(short s);
- native void min(int i);
- native void mln(long l);
- native void mfn(float f);
- native void mdn(double d);
- native void mon(Object o);
- native void mtn(String t);
- native void mgn(List<String> g);
- }
-
- class Inner2 {
- // simple types
- byte b;
- short s;
- int i;
- long l;
- float f;
- double d;
- Object o;
- String t;
- List<String> g;
-
- // constants
- static final byte bc = 0;
- static final short sc = 0;
- static final int ic = 0;
- static final long lc = 0;
- static final float fc = 0;
- static final double dc = 0;
- //static final Object oc = null;
- static final String tc = "";
- //static final List<String> gc = null;
-
- // simple arrays
- byte[] ba;
- // short[] sa; // not handled corrected by javah v6
- int[] ia;
- long[] la;
- float[] fa;
- double[] da;
- Object[] oa;
- String[] ta;
- List<String>[] ga;
-
- // multidimensional arrays
- byte[][] baa;
- short[][] saa;
- int[][] iaa;
- long[][] laa;
- float[][] faa;
- double[][] daa;
- Object[][] oaa;
- String[][] taa;
- List<String>[] gaa;
-
- // simple Java methods
- byte bm() { return 0; }
- short sm() { return 0; }
- int im() { return 0; }
- long lm() { return 0; }
- float fm() { return 0; }
- double dm() { return 0; }
- Object om() { return null; }
- String tm() { return ""; }
- List<String> gm() { return null; }
- void vm() { }
-
- // simple native methods
- native byte bmn();
- native short smn();
- native int imn();
- native long lmn();
- native float fmn();
- native double dmn();
- native Object omn();
- native String tmn();
- native List<String> gmn();
- native void vmn();
-
- // overloaded Java methods
- byte bm1() { return 0; }
- short sm1() { return 0; }
- int im1() { return 0; }
- long lm1() { return 0; }
- float fm1() { return 0; }
- double dm1() { return 0; }
- Object om1() { return null; }
- String tm1() { return ""; }
- List<String> gm1() { return null; }
- void vm1() { }
-
- byte bm2(int i) { return 0; }
- short sm2(int i) { return 0; }
- int im2(int i) { return 0; }
- long lm2(int i) { return 0; }
- float fm2(int i) { return 0; }
- double dm2(int i) { return 0; }
- Object om2(int i) { return null; }
- String tm2(int i) { return ""; }
- List<String> gm2(int i) { return null; }
- void vm2(int i) { }
-
- // overloaded native methods
- native byte bmn1();
- native short smn1();
- native int imn1();
- native long lmn1();
- native float fmn1();
- native double dmn1();
- native Object omn1();
- native String tmn1();
- native List<String> gmn1();
- native void vmn1();
-
- native byte bmn2(int i);
- native short smn2(int i);
- native int imn2(int i);
- native long lmn2(int i);
- native float fmn2(int i);
- native double dmn2(int i);
- native Object omn2(int i);
- native String tmn2(int i);
- native List<String> gmn2(int i);
- native void vmn2(int i);
-
- // arg types for Java methods
- void mb(byte b) { }
- void ms(short s) { }
- void mi(int i) { }
- void ml(long l) { }
- void mf(float f) { }
- void md(double d) { }
- void mo(Object o) { }
- void mt(String t) { }
- void mg(List<String> g) { }
-
- // arg types for native methods
- native void mbn(byte b);
- native void msn(short s);
- native void min(int i);
- native void mln(long l);
- native void mfn(float f);
- native void mdn(double d);
- native void mon(Object o);
- native void mtn(String t);
- native void mgn(List<String> g);
- }
-
-}
--- a/test/langtools/tools/javac/nativeHeaders/javahComparison/TestClass4.java Wed Dec 13 14:21:12 2017 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,50 +0,0 @@
-/*
- * Copyright (c) 2007, 2012, 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.
- *
- * 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.
- */
-
-import java.lang.annotation.Native;
-
-public class TestClass4 {
- @Native
- public static final byte b = 1;
-
- @Native
- public static final short s = 2;
-
- @Native
- public static final int i = 3;
-
- @Native
- public static final long l = 4;
-
- @Native
- public static final float f = 5.0f;
-
- @Native
- public static final double d = 6.0;
-
- @Native
- public static final Object o = null;
-
- @Native
- public static final String t = "8";
-}
--- a/test/langtools/tools/javac/nativeHeaders/javahComparison/TestClass5.java Wed Dec 13 14:21:12 2017 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,60 +0,0 @@
-/*
- * Copyright (c) 2007, 2012, 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.
- *
- * 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.
- */
-
-import java.lang.annotation.Native;
-
-public class TestClass5 {
- @Native
- public static final int tc5 = 1;
-
- public class Inner1 {
- @Native
- public static final int tc5i1 = 2;
-
- public class Inner1A {
- @Native
- public static final int tc5i1i1a = 3;
- }
-
- public class Inner1B {
- @Native
- public static final int tc5i1i1b = 4;
- }
- }
-
- public class Inner2 {
- @Native
- public static final int tc521 = 5;
-
- public class Inner2A {
- @Native
- public static final int tc5i2i2a = 6;
- }
-
- public class Inner2B {
- @Native
- public static final int tc5i2i2b = 7;
- }
- }
-}
-
--- a/test/langtools/tools/javadoc/api/basic/APITest.java Wed Dec 13 14:21:12 2017 -0800
+++ b/test/langtools/tools/javadoc/api/basic/APITest.java Mon Dec 18 10:28:43 2017 -0800
@@ -227,7 +227,7 @@
"member-search-index.js",
"member-search-index.zip",
"overview-tree.html",
- "package-list",
+ "element-list",
"package-search-index.js",
"package-search-index.zip",
"pkg/C.html",
--- a/test/langtools/tools/javah/4942232/ParamClassTest.java Wed Dec 13 14:21:12 2017 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,36 +0,0 @@
-/*
- * Copyright (c) 2010, 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.
- *
- * 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.
- */
-
-public class ParamClassTest {
- static {
- System.loadLibrary("Test");
- }
-
- public native void method(Param s);
-
- public static void main(String[] a) {
- }
-}
-
-class Param {
-}
--- a/test/langtools/tools/javah/4942232/Test.java Wed Dec 13 14:21:12 2017 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,142 +0,0 @@
-/*
- * Copyright (c) 2010, 2016, 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.
- *
- * 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.
- */
-
-/*
- * @test
- * @bug 4942232
- * @summary missing param class processes without error
- * @modules jdk.compiler/com.sun.tools.javah
- * @build ParamClassTest Test
- * @run main Test
- */
-
-import java.io.*;
-import java.util.*;
-
-public class Test {
- public static void main(String... args) throws Exception {
- new Test().run();
- }
-
- void run() throws Exception {
- File testSrc = new File(System.getProperty("test.src"));
- File testClasses = new File(System.getProperty("test.classes"));
-
- // standard use of javah on valid class file
- String[] test1Args = {
- "-d", mkdir("test1/out").getPath(),
- "-classpath", testClasses.getPath(),
- "ParamClassTest"
- };
- test(test1Args, 0);
-
- // extended use of javah on valid source file
- String[] test2Args = {
- "-d", mkdir("test2/out").getPath(),
- "-classpath", testSrc.getPath(),
- "ParamClassTest"
- };
- test(test2Args, 0);
-
- // javah on class file with missing referents
- File test3Classes = mkdir("test3/classes");
- copy(new File(testClasses, "ParamClassTest.class"), test3Classes);
- String[] test3Args = {
- "-d", mkdir("test3/out").getPath(),
- "-classpath", test3Classes.getPath(),
- "ParamClassTest"
- };
- test(test3Args, 1);
-
- // javah on source file with missing referents
- File test4Src = mkdir("test4/src");
- String paramClassTestSrc = readFile(new File(testSrc, "ParamClassTest.java"));
- writeFile(new File(test4Src, "ParamClassTest.java"),
- paramClassTestSrc.replaceAll("class Param \\{\\s+\\}", ""));
- String[] test4Args = {
- "-d", mkdir("test4/out").getPath(),
- "-classpath", test4Src.getPath(),
- "ParamClassTest"
- };
- test(test4Args, 15);
-
- if (errors > 0)
- throw new Exception(errors + " errors occurred");
- }
-
- void test(String[] args, int expect) {
- System.err.println("test: " + Arrays.asList(args));
- int rc = javah(args);
- if (rc != expect)
- error("Unexpected return code: " + rc + "; expected: " + expect);
- }
-
- int javah(String... args) {
- StringWriter sw = new StringWriter();
- PrintWriter pw = new PrintWriter(sw);
- int rc = com.sun.tools.javah.Main.run(args, pw);
- pw.close();
- String out = sw.toString();
- if (!out.isEmpty())
- System.err.println(out);
- return rc;
- }
-
- File mkdir(String path) {
- File f = new File(path);
- f.mkdirs();
- return f;
- }
-
- void copy(File from, File to) throws IOException {
- if (to.isDirectory())
- to = new File(to, from.getName());
- try (DataInputStream in = new DataInputStream(new FileInputStream(from));
- FileOutputStream out = new FileOutputStream(to)) {
- byte[] buf = new byte[(int) from.length()];
- in.readFully(buf);
- out.write(buf);
- }
- }
-
- String readFile(File f) throws IOException {
- try (DataInputStream in = new DataInputStream(new FileInputStream(f))) {
- byte[] buf = new byte[(int) f.length()];
- in.readFully(buf);
- return new String(buf);
- }
- }
-
- void writeFile(File f, String body) throws IOException {
- try (FileWriter out = new FileWriter(f)) {
- out.write(body);
- }
- }
-
- void error(String msg) {
- System.err.println(msg);
- errors++;
- }
-
- int errors;
-}
--- a/test/langtools/tools/javah/6257087/T6257087.java Wed Dec 13 14:21:12 2017 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,83 +0,0 @@
-/*
- * Copyright (c) 2013, 2016, 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.
- *
- * 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.
- */
-
-/*
- * @test
- * @bug 6257087
- * @summary javah doesn't produce proper signatures for inner class native methods
- * @library /tools/lib
- * @modules jdk.compiler/com.sun.tools.javac.api
- * jdk.compiler/com.sun.tools.javac.main
- * jdk.compiler/com.sun.tools.javah
- * @build toolbox.ToolBox toolbox.JavahTask
- * @run main T6257087
- */
-
-import java.util.List;
-
-import toolbox.JavahTask;
-import toolbox.ToolBox;
-
-public class T6257087 {
-
- private static final String fooBarGoldenFile =
- "/* DO NOT EDIT THIS FILE - it is machine generated */\n" +
- "#include <jni.h>\n" +
- "/* Header for class foo_bar */\n" +
- "\n" +
- "#ifndef _Included_foo_bar\n" +
- "#define _Included_foo_bar\n" +
- "#ifdef __cplusplus\n" +
- "extern \"C\" {\n" +
- "#endif\n" +
- "/*\n" +
- " * Class: foo_bar\n" +
- " * Method: aardvark\n" +
- " * Signature: ()V\n" +
- " */\n" +
- "JNIEXPORT void JNICALL Java_foo_00024bar_aardvark\n" +
- " (JNIEnv *, jobject);\n" +
- "\n" +
- "#ifdef __cplusplus\n" +
- "}\n" +
- "#endif\n" +
- "#endif";
-
- public static void main(String[] args) throws Exception {
- ToolBox tb = new ToolBox();
- new JavahTask(tb)
- .classpath(ToolBox.testClasses)
- .classes("foo")
- .run();
-
- List<String> fooBarFile = tb.readAllLines("foo_bar.h");
- tb.checkEqual(fooBarFile, tb.split(fooBarGoldenFile, "\n"));
- }
-
-}
-
-class foo {
- class bar {
- public native void aardvark();
- }
-}
--- a/test/langtools/tools/javah/6572945/T6572945.java Wed Dec 13 14:21:12 2017 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,240 +0,0 @@
-/*
- * Copyright (c) 2007, 2016, 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.
- *
- * 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.
- */
-
-/*
- * @test
- * @bug 6572945
- * @summary rewrite javah as an annotation processor, instead of as a doclet
- * @modules jdk.compiler/com.sun.tools.javah
- * @build TestClass1 TestClass2 TestClass3
- * @run main T6572945
- */
-
-import java.io.*;
-import java.util.*;
-import com.sun.tools.javah.Main;
-
-public class T6572945
-{
- static File testSrc = new File(System.getProperty("test.src", "."));
- static File testClasses = new File(System.getProperty("test.classes", "."));
- static boolean isWindows = System.getProperty("os.name").startsWith("Windows");
-
- public static void main(String... args)
- throws IOException, InterruptedException
- {
- boolean ok = new T6572945().run(args);
- if (!ok)
- throw new Error("Test Failed");
- }
-
- public boolean run(String[] args)
- throws IOException, InterruptedException
- {
- if (args.length == 1)
- jdk = new File(args[0]);
-
- test("-o", "jni.file.1", "-jni", "TestClass1");
- test("-o", "jni.file.2", "-jni", "TestClass1", "TestClass2");
- test("-d", "jni.dir.1", "-jni", "TestClass1", "TestClass2");
- test("-o", "jni.file.3", "-jni", "TestClass3");
-
- // The following tests are disabled because llni support has been
- // discontinued, and because bugs in old javah means that character
- // for character testing against output from old javah does not work.
- // In fact, the LLNI impl in new javah is actually better than the
- // impl in old javah because of a couple of significant bug fixes.
-
-// test("-o", "llni.file.1", "-llni", "TestClass1");
-// test("-o", "llni.file.2", "-llni", "TestClass1", "TestClass2");
-// test("-d", "llni.dir.1", "-llni", "TestClass1", "TestClass2");
-// test("-o", "llni.file.3", "-llni", "TestClass3");
-
- return (errors == 0);
- }
-
- void test(String... args)
- throws IOException, InterruptedException
- {
- String[] cp_args = new String[args.length + 2];
- cp_args[0] = "-classpath";
- cp_args[1] = testClasses.getPath();
- System.arraycopy(args, 0, cp_args, 2, args.length);
-
- if (jdk != null)
- init(cp_args);
-
- File out = null;
- for (int i = 0; i < args.length; i++) {
- if (args[i].equals("-o")) {
- out = new File(args[++i]);
- break;
- } else if (args[i].equals("-d")) {
- out = new File(args[++i]);
- out.mkdirs();
- break;
- }
- }
-
- try {
- System.out.println("test: " + Arrays.asList(cp_args));
-
-// // Uncomment and use the following lines to execute javah via the
-// // command line -- for example, to run old javah and set up the golden files
-// List<String> cmd = new ArrayList<String>();
-// File javaHome = new File(System.getProperty("java.home"));
-// if (javaHome.getName().equals("jre"))
-// javaHome = javaHome.getParentFile();
-// File javah = new File(new File(javaHome, "bin"), "javah");
-// cmd.add(javah.getPath());
-// cmd.addAll(Arrays.asList(cp_args));
-// ProcessBuilder pb = new ProcessBuilder(cmd);
-// pb.redirectErrorStream(true);
-// pb.start();
-// Process p = pb.start();
-// String line;
-// BufferedReader in = new BufferedReader(new InputStreamReader(p.getInputStream()));
-// while ((line = in.readLine()) != null)
-// System.err.println(line);
-// in.close();
-// int rc = p.waitFor();
-
- // Use new javah
- PrintWriter err = new PrintWriter(System.err, true);
- int rc = Main.run(cp_args, err);
-
- if (rc != 0) {
- error("javah failed: rc=" + rc);
- return;
- }
-
- // The golden files use the LL suffix for long constants, which
- // is used on Linux and Solaris. On Windows, the suffix is i64,
- // so compare will update the golden files on the fly before the
- // final comparison.
- compare(new File(new File(testSrc, "gold"), out.getName()), out);
- } catch (Throwable t) {
- t.printStackTrace();
- error("javah threw exception");
- }
- }
-
- void init(String[] args) throws IOException, InterruptedException {
- String[] cmdArgs = new String[args.length + 1];
- cmdArgs[0] = new File(new File(jdk, "bin"), "javah").getPath();
- System.arraycopy(args, 0, cmdArgs, 1, args.length);
-
- System.out.println("init: " + Arrays.asList(cmdArgs));
-
- ProcessBuilder pb = new ProcessBuilder(cmdArgs);
- pb.directory(new File(testSrc, "gold"));
- pb.redirectErrorStream(true);
- Process p = pb.start();
- BufferedReader in = new BufferedReader(new InputStreamReader(p.getInputStream()));
- String line;
- while ((line = in.readLine()) != null)
- System.out.println("javah: " + line);
- int rc = p.waitFor();
- if (rc != 0)
- error("javah: exit code " + rc);
- }
-
- /** Compare two directories.
- * @param f1 The golden directory
- * @param f2 The directory to be compared
- */
- void compare(File f1, File f2) {
- compare(f1, f2, null);
- }
-
- /** Compare two files or directories
- * @param f1 The golden directory
- * @param f2 The directory to be compared
- * @param p An optional path identifying a file within the two directories
- */
- void compare(File f1, File f2, String p) {
- File f1p = (p == null ? f1 : new File(f1, p));
- File f2p = (p == null ? f2 : new File(f2, p));
- System.out.println("compare " + f1p + " " + f2p);
- if (f1p.isDirectory() && f2p.isDirectory()) {
- Set<String> children = new HashSet<String>();
- children.addAll(Arrays.asList(f1p.list()));
- children.addAll(Arrays.asList(f2p.list()));
- for (String c: children) {
- compare(f1, f2, new File(p, c).getPath()); // null-safe for p
- }
- }
- else if (f1p.isFile() && f2p.isFile()) {
- String s1 = read(f1p);
- if (isWindows) {
- // f1/s1 is the golden file
- // on Windows, long constants use the i64 suffix, not LL
- s1 = s1.replaceAll("( [0-9]+)LL\n", "$1i64\n");
- }
- String s2 = read(f2p);
- if (!s1.equals(s2)) {
- System.out.println("File: " + f1p + "\n" + s1);
- System.out.println("File: " + f2p + "\n" + s2);
- error("Files differ: " + f1p + " " + f2p);
- }
- }
- else if (f1p.exists() && !f2p.exists())
- error("Only in " + f1 + ": " + p);
- else if (f2p.exists() && !f1p.exists())
- error("Only in " + f2 + ": " + p);
- else
- error("Files differ: " + f1p + " " + f2p);
- }
-
- private String read(File f) {
- try {
- BufferedReader in = new BufferedReader(new FileReader(f));
- try {
- StringBuilder sb = new StringBuilder((int) f.length());
- String line;
- while ((line = in.readLine()) != null) {
- sb.append(line);
- sb.append("\n");
- }
- return sb.toString();
- } finally {
- try {
- in.close();
- } catch (IOException e) {
- }
- }
- } catch (IOException e) {
- error("error reading " + f + ": " + e);
- return "";
- }
- }
-
-
- private void error(String msg) {
- System.out.println(msg);
- errors++;
- }
-
- private int errors;
- private File jdk;
-}
--- a/test/langtools/tools/javah/6572945/TestClass1.java Wed Dec 13 14:21:12 2017 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,475 +0,0 @@
-/*
- * Copyright (c) 2007, 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.
- *
- * 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.
- */
-
-import java.util.List;
-
-public class TestClass1 {
- // simple types
- byte b;
- short s;
- int i;
- long l;
- float f;
- double d;
- Object o;
- String t;
- List<String> g;
-
- // constants
- static final byte bc = 0;
- static final short sc = 0;
- static final int ic = 0;
- static final long lc = 0;
- static final float fc = 0;
- static final double dc = 0;
- static final Object oc = null;
- static final String tc = "";
- static final List<String> gc = null;
-
- // simple arrays
- byte[] ba;
- short[] sa; // not handled corrected by javah v6
- int[] ia;
- long[] la;
- float[] fa;
- double[] da;
- Object[] oa;
- String[] ta;
- List<String>[] ga;
-
- // multidimensional arrays
- byte[][] baa;
- short[][] saa;
- int[][] iaa;
- long[][] laa;
- float[][] faa;
- double[][] daa;
- Object[][] oaa;
- String[][] taa;
- List<String>[] gaa;
-
- // simple Java methods
- byte bm() { return 0; }
- short sm() { return 0; }
- int im() { return 0; }
- long lm() { return 0; }
- float fm() { return 0; }
- double dm() { return 0; }
- Object om() { return null; }
- String tm() { return ""; }
- List<String> gm() { return null; }
- void vm() { }
- byte[] bam() { return null; }
- short[] sam() { return null; }
- int[] iam() { return null; }
- long[] lam() { return null; }
- float[] fam() { return null; }
- double[] dam() { return null; }
- Object[] oam() { return null; }
- String[] tam() { return null; }
- List<String>[] gam() { return null; }
- byte[][] baam() { return null; }
- short[][] saam() { return null; }
- int[][] iaam() { return null; }
- long[][] laam() { return null; }
- float[][] faam() { return null; }
- double[][] daam() { return null; }
- Object[][] oaam() { return null; }
- String[][] taam() { return null; }
- List<String>[] gaam() { return null; }
-
- // simple native methods
- native byte bmn();
- native short smn();
- native int imn();
- native long lmn();
- native float fmn();
- native double dmn();
- native Object omn();
- native String tmn();
- native List<String> gmn();
- native void vmn();
- native byte[] bamn();
- native short[] samn();
- native int[] iamn();
- native long[] lamn();
- native float[] famn();
- native double[] damn();
- native Object[] oamn();
- native String[] tamn();
- native List<String>[] gamn();
- native byte[][] baamn();
- native short[][] saamn();
- native int[][] iaamn();
- native long[][] laamn();
- native float[][] faamn();
- native double[][] daamn();
- native Object[][] oaamn();
- native String[][] taamn();
- native List<String>[] gaamn();
-
- // overloaded Java methods
- byte bm1() { return 0; }
- short sm1() { return 0; }
- int im1() { return 0; }
- long lm1() { return 0; }
- float fm1() { return 0; }
- double dm1() { return 0; }
- Object om1() { return null; }
- String tm1() { return ""; }
- List<String> gm1() { return null; }
- void vm1() { }
-
- byte bm2(int i) { return 0; }
- short sm2(int i) { return 0; }
- int im2(int i) { return 0; }
- long lm2(int i) { return 0; }
- float fm2(int i) { return 0; }
- double dm2(int i) { return 0; }
- Object om2(int i) { return null; }
- String tm2(int i) { return ""; }
- List<String> gm2(int i) { return null; }
- void vm2(int i) { }
-
- // overloaded native methods
- native byte bmn1();
- native short smn1();
- native int imn1();
- native long lmn1();
- native float fmn1();
- native double dmn1();
- native Object omn1();
- native String tmn1();
- native List<String> gmn1();
- native void vmn1();
-
- native byte bmn2(int i);
- native short smn2(int i);
- native int imn2(int i);
- native long lmn2(int i);
- native float fmn2(int i);
- native double dmn2(int i);
- native Object omn2(int i);
- native String tmn2(int i);
- native List<String> gmn2(int i);
- native void vmn2(int i);
-
- // arg types for Java methods
- void mb(byte b) { }
- void ms(short s) { }
- void mi(int i) { }
- void ml(long l) { }
- void mf(float f) { }
- void md(double d) { }
- void mo(Object o) { }
- void mt(String t) { }
- void mg(List<String> g) { }
-
- // arg types for native methods
- native void mbn(byte b);
- native void msn(short s);
- native void min(int i);
- native void mln(long l);
- native void mfn(float f);
- native void mdn(double d);
- native void mon(Object o);
- native void mtn(String t);
- native void mgn(List<String> g);
-
- static class Inner1 {
- // simple types
- byte b;
- short s;
- int i;
- long l;
- float f;
- double d;
- Object o;
- String t;
- List<String> g;
-
- // constants
- static final byte bc = 0;
- static final short sc = 0;
- static final int ic = 0;
- static final long lc = 0;
- static final float fc = 0;
- static final double dc = 0;
- static final Object oc = null;
- static final String tc = "";
- static final List<String> gc = null;
-
- // simple arrays
- byte[] ba;
- // short[] sa; // not handled corrected by javah v6
- int[] ia;
- long[] la;
- float[] fa;
- double[] da;
- Object[] oa;
- String[] ta;
- List<String>[] ga;
-
- // multidimensional arrays
- byte[][] baa;
- short[][] saa;
- int[][] iaa;
- long[][] laa;
- float[][] faa;
- double[][] daa;
- Object[][] oaa;
- String[][] taa;
- List<String>[] gaa;
-
- // simple Java methods
- byte bm() { return 0; }
- short sm() { return 0; }
- int im() { return 0; }
- long lm() { return 0; }
- float fm() { return 0; }
- double dm() { return 0; }
- Object om() { return null; }
- String tm() { return ""; }
- List<String> gm() { return null; }
- void vm() { }
-
- // simple native methods
- native byte bmn();
- native short smn();
- native int imn();
- native long lmn();
- native float fmn();
- native double dmn();
- native Object omn();
- native String tmn();
- native List<String> gmn();
- native void vmn();
-
- // overloaded Java methods
- byte bm1() { return 0; }
- short sm1() { return 0; }
- int im1() { return 0; }
- long lm1() { return 0; }
- float fm1() { return 0; }
- double dm1() { return 0; }
- Object om1() { return null; }
- String tm1() { return ""; }
- List<String> gm1() { return null; }
- void vm1() { }
-
- byte bm2(int i) { return 0; }
- short sm2(int i) { return 0; }
- int im2(int i) { return 0; }
- long lm2(int i) { return 0; }
- float fm2(int i) { return 0; }
- double dm2(int i) { return 0; }
- Object om2(int i) { return null; }
- String tm2(int i) { return ""; }
- List<String> gm2(int i) { return null; }
- void vm2(int i) { }
-
- // overloaded native methods
- native byte bmn1();
- native short smn1();
- native int imn1();
- native long lmn1();
- native float fmn1();
- native double dmn1();
- native Object omn1();
- native String tmn1();
- native List<String> gmn1();
- native void vmn1();
-
- native byte bmn2(int i);
- native short smn2(int i);
- native int imn2(int i);
- native long lmn2(int i);
- native float fmn2(int i);
- native double dmn2(int i);
- native Object omn2(int i);
- native String tmn2(int i);
- native List<String> gmn2(int i);
- native void vmn2(int i);
-
- // arg types for Java methods
- void mb(byte b) { }
- void ms(short s) { }
- void mi(int i) { }
- void ml(long l) { }
- void mf(float f) { }
- void md(double d) { }
- void mo(Object o) { }
- void mt(String t) { }
- void mg(List<String> g) { }
-
- // arg types for native methods
- native void mbn(byte b);
- native void msn(short s);
- native void min(int i);
- native void mln(long l);
- native void mfn(float f);
- native void mdn(double d);
- native void mon(Object o);
- native void mtn(String t);
- native void mgn(List<String> g);
- }
-
- class Inner2 {
- // simple types
- byte b;
- short s;
- int i;
- long l;
- float f;
- double d;
- Object o;
- String t;
- List<String> g;
-
- // constants
- static final byte bc = 0;
- static final short sc = 0;
- static final int ic = 0;
- static final long lc = 0;
- static final float fc = 0;
- static final double dc = 0;
- //static final Object oc = null;
- static final String tc = "";
- //static final List<String> gc = null;
-
- // simple arrays
- byte[] ba;
- // short[] sa; // not handled corrected by javah v6
- int[] ia;
- long[] la;
- float[] fa;
- double[] da;
- Object[] oa;
- String[] ta;
- List<String>[] ga;
-
- // multidimensional arrays
- byte[][] baa;
- short[][] saa;
- int[][] iaa;
- long[][] laa;
- float[][] faa;
- double[][] daa;
- Object[][] oaa;
- String[][] taa;
- List<String>[] gaa;
-
- // simple Java methods
- byte bm() { return 0; }
- short sm() { return 0; }
- int im() { return 0; }
- long lm() { return 0; }
- float fm() { return 0; }
- double dm() { return 0; }
- Object om() { return null; }
- String tm() { return ""; }
- List<String> gm() { return null; }
- void vm() { }
-
- // simple native methods
- native byte bmn();
- native short smn();
- native int imn();
- native long lmn();
- native float fmn();
- native double dmn();
- native Object omn();
- native String tmn();
- native List<String> gmn();
- native void vmn();
-
- // overloaded Java methods
- byte bm1() { return 0; }
- short sm1() { return 0; }
- int im1() { return 0; }
- long lm1() { return 0; }
- float fm1() { return 0; }
- double dm1() { return 0; }
- Object om1() { return null; }
- String tm1() { return ""; }
- List<String> gm1() { return null; }
- void vm1() { }
-
- byte bm2(int i) { return 0; }
- short sm2(int i) { return 0; }
- int im2(int i) { return 0; }
- long lm2(int i) { return 0; }
- float fm2(int i) { return 0; }
- double dm2(int i) { return 0; }
- Object om2(int i) { return null; }
- String tm2(int i) { return ""; }
- List<String> gm2(int i) { return null; }
- void vm2(int i) { }
-
- // overloaded native methods
- native byte bmn1();
- native short smn1();
- native int imn1();
- native long lmn1();
- native float fmn1();
- native double dmn1();
- native Object omn1();
- native String tmn1();
- native List<String> gmn1();
- native void vmn1();
-
- native byte bmn2(int i);
- native short smn2(int i);
- native int imn2(int i);
- native long lmn2(int i);
- native float fmn2(int i);
- native double dmn2(int i);
- native Object omn2(int i);
- native String tmn2(int i);
- native List<String> gmn2(int i);
- native void vmn2(int i);
-
- // arg types for Java methods
- void mb(byte b) { }
- void ms(short s) { }
- void mi(int i) { }
- void ml(long l) { }
- void mf(float f) { }
- void md(double d) { }
- void mo(Object o) { }
- void mt(String t) { }
- void mg(List<String> g) { }
-
- // arg types for native methods
- native void mbn(byte b);
- native void msn(short s);
- native void min(int i);
- native void mln(long l);
- native void mfn(float f);
- native void mdn(double d);
- native void mon(Object o);
- native void mtn(String t);
- native void mgn(List<String> g);
- }
-
-}
--- a/test/langtools/tools/javah/6572945/TestClass2.java Wed Dec 13 14:21:12 2017 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,33 +0,0 @@
-/*
- * Copyright (c) 2007, 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.
- *
- * 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.
- */
-
-public class TestClass2 {
- byte b;
- short s;
- int i;
- long l;
- float f;
- double d;
- Object o;
- String t;
-}
--- a/test/langtools/tools/javah/6572945/TestClass3.java Wed Dec 13 14:21:12 2017 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 2007, 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.
- *
- * 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.
- */
-
-public class TestClass3 {
- public int tc3;
-
- public class Inner1 {
- public int tc3i1;
-
- public class Inner1A {
- public int tc3i1i1a;
- }
-
- public class Inner1B {
- public int tc3i1i1b;
- }
- }
-
- public class Inner2 {
- public int tc321;
-
- public class Inner2A {
- public int tc3i2i2a;
- }
-
- public class Inner2B {
- public int tc3i2i2b;
- }
- }
-}
-
--- a/test/langtools/tools/javah/6572945/gold/jni.dir.1/TestClass1.h Wed Dec 13 14:21:12 2017 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,481 +0,0 @@
-/* DO NOT EDIT THIS FILE - it is machine generated */
-#include <jni.h>
-/* Header for class TestClass1 */
-
-#ifndef _Included_TestClass1
-#define _Included_TestClass1
-#ifdef __cplusplus
-extern "C" {
-#endif
-#undef TestClass1_bc
-#define TestClass1_bc 0L
-#undef TestClass1_sc
-#define TestClass1_sc 0L
-#undef TestClass1_ic
-#define TestClass1_ic 0L
-#undef TestClass1_lc
-#define TestClass1_lc 0LL
-#undef TestClass1_fc
-#define TestClass1_fc 0.0f
-#undef TestClass1_dc
-#define TestClass1_dc 0.0
-/*
- * Class: TestClass1
- * Method: bmn
- * Signature: ()B
- */
-JNIEXPORT jbyte JNICALL Java_TestClass1_bmn
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1
- * Method: smn
- * Signature: ()S
- */
-JNIEXPORT jshort JNICALL Java_TestClass1_smn
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1
- * Method: imn
- * Signature: ()I
- */
-JNIEXPORT jint JNICALL Java_TestClass1_imn
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1
- * Method: lmn
- * Signature: ()J
- */
-JNIEXPORT jlong JNICALL Java_TestClass1_lmn
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1
- * Method: fmn
- * Signature: ()F
- */
-JNIEXPORT jfloat JNICALL Java_TestClass1_fmn
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1
- * Method: dmn
- * Signature: ()D
- */
-JNIEXPORT jdouble JNICALL Java_TestClass1_dmn
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1
- * Method: omn
- * Signature: ()Ljava/lang/Object;
- */
-JNIEXPORT jobject JNICALL Java_TestClass1_omn
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1
- * Method: tmn
- * Signature: ()Ljava/lang/String;
- */
-JNIEXPORT jstring JNICALL Java_TestClass1_tmn
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1
- * Method: gmn
- * Signature: ()Ljava/util/List;
- */
-JNIEXPORT jobject JNICALL Java_TestClass1_gmn
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1
- * Method: vmn
- * Signature: ()V
- */
-JNIEXPORT void JNICALL Java_TestClass1_vmn
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1
- * Method: bamn
- * Signature: ()[B
- */
-JNIEXPORT jbyteArray JNICALL Java_TestClass1_bamn
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1
- * Method: samn
- * Signature: ()[S
- */
-JNIEXPORT jshortArray JNICALL Java_TestClass1_samn
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1
- * Method: iamn
- * Signature: ()[I
- */
-JNIEXPORT jintArray JNICALL Java_TestClass1_iamn
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1
- * Method: lamn
- * Signature: ()[J
- */
-JNIEXPORT jlongArray JNICALL Java_TestClass1_lamn
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1
- * Method: famn
- * Signature: ()[F
- */
-JNIEXPORT jfloatArray JNICALL Java_TestClass1_famn
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1
- * Method: damn
- * Signature: ()[D
- */
-JNIEXPORT jdoubleArray JNICALL Java_TestClass1_damn
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1
- * Method: oamn
- * Signature: ()[Ljava/lang/Object;
- */
-JNIEXPORT jobjectArray JNICALL Java_TestClass1_oamn
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1
- * Method: tamn
- * Signature: ()[Ljava/lang/String;
- */
-JNIEXPORT jobjectArray JNICALL Java_TestClass1_tamn
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1
- * Method: gamn
- * Signature: ()[Ljava/util/List;
- */
-JNIEXPORT jobjectArray JNICALL Java_TestClass1_gamn
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1
- * Method: baamn
- * Signature: ()[[B
- */
-JNIEXPORT jobjectArray JNICALL Java_TestClass1_baamn
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1
- * Method: saamn
- * Signature: ()[[S
- */
-JNIEXPORT jobjectArray JNICALL Java_TestClass1_saamn
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1
- * Method: iaamn
- * Signature: ()[[I
- */
-JNIEXPORT jobjectArray JNICALL Java_TestClass1_iaamn
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1
- * Method: laamn
- * Signature: ()[[J
- */
-JNIEXPORT jobjectArray JNICALL Java_TestClass1_laamn
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1
- * Method: faamn
- * Signature: ()[[F
- */
-JNIEXPORT jobjectArray JNICALL Java_TestClass1_faamn
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1
- * Method: daamn
- * Signature: ()[[D
- */
-JNIEXPORT jobjectArray JNICALL Java_TestClass1_daamn
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1
- * Method: oaamn
- * Signature: ()[[Ljava/lang/Object;
- */
-JNIEXPORT jobjectArray JNICALL Java_TestClass1_oaamn
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1
- * Method: taamn
- * Signature: ()[[Ljava/lang/String;
- */
-JNIEXPORT jobjectArray JNICALL Java_TestClass1_taamn
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1
- * Method: gaamn
- * Signature: ()[Ljava/util/List;
- */
-JNIEXPORT jobjectArray JNICALL Java_TestClass1_gaamn
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1
- * Method: bmn1
- * Signature: ()B
- */
-JNIEXPORT jbyte JNICALL Java_TestClass1_bmn1
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1
- * Method: smn1
- * Signature: ()S
- */
-JNIEXPORT jshort JNICALL Java_TestClass1_smn1
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1
- * Method: imn1
- * Signature: ()I
- */
-JNIEXPORT jint JNICALL Java_TestClass1_imn1
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1
- * Method: lmn1
- * Signature: ()J
- */
-JNIEXPORT jlong JNICALL Java_TestClass1_lmn1
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1
- * Method: fmn1
- * Signature: ()F
- */
-JNIEXPORT jfloat JNICALL Java_TestClass1_fmn1
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1
- * Method: dmn1
- * Signature: ()D
- */
-JNIEXPORT jdouble JNICALL Java_TestClass1_dmn1
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1
- * Method: omn1
- * Signature: ()Ljava/lang/Object;
- */
-JNIEXPORT jobject JNICALL Java_TestClass1_omn1
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1
- * Method: tmn1
- * Signature: ()Ljava/lang/String;
- */
-JNIEXPORT jstring JNICALL Java_TestClass1_tmn1
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1
- * Method: gmn1
- * Signature: ()Ljava/util/List;
- */
-JNIEXPORT jobject JNICALL Java_TestClass1_gmn1
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1
- * Method: vmn1
- * Signature: ()V
- */
-JNIEXPORT void JNICALL Java_TestClass1_vmn1
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1
- * Method: bmn2
- * Signature: (I)B
- */
-JNIEXPORT jbyte JNICALL Java_TestClass1_bmn2
- (JNIEnv *, jobject, jint);
-
-/*
- * Class: TestClass1
- * Method: smn2
- * Signature: (I)S
- */
-JNIEXPORT jshort JNICALL Java_TestClass1_smn2
- (JNIEnv *, jobject, jint);
-
-/*
- * Class: TestClass1
- * Method: imn2
- * Signature: (I)I
- */
-JNIEXPORT jint JNICALL Java_TestClass1_imn2
- (JNIEnv *, jobject, jint);
-
-/*
- * Class: TestClass1
- * Method: lmn2
- * Signature: (I)J
- */
-JNIEXPORT jlong JNICALL Java_TestClass1_lmn2
- (JNIEnv *, jobject, jint);
-
-/*
- * Class: TestClass1
- * Method: fmn2
- * Signature: (I)F
- */
-JNIEXPORT jfloat JNICALL Java_TestClass1_fmn2
- (JNIEnv *, jobject, jint);
-
-/*
- * Class: TestClass1
- * Method: dmn2
- * Signature: (I)D
- */
-JNIEXPORT jdouble JNICALL Java_TestClass1_dmn2
- (JNIEnv *, jobject, jint);
-
-/*
- * Class: TestClass1
- * Method: omn2
- * Signature: (I)Ljava/lang/Object;
- */
-JNIEXPORT jobject JNICALL Java_TestClass1_omn2
- (JNIEnv *, jobject, jint);
-
-/*
- * Class: TestClass1
- * Method: tmn2
- * Signature: (I)Ljava/lang/String;
- */
-JNIEXPORT jstring JNICALL Java_TestClass1_tmn2
- (JNIEnv *, jobject, jint);
-
-/*
- * Class: TestClass1
- * Method: gmn2
- * Signature: (I)Ljava/util/List;
- */
-JNIEXPORT jobject JNICALL Java_TestClass1_gmn2
- (JNIEnv *, jobject, jint);
-
-/*
- * Class: TestClass1
- * Method: vmn2
- * Signature: (I)V
- */
-JNIEXPORT void JNICALL Java_TestClass1_vmn2
- (JNIEnv *, jobject, jint);
-
-/*
- * Class: TestClass1
- * Method: mbn
- * Signature: (B)V
- */
-JNIEXPORT void JNICALL Java_TestClass1_mbn
- (JNIEnv *, jobject, jbyte);
-
-/*
- * Class: TestClass1
- * Method: msn
- * Signature: (S)V
- */
-JNIEXPORT void JNICALL Java_TestClass1_msn
- (JNIEnv *, jobject, jshort);
-
-/*
- * Class: TestClass1
- * Method: min
- * Signature: (I)V
- */
-JNIEXPORT void JNICALL Java_TestClass1_min
- (JNIEnv *, jobject, jint);
-
-/*
- * Class: TestClass1
- * Method: mln
- * Signature: (J)V
- */
-JNIEXPORT void JNICALL Java_TestClass1_mln
- (JNIEnv *, jobject, jlong);
-
-/*
- * Class: TestClass1
- * Method: mfn
- * Signature: (F)V
- */
-JNIEXPORT void JNICALL Java_TestClass1_mfn
- (JNIEnv *, jobject, jfloat);
-
-/*
- * Class: TestClass1
- * Method: mdn
- * Signature: (D)V
- */
-JNIEXPORT void JNICALL Java_TestClass1_mdn
- (JNIEnv *, jobject, jdouble);
-
-/*
- * Class: TestClass1
- * Method: mon
- * Signature: (Ljava/lang/Object;)V
- */
-JNIEXPORT void JNICALL Java_TestClass1_mon
- (JNIEnv *, jobject, jobject);
-
-/*
- * Class: TestClass1
- * Method: mtn
- * Signature: (Ljava/lang/String;)V
- */
-JNIEXPORT void JNICALL Java_TestClass1_mtn
- (JNIEnv *, jobject, jstring);
-
-/*
- * Class: TestClass1
- * Method: mgn
- * Signature: (Ljava/util/List;)V
- */
-JNIEXPORT void JNICALL Java_TestClass1_mgn
- (JNIEnv *, jobject, jobject);
-
-#ifdef __cplusplus
-}
-#endif
-#endif
--- a/test/langtools/tools/javah/6572945/gold/jni.dir.1/TestClass1_Inner1.h Wed Dec 13 14:21:12 2017 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,337 +0,0 @@
-/* DO NOT EDIT THIS FILE - it is machine generated */
-#include <jni.h>
-/* Header for class TestClass1_Inner1 */
-
-#ifndef _Included_TestClass1_Inner1
-#define _Included_TestClass1_Inner1
-#ifdef __cplusplus
-extern "C" {
-#endif
-#undef TestClass1_Inner1_bc
-#define TestClass1_Inner1_bc 0L
-#undef TestClass1_Inner1_sc
-#define TestClass1_Inner1_sc 0L
-#undef TestClass1_Inner1_ic
-#define TestClass1_Inner1_ic 0L
-#undef TestClass1_Inner1_lc
-#define TestClass1_Inner1_lc 0LL
-#undef TestClass1_Inner1_fc
-#define TestClass1_Inner1_fc 0.0f
-#undef TestClass1_Inner1_dc
-#define TestClass1_Inner1_dc 0.0
-/*
- * Class: TestClass1_Inner1
- * Method: bmn
- * Signature: ()B
- */
-JNIEXPORT jbyte JNICALL Java_TestClass1_00024Inner1_bmn
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1_Inner1
- * Method: smn
- * Signature: ()S
- */
-JNIEXPORT jshort JNICALL Java_TestClass1_00024Inner1_smn
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1_Inner1
- * Method: imn
- * Signature: ()I
- */
-JNIEXPORT jint JNICALL Java_TestClass1_00024Inner1_imn
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1_Inner1
- * Method: lmn
- * Signature: ()J
- */
-JNIEXPORT jlong JNICALL Java_TestClass1_00024Inner1_lmn
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1_Inner1
- * Method: fmn
- * Signature: ()F
- */
-JNIEXPORT jfloat JNICALL Java_TestClass1_00024Inner1_fmn
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1_Inner1
- * Method: dmn
- * Signature: ()D
- */
-JNIEXPORT jdouble JNICALL Java_TestClass1_00024Inner1_dmn
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1_Inner1
- * Method: omn
- * Signature: ()Ljava/lang/Object;
- */
-JNIEXPORT jobject JNICALL Java_TestClass1_00024Inner1_omn
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1_Inner1
- * Method: tmn
- * Signature: ()Ljava/lang/String;
- */
-JNIEXPORT jstring JNICALL Java_TestClass1_00024Inner1_tmn
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1_Inner1
- * Method: gmn
- * Signature: ()Ljava/util/List;
- */
-JNIEXPORT jobject JNICALL Java_TestClass1_00024Inner1_gmn
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1_Inner1
- * Method: vmn
- * Signature: ()V
- */
-JNIEXPORT void JNICALL Java_TestClass1_00024Inner1_vmn
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1_Inner1
- * Method: bmn1
- * Signature: ()B
- */
-JNIEXPORT jbyte JNICALL Java_TestClass1_00024Inner1_bmn1
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1_Inner1
- * Method: smn1
- * Signature: ()S
- */
-JNIEXPORT jshort JNICALL Java_TestClass1_00024Inner1_smn1
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1_Inner1
- * Method: imn1
- * Signature: ()I
- */
-JNIEXPORT jint JNICALL Java_TestClass1_00024Inner1_imn1
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1_Inner1
- * Method: lmn1
- * Signature: ()J
- */
-JNIEXPORT jlong JNICALL Java_TestClass1_00024Inner1_lmn1
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1_Inner1
- * Method: fmn1
- * Signature: ()F
- */
-JNIEXPORT jfloat JNICALL Java_TestClass1_00024Inner1_fmn1
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1_Inner1
- * Method: dmn1
- * Signature: ()D
- */
-JNIEXPORT jdouble JNICALL Java_TestClass1_00024Inner1_dmn1
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1_Inner1
- * Method: omn1
- * Signature: ()Ljava/lang/Object;
- */
-JNIEXPORT jobject JNICALL Java_TestClass1_00024Inner1_omn1
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1_Inner1
- * Method: tmn1
- * Signature: ()Ljava/lang/String;
- */
-JNIEXPORT jstring JNICALL Java_TestClass1_00024Inner1_tmn1
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1_Inner1
- * Method: gmn1
- * Signature: ()Ljava/util/List;
- */
-JNIEXPORT jobject JNICALL Java_TestClass1_00024Inner1_gmn1
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1_Inner1
- * Method: vmn1
- * Signature: ()V
- */
-JNIEXPORT void JNICALL Java_TestClass1_00024Inner1_vmn1
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1_Inner1
- * Method: bmn2
- * Signature: (I)B
- */
-JNIEXPORT jbyte JNICALL Java_TestClass1_00024Inner1_bmn2
- (JNIEnv *, jobject, jint);
-
-/*
- * Class: TestClass1_Inner1
- * Method: smn2
- * Signature: (I)S
- */
-JNIEXPORT jshort JNICALL Java_TestClass1_00024Inner1_smn2
- (JNIEnv *, jobject, jint);
-
-/*
- * Class: TestClass1_Inner1
- * Method: imn2
- * Signature: (I)I
- */
-JNIEXPORT jint JNICALL Java_TestClass1_00024Inner1_imn2
- (JNIEnv *, jobject, jint);
-
-/*
- * Class: TestClass1_Inner1
- * Method: lmn2
- * Signature: (I)J
- */
-JNIEXPORT jlong JNICALL Java_TestClass1_00024Inner1_lmn2
- (JNIEnv *, jobject, jint);
-
-/*
- * Class: TestClass1_Inner1
- * Method: fmn2
- * Signature: (I)F
- */
-JNIEXPORT jfloat JNICALL Java_TestClass1_00024Inner1_fmn2
- (JNIEnv *, jobject, jint);
-
-/*
- * Class: TestClass1_Inner1
- * Method: dmn2
- * Signature: (I)D
- */
-JNIEXPORT jdouble JNICALL Java_TestClass1_00024Inner1_dmn2
- (JNIEnv *, jobject, jint);
-
-/*
- * Class: TestClass1_Inner1
- * Method: omn2
- * Signature: (I)Ljava/lang/Object;
- */
-JNIEXPORT jobject JNICALL Java_TestClass1_00024Inner1_omn2
- (JNIEnv *, jobject, jint);
-
-/*
- * Class: TestClass1_Inner1
- * Method: tmn2
- * Signature: (I)Ljava/lang/String;
- */
-JNIEXPORT jstring JNICALL Java_TestClass1_00024Inner1_tmn2
- (JNIEnv *, jobject, jint);
-
-/*
- * Class: TestClass1_Inner1
- * Method: gmn2
- * Signature: (I)Ljava/util/List;
- */
-JNIEXPORT jobject JNICALL Java_TestClass1_00024Inner1_gmn2
- (JNIEnv *, jobject, jint);
-
-/*
- * Class: TestClass1_Inner1
- * Method: vmn2
- * Signature: (I)V
- */
-JNIEXPORT void JNICALL Java_TestClass1_00024Inner1_vmn2
- (JNIEnv *, jobject, jint);
-
-/*
- * Class: TestClass1_Inner1
- * Method: mbn
- * Signature: (B)V
- */
-JNIEXPORT void JNICALL Java_TestClass1_00024Inner1_mbn
- (JNIEnv *, jobject, jbyte);
-
-/*
- * Class: TestClass1_Inner1
- * Method: msn
- * Signature: (S)V
- */
-JNIEXPORT void JNICALL Java_TestClass1_00024Inner1_msn
- (JNIEnv *, jobject, jshort);
-
-/*
- * Class: TestClass1_Inner1
- * Method: min
- * Signature: (I)V
- */
-JNIEXPORT void JNICALL Java_TestClass1_00024Inner1_min
- (JNIEnv *, jobject, jint);
-
-/*
- * Class: TestClass1_Inner1
- * Method: mln
- * Signature: (J)V
- */
-JNIEXPORT void JNICALL Java_TestClass1_00024Inner1_mln
- (JNIEnv *, jobject, jlong);
-
-/*
- * Class: TestClass1_Inner1
- * Method: mfn
- * Signature: (F)V
- */
-JNIEXPORT void JNICALL Java_TestClass1_00024Inner1_mfn
- (JNIEnv *, jobject, jfloat);
-
-/*
- * Class: TestClass1_Inner1
- * Method: mdn
- * Signature: (D)V
- */
-JNIEXPORT void JNICALL Java_TestClass1_00024Inner1_mdn
- (JNIEnv *, jobject, jdouble);
-
-/*
- * Class: TestClass1_Inner1
- * Method: mon
- * Signature: (Ljava/lang/Object;)V
- */
-JNIEXPORT void JNICALL Java_TestClass1_00024Inner1_mon
- (JNIEnv *, jobject, jobject);
-
-/*
- * Class: TestClass1_Inner1
- * Method: mtn
- * Signature: (Ljava/lang/String;)V
- */
-JNIEXPORT void JNICALL Java_TestClass1_00024Inner1_mtn
- (JNIEnv *, jobject, jstring);
-
-/*
- * Class: TestClass1_Inner1
- * Method: mgn
- * Signature: (Ljava/util/List;)V
- */
-JNIEXPORT void JNICALL Java_TestClass1_00024Inner1_mgn
- (JNIEnv *, jobject, jobject);
-
-#ifdef __cplusplus
-}
-#endif
-#endif
--- a/test/langtools/tools/javah/6572945/gold/jni.dir.1/TestClass1_Inner2.h Wed Dec 13 14:21:12 2017 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,337 +0,0 @@
-/* DO NOT EDIT THIS FILE - it is machine generated */
-#include <jni.h>
-/* Header for class TestClass1_Inner2 */
-
-#ifndef _Included_TestClass1_Inner2
-#define _Included_TestClass1_Inner2
-#ifdef __cplusplus
-extern "C" {
-#endif
-#undef TestClass1_Inner2_bc
-#define TestClass1_Inner2_bc 0L
-#undef TestClass1_Inner2_sc
-#define TestClass1_Inner2_sc 0L
-#undef TestClass1_Inner2_ic
-#define TestClass1_Inner2_ic 0L
-#undef TestClass1_Inner2_lc
-#define TestClass1_Inner2_lc 0LL
-#undef TestClass1_Inner2_fc
-#define TestClass1_Inner2_fc 0.0f
-#undef TestClass1_Inner2_dc
-#define TestClass1_Inner2_dc 0.0
-/*
- * Class: TestClass1_Inner2
- * Method: bmn
- * Signature: ()B
- */
-JNIEXPORT jbyte JNICALL Java_TestClass1_00024Inner2_bmn
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1_Inner2
- * Method: smn
- * Signature: ()S
- */
-JNIEXPORT jshort JNICALL Java_TestClass1_00024Inner2_smn
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1_Inner2
- * Method: imn
- * Signature: ()I
- */
-JNIEXPORT jint JNICALL Java_TestClass1_00024Inner2_imn
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1_Inner2
- * Method: lmn
- * Signature: ()J
- */
-JNIEXPORT jlong JNICALL Java_TestClass1_00024Inner2_lmn
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1_Inner2
- * Method: fmn
- * Signature: ()F
- */
-JNIEXPORT jfloat JNICALL Java_TestClass1_00024Inner2_fmn
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1_Inner2
- * Method: dmn
- * Signature: ()D
- */
-JNIEXPORT jdouble JNICALL Java_TestClass1_00024Inner2_dmn
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1_Inner2
- * Method: omn
- * Signature: ()Ljava/lang/Object;
- */
-JNIEXPORT jobject JNICALL Java_TestClass1_00024Inner2_omn
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1_Inner2
- * Method: tmn
- * Signature: ()Ljava/lang/String;
- */
-JNIEXPORT jstring JNICALL Java_TestClass1_00024Inner2_tmn
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1_Inner2
- * Method: gmn
- * Signature: ()Ljava/util/List;
- */
-JNIEXPORT jobject JNICALL Java_TestClass1_00024Inner2_gmn
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1_Inner2
- * Method: vmn
- * Signature: ()V
- */
-JNIEXPORT void JNICALL Java_TestClass1_00024Inner2_vmn
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1_Inner2
- * Method: bmn1
- * Signature: ()B
- */
-JNIEXPORT jbyte JNICALL Java_TestClass1_00024Inner2_bmn1
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1_Inner2
- * Method: smn1
- * Signature: ()S
- */
-JNIEXPORT jshort JNICALL Java_TestClass1_00024Inner2_smn1
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1_Inner2
- * Method: imn1
- * Signature: ()I
- */
-JNIEXPORT jint JNICALL Java_TestClass1_00024Inner2_imn1
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1_Inner2
- * Method: lmn1
- * Signature: ()J
- */
-JNIEXPORT jlong JNICALL Java_TestClass1_00024Inner2_lmn1
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1_Inner2
- * Method: fmn1
- * Signature: ()F
- */
-JNIEXPORT jfloat JNICALL Java_TestClass1_00024Inner2_fmn1
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1_Inner2
- * Method: dmn1
- * Signature: ()D
- */
-JNIEXPORT jdouble JNICALL Java_TestClass1_00024Inner2_dmn1
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1_Inner2
- * Method: omn1
- * Signature: ()Ljava/lang/Object;
- */
-JNIEXPORT jobject JNICALL Java_TestClass1_00024Inner2_omn1
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1_Inner2
- * Method: tmn1
- * Signature: ()Ljava/lang/String;
- */
-JNIEXPORT jstring JNICALL Java_TestClass1_00024Inner2_tmn1
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1_Inner2
- * Method: gmn1
- * Signature: ()Ljava/util/List;
- */
-JNIEXPORT jobject JNICALL Java_TestClass1_00024Inner2_gmn1
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1_Inner2
- * Method: vmn1
- * Signature: ()V
- */
-JNIEXPORT void JNICALL Java_TestClass1_00024Inner2_vmn1
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1_Inner2
- * Method: bmn2
- * Signature: (I)B
- */
-JNIEXPORT jbyte JNICALL Java_TestClass1_00024Inner2_bmn2
- (JNIEnv *, jobject, jint);
-
-/*
- * Class: TestClass1_Inner2
- * Method: smn2
- * Signature: (I)S
- */
-JNIEXPORT jshort JNICALL Java_TestClass1_00024Inner2_smn2
- (JNIEnv *, jobject, jint);
-
-/*
- * Class: TestClass1_Inner2
- * Method: imn2
- * Signature: (I)I
- */
-JNIEXPORT jint JNICALL Java_TestClass1_00024Inner2_imn2
- (JNIEnv *, jobject, jint);
-
-/*
- * Class: TestClass1_Inner2
- * Method: lmn2
- * Signature: (I)J
- */
-JNIEXPORT jlong JNICALL Java_TestClass1_00024Inner2_lmn2
- (JNIEnv *, jobject, jint);
-
-/*
- * Class: TestClass1_Inner2
- * Method: fmn2
- * Signature: (I)F
- */
-JNIEXPORT jfloat JNICALL Java_TestClass1_00024Inner2_fmn2
- (JNIEnv *, jobject, jint);
-
-/*
- * Class: TestClass1_Inner2
- * Method: dmn2
- * Signature: (I)D
- */
-JNIEXPORT jdouble JNICALL Java_TestClass1_00024Inner2_dmn2
- (JNIEnv *, jobject, jint);
-
-/*
- * Class: TestClass1_Inner2
- * Method: omn2
- * Signature: (I)Ljava/lang/Object;
- */
-JNIEXPORT jobject JNICALL Java_TestClass1_00024Inner2_omn2
- (JNIEnv *, jobject, jint);
-
-/*
- * Class: TestClass1_Inner2
- * Method: tmn2
- * Signature: (I)Ljava/lang/String;
- */
-JNIEXPORT jstring JNICALL Java_TestClass1_00024Inner2_tmn2
- (JNIEnv *, jobject, jint);
-
-/*
- * Class: TestClass1_Inner2
- * Method: gmn2
- * Signature: (I)Ljava/util/List;
- */
-JNIEXPORT jobject JNICALL Java_TestClass1_00024Inner2_gmn2
- (JNIEnv *, jobject, jint);
-
-/*
- * Class: TestClass1_Inner2
- * Method: vmn2
- * Signature: (I)V
- */
-JNIEXPORT void JNICALL Java_TestClass1_00024Inner2_vmn2
- (JNIEnv *, jobject, jint);
-
-/*
- * Class: TestClass1_Inner2
- * Method: mbn
- * Signature: (B)V
- */
-JNIEXPORT void JNICALL Java_TestClass1_00024Inner2_mbn
- (JNIEnv *, jobject, jbyte);
-
-/*
- * Class: TestClass1_Inner2
- * Method: msn
- * Signature: (S)V
- */
-JNIEXPORT void JNICALL Java_TestClass1_00024Inner2_msn
- (JNIEnv *, jobject, jshort);
-
-/*
- * Class: TestClass1_Inner2
- * Method: min
- * Signature: (I)V
- */
-JNIEXPORT void JNICALL Java_TestClass1_00024Inner2_min
- (JNIEnv *, jobject, jint);
-
-/*
- * Class: TestClass1_Inner2
- * Method: mln
- * Signature: (J)V
- */
-JNIEXPORT void JNICALL Java_TestClass1_00024Inner2_mln
- (JNIEnv *, jobject, jlong);
-
-/*
- * Class: TestClass1_Inner2
- * Method: mfn
- * Signature: (F)V
- */
-JNIEXPORT void JNICALL Java_TestClass1_00024Inner2_mfn
- (JNIEnv *, jobject, jfloat);
-
-/*
- * Class: TestClass1_Inner2
- * Method: mdn
- * Signature: (D)V
- */
-JNIEXPORT void JNICALL Java_TestClass1_00024Inner2_mdn
- (JNIEnv *, jobject, jdouble);
-
-/*
- * Class: TestClass1_Inner2
- * Method: mon
- * Signature: (Ljava/lang/Object;)V
- */
-JNIEXPORT void JNICALL Java_TestClass1_00024Inner2_mon
- (JNIEnv *, jobject, jobject);
-
-/*
- * Class: TestClass1_Inner2
- * Method: mtn
- * Signature: (Ljava/lang/String;)V
- */
-JNIEXPORT void JNICALL Java_TestClass1_00024Inner2_mtn
- (JNIEnv *, jobject, jstring);
-
-/*
- * Class: TestClass1_Inner2
- * Method: mgn
- * Signature: (Ljava/util/List;)V
- */
-JNIEXPORT void JNICALL Java_TestClass1_00024Inner2_mgn
- (JNIEnv *, jobject, jobject);
-
-#ifdef __cplusplus
-}
-#endif
-#endif
--- a/test/langtools/tools/javah/6572945/gold/jni.dir.1/TestClass2.h Wed Dec 13 14:21:12 2017 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,13 +0,0 @@
-/* DO NOT EDIT THIS FILE - it is machine generated */
-#include <jni.h>
-/* Header for class TestClass2 */
-
-#ifndef _Included_TestClass2
-#define _Included_TestClass2
-#ifdef __cplusplus
-extern "C" {
-#endif
-#ifdef __cplusplus
-}
-#endif
-#endif
--- a/test/langtools/tools/javah/6572945/gold/jni.file.1 Wed Dec 13 14:21:12 2017 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1151 +0,0 @@
-/* DO NOT EDIT THIS FILE - it is machine generated */
-#include <jni.h>
-/* Header for class TestClass1 */
-
-#ifndef _Included_TestClass1
-#define _Included_TestClass1
-#ifdef __cplusplus
-extern "C" {
-#endif
-#undef TestClass1_bc
-#define TestClass1_bc 0L
-#undef TestClass1_sc
-#define TestClass1_sc 0L
-#undef TestClass1_ic
-#define TestClass1_ic 0L
-#undef TestClass1_lc
-#define TestClass1_lc 0LL
-#undef TestClass1_fc
-#define TestClass1_fc 0.0f
-#undef TestClass1_dc
-#define TestClass1_dc 0.0
-/*
- * Class: TestClass1
- * Method: bmn
- * Signature: ()B
- */
-JNIEXPORT jbyte JNICALL Java_TestClass1_bmn
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1
- * Method: smn
- * Signature: ()S
- */
-JNIEXPORT jshort JNICALL Java_TestClass1_smn
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1
- * Method: imn
- * Signature: ()I
- */
-JNIEXPORT jint JNICALL Java_TestClass1_imn
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1
- * Method: lmn
- * Signature: ()J
- */
-JNIEXPORT jlong JNICALL Java_TestClass1_lmn
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1
- * Method: fmn
- * Signature: ()F
- */
-JNIEXPORT jfloat JNICALL Java_TestClass1_fmn
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1
- * Method: dmn
- * Signature: ()D
- */
-JNIEXPORT jdouble JNICALL Java_TestClass1_dmn
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1
- * Method: omn
- * Signature: ()Ljava/lang/Object;
- */
-JNIEXPORT jobject JNICALL Java_TestClass1_omn
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1
- * Method: tmn
- * Signature: ()Ljava/lang/String;
- */
-JNIEXPORT jstring JNICALL Java_TestClass1_tmn
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1
- * Method: gmn
- * Signature: ()Ljava/util/List;
- */
-JNIEXPORT jobject JNICALL Java_TestClass1_gmn
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1
- * Method: vmn
- * Signature: ()V
- */
-JNIEXPORT void JNICALL Java_TestClass1_vmn
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1
- * Method: bamn
- * Signature: ()[B
- */
-JNIEXPORT jbyteArray JNICALL Java_TestClass1_bamn
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1
- * Method: samn
- * Signature: ()[S
- */
-JNIEXPORT jshortArray JNICALL Java_TestClass1_samn
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1
- * Method: iamn
- * Signature: ()[I
- */
-JNIEXPORT jintArray JNICALL Java_TestClass1_iamn
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1
- * Method: lamn
- * Signature: ()[J
- */
-JNIEXPORT jlongArray JNICALL Java_TestClass1_lamn
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1
- * Method: famn
- * Signature: ()[F
- */
-JNIEXPORT jfloatArray JNICALL Java_TestClass1_famn
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1
- * Method: damn
- * Signature: ()[D
- */
-JNIEXPORT jdoubleArray JNICALL Java_TestClass1_damn
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1
- * Method: oamn
- * Signature: ()[Ljava/lang/Object;
- */
-JNIEXPORT jobjectArray JNICALL Java_TestClass1_oamn
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1
- * Method: tamn
- * Signature: ()[Ljava/lang/String;
- */
-JNIEXPORT jobjectArray JNICALL Java_TestClass1_tamn
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1
- * Method: gamn
- * Signature: ()[Ljava/util/List;
- */
-JNIEXPORT jobjectArray JNICALL Java_TestClass1_gamn
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1
- * Method: baamn
- * Signature: ()[[B
- */
-JNIEXPORT jobjectArray JNICALL Java_TestClass1_baamn
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1
- * Method: saamn
- * Signature: ()[[S
- */
-JNIEXPORT jobjectArray JNICALL Java_TestClass1_saamn
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1
- * Method: iaamn
- * Signature: ()[[I
- */
-JNIEXPORT jobjectArray JNICALL Java_TestClass1_iaamn
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1
- * Method: laamn
- * Signature: ()[[J
- */
-JNIEXPORT jobjectArray JNICALL Java_TestClass1_laamn
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1
- * Method: faamn
- * Signature: ()[[F
- */
-JNIEXPORT jobjectArray JNICALL Java_TestClass1_faamn
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1
- * Method: daamn
- * Signature: ()[[D
- */
-JNIEXPORT jobjectArray JNICALL Java_TestClass1_daamn
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1
- * Method: oaamn
- * Signature: ()[[Ljava/lang/Object;
- */
-JNIEXPORT jobjectArray JNICALL Java_TestClass1_oaamn
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1
- * Method: taamn
- * Signature: ()[[Ljava/lang/String;
- */
-JNIEXPORT jobjectArray JNICALL Java_TestClass1_taamn
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1
- * Method: gaamn
- * Signature: ()[Ljava/util/List;
- */
-JNIEXPORT jobjectArray JNICALL Java_TestClass1_gaamn
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1
- * Method: bmn1
- * Signature: ()B
- */
-JNIEXPORT jbyte JNICALL Java_TestClass1_bmn1
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1
- * Method: smn1
- * Signature: ()S
- */
-JNIEXPORT jshort JNICALL Java_TestClass1_smn1
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1
- * Method: imn1
- * Signature: ()I
- */
-JNIEXPORT jint JNICALL Java_TestClass1_imn1
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1
- * Method: lmn1
- * Signature: ()J
- */
-JNIEXPORT jlong JNICALL Java_TestClass1_lmn1
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1
- * Method: fmn1
- * Signature: ()F
- */
-JNIEXPORT jfloat JNICALL Java_TestClass1_fmn1
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1
- * Method: dmn1
- * Signature: ()D
- */
-JNIEXPORT jdouble JNICALL Java_TestClass1_dmn1
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1
- * Method: omn1
- * Signature: ()Ljava/lang/Object;
- */
-JNIEXPORT jobject JNICALL Java_TestClass1_omn1
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1
- * Method: tmn1
- * Signature: ()Ljava/lang/String;
- */
-JNIEXPORT jstring JNICALL Java_TestClass1_tmn1
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1
- * Method: gmn1
- * Signature: ()Ljava/util/List;
- */
-JNIEXPORT jobject JNICALL Java_TestClass1_gmn1
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1
- * Method: vmn1
- * Signature: ()V
- */
-JNIEXPORT void JNICALL Java_TestClass1_vmn1
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1
- * Method: bmn2
- * Signature: (I)B
- */
-JNIEXPORT jbyte JNICALL Java_TestClass1_bmn2
- (JNIEnv *, jobject, jint);
-
-/*
- * Class: TestClass1
- * Method: smn2
- * Signature: (I)S
- */
-JNIEXPORT jshort JNICALL Java_TestClass1_smn2
- (JNIEnv *, jobject, jint);
-
-/*
- * Class: TestClass1
- * Method: imn2
- * Signature: (I)I
- */
-JNIEXPORT jint JNICALL Java_TestClass1_imn2
- (JNIEnv *, jobject, jint);
-
-/*
- * Class: TestClass1
- * Method: lmn2
- * Signature: (I)J
- */
-JNIEXPORT jlong JNICALL Java_TestClass1_lmn2
- (JNIEnv *, jobject, jint);
-
-/*
- * Class: TestClass1
- * Method: fmn2
- * Signature: (I)F
- */
-JNIEXPORT jfloat JNICALL Java_TestClass1_fmn2
- (JNIEnv *, jobject, jint);
-
-/*
- * Class: TestClass1
- * Method: dmn2
- * Signature: (I)D
- */
-JNIEXPORT jdouble JNICALL Java_TestClass1_dmn2
- (JNIEnv *, jobject, jint);
-
-/*
- * Class: TestClass1
- * Method: omn2
- * Signature: (I)Ljava/lang/Object;
- */
-JNIEXPORT jobject JNICALL Java_TestClass1_omn2
- (JNIEnv *, jobject, jint);
-
-/*
- * Class: TestClass1
- * Method: tmn2
- * Signature: (I)Ljava/lang/String;
- */
-JNIEXPORT jstring JNICALL Java_TestClass1_tmn2
- (JNIEnv *, jobject, jint);
-
-/*
- * Class: TestClass1
- * Method: gmn2
- * Signature: (I)Ljava/util/List;
- */
-JNIEXPORT jobject JNICALL Java_TestClass1_gmn2
- (JNIEnv *, jobject, jint);
-
-/*
- * Class: TestClass1
- * Method: vmn2
- * Signature: (I)V
- */
-JNIEXPORT void JNICALL Java_TestClass1_vmn2
- (JNIEnv *, jobject, jint);
-
-/*
- * Class: TestClass1
- * Method: mbn
- * Signature: (B)V
- */
-JNIEXPORT void JNICALL Java_TestClass1_mbn
- (JNIEnv *, jobject, jbyte);
-
-/*
- * Class: TestClass1
- * Method: msn
- * Signature: (S)V
- */
-JNIEXPORT void JNICALL Java_TestClass1_msn
- (JNIEnv *, jobject, jshort);
-
-/*
- * Class: TestClass1
- * Method: min
- * Signature: (I)V
- */
-JNIEXPORT void JNICALL Java_TestClass1_min
- (JNIEnv *, jobject, jint);
-
-/*
- * Class: TestClass1
- * Method: mln
- * Signature: (J)V
- */
-JNIEXPORT void JNICALL Java_TestClass1_mln
- (JNIEnv *, jobject, jlong);
-
-/*
- * Class: TestClass1
- * Method: mfn
- * Signature: (F)V
- */
-JNIEXPORT void JNICALL Java_TestClass1_mfn
- (JNIEnv *, jobject, jfloat);
-
-/*
- * Class: TestClass1
- * Method: mdn
- * Signature: (D)V
- */
-JNIEXPORT void JNICALL Java_TestClass1_mdn
- (JNIEnv *, jobject, jdouble);
-
-/*
- * Class: TestClass1
- * Method: mon
- * Signature: (Ljava/lang/Object;)V
- */
-JNIEXPORT void JNICALL Java_TestClass1_mon
- (JNIEnv *, jobject, jobject);
-
-/*
- * Class: TestClass1
- * Method: mtn
- * Signature: (Ljava/lang/String;)V
- */
-JNIEXPORT void JNICALL Java_TestClass1_mtn
- (JNIEnv *, jobject, jstring);
-
-/*
- * Class: TestClass1
- * Method: mgn
- * Signature: (Ljava/util/List;)V
- */
-JNIEXPORT void JNICALL Java_TestClass1_mgn
- (JNIEnv *, jobject, jobject);
-
-#ifdef __cplusplus
-}
-#endif
-#endif
-/* Header for class TestClass1_Inner2 */
-
-#ifndef _Included_TestClass1_Inner2
-#define _Included_TestClass1_Inner2
-#ifdef __cplusplus
-extern "C" {
-#endif
-#undef TestClass1_Inner2_bc
-#define TestClass1_Inner2_bc 0L
-#undef TestClass1_Inner2_sc
-#define TestClass1_Inner2_sc 0L
-#undef TestClass1_Inner2_ic
-#define TestClass1_Inner2_ic 0L
-#undef TestClass1_Inner2_lc
-#define TestClass1_Inner2_lc 0LL
-#undef TestClass1_Inner2_fc
-#define TestClass1_Inner2_fc 0.0f
-#undef TestClass1_Inner2_dc
-#define TestClass1_Inner2_dc 0.0
-/*
- * Class: TestClass1_Inner2
- * Method: bmn
- * Signature: ()B
- */
-JNIEXPORT jbyte JNICALL Java_TestClass1_00024Inner2_bmn
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1_Inner2
- * Method: smn
- * Signature: ()S
- */
-JNIEXPORT jshort JNICALL Java_TestClass1_00024Inner2_smn
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1_Inner2
- * Method: imn
- * Signature: ()I
- */
-JNIEXPORT jint JNICALL Java_TestClass1_00024Inner2_imn
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1_Inner2
- * Method: lmn
- * Signature: ()J
- */
-JNIEXPORT jlong JNICALL Java_TestClass1_00024Inner2_lmn
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1_Inner2
- * Method: fmn
- * Signature: ()F
- */
-JNIEXPORT jfloat JNICALL Java_TestClass1_00024Inner2_fmn
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1_Inner2
- * Method: dmn
- * Signature: ()D
- */
-JNIEXPORT jdouble JNICALL Java_TestClass1_00024Inner2_dmn
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1_Inner2
- * Method: omn
- * Signature: ()Ljava/lang/Object;
- */
-JNIEXPORT jobject JNICALL Java_TestClass1_00024Inner2_omn
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1_Inner2
- * Method: tmn
- * Signature: ()Ljava/lang/String;
- */
-JNIEXPORT jstring JNICALL Java_TestClass1_00024Inner2_tmn
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1_Inner2
- * Method: gmn
- * Signature: ()Ljava/util/List;
- */
-JNIEXPORT jobject JNICALL Java_TestClass1_00024Inner2_gmn
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1_Inner2
- * Method: vmn
- * Signature: ()V
- */
-JNIEXPORT void JNICALL Java_TestClass1_00024Inner2_vmn
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1_Inner2
- * Method: bmn1
- * Signature: ()B
- */
-JNIEXPORT jbyte JNICALL Java_TestClass1_00024Inner2_bmn1
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1_Inner2
- * Method: smn1
- * Signature: ()S
- */
-JNIEXPORT jshort JNICALL Java_TestClass1_00024Inner2_smn1
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1_Inner2
- * Method: imn1
- * Signature: ()I
- */
-JNIEXPORT jint JNICALL Java_TestClass1_00024Inner2_imn1
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1_Inner2
- * Method: lmn1
- * Signature: ()J
- */
-JNIEXPORT jlong JNICALL Java_TestClass1_00024Inner2_lmn1
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1_Inner2
- * Method: fmn1
- * Signature: ()F
- */
-JNIEXPORT jfloat JNICALL Java_TestClass1_00024Inner2_fmn1
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1_Inner2
- * Method: dmn1
- * Signature: ()D
- */
-JNIEXPORT jdouble JNICALL Java_TestClass1_00024Inner2_dmn1
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1_Inner2
- * Method: omn1
- * Signature: ()Ljava/lang/Object;
- */
-JNIEXPORT jobject JNICALL Java_TestClass1_00024Inner2_omn1
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1_Inner2
- * Method: tmn1
- * Signature: ()Ljava/lang/String;
- */
-JNIEXPORT jstring JNICALL Java_TestClass1_00024Inner2_tmn1
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1_Inner2
- * Method: gmn1
- * Signature: ()Ljava/util/List;
- */
-JNIEXPORT jobject JNICALL Java_TestClass1_00024Inner2_gmn1
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1_Inner2
- * Method: vmn1
- * Signature: ()V
- */
-JNIEXPORT void JNICALL Java_TestClass1_00024Inner2_vmn1
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1_Inner2
- * Method: bmn2
- * Signature: (I)B
- */
-JNIEXPORT jbyte JNICALL Java_TestClass1_00024Inner2_bmn2
- (JNIEnv *, jobject, jint);
-
-/*
- * Class: TestClass1_Inner2
- * Method: smn2
- * Signature: (I)S
- */
-JNIEXPORT jshort JNICALL Java_TestClass1_00024Inner2_smn2
- (JNIEnv *, jobject, jint);
-
-/*
- * Class: TestClass1_Inner2
- * Method: imn2
- * Signature: (I)I
- */
-JNIEXPORT jint JNICALL Java_TestClass1_00024Inner2_imn2
- (JNIEnv *, jobject, jint);
-
-/*
- * Class: TestClass1_Inner2
- * Method: lmn2
- * Signature: (I)J
- */
-JNIEXPORT jlong JNICALL Java_TestClass1_00024Inner2_lmn2
- (JNIEnv *, jobject, jint);
-
-/*
- * Class: TestClass1_Inner2
- * Method: fmn2
- * Signature: (I)F
- */
-JNIEXPORT jfloat JNICALL Java_TestClass1_00024Inner2_fmn2
- (JNIEnv *, jobject, jint);
-
-/*
- * Class: TestClass1_Inner2
- * Method: dmn2
- * Signature: (I)D
- */
-JNIEXPORT jdouble JNICALL Java_TestClass1_00024Inner2_dmn2
- (JNIEnv *, jobject, jint);
-
-/*
- * Class: TestClass1_Inner2
- * Method: omn2
- * Signature: (I)Ljava/lang/Object;
- */
-JNIEXPORT jobject JNICALL Java_TestClass1_00024Inner2_omn2
- (JNIEnv *, jobject, jint);
-
-/*
- * Class: TestClass1_Inner2
- * Method: tmn2
- * Signature: (I)Ljava/lang/String;
- */
-JNIEXPORT jstring JNICALL Java_TestClass1_00024Inner2_tmn2
- (JNIEnv *, jobject, jint);
-
-/*
- * Class: TestClass1_Inner2
- * Method: gmn2
- * Signature: (I)Ljava/util/List;
- */
-JNIEXPORT jobject JNICALL Java_TestClass1_00024Inner2_gmn2
- (JNIEnv *, jobject, jint);
-
-/*
- * Class: TestClass1_Inner2
- * Method: vmn2
- * Signature: (I)V
- */
-JNIEXPORT void JNICALL Java_TestClass1_00024Inner2_vmn2
- (JNIEnv *, jobject, jint);
-
-/*
- * Class: TestClass1_Inner2
- * Method: mbn
- * Signature: (B)V
- */
-JNIEXPORT void JNICALL Java_TestClass1_00024Inner2_mbn
- (JNIEnv *, jobject, jbyte);
-
-/*
- * Class: TestClass1_Inner2
- * Method: msn
- * Signature: (S)V
- */
-JNIEXPORT void JNICALL Java_TestClass1_00024Inner2_msn
- (JNIEnv *, jobject, jshort);
-
-/*
- * Class: TestClass1_Inner2
- * Method: min
- * Signature: (I)V
- */
-JNIEXPORT void JNICALL Java_TestClass1_00024Inner2_min
- (JNIEnv *, jobject, jint);
-
-/*
- * Class: TestClass1_Inner2
- * Method: mln
- * Signature: (J)V
- */
-JNIEXPORT void JNICALL Java_TestClass1_00024Inner2_mln
- (JNIEnv *, jobject, jlong);
-
-/*
- * Class: TestClass1_Inner2
- * Method: mfn
- * Signature: (F)V
- */
-JNIEXPORT void JNICALL Java_TestClass1_00024Inner2_mfn
- (JNIEnv *, jobject, jfloat);
-
-/*
- * Class: TestClass1_Inner2
- * Method: mdn
- * Signature: (D)V
- */
-JNIEXPORT void JNICALL Java_TestClass1_00024Inner2_mdn
- (JNIEnv *, jobject, jdouble);
-
-/*
- * Class: TestClass1_Inner2
- * Method: mon
- * Signature: (Ljava/lang/Object;)V
- */
-JNIEXPORT void JNICALL Java_TestClass1_00024Inner2_mon
- (JNIEnv *, jobject, jobject);
-
-/*
- * Class: TestClass1_Inner2
- * Method: mtn
- * Signature: (Ljava/lang/String;)V
- */
-JNIEXPORT void JNICALL Java_TestClass1_00024Inner2_mtn
- (JNIEnv *, jobject, jstring);
-
-/*
- * Class: TestClass1_Inner2
- * Method: mgn
- * Signature: (Ljava/util/List;)V
- */
-JNIEXPORT void JNICALL Java_TestClass1_00024Inner2_mgn
- (JNIEnv *, jobject, jobject);
-
-#ifdef __cplusplus
-}
-#endif
-#endif
-/* Header for class TestClass1_Inner1 */
-
-#ifndef _Included_TestClass1_Inner1
-#define _Included_TestClass1_Inner1
-#ifdef __cplusplus
-extern "C" {
-#endif
-#undef TestClass1_Inner1_bc
-#define TestClass1_Inner1_bc 0L
-#undef TestClass1_Inner1_sc
-#define TestClass1_Inner1_sc 0L
-#undef TestClass1_Inner1_ic
-#define TestClass1_Inner1_ic 0L
-#undef TestClass1_Inner1_lc
-#define TestClass1_Inner1_lc 0LL
-#undef TestClass1_Inner1_fc
-#define TestClass1_Inner1_fc 0.0f
-#undef TestClass1_Inner1_dc
-#define TestClass1_Inner1_dc 0.0
-/*
- * Class: TestClass1_Inner1
- * Method: bmn
- * Signature: ()B
- */
-JNIEXPORT jbyte JNICALL Java_TestClass1_00024Inner1_bmn
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1_Inner1
- * Method: smn
- * Signature: ()S
- */
-JNIEXPORT jshort JNICALL Java_TestClass1_00024Inner1_smn
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1_Inner1
- * Method: imn
- * Signature: ()I
- */
-JNIEXPORT jint JNICALL Java_TestClass1_00024Inner1_imn
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1_Inner1
- * Method: lmn
- * Signature: ()J
- */
-JNIEXPORT jlong JNICALL Java_TestClass1_00024Inner1_lmn
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1_Inner1
- * Method: fmn
- * Signature: ()F
- */
-JNIEXPORT jfloat JNICALL Java_TestClass1_00024Inner1_fmn
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1_Inner1
- * Method: dmn
- * Signature: ()D
- */
-JNIEXPORT jdouble JNICALL Java_TestClass1_00024Inner1_dmn
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1_Inner1
- * Method: omn
- * Signature: ()Ljava/lang/Object;
- */
-JNIEXPORT jobject JNICALL Java_TestClass1_00024Inner1_omn
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1_Inner1
- * Method: tmn
- * Signature: ()Ljava/lang/String;
- */
-JNIEXPORT jstring JNICALL Java_TestClass1_00024Inner1_tmn
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1_Inner1
- * Method: gmn
- * Signature: ()Ljava/util/List;
- */
-JNIEXPORT jobject JNICALL Java_TestClass1_00024Inner1_gmn
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1_Inner1
- * Method: vmn
- * Signature: ()V
- */
-JNIEXPORT void JNICALL Java_TestClass1_00024Inner1_vmn
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1_Inner1
- * Method: bmn1
- * Signature: ()B
- */
-JNIEXPORT jbyte JNICALL Java_TestClass1_00024Inner1_bmn1
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1_Inner1
- * Method: smn1
- * Signature: ()S
- */
-JNIEXPORT jshort JNICALL Java_TestClass1_00024Inner1_smn1
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1_Inner1
- * Method: imn1
- * Signature: ()I
- */
-JNIEXPORT jint JNICALL Java_TestClass1_00024Inner1_imn1
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1_Inner1
- * Method: lmn1
- * Signature: ()J
- */
-JNIEXPORT jlong JNICALL Java_TestClass1_00024Inner1_lmn1
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1_Inner1
- * Method: fmn1
- * Signature: ()F
- */
-JNIEXPORT jfloat JNICALL Java_TestClass1_00024Inner1_fmn1
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1_Inner1
- * Method: dmn1
- * Signature: ()D
- */
-JNIEXPORT jdouble JNICALL Java_TestClass1_00024Inner1_dmn1
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1_Inner1
- * Method: omn1
- * Signature: ()Ljava/lang/Object;
- */
-JNIEXPORT jobject JNICALL Java_TestClass1_00024Inner1_omn1
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1_Inner1
- * Method: tmn1
- * Signature: ()Ljava/lang/String;
- */
-JNIEXPORT jstring JNICALL Java_TestClass1_00024Inner1_tmn1
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1_Inner1
- * Method: gmn1
- * Signature: ()Ljava/util/List;
- */
-JNIEXPORT jobject JNICALL Java_TestClass1_00024Inner1_gmn1
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1_Inner1
- * Method: vmn1
- * Signature: ()V
- */
-JNIEXPORT void JNICALL Java_TestClass1_00024Inner1_vmn1
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1_Inner1
- * Method: bmn2
- * Signature: (I)B
- */
-JNIEXPORT jbyte JNICALL Java_TestClass1_00024Inner1_bmn2
- (JNIEnv *, jobject, jint);
-
-/*
- * Class: TestClass1_Inner1
- * Method: smn2
- * Signature: (I)S
- */
-JNIEXPORT jshort JNICALL Java_TestClass1_00024Inner1_smn2
- (JNIEnv *, jobject, jint);
-
-/*
- * Class: TestClass1_Inner1
- * Method: imn2
- * Signature: (I)I
- */
-JNIEXPORT jint JNICALL Java_TestClass1_00024Inner1_imn2
- (JNIEnv *, jobject, jint);
-
-/*
- * Class: TestClass1_Inner1
- * Method: lmn2
- * Signature: (I)J
- */
-JNIEXPORT jlong JNICALL Java_TestClass1_00024Inner1_lmn2
- (JNIEnv *, jobject, jint);
-
-/*
- * Class: TestClass1_Inner1
- * Method: fmn2
- * Signature: (I)F
- */
-JNIEXPORT jfloat JNICALL Java_TestClass1_00024Inner1_fmn2
- (JNIEnv *, jobject, jint);
-
-/*
- * Class: TestClass1_Inner1
- * Method: dmn2
- * Signature: (I)D
- */
-JNIEXPORT jdouble JNICALL Java_TestClass1_00024Inner1_dmn2
- (JNIEnv *, jobject, jint);
-
-/*
- * Class: TestClass1_Inner1
- * Method: omn2
- * Signature: (I)Ljava/lang/Object;
- */
-JNIEXPORT jobject JNICALL Java_TestClass1_00024Inner1_omn2
- (JNIEnv *, jobject, jint);
-
-/*
- * Class: TestClass1_Inner1
- * Method: tmn2
- * Signature: (I)Ljava/lang/String;
- */
-JNIEXPORT jstring JNICALL Java_TestClass1_00024Inner1_tmn2
- (JNIEnv *, jobject, jint);
-
-/*
- * Class: TestClass1_Inner1
- * Method: gmn2
- * Signature: (I)Ljava/util/List;
- */
-JNIEXPORT jobject JNICALL Java_TestClass1_00024Inner1_gmn2
- (JNIEnv *, jobject, jint);
-
-/*
- * Class: TestClass1_Inner1
- * Method: vmn2
- * Signature: (I)V
- */
-JNIEXPORT void JNICALL Java_TestClass1_00024Inner1_vmn2
- (JNIEnv *, jobject, jint);
-
-/*
- * Class: TestClass1_Inner1
- * Method: mbn
- * Signature: (B)V
- */
-JNIEXPORT void JNICALL Java_TestClass1_00024Inner1_mbn
- (JNIEnv *, jobject, jbyte);
-
-/*
- * Class: TestClass1_Inner1
- * Method: msn
- * Signature: (S)V
- */
-JNIEXPORT void JNICALL Java_TestClass1_00024Inner1_msn
- (JNIEnv *, jobject, jshort);
-
-/*
- * Class: TestClass1_Inner1
- * Method: min
- * Signature: (I)V
- */
-JNIEXPORT void JNICALL Java_TestClass1_00024Inner1_min
- (JNIEnv *, jobject, jint);
-
-/*
- * Class: TestClass1_Inner1
- * Method: mln
- * Signature: (J)V
- */
-JNIEXPORT void JNICALL Java_TestClass1_00024Inner1_mln
- (JNIEnv *, jobject, jlong);
-
-/*
- * Class: TestClass1_Inner1
- * Method: mfn
- * Signature: (F)V
- */
-JNIEXPORT void JNICALL Java_TestClass1_00024Inner1_mfn
- (JNIEnv *, jobject, jfloat);
-
-/*
- * Class: TestClass1_Inner1
- * Method: mdn
- * Signature: (D)V
- */
-JNIEXPORT void JNICALL Java_TestClass1_00024Inner1_mdn
- (JNIEnv *, jobject, jdouble);
-
-/*
- * Class: TestClass1_Inner1
- * Method: mon
- * Signature: (Ljava/lang/Object;)V
- */
-JNIEXPORT void JNICALL Java_TestClass1_00024Inner1_mon
- (JNIEnv *, jobject, jobject);
-
-/*
- * Class: TestClass1_Inner1
- * Method: mtn
- * Signature: (Ljava/lang/String;)V
- */
-JNIEXPORT void JNICALL Java_TestClass1_00024Inner1_mtn
- (JNIEnv *, jobject, jstring);
-
-/*
- * Class: TestClass1_Inner1
- * Method: mgn
- * Signature: (Ljava/util/List;)V
- */
-JNIEXPORT void JNICALL Java_TestClass1_00024Inner1_mgn
- (JNIEnv *, jobject, jobject);
-
-#ifdef __cplusplus
-}
-#endif
-#endif
--- a/test/langtools/tools/javah/6572945/gold/jni.file.2 Wed Dec 13 14:21:12 2017 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1162 +0,0 @@
-/* DO NOT EDIT THIS FILE - it is machine generated */
-#include <jni.h>
-/* Header for class TestClass1 */
-
-#ifndef _Included_TestClass1
-#define _Included_TestClass1
-#ifdef __cplusplus
-extern "C" {
-#endif
-#undef TestClass1_bc
-#define TestClass1_bc 0L
-#undef TestClass1_sc
-#define TestClass1_sc 0L
-#undef TestClass1_ic
-#define TestClass1_ic 0L
-#undef TestClass1_lc
-#define TestClass1_lc 0LL
-#undef TestClass1_fc
-#define TestClass1_fc 0.0f
-#undef TestClass1_dc
-#define TestClass1_dc 0.0
-/*
- * Class: TestClass1
- * Method: bmn
- * Signature: ()B
- */
-JNIEXPORT jbyte JNICALL Java_TestClass1_bmn
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1
- * Method: smn
- * Signature: ()S
- */
-JNIEXPORT jshort JNICALL Java_TestClass1_smn
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1
- * Method: imn
- * Signature: ()I
- */
-JNIEXPORT jint JNICALL Java_TestClass1_imn
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1
- * Method: lmn
- * Signature: ()J
- */
-JNIEXPORT jlong JNICALL Java_TestClass1_lmn
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1
- * Method: fmn
- * Signature: ()F
- */
-JNIEXPORT jfloat JNICALL Java_TestClass1_fmn
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1
- * Method: dmn
- * Signature: ()D
- */
-JNIEXPORT jdouble JNICALL Java_TestClass1_dmn
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1
- * Method: omn
- * Signature: ()Ljava/lang/Object;
- */
-JNIEXPORT jobject JNICALL Java_TestClass1_omn
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1
- * Method: tmn
- * Signature: ()Ljava/lang/String;
- */
-JNIEXPORT jstring JNICALL Java_TestClass1_tmn
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1
- * Method: gmn
- * Signature: ()Ljava/util/List;
- */
-JNIEXPORT jobject JNICALL Java_TestClass1_gmn
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1
- * Method: vmn
- * Signature: ()V
- */
-JNIEXPORT void JNICALL Java_TestClass1_vmn
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1
- * Method: bamn
- * Signature: ()[B
- */
-JNIEXPORT jbyteArray JNICALL Java_TestClass1_bamn
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1
- * Method: samn
- * Signature: ()[S
- */
-JNIEXPORT jshortArray JNICALL Java_TestClass1_samn
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1
- * Method: iamn
- * Signature: ()[I
- */
-JNIEXPORT jintArray JNICALL Java_TestClass1_iamn
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1
- * Method: lamn
- * Signature: ()[J
- */
-JNIEXPORT jlongArray JNICALL Java_TestClass1_lamn
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1
- * Method: famn
- * Signature: ()[F
- */
-JNIEXPORT jfloatArray JNICALL Java_TestClass1_famn
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1
- * Method: damn
- * Signature: ()[D
- */
-JNIEXPORT jdoubleArray JNICALL Java_TestClass1_damn
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1
- * Method: oamn
- * Signature: ()[Ljava/lang/Object;
- */
-JNIEXPORT jobjectArray JNICALL Java_TestClass1_oamn
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1
- * Method: tamn
- * Signature: ()[Ljava/lang/String;
- */
-JNIEXPORT jobjectArray JNICALL Java_TestClass1_tamn
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1
- * Method: gamn
- * Signature: ()[Ljava/util/List;
- */
-JNIEXPORT jobjectArray JNICALL Java_TestClass1_gamn
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1
- * Method: baamn
- * Signature: ()[[B
- */
-JNIEXPORT jobjectArray JNICALL Java_TestClass1_baamn
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1
- * Method: saamn
- * Signature: ()[[S
- */
-JNIEXPORT jobjectArray JNICALL Java_TestClass1_saamn
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1
- * Method: iaamn
- * Signature: ()[[I
- */
-JNIEXPORT jobjectArray JNICALL Java_TestClass1_iaamn
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1
- * Method: laamn
- * Signature: ()[[J
- */
-JNIEXPORT jobjectArray JNICALL Java_TestClass1_laamn
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1
- * Method: faamn
- * Signature: ()[[F
- */
-JNIEXPORT jobjectArray JNICALL Java_TestClass1_faamn
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1
- * Method: daamn
- * Signature: ()[[D
- */
-JNIEXPORT jobjectArray JNICALL Java_TestClass1_daamn
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1
- * Method: oaamn
- * Signature: ()[[Ljava/lang/Object;
- */
-JNIEXPORT jobjectArray JNICALL Java_TestClass1_oaamn
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1
- * Method: taamn
- * Signature: ()[[Ljava/lang/String;
- */
-JNIEXPORT jobjectArray JNICALL Java_TestClass1_taamn
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1
- * Method: gaamn
- * Signature: ()[Ljava/util/List;
- */
-JNIEXPORT jobjectArray JNICALL Java_TestClass1_gaamn
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1
- * Method: bmn1
- * Signature: ()B
- */
-JNIEXPORT jbyte JNICALL Java_TestClass1_bmn1
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1
- * Method: smn1
- * Signature: ()S
- */
-JNIEXPORT jshort JNICALL Java_TestClass1_smn1
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1
- * Method: imn1
- * Signature: ()I
- */
-JNIEXPORT jint JNICALL Java_TestClass1_imn1
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1
- * Method: lmn1
- * Signature: ()J
- */
-JNIEXPORT jlong JNICALL Java_TestClass1_lmn1
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1
- * Method: fmn1
- * Signature: ()F
- */
-JNIEXPORT jfloat JNICALL Java_TestClass1_fmn1
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1
- * Method: dmn1
- * Signature: ()D
- */
-JNIEXPORT jdouble JNICALL Java_TestClass1_dmn1
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1
- * Method: omn1
- * Signature: ()Ljava/lang/Object;
- */
-JNIEXPORT jobject JNICALL Java_TestClass1_omn1
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1
- * Method: tmn1
- * Signature: ()Ljava/lang/String;
- */
-JNIEXPORT jstring JNICALL Java_TestClass1_tmn1
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1
- * Method: gmn1
- * Signature: ()Ljava/util/List;
- */
-JNIEXPORT jobject JNICALL Java_TestClass1_gmn1
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1
- * Method: vmn1
- * Signature: ()V
- */
-JNIEXPORT void JNICALL Java_TestClass1_vmn1
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1
- * Method: bmn2
- * Signature: (I)B
- */
-JNIEXPORT jbyte JNICALL Java_TestClass1_bmn2
- (JNIEnv *, jobject, jint);
-
-/*
- * Class: TestClass1
- * Method: smn2
- * Signature: (I)S
- */
-JNIEXPORT jshort JNICALL Java_TestClass1_smn2
- (JNIEnv *, jobject, jint);
-
-/*
- * Class: TestClass1
- * Method: imn2
- * Signature: (I)I
- */
-JNIEXPORT jint JNICALL Java_TestClass1_imn2
- (JNIEnv *, jobject, jint);
-
-/*
- * Class: TestClass1
- * Method: lmn2
- * Signature: (I)J
- */
-JNIEXPORT jlong JNICALL Java_TestClass1_lmn2
- (JNIEnv *, jobject, jint);
-
-/*
- * Class: TestClass1
- * Method: fmn2
- * Signature: (I)F
- */
-JNIEXPORT jfloat JNICALL Java_TestClass1_fmn2
- (JNIEnv *, jobject, jint);
-
-/*
- * Class: TestClass1
- * Method: dmn2
- * Signature: (I)D
- */
-JNIEXPORT jdouble JNICALL Java_TestClass1_dmn2
- (JNIEnv *, jobject, jint);
-
-/*
- * Class: TestClass1
- * Method: omn2
- * Signature: (I)Ljava/lang/Object;
- */
-JNIEXPORT jobject JNICALL Java_TestClass1_omn2
- (JNIEnv *, jobject, jint);
-
-/*
- * Class: TestClass1
- * Method: tmn2
- * Signature: (I)Ljava/lang/String;
- */
-JNIEXPORT jstring JNICALL Java_TestClass1_tmn2
- (JNIEnv *, jobject, jint);
-
-/*
- * Class: TestClass1
- * Method: gmn2
- * Signature: (I)Ljava/util/List;
- */
-JNIEXPORT jobject JNICALL Java_TestClass1_gmn2
- (JNIEnv *, jobject, jint);
-
-/*
- * Class: TestClass1
- * Method: vmn2
- * Signature: (I)V
- */
-JNIEXPORT void JNICALL Java_TestClass1_vmn2
- (JNIEnv *, jobject, jint);
-
-/*
- * Class: TestClass1
- * Method: mbn
- * Signature: (B)V
- */
-JNIEXPORT void JNICALL Java_TestClass1_mbn
- (JNIEnv *, jobject, jbyte);
-
-/*
- * Class: TestClass1
- * Method: msn
- * Signature: (S)V
- */
-JNIEXPORT void JNICALL Java_TestClass1_msn
- (JNIEnv *, jobject, jshort);
-
-/*
- * Class: TestClass1
- * Method: min
- * Signature: (I)V
- */
-JNIEXPORT void JNICALL Java_TestClass1_min
- (JNIEnv *, jobject, jint);
-
-/*
- * Class: TestClass1
- * Method: mln
- * Signature: (J)V
- */
-JNIEXPORT void JNICALL Java_TestClass1_mln
- (JNIEnv *, jobject, jlong);
-
-/*
- * Class: TestClass1
- * Method: mfn
- * Signature: (F)V
- */
-JNIEXPORT void JNICALL Java_TestClass1_mfn
- (JNIEnv *, jobject, jfloat);
-
-/*
- * Class: TestClass1
- * Method: mdn
- * Signature: (D)V
- */
-JNIEXPORT void JNICALL Java_TestClass1_mdn
- (JNIEnv *, jobject, jdouble);
-
-/*
- * Class: TestClass1
- * Method: mon
- * Signature: (Ljava/lang/Object;)V
- */
-JNIEXPORT void JNICALL Java_TestClass1_mon
- (JNIEnv *, jobject, jobject);
-
-/*
- * Class: TestClass1
- * Method: mtn
- * Signature: (Ljava/lang/String;)V
- */
-JNIEXPORT void JNICALL Java_TestClass1_mtn
- (JNIEnv *, jobject, jstring);
-
-/*
- * Class: TestClass1
- * Method: mgn
- * Signature: (Ljava/util/List;)V
- */
-JNIEXPORT void JNICALL Java_TestClass1_mgn
- (JNIEnv *, jobject, jobject);
-
-#ifdef __cplusplus
-}
-#endif
-#endif
-/* Header for class TestClass1_Inner2 */
-
-#ifndef _Included_TestClass1_Inner2
-#define _Included_TestClass1_Inner2
-#ifdef __cplusplus
-extern "C" {
-#endif
-#undef TestClass1_Inner2_bc
-#define TestClass1_Inner2_bc 0L
-#undef TestClass1_Inner2_sc
-#define TestClass1_Inner2_sc 0L
-#undef TestClass1_Inner2_ic
-#define TestClass1_Inner2_ic 0L
-#undef TestClass1_Inner2_lc
-#define TestClass1_Inner2_lc 0LL
-#undef TestClass1_Inner2_fc
-#define TestClass1_Inner2_fc 0.0f
-#undef TestClass1_Inner2_dc
-#define TestClass1_Inner2_dc 0.0
-/*
- * Class: TestClass1_Inner2
- * Method: bmn
- * Signature: ()B
- */
-JNIEXPORT jbyte JNICALL Java_TestClass1_00024Inner2_bmn
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1_Inner2
- * Method: smn
- * Signature: ()S
- */
-JNIEXPORT jshort JNICALL Java_TestClass1_00024Inner2_smn
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1_Inner2
- * Method: imn
- * Signature: ()I
- */
-JNIEXPORT jint JNICALL Java_TestClass1_00024Inner2_imn
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1_Inner2
- * Method: lmn
- * Signature: ()J
- */
-JNIEXPORT jlong JNICALL Java_TestClass1_00024Inner2_lmn
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1_Inner2
- * Method: fmn
- * Signature: ()F
- */
-JNIEXPORT jfloat JNICALL Java_TestClass1_00024Inner2_fmn
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1_Inner2
- * Method: dmn
- * Signature: ()D
- */
-JNIEXPORT jdouble JNICALL Java_TestClass1_00024Inner2_dmn
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1_Inner2
- * Method: omn
- * Signature: ()Ljava/lang/Object;
- */
-JNIEXPORT jobject JNICALL Java_TestClass1_00024Inner2_omn
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1_Inner2
- * Method: tmn
- * Signature: ()Ljava/lang/String;
- */
-JNIEXPORT jstring JNICALL Java_TestClass1_00024Inner2_tmn
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1_Inner2
- * Method: gmn
- * Signature: ()Ljava/util/List;
- */
-JNIEXPORT jobject JNICALL Java_TestClass1_00024Inner2_gmn
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1_Inner2
- * Method: vmn
- * Signature: ()V
- */
-JNIEXPORT void JNICALL Java_TestClass1_00024Inner2_vmn
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1_Inner2
- * Method: bmn1
- * Signature: ()B
- */
-JNIEXPORT jbyte JNICALL Java_TestClass1_00024Inner2_bmn1
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1_Inner2
- * Method: smn1
- * Signature: ()S
- */
-JNIEXPORT jshort JNICALL Java_TestClass1_00024Inner2_smn1
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1_Inner2
- * Method: imn1
- * Signature: ()I
- */
-JNIEXPORT jint JNICALL Java_TestClass1_00024Inner2_imn1
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1_Inner2
- * Method: lmn1
- * Signature: ()J
- */
-JNIEXPORT jlong JNICALL Java_TestClass1_00024Inner2_lmn1
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1_Inner2
- * Method: fmn1
- * Signature: ()F
- */
-JNIEXPORT jfloat JNICALL Java_TestClass1_00024Inner2_fmn1
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1_Inner2
- * Method: dmn1
- * Signature: ()D
- */
-JNIEXPORT jdouble JNICALL Java_TestClass1_00024Inner2_dmn1
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1_Inner2
- * Method: omn1
- * Signature: ()Ljava/lang/Object;
- */
-JNIEXPORT jobject JNICALL Java_TestClass1_00024Inner2_omn1
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1_Inner2
- * Method: tmn1
- * Signature: ()Ljava/lang/String;
- */
-JNIEXPORT jstring JNICALL Java_TestClass1_00024Inner2_tmn1
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1_Inner2
- * Method: gmn1
- * Signature: ()Ljava/util/List;
- */
-JNIEXPORT jobject JNICALL Java_TestClass1_00024Inner2_gmn1
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1_Inner2
- * Method: vmn1
- * Signature: ()V
- */
-JNIEXPORT void JNICALL Java_TestClass1_00024Inner2_vmn1
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1_Inner2
- * Method: bmn2
- * Signature: (I)B
- */
-JNIEXPORT jbyte JNICALL Java_TestClass1_00024Inner2_bmn2
- (JNIEnv *, jobject, jint);
-
-/*
- * Class: TestClass1_Inner2
- * Method: smn2
- * Signature: (I)S
- */
-JNIEXPORT jshort JNICALL Java_TestClass1_00024Inner2_smn2
- (JNIEnv *, jobject, jint);
-
-/*
- * Class: TestClass1_Inner2
- * Method: imn2
- * Signature: (I)I
- */
-JNIEXPORT jint JNICALL Java_TestClass1_00024Inner2_imn2
- (JNIEnv *, jobject, jint);
-
-/*
- * Class: TestClass1_Inner2
- * Method: lmn2
- * Signature: (I)J
- */
-JNIEXPORT jlong JNICALL Java_TestClass1_00024Inner2_lmn2
- (JNIEnv *, jobject, jint);
-
-/*
- * Class: TestClass1_Inner2
- * Method: fmn2
- * Signature: (I)F
- */
-JNIEXPORT jfloat JNICALL Java_TestClass1_00024Inner2_fmn2
- (JNIEnv *, jobject, jint);
-
-/*
- * Class: TestClass1_Inner2
- * Method: dmn2
- * Signature: (I)D
- */
-JNIEXPORT jdouble JNICALL Java_TestClass1_00024Inner2_dmn2
- (JNIEnv *, jobject, jint);
-
-/*
- * Class: TestClass1_Inner2
- * Method: omn2
- * Signature: (I)Ljava/lang/Object;
- */
-JNIEXPORT jobject JNICALL Java_TestClass1_00024Inner2_omn2
- (JNIEnv *, jobject, jint);
-
-/*
- * Class: TestClass1_Inner2
- * Method: tmn2
- * Signature: (I)Ljava/lang/String;
- */
-JNIEXPORT jstring JNICALL Java_TestClass1_00024Inner2_tmn2
- (JNIEnv *, jobject, jint);
-
-/*
- * Class: TestClass1_Inner2
- * Method: gmn2
- * Signature: (I)Ljava/util/List;
- */
-JNIEXPORT jobject JNICALL Java_TestClass1_00024Inner2_gmn2
- (JNIEnv *, jobject, jint);
-
-/*
- * Class: TestClass1_Inner2
- * Method: vmn2
- * Signature: (I)V
- */
-JNIEXPORT void JNICALL Java_TestClass1_00024Inner2_vmn2
- (JNIEnv *, jobject, jint);
-
-/*
- * Class: TestClass1_Inner2
- * Method: mbn
- * Signature: (B)V
- */
-JNIEXPORT void JNICALL Java_TestClass1_00024Inner2_mbn
- (JNIEnv *, jobject, jbyte);
-
-/*
- * Class: TestClass1_Inner2
- * Method: msn
- * Signature: (S)V
- */
-JNIEXPORT void JNICALL Java_TestClass1_00024Inner2_msn
- (JNIEnv *, jobject, jshort);
-
-/*
- * Class: TestClass1_Inner2
- * Method: min
- * Signature: (I)V
- */
-JNIEXPORT void JNICALL Java_TestClass1_00024Inner2_min
- (JNIEnv *, jobject, jint);
-
-/*
- * Class: TestClass1_Inner2
- * Method: mln
- * Signature: (J)V
- */
-JNIEXPORT void JNICALL Java_TestClass1_00024Inner2_mln
- (JNIEnv *, jobject, jlong);
-
-/*
- * Class: TestClass1_Inner2
- * Method: mfn
- * Signature: (F)V
- */
-JNIEXPORT void JNICALL Java_TestClass1_00024Inner2_mfn
- (JNIEnv *, jobject, jfloat);
-
-/*
- * Class: TestClass1_Inner2
- * Method: mdn
- * Signature: (D)V
- */
-JNIEXPORT void JNICALL Java_TestClass1_00024Inner2_mdn
- (JNIEnv *, jobject, jdouble);
-
-/*
- * Class: TestClass1_Inner2
- * Method: mon
- * Signature: (Ljava/lang/Object;)V
- */
-JNIEXPORT void JNICALL Java_TestClass1_00024Inner2_mon
- (JNIEnv *, jobject, jobject);
-
-/*
- * Class: TestClass1_Inner2
- * Method: mtn
- * Signature: (Ljava/lang/String;)V
- */
-JNIEXPORT void JNICALL Java_TestClass1_00024Inner2_mtn
- (JNIEnv *, jobject, jstring);
-
-/*
- * Class: TestClass1_Inner2
- * Method: mgn
- * Signature: (Ljava/util/List;)V
- */
-JNIEXPORT void JNICALL Java_TestClass1_00024Inner2_mgn
- (JNIEnv *, jobject, jobject);
-
-#ifdef __cplusplus
-}
-#endif
-#endif
-/* Header for class TestClass1_Inner1 */
-
-#ifndef _Included_TestClass1_Inner1
-#define _Included_TestClass1_Inner1
-#ifdef __cplusplus
-extern "C" {
-#endif
-#undef TestClass1_Inner1_bc
-#define TestClass1_Inner1_bc 0L
-#undef TestClass1_Inner1_sc
-#define TestClass1_Inner1_sc 0L
-#undef TestClass1_Inner1_ic
-#define TestClass1_Inner1_ic 0L
-#undef TestClass1_Inner1_lc
-#define TestClass1_Inner1_lc 0LL
-#undef TestClass1_Inner1_fc
-#define TestClass1_Inner1_fc 0.0f
-#undef TestClass1_Inner1_dc
-#define TestClass1_Inner1_dc 0.0
-/*
- * Class: TestClass1_Inner1
- * Method: bmn
- * Signature: ()B
- */
-JNIEXPORT jbyte JNICALL Java_TestClass1_00024Inner1_bmn
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1_Inner1
- * Method: smn
- * Signature: ()S
- */
-JNIEXPORT jshort JNICALL Java_TestClass1_00024Inner1_smn
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1_Inner1
- * Method: imn
- * Signature: ()I
- */
-JNIEXPORT jint JNICALL Java_TestClass1_00024Inner1_imn
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1_Inner1
- * Method: lmn
- * Signature: ()J
- */
-JNIEXPORT jlong JNICALL Java_TestClass1_00024Inner1_lmn
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1_Inner1
- * Method: fmn
- * Signature: ()F
- */
-JNIEXPORT jfloat JNICALL Java_TestClass1_00024Inner1_fmn
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1_Inner1
- * Method: dmn
- * Signature: ()D
- */
-JNIEXPORT jdouble JNICALL Java_TestClass1_00024Inner1_dmn
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1_Inner1
- * Method: omn
- * Signature: ()Ljava/lang/Object;
- */
-JNIEXPORT jobject JNICALL Java_TestClass1_00024Inner1_omn
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1_Inner1
- * Method: tmn
- * Signature: ()Ljava/lang/String;
- */
-JNIEXPORT jstring JNICALL Java_TestClass1_00024Inner1_tmn
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1_Inner1
- * Method: gmn
- * Signature: ()Ljava/util/List;
- */
-JNIEXPORT jobject JNICALL Java_TestClass1_00024Inner1_gmn
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1_Inner1
- * Method: vmn
- * Signature: ()V
- */
-JNIEXPORT void JNICALL Java_TestClass1_00024Inner1_vmn
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1_Inner1
- * Method: bmn1
- * Signature: ()B
- */
-JNIEXPORT jbyte JNICALL Java_TestClass1_00024Inner1_bmn1
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1_Inner1
- * Method: smn1
- * Signature: ()S
- */
-JNIEXPORT jshort JNICALL Java_TestClass1_00024Inner1_smn1
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1_Inner1
- * Method: imn1
- * Signature: ()I
- */
-JNIEXPORT jint JNICALL Java_TestClass1_00024Inner1_imn1
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1_Inner1
- * Method: lmn1
- * Signature: ()J
- */
-JNIEXPORT jlong JNICALL Java_TestClass1_00024Inner1_lmn1
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1_Inner1
- * Method: fmn1
- * Signature: ()F
- */
-JNIEXPORT jfloat JNICALL Java_TestClass1_00024Inner1_fmn1
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1_Inner1
- * Method: dmn1
- * Signature: ()D
- */
-JNIEXPORT jdouble JNICALL Java_TestClass1_00024Inner1_dmn1
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1_Inner1
- * Method: omn1
- * Signature: ()Ljava/lang/Object;
- */
-JNIEXPORT jobject JNICALL Java_TestClass1_00024Inner1_omn1
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1_Inner1
- * Method: tmn1
- * Signature: ()Ljava/lang/String;
- */
-JNIEXPORT jstring JNICALL Java_TestClass1_00024Inner1_tmn1
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1_Inner1
- * Method: gmn1
- * Signature: ()Ljava/util/List;
- */
-JNIEXPORT jobject JNICALL Java_TestClass1_00024Inner1_gmn1
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1_Inner1
- * Method: vmn1
- * Signature: ()V
- */
-JNIEXPORT void JNICALL Java_TestClass1_00024Inner1_vmn1
- (JNIEnv *, jobject);
-
-/*
- * Class: TestClass1_Inner1
- * Method: bmn2
- * Signature: (I)B
- */
-JNIEXPORT jbyte JNICALL Java_TestClass1_00024Inner1_bmn2
- (JNIEnv *, jobject, jint);
-
-/*
- * Class: TestClass1_Inner1
- * Method: smn2
- * Signature: (I)S
- */
-JNIEXPORT jshort JNICALL Java_TestClass1_00024Inner1_smn2
- (JNIEnv *, jobject, jint);
-
-/*
- * Class: TestClass1_Inner1
- * Method: imn2
- * Signature: (I)I
- */
-JNIEXPORT jint JNICALL Java_TestClass1_00024Inner1_imn2
- (JNIEnv *, jobject, jint);
-
-/*
- * Class: TestClass1_Inner1
- * Method: lmn2
- * Signature: (I)J
- */
-JNIEXPORT jlong JNICALL Java_TestClass1_00024Inner1_lmn2
- (JNIEnv *, jobject, jint);
-
-/*
- * Class: TestClass1_Inner1
- * Method: fmn2
- * Signature: (I)F
- */
-JNIEXPORT jfloat JNICALL Java_TestClass1_00024Inner1_fmn2
- (JNIEnv *, jobject, jint);
-
-/*
- * Class: TestClass1_Inner1
- * Method: dmn2
- * Signature: (I)D
- */
-JNIEXPORT jdouble JNICALL Java_TestClass1_00024Inner1_dmn2
- (JNIEnv *, jobject, jint);
-
-/*
- * Class: TestClass1_Inner1
- * Method: omn2
- * Signature: (I)Ljava/lang/Object;
- */
-JNIEXPORT jobject JNICALL Java_TestClass1_00024Inner1_omn2
- (JNIEnv *, jobject, jint);
-
-/*
- * Class: TestClass1_Inner1
- * Method: tmn2
- * Signature: (I)Ljava/lang/String;
- */
-JNIEXPORT jstring JNICALL Java_TestClass1_00024Inner1_tmn2
- (JNIEnv *, jobject, jint);
-
-/*
- * Class: TestClass1_Inner1
- * Method: gmn2
- * Signature: (I)Ljava/util/List;
- */
-JNIEXPORT jobject JNICALL Java_TestClass1_00024Inner1_gmn2
- (JNIEnv *, jobject, jint);
-
-/*
- * Class: TestClass1_Inner1
- * Method: vmn2
- * Signature: (I)V
- */
-JNIEXPORT void JNICALL Java_TestClass1_00024Inner1_vmn2
- (JNIEnv *, jobject, jint);
-
-/*
- * Class: TestClass1_Inner1
- * Method: mbn
- * Signature: (B)V
- */
-JNIEXPORT void JNICALL Java_TestClass1_00024Inner1_mbn
- (JNIEnv *, jobject, jbyte);
-
-/*
- * Class: TestClass1_Inner1
- * Method: msn
- * Signature: (S)V
- */
-JNIEXPORT void JNICALL Java_TestClass1_00024Inner1_msn
- (JNIEnv *, jobject, jshort);
-
-/*
- * Class: TestClass1_Inner1
- * Method: min
- * Signature: (I)V
- */
-JNIEXPORT void JNICALL Java_TestClass1_00024Inner1_min
- (JNIEnv *, jobject, jint);
-
-/*
- * Class: TestClass1_Inner1
- * Method: mln
- * Signature: (J)V
- */
-JNIEXPORT void JNICALL Java_TestClass1_00024Inner1_mln
- (JNIEnv *, jobject, jlong);
-
-/*
- * Class: TestClass1_Inner1
- * Method: mfn
- * Signature: (F)V
- */
-JNIEXPORT void JNICALL Java_TestClass1_00024Inner1_mfn
- (JNIEnv *, jobject, jfloat);
-
-/*
- * Class: TestClass1_Inner1
- * Method: mdn
- * Signature: (D)V
- */
-JNIEXPORT void JNICALL Java_TestClass1_00024Inner1_mdn
- (JNIEnv *, jobject, jdouble);
-
-/*
- * Class: TestClass1_Inner1
- * Method: mon
- * Signature: (Ljava/lang/Object;)V
- */
-JNIEXPORT void JNICALL Java_TestClass1_00024Inner1_mon
- (JNIEnv *, jobject, jobject);
-
-/*
- * Class: TestClass1_Inner1
- * Method: mtn
- * Signature: (Ljava/lang/String;)V
- */
-JNIEXPORT void JNICALL Java_TestClass1_00024Inner1_mtn
- (JNIEnv *, jobject, jstring);
-
-/*
- * Class: TestClass1_Inner1
- * Method: mgn
- * Signature: (Ljava/util/List;)V
- */
-JNIEXPORT void JNICALL Java_TestClass1_00024Inner1_mgn
- (JNIEnv *, jobject, jobject);
-
-#ifdef __cplusplus
-}
-#endif
-#endif
-/* Header for class TestClass2 */
-
-#ifndef _Included_TestClass2
-#define _Included_TestClass2
-#ifdef __cplusplus
-extern "C" {
-#endif
-#ifdef __cplusplus
-}
-#endif
-#endif
--- a/test/langtools/tools/javah/6572945/gold/jni.file.3 Wed Dec 13 14:21:12 2017 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,79 +0,0 @@
-/* DO NOT EDIT THIS FILE - it is machine generated */
-#include <jni.h>
-/* Header for class TestClass3 */
-
-#ifndef _Included_TestClass3
-#define _Included_TestClass3
-#ifdef __cplusplus
-extern "C" {
-#endif
-#ifdef __cplusplus
-}
-#endif
-#endif
-/* Header for class TestClass3_Inner2 */
-
-#ifndef _Included_TestClass3_Inner2
-#define _Included_TestClass3_Inner2
-#ifdef __cplusplus
-extern "C" {
-#endif
-#ifdef __cplusplus
-}
-#endif
-#endif
-/* Header for class TestClass3_Inner2_Inner2B */
-
-#ifndef _Included_TestClass3_Inner2_Inner2B
-#define _Included_TestClass3_Inner2_Inner2B
-#ifdef __cplusplus
-extern "C" {
-#endif
-#ifdef __cplusplus
-}
-#endif
-#endif
-/* Header for class TestClass3_Inner2_Inner2A */
-
-#ifndef _Included_TestClass3_Inner2_Inner2A
-#define _Included_TestClass3_Inner2_Inner2A
-#ifdef __cplusplus
-extern "C" {
-#endif
-#ifdef __cplusplus
-}
-#endif
-#endif
-/* Header for class TestClass3_Inner1 */
-
-#ifndef _Included_TestClass3_Inner1
-#define _Included_TestClass3_Inner1
-#ifdef __cplusplus
-extern "C" {
-#endif
-#ifdef __cplusplus
-}
-#endif
-#endif
-/* Header for class TestClass3_Inner1_Inner1B */
-
-#ifndef _Included_TestClass3_Inner1_Inner1B
-#define _Included_TestClass3_Inner1_Inner1B
-#ifdef __cplusplus
-extern "C" {
-#endif
-#ifdef __cplusplus
-}
-#endif
-#endif
-/* Header for class TestClass3_Inner1_Inner1A */
-
-#ifndef _Included_TestClass3_Inner1_Inner1A
-#define _Included_TestClass3_Inner1_Inner1A
-#ifdef __cplusplus
-extern "C" {
-#endif
-#ifdef __cplusplus
-}
-#endif
-#endif
--- a/test/langtools/tools/javah/ModuleClass.java Wed Dec 13 14:21:12 2017 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,64 +0,0 @@
-/*
- * Copyright (c) 2012, 2016, 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.
- *
- * 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.
- */
-
-/*
- * @test
- * @bug 8049811
- * @summary javah should accept module/class names
- * @library /tools/lib
- * @modules jdk.compiler/com.sun.tools.javac.api
- * jdk.compiler/com.sun.tools.javac.main
- * jdk.compiler/com.sun.tools.javah
- * @build toolbox.ToolBox toolbox.JavahTask
- * @run main ModuleClass
- */
-
-import java.util.List;
-
-import toolbox.JavahTask;
-import toolbox.ToolBox;
-
-public class ModuleClass {
- static public void main(String[] args) throws Exception {
- ToolBox tb = new ToolBox();
- check(tb, "java.lang.Object");
- check(tb, "java.base/java.io.File");
- }
-
- static void check(ToolBox tb, String name) throws Exception {
- new JavahTask(tb)
- .classes(name)
- .run();
-
- int sep = name.indexOf("/");
- String className = (sep == -1) ? name : name.substring(sep + 1);
- String file = className.replace(".", "_") + ".h";
- List<String> outObject = tb.readAllLines(file);
-
- String text = "#ifndef _Included_" + className.replace(".", "_");
- if (!outObject.contains(text)) {
- throw new Exception("expected line not found");
- }
- }
-}
-
--- a/test/langtools/tools/javah/ReadOldClass.sh Wed Dec 13 14:21:12 2017 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,77 +0,0 @@
-#!/bin/sh
-
-#
-# Copyright (c) 2005, 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.
-#
-# 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.
-#
-
-#
-# @test
-# @bug 4164450
-# @summary Ensure that javah/javadoc doesn't try to read (new) source files
-# @author Peter von der Ah\u00e9
-# @run shell ReadOldClass.sh
-#
-
-TS=${TESTSRC-.}
-TC=${TESTCLASSES-.}
-
-if [ "${TESTJAVA}" = "" ]
-then
- echo "TESTJAVA not set. Test cannot execute. Failed."
- exit 1
-fi
-
-# set platform-dependent variables
-OS=`uname -s`
-case "$OS" in
- SunOS | Linux | Darwin | CYGWIN* )
- PS=":"
- FS="/"
- ;;
- Windows* )
- PS=";"
- FS="\\"
- ;;
- * )
- echo "Unrecognized system!"
- exit 1;
- ;;
-esac
-
-cat > "${TC}/ReadOldClass.java" <<EOF
-public class ReadOldClass {
- public static void main(String[] args) {
- }
-}
-EOF
-
-rm -f ${TC}/ReadOldClass.h
-
-set -e
-
-# compile the file
-"${TESTJAVA}${FS}bin${FS}javac" ${TESTTOOLVMOPTS} -d "${TC}" "${TC}/ReadOldClass.java"
-# ensure the source file is newer than the class file
-touch "${TC}/ReadOldClass.java"
-"${TESTJAVA}${FS}bin${FS}javah" ${TESTTOOLVMOPTS} -jni -classpath "${TC}" -d "${TC}" ReadOldClass
-
-test -f "${TC}/ReadOldClass.h"
--- a/test/langtools/tools/javah/T4942232/MissingParamClassTest.java Wed Dec 13 14:21:12 2017 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,85 +0,0 @@
-/*
- * Copyright (c) 2013, 2016, 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.
- *
- * 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.
- */
-
-/*
- * @test
- * @bug 4942232
- * @summary Verifies that javah won't attempt to generate a header file if a
- * native method in a supplied class contains a parameter type whose corresponding
- * class is missing or not in the classpath
- * @library /tools/lib
- * @modules jdk.compiler/com.sun.tools.javac.api
- * jdk.compiler/com.sun.tools.javac.main
- * jdk.compiler/com.sun.tools.javah
- * @build toolbox.ToolBox toolbox.JavahTask
- * @run compile MissingParamClassTest.java
- * @clean MissingParamClassException
- * @run main MissingParamClassTest
- * @run compile MissingParamClassTest.java
- * @clean Param
- * @run main MissingParamClassTest
- */
-
-import java.nio.file.Files;
-import java.nio.file.Paths;
-
-import toolbox.JavahTask;
-import toolbox.Task;
-import toolbox.ToolBox;
-
-// Original test: test/tools/javah/MissingParamClassTest.sh
-public class MissingParamClassTest {
-
- public static void main(String[] args) throws Exception {
- ToolBox tb = new ToolBox();
-
- String out = new JavahTask(tb)
- .classpath(ToolBox.testClasses)
- .classes("ParamClassTest")
- .run(Task.Expect.FAIL)
- .getOutput(Task.OutputKind.DIRECT);
-
- if (Files.exists(Paths.get("ParamClassTest.h")) || out.isEmpty())
- throw new AssertionError("The only output generated by javah must be an error message");
- }
-
-}
-
-class MissingParamClassException extends Exception {
- public MissingParamClassException() {
- System.out.println("MissingParamClassException constructor called");
- }
-}
-
-class ParamClassTest {
- public native void method(Param s);
-
- public static void main(String args[]) {
- }
-}
-
-class Param extends MissingParamClassException {
- Param() {
- System.out.println("Param constructor");
- }
-}
--- a/test/langtools/tools/javah/T5070898.java Wed Dec 13 14:21:12 2017 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,99 +0,0 @@
-/*
- * Copyright (c) 2007, 2015, 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.
- *
- * 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.
- */
-
-/* @test
- * @bug 5070898
- * @summary javah command doesn't throw correct exit code in case of error
- * @modules java.compiler
- * jdk.compiler
- */
-
-import java.io.*;
-import java.util.*;
-import javax.tools.*;
-
-public class T5070898
-{
- public static void main(String... args) throws Exception {
- new T5070898().run();
- }
-
- public void run() throws Exception {
- writeFile();
- compileFile();
-
- int rc = runJavah();
- System.err.println("exit code: " + rc);
- if (rc == 0)
- throw new Exception("unexpected exit code: " + rc);
- }
-
- void writeFile() throws Exception {
- String content =
- "package test;\n" +
- "public class JavahTest{\n" +
- " public static void main(String args){\n" +
- " System.out.println(\"Test Message\");" +
- " }\n" +
- " private static native Object nativeTest();\n" +
- "}\n";
- FileWriter out = new FileWriter("JavahTest.java");
- try {
- out.write(content);
- } finally {
- out.close();
- }
- }
-
- void compileFile() throws Exception {
- JavaCompiler javac = ToolProvider.getSystemJavaCompiler();
- int rc = javac.run(null, null, null, "JavahTest.java");
- if (rc != 0)
- throw new Exception("compilation failed");
- }
-
- int runJavah() throws Exception {
- List<String> cmd = new ArrayList<String>();
- File java_home = new File(System.getProperty("java.home"));
- cmd.add(new File(new File(java_home, "bin"), "javah").getPath());
-
- cmd.add("JavahTest");
-
- ProcessBuilder pb = new ProcessBuilder(cmd);
- pb.redirectErrorStream(true);
- pb.environment().remove("CLASSPATH");
- Process p = pb.start();
- p.getOutputStream().close();
-
- String line;
- DataInputStream in = new DataInputStream(p.getInputStream());
- try {
- while ((line = in.readLine()) != null)
- System.err.println(line);
- } finally {
- in.close();
- }
-
- return p.waitFor();
- }
-}
--- a/test/langtools/tools/javah/T6893943.java Wed Dec 13 14:21:12 2017 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,87 +0,0 @@
-/*
- * Copyright (c) 2010, 2016, 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.
- *
- * 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.
- */
-
-/*
- * @test
- * @bug 6893943 6937318
- * @summary exit code from javah with no args is 0
- * @modules jdk.compiler/com.sun.tools.javah
- */
-
-import java.io.*;
-import java.util.*;
-
-public class T6893943 {
- static final String[] NO_ARGS = { "-XDsuppress-tool-removal-message" };
- static final String[] SUPPRESS_WARNING_PLUS_HELP = { "-XDsuppress-tool-removal-message", "-help" };
- static final String NEWLINE = System.getProperty("line.separator");
-
- public static void main(String... args) throws Exception {
- new T6893943().run();
- }
-
- void run() throws Exception {
- testSimpleAPI(NO_ARGS, 1);
- testSimpleAPI(SUPPRESS_WARNING_PLUS_HELP, 0);
- testCommand(NO_ARGS, 1);
- testCommand(SUPPRESS_WARNING_PLUS_HELP, 0);
- }
-
- void testSimpleAPI(String[] args, int expect_rc) throws Exception {
- System.err.println("Test simple api: " + Arrays.asList(args));
- StringWriter sw = new StringWriter();
- PrintWriter pw = new PrintWriter(sw);
- int rc = com.sun.tools.javah.Main.run(args, pw);
- pw.close();
- expect("testSimpleAPI", sw.toString(), rc, expect_rc);
- }
-
- void testCommand(String[] args, int expect_rc) throws Exception {
- System.err.println("Test command: " + Arrays.asList(args));
- File javaHome = new File(System.getProperty("java.home"));
- List<String> command = new ArrayList<String>();
- command.add(new File(new File(javaHome, "bin"), "javah").getPath());
- command.addAll(Arrays.asList(args));
- //System.err.println("command: " + command);
-
- ProcessBuilder pb = new ProcessBuilder(command);
- pb.redirectErrorStream(true);
- Process p = pb.start();
- p.getOutputStream().close();
- StringWriter sw = new StringWriter();
- String line;
- BufferedReader in = new BufferedReader(new InputStreamReader(p.getInputStream()));
- while ((line = in.readLine()) != null)
- sw.write(line + NEWLINE);
- int rc = p.waitFor();
- expect("testCommand", sw.toString(), rc, expect_rc);
- }
-
- void expect(String name, String out, int actual_rc, int expect_rc) throws Exception {
- if (out.isEmpty())
- throw new Exception("No output from javah");
-
- if (actual_rc != expect_rc)
- throw new Exception(name + ": unexpected exit: " + actual_rc + ", expected: " + expect_rc);
- }
-}
--- a/test/langtools/tools/javah/T6994608.java Wed Dec 13 14:21:12 2017 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,90 +0,0 @@
-/*
- * Copyright (c) 2010, 2016, 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.
- *
- * 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.
- */
-
-/*
- * @test
- * @bug 6994608
- * @summary javah no longer accepts parameter files as input
- * @modules jdk.compiler/com.sun.tools.javah
- */
-
-import java.io.*;
-import java.util.*;
-
-public class T6994608 {
- public static void main(String... args) throws Exception {
- new T6994608().run();
- }
-
- void run() throws Exception {
- Locale prev = Locale.getDefault();
- Locale.setDefault(Locale.ENGLISH);
- try {
- File f = writeFile(new File("classList"), "java.lang.Object");
- test(Arrays.asList("@" + f.getPath()), 0, null);
- test(Arrays.asList("@badfile"), 1, "Can't find file badfile");
- if (errors > 0)
- throw new Exception(errors + " errors occurred");
- } finally {
- Locale.setDefault(prev);
- }
- }
-
- void test(List<String> args, int expectRC, String expectOut) {
- System.err.println("Test: " + args
- + " rc:" + expectRC
- + ((expectOut != null) ? " out:" + expectOut : ""));
-
- StringWriter sw = new StringWriter();
- PrintWriter pw = new PrintWriter(sw);
- int rc = com.sun.tools.javah.Main.run(args.toArray(new String[args.size()]), pw);
- pw.close();
- String out = sw.toString();
- if (!out.isEmpty())
- System.err.println(out);
-
- if (rc != expectRC)
- error("Unexpected exit code: " + rc + "; expected: " + expectRC);
- if (expectOut != null && !out.contains(expectOut))
- error("Expected string not found: " + expectOut);
-
- System.err.println();
- }
-
- File writeFile(File f, String s) throws IOException {
- if (f.getParentFile() != null)
- f.getParentFile().mkdirs();
- try (FileWriter out = new FileWriter(f)) {
- out.write(s);
- }
- return f;
- }
-
- void error(String msg) {
- System.err.println(msg);
- errors++;
- }
-
- int errors;
-}
-
--- a/test/langtools/tools/javah/T7126832/T7126832.java Wed Dec 13 14:21:12 2017 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,108 +0,0 @@
-/*
- * Copyright (c) 2012, 2016, 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.
- *
- * 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.
- */
-
-/*
- * @test
- * @bug 7126832
- * @modules jdk.compiler/com.sun.tools.javah
- * @compile java.java
- * @summary com.sun.tools.javac.api.ClientCodeWrapper$WrappedJavaFileManager cannot be cast
- * @run main T7126832
- */
-
-import java.io.*;
-import java.util.*;
-
-public class T7126832 {
- public static void main(String... args) throws Exception {
- new T7126832().run();
- }
-
- void run() throws Exception {
- Locale prev = Locale.getDefault();
- Locale.setDefault(Locale.ENGLISH);
- try {
- // Verify that a .java file is correctly diagnosed
- File ff = writeFile(new File("JavahTest.java"), "class JavahTest {}");
- test(Arrays.asList(ff.getPath()), 1, "Could not find class file for 'JavahTest.java'.");
-
- // Verify that a class named 'xx.java' is accepted.
- // Note that ./xx/java.class exists, so this should work ok
- test(Arrays.asList("xx.java"), 0, null);
-
- if (errors > 0) {
- throw new Exception(errors + " errors occurred");
- }
- } finally {
- Locale.setDefault(prev);
- }
- }
-
- void test(List<String> args, int expectRC, String expectOut) {
- System.err.println("Test: " + args
- + " rc:" + expectRC
- + ((expectOut != null) ? " out:" + expectOut : ""));
-
- StringWriter sw = new StringWriter();
- PrintWriter pw = new PrintWriter(sw);
- int rc = 0;
- String out = null;
- try {
- rc = com.sun.tools.javah.Main.run(args.toArray(new String[args.size()]), pw);
- out = sw.toString();
- } catch(Exception ee) {
- rc = 1;
- out = ee.toString();;
- }
- pw.close();
- if (!out.isEmpty()) {
- System.err.println(out);
- }
- if (rc != expectRC) {
- error("Unexpected exit code: " + rc + "; expected: " + expectRC);
- }
- if (expectOut != null && !out.contains(expectOut)) {
- error("Expected string not found: " + expectOut);
- }
-
- System.err.println();
- }
-
- File writeFile(File ff, String ss) throws IOException {
- if (ff.getParentFile() != null)
- ff.getParentFile().mkdirs();
-
- try (FileWriter out = new FileWriter(ff)) {
- out.write(ss);
- }
- return ff;
- }
-
- void error(String msg) {
- System.err.println(msg);
- errors++;
- }
-
- int errors;
-}
-
--- a/test/langtools/tools/javah/T7126832/java.java Wed Dec 13 14:21:12 2017 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,27 +0,0 @@
-/*
- * Copyright (c) 2012, 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.
- *
- * 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 xx;
-class java {
- int fred;
-}
--- a/test/langtools/tools/javah/T7185778.java Wed Dec 13 14:21:12 2017 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,57 +0,0 @@
-/*
- * Copyright (c) 2012, 2016, 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.
- *
- * 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.
- */
-
-/*
- * @test
- * @bug 7185778
- * @summary javah error "Not a valid class name" on class names with dollar signs
- * The first two tests are on an inner class name whose name does not contain $.
- * The second two tests are on an inner class name whose name does contain $.
- * The last test is on an outer class whose name contains $.
- * @modules jdk.compiler/com.sun.tools.javah
- * @run main T7185778 T7185778$inner
- * @run main T7185778 T7185778.inner
- * @run main T7185778 T7185778$inner$
- * @run main T7185778 T7185778.inner$
- * @run main T7185778 xx$yy
- */
-
-public class T7185778 {
- class inner {
- native byte[] xxxxx(String name);
- }
- class inner$ {
- native byte[] xxxxx(String name);
- }
-
- static public void main(String[] args) {
- int rc = com.sun.tools.javah.Main.run(args, null);
- if ( rc != 0) {
- throw new Error("javah returned non zero: " + rc);
- }
- }
-}
-
-class xx$yy {
- native byte[] xxxxx(String name);
-}
--- a/test/langtools/tools/javah/TestHelpOpts.java Wed Dec 13 14:21:12 2017 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,82 +0,0 @@
-/*
- * Copyright (c) 2010, 2016, 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.
- *
- * 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.
- */
-
-/*
- * @test
- * @bug 6893932 6990390
- * @summary javah help screen lists -h and -? but does not accept them
- * @modules jdk.compiler/com.sun.tools.javah
- */
-
-import java.io.*;
-import java.util.*;
-
-public class TestHelpOpts {
- public static void main(String... args) throws Exception {
- new TestHelpOpts().run();
- }
-
- void run() throws Exception {
- Locale prev = Locale.getDefault();
- try {
- Locale.setDefault(Locale.ENGLISH);
-
- String[] opts = { "-h", "-help", "-?", "--help" };
- for (String opt: opts)
- test(opt);
- } finally {
- Locale.setDefault(prev);
- }
-
- if (errors > 0)
- throw new Exception(errors + " errors occurred");
- }
-
- void test(String opt) {
- System.err.println("test " + opt);
- String[] args = { opt };
-
- StringWriter sw = new StringWriter();
- PrintWriter pw = new PrintWriter(sw);
- int rc = com.sun.tools.javah.Main.run(args, pw);
- pw.close();
- String out = sw.toString();
- if (!out.isEmpty())
- System.err.println(out);
- if (rc != 0)
- error("Unexpected exit: rc=" + rc);
-
- String flat = out.replaceAll("\\s+", " "); // canonicalize whitespace
- if (!flat.contains("Usage: javah [options] <classes> where [options] include:"))
- error("expected text not found");
- if (flat.contains("main.opt"))
- error("key not found in resource bundle: " + flat.replaceAll(".*(main.opt.[^ ]*).*", "$1"));
- }
-
- void error(String msg) {
- System.err.println(msg);
- errors++;
- }
-
- int errors;
-}
--- a/test/langtools/tools/javah/VersionTest.java Wed Dec 13 14:21:12 2017 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,60 +0,0 @@
-/*
- * Copyright (c) 2010, 2016, 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.
- *
- * 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.
- */
-
-/*
- * @test
- * @bug 6890226
- * @summary javah -version is broken
- * @modules jdk.compiler/com.sun.tools.javah
- */
-
-import java.io.*;
-import java.util.Locale;
-
-public class VersionTest {
- public static void main(String... args) {
- Locale prev = Locale.getDefault();
- try {
- Locale.setDefault(Locale.ENGLISH);
- System.err.println(Locale.getDefault());
- test("-version -XDsuppress-tool-removal-message", "\\S+ version \"\\S+\"");
- test("-fullversion -XDsuppress-tool-removal-message", "\\S+ full version \"\\S+\"");
- } finally {
- Locale.setDefault(prev);
- }
- }
-
- static void test(String option, String regex) {
- StringWriter sw = new StringWriter();
- PrintWriter pw = new PrintWriter(sw);
- String[] args = option.split(" ");
- int rc = com.sun.tools.javah.Main.run(args, pw);
- pw.close();
- if (rc != 0)
- throw new Error("javah failed: rc=" + rc);
- String out = sw.toString().trim();
- System.err.println(out);
- if (!out.matches(regex))
- throw new Error("output does not match pattern: " + regex);
- }
-}
--- a/test/langtools/tools/javah/constMacroTest/ConstMacroTest.java Wed Dec 13 14:21:12 2017 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,117 +0,0 @@
-/*
- * Copyright (c) 2013, 2016, 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.
- *
- * 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.
- */
-
-/*
- * @test
- * @bug 4786406 4781221 4780341 6214324
- * @summary Validates rewritten javah handling of class defined constants and
- * ensures that the appropriate macro definitions are placed in the generated
- * header file.
- * @library /tools/lib
- * @modules jdk.compiler/com.sun.tools.javac.api
- * jdk.compiler/com.sun.tools.javac.main
- * jdk.compiler/com.sun.tools.javah
- * @build toolbox.ToolBox toolbox.JavahTask
- * @run main ConstMacroTest
- */
-
-import java.io.*;
-import java.util.List;
-
-import toolbox.JavahTask;
-import toolbox.ToolBox;
-
-// Original test: test/tools/javah/ConstMacroTest.sh
-public class ConstMacroTest {
-
- private static final String subClassConstsGoldenFileTemplate =
- "/* DO NOT EDIT THIS FILE - it is machine generated */\n" +
- "#include <jni.h>\n" +
- "/* Header for class SubClassConsts */\n" +
- "\n" +
- "#ifndef _Included_SubClassConsts\n" +
- "#define _Included_SubClassConsts\n" +
- "#ifdef __cplusplus\n" +
- "extern \"C\" {\n" +
- "#endif\n" +
- "#undef SubClassConsts_serialVersionUID\n" +
- "#define SubClassConsts_serialVersionUID 6733861379283244755%s\n" +
- "#undef SubClassConsts_SUPER_INT_CONSTANT\n" +
- "#define SubClassConsts_SUPER_INT_CONSTANT 3L\n" +
- "#undef SubClassConsts_SUPER_FLOAT_CONSTANT\n" +
- "#define SubClassConsts_SUPER_FLOAT_CONSTANT 99.3f\n" +
- "#undef SubClassConsts_SUPER_DOUBLE_CONSTANT\n" +
- "#define SubClassConsts_SUPER_DOUBLE_CONSTANT 33.2\n" +
- "#undef SubClassConsts_SUPER_BOOLEAN_CONSTANT\n" +
- "#define SubClassConsts_SUPER_BOOLEAN_CONSTANT 0L\n" +
- "#undef SubClassConsts_SUB_INT_CONSTANT\n" +
- "#define SubClassConsts_SUB_INT_CONSTANT 2L\n" +
- "#undef SubClassConsts_SUB_DOUBLE_CONSTANT\n" +
- "#define SubClassConsts_SUB_DOUBLE_CONSTANT 2.25\n" +
- "#undef SubClassConsts_SUB_FLOAT_CONSTANT\n" +
- "#define SubClassConsts_SUB_FLOAT_CONSTANT 7.9f\n" +
- "#undef SubClassConsts_SUB_BOOLEAN_CONSTANT\n" +
- "#define SubClassConsts_SUB_BOOLEAN_CONSTANT 1L\n" +
- "#ifdef __cplusplus\n" +
- "}\n" +
- "#endif\n" +
- "#endif";
-
- public static void main(String[] args) throws Exception {
- ToolBox tb = new ToolBox();
-
- new JavahTask(tb)
- .classpath(ToolBox.testClasses)
- .classes("SubClassConsts")
- .run();
-
- String longSuffix = tb.isWindows() ? "i64" : "LL";
- List<String> subClassConstsGoldenFile = tb.split(
- String.format(subClassConstsGoldenFileTemplate, longSuffix), "\n");
-
- List<String> subClassConstsFile = tb.readAllLines("SubClassConsts.h");
-
- tb.checkEqual(subClassConstsFile, subClassConstsGoldenFile);
- }
-
-}
-
-class SuperClassConsts implements Serializable {
- // Define class constant values, base class is serializable
- private static final long serialVersionUID = 6733861379283244755L;
- public static final int SUPER_INT_CONSTANT = 3;
- public final static float SUPER_FLOAT_CONSTANT = 99.3f;
- public final static double SUPER_DOUBLE_CONSTANT = 33.2;
- public final static boolean SUPER_BOOLEAN_CONSTANT = false;
- // A token instance field
- int instanceField;
-
- public native int numValues();
-}
-
-class SubClassConsts extends SuperClassConsts {
- private final static int SUB_INT_CONSTANT = 2;
- private final static double SUB_DOUBLE_CONSTANT = 2.25;
- private final static float SUB_FLOAT_CONSTANT = 7.90f;
- private final static boolean SUB_BOOLEAN_CONSTANT = true;
-}
--- a/test/langtools/tools/lib/toolbox/JavahTask.java Wed Dec 13 14:21:12 2017 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,122 +0,0 @@
-/*
- * Copyright (c) 2013, 2016, 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.
- *
- * 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 toolbox;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * A task to configure and run the native header tool, javah.
- */
-public class JavahTask extends AbstractTask<JavahTask> {
- private String classpath;
- private List<String> options;
- private List<String> classes;
-
- /**
- * Create a task to execute {@code javah} using {@code CMDLINE} mode.
- * @param toolBox the {@code ToolBox} to use
- */
- public JavahTask(ToolBox toolBox) {
- super(toolBox, Task.Mode.CMDLINE);
- }
-
- /**
- * Sets the classpath.
- * @param classpath the classpath
- * @return this task object
- */
- public JavahTask classpath(String classpath) {
- this.classpath = classpath;
- return this;
- }
-
- /**
- * Sets the options.
- * @param options the options
- * @return this task object
- */
- public JavahTask options(String... options) {
- this.options = Arrays.asList(options);
- return this;
- }
-
- /**
- * Sets the classes to be analyzed.
- * @param classes the classes
- * @return this task object
- */
- public JavahTask classes(String... classes) {
- this.classes = Arrays.asList(classes);
- return this;
- }
-
- /**
- * {@inheritDoc}
- * @return the name "javah"
- */
- @Override
- public String name() {
- return "javah";
- }
-
- /**
- * Calls the javah tool with the arguments as currently configured.
- * @return a Result object indicating the outcome of the task
- * and the content of any output written to stdout, stderr, or the
- * main stream provided to the task.
- * @throws TaskError if the outcome of the task is not as expected.
- */
- @Override
- public Task.Result run() {
- List<String> args = new ArrayList<>();
- if (options != null)
- args.addAll(options);
- if (classpath != null) {
- args.add("-classpath");
- args.add(classpath);
- }
- if (classes != null)
- args.addAll(classes);
-
- AbstractTask.WriterOutput direct = new AbstractTask.WriterOutput();
- // These are to catch output to System.out and System.err,
- // in case these are used instead of the primary streams
- AbstractTask.StreamOutput sysOut = new AbstractTask.StreamOutput(System.out, System::setOut);
- AbstractTask.StreamOutput sysErr = new AbstractTask.StreamOutput(System.err, System::setErr);
- int rc;
- Map<Task.OutputKind, String> outputMap = new HashMap<>();
- try {
- rc = com.sun.tools.javah.Main.run(args.toArray(new String[args.size()]), direct.pw);
- } finally {
- outputMap.put(Task.OutputKind.STDOUT, sysOut.close());
- outputMap.put(Task.OutputKind.STDERR, sysErr.close());
- outputMap.put(Task.OutputKind.DIRECT, direct.close());
- }
- return checkExit(new Task.Result(toolBox, this, rc, outputMap));
- }
-}
--- a/test/langtools/tools/lib/toolbox/ModuleBuilder.java Wed Dec 13 14:21:12 2017 -0800
+++ b/test/langtools/tools/lib/toolbox/ModuleBuilder.java Mon Dec 18 10:28:43 2017 -0800
@@ -43,6 +43,7 @@
private final ToolBox tb;
private final String name;
private String comment = "";
+ private boolean open;
private List<String> requires = new ArrayList<>();
private List<String> exports = new ArrayList<>();
private List<String> opens = new ArrayList<>();
@@ -53,11 +54,22 @@
/**
* Creates a builder for a module.
- * @param tb a Toolbox that can be used to compile the module declaration.
+ * @param tb a Toolbox that can be used to compile the module declaration
* @param name the name of the module to be built
*/
public ModuleBuilder(ToolBox tb, String name) {
+ this(tb, false, name);
+ }
+
+ /**
+ * Creates a builder for a module.
+ * @param tb a Toolbox that can be used to compile the module declaration
+ * @param open whether or not this is an open module
+ * @param name the name of the module to be built
+ */
+ public ModuleBuilder(ToolBox tb, boolean open, String name) {
this.tb = tb;
+ this.open = open;
this.name = name;
}
@@ -214,6 +226,9 @@
.append(comment.replace("\n", "\n * "))
.append("\n */\n");
}
+ if (open) {
+ sb.append("open ");
+ }
sb.append("module ").append(name).append(" {\n");
requires.forEach(r -> sb.append(" " + r + "\n"));
exports.forEach(e -> sb.append(" " + e + "\n"));
--- a/test/langtools/tools/lib/toolbox/ToolBox.java Wed Dec 13 14:21:12 2017 -0800
+++ b/test/langtools/tools/lib/toolbox/ToolBox.java Mon Dec 18 10:28:43 2017 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 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
@@ -524,6 +524,8 @@
return source;
}
+ private static Pattern commentPattern =
+ Pattern.compile("(?s)(\\s+//.*?\n|/\\*.*?\\*/)");
private static Pattern modulePattern =
Pattern.compile("module\\s+((?:\\w+\\.)*)");
private static Pattern packagePattern =
@@ -533,13 +535,24 @@
/**
* Extracts the Java file name from the class declaration.
- * This method is intended for simple files and uses regular expressions,
- * so comments matching the pattern can make the method fail.
+ * This method is intended for simple files and uses regular expressions.
+ * Comments in the source are stripped before looking for the
+ * declarations from which the name is derived.
*/
static String getJavaFileNameFromSource(String source) {
+ StringBuilder sb = new StringBuilder();
+ Matcher matcher = commentPattern.matcher(source);
+ int start = 0;
+ while (matcher.find()) {
+ sb.append(source.substring(start, matcher.start()));
+ start = matcher.end();
+ }
+ sb.append(source.substring(start));
+ source = sb.toString();
+
String packageName = null;
- Matcher matcher = modulePattern.matcher(source);
+ matcher = modulePattern.matcher(source);
if (matcher.find())
return "module-info.java";
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/nashorn/script/basic/JDK-8191301.js Mon Dec 18 10:28:43 2017 -0800
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * 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.
+ */
+
+/**
+ * JDK-8191301 : JavaImporter fails to resolve imported elements within functions, that contain too many statements
+ *
+ * @test
+ * @run
+ * @option -Dnashorn.compiler.splitter.threshold=150
+ * @fork
+ */
+
+var imports = new JavaImporter(java.lang);
+with (imports) {
+ function func() {
+ System.out.println('a');
+ System.out.println('a');
+ System.out.println('a');
+ System.out.println('a');
+ System.out.println('a');
+ System.out.println('a');
+ System.out.println('a');
+ };
+ func();
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/nashorn/script/basic/JDK-8191301.js.EXPECTED Mon Dec 18 10:28:43 2017 -0800
@@ -0,0 +1,7 @@
+a
+a
+a
+a
+a
+a
+a
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/nashorn/src/jdk/nashorn/api/tree/test/JDK_8193296_Test.java Mon Dec 18 10:28:43 2017 -0800
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 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
+ * 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 jdk.nashorn.api.tree.test;
+
+import jdk.nashorn.api.tree.CompilationUnitTree;
+import jdk.nashorn.api.tree.ExpressionStatementTree;
+import jdk.nashorn.api.tree.FunctionCallTree;
+import jdk.nashorn.api.tree.Parser;
+import jdk.nashorn.api.tree.Tree;
+import jdk.nashorn.api.tree.UnaryTree;
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/**
+ * @test
+ * @bug 8184723
+ * @summary Parser should not eagerly transform delete expressions
+ * @run testng jdk.nashorn.api.tree.test.JDK_8193296_Test
+ */
+public class JDK_8193296_Test {
+ @Test
+ public void test() {
+ Parser p = Parser.create();
+ CompilationUnitTree t = p.parse("test", "function x() { }; delete x();", System.out::println);
+ Assert.assertEquals(t.getSourceElements().size(), 2);
+ Tree delt = ((ExpressionStatementTree)t.getSourceElements().get(1)).getExpression();
+ Assert.assertTrue(delt instanceof UnaryTree, delt.getClass().getName());
+ UnaryTree del = (UnaryTree)delt;
+ Assert.assertEquals(del.getKind(), Tree.Kind.DELETE);
+ Assert.assertTrue(del.getExpression() instanceof FunctionCallTree, del.getExpression().getClass().getName());
+ }
+}