# HG changeset patch # User jwilhelm # Date 1513353257 -3600 # Node ID 0c0b618a20b1c408c054f42d10965aea762a96e1 # Parent 474cec233fb2f405d899946ec42df3fe826ef3a2# Parent 626d11295f31f3b577dfabfdca9dfa2ce94eb5a2 Merge diff -r 474cec233fb2 -r 0c0b618a20b1 .hgtags --- a/.hgtags Fri Dec 15 11:23:50 2017 -0500 +++ b/.hgtags Fri Dec 15 16:54:17 2017 +0100 @@ -460,3 +460,5 @@ bbd692ad4fa300ecca7939ffbe3b1d5e52a28cc6 jdk-10+33 89deac44e51517841491ba86ff44aa82a5ca96b3 jdk-10+34 d8c634b016c628622c9abbdc6bf50509e5dedbec jdk-10+35 +0ee20aad71c4f33c426372b4c8bcc1235ce2ec08 jdk-11+0 +959f2f7cbaa6d2ee45d50029744efb219721576c jdk-10+36 diff -r 474cec233fb2 -r 0c0b618a20b1 ADDITIONAL_LICENSE_INFO --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ADDITIONAL_LICENSE_INFO Fri Dec 15 16:54:17 2017 +0100 @@ -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. diff -r 474cec233fb2 -r 0c0b618a20b1 make/MacBundles.gmk --- a/make/MacBundles.gmk Fri Dec 15 11:23:50 2017 -0500 +++ b/make/MacBundles.gmk Fri Dec 15 16:54:17 2017 +0100 @@ -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 diff -r 474cec233fb2 -r 0c0b618a20b1 make/ReleaseFile.gmk --- a/make/ReleaseFile.gmk Fri Dec 15 11:23:50 2017 -0500 +++ b/make/ReleaseFile.gmk Fri Dec 15 16:54:17 2017 +0100 @@ -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 diff -r 474cec233fb2 -r 0c0b618a20b1 make/autoconf/flags.m4 --- a/make/autoconf/flags.m4 Fri Dec 15 11:23:50 2017 -0500 +++ b/make/autoconf/flags.m4 Fri Dec 15 16:54:17 2017 +0100 @@ -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 \ diff -r 474cec233fb2 -r 0c0b618a20b1 make/autoconf/generated-configure.sh --- a/make/autoconf/generated-configure.sh Fri Dec 15 11:23:50 2017 -0500 +++ b/make/autoconf/generated-configure.sh Fri Dec 15 16:54:17 2017 +0100 @@ -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 @@ -1091,6 +1093,7 @@ docdir oldincludedir includedir +runstatedir localstatedir sharedstatedir sysconfdir @@ -1141,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 @@ -1375,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}' @@ -1627,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=* \ @@ -1764,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. @@ -1917,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] @@ -2058,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'] @@ -2065,14 +2090,17 @@ [..] --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] @@ -4447,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 @@ -5157,7 +5185,7 @@ #CUSTOM_AUTOCONF_INCLUDE # Do not change or remove the following line, it is needed for consistency checks: -DATE_WHEN_GENERATED=1512638287 +DATE_WHEN_GENERATED=1513206608 ############################################################################### # @@ -24988,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 @@ -25016,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 @@ -25158,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]} @@ -25183,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]} @@ -25230,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]} @@ -25277,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 @@ -25350,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 @@ -25368,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 @@ -25387,6 +25476,8 @@ + + ############################################################################### # # Setup BootJDK, used to bootstrap the build. @@ -50653,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 \ diff -r 474cec233fb2 -r 0c0b618a20b1 make/autoconf/jdk-version.m4 --- a/make/autoconf/jdk-version.m4 Fri Dec 15 11:23:50 2017 -0500 +++ b/make/autoconf/jdk-version.m4 Fri Dec 15 16:54:17 2017 +0100 @@ -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) ]) diff -r 474cec233fb2 -r 0c0b618a20b1 make/autoconf/spec.gmk.in --- a/make/autoconf/spec.gmk.in Fri Dec 15 11:23:50 2017 -0500 +++ b/make/autoconf/spec.gmk.in Fri Dec 15 16:54:17 2017 +0100 @@ -143,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@ @@ -164,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) \ @@ -183,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 diff -r 474cec233fb2 -r 0c0b618a20b1 make/autoconf/version-numbers --- a/make/autoconf/version-numbers Fri Dec 15 11:23:50 2017 -0500 +++ b/make/autoconf/version-numbers Fri Dec 15 16:54:17 2017 +0100 @@ -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 diff -r 474cec233fb2 -r 0c0b618a20b1 make/conf/jib-profiles.js --- a/make/conf/jib-profiles.js Fri Dec 15 11:23:50 2017 -0500 +++ b/make/conf/jib-profiles.js Fri Dec 15 16:54:17 2017 +0100 @@ -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); diff -r 474cec233fb2 -r 0c0b618a20b1 make/copy/Copy-java.base.gmk --- a/make/copy/Copy-java.base.gmk Fri Dec 15 11:23:50 2017 -0500 +++ b/make/copy/Copy-java.base.gmk Fri Dec 15 16:54:17 2017 +0100 @@ -219,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, \ )) diff -r 474cec233fb2 -r 0c0b618a20b1 make/gensrc/GensrcMisc.gmk --- a/make/gensrc/GensrcMisc.gmk Fri Dec 15 11:23:50 2017 -0500 +++ b/make/gensrc/GensrcMisc.gmk Fri Dec 15 16:54:17 2017 +0100 @@ -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) diff -r 474cec233fb2 -r 0c0b618a20b1 make/launcher/Launcher-jdk.compiler.gmk --- a/make/launcher/Launcher-jdk.compiler.gmk Fri Dec 15 11:23:50 2017 -0500 +++ b/make/launcher/Launcher-jdk.compiler.gmk Fri Dec 15 16:54:17 2017 +0100 @@ -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, \ diff -r 474cec233fb2 -r 0c0b618a20b1 src/hotspot/cpu/ppc/c1_LIRAssembler_ppc.cpp --- a/src/hotspot/cpu/ppc/c1_LIRAssembler_ppc.cpp Fri Dec 15 11:23:50 2017 -0500 +++ b/src/hotspot/cpu/ppc/c1_LIRAssembler_ppc.cpp Fri Dec 15 16:54:17 2017 +0100 @@ -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; } diff -r 474cec233fb2 -r 0c0b618a20b1 src/hotspot/cpu/ppc/globalDefinitions_ppc.hpp --- a/src/hotspot/cpu/ppc/globalDefinitions_ppc.hpp Fri Dec 15 11:23:50 2017 -0500 +++ b/src/hotspot/cpu/ppc/globalDefinitions_ppc.hpp Fri Dec 15 16:54:17 2017 +0100 @@ -54,4 +54,6 @@ #define SUPPORT_RESERVED_STACK_AREA +#define THREAD_LOCAL_POLL + #endif // CPU_PPC_VM_GLOBALDEFINITIONS_PPC_HPP diff -r 474cec233fb2 -r 0c0b618a20b1 src/hotspot/cpu/ppc/globals_ppc.hpp --- a/src/hotspot/cpu/ppc/globals_ppc.hpp Fri Dec 15 11:23:50 2017 -0500 +++ b/src/hotspot/cpu/ppc/globals_ppc.hpp Fri Dec 15 16:54:17 2017 +0100 @@ -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.") \ diff -r 474cec233fb2 -r 0c0b618a20b1 src/hotspot/cpu/ppc/interp_masm_ppc.hpp --- a/src/hotspot/cpu/ppc/interp_masm_ppc.hpp Fri Dec 15 11:23:50 2017 -0500 +++ b/src/hotspot/cpu/ppc/interp_masm_ppc.hpp Fri Dec 15 16:54:17 2017 +0100 @@ -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); diff -r 474cec233fb2 -r 0c0b618a20b1 src/hotspot/cpu/ppc/interp_masm_ppc_64.cpp --- a/src/hotspot/cpu/ppc/interp_masm_ppc_64.cpp Fri Dec 15 11:23:50 2017 -0500 +++ b/src/hotspot/cpu/ppc/interp_masm_ppc_64.cpp Fri Dec 15 16:54:17 2017 +0100 @@ -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); diff -r 474cec233fb2 -r 0c0b618a20b1 src/hotspot/cpu/ppc/macroAssembler_ppc.cpp --- a/src/hotspot/cpu/ppc/macroAssembler_ppc.cpp Fri Dec 15 11:23:50 2017 -0500 +++ b/src/hotspot/cpu/ppc/macroAssembler_ppc.cpp Fri Dec 15 16:54:17 2017 +0100 @@ -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 diff -r 474cec233fb2 -r 0c0b618a20b1 src/hotspot/cpu/ppc/macroAssembler_ppc.hpp --- a/src/hotspot/cpu/ppc/macroAssembler_ppc.hpp Fri Dec 15 11:23:50 2017 -0500 +++ b/src/hotspot/cpu/ppc/macroAssembler_ppc.hpp Fri Dec 15 16:54:17 2017 +0100 @@ -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); diff -r 474cec233fb2 -r 0c0b618a20b1 src/hotspot/cpu/ppc/ppc.ad --- a/src/hotspot/cpu/ppc/ppc.ad Fri Dec 15 11:23:50 2017 -0500 +++ b/src/hotspot/cpu/ppc/ppc.ad Fri Dec 15 16:54:17 2017 +0100 @@ -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 diff -r 474cec233fb2 -r 0c0b618a20b1 src/hotspot/cpu/ppc/sharedRuntime_ppc.cpp --- a/src/hotspot/cpu/ppc/sharedRuntime_ppc.cpp Fri Dec 15 11:23:50 2017 -0500 +++ b/src/hotspot/cpu/ppc/sharedRuntime_ppc.cpp Fri Dec 15 16:54:17 2017 +0100 @@ -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, diff -r 474cec233fb2 -r 0c0b618a20b1 src/hotspot/cpu/ppc/templateInterpreterGenerator_ppc.cpp --- a/src/hotspot/cpu/ppc/templateInterpreterGenerator_ppc.cpp Fri Dec 15 11:23:50 2017 -0500 +++ b/src/hotspot/cpu/ppc/templateInterpreterGenerator_ppc.cpp Fri Dec 15 16:54:17 2017 +0100 @@ -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) diff -r 474cec233fb2 -r 0c0b618a20b1 src/hotspot/cpu/ppc/templateTable_ppc_64.cpp --- a/src/hotspot/cpu/ppc/templateTable_ppc_64.cpp Fri Dec 15 11:23:50 2017 -0500 +++ b/src/hotspot/cpu/ppc/templateTable_ppc_64.cpp Fri Dec 15 16:54:17 2017 +0100 @@ -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. diff -r 474cec233fb2 -r 0c0b618a20b1 src/hotspot/cpu/s390/assembler_s390.hpp --- a/src/hotspot/cpu/s390/assembler_s390.hpp Fri Dec 15 11:23:50 2017 -0500 +++ b/src/hotspot/cpu/s390/assembler_s390.hpp Fri Dec 15 16:54:17 2017 +0100 @@ -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); diff -r 474cec233fb2 -r 0c0b618a20b1 src/hotspot/cpu/s390/assembler_s390.inline.hpp --- a/src/hotspot/cpu/s390/assembler_s390.inline.hpp Fri Dec 15 11:23:50 2017 -0500 +++ b/src/hotspot/cpu/s390/assembler_s390.inline.hpp Fri Dec 15 16:54:17 2017 +0100 @@ -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)); } diff -r 474cec233fb2 -r 0c0b618a20b1 src/hotspot/cpu/s390/c1_LIRAssembler_s390.cpp --- a/src/hotspot/cpu/s390/c1_LIRAssembler_s390.cpp Fri Dec 15 11:23:50 2017 -0500 +++ b/src/hotspot/cpu/s390/c1_LIRAssembler_s390.cpp Fri Dec 15 16:54:17 2017 +0100 @@ -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; } diff -r 474cec233fb2 -r 0c0b618a20b1 src/hotspot/cpu/s390/globalDefinitions_s390.hpp --- a/src/hotspot/cpu/s390/globalDefinitions_s390.hpp Fri Dec 15 11:23:50 2017 -0500 +++ b/src/hotspot/cpu/s390/globalDefinitions_s390.hpp Fri Dec 15 16:54:17 2017 +0100 @@ -54,4 +54,6 @@ #define SUPPORT_RESERVED_STACK_AREA +#define THREAD_LOCAL_POLL + #endif // CPU_S390_VM_GLOBALDEFINITIONS_S390_HPP diff -r 474cec233fb2 -r 0c0b618a20b1 src/hotspot/cpu/s390/globals_s390.hpp --- a/src/hotspot/cpu/s390/globals_s390.hpp Fri Dec 15 11:23:50 2017 -0500 +++ b/src/hotspot/cpu/s390/globals_s390.hpp Fri Dec 15 16:54:17 2017 +0100 @@ -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) \ \ diff -r 474cec233fb2 -r 0c0b618a20b1 src/hotspot/cpu/s390/interp_masm_s390.cpp --- a/src/hotspot/cpu/s390/interp_masm_s390.cpp Fri Dec 15 11:23:50 2017 -0500 +++ b/src/hotspot/cpu/s390/interp_masm_s390.cpp Fri Dec 15 16:54:17 2017 +0100 @@ -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) { diff -r 474cec233fb2 -r 0c0b618a20b1 src/hotspot/cpu/s390/interp_masm_s390.hpp --- a/src/hotspot/cpu/s390/interp_masm_s390.hpp Fri Dec 15 11:23:50 2017 -0500 +++ b/src/hotspot/cpu/s390/interp_masm_s390.hpp Fri Dec 15 16:54:17 2017 +0100 @@ -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); diff -r 474cec233fb2 -r 0c0b618a20b1 src/hotspot/cpu/s390/macroAssembler_s390.cpp --- a/src/hotspot/cpu/s390/macroAssembler_s390.cpp Fri Dec 15 11:23:50 2017 -0500 +++ b/src/hotspot/cpu/s390/macroAssembler_s390.cpp Fri Dec 15 16:54:17 2017 +0100 @@ -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 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, diff -r 474cec233fb2 -r 0c0b618a20b1 src/hotspot/cpu/s390/macroAssembler_s390.hpp --- a/src/hotspot/cpu/s390/macroAssembler_s390.hpp Fri Dec 15 11:23:50 2017 -0500 +++ b/src/hotspot/cpu/s390/macroAssembler_s390.hpp Fri Dec 15 16:54:17 2017 +0100 @@ -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); diff -r 474cec233fb2 -r 0c0b618a20b1 src/hotspot/cpu/s390/s390.ad --- a/src/hotspot/cpu/s390/s390.ad Fri Dec 15 11:23:50 2017 -0500 +++ b/src/hotspot/cpu/s390/s390.ad Fri Dec 15 16:54:17 2017 +0100 @@ -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); diff -r 474cec233fb2 -r 0c0b618a20b1 src/hotspot/cpu/s390/sharedRuntime_s390.cpp --- a/src/hotspot/cpu/s390/sharedRuntime_s390.cpp Fri Dec 15 11:23:50 2017 -0500 +++ b/src/hotspot/cpu/s390/sharedRuntime_s390.cpp Fri Dec 15 16:54:17 2017 +0100 @@ -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); diff -r 474cec233fb2 -r 0c0b618a20b1 src/hotspot/cpu/s390/templateInterpreterGenerator_s390.cpp --- a/src/hotspot/cpu/s390/templateInterpreterGenerator_s390.cpp Fri Dec 15 11:23:50 2017 -0500 +++ b/src/hotspot/cpu/s390/templateInterpreterGenerator_s390.cpp Fri Dec 15 16:54:17 2017 +0100 @@ -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. diff -r 474cec233fb2 -r 0c0b618a20b1 src/hotspot/cpu/s390/templateTable_s390.cpp --- a/src/hotspot/cpu/s390/templateTable_s390.cpp Fri Dec 15 11:23:50 2017 -0500 +++ b/src/hotspot/cpu/s390/templateTable_s390.cpp Fri Dec 15 16:54:17 2017 +0100 @@ -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 diff -r 474cec233fb2 -r 0c0b618a20b1 src/hotspot/share/runtime/vm_version.cpp --- a/src/hotspot/share/runtime/vm_version.cpp Fri Dec 15 11:23:50 2017 -0500 +++ b/src/hotspot/share/runtime/vm_version.cpp Fri Dec 15 16:54:17 2017 +0100 @@ -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; diff -r 474cec233fb2 -r 0c0b618a20b1 src/java.base/share/classes/java/lang/Runtime.java --- a/src/java.base/share/classes/java/lang/Runtime.java Fri Dec 15 11:23:50 2017 -0500 +++ b/src/java.base/share/classes/java/lang/Runtime.java Fri Dec 15 16:54:17 2017 +0100 @@ -899,81 +899,68 @@ * *

Version numbers

* - *

A version number, {@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: - *

+ *

A version number, {@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:

* *
-     *     [1-9][0-9]*((\.0)*\.[1-9][0-9]*)*
+     * [1-9][0-9]*((\.0)*\.[1-9][0-9]*)*
      * 
* - *

The sequence may be of arbitrary length but the first three - * elements are assigned specific meanings, as follows:

+ *

The sequence may be of arbitrary length but the first four elements + * are assigned specific meanings, as follows:

* *
-     *     $MAJOR.$MINOR.$SECURITY
+     * $FEATURE.$INTERIM.$UPDATE.$PATCH
      * 
* *
    * - *
  • {@code $MAJOR} --- 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, e.g., JSR 337 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.

  • + *
  • {@code $FEATURE} — 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.

  • * - *
  • {@code $MINOR} --- The minor version - * number, incremented for a minor update release that may contain - * compatible bug fixes, revisions to standard APIs mandated by a - * Maintenance Release - * 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.

  • + *
  • {@code $INTERIM} — 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. + *

  • * - *
  • {@code $SECURITY} --- The security - * level, incremented for a security update release that contains critical - * fixes including those necessary to improve security. {@code $SECURITY} - * is not 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}.

  • + *
  • {@code $UPDATE} — The update-release + * counter, incremented for compatible update releases that fix security + * issues, regressions, and bugs in newer features.

  • + * + *
  • {@code $PATCH} — The emergency + * patch-release counter, incremented only when it's necessary to produce + * an emergency release to fix a critical issue.

  • * *
* - *

The fourth and later elements of a version number are free for use - * by downstream consumers of this code base. Such a consumer may, - * e.g., 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.

+ *

The fifth and later elements of a version number are free for use by + * platform implementors, to identify implementor-specific patch + * releases.

* - *

The version number does not include trailing zero elements; - * i.e., {@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.

+ *

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.

* *

The sequence of numerals in a version number is compared to another * such sequence in numerical, pointwise fashion; e.g., {@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; e.g., {@code 9.1.2} is less than {@code 9.1.2.1}. - *

+ * 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; + * e.g., {@code 10.0.2} is less than {@code 10.0.2.1}.

* *

Version strings

* - *

A version string, {@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: - *

+ *

A version string, {@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:

* *
      *     $VNUM(-$PRE)?\+$BUILD(-$OPT)?
@@ -986,19 +973,19 @@
      * 
    * *
  • {@code $PRE}, 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.

  • + * — 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.

    * *
  • {@code $BUILD}, 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.

  • * - *
  • {@code $OPT}, 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.

  • + *
  • {@code $OPT}, 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.

  • * *
* @@ -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 major version number. + * Returns the value of the feature 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 minor version number or zero if it - * was not set. + * Returns the value of the interim 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 security version number or zero - * if it was not set. + * Returns the value of the update 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 version - * number. The {@code List} always contains at least one - * element corresponding to the major version - * number. + * Returns the value of the patch 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 feature + * 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 interim + * 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 update 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 version number. The {@code + * List} always contains at least one element corresponding to the feature version number. + * + * @return An unmodifiable list of the integers + * represented in the version number */ public List version() { return version; diff -r 474cec233fb2 -r 0c0b618a20b1 src/java.base/share/classes/java/lang/System.java --- a/src/java.base/share/classes/java/lang/System.java Fri Dec 15 11:23:50 2017 -0500 +++ b/src/java.base/share/classes/java/lang/System.java Fri Dec 15 16:54:17 2017 +0100 @@ -550,8 +550,10 @@ * System properties. The following properties are guaranteed to be defined: *
*
java.version
Java version number + *
java.version.date
Java version date *
java.vendor
Java vendor specific string *
java.vendor.url
Java vendor URL + *
java.vendor.version
Java vendor version *
java.home
Java installation directory *
java.class.version
Java class version number *
java.class.path
Java classpath @@ -591,12 +593,18 @@ * * * java.version - * Java Runtime Environment version which may be interpreted + * Java Runtime Environment version, which may be interpreted * as a {@link Runtime.Version} + * java.version.date + * Java Runtime Environment version date, in ISO-8601 YYYY-MM-DD + * format, which may be interpreted as a {@link + * java.time.LocalDate} * java.vendor * Java Runtime Environment vendor * java.vendor.url * Java vendor URL + * java.vendor.version + * Java vendor version * java.home * Java installation directory * java.vm.specification.version diff -r 474cec233fb2 -r 0c0b618a20b1 src/java.base/share/classes/java/lang/VersionProps.java.template --- a/src/java.base/share/classes/java/lang/VersionProps.java.template Fri Dec 15 11:23:50 2017 -0500 +++ b/src/java.base/share/classes/java/lang/VersionProps.java.template Fri Dec 15 16:54:17 2017 +0100 @@ -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 + ")"); + } } diff -r 474cec233fb2 -r 0c0b618a20b1 src/java.base/share/classes/java/util/Optional.java --- a/src/java.base/share/classes/java/util/Optional.java Fri Dec 15 11:23:50 2017 -0500 +++ b/src/java.base/share/classes/java/util/Optional.java Fri Dec 15 16:54:17 2017 +0100 @@ -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 empty and + * {@code isPresent()} returns {@code false}. * *

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. * diff -r 474cec233fb2 -r 0c0b618a20b1 src/java.base/share/classes/java/util/OptionalDouble.java --- a/src/java.base/share/classes/java/util/OptionalDouble.java Fri Dec 15 11:23:50 2017 -0500 +++ b/src/java.base/share/classes/java/util/OptionalDouble.java Fri Dec 15 16:54:17 2017 +0100 @@ -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 empty and + * {@code isPresent()} returns {@code false}. * *

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. * diff -r 474cec233fb2 -r 0c0b618a20b1 src/java.base/share/classes/java/util/OptionalInt.java --- a/src/java.base/share/classes/java/util/OptionalInt.java Fri Dec 15 11:23:50 2017 -0500 +++ b/src/java.base/share/classes/java/util/OptionalInt.java Fri Dec 15 16:54:17 2017 +0100 @@ -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 empty and + * {@code isPresent()} returns {@code false}. * *

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. * diff -r 474cec233fb2 -r 0c0b618a20b1 src/java.base/share/classes/java/util/OptionalLong.java --- a/src/java.base/share/classes/java/util/OptionalLong.java Fri Dec 15 11:23:50 2017 -0500 +++ b/src/java.base/share/classes/java/util/OptionalLong.java Fri Dec 15 16:54:17 2017 +0100 @@ -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 empty and + * {@code isPresent()} returns {@code false}. * *

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. * diff -r 474cec233fb2 -r 0c0b618a20b1 src/java.base/share/classes/java/util/jar/JarFile.java --- a/src/java.base/share/classes/java/util/jar/JarFile.java Fri Dec 15 11:23:50 2017 -0500 +++ b/src/java.base/share/classes/java/util/jar/JarFile.java Fri Dec 15 16:54:17 2017 +0100 @@ -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 @@ *

  • * {@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. *

    - * 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 @@ *

    * 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); diff -r 474cec233fb2 -r 0c0b618a20b1 src/java.base/share/classes/java/util/zip/Deflater.java --- a/src/java.base/share/classes/java/util/zip/Deflater.java Fri Dec 15 11:23:50 2017 -0500 +++ b/src/java.base/share/classes/java/util/zip/Deflater.java Fri Dec 15 16:54:17 2017 +0100 @@ -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(); + } + } + } } diff -r 474cec233fb2 -r 0c0b618a20b1 src/java.base/share/classes/java/util/zip/Inflater.java --- a/src/java.base/share/classes/java/util/zip/Inflater.java Fri Dec 15 11:23:50 2017 -0500 +++ b/src/java.base/share/classes/java/util/zip/Inflater.java Fri Dec 15 16:54:17 2017 +0100 @@ -25,8 +25,8 @@ 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; /** * This class provides support for general purpose decompression using the @@ -91,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; @@ -118,20 +118,7 @@ * @param nowrap if true then support GZIP compatible compression */ public Inflater(boolean nowrap) { - this.zsRef = ZStreamRef.get(this, - // Desugared for startup purposes. - new LongSupplier() { - @Override - public long getAsLong() { - return init(nowrap); - } - }, - new LongConsumer() { - @Override - public void accept(long value) { - end(); - } - }); + this.zsRef = InflaterZStreamRef.get(this, init(nowrap)); } /** @@ -444,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(); + } + } + } } diff -r 474cec233fb2 -r 0c0b618a20b1 src/java.base/share/classes/java/util/zip/ZStreamRef.java --- a/src/java.base/share/classes/java/util/zip/ZStreamRef.java Fri Dec 15 11:23:50 2017 -0500 +++ /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(); - } - } -} diff -r 474cec233fb2 -r 0c0b618a20b1 src/java.base/share/classes/java/util/zip/ZipFile.java --- a/src/java.base/share/classes/java/util/zip/ZipFile.java Fri Dec 15 11:23:50 2017 -0500 +++ b/src/java.base/share/classes/java/util/zip/ZipFile.java Fri Dec 15 16:54:17 2017 +0100 @@ -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,13 +442,8 @@ Inflater inf, int size) { super(zfin, inf, size); this.cleanable = CleanerFactory.cleaner().register(this, - new Runnable() { - @Override - public void run() { - res.releaseInflater(inf); - } - }); - } + new InflaterCleanupAction(inf, res)); + } public void close() throws IOException { if (closeRequested) diff -r 474cec233fb2 -r 0c0b618a20b1 src/java.base/share/classes/sun/security/tools/keytool/Main.java --- a/src/java.base/share/classes/sun/security/tools/keytool/Main.java Fri Dec 15 11:23:50 2017 -0500 +++ b/src/java.base/share/classes/sun/security/tools/keytool/Main.java Fri Dec 15 16:54:17 2017 +0100 @@ -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 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. diff -r 474cec233fb2 -r 0c0b618a20b1 src/java.base/share/native/libjava/jdk_util.c --- a/src/java.base/share/native/libjava/jdk_util.c Fri Dec 15 11:23:50 2017 -0500 +++ b/src/java.base/share/native/libjava/jdk_util.c Fri Dec 15 16:54:17 2017 +0100 @@ -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; diff -r 474cec233fb2 -r 0c0b618a20b1 src/java.compiler/share/classes/javax/lang/model/SourceVersion.java --- a/src/java.compiler/share/classes/javax/lang/model/SourceVersion.java Fri Dec 15 11:23:50 2017 -0500 +++ b/src/java.compiler/share/classes/javax/lang/model/SourceVersion.java Fri Dec 15 16:54:17 2017 +0100 @@ -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; diff -r 474cec233fb2 -r 0c0b618a20b1 src/jdk.compiler/share/classes/com/sun/tools/javah/Gen.java --- a/src/jdk.compiler/share/classes/com/sun/tools/javah/Gen.java Fri Dec 15 11:23:50 2017 -0500 +++ /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. - * - *

    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.

    - * - * @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 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 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 getAllFields(TypeElement subclazz) { - List fields = new ArrayList<>(); - TypeElement cd = null; - Stack 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(); - } -} - diff -r 474cec233fb2 -r 0c0b618a20b1 src/jdk.compiler/share/classes/com/sun/tools/javah/InternalError.java --- a/src/jdk.compiler/share/classes/com/sun/tools/javah/InternalError.java Fri Dec 15 11:23:50 2017 -0500 +++ /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; - -/** - *

    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. - */ -public class InternalError extends Error { - private static final long serialVersionUID = 8411861562497165022L; - InternalError(String msg, Throwable cause) { - super("Internal error: " + msg); - initCause(cause); - } -} diff -r 474cec233fb2 -r 0c0b618a20b1 src/jdk.compiler/share/classes/com/sun/tools/javah/JNI.java --- a/src/jdk.compiler/share/classes/com/sun/tools/javah/JNI.java Fri Dec 15 11:23:50 2017 -0500 +++ /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. - * - *

    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.

    - * - * @author Sucheta Dambalkar(Revised) - */ -public class JNI extends Gen { - JNI(Util util) { - super(util); - } - - public String getIncludes() { - return "#include "; - } - - 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 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 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 paramargs = md.getParameters(); - List 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. */ - } -} diff -r 474cec233fb2 -r 0c0b618a20b1 src/jdk.compiler/share/classes/com/sun/tools/javah/JavahFileManager.java --- a/src/jdk.compiler/share/classes/com/sun/tools/javah/JavahFileManager.java Fri Dec 15 11:23:50 2017 -0500 +++ /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. - * - *

    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. - */ -class JavahFileManager extends JavacFileManager { - private JavahFileManager(Context context, Charset charset) { - super(context, true, charset); - setSymbolFileEnabled(false); - } - - static JavahFileManager create(final DiagnosticListener 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); - } -} diff -r 474cec233fb2 -r 0c0b618a20b1 src/jdk.compiler/share/classes/com/sun/tools/javah/JavahTask.java --- a/src/jdk.compiler/share/classes/com/sun/tools/javah/JavahTask.java Fri Dec 15 11:23:50 2017 -0500 +++ /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. - * - *

    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.

    - * - * @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 diagnosticListener, - Iterable options, - Iterable 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 dl) { - diagnosticListener = dl; - } - - public void setDiagnosticListener(OutputStream s) { - setDiagnosticListener(getDiagnosticListenerForStream(s)); - } - - private DiagnosticListener getDiagnosticListenerForStream(OutputStream s) { - return getDiagnosticListenerForWriter(getPrintWriterForStream(s)); - } - - private DiagnosticListener 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 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 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 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 expandAtArgs(Iterable args) throws BadArgs { - try { - List 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 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 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 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 createDiagnostic(final String key, final Object... args) { - return new Diagnostic() { - @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> - // 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 classes; - boolean verbose; - boolean noArgs; - boolean help; - boolean trace; - boolean version; - boolean fullVersion; - boolean jni; - boolean llni; - boolean doubleAlign; - boolean force; - Set javac_extras = new LinkedHashSet<>(); - - PrintWriter log; - JavaFileManager fileManager; - DiagnosticListener diagnosticListener; - Locale task_locale; - Map 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 annotations, RoundEnvironment roundEnv) { - try { - Set 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 getAllClasses(Set classes) { - Set allClasses = new LinkedHashSet<>(); - getAllClasses0(classes, allClasses); - return allClasses; - } - - private void getAllClasses0(Iterable classes, Set 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 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 checkMethodParametersVisitor = - new SimpleTypeVisitor9() { - @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; - } -} diff -r 474cec233fb2 -r 0c0b618a20b1 src/jdk.compiler/share/classes/com/sun/tools/javah/JavahTool.java --- a/src/jdk.compiler/share/classes/com/sun/tools/javah/JavahTool.java Fri Dec 15 11:23:50 2017 -0500 +++ /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; - -/* - *

    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.

    - */ -public class JavahTool implements NativeHeaderTool { - - public NativeHeaderTask getTask(Writer out, - JavaFileManager fileManager, - DiagnosticListener diagnosticListener, - Iterable options, - Iterable classes) { - return new JavahTask(out, fileManager, diagnosticListener, options, classes); - } - - public StandardJavaFileManager getStandardFileManager(DiagnosticListener 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 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; - } -} diff -r 474cec233fb2 -r 0c0b618a20b1 src/jdk.compiler/share/classes/com/sun/tools/javah/LLNI.java --- a/src/jdk.compiler/share/classes/com/sun/tools/javah/LLNI.java Fri Dec 15 11:23:50 2017 -0500 +++ /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; - -/* - *

    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.

    - * - * @author Sucheta Dambalkar(Revised) - */ -public class LLNI extends Gen { - - protected final char innerDelim = '$'; /* For inner classes */ - protected Set doneHandleTypes; - List fields; - List 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 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 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 params = method.getParameters(); - List 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 params = method.getParameters(); - List 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 v = new SimpleTypeVisitor9() { - @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; - } -} - diff -r 474cec233fb2 -r 0c0b618a20b1 src/jdk.compiler/share/classes/com/sun/tools/javah/Main.java --- a/src/jdk.compiler/share/classes/com/sun/tools/javah/Main.java Fri Dec 15 11:23:50 2017 -0500 +++ /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. - * - *

    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. - */ -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 not 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); - } -} diff -r 474cec233fb2 -r 0c0b618a20b1 src/jdk.compiler/share/classes/com/sun/tools/javah/Mangle.java --- a/src/jdk.compiler/share/classes/com/sun/tools/javah/Mangle.java Fri Dec 15 11:23:50 2017 -0500 +++ /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. - * - *

    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.

    - * - * @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; - } -} diff -r 474cec233fb2 -r 0c0b618a20b1 src/jdk.compiler/share/classes/com/sun/tools/javah/NativeHeaderTool.java --- a/src/jdk.compiler/share/classes/com/sun/tools/javah/NativeHeaderTool.java Fri Dec 15 11:23:50 2017 -0500 +++ /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 - * - *

    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. - */ -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. - * - *

    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 diagnosticListener, - Iterable options, - Iterable 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. - * - *

    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 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. - * - *

    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 { - - /** - * 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(); - } -} diff -r 474cec233fb2 -r 0c0b618a20b1 src/jdk.compiler/share/classes/com/sun/tools/javah/TypeSignature.java --- a/src/jdk.compiler/share/classes/com/sun/tools/javah/TypeSignature.java Fri Dec 15 11:23:50 2017 -0500 +++ /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. - * - *

    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.

    - * - * @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 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 v = new SimpleTypeVisitor9() { - @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(); - } -} diff -r 474cec233fb2 -r 0c0b618a20b1 src/jdk.compiler/share/classes/com/sun/tools/javah/Util.java --- a/src/jdk.compiler/share/classes/com/sun/tools/javah/Util.java Fri Dec 15 11:23:50 2017 -0500 +++ /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 - * - *

    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.

    - */ -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 dl; - - Util(PrintWriter log, DiagnosticListener 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 createDiagnostic( - final Diagnostic.Kind kind, final String code, final Object... args) { - return new Diagnostic() { - @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; - } - }; - } -} diff -r 474cec233fb2 -r 0c0b618a20b1 src/jdk.compiler/share/classes/com/sun/tools/javah/resources/l10n.properties --- a/src/jdk.compiler/share/classes/com/sun/tools/javah/resources/l10n.properties Fri Dec 15 11:23:50 2017 -0500 +++ /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] \n\ -where [options] include: - -main.opt.o=\ -\ -o Output file (only one of -d or -o may be used) - -main.opt.d=\ -\ -d 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 from which to load application modules - -main.opt.upgrade_module_path=\ -\ --upgrade_module-path Path from which to load application modules - -main.opt.classpath=\ -\ -classpath Path from which to load classes - -main.opt.class_path=\ -\ --class-path Path from which to load classes - -main.opt.cp=\ -\ -cp Path from which to load classes - -main.opt.bootclasspath=\ -\ -bootclasspath Path from which to load bootstrap classes - -main.opt.system=\ -\ --system 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 diff -r 474cec233fb2 -r 0c0b618a20b1 src/jdk.compiler/share/classes/com/sun/tools/javah/resources/l10n_ja.properties --- a/src/jdk.compiler/share/classes/com/sun/tools/javah/resources/l10n_ja.properties Fri Dec 15 11:23:50 2017 -0500 +++ /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] \n[options]\u306B\u306F\u6B21\u306E\u3082\u306E\u304C\u3042\u308A\u307E\u3059\u3002 - -main.opt.o=\ -o \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 \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 \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 \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 \u30AF\u30E9\u30B9\u3092\u30ED\u30FC\u30C9\u3059\u308B\u30D1\u30B9 - -main.opt.class_path=\ --class-path \u30AF\u30E9\u30B9\u3092\u30ED\u30FC\u30C9\u3059\u308B\u30D1\u30B9 - -main.opt.cp=\ -cp \u30AF\u30E9\u30B9\u3092\u30ED\u30FC\u30C9\u3059\u308B\u30D1\u30B9 - -main.opt.bootclasspath=\ -bootclasspath \u30D6\u30FC\u30C8\u30B9\u30C8\u30E9\u30C3\u30D7\u30FB\u30AF\u30E9\u30B9\u3092\u30ED\u30FC\u30C9\u3059\u308B\u30D1\u30B9 - -main.opt.system=\ --system \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 diff -r 474cec233fb2 -r 0c0b618a20b1 src/jdk.compiler/share/classes/com/sun/tools/javah/resources/l10n_zh_CN.properties --- a/src/jdk.compiler/share/classes/com/sun/tools/javah/resources/l10n_zh_CN.properties Fri Dec 15 11:23:50 2017 -0500 +++ /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] \n\u5176\u4E2D, [options] \u5305\u62EC: - -main.opt.o=\ -o \u8F93\u51FA\u6587\u4EF6 (\u53EA\u80FD\u4F7F\u7528 -d \u6216 -o \u4E4B\u4E00) - -main.opt.d=\ -d \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 \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 \u4ECE\u4E2D\u52A0\u8F7D\u7C7B\u7684\u8DEF\u5F84 - -main.opt.bootclasspath=\ -bootclasspath \u4ECE\u4E2D\u52A0\u8F7D\u5F15\u5BFC\u7C7B\u7684\u8DEF\u5F84 - -main.opt.system=\ --system \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 diff -r 474cec233fb2 -r 0c0b618a20b1 src/jdk.compiler/share/classes/com/sun/tools/javah/resources/version.properties-template --- a/src/jdk.compiler/share/classes/com/sun/tools/javah/resources/version.properties-template Fri Dec 15 11:23:50 2017 -0500 +++ /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) diff -r 474cec233fb2 -r 0c0b618a20b1 src/jdk.compiler/share/classes/module-info.java --- a/src/jdk.compiler/share/classes/module-info.java Fri Dec 15 11:23:50 2017 -0500 +++ b/src/jdk.compiler/share/classes/module-info.java Fri Dec 15 16:54:17 2017 +0100 @@ -26,8 +26,7 @@ /** * Defines the implementation of the * {@linkplain javax.tools.ToolProvider#getSystemJavaCompiler system Java compiler} - * and its command line equivalent, {@index javac javac tool}, - * as well as {@index javah javah tool}. + * and its command line equivalent, {@index javac javac tool}. * *

    javac

    * @@ -56,17 +55,9 @@ * {@code jdk.zipfs} module, must be available if the compiler is to be able * to read JAR files. * - *

    javah

    - * - *

    - * javah 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 javac instead.

    - * *
    *
    Tool Guides: - *
    {@extLink javac_tool_reference javac}, - * {@extLink javah_tool_reference javah} + *
    {@extLink javac_tool_reference javac} *
    * * @provides java.util.spi.ToolProvider diff -r 474cec233fb2 -r 0c0b618a20b1 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/Contents.java --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/Contents.java Fri Dec 15 11:23:50 2017 -0500 +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/Contents.java Fri Dec 15 16:54:17 2017 +0100 @@ -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"); diff -r 474cec233fb2 -r 0c0b618a20b1 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleWriterImpl.java --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleWriterImpl.java Fri Dec 15 11:23:50 2017 -0500 +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleWriterImpl.java Fri Dec 15 16:54:17 2017 +0100 @@ -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> 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 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 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> openedPackages - = new TreeMap<>(utils.makePackageComparator()); - - /** - * Set of concealed packages of this module. - */ - private final SortedSet concealedPackages = new TreeSet<>(utils.makePackageComparator()); + private final Map 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 mdleList = new TreeSet<>(utils.makeModuleComparator()); List 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 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 mdleList = new TreeSet<>(utils.makeModuleComparator()); List 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 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 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 colHeaders = new ArrayList<>(); + List 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 e : packages.entrySet()) { + PackageElement pkg = e.getKey(); + PackageEntry entry = e.getValue(); + List 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> ap) { - for (Map.Entry> entry : ap.entrySet()) { - List row = new ArrayList<>(); - PackageElement pkg = entry.getKey(); - SortedSet 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 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 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); diff -r 474cec233fb2 -r 0c0b618a20b1 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/TableHeader.java --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/TableHeader.java Fri Dec 15 11:23:50 2017 -0500 +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/TableHeader.java Fri Dec 15 16:54:17 2017 +0100 @@ -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 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 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 */ diff -r 474cec233fb2 -r 0c0b618a20b1 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/doclets.properties --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/doclets.properties Fri Dec 15 11:23:50 2017 -0500 +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/doclets.properties Fri Dec 15 16:54:17 2017 +0100 @@ -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 diff -r 474cec233fb2 -r 0c0b618a20b1 src/jdk.jconsole/share/classes/sun/tools/jconsole/AboutDialog.java --- a/src/jdk.jconsole/share/classes/sun/tools/jconsole/AboutDialog.java Fri Dec 15 11:23:50 2017 -0500 +++ b/src/jdk.jconsole/share/classes/sun/tools/jconsole/AboutDialog.java Fri Dec 15 16:54:17 2017 +0100 @@ -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); } diff -r 474cec233fb2 -r 0c0b618a20b1 src/jdk.jdeps/share/classes/com/sun/tools/jdeprscan/TraverseProc.java --- a/src/jdk.jdeps/share/classes/com/sun/tools/jdeprscan/TraverseProc.java Fri Dec 15 11:23:50 2017 -0500 +++ b/src/jdk.jdeps/share/classes/com/sun/tools/jdeprscan/TraverseProc.java Fri Dec 15 16:54:17 2017 +0100 @@ -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; diff -r 474cec233fb2 -r 0c0b618a20b1 src/jdk.jdeps/share/classes/com/sun/tools/jdeprscan/readme.md --- a/src/jdk.jdeps/share/classes/com/sun/tools/jdeprscan/readme.md Fri Dec 15 11:23:50 2017 -0500 +++ b/src/jdk.jdeps/share/classes/com/sun/tools/jdeprscan/readme.md Fri Dec 15 16:54:17 2017 +0100 @@ -1,6 +1,6 @@