OpenJDK / jdk / hs
changeset 45091:779b6795fcdf
Merge
author | duke |
---|---|
date | Wed, 05 Jul 2017 23:26:38 +0200 |
parents | a0908e5be3bc 10f543db5dcb |
children | 22e37211f5d4 |
files | jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/xinclude/XPointerElementHandler.java jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/xinclude/XPointerFramework.java jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/xinclude/XPointerSchema.java jaxp/test/javax/xml/jaxp/libs/jdk/testlibrary/Asserts.java jaxp/test/javax/xml/jaxp/libs/jdk/testlibrary/CompilerUtils.java jaxp/test/javax/xml/jaxp/libs/jdk/testlibrary/JDKToolFinder.java jaxp/test/javax/xml/jaxp/libs/jdk/testlibrary/JDKToolLauncher.java jaxp/test/javax/xml/jaxp/libs/jdk/testlibrary/OutputAnalyzer.java jaxp/test/javax/xml/jaxp/libs/jdk/testlibrary/OutputBuffer.java jaxp/test/javax/xml/jaxp/libs/jdk/testlibrary/Platform.java jaxp/test/javax/xml/jaxp/libs/jdk/testlibrary/ProcessTools.java jaxp/test/javax/xml/jaxp/libs/jdk/testlibrary/README.txt jaxp/test/javax/xml/jaxp/libs/jdk/testlibrary/StreamPumper.java jaxp/test/javax/xml/jaxp/libs/jdk/testlibrary/Utils.java jdk/src/java.base/share/classes/sun/security/ssl/EllipticCurvesExtension.java jdk/test/java/util/stream/bootlib/java.base/java/util/SpliteratorOfIntDataBuilder.java jdk/test/java/util/stream/bootlib/java.base/java/util/SpliteratorTestHelper.java jdk/test/java/util/stream/bootlib/java.base/java/util/stream/CollectorOps.java jdk/test/java/util/stream/bootlib/java.base/java/util/stream/DefaultMethodStreams.java jdk/test/java/util/stream/bootlib/java.base/java/util/stream/DoubleStreamTestDataProvider.java jdk/test/java/util/stream/bootlib/java.base/java/util/stream/DoubleStreamTestScenario.java jdk/test/java/util/stream/bootlib/java.base/java/util/stream/FlagDeclaringOp.java jdk/test/java/util/stream/bootlib/java.base/java/util/stream/IntStreamTestDataProvider.java jdk/test/java/util/stream/bootlib/java.base/java/util/stream/IntStreamTestScenario.java jdk/test/java/util/stream/bootlib/java.base/java/util/stream/IntermediateTestOp.java jdk/test/java/util/stream/bootlib/java.base/java/util/stream/LambdaTestHelpers.java jdk/test/java/util/stream/bootlib/java.base/java/util/stream/LambdaTestMode.java jdk/test/java/util/stream/bootlib/java.base/java/util/stream/LoggingTestCase.java jdk/test/java/util/stream/bootlib/java.base/java/util/stream/LongStreamTestDataProvider.java jdk/test/java/util/stream/bootlib/java.base/java/util/stream/LongStreamTestScenario.java jdk/test/java/util/stream/bootlib/java.base/java/util/stream/OpTestCase.java jdk/test/java/util/stream/bootlib/java.base/java/util/stream/StatefulTestOp.java jdk/test/java/util/stream/bootlib/java.base/java/util/stream/StatelessTestOp.java jdk/test/java/util/stream/bootlib/java.base/java/util/stream/StreamOpFlagTestHelper.java jdk/test/java/util/stream/bootlib/java.base/java/util/stream/StreamTestDataProvider.java jdk/test/java/util/stream/bootlib/java.base/java/util/stream/StreamTestScenario.java jdk/test/java/util/stream/bootlib/java.base/java/util/stream/TestData.java jdk/test/java/util/stream/bootlib/java.base/java/util/stream/TestFlagExpectedOp.java jdk/test/java/util/stream/bootlib/java.base/java/util/stream/ThrowableHelper.java jdk/test/java/util/stream/test/org/openjdk/tests/java/util/NullArgsTestCase.java jdk/test/sample/TEST.properties jdk/test/sample/chatserver/ChatTest.java jdk/test/sample/mergesort/MergeSortTest.java jdk/test/tools/launcher/modules/listmods/src/java.transaction/javax/transaction/atomic/Atomic.java |
diffstat | 583 files changed, 16656 insertions(+), 15736 deletions(-) [+] |
line wrap: on
line diff
--- a/.hgtags-top-repo Fri May 12 15:14:16 2017 -0700 +++ b/.hgtags-top-repo Wed Jul 05 23:26:38 2017 +0200 @@ -417,4 +417,6 @@ 06373236a30801f72e2a31ee5c691c2a1e500f57 jdk-10+3 8ec175c61fc3f58328a3324f07d7ded00e060be3 jdk-10+4 111e2e7d00f45c983cdbc9c59ae40552152fcc23 jdk-10+5 -03fe61bb7670644cf6e46b5cfafb6b27c0e0157e jdk-10+6 \ No newline at end of file +03fe61bb7670644cf6e46b5cfafb6b27c0e0157e jdk-10+6 +b25838a28195f4b6dab34668411eedd2d366a16c jdk-9+169 +
--- a/common/autoconf/boot-jdk.m4 Fri May 12 15:14:16 2017 -0700 +++ b/common/autoconf/boot-jdk.m4 Wed Jul 05 23:26:38 2017 +0200 @@ -318,7 +318,7 @@ AC_SUBST(JAVAC_FLAGS) # Check if the boot jdk is 32 or 64 bit - if "$JAVA" -d64 -version > /dev/null 2>&1; then + if "$JAVA" -version 2>&1 | $GREP -q "64-Bit"; then BOOT_JDK_BITS="64" else BOOT_JDK_BITS="32"
--- a/common/autoconf/build-aux/install.sh Fri May 12 15:14:16 2017 -0700 +++ b/common/autoconf/build-aux/install.sh Wed Jul 05 23:26:38 2017 +0200 @@ -1,5 +1,28 @@ -#!/bin/sh -echo >&2 "No suitable 'install' command found.'" -echo >&2 "If automake is installed, running 'automake -fa'" -echo >&2 "(and ignoring the errors) might produce one." -exit 1 +#!/bin/bash +# +# Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# This code is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License version 2 only, as +# published by the Free Software Foundation. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the LICENSE file that accompanied this code. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# + +# This file is empty on purpose. It's a placeholder which is required by +# autoconf, but it serves no purpose for us.
--- a/common/autoconf/build-performance.m4 Fri May 12 15:14:16 2017 -0700 +++ b/common/autoconf/build-performance.m4 Wed Jul 05 23:26:38 2017 +0200 @@ -417,10 +417,8 @@ AC_SUBST(SJAVAC_SERVER_JAVA) if test "$MEMORY_SIZE" -gt "3000"; then - ADD_JVM_ARG_IF_OK([-d64],SJAVAC_SERVER_JAVA_FLAGS,[$SJAVAC_SERVER_JAVA]) - if test "$JVM_ARG_OK" = true; then + if "$JAVA" -version 2>&1 | $GREP -q "64-Bit"; then JVM_64BIT=true - JVM_ARG_OK=false fi fi
--- a/common/autoconf/generated-configure.sh Fri May 12 15:14:16 2017 -0700 +++ b/common/autoconf/generated-configure.sh Wed Jul 05 23:26:38 2017 +0200 @@ -996,8 +996,9 @@ OPENJDK_TARGET_CPU_ISADIR OPENJDK_TARGET_CPU_LEGACY_LIB OPENJDK_TARGET_CPU_LEGACY -OPENJDK_MODULE_TARGET_OS_ARCH -OPENJDK_MODULE_TARGET_OS_NAME +RELEASE_FILE_OS_ARCH +RELEASE_FILE_OS_NAME +OPENJDK_MODULE_TARGET_PLATFORM COMPILE_TYPE OPENJDK_TARGET_CPU_ENDIAN OPENJDK_TARGET_CPU_BITS @@ -4900,6 +4901,8 @@ + + #%%% Build and target systems %%% @@ -5183,7 +5186,7 @@ #CUSTOM_AUTOCONF_INCLUDE # Do not change or remove the following line, it is needed for consistency checks: -DATE_WHEN_GENERATED=1492975963 +DATE_WHEN_GENERATED=1494615666 ############################################################################### # @@ -16043,6 +16046,27 @@ OPENJDK_MODULE_TARGET_OS_ARCH="$OPENJDK_TARGET_CPU" fi + OPENJDK_MODULE_TARGET_PLATFORM="${OPENJDK_MODULE_TARGET_OS_NAME}-${OPENJDK_MODULE_TARGET_OS_ARCH}" + + + + if test "x$OPENJDK_TARGET_OS" = "xsolaris"; then + RELEASE_FILE_OS_NAME=SunOS + fi + if test "x$OPENJDK_TARGET_OS" = "xlinux"; then + RELEASE_FILE_OS_NAME=Linux + fi + if test "x$OPENJDK_TARGET_OS" = "xwindows"; then + RELEASE_FILE_OS_NAME=Windows + fi + if test "x$OPENJDK_TARGET_OS" = xmacosx; then + RELEASE_FILE_OS_NAME="Darwin" + fi + if test "x$OPENJDK_TARGET_OS" = "xaix"; then + RELEASE_FILE_OS_NAME="AIX" + fi + RELEASE_FILE_OS_ARCH=${OPENJDK_TARGET_CPU} + @@ -31392,7 +31416,7 @@ # Check if the boot jdk is 32 or 64 bit - if "$JAVA" -d64 -version > /dev/null 2>&1; then + if "$JAVA" -version 2>&1 | $GREP -q "64-Bit"; then BOOT_JDK_BITS="64" else BOOT_JDK_BITS="32" @@ -65910,24 +65934,8 @@ if test "$MEMORY_SIZE" -gt "3000"; then - - $ECHO "Check if jvm arg is ok: -d64" >&5 - $ECHO "Command: $SJAVAC_SERVER_JAVA -d64 -version" >&5 - OUTPUT=`$SJAVAC_SERVER_JAVA -d64 -version 2>&1` - FOUND_WARN=`$ECHO "$OUTPUT" | $GREP -i warn` - FOUND_VERSION=`$ECHO $OUTPUT | $GREP " version \""` - if test "x$FOUND_VERSION" != x && test "x$FOUND_WARN" = x; then - SJAVAC_SERVER_JAVA_FLAGS="$SJAVAC_SERVER_JAVA_FLAGS -d64" - JVM_ARG_OK=true - else - $ECHO "Arg failed:" >&5 - $ECHO "$OUTPUT" >&5 - JVM_ARG_OK=false - fi - - if test "$JVM_ARG_OK" = true; then + if "$JAVA" -version 2>&1 | $GREP -q "64-Bit"; then JVM_64BIT=true - JVM_ARG_OK=false fi fi
--- a/common/autoconf/platform.m4 Fri May 12 15:14:16 2017 -0700 +++ b/common/autoconf/platform.m4 Wed Jul 05 23:26:38 2017 +0200 @@ -433,6 +433,29 @@ ]) +AC_DEFUN([PLATFORM_SET_RELEASE_FILE_OS_VALUES], +[ + if test "x$OPENJDK_TARGET_OS" = "xsolaris"; then + RELEASE_FILE_OS_NAME=SunOS + fi + if test "x$OPENJDK_TARGET_OS" = "xlinux"; then + RELEASE_FILE_OS_NAME=Linux + fi + if test "x$OPENJDK_TARGET_OS" = "xwindows"; then + RELEASE_FILE_OS_NAME=Windows + fi + if test "x$OPENJDK_TARGET_OS" = xmacosx; then + RELEASE_FILE_OS_NAME="Darwin" + fi + if test "x$OPENJDK_TARGET_OS" = "xaix"; then + RELEASE_FILE_OS_NAME="AIX" + fi + RELEASE_FILE_OS_ARCH=${OPENJDK_TARGET_CPU} + + AC_SUBST(RELEASE_FILE_OS_NAME) + AC_SUBST(RELEASE_FILE_OS_ARCH) +]) + AC_DEFUN([PLATFORM_SET_MODULE_TARGET_OS_VALUES], [ if test "x$OPENJDK_TARGET_OS" = xmacosx; then @@ -447,8 +470,8 @@ OPENJDK_MODULE_TARGET_OS_ARCH="$OPENJDK_TARGET_CPU" fi - AC_SUBST(OPENJDK_MODULE_TARGET_OS_NAME) - AC_SUBST(OPENJDK_MODULE_TARGET_OS_ARCH) + OPENJDK_MODULE_TARGET_PLATFORM="${OPENJDK_MODULE_TARGET_OS_NAME}-${OPENJDK_MODULE_TARGET_OS_ARCH}" + AC_SUBST(OPENJDK_MODULE_TARGET_PLATFORM) ]) #%%% Build and target systems %%% @@ -466,6 +489,7 @@ PLATFORM_EXTRACT_TARGET_AND_BUILD PLATFORM_SETUP_TARGET_CPU_BITS PLATFORM_SET_MODULE_TARGET_OS_VALUES + PLATFORM_SET_RELEASE_FILE_OS_VALUES PLATFORM_SETUP_LEGACY_VARS ])
--- a/common/autoconf/spec.gmk.in Fri May 12 15:14:16 2017 -0700 +++ b/common/autoconf/spec.gmk.in Wed Jul 05 23:26:38 2017 +0200 @@ -101,9 +101,12 @@ OPENJDK_BUILD_CPU_BITS:=@OPENJDK_BUILD_CPU_BITS@ OPENJDK_BUILD_CPU_ENDIAN:=@OPENJDK_BUILD_CPU_ENDIAN@ -# OS values for use in ModuleTarget class file attribute. -OPENJDK_MODULE_TARGET_OS_NAME:=@OPENJDK_MODULE_TARGET_OS_NAME@ -OPENJDK_MODULE_TARGET_OS_ARCH:=@OPENJDK_MODULE_TARGET_OS_ARCH@ +# Target platform value in ModuleTarget class file attribute. +OPENJDK_MODULE_TARGET_PLATFORM:=@OPENJDK_MODULE_TARGET_PLATFORM@ + +# OS_* properties in release file +RELEASE_FILE_OS_NAME:=@RELEASE_FILE_OS_NAME@ +RELEASE_FILE_OS_ARCH:=@RELEASE_FILE_OS_ARCH@ LIBM:=@LIBM@ LIBDL:=@LIBDL@
--- a/common/conf/jib-profiles.js Fri May 12 15:14:16 2017 -0700 +++ b/common/conf/jib-profiles.js Wed Jul 05 23:26:38 2017 +0200 @@ -239,11 +239,8 @@ common.main_profile_base = { dependencies: ["boot_jdk", "gnumake", "jtreg"], default_make_targets: ["product-bundles", "test-bundles"], - configure_args: [ - "--with-version-opt=" + common.build_id, - "--enable-jtreg-failure-handler", - "--with-version-build=" + common.build_number - ] + configure_args: concat(["--enable-jtreg-failure-handler"], + versionArgs(input, common)) }; // Extra settings for debug profiles common.debug_suffix = "-debug"; @@ -269,10 +266,12 @@ /** * Define common artifacts template for all main profiles - * @param pf - Name of platform in bundle names - * @param demo_ext - Type of extension for demo bundle + * @param o - Object containing data for artifacts */ - common.main_profile_artifacts = function (pf, demo_ext) { + common.main_profile_artifacts = function (o) { + var jdk_subdir = (o.jdk_subdir != null ? o.jdk_subdir : "jdk-" + data.version); + var jre_subdir = (o.jre_subdir != null ? o.jre_subdir : "jre-" + data.version); + var pf = o.platform return { artifacts: { jdk: { @@ -281,7 +280,7 @@ "bundles/" + pf + "/jdk-" + data.version + "_" + pf + "_bin.tar.gz", "bundles/" + pf + "/\\1" ], - subdir: "jdk-" + data.version, + subdir: jdk_subdir, exploded: "images/jdk" }, jre: { @@ -290,7 +289,7 @@ "bundles/" + pf + "/jre-" + data.version + "_" + pf + "_bin.tar.gz", "bundles/" + pf + "/\\1" ], - subdir: "jre-" + data.version, + subdir: jre_subdir, exploded: "images/jre" }, test: { @@ -307,7 +306,7 @@ "bundles/" + pf + "/jdk-" + data.version + "_" + pf + "_bin-symbols.tar.gz", "bundles/" + pf + "/\\1" ], - subdir: "jdk-" + data.version, + subdir: jdk_subdir, exploded: "images/jdk" }, jre_symbols: { @@ -316,15 +315,8 @@ "bundles/" + pf + "/jre-" + data.version + "_" + pf + "_bin-symbols.tar.gz", "bundles/" + pf + "/\\1" ], - subdir: "jre-" + data.version, + subdir: jre_subdir, exploded: "images/jre" - }, - demo: { - local: "bundles/\\(jdk.*demo." + demo_ext + "\\)", - remote: [ - "bundles/" + pf + "/jdk-" + data.version + "_" + pf + "_demo." + demo_ext, - "bundles/" + pf + "/\\1" - ], } } }; @@ -333,9 +325,12 @@ /** * Define common artifacts template for all debug profiles - * @param pf - Name of platform in bundle names + * @param o - Object containing data for artifacts */ - common.debug_profile_artifacts = function (pf) { + common.debug_profile_artifacts = function (o) { + var jdk_subdir = "jdk-" + data.version + "/fastdebug"; + var jre_subdir = "jre-" + data.version + "/fastdebug"; + var pf = o.platform return { artifacts: { jdk: { @@ -344,7 +339,7 @@ "bundles/" + pf + "/jdk-" + data.version + "_" + pf + "_bin-debug.tar.gz", "bundles/" + pf + "/\\1" ], - subdir: "jdk-" + data.version, + subdir: jdk_subdir, exploded: "images/jdk" }, jre: { @@ -353,7 +348,7 @@ "bundles/" + pf + "/jre-" + data.version + "_" + pf + "_bin-debug.tar.gz", "bundles/" + pf + "/\\1" ], - subdir: "jre-" + data.version, + subdir: jre_subdir, exploded: "images/jre" }, test: { @@ -370,7 +365,7 @@ "bundles/" + pf + "/jdk-" + data.version + "_" + pf + "_bin-debug-symbols.tar.gz", "bundles/" + pf + "/\\1" ], - subdir: "jdk-" + data.version, + subdir: jdk_subdir, exploded: "images/jdk" }, jre_symbols: { @@ -379,7 +374,7 @@ "bundles/" + pf + "/jre-" + data.version + "_" + pf + "_bin-debug-symbols.tar.gz", "bundles/" + pf + "/\\1" ], - subdir: "jre-" + data.version, + subdir: jre_subdir, exploded: "images/jre" } } @@ -665,61 +660,53 @@ // // Define artifacts for profiles // - // Macosx bundles are named osx and Windows demo bundles use zip instead of + // Macosx bundles are named osx // tar.gz. var artifactData = { "linux-x64": { platform: "linux-x64", - demo_ext: "tar.gz" }, "linux-x86": { platform: "linux-x86", - demo_ext: "tar.gz" }, "macosx-x64": { platform: "osx-x64", - demo_ext: "tar.gz" + jdk_subdir: "jdk-" + data.version + ".jdk/Contents/Home", + jre_subdir: "jre-" + data.version + ".jre/Contents/Home" }, "solaris-x64": { platform: "solaris-x64", - demo_ext: "tar.gz" }, "solaris-sparcv9": { platform: "solaris-sparcv9", - demo_ext: "tar.gz" }, "windows-x64": { platform: "windows-x64", - demo_ext: "zip" }, "windows-x86": { platform: "windows-x86", - demo_ext: "zip" }, "linux-arm64": { platform: "linux-arm64-vfp-hflt", - demo_ext: "tar.gz" }, "linux-arm-vfp-hflt": { platform: "linux-arm32-vfp-hflt", - demo_ext: "tar.gz" }, "linux-arm-vfp-hflt-dyn": { platform: "linux-arm32-vfp-hflt-dyn", - demo_ext: "tar.gz" } } // Generate common artifacts for all main profiles Object.keys(artifactData).forEach(function (name) { profiles[name] = concatObjects(profiles[name], - common.main_profile_artifacts(artifactData[name].platform, artifactData[name].demo_ext)); + common.main_profile_artifacts(artifactData[name])); }); // Generate common artifacts for all debug profiles Object.keys(artifactData).forEach(function (name) { var debugName = name + common.debug_suffix; profiles[debugName] = concatObjects(profiles[debugName], - common.debug_profile_artifacts(artifactData[name].platform)); + common.debug_profile_artifacts(artifactData[name])); }); // Extra profile specific artifacts @@ -740,7 +727,12 @@ artifacts: { jdk: { local: "bundles/\\(jdk.*bin.tar.gz\\)", - remote: "bundles/openjdk/GPL/linux-x64/\\1", + remote: [ + "bundles/openjdk/GPL/linux-x64/jdk-" + data.version + + "_linux-x64_bin.tar.gz", + "bundles/openjdk/GPL/linux-x64/\\1" + ], + subdir: "jdk-" + data.version }, jre: { local: "bundles/\\(jre.*bin.tar.gz\\)", @@ -748,20 +740,25 @@ }, test: { local: "bundles/\\(jdk.*bin-tests.tar.gz\\)", - remote: "bundles/openjdk/GPL/linux-x64/\\1", + remote: [ + "bundles/openjdk/GPL/linux-x64/jdk-" + data.version + + "_linux-x64_bin-tests.tar.gz", + "bundles/openjdk/GPL/linux-x64/\\1" + ] }, jdk_symbols: { local: "bundles/\\(jdk.*bin-symbols.tar.gz\\)", - remote: "bundles/openjdk/GPL/linux-x64/\\1", + remote: [ + "bundles/openjdk/GPL/linux-x64/jdk-" + data.version + + "_linux-x64_bin-symbols.tar.gz", + "bundles/openjdk/GPL/linux-x64/\\1" + ], + subdir: "jdk-" + data.version }, jre_symbols: { local: "bundles/\\(jre.*bin-symbols.tar.gz\\)", remote: "bundles/openjdk/GPL/linux-x64/\\1", }, - demo: { - local: "bundles/\\(jdk.*demo.tar.gz\\)", - remote: "bundles/openjdk/GPL/linux-x64/\\1", - }, doc_api_spec: { local: "bundles/\\(jdk.*doc-api-spec.tar.gz\\)", remote: "bundles/openjdk/GPL/linux-x64/\\1", @@ -773,11 +770,29 @@ artifacts: { jdk: { local: "bundles/\\(jdk.*bin.tar.gz\\)", - remote: "bundles/openjdk/GPL/profile/linux-x86/\\1", + remote: [ + "bundles/openjdk/GPL/linux-x86/jdk-" + data.version + + "_linux-x86_bin.tar.gz", + "bundles/openjdk/GPL/linux-x86/\\1" + ], + subdir: "jdk-" + data.version }, jdk_symbols: { local: "bundles/\\(jdk.*bin-symbols.tar.gz\\)", - remote: "bundles/openjdk/GPL/profile/linux-x86/\\1", + remote: [ + "bundles/openjdk/GPL/linux-x86/jdk-" + data.version + + "_linux-x86_bin-symbols.tar.gz", + "bundles/openjdk/GPL/linux-x86/\\1" + ], + subdir: "jdk-" + data.version + }, + test: { + local: "bundles/\\(jdk.*bin-tests.tar.gz\\)", + remote: [ + "bundles/openjdk/GPL/linux-x86/jdk-" + data.version + + "_linux-x86_bin-tests.tar.gz", + "bundles/openjdk/GPL/linux-x86/\\1" + ] }, jre: { // This regexp needs to not match the compact* files below @@ -803,7 +818,12 @@ artifacts: { jdk: { local: "bundles/\\(jdk.*bin.tar.gz\\)", - remote: "bundles/openjdk/GPL/windows-x86/\\1", + remote: [ + "bundles/openjdk/GPL/windows-x86/jdk-" + data.version + + "_windows-x86_bin.tar.gz", + "bundles/openjdk/GPL/windows-x86/\\1" + ], + subdir: "jdk-" + data.version }, jre: { local: "bundles/\\(jre.*bin.tar.gz\\)", @@ -811,19 +831,24 @@ }, test: { local: "bundles/\\(jdk.*bin-tests.tar.gz\\)", - remote: "bundles/openjdk/GPL/windows-x86/\\1", + remote: [ + "bundles/openjdk/GPL/windows-x86/jdk-" + data.version + + "_windows-x86_bin-tests.tar.gz", + "bundles/openjdk/GPL/windows-x86/\\1" + ] }, jdk_symbols: { local: "bundles/\\(jdk.*bin-symbols.tar.gz\\)", - remote: "bundles/openjdk/GPL/windows-x86/\\1" + remote: [ + "bundles/openjdk/GPL/windows-x86/jdk-" + data.version + + "_windows-x86_bin-symbols.tar.gz", + "bundles/openjdk/GPL/windows-x86/\\1" + ], + subdir: "jdk-" + data.version }, jre_symbols: { local: "bundles/\\(jre.*bin-symbols.tar.gz\\)", remote: "bundles/openjdk/GPL/windows-x86/\\1", - }, - demo: { - local: "bundles/\\(jdk.*demo.zip\\)", - remote: "bundles/openjdk/GPL/windows-x86/\\1", } } }, @@ -1154,6 +1179,23 @@ return version; }; +/** + * Constructs the common version configure args based on build type and + * other version inputs + */ +var versionArgs = function(input, common) { + var args = ["--with-version-build=" + common.build_number]; + if (input.build_type == "promoted") { + args = concat(args, + // This needs to be changed when we start building release candidates + "--with-version-pre=ea", + "--without-version-opt"); + } else { + args = concat(args, "--with-version-opt=" + common.build_id); + } + return args; +} + // Properties representation of the common/autoconf/version-numbers file. Lazily // initiated by the function below. var version_numbers;
--- a/common/doc/testing.md Fri May 12 15:14:16 2017 -0700 +++ b/common/doc/testing.md Wed Jul 05 23:26:38 2017 +0200 @@ -199,9 +199,8 @@ Use `GTEST="OPTIONS=--help"` to see all available Gtest options. --- -# Override some definitions in http://openjdk.java.net/page.css that are -# unsuitable for this document. +# Override some definitions in the global css file that are not optimal for +# this document. header-includes: - '<style type="text/css">pre, code, tt { color: #1d6ae5; }</style>' - - '<style type="text/css">pre { font-size: 10pt; }</style>' ---
--- a/corba/.hgtags Fri May 12 15:14:16 2017 -0700 +++ b/corba/.hgtags Wed Jul 05 23:26:38 2017 +0200 @@ -418,3 +418,4 @@ c7358d703e1282af3dcd8af6c037dc4342de9054 jdk-10+6 43de67f51801b9e16507865fcb7e8344f4ca4aa9 jdk-9+167 03a2cc9c8a1e8f87924c9863e917bc8b91770d5f jdk-9+168 +b2218d41edef02ee8f94bb438f885b2ba79bfa08 jdk-9+169
--- a/hotspot/.hgtags Fri May 12 15:14:16 2017 -0700 +++ b/hotspot/.hgtags Wed Jul 05 23:26:38 2017 +0200 @@ -578,3 +578,4 @@ 762465099d938fd96cd1efda193bc1fa23d070d3 jdk-10+6 1ca7ed1b17b5776930d641d1379834f3140a74e4 jdk-9+167 fbb9c802649585d19f6d7e81b4a519d44806225a jdk-9+168 +16d692be099c5c38eb48cc9aca78b0c900910d5b jdk-9+169
--- a/hotspot/src/cpu/aarch64/vm/aarch64.ad Fri May 12 15:14:16 2017 -0700 +++ b/hotspot/src/cpu/aarch64/vm/aarch64.ad Wed Jul 05 23:26:38 2017 +0200 @@ -577,7 +577,7 @@ R26 /* R27, */ // heapbase /* R28, */ // thread - /* R29, */ // fp + R29, // fp /* R30, */ // lr /* R31 */ // sp ); @@ -646,7 +646,7 @@ R26, R26_H, /* R27, R27_H, */ // heapbase /* R28, R28_H, */ // thread - /* R29, R29_H, */ // fp + R29, R29_H, // fp /* R30, R30_H, */ // lr /* R31, R31_H */ // sp ); @@ -14021,10 +14021,12 @@ ins_pipe(pipe_class_memory); %} -instruct clearArray_imm_reg(immL cnt, iRegP_R10 base, iRegL_R11 tmp, Universe dummy, rFlagsReg cr) -%{ +instruct clearArray_imm_reg(immL cnt, iRegP_R10 base, Universe dummy, rFlagsReg cr) +%{ + predicate((u_int64_t)n->in(2)->get_long() + < (u_int64_t)(BlockZeroingLowLimit >> LogBytesPerWord)); match(Set dummy (ClearArray cnt base)); - effect(USE_KILL base, TEMP tmp); + effect(USE_KILL base); ins_cost(4 * INSN_COST); format %{ "ClearArray $cnt, $base" %}
--- a/hotspot/src/cpu/aarch64/vm/assembler_aarch64.cpp Fri May 12 15:14:16 2017 -0700 +++ b/hotspot/src/cpu/aarch64/vm/assembler_aarch64.cpp Wed Jul 05 23:26:38 2017 +0200 @@ -1,8 +1,7 @@ /* - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights All rights reserved. + * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2014, Red Hat Inc. All rights reserved. - * reserved. DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE - * HEADER. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as @@ -21,7 +20,6 @@ * 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. - * */ #include <stdio.h>
--- a/hotspot/src/cpu/aarch64/vm/macroAssembler_aarch64.cpp Fri May 12 15:14:16 2017 -0700 +++ b/hotspot/src/cpu/aarch64/vm/macroAssembler_aarch64.cpp Wed Jul 05 23:26:38 2017 +0200 @@ -698,6 +698,7 @@ // trampolines won't be emitted. address MacroAssembler::trampoline_call(Address entry, CodeBuffer *cbuf) { + assert(JavaThread::current()->is_Compiler_thread(), "just checking"); assert(entry.rspec().type() == relocInfo::runtime_call_type || entry.rspec().type() == relocInfo::opt_virtual_call_type || entry.rspec().type() == relocInfo::static_call_type @@ -4944,34 +4945,67 @@ } -// base: Address of a buffer to be zeroed, 8 bytes aligned. -// cnt: Count in HeapWords. -// is_large: True when 'cnt' is known to be >= BlockZeroingLowLimit. -void MacroAssembler::zero_words(Register base, Register cnt) +// The size of the blocks erased by the zero_blocks stub. We must +// handle anything smaller than this ourselves in zero_words(). +const int MacroAssembler::zero_words_block_size = 8; + +// zero_words() is used by C2 ClearArray patterns. It is as small as +// possible, handling small word counts locally and delegating +// anything larger to the zero_blocks stub. It is expanded many times +// in compiled code, so it is important to keep it short. + +// ptr: Address of a buffer to be zeroed. +// cnt: Count in HeapWords. +// +// ptr, cnt, rscratch1, and rscratch2 are clobbered. +void MacroAssembler::zero_words(Register ptr, Register cnt) { - if (UseBlockZeroing) { - block_zero(base, cnt); - } else { - fill_words(base, cnt, zr); + assert(is_power_of_2(zero_words_block_size), "adjust this"); + assert(ptr == r10 && cnt == r11, "mismatch in register usage"); + + BLOCK_COMMENT("zero_words {"); + cmp(cnt, zero_words_block_size); + Label around, done, done16; + br(LO, around); + { + RuntimeAddress zero_blocks = RuntimeAddress(StubRoutines::aarch64::zero_blocks()); + assert(zero_blocks.target() != NULL, "zero_blocks stub has not been generated"); + if (StubRoutines::aarch64::complete()) { + trampoline_call(zero_blocks); + } else { + bl(zero_blocks); + } } + bind(around); + for (int i = zero_words_block_size >> 1; i > 1; i >>= 1) { + Label l; + tbz(cnt, exact_log2(i), l); + for (int j = 0; j < i; j += 2) { + stp(zr, zr, post(ptr, 16)); + } + bind(l); + } + { + Label l; + tbz(cnt, 0, l); + str(zr, Address(ptr)); + bind(l); + } + BLOCK_COMMENT("} zero_words"); } -// r10 = base: Address of a buffer to be zeroed, 8 bytes aligned. +// base: Address of a buffer to be zeroed, 8 bytes aligned. // cnt: Immediate count in HeapWords. -// r11 = tmp: For use as cnt if we need to call out -#define ShortArraySize (18 * BytesPerLong) +#define SmallArraySize (18 * BytesPerLong) void MacroAssembler::zero_words(Register base, u_int64_t cnt) { - Register tmp = r11; + BLOCK_COMMENT("zero_words {"); int i = cnt & 1; // store any odd word to start if (i) str(zr, Address(base)); - if (cnt <= ShortArraySize / BytesPerLong) { + if (cnt <= SmallArraySize / BytesPerLong) { for (; i < (int)cnt; i += 2) stp(zr, zr, Address(base, i * wordSize)); - } else if (UseBlockZeroing && cnt >= (u_int64_t)(BlockZeroingLowLimit >> LogBytesPerWord)) { - mov(tmp, cnt); - block_zero(base, tmp, true); } else { const int unroll = 4; // Number of stp(zr, zr) instructions we'll unroll int remainder = cnt % (2 * unroll); @@ -4992,6 +5026,51 @@ stp(zr, zr, Address(pre(loop_base, 2 * unroll * wordSize))); cbnz(cnt_reg, loop); } + BLOCK_COMMENT("} zero_words"); +} + +// Zero blocks of memory by using DC ZVA. +// +// Aligns the base address first sufficently for DC ZVA, then uses +// DC ZVA repeatedly for every full block. cnt is the size to be +// zeroed in HeapWords. Returns the count of words left to be zeroed +// in cnt. +// +// NOTE: This is intended to be used in the zero_blocks() stub. If +// you want to use it elsewhere, note that cnt must be >= 2*zva_length. +void MacroAssembler::zero_dcache_blocks(Register base, Register cnt) { + Register tmp = rscratch1; + Register tmp2 = rscratch2; + int zva_length = VM_Version::zva_length(); + Label initial_table_end, loop_zva; + Label fini; + + // Base must be 16 byte aligned. If not just return and let caller handle it + tst(base, 0x0f); + br(Assembler::NE, fini); + // Align base with ZVA length. + neg(tmp, base); + andr(tmp, tmp, zva_length - 1); + + // tmp: the number of bytes to be filled to align the base with ZVA length. + add(base, base, tmp); + sub(cnt, cnt, tmp, Assembler::ASR, 3); + adr(tmp2, initial_table_end); + sub(tmp2, tmp2, tmp, Assembler::LSR, 2); + br(tmp2); + + for (int i = -zva_length + 16; i < 0; i += 16) + stp(zr, zr, Address(base, i)); + bind(initial_table_end); + + sub(cnt, cnt, zva_length >> 3); + bind(loop_zva); + dc(Assembler::ZVA, base); + subs(cnt, cnt, zva_length >> 3); + add(base, base, zva_length); + br(Assembler::GE, loop_zva); + add(cnt, cnt, zva_length >> 3); // count not zeroed by DC ZVA + bind(fini); } // base: Address of a buffer to be filled, 8 bytes aligned. @@ -5052,69 +5131,6 @@ bind(fini); } -// Use DC ZVA to do fast zeroing. -// base: Address of a buffer to be zeroed, 8 bytes aligned. -// cnt: Count in HeapWords. -// is_large: True when 'cnt' is known to be >= BlockZeroingLowLimit. -void MacroAssembler::block_zero(Register base, Register cnt, bool is_large) -{ - Label small; - Label store_pair, loop_store_pair, done; - Label base_aligned; - - assert_different_registers(base, cnt, rscratch1); - guarantee(base == r10 && cnt == r11, "fix register usage"); - - Register tmp = rscratch1; - Register tmp2 = rscratch2; - int zva_length = VM_Version::zva_length(); - - // Ensure ZVA length can be divided by 16. This is required by - // the subsequent operations. - assert (zva_length % 16 == 0, "Unexpected ZVA Length"); - - if (!is_large) cbz(cnt, done); - tbz(base, 3, base_aligned); - str(zr, Address(post(base, 8))); - sub(cnt, cnt, 1); - bind(base_aligned); - - // Ensure count >= zva_length * 2 so that it still deserves a zva after - // alignment. - if (!is_large || !(BlockZeroingLowLimit >= zva_length * 2)) { - int low_limit = MAX2(zva_length * 2, (int)BlockZeroingLowLimit); - subs(tmp, cnt, low_limit >> 3); - br(Assembler::LT, small); - } - - far_call(StubRoutines::aarch64::get_zero_longs()); - - bind(small); - - const int unroll = 8; // Number of stp instructions we'll unroll - Label small_loop, small_table_end; - - andr(tmp, cnt, (unroll-1) * 2); - sub(cnt, cnt, tmp); - add(base, base, tmp, Assembler::LSL, 3); - adr(tmp2, small_table_end); - sub(tmp2, tmp2, tmp, Assembler::LSL, 1); - br(tmp2); - - bind(small_loop); - add(base, base, unroll * 16); - for (int i = -unroll; i < 0; i++) - stp(zr, zr, Address(base, i * 16)); - bind(small_table_end); - subs(cnt, cnt, unroll * 2); - br(Assembler::GE, small_loop); - - tbz(cnt, 0, done); - str(zr, Address(post(base, 8))); - - bind(done); -} - // Intrinsic for sun/nio/cs/ISO_8859_1$Encoder.implEncodeISOArray and // java/lang/StringUTF16.compress. void MacroAssembler::encode_iso_array(Register src, Register dst,
--- a/hotspot/src/cpu/aarch64/vm/macroAssembler_aarch64.hpp Fri May 12 15:14:16 2017 -0700 +++ b/hotspot/src/cpu/aarch64/vm/macroAssembler_aarch64.hpp Wed Jul 05 23:26:38 2017 +0200 @@ -1213,8 +1213,10 @@ void fill_words(Register base, Register cnt, Register value); void zero_words(Register base, u_int64_t cnt); - void zero_words(Register base, Register cnt); - void block_zero(Register base, Register cnt, bool is_large = false); + void zero_words(Register ptr, Register cnt); + void zero_dcache_blocks(Register base, Register cnt); + + static const int zero_words_block_size; void byte_array_inflate(Register src, Register dst, Register len, FloatRegister vtmp1, FloatRegister vtmp2,
--- a/hotspot/src/cpu/aarch64/vm/stubGenerator_aarch64.cpp Fri May 12 15:14:16 2017 -0700 +++ b/hotspot/src/cpu/aarch64/vm/stubGenerator_aarch64.cpp Wed Jul 05 23:26:38 2017 +0200 @@ -719,48 +719,74 @@ } } - address generate_zero_longs(Register base, Register cnt) { - Register tmp = rscratch1; - Register tmp2 = rscratch2; - int zva_length = VM_Version::zva_length(); - Label initial_table_end, loop_zva; - Label fini; + // The inner part of zero_words(). This is the bulk operation, + // zeroing words in blocks, possibly using DC ZVA to do it. The + // caller is responsible for zeroing the last few words. + // + // Inputs: + // r10: the HeapWord-aligned base address of an array to zero. + // r11: the count in HeapWords, r11 > 0. + // + // Returns r10 and r11, adjusted for the caller to clear. + // r10: the base address of the tail of words left to clear. + // r11: the number of words in the tail. + // r11 < MacroAssembler::zero_words_block_size. + + address generate_zero_blocks() { + Label store_pair, loop_store_pair, done; + Label base_aligned; + + Register base = r10, cnt = r11; __ align(CodeEntryAlignment); - StubCodeMark mark(this, "StubRoutines", "zero_longs"); + StubCodeMark mark(this, "StubRoutines", "zero_blocks"); address start = __ pc(); - // Base must be 16 byte aligned. If not just return and let caller handle it - __ tst(base, 0x0f); - __ br(Assembler::NE, fini); - // Align base with ZVA length. - __ neg(tmp, base); - __ andr(tmp, tmp, zva_length - 1); - - // tmp: the number of bytes to be filled to align the base with ZVA length. - __ add(base, base, tmp); - __ sub(cnt, cnt, tmp, Assembler::ASR, 3); - __ adr(tmp2, initial_table_end); - __ sub(tmp2, tmp2, tmp, Assembler::LSR, 2); - __ br(tmp2); - - for (int i = -zva_length + 16; i < 0; i += 16) - __ stp(zr, zr, Address(base, i)); - __ bind(initial_table_end); - - __ sub(cnt, cnt, zva_length >> 3); - __ bind(loop_zva); - __ dc(Assembler::ZVA, base); - __ subs(cnt, cnt, zva_length >> 3); - __ add(base, base, zva_length); - __ br(Assembler::GE, loop_zva); - __ add(cnt, cnt, zva_length >> 3); // count not zeroed by DC ZVA - __ bind(fini); + if (UseBlockZeroing) { + int zva_length = VM_Version::zva_length(); + + // Ensure ZVA length can be divided by 16. This is required by + // the subsequent operations. + assert (zva_length % 16 == 0, "Unexpected ZVA Length"); + + __ tbz(base, 3, base_aligned); + __ str(zr, Address(__ post(base, 8))); + __ sub(cnt, cnt, 1); + __ bind(base_aligned); + + // Ensure count >= zva_length * 2 so that it still deserves a zva after + // alignment. + Label small; + int low_limit = MAX2(zva_length * 2, (int)BlockZeroingLowLimit); + __ cmp(cnt, low_limit >> 3); + __ br(Assembler::LT, small); + __ zero_dcache_blocks(base, cnt); + __ bind(small); + } + + { + // Number of stp instructions we'll unroll + const int unroll = + MacroAssembler::zero_words_block_size / 2; + // Clear the remaining blocks. + Label loop; + __ subs(cnt, cnt, unroll * 2); + __ br(Assembler::LT, done); + __ bind(loop); + for (int i = 0; i < unroll; i++) + __ stp(zr, zr, __ post(base, 16)); + __ subs(cnt, cnt, unroll * 2); + __ br(Assembler::GE, loop); + __ bind(done); + __ add(cnt, cnt, unroll * 2); + } + __ ret(lr); return start; } + typedef enum { copy_forwards = 1, copy_backwards = -1 @@ -2346,20 +2372,16 @@ __ subw(count, count, cnt_words, Assembler::LSL, 3 - shift); if (UseBlockZeroing) { Label non_block_zeroing, rest; - Register tmp = rscratch1; - // count >= BlockZeroingLowLimit && value == 0 - __ subs(tmp, cnt_words, BlockZeroingLowLimit >> 3); - __ ccmp(value, 0 /* comparing value */, 0 /* NZCV */, Assembler::GE); - __ br(Assembler::NE, non_block_zeroing); + // If the fill value is zero we can use the fast zero_words(). + __ cbnz(value, non_block_zeroing); __ mov(bz_base, to); - __ block_zero(bz_base, cnt_words, true); - __ mov(to, bz_base); + __ add(to, to, cnt_words, Assembler::LSL, LogBytesPerWord); + __ zero_words(bz_base, cnt_words); __ b(rest); __ bind(non_block_zeroing); __ fill_words(to, cnt_words, value); __ bind(rest); - } - else { + } else { __ fill_words(to, cnt_words, value); } @@ -2420,7 +2442,7 @@ generate_copy_longs(copy_f, r0, r1, rscratch2, copy_forwards); generate_copy_longs(copy_b, r0, r1, rscratch2, copy_backwards); - StubRoutines::aarch64::_zero_longs = generate_zero_longs(r10, r11); + StubRoutines::aarch64::_zero_blocks = generate_zero_blocks(); //*** jbyte // Always need aligned and unaligned versions @@ -4769,6 +4791,7 @@ &StubRoutines::_safefetchN_fault_pc, &StubRoutines::_safefetchN_continuation_pc); #endif + StubRoutines::aarch64::set_completed(); } public:
--- a/hotspot/src/cpu/aarch64/vm/stubRoutines_aarch64.cpp Fri May 12 15:14:16 2017 -0700 +++ b/hotspot/src/cpu/aarch64/vm/stubRoutines_aarch64.cpp Wed Jul 05 23:26:38 2017 +0200 @@ -43,7 +43,8 @@ address StubRoutines::aarch64::_float_sign_flip = NULL; address StubRoutines::aarch64::_double_sign_mask = NULL; address StubRoutines::aarch64::_double_sign_flip = NULL; -address StubRoutines::aarch64::_zero_longs = NULL; +address StubRoutines::aarch64::_zero_blocks = NULL; +bool StubRoutines::aarch64::_completed = false; /** * crc_table[] from jdk/src/share/native/java/util/zip/zlib-1.2.5/crc32.h
--- a/hotspot/src/cpu/aarch64/vm/stubRoutines_aarch64.hpp Fri May 12 15:14:16 2017 -0700 +++ b/hotspot/src/cpu/aarch64/vm/stubRoutines_aarch64.hpp Wed Jul 05 23:26:38 2017 +0200 @@ -61,7 +61,8 @@ static address _double_sign_mask; static address _double_sign_flip; - static address _zero_longs; + static address _zero_blocks; + static bool _completed; public: @@ -115,12 +116,19 @@ return _double_sign_flip; } - static address get_zero_longs() - { - return _zero_longs; + static address zero_blocks() { + return _zero_blocks; } - private: + static bool complete() { + return _completed; + } + + static void set_completed() { + _completed = true; + } + +private: static juint _crc_table[]; };
--- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/ppc64/PPC64RegisterMap.java Fri May 12 15:14:16 2017 -0700 +++ b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/ppc64/PPC64RegisterMap.java Wed Jul 05 23:26:38 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 20014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 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
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.test/src/org/graalvm/compiler/hotspot/test/CheckGraalIntrinsics.java Fri May 12 15:14:16 2017 -0700 +++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.test/src/org/graalvm/compiler/hotspot/test/CheckGraalIntrinsics.java Wed Jul 05 23:26:38 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -246,21 +246,21 @@ "jdk/internal/misc/Unsafe.allocateUninitializedArray0(Ljava/lang/Class;I)Ljava/lang/Object;", "jdk/internal/misc/Unsafe.compareAndExchangeByteAcquire(Ljava/lang/Object;JBB)B", "jdk/internal/misc/Unsafe.compareAndExchangeByteRelease(Ljava/lang/Object;JBB)B", - "jdk/internal/misc/Unsafe.compareAndExchangeByteVolatile(Ljava/lang/Object;JBB)B", + "jdk/internal/misc/Unsafe.compareAndExchangeByte(Ljava/lang/Object;JBB)B", "jdk/internal/misc/Unsafe.compareAndExchangeIntAcquire(Ljava/lang/Object;JII)I", "jdk/internal/misc/Unsafe.compareAndExchangeIntRelease(Ljava/lang/Object;JII)I", - "jdk/internal/misc/Unsafe.compareAndExchangeIntVolatile(Ljava/lang/Object;JII)I", + "jdk/internal/misc/Unsafe.compareAndExchangeInt(Ljava/lang/Object;JII)I", "jdk/internal/misc/Unsafe.compareAndExchangeLongAcquire(Ljava/lang/Object;JJJ)J", "jdk/internal/misc/Unsafe.compareAndExchangeLongRelease(Ljava/lang/Object;JJJ)J", - "jdk/internal/misc/Unsafe.compareAndExchangeLongVolatile(Ljava/lang/Object;JJJ)J", + "jdk/internal/misc/Unsafe.compareAndExchangeLong(Ljava/lang/Object;JJJ)J", "jdk/internal/misc/Unsafe.compareAndExchangeObjectAcquire(Ljava/lang/Object;JLjava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;", "jdk/internal/misc/Unsafe.compareAndExchangeObjectRelease(Ljava/lang/Object;JLjava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;", - "jdk/internal/misc/Unsafe.compareAndExchangeObjectVolatile(Ljava/lang/Object;JLjava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;", + "jdk/internal/misc/Unsafe.compareAndExchangeObject(Ljava/lang/Object;JLjava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;", "jdk/internal/misc/Unsafe.compareAndExchangeShortAcquire(Ljava/lang/Object;JSS)S", "jdk/internal/misc/Unsafe.compareAndExchangeShortRelease(Ljava/lang/Object;JSS)S", - "jdk/internal/misc/Unsafe.compareAndExchangeShortVolatile(Ljava/lang/Object;JSS)S", - "jdk/internal/misc/Unsafe.compareAndSwapByte(Ljava/lang/Object;JBB)Z", - "jdk/internal/misc/Unsafe.compareAndSwapShort(Ljava/lang/Object;JSS)Z", + "jdk/internal/misc/Unsafe.compareAndExchangeShort(Ljava/lang/Object;JSS)S", + "jdk/internal/misc/Unsafe.compareAndSetByte(Ljava/lang/Object;JBB)Z", + "jdk/internal/misc/Unsafe.compareAndSetShort(Ljava/lang/Object;JSS)Z", "jdk/internal/misc/Unsafe.copyMemory0(Ljava/lang/Object;JLjava/lang/Object;JJ)V", "jdk/internal/misc/Unsafe.getAndAddByte(Ljava/lang/Object;JB)B", "jdk/internal/misc/Unsafe.getAndAddShort(Ljava/lang/Object;JS)S", @@ -295,26 +295,26 @@ "jdk/internal/misc/Unsafe.putObjectOpaque(Ljava/lang/Object;JLjava/lang/Object;)V", "jdk/internal/misc/Unsafe.putShortOpaque(Ljava/lang/Object;JS)V", "jdk/internal/misc/Unsafe.unpark(Ljava/lang/Object;)V", - "jdk/internal/misc/Unsafe.weakCompareAndSwapByte(Ljava/lang/Object;JBB)Z", - "jdk/internal/misc/Unsafe.weakCompareAndSwapByteAcquire(Ljava/lang/Object;JBB)Z", - "jdk/internal/misc/Unsafe.weakCompareAndSwapByteRelease(Ljava/lang/Object;JBB)Z", - "jdk/internal/misc/Unsafe.weakCompareAndSwapByteVolatile(Ljava/lang/Object;JBB)Z", - "jdk/internal/misc/Unsafe.weakCompareAndSwapInt(Ljava/lang/Object;JII)Z", - "jdk/internal/misc/Unsafe.weakCompareAndSwapIntAcquire(Ljava/lang/Object;JII)Z", - "jdk/internal/misc/Unsafe.weakCompareAndSwapIntRelease(Ljava/lang/Object;JII)Z", - "jdk/internal/misc/Unsafe.weakCompareAndSwapIntVolatile(Ljava/lang/Object;JII)Z", - "jdk/internal/misc/Unsafe.weakCompareAndSwapLong(Ljava/lang/Object;JJJ)Z", - "jdk/internal/misc/Unsafe.weakCompareAndSwapLongAcquire(Ljava/lang/Object;JJJ)Z", - "jdk/internal/misc/Unsafe.weakCompareAndSwapLongRelease(Ljava/lang/Object;JJJ)Z", - "jdk/internal/misc/Unsafe.weakCompareAndSwapLongVolatile(Ljava/lang/Object;JJJ)Z", - "jdk/internal/misc/Unsafe.weakCompareAndSwapObject(Ljava/lang/Object;JLjava/lang/Object;Ljava/lang/Object;)Z", - "jdk/internal/misc/Unsafe.weakCompareAndSwapObjectAcquire(Ljava/lang/Object;JLjava/lang/Object;Ljava/lang/Object;)Z", - "jdk/internal/misc/Unsafe.weakCompareAndSwapObjectRelease(Ljava/lang/Object;JLjava/lang/Object;Ljava/lang/Object;)Z", - "jdk/internal/misc/Unsafe.weakCompareAndSwapObjectVolatile(Ljava/lang/Object;JLjava/lang/Object;Ljava/lang/Object;)Z", - "jdk/internal/misc/Unsafe.weakCompareAndSwapShort(Ljava/lang/Object;JSS)Z", - "jdk/internal/misc/Unsafe.weakCompareAndSwapShortAcquire(Ljava/lang/Object;JSS)Z", - "jdk/internal/misc/Unsafe.weakCompareAndSwapShortRelease(Ljava/lang/Object;JSS)Z", - "jdk/internal/misc/Unsafe.weakCompareAndSwapShortVolatile(Ljava/lang/Object;JSS)Z", + "jdk/internal/misc/Unsafe.weakCompareAndSetBytePlain(Ljava/lang/Object;JBB)Z", + "jdk/internal/misc/Unsafe.weakCompareAndSetByteAcquire(Ljava/lang/Object;JBB)Z", + "jdk/internal/misc/Unsafe.weakCompareAndSetByteRelease(Ljava/lang/Object;JBB)Z", + "jdk/internal/misc/Unsafe.weakCompareAndSetByte(Ljava/lang/Object;JBB)Z", + "jdk/internal/misc/Unsafe.weakCompareAndSetIntPlain(Ljava/lang/Object;JII)Z", + "jdk/internal/misc/Unsafe.weakCompareAndSetIntAcquire(Ljava/lang/Object;JII)Z", + "jdk/internal/misc/Unsafe.weakCompareAndSetIntRelease(Ljava/lang/Object;JII)Z", + "jdk/internal/misc/Unsafe.weakCompareAndSetInt(Ljava/lang/Object;JII)Z", + "jdk/internal/misc/Unsafe.weakCompareAndSetLongPlain(Ljava/lang/Object;JJJ)Z", + "jdk/internal/misc/Unsafe.weakCompareAndSetLongAcquire(Ljava/lang/Object;JJJ)Z", + "jdk/internal/misc/Unsafe.weakCompareAndSetLongRelease(Ljava/lang/Object;JJJ)Z", + "jdk/internal/misc/Unsafe.weakCompareAndSetLong(Ljava/lang/Object;JJJ)Z", + "jdk/internal/misc/Unsafe.weakCompareAndSetObjectPlain(Ljava/lang/Object;JLjava/lang/Object;Ljava/lang/Object;)Z", + "jdk/internal/misc/Unsafe.weakCompareAndSetObjectAcquire(Ljava/lang/Object;JLjava/lang/Object;Ljava/lang/Object;)Z", + "jdk/internal/misc/Unsafe.weakCompareAndSetObjectRelease(Ljava/lang/Object;JLjava/lang/Object;Ljava/lang/Object;)Z", + "jdk/internal/misc/Unsafe.weakCompareAndSetObject(Ljava/lang/Object;JLjava/lang/Object;Ljava/lang/Object;)Z", + "jdk/internal/misc/Unsafe.weakCompareAndSetShortPlain(Ljava/lang/Object;JSS)Z", + "jdk/internal/misc/Unsafe.weakCompareAndSetShortAcquire(Ljava/lang/Object;JSS)Z", + "jdk/internal/misc/Unsafe.weakCompareAndSetShortRelease(Ljava/lang/Object;JSS)Z", + "jdk/internal/misc/Unsafe.weakCompareAndSetShort(Ljava/lang/Object;JSS)Z", "jdk/internal/util/Preconditions.checkIndex(IILjava/util/function/BiFunction;)I", "jdk/jfr/internal/JVM.counterTime()J", "jdk/jfr/internal/JVM.getBufferWriter()Ljava/lang/Object;",
--- a/hotspot/src/share/vm/c1/c1_Compiler.cpp Fri May 12 15:14:16 2017 -0700 +++ b/hotspot/src/share/vm/c1/c1_Compiler.cpp Wed Jul 05 23:26:38 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 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 @@ -108,7 +108,7 @@ } switch (id) { - case vmIntrinsics::_compareAndSwapLong: + case vmIntrinsics::_compareAndSetLong: if (!VM_Version::supports_cx8()) return false; break; case vmIntrinsics::_getAndAddInt: @@ -217,8 +217,8 @@ case vmIntrinsics::_updateDirectByteBufferCRC32C: #endif case vmIntrinsics::_vectorizedMismatch: - case vmIntrinsics::_compareAndSwapInt: - case vmIntrinsics::_compareAndSwapObject: + case vmIntrinsics::_compareAndSetInt: + case vmIntrinsics::_compareAndSetObject: case vmIntrinsics::_getCharStringU: case vmIntrinsics::_putCharStringU: #ifdef TRACE_HAVE_INTRINSICS
--- a/hotspot/src/share/vm/c1/c1_GraphBuilder.cpp Fri May 12 15:14:16 2017 -0700 +++ b/hotspot/src/share/vm/c1/c1_GraphBuilder.cpp Wed Jul 05 23:26:38 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 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 @@ -3500,9 +3500,9 @@ case vmIntrinsics::_putLongVolatile : append_unsafe_put_obj(callee, T_LONG, true); return; case vmIntrinsics::_putFloatVolatile : append_unsafe_put_obj(callee, T_FLOAT, true); return; case vmIntrinsics::_putDoubleVolatile : append_unsafe_put_obj(callee, T_DOUBLE, true); return; - case vmIntrinsics::_compareAndSwapLong: - case vmIntrinsics::_compareAndSwapInt: - case vmIntrinsics::_compareAndSwapObject: append_unsafe_CAS(callee); return; + case vmIntrinsics::_compareAndSetLong: + case vmIntrinsics::_compareAndSetInt: + case vmIntrinsics::_compareAndSetObject: append_unsafe_CAS(callee); return; case vmIntrinsics::_getAndAddInt: case vmIntrinsics::_getAndAddLong : append_unsafe_get_and_set_obj(callee, true); return; case vmIntrinsics::_getAndSetInt :
--- a/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp Fri May 12 15:14:16 2017 -0700 +++ b/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp Wed Jul 05 23:26:38 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2016, 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 @@ -3212,13 +3212,13 @@ // java.nio.Buffer.checkIndex case vmIntrinsics::_checkIndex: do_NIOCheckIndex(x); break; - case vmIntrinsics::_compareAndSwapObject: + case vmIntrinsics::_compareAndSetObject: do_CompareAndSwap(x, objectType); break; - case vmIntrinsics::_compareAndSwapInt: + case vmIntrinsics::_compareAndSetInt: do_CompareAndSwap(x, intType); break; - case vmIntrinsics::_compareAndSwapLong: + case vmIntrinsics::_compareAndSetLong: do_CompareAndSwap(x, longType); break;
--- a/hotspot/src/share/vm/classfile/moduleEntry.cpp Fri May 12 15:14:16 2017 -0700 +++ b/hotspot/src/share/vm/classfile/moduleEntry.cpp Wed Jul 05 23:26:38 2017 +0200 @@ -158,10 +158,10 @@ loader_data() != m_loader_data && !m_loader_data->is_builtin_class_loader_data()) { _must_walk_reads = true; - if (log_is_enabled(Trace, modules)) { + if (log_is_enabled(Trace, module)) { ResourceMark rm; - log_trace(modules)("ModuleEntry::set_read_walk_required(): module %s reads list must be walked", - (name() != NULL) ? name()->as_C_string() : UNNAMED_MODULE); + log_trace(module)("ModuleEntry::set_read_walk_required(): module %s reads list must be walked", + (name() != NULL) ? name()->as_C_string() : UNNAMED_MODULE); } } } @@ -180,10 +180,10 @@ // on the remaining live modules on the reads list. _must_walk_reads = false; - if (log_is_enabled(Trace, modules)) { + if (log_is_enabled(Trace, module)) { ResourceMark rm; - log_trace(modules)("ModuleEntry::purge_reads(): module %s reads list being walked", - (name() != NULL) ? name()->as_C_string() : UNNAMED_MODULE); + log_trace(module)("ModuleEntry::purge_reads(): module %s reads list being walked", + (name() != NULL) ? name()->as_C_string() : UNNAMED_MODULE); } // Go backwards because this removes entries that are dead. @@ -236,8 +236,11 @@ m = m->next(); ResourceMark rm; - log_debug(modules)("ModuleEntryTable: deleting module: %s", to_remove->name() != NULL ? - to_remove->name()->as_C_string() : UNNAMED_MODULE); + if (to_remove->name() != NULL) { + log_info(module, unload)("unloading module %s", to_remove->name()->as_C_string()); + } + log_debug(module)("ModuleEntryTable: deleting module: %s", to_remove->name() != NULL ? + to_remove->name()->as_C_string() : UNNAMED_MODULE); // Clean out the C heap allocated reads list first before freeing the entry to_remove->delete_reads(); @@ -315,9 +318,9 @@ if (ClassLoader::is_in_patch_mod_entries(name)) { entry->set_is_patched(); - if (log_is_enabled(Trace, modules, patch)) { + if (log_is_enabled(Trace, module, patch)) { ResourceMark rm; - log_trace(modules, patch)("Marked module %s as patched from --patch-module", name->as_C_string()); + log_trace(module, patch)("Marked module %s as patched from --patch-module", name->as_C_string()); } }
--- a/hotspot/src/share/vm/classfile/modules.cpp Fri May 12 15:14:16 2017 -0700 +++ b/hotspot/src/share/vm/classfile/modules.cpp Wed Jul 05 23:26:38 2017 +0200 @@ -237,16 +237,18 @@ // Patch any previously loaded class's module field with java.base's java.lang.Module. ModuleEntryTable::patch_javabase_entries(module_handle); - log_debug(modules)("define_javabase_module(): Definition of module: " - JAVA_BASE_NAME ", version: %s, location: %s, package #: %d", - module_version != NULL ? module_version : "NULL", - module_location != NULL ? module_location : "NULL", - pkg_list->length()); + log_info(module, load)(JAVA_BASE_NAME " location: %s", + module_location != NULL ? module_location : "NULL"); + log_debug(module)("define_javabase_module(): Definition of module: " + JAVA_BASE_NAME ", version: %s, location: %s, package #: %d", + module_version != NULL ? module_version : "NULL", + module_location != NULL ? module_location : "NULL", + pkg_list->length()); // packages defined to java.base for (int x = 0; x < pkg_list->length(); x++) { - log_trace(modules)("define_javabase_module(): creation of package %s for module " JAVA_BASE_NAME, - (pkg_list->at(x))->as_C_string()); + log_trace(module)("define_javabase_module(): creation of package %s for module " JAVA_BASE_NAME, + (pkg_list->at(x))->as_C_string()); } } @@ -438,23 +440,24 @@ throw_dup_pkg_exception(module_name, existing_pkg, CHECK); } - if (log_is_enabled(Debug, modules)) { - outputStream* logst = Log(modules)::debug_stream(); + log_info(module, load)("%s location: %s", module_name, + module_location != NULL ? module_location : "NULL"); + if (log_is_enabled(Debug, module)) { + outputStream* logst = Log(module)::debug_stream(); logst->print("define_module(): creation of module: %s, version: %s, location: %s, ", module_name, module_version != NULL ? module_version : "NULL", module_location != NULL ? module_location : "NULL"); loader_data->print_value_on(logst); logst->print_cr(", package #: %d", pkg_list->length()); for (int y = 0; y < pkg_list->length(); y++) { - log_trace(modules)("define_module(): creation of package %s for module %s", - (pkg_list->at(y))->as_C_string(), module_name); + log_trace(module)("define_module(): creation of package %s for module %s", + (pkg_list->at(y))->as_C_string(), module_name); } } // If the module is defined to the boot loader and an exploded build is being // used, prepend <java.home>/modules/modules_name, if it exists, to the system boot class path. if (loader == NULL && - !Universe::is_module_initialized() && !ClassLoader::has_jrt_entry()) { ClassLoader::add_to_exploded_build_list(module_symbol, CHECK); } @@ -487,7 +490,7 @@ } Handle h_loader = Handle(THREAD, loader); - log_debug(modules)("set_bootloader_unnamed_module(): recording unnamed module for boot loader"); + log_debug(module)("set_bootloader_unnamed_module(): recording unnamed module for boot loader"); // Ensure the boot loader's PackageEntryTable has been created ModuleEntryTable* module_table = get_module_entry_table(h_loader, CHECK); @@ -545,10 +548,10 @@ from_module_entry->name()->as_C_string())); } - log_debug(modules)("add_module_exports(): package %s in module %s is exported to module %s", - package_entry->name()->as_C_string(), - from_module_entry->name()->as_C_string(), - to_module_entry == NULL ? "NULL" : + log_debug(module)("add_module_exports(): package %s in module %s is exported to module %s", + package_entry->name()->as_C_string(), + from_module_entry->name()->as_C_string(), + to_module_entry == NULL ? "NULL" : to_module_entry->is_named() ? to_module_entry->name()->as_C_string() : UNNAMED_MODULE); @@ -592,12 +595,12 @@ } ResourceMark rm(THREAD); - log_debug(modules)("add_reads_module(): Adding read from module %s to module %s", - from_module_entry->is_named() ? - from_module_entry->name()->as_C_string() : UNNAMED_MODULE, - to_module_entry == NULL ? "all unnamed" : - (to_module_entry->is_named() ? - to_module_entry->name()->as_C_string() : UNNAMED_MODULE)); + log_debug(module)("add_reads_module(): Adding read from module %s to module %s", + from_module_entry->is_named() ? + from_module_entry->name()->as_C_string() : UNNAMED_MODULE, + to_module_entry == NULL ? "all unnamed" : + (to_module_entry->is_named() ? + to_module_entry->name()->as_C_string() : UNNAMED_MODULE)); // if modules are the same or if from_module is unnamed then no need to add the read. if (from_module_entry != to_module_entry && from_module_entry->is_named()) { @@ -616,7 +619,7 @@ } oop mirror = JNIHandles::resolve_non_null(clazz); if (mirror == NULL) { - log_debug(modules)("get_module(): no mirror, returning NULL"); + log_debug(module)("get_module(): no mirror, returning NULL"); return NULL; } if (!java_lang_Class::is_instance(mirror)) { @@ -629,9 +632,9 @@ assert(module != NULL, "java.lang.Class module field not set"); assert(java_lang_Module::is_instance(module), "module is not an instance of type java.lang.Module"); - if (log_is_enabled(Debug, modules)) { + if (log_is_enabled(Debug, module)) { ResourceMark rm(THREAD); - outputStream* logst = Log(modules)::debug_stream(); + outputStream* logst = Log(module)::debug_stream(); Klass* klass = java_lang_Class::as_Klass(mirror); oop module_name = java_lang_Module::name(module); if (module_name != NULL) { @@ -764,8 +767,8 @@ THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(), message); } - log_debug(modules)("add_module_package(): Adding package %s to module %s", - package_name, module_entry->name()->as_C_string()); + log_debug(module)("add_module_package(): Adding package %s to module %s", + package_name, module_entry->name()->as_C_string()); TempNewSymbol pkg_symbol = SymbolTable::new_symbol(package_name, CHECK); PackageEntryTable* package_table = loader_data->packages(); @@ -820,8 +823,8 @@ module_entry->name()->as_C_string())); } - log_debug(modules)("add_module_exports_to_all_unnamed(): package %s in module" - " %s is exported to all unnamed modules", + log_debug(module)("add_module_exports_to_all_unnamed(): package %s in module" + " %s is exported to all unnamed modules", package_entry->name()->as_C_string(), module_entry->name()->as_C_string());
--- a/hotspot/src/share/vm/classfile/packageEntry.cpp Fri May 12 15:14:16 2017 -0700 +++ b/hotspot/src/share/vm/classfile/packageEntry.cpp Wed Jul 05 23:26:38 2017 +0200 @@ -77,13 +77,13 @@ (this_pkg_mod == NULL || this_pkg_mod->loader_data() != m_loader_data) && !m_loader_data->is_builtin_class_loader_data()) { _must_walk_exports = true; - if (log_is_enabled(Trace, modules)) { + if (log_is_enabled(Trace, module)) { ResourceMark rm; assert(name() != NULL, "PackageEntry without a valid name"); - log_trace(modules)("PackageEntry::set_export_walk_required(): package %s defined in module %s, exports list must be walked", - name()->as_C_string(), - (this_pkg_mod == NULL || this_pkg_mod->name() == NULL) ? - UNNAMED_MODULE : this_pkg_mod->name()->as_C_string()); + log_trace(module)("PackageEntry::set_export_walk_required(): package %s defined in module %s, exports list must be walked", + name()->as_C_string(), + (this_pkg_mod == NULL || this_pkg_mod->name() == NULL) ? + UNNAMED_MODULE : this_pkg_mod->name()->as_C_string()); } } } @@ -132,13 +132,13 @@ // on the remaining live modules on the exports list. _must_walk_exports = false; - if (log_is_enabled(Trace, modules)) { + if (log_is_enabled(Trace, module)) { ResourceMark rm; assert(name() != NULL, "PackageEntry without a valid name"); ModuleEntry* pkg_mod = module(); - log_trace(modules)("PackageEntry::purge_qualified_exports(): package %s defined in module %s, exports list being walked", - name()->as_C_string(), - (pkg_mod == NULL || pkg_mod->name() == NULL) ? UNNAMED_MODULE : pkg_mod->name()->as_C_string()); + log_trace(module)("PackageEntry::purge_qualified_exports(): package %s defined in module %s, exports list being walked", + name()->as_C_string(), + (pkg_mod == NULL || pkg_mod->name() == NULL) ? UNNAMED_MODULE : pkg_mod->name()->as_C_string()); } // Go backwards because this removes entries that are dead.
--- a/hotspot/src/share/vm/classfile/vmSymbols.cpp Fri May 12 15:14:16 2017 -0700 +++ b/hotspot/src/share/vm/classfile/vmSymbols.cpp Wed Jul 05 23:26:38 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2015, 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 @@ -632,25 +632,28 @@ case vmIntrinsics::_loadFence: case vmIntrinsics::_storeFence: case vmIntrinsics::_fullFence: - case vmIntrinsics::_compareAndSwapLong: - case vmIntrinsics::_weakCompareAndSwapLong: - case vmIntrinsics::_weakCompareAndSwapLongAcquire: - case vmIntrinsics::_weakCompareAndSwapLongRelease: - case vmIntrinsics::_compareAndSwapInt: - case vmIntrinsics::_weakCompareAndSwapInt: - case vmIntrinsics::_weakCompareAndSwapIntAcquire: - case vmIntrinsics::_weakCompareAndSwapIntRelease: - case vmIntrinsics::_compareAndSwapObject: - case vmIntrinsics::_weakCompareAndSwapObject: - case vmIntrinsics::_weakCompareAndSwapObjectAcquire: - case vmIntrinsics::_weakCompareAndSwapObjectRelease: - case vmIntrinsics::_compareAndExchangeIntVolatile: + case vmIntrinsics::_compareAndSetLong: + case vmIntrinsics::_weakCompareAndSetLong: + case vmIntrinsics::_weakCompareAndSetLongPlain: + case vmIntrinsics::_weakCompareAndSetLongAcquire: + case vmIntrinsics::_weakCompareAndSetLongRelease: + case vmIntrinsics::_compareAndSetInt: + case vmIntrinsics::_weakCompareAndSetInt: + case vmIntrinsics::_weakCompareAndSetIntPlain: + case vmIntrinsics::_weakCompareAndSetIntAcquire: + case vmIntrinsics::_weakCompareAndSetIntRelease: + case vmIntrinsics::_compareAndSetObject: + case vmIntrinsics::_weakCompareAndSetObject: + case vmIntrinsics::_weakCompareAndSetObjectPlain: + case vmIntrinsics::_weakCompareAndSetObjectAcquire: + case vmIntrinsics::_weakCompareAndSetObjectRelease: + case vmIntrinsics::_compareAndExchangeInt: case vmIntrinsics::_compareAndExchangeIntAcquire: case vmIntrinsics::_compareAndExchangeIntRelease: - case vmIntrinsics::_compareAndExchangeLongVolatile: + case vmIntrinsics::_compareAndExchangeLong: case vmIntrinsics::_compareAndExchangeLongAcquire: case vmIntrinsics::_compareAndExchangeLongRelease: - case vmIntrinsics::_compareAndExchangeObjectVolatile: + case vmIntrinsics::_compareAndExchangeObject: case vmIntrinsics::_compareAndExchangeObjectAcquire: case vmIntrinsics::_compareAndExchangeObjectRelease: if (!InlineUnsafeOps) return true;
--- a/hotspot/src/share/vm/classfile/vmSymbols.hpp Fri May 12 15:14:16 2017 -0700 +++ b/hotspot/src/share/vm/classfile/vmSymbols.hpp Wed Jul 05 23:26:38 2017 +0200 @@ -650,6 +650,8 @@ template(addUses_signature, "(Ljava/lang/Module;Ljava/lang/Class;)V") \ template(addProvides_name, "addProvides") \ template(addProvides_signature, "(Ljava/lang/Module;Ljava/lang/Class;Ljava/lang/Class;)V") \ + template(loadModule_name, "loadModule") \ + template(loadModule_signature, "(Ljava/lang/String;)Ljava/lang/Module;") \ template(transformedByAgent_name, "transformedByAgent") \ template(transformedByAgent_signature, "(Ljava/lang/Module;)V") \ template(appendToClassPathForInstrumentation_name, "appendToClassPathForInstrumentation") \ @@ -1242,100 +1244,100 @@ do_intrinsic(_putIntUnaligned, jdk_internal_misc_Unsafe, putIntUnaligned_name, putInt_signature, F_R) \ do_intrinsic(_putLongUnaligned, jdk_internal_misc_Unsafe, putLongUnaligned_name, putLong_signature, F_R) \ \ - do_signature(compareAndSwapObject_signature, "(Ljava/lang/Object;JLjava/lang/Object;Ljava/lang/Object;)Z") \ + do_signature(compareAndSetObject_signature, "(Ljava/lang/Object;JLjava/lang/Object;Ljava/lang/Object;)Z") \ do_signature(compareAndExchangeObject_signature, "(Ljava/lang/Object;JLjava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;") \ - do_signature(compareAndSwapLong_signature, "(Ljava/lang/Object;JJJ)Z") \ + do_signature(compareAndSetLong_signature, "(Ljava/lang/Object;JJJ)Z") \ do_signature(compareAndExchangeLong_signature, "(Ljava/lang/Object;JJJ)J") \ - do_signature(compareAndSwapInt_signature, "(Ljava/lang/Object;JII)Z") \ + do_signature(compareAndSetInt_signature, "(Ljava/lang/Object;JII)Z") \ do_signature(compareAndExchangeInt_signature, "(Ljava/lang/Object;JII)I") \ - do_signature(compareAndSwapByte_signature, "(Ljava/lang/Object;JBB)Z") \ + do_signature(compareAndSetByte_signature, "(Ljava/lang/Object;JBB)Z") \ do_signature(compareAndExchangeByte_signature, "(Ljava/lang/Object;JBB)B") \ - do_signature(compareAndSwapShort_signature, "(Ljava/lang/Object;JSS)Z") \ + do_signature(compareAndSetShort_signature, "(Ljava/lang/Object;JSS)Z") \ do_signature(compareAndExchangeShort_signature, "(Ljava/lang/Object;JSS)S") \ \ - do_name(compareAndSwapObject_name, "compareAndSwapObject") \ - do_name(compareAndExchangeObjectVolatile_name, "compareAndExchangeObjectVolatile") \ + do_name(compareAndSetObject_name, "compareAndSetObject") \ + do_name(compareAndExchangeObject_name, "compareAndExchangeObject") \ do_name(compareAndExchangeObjectAcquire_name, "compareAndExchangeObjectAcquire") \ do_name(compareAndExchangeObjectRelease_name, "compareAndExchangeObjectRelease") \ - do_name(compareAndSwapLong_name, "compareAndSwapLong") \ - do_name(compareAndExchangeLongVolatile_name, "compareAndExchangeLongVolatile") \ + do_name(compareAndSetLong_name, "compareAndSetLong") \ + do_name(compareAndExchangeLong_name, "compareAndExchangeLong") \ do_name(compareAndExchangeLongAcquire_name, "compareAndExchangeLongAcquire") \ do_name(compareAndExchangeLongRelease_name, "compareAndExchangeLongRelease") \ - do_name(compareAndSwapInt_name, "compareAndSwapInt") \ - do_name(compareAndExchangeIntVolatile_name, "compareAndExchangeIntVolatile") \ + do_name(compareAndSetInt_name, "compareAndSetInt") \ + do_name(compareAndExchangeInt_name, "compareAndExchangeInt") \ do_name(compareAndExchangeIntAcquire_name, "compareAndExchangeIntAcquire") \ do_name(compareAndExchangeIntRelease_name, "compareAndExchangeIntRelease") \ - do_name(compareAndSwapByte_name, "compareAndSwapByte") \ - do_name(compareAndExchangeByteVolatile_name, "compareAndExchangeByteVolatile") \ + do_name(compareAndSetByte_name, "compareAndSetByte") \ + do_name(compareAndExchangeByte_name, "compareAndExchangeByte") \ do_name(compareAndExchangeByteAcquire_name, "compareAndExchangeByteAcquire") \ do_name(compareAndExchangeByteRelease_name, "compareAndExchangeByteRelease") \ - do_name(compareAndSwapShort_name, "compareAndSwapShort") \ - do_name(compareAndExchangeShortVolatile_name, "compareAndExchangeShortVolatile") \ + do_name(compareAndSetShort_name, "compareAndSetShort") \ + do_name(compareAndExchangeShort_name, "compareAndExchangeShort") \ do_name(compareAndExchangeShortAcquire_name, "compareAndExchangeShortAcquire") \ do_name(compareAndExchangeShortRelease_name, "compareAndExchangeShortRelease") \ \ - do_name(weakCompareAndSwapObject_name, "weakCompareAndSwapObject") \ - do_name(weakCompareAndSwapObjectAcquire_name, "weakCompareAndSwapObjectAcquire") \ - do_name(weakCompareAndSwapObjectRelease_name, "weakCompareAndSwapObjectRelease") \ - do_name(weakCompareAndSwapObjectVolatile_name, "weakCompareAndSwapObjectVolatile") \ - do_name(weakCompareAndSwapLong_name, "weakCompareAndSwapLong") \ - do_name(weakCompareAndSwapLongAcquire_name, "weakCompareAndSwapLongAcquire") \ - do_name(weakCompareAndSwapLongRelease_name, "weakCompareAndSwapLongRelease") \ - do_name(weakCompareAndSwapLongVolatile_name, "weakCompareAndSwapLongVolatile") \ - do_name(weakCompareAndSwapInt_name, "weakCompareAndSwapInt") \ - do_name(weakCompareAndSwapIntAcquire_name, "weakCompareAndSwapIntAcquire") \ - do_name(weakCompareAndSwapIntRelease_name, "weakCompareAndSwapIntRelease") \ - do_name(weakCompareAndSwapIntVolatile_name, "weakCompareAndSwapIntVolatile") \ - do_name(weakCompareAndSwapByte_name, "weakCompareAndSwapByte") \ - do_name(weakCompareAndSwapByteAcquire_name, "weakCompareAndSwapByteAcquire") \ - do_name(weakCompareAndSwapByteRelease_name, "weakCompareAndSwapByteRelease") \ - do_name(weakCompareAndSwapByteVolatile_name, "weakCompareAndSwapByteVolatile") \ - do_name(weakCompareAndSwapShort_name, "weakCompareAndSwapShort") \ - do_name(weakCompareAndSwapShortAcquire_name, "weakCompareAndSwapShortAcquire") \ - do_name(weakCompareAndSwapShortRelease_name, "weakCompareAndSwapShortRelease") \ - do_name(weakCompareAndSwapShortVolatile_name, "weakCompareAndSwapShortVolatile") \ + do_name(weakCompareAndSetObjectPlain_name, "weakCompareAndSetObjectPlain") \ + do_name(weakCompareAndSetObjectAcquire_name, "weakCompareAndSetObjectAcquire") \ + do_name(weakCompareAndSetObjectRelease_name, "weakCompareAndSetObjectRelease") \ + do_name(weakCompareAndSetObject_name, "weakCompareAndSetObject") \ + do_name(weakCompareAndSetLongPlain_name, "weakCompareAndSetLongPlain") \ + do_name(weakCompareAndSetLongAcquire_name, "weakCompareAndSetLongAcquire") \ + do_name(weakCompareAndSetLongRelease_name, "weakCompareAndSetLongRelease") \ + do_name(weakCompareAndSetLong_name, "weakCompareAndSetLong") \ + do_name(weakCompareAndSetIntPlain_name, "weakCompareAndSetIntPlain") \ + do_name(weakCompareAndSetIntAcquire_name, "weakCompareAndSetIntAcquire") \ + do_name(weakCompareAndSetIntRelease_name, "weakCompareAndSetIntRelease") \ + do_name(weakCompareAndSetInt_name, "weakCompareAndSetInt") \ + do_name(weakCompareAndSetBytePlain_name, "weakCompareAndSetBytePlain") \ + do_name(weakCompareAndSetByteAcquire_name, "weakCompareAndSetByteAcquire") \ + do_name(weakCompareAndSetByteRelease_name, "weakCompareAndSetByteRelease") \ + do_name(weakCompareAndSetByte_name, "weakCompareAndSetByte") \ + do_name(weakCompareAndSetShortPlain_name, "weakCompareAndSetShortPlain") \ + do_name(weakCompareAndSetShortAcquire_name, "weakCompareAndSetShortAcquire") \ + do_name(weakCompareAndSetShortRelease_name, "weakCompareAndSetShortRelease") \ + do_name(weakCompareAndSetShort_name, "weakCompareAndSetShort") \ \ - do_intrinsic(_compareAndSwapObject, jdk_internal_misc_Unsafe, compareAndSwapObject_name, compareAndSwapObject_signature, F_RN) \ - do_intrinsic(_compareAndExchangeObjectVolatile, jdk_internal_misc_Unsafe, compareAndExchangeObjectVolatile_name, compareAndExchangeObject_signature, F_RN) \ + do_intrinsic(_compareAndSetObject, jdk_internal_misc_Unsafe, compareAndSetObject_name, compareAndSetObject_signature, F_RN) \ + do_intrinsic(_compareAndExchangeObject, jdk_internal_misc_Unsafe, compareAndExchangeObject_name, compareAndExchangeObject_signature, F_RN) \ do_intrinsic(_compareAndExchangeObjectAcquire, jdk_internal_misc_Unsafe, compareAndExchangeObjectAcquire_name, compareAndExchangeObject_signature, F_R) \ do_intrinsic(_compareAndExchangeObjectRelease, jdk_internal_misc_Unsafe, compareAndExchangeObjectRelease_name, compareAndExchangeObject_signature, F_R) \ - do_intrinsic(_compareAndSwapLong, jdk_internal_misc_Unsafe, compareAndSwapLong_name, compareAndSwapLong_signature, F_RN) \ - do_intrinsic(_compareAndExchangeLongVolatile, jdk_internal_misc_Unsafe, compareAndExchangeLongVolatile_name, compareAndExchangeLong_signature, F_RN) \ + do_intrinsic(_compareAndSetLong, jdk_internal_misc_Unsafe, compareAndSetLong_name, compareAndSetLong_signature, F_RN) \ + do_intrinsic(_compareAndExchangeLong, jdk_internal_misc_Unsafe, compareAndExchangeLong_name, compareAndExchangeLong_signature, F_RN) \ do_intrinsic(_compareAndExchangeLongAcquire, jdk_internal_misc_Unsafe, compareAndExchangeLongAcquire_name, compareAndExchangeLong_signature, F_R) \ do_intrinsic(_compareAndExchangeLongRelease, jdk_internal_misc_Unsafe, compareAndExchangeLongRelease_name, compareAndExchangeLong_signature, F_R) \ - do_intrinsic(_compareAndSwapInt, jdk_internal_misc_Unsafe, compareAndSwapInt_name, compareAndSwapInt_signature, F_RN) \ - do_intrinsic(_compareAndExchangeIntVolatile, jdk_internal_misc_Unsafe, compareAndExchangeIntVolatile_name, compareAndExchangeInt_signature, F_RN) \ + do_intrinsic(_compareAndSetInt, jdk_internal_misc_Unsafe, compareAndSetInt_name, compareAndSetInt_signature, F_RN) \ + do_intrinsic(_compareAndExchangeInt, jdk_internal_misc_Unsafe, compareAndExchangeInt_name, compareAndExchangeInt_signature, F_RN) \ do_intrinsic(_compareAndExchangeIntAcquire, jdk_internal_misc_Unsafe, compareAndExchangeIntAcquire_name, compareAndExchangeInt_signature, F_R) \ do_intrinsic(_compareAndExchangeIntRelease, jdk_internal_misc_Unsafe, compareAndExchangeIntRelease_name, compareAndExchangeInt_signature, F_R) \ - do_intrinsic(_compareAndSwapByte, jdk_internal_misc_Unsafe, compareAndSwapByte_name, compareAndSwapByte_signature, F_R) \ - do_intrinsic(_compareAndExchangeByteVolatile, jdk_internal_misc_Unsafe, compareAndExchangeByteVolatile_name, compareAndExchangeByte_signature, F_R) \ + do_intrinsic(_compareAndSetByte, jdk_internal_misc_Unsafe, compareAndSetByte_name, compareAndSetByte_signature, F_R) \ + do_intrinsic(_compareAndExchangeByte, jdk_internal_misc_Unsafe, compareAndExchangeByte_name, compareAndExchangeByte_signature, F_R) \ do_intrinsic(_compareAndExchangeByteAcquire, jdk_internal_misc_Unsafe, compareAndExchangeByteAcquire_name, compareAndExchangeByte_signature, F_R) \ do_intrinsic(_compareAndExchangeByteRelease, jdk_internal_misc_Unsafe, compareAndExchangeByteRelease_name, compareAndExchangeByte_signature, F_R) \ - do_intrinsic(_compareAndSwapShort, jdk_internal_misc_Unsafe, compareAndSwapShort_name, compareAndSwapShort_signature, F_R) \ - do_intrinsic(_compareAndExchangeShortVolatile, jdk_internal_misc_Unsafe, compareAndExchangeShortVolatile_name, compareAndExchangeShort_signature, F_R) \ + do_intrinsic(_compareAndSetShort, jdk_internal_misc_Unsafe, compareAndSetShort_name, compareAndSetShort_signature, F_R) \ + do_intrinsic(_compareAndExchangeShort, jdk_internal_misc_Unsafe, compareAndExchangeShort_name, compareAndExchangeShort_signature, F_R) \ do_intrinsic(_compareAndExchangeShortAcquire, jdk_internal_misc_Unsafe, compareAndExchangeShortAcquire_name, compareAndExchangeShort_signature, F_R) \ do_intrinsic(_compareAndExchangeShortRelease, jdk_internal_misc_Unsafe, compareAndExchangeShortRelease_name, compareAndExchangeShort_signature, F_R) \ \ - do_intrinsic(_weakCompareAndSwapObject, jdk_internal_misc_Unsafe, weakCompareAndSwapObject_name, compareAndSwapObject_signature, F_R) \ - do_intrinsic(_weakCompareAndSwapObjectAcquire, jdk_internal_misc_Unsafe, weakCompareAndSwapObjectAcquire_name, compareAndSwapObject_signature, F_R) \ - do_intrinsic(_weakCompareAndSwapObjectRelease, jdk_internal_misc_Unsafe, weakCompareAndSwapObjectRelease_name, compareAndSwapObject_signature, F_R) \ - do_intrinsic(_weakCompareAndSwapObjectVolatile, jdk_internal_misc_Unsafe, weakCompareAndSwapObjectVolatile_name, compareAndSwapObject_signature, F_R) \ - do_intrinsic(_weakCompareAndSwapLong, jdk_internal_misc_Unsafe, weakCompareAndSwapLong_name, compareAndSwapLong_signature, F_R) \ - do_intrinsic(_weakCompareAndSwapLongAcquire, jdk_internal_misc_Unsafe, weakCompareAndSwapLongAcquire_name, compareAndSwapLong_signature, F_R) \ - do_intrinsic(_weakCompareAndSwapLongRelease, jdk_internal_misc_Unsafe, weakCompareAndSwapLongRelease_name, compareAndSwapLong_signature, F_R) \ - do_intrinsic(_weakCompareAndSwapLongVolatile, jdk_internal_misc_Unsafe, weakCompareAndSwapLongVolatile_name, compareAndSwapLong_signature, F_R) \ - do_intrinsic(_weakCompareAndSwapInt, jdk_internal_misc_Unsafe, weakCompareAndSwapInt_name, compareAndSwapInt_signature, F_R) \ - do_intrinsic(_weakCompareAndSwapIntAcquire, jdk_internal_misc_Unsafe, weakCompareAndSwapIntAcquire_name, compareAndSwapInt_signature, F_R) \ - do_intrinsic(_weakCompareAndSwapIntRelease, jdk_internal_misc_Unsafe, weakCompareAndSwapIntRelease_name, compareAndSwapInt_signature, F_R) \ - do_intrinsic(_weakCompareAndSwapIntVolatile, jdk_internal_misc_Unsafe, weakCompareAndSwapIntVolatile_name, compareAndSwapInt_signature, F_R) \ - do_intrinsic(_weakCompareAndSwapByte, jdk_internal_misc_Unsafe, weakCompareAndSwapByte_name, compareAndSwapByte_signature, F_R) \ - do_intrinsic(_weakCompareAndSwapByteAcquire, jdk_internal_misc_Unsafe, weakCompareAndSwapByteAcquire_name, compareAndSwapByte_signature, F_R) \ - do_intrinsic(_weakCompareAndSwapByteRelease, jdk_internal_misc_Unsafe, weakCompareAndSwapByteRelease_name, compareAndSwapByte_signature, F_R) \ - do_intrinsic(_weakCompareAndSwapByteVolatile, jdk_internal_misc_Unsafe, weakCompareAndSwapByteVolatile_name, compareAndSwapByte_signature, F_R) \ - do_intrinsic(_weakCompareAndSwapShort, jdk_internal_misc_Unsafe, weakCompareAndSwapShort_name, compareAndSwapShort_signature, F_R) \ - do_intrinsic(_weakCompareAndSwapShortAcquire, jdk_internal_misc_Unsafe, weakCompareAndSwapShortAcquire_name, compareAndSwapShort_signature, F_R) \ - do_intrinsic(_weakCompareAndSwapShortRelease, jdk_internal_misc_Unsafe, weakCompareAndSwapShortRelease_name, compareAndSwapShort_signature, F_R) \ - do_intrinsic(_weakCompareAndSwapShortVolatile, jdk_internal_misc_Unsafe, weakCompareAndSwapShortVolatile_name, compareAndSwapShort_signature, F_R) \ + do_intrinsic(_weakCompareAndSetObjectPlain, jdk_internal_misc_Unsafe, weakCompareAndSetObjectPlain_name, compareAndSetObject_signature, F_R) \ + do_intrinsic(_weakCompareAndSetObjectAcquire, jdk_internal_misc_Unsafe, weakCompareAndSetObjectAcquire_name, compareAndSetObject_signature, F_R) \ + do_intrinsic(_weakCompareAndSetObjectRelease, jdk_internal_misc_Unsafe, weakCompareAndSetObjectRelease_name, compareAndSetObject_signature, F_R) \ + do_intrinsic(_weakCompareAndSetObject, jdk_internal_misc_Unsafe, weakCompareAndSetObject_name, compareAndSetObject_signature, F_R) \ + do_intrinsic(_weakCompareAndSetLongPlain, jdk_internal_misc_Unsafe, weakCompareAndSetLongPlain_name, compareAndSetLong_signature, F_R) \ + do_intrinsic(_weakCompareAndSetLongAcquire, jdk_internal_misc_Unsafe, weakCompareAndSetLongAcquire_name, compareAndSetLong_signature, F_R) \ + do_intrinsic(_weakCompareAndSetLongRelease, jdk_internal_misc_Unsafe, weakCompareAndSetLongRelease_name, compareAndSetLong_signature, F_R) \ + do_intrinsic(_weakCompareAndSetLong, jdk_internal_misc_Unsafe, weakCompareAndSetLong_name, compareAndSetLong_signature, F_R) \ + do_intrinsic(_weakCompareAndSetIntPlain, jdk_internal_misc_Unsafe, weakCompareAndSetIntPlain_name, compareAndSetInt_signature, F_R) \ + do_intrinsic(_weakCompareAndSetIntAcquire, jdk_internal_misc_Unsafe, weakCompareAndSetIntAcquire_name, compareAndSetInt_signature, F_R) \ + do_intrinsic(_weakCompareAndSetIntRelease, jdk_internal_misc_Unsafe, weakCompareAndSetIntRelease_name, compareAndSetInt_signature, F_R) \ + do_intrinsic(_weakCompareAndSetInt, jdk_internal_misc_Unsafe, weakCompareAndSetInt_name, compareAndSetInt_signature, F_R) \ + do_intrinsic(_weakCompareAndSetBytePlain, jdk_internal_misc_Unsafe, weakCompareAndSetBytePlain_name, compareAndSetByte_signature, F_R) \ + do_intrinsic(_weakCompareAndSetByteAcquire, jdk_internal_misc_Unsafe, weakCompareAndSetByteAcquire_name, compareAndSetByte_signature, F_R) \ + do_intrinsic(_weakCompareAndSetByteRelease, jdk_internal_misc_Unsafe, weakCompareAndSetByteRelease_name, compareAndSetByte_signature, F_R) \ + do_intrinsic(_weakCompareAndSetByte, jdk_internal_misc_Unsafe, weakCompareAndSetByte_name, compareAndSetByte_signature, F_R) \ + do_intrinsic(_weakCompareAndSetShortPlain, jdk_internal_misc_Unsafe, weakCompareAndSetShortPlain_name, compareAndSetShort_signature, F_R) \ + do_intrinsic(_weakCompareAndSetShortAcquire, jdk_internal_misc_Unsafe, weakCompareAndSetShortAcquire_name, compareAndSetShort_signature, F_R) \ + do_intrinsic(_weakCompareAndSetShortRelease, jdk_internal_misc_Unsafe, weakCompareAndSetShortRelease_name, compareAndSetShort_signature, F_R) \ + do_intrinsic(_weakCompareAndSetShort, jdk_internal_misc_Unsafe, weakCompareAndSetShort_name, compareAndSetShort_signature, F_R) \ \ do_intrinsic(_getAndAddInt, jdk_internal_misc_Unsafe, getAndAddInt_name, getAndAddInt_signature, F_R) \ do_name( getAndAddInt_name, "getAndAddInt") \
--- a/hotspot/src/share/vm/logging/logTag.hpp Fri May 12 15:14:16 2017 -0700 +++ b/hotspot/src/share/vm/logging/logTag.hpp Wed Jul 05 23:26:38 2017 +0200 @@ -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 @@ -82,7 +82,7 @@ LOG_TAG(metadata) \ LOG_TAG(metaspace) \ LOG_TAG(mmu) \ - LOG_TAG(modules) \ + LOG_TAG(module) \ LOG_TAG(monitorinflation) \ LOG_TAG(monitormismatch) \ LOG_TAG(nmethod) \
--- a/hotspot/src/share/vm/oops/instanceKlass.cpp Fri May 12 15:14:16 2017 -0700 +++ b/hotspot/src/share/vm/oops/instanceKlass.cpp Wed Jul 05 23:26:38 2017 +0200 @@ -2331,21 +2331,21 @@ name()->as_C_string(), loader_data->loader_name()); } - if (log_is_enabled(Debug, modules)) { + if (log_is_enabled(Debug, module)) { ResourceMark rm; ModuleEntry* m = _package_entry->module(); - log_trace(modules)("Setting package: class: %s, package: %s, loader: %s, module: %s", - external_name(), - pkg_name->as_C_string(), - loader_data->loader_name(), - (m->is_named() ? m->name()->as_C_string() : UNNAMED_MODULE)); + log_trace(module)("Setting package: class: %s, package: %s, loader: %s, module: %s", + external_name(), + pkg_name->as_C_string(), + loader_data->loader_name(), + (m->is_named() ? m->name()->as_C_string() : UNNAMED_MODULE)); } } else { ResourceMark rm; - log_trace(modules)("Setting package: class: %s, package: unnamed, loader: %s, module: %s", - external_name(), - (loader_data != NULL) ? loader_data->loader_name() : "NULL", - UNNAMED_MODULE); + log_trace(module)("Setting package: class: %s, package: unnamed, loader: %s, module: %s", + external_name(), + (loader_data != NULL) ? loader_data->loader_name() : "NULL", + UNNAMED_MODULE); } }
--- a/hotspot/src/share/vm/opto/c2compiler.cpp Fri May 12 15:14:16 2017 -0700 +++ b/hotspot/src/share/vm/opto/c2compiler.cpp Wed Jul 05 23:26:38 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 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 @@ -244,8 +244,8 @@ if (!Matcher::match_rule_supported(Op_ReverseBytesL)) return false; break; - /* CompareAndSwap, Object: */ - case vmIntrinsics::_compareAndSwapObject: + /* CompareAndSet, Object: */ + case vmIntrinsics::_compareAndSetObject: #ifdef _LP64 if ( UseCompressedOops && !Matcher::match_rule_supported(Op_CompareAndSwapN)) return false; if (!UseCompressedOops && !Matcher::match_rule_supported(Op_CompareAndSwapP)) return false; @@ -253,10 +253,10 @@ if (!Matcher::match_rule_supported(Op_CompareAndSwapP)) return false; #endif break; - case vmIntrinsics::_weakCompareAndSwapObject: - case vmIntrinsics::_weakCompareAndSwapObjectAcquire: - case vmIntrinsics::_weakCompareAndSwapObjectRelease: - case vmIntrinsics::_weakCompareAndSwapObjectVolatile: + case vmIntrinsics::_weakCompareAndSetObjectPlain: + case vmIntrinsics::_weakCompareAndSetObjectAcquire: + case vmIntrinsics::_weakCompareAndSetObjectRelease: + case vmIntrinsics::_weakCompareAndSetObject: #ifdef _LP64 if ( UseCompressedOops && !Matcher::match_rule_supported(Op_WeakCompareAndSwapN)) return false; if (!UseCompressedOops && !Matcher::match_rule_supported(Op_WeakCompareAndSwapP)) return false; @@ -264,52 +264,52 @@ if (!Matcher::match_rule_supported(Op_WeakCompareAndSwapP)) return false; #endif break; - /* CompareAndSwap, Long: */ - case vmIntrinsics::_compareAndSwapLong: + /* CompareAndSet, Long: */ + case vmIntrinsics::_compareAndSetLong: if (!Matcher::match_rule_supported(Op_CompareAndSwapL)) return false; break; - case vmIntrinsics::_weakCompareAndSwapLong: - case vmIntrinsics::_weakCompareAndSwapLongAcquire: - case vmIntrinsics::_weakCompareAndSwapLongRelease: - case vmIntrinsics::_weakCompareAndSwapLongVolatile: + case vmIntrinsics::_weakCompareAndSetLongPlain: + case vmIntrinsics::_weakCompareAndSetLongAcquire: + case vmIntrinsics::_weakCompareAndSetLongRelease: + case vmIntrinsics::_weakCompareAndSetLong: if (!Matcher::match_rule_supported(Op_WeakCompareAndSwapL)) return false; break; - /* CompareAndSwap, Int: */ - case vmIntrinsics::_compareAndSwapInt: + /* CompareAndSet, Int: */ + case vmIntrinsics::_compareAndSetInt: if (!Matcher::match_rule_supported(Op_CompareAndSwapI)) return false; break; - case vmIntrinsics::_weakCompareAndSwapInt: - case vmIntrinsics::_weakCompareAndSwapIntAcquire: - case vmIntrinsics::_weakCompareAndSwapIntRelease: - case vmIntrinsics::_weakCompareAndSwapIntVolatile: + case vmIntrinsics::_weakCompareAndSetIntPlain: + case vmIntrinsics::_weakCompareAndSetIntAcquire: + case vmIntrinsics::_weakCompareAndSetIntRelease: + case vmIntrinsics::_weakCompareAndSetInt: if (!Matcher::match_rule_supported(Op_WeakCompareAndSwapL)) return false; break; - /* CompareAndSwap, Byte: */ - case vmIntrinsics::_compareAndSwapByte: + /* CompareAndSet, Byte: */ + case vmIntrinsics::_compareAndSetByte: if (!Matcher::match_rule_supported(Op_CompareAndSwapB)) return false; break; - case vmIntrinsics::_weakCompareAndSwapByte: - case vmIntrinsics::_weakCompareAndSwapByteAcquire: - case vmIntrinsics::_weakCompareAndSwapByteRelease: - case vmIntrinsics::_weakCompareAndSwapByteVolatile: + case vmIntrinsics::_weakCompareAndSetBytePlain: + case vmIntrinsics::_weakCompareAndSetByteAcquire: + case vmIntrinsics::_weakCompareAndSetByteRelease: + case vmIntrinsics::_weakCompareAndSetByte: if (!Matcher::match_rule_supported(Op_WeakCompareAndSwapB)) return false; break; - /* CompareAndSwap, Short: */ - case vmIntrinsics::_compareAndSwapShort: + /* CompareAndSet, Short: */ + case vmIntrinsics::_compareAndSetShort: if (!Matcher::match_rule_supported(Op_CompareAndSwapS)) return false; break; - case vmIntrinsics::_weakCompareAndSwapShort: - case vmIntrinsics::_weakCompareAndSwapShortAcquire: - case vmIntrinsics::_weakCompareAndSwapShortRelease: - case vmIntrinsics::_weakCompareAndSwapShortVolatile: + case vmIntrinsics::_weakCompareAndSetShortPlain: + case vmIntrinsics::_weakCompareAndSetShortAcquire: + case vmIntrinsics::_weakCompareAndSetShortRelease: + case vmIntrinsics::_weakCompareAndSetShort: if (!Matcher::match_rule_supported(Op_WeakCompareAndSwapS)) return false; break; /* CompareAndExchange, Object: */ - case vmIntrinsics::_compareAndExchangeObjectVolatile: + case vmIntrinsics::_compareAndExchangeObject: case vmIntrinsics::_compareAndExchangeObjectAcquire: case vmIntrinsics::_compareAndExchangeObjectRelease: #ifdef _LP64 @@ -321,28 +321,28 @@ break; /* CompareAndExchange, Long: */ - case vmIntrinsics::_compareAndExchangeLongVolatile: + case vmIntrinsics::_compareAndExchangeLong: case vmIntrinsics::_compareAndExchangeLongAcquire: case vmIntrinsics::_compareAndExchangeLongRelease: if (!Matcher::match_rule_supported(Op_CompareAndExchangeL)) return false; break; /* CompareAndExchange, Int: */ - case vmIntrinsics::_compareAndExchangeIntVolatile: + case vmIntrinsics::_compareAndExchangeInt: case vmIntrinsics::_compareAndExchangeIntAcquire: case vmIntrinsics::_compareAndExchangeIntRelease: if (!Matcher::match_rule_supported(Op_CompareAndExchangeI)) return false; break; /* CompareAndExchange, Byte: */ - case vmIntrinsics::_compareAndExchangeByteVolatile: + case vmIntrinsics::_compareAndExchangeByte: case vmIntrinsics::_compareAndExchangeByteAcquire: case vmIntrinsics::_compareAndExchangeByteRelease: if (!Matcher::match_rule_supported(Op_CompareAndExchangeB)) return false; break; /* CompareAndExchange, Short: */ - case vmIntrinsics::_compareAndExchangeShortVolatile: + case vmIntrinsics::_compareAndExchangeShort: case vmIntrinsics::_compareAndExchangeShortAcquire: case vmIntrinsics::_compareAndExchangeShortRelease: if (!Matcher::match_rule_supported(Op_CompareAndExchangeS)) return false;
--- a/hotspot/src/share/vm/opto/library_call.cpp Fri May 12 15:14:16 2017 -0700 +++ b/hotspot/src/share/vm/opto/library_call.cpp Wed Jul 05 23:26:38 2017 +0200 @@ -649,46 +649,46 @@ case vmIntrinsics::_putFloatOpaque: return inline_unsafe_access( is_store, T_FLOAT, Opaque, false); case vmIntrinsics::_putDoubleOpaque: return inline_unsafe_access( is_store, T_DOUBLE, Opaque, false); - case vmIntrinsics::_compareAndSwapObject: return inline_unsafe_load_store(T_OBJECT, LS_cmp_swap, Volatile); - case vmIntrinsics::_compareAndSwapByte: return inline_unsafe_load_store(T_BYTE, LS_cmp_swap, Volatile); - case vmIntrinsics::_compareAndSwapShort: return inline_unsafe_load_store(T_SHORT, LS_cmp_swap, Volatile); - case vmIntrinsics::_compareAndSwapInt: return inline_unsafe_load_store(T_INT, LS_cmp_swap, Volatile); - case vmIntrinsics::_compareAndSwapLong: return inline_unsafe_load_store(T_LONG, LS_cmp_swap, Volatile); - - case vmIntrinsics::_weakCompareAndSwapObject: return inline_unsafe_load_store(T_OBJECT, LS_cmp_swap_weak, Relaxed); - case vmIntrinsics::_weakCompareAndSwapObjectAcquire: return inline_unsafe_load_store(T_OBJECT, LS_cmp_swap_weak, Acquire); - case vmIntrinsics::_weakCompareAndSwapObjectRelease: return inline_unsafe_load_store(T_OBJECT, LS_cmp_swap_weak, Release); - case vmIntrinsics::_weakCompareAndSwapObjectVolatile: return inline_unsafe_load_store(T_OBJECT, LS_cmp_swap_weak, Volatile); - case vmIntrinsics::_weakCompareAndSwapByte: return inline_unsafe_load_store(T_BYTE, LS_cmp_swap_weak, Relaxed); - case vmIntrinsics::_weakCompareAndSwapByteAcquire: return inline_unsafe_load_store(T_BYTE, LS_cmp_swap_weak, Acquire); - case vmIntrinsics::_weakCompareAndSwapByteRelease: return inline_unsafe_load_store(T_BYTE, LS_cmp_swap_weak, Release); - case vmIntrinsics::_weakCompareAndSwapByteVolatile: return inline_unsafe_load_store(T_BYTE, LS_cmp_swap_weak, Volatile); - case vmIntrinsics::_weakCompareAndSwapShort: return inline_unsafe_load_store(T_SHORT, LS_cmp_swap_weak, Relaxed); - case vmIntrinsics::_weakCompareAndSwapShortAcquire: return inline_unsafe_load_store(T_SHORT, LS_cmp_swap_weak, Acquire); - case vmIntrinsics::_weakCompareAndSwapShortRelease: return inline_unsafe_load_store(T_SHORT, LS_cmp_swap_weak, Release); - case vmIntrinsics::_weakCompareAndSwapShortVolatile: return inline_unsafe_load_store(T_SHORT, LS_cmp_swap_weak, Volatile); - case vmIntrinsics::_weakCompareAndSwapInt: return inline_unsafe_load_store(T_INT, LS_cmp_swap_weak, Relaxed); - case vmIntrinsics::_weakCompareAndSwapIntAcquire: return inline_unsafe_load_store(T_INT, LS_cmp_swap_weak, Acquire); - case vmIntrinsics::_weakCompareAndSwapIntRelease: return inline_unsafe_load_store(T_INT, LS_cmp_swap_weak, Release); - case vmIntrinsics::_weakCompareAndSwapIntVolatile: return inline_unsafe_load_store(T_INT, LS_cmp_swap_weak, Volatile); - case vmIntrinsics::_weakCompareAndSwapLong: return inline_unsafe_load_store(T_LONG, LS_cmp_swap_weak, Relaxed); - case vmIntrinsics::_weakCompareAndSwapLongAcquire: return inline_unsafe_load_store(T_LONG, LS_cmp_swap_weak, Acquire); - case vmIntrinsics::_weakCompareAndSwapLongRelease: return inline_unsafe_load_store(T_LONG, LS_cmp_swap_weak, Release); - case vmIntrinsics::_weakCompareAndSwapLongVolatile: return inline_unsafe_load_store(T_LONG, LS_cmp_swap_weak, Volatile); - - case vmIntrinsics::_compareAndExchangeObjectVolatile: return inline_unsafe_load_store(T_OBJECT, LS_cmp_exchange, Volatile); + case vmIntrinsics::_compareAndSetObject: return inline_unsafe_load_store(T_OBJECT, LS_cmp_swap, Volatile); + case vmIntrinsics::_compareAndSetByte: return inline_unsafe_load_store(T_BYTE, LS_cmp_swap, Volatile); + case vmIntrinsics::_compareAndSetShort: return inline_unsafe_load_store(T_SHORT, LS_cmp_swap, Volatile); + case vmIntrinsics::_compareAndSetInt: return inline_unsafe_load_store(T_INT, LS_cmp_swap, Volatile); + case vmIntrinsics::_compareAndSetLong: return inline_unsafe_load_store(T_LONG, LS_cmp_swap, Volatile); + + case vmIntrinsics::_weakCompareAndSetObjectPlain: return inline_unsafe_load_store(T_OBJECT, LS_cmp_swap_weak, Relaxed); + case vmIntrinsics::_weakCompareAndSetObjectAcquire: return inline_unsafe_load_store(T_OBJECT, LS_cmp_swap_weak, Acquire); + case vmIntrinsics::_weakCompareAndSetObjectRelease: return inline_unsafe_load_store(T_OBJECT, LS_cmp_swap_weak, Release); + case vmIntrinsics::_weakCompareAndSetObject: return inline_unsafe_load_store(T_OBJECT, LS_cmp_swap_weak, Volatile); + case vmIntrinsics::_weakCompareAndSetBytePlain: return inline_unsafe_load_store(T_BYTE, LS_cmp_swap_weak, Relaxed); + case vmIntrinsics::_weakCompareAndSetByteAcquire: return inline_unsafe_load_store(T_BYTE, LS_cmp_swap_weak, Acquire); + case vmIntrinsics::_weakCompareAndSetByteRelease: return inline_unsafe_load_store(T_BYTE, LS_cmp_swap_weak, Release); + case vmIntrinsics::_weakCompareAndSetByte: return inline_unsafe_load_store(T_BYTE, LS_cmp_swap_weak, Volatile); + case vmIntrinsics::_weakCompareAndSetShortPlain: return inline_unsafe_load_store(T_SHORT, LS_cmp_swap_weak, Relaxed); + case vmIntrinsics::_weakCompareAndSetShortAcquire: return inline_unsafe_load_store(T_SHORT, LS_cmp_swap_weak, Acquire); + case vmIntrinsics::_weakCompareAndSetShortRelease: return inline_unsafe_load_store(T_SHORT, LS_cmp_swap_weak, Release); + case vmIntrinsics::_weakCompareAndSetShort: return inline_unsafe_load_store(T_SHORT, LS_cmp_swap_weak, Volatile); + case vmIntrinsics::_weakCompareAndSetIntPlain: return inline_unsafe_load_store(T_INT, LS_cmp_swap_weak, Relaxed); + case vmIntrinsics::_weakCompareAndSetIntAcquire: return inline_unsafe_load_store(T_INT, LS_cmp_swap_weak, Acquire); + case vmIntrinsics::_weakCompareAndSetIntRelease: return inline_unsafe_load_store(T_INT, LS_cmp_swap_weak, Release); + case vmIntrinsics::_weakCompareAndSetInt: return inline_unsafe_load_store(T_INT, LS_cmp_swap_weak, Volatile); + case vmIntrinsics::_weakCompareAndSetLongPlain: return inline_unsafe_load_store(T_LONG, LS_cmp_swap_weak, Relaxed); + case vmIntrinsics::_weakCompareAndSetLongAcquire: return inline_unsafe_load_store(T_LONG, LS_cmp_swap_weak, Acquire); + case vmIntrinsics::_weakCompareAndSetLongRelease: return inline_unsafe_load_store(T_LONG, LS_cmp_swap_weak, Release); + case vmIntrinsics::_weakCompareAndSetLong: return inline_unsafe_load_store(T_LONG, LS_cmp_swap_weak, Volatile); + + case vmIntrinsics::_compareAndExchangeObject: return inline_unsafe_load_store(T_OBJECT, LS_cmp_exchange, Volatile); case vmIntrinsics::_compareAndExchangeObjectAcquire: return inline_unsafe_load_store(T_OBJECT, LS_cmp_exchange, Acquire); case vmIntrinsics::_compareAndExchangeObjectRelease: return inline_unsafe_load_store(T_OBJECT, LS_cmp_exchange, Release); - case vmIntrinsics::_compareAndExchangeByteVolatile: return inline_unsafe_load_store(T_BYTE, LS_cmp_exchange, Volatile); + case vmIntrinsics::_compareAndExchangeByte: return inline_unsafe_load_store(T_BYTE, LS_cmp_exchange, Volatile); case vmIntrinsics::_compareAndExchangeByteAcquire: return inline_unsafe_load_store(T_BYTE, LS_cmp_exchange, Acquire); case vmIntrinsics::_compareAndExchangeByteRelease: return inline_unsafe_load_store(T_BYTE, LS_cmp_exchange, Release); - case vmIntrinsics::_compareAndExchangeShortVolatile: return inline_unsafe_load_store(T_SHORT, LS_cmp_exchange, Volatile); + case vmIntrinsics::_compareAndExchangeShort: return inline_unsafe_load_store(T_SHORT, LS_cmp_exchange, Volatile); case vmIntrinsics::_compareAndExchangeShortAcquire: return inline_unsafe_load_store(T_SHORT, LS_cmp_exchange, Acquire); case vmIntrinsics::_compareAndExchangeShortRelease: return inline_unsafe_load_store(T_SHORT, LS_cmp_exchange, Release); - case vmIntrinsics::_compareAndExchangeIntVolatile: return inline_unsafe_load_store(T_INT, LS_cmp_exchange, Volatile); + case vmIntrinsics::_compareAndExchangeInt: return inline_unsafe_load_store(T_INT, LS_cmp_exchange, Volatile); case vmIntrinsics::_compareAndExchangeIntAcquire: return inline_unsafe_load_store(T_INT, LS_cmp_exchange, Acquire); case vmIntrinsics::_compareAndExchangeIntRelease: return inline_unsafe_load_store(T_INT, LS_cmp_exchange, Release); - case vmIntrinsics::_compareAndExchangeLongVolatile: return inline_unsafe_load_store(T_LONG, LS_cmp_exchange, Volatile); + case vmIntrinsics::_compareAndExchangeLong: return inline_unsafe_load_store(T_LONG, LS_cmp_exchange, Volatile); case vmIntrinsics::_compareAndExchangeLongAcquire: return inline_unsafe_load_store(T_LONG, LS_cmp_exchange, Acquire); case vmIntrinsics::_compareAndExchangeLongRelease: return inline_unsafe_load_store(T_LONG, LS_cmp_exchange, Release); @@ -2587,23 +2587,26 @@ // // LS_cmp_swap: // -// boolean compareAndSwapObject(Object o, long offset, Object expected, Object x); -// boolean compareAndSwapInt( Object o, long offset, int expected, int x); -// boolean compareAndSwapLong( Object o, long offset, long expected, long x); +// boolean compareAndSetObject(Object o, long offset, Object expected, Object x); +// boolean compareAndSetInt( Object o, long offset, int expected, int x); +// boolean compareAndSetLong( Object o, long offset, long expected, long x); // // LS_cmp_swap_weak: // -// boolean weakCompareAndSwapObject( Object o, long offset, Object expected, Object x); -// boolean weakCompareAndSwapObjectAcquire(Object o, long offset, Object expected, Object x); -// boolean weakCompareAndSwapObjectRelease(Object o, long offset, Object expected, Object x); +// boolean weakCompareAndSetObject( Object o, long offset, Object expected, Object x); +// boolean weakCompareAndSetObjectPlain( Object o, long offset, Object expected, Object x); +// boolean weakCompareAndSetObjectAcquire(Object o, long offset, Object expected, Object x); +// boolean weakCompareAndSetObjectRelease(Object o, long offset, Object expected, Object x); // -// boolean weakCompareAndSwapInt( Object o, long offset, int expected, int x); -// boolean weakCompareAndSwapIntAcquire( Object o, long offset, int expected, int x); -// boolean weakCompareAndSwapIntRelease( Object o, long offset, int expected, int x); +// boolean weakCompareAndSetInt( Object o, long offset, int expected, int x); +// boolean weakCompareAndSetIntPlain( Object o, long offset, int expected, int x); +// boolean weakCompareAndSetIntAcquire( Object o, long offset, int expected, int x); +// boolean weakCompareAndSetIntRelease( Object o, long offset, int expected, int x); // -// boolean weakCompareAndSwapLong( Object o, long offset, long expected, long x); -// boolean weakCompareAndSwapLongAcquire( Object o, long offset, long expected, long x); -// boolean weakCompareAndSwapLongRelease( Object o, long offset, long expected, long x); +// boolean weakCompareAndSetLong( Object o, long offset, long expected, long x); +// boolean weakCompareAndSetLongPlain( Object o, long offset, long expected, long x); +// boolean weakCompareAndSetLongAcquire( Object o, long offset, long expected, long x); +// boolean weakCompareAndSetLongRelease( Object o, long offset, long expected, long x); // // LS_cmp_exchange: // @@ -4965,7 +4968,7 @@ // See arraycopy_restore_alloc_state() comment // if alloc == NULL we don't have to worry about a tightly coupled allocation so we can emit all needed guards // if saved_jvms != NULL (then alloc != NULL) then we can handle guards and a tightly coupled allocation - // if saved_jvms == NULL and alloc != NULL, we can’t emit any guards + // if saved_jvms == NULL and alloc != NULL, we can't emit any guards bool can_emit_guards = (alloc == NULL || saved_jvms != NULL); // The following tests must be performed
--- a/hotspot/src/share/vm/opto/parse3.cpp Fri May 12 15:14:16 2017 -0700 +++ b/hotspot/src/share/vm/opto/parse3.cpp Wed Jul 05 23:26:38 2017 +0200 @@ -146,8 +146,16 @@ void Parse::do_get_xxx(Node* obj, ciField* field, bool is_field) { + BasicType bt = field->layout_type(); + // Does this field have a constant value? If so, just push the value. - if (field->is_constant()) { + if (field->is_constant() && + // Keep consistent with types found by ciTypeFlow: for an + // unloaded field type, ciTypeFlow::StateVector::do_getstatic() + // speculates the field is null. The code in the rest of this + // method does the same. We must not bypass it and use a non + // null constant here. + (bt != T_OBJECT || field->type()->is_loaded())) { // final or stable field Node* con = make_constant_from_field(field, obj); if (con != NULL) { @@ -163,7 +171,6 @@ int offset = field->offset_in_bytes(); const TypePtr* adr_type = C->alias_type(field)->adr_type(); Node *adr = basic_plus_adr(obj, obj, offset); - BasicType bt = field->layout_type(); // Build the resultant type of the load const Type *type;
--- a/hotspot/src/share/vm/prims/jvmti.xml Fri May 12 15:14:16 2017 -0700 +++ b/hotspot/src/share/vm/prims/jvmti.xml Wed Jul 05 23:26:38 2017 +0200 @@ -6814,7 +6814,9 @@ <functionlink id="AddModuleReads"/>, <functionlink id="AddModuleExports"/>, <functionlink id="AddModuleOpens"/>, <functionlink id="AddModuleUses"/>, and <functionlink id="AddModuleProvides"/>. If a module is not modifiable - then the module can not be updated with these functions. + then the module can not be updated with these functions. The result of + this function is always <code>JNI_TRUE</code> when called to determine + if an unnamed module is modifiable. </description> <origin>new</origin> <capabilities>
--- a/hotspot/src/share/vm/prims/jvmtiExport.cpp Fri May 12 15:14:16 2017 -0700 +++ b/hotspot/src/share/vm/prims/jvmtiExport.cpp Wed Jul 05 23:26:38 2017 +0200 @@ -54,7 +54,6 @@ #include "runtime/os.inline.hpp" #include "runtime/thread.inline.hpp" #include "runtime/vframe.hpp" -#include "services/attachListener.hpp" #include "services/serviceUtil.hpp" #include "utilities/macros.hpp" #if INCLUDE_ALL_GCS @@ -2479,15 +2478,6 @@ typedef jint (JNICALL *OnAttachEntry_t)(JavaVM*, char *, void *); } -jint JvmtiExport::load_agent_library(AttachOperation* op, outputStream* st) { - // get agent name and options - const char* agent = op->arg(0); - const char* absParam = op->arg(1); - const char* options = op->arg(2); - - return load_agent_library(agent, absParam, options, st); -} - jint JvmtiExport::load_agent_library(const char *agent, const char *absParam, const char *options, outputStream* st) { char ebuf[1024];
--- a/hotspot/src/share/vm/prims/jvmtiExport.hpp Fri May 12 15:14:16 2017 -0700 +++ b/hotspot/src/share/vm/prims/jvmtiExport.hpp Wed Jul 05 23:26:38 2017 +0200 @@ -45,7 +45,6 @@ class JvmtiManageCapabilities; class JvmtiEnv; class JvmtiThreadState; -class AttachOperation; #define JVMTI_SUPPORT_FLAG(key) \ private: \ @@ -396,7 +395,6 @@ #if INCLUDE_SERVICES // attach support static jint load_agent_library(const char *agent, const char *absParam, const char *options, outputStream* out) NOT_JVMTI_RETURN_(JNI_ERR); - static jint load_agent_library(AttachOperation* op, outputStream* out) NOT_JVMTI_RETURN_(JNI_ERR); #endif // SetNativeMethodPrefix support
--- a/hotspot/src/share/vm/prims/unsafe.cpp Fri May 12 15:14:16 2017 -0700 +++ b/hotspot/src/share/vm/prims/unsafe.cpp Wed Jul 05 23:26:38 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 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 @@ -378,7 +378,7 @@ // On platforms which do not support atomic compare-and-swap of jlong (8 byte) // values we have to use a lock-based scheme to enforce atomicity. This has to be // applied to all Unsafe operations that set the value of a jlong field. Even so -// the compareAndSwapLong operation will not be atomic with respect to direct stores +// the compareAndSetLong operation will not be atomic with respect to direct stores // to the field from Java code. It is important therefore that any Java code that // utilizes these Unsafe jlong operations does not perform direct stores. To permit // direct loads of the field from Java code we must also use Atomic::store within the @@ -1013,7 +1013,7 @@ #endif } UNSAFE_END -UNSAFE_ENTRY(jboolean, Unsafe_CompareAndSwapObject(JNIEnv *env, jobject unsafe, jobject obj, jlong offset, jobject e_h, jobject x_h)) { +UNSAFE_ENTRY(jboolean, Unsafe_CompareAndSetObject(JNIEnv *env, jobject unsafe, jobject obj, jlong offset, jobject e_h, jobject x_h)) { oop x = JNIHandles::resolve(x_h); oop e = JNIHandles::resolve(e_h); oop p = JNIHandles::resolve(obj); @@ -1028,14 +1028,14 @@ return true; } UNSAFE_END -UNSAFE_ENTRY(jboolean, Unsafe_CompareAndSwapInt(JNIEnv *env, jobject unsafe, jobject obj, jlong offset, jint e, jint x)) { +UNSAFE_ENTRY(jboolean, Unsafe_CompareAndSetInt(JNIEnv *env, jobject unsafe, jobject obj, jlong offset, jint e, jint x)) { oop p = JNIHandles::resolve(obj); jint* addr = (jint *)index_oop_from_field_offset_long(p, offset); return (jint)(Atomic::cmpxchg(x, addr, e)) == e; } UNSAFE_END -UNSAFE_ENTRY(jboolean, Unsafe_CompareAndSwapLong(JNIEnv *env, jobject unsafe, jobject obj, jlong offset, jlong e, jlong x)) { +UNSAFE_ENTRY(jboolean, Unsafe_CompareAndSetLong(JNIEnv *env, jobject unsafe, jobject obj, jlong offset, jlong e, jlong x)) { Handle p(THREAD, JNIHandles::resolve(obj)); jlong* addr = (jlong*)index_oop_from_field_offset_long(p(), offset); @@ -1194,12 +1194,12 @@ {CC "defineClass0", CC "(" DC_Args ")" CLS, FN_PTR(Unsafe_DefineClass0)}, {CC "allocateInstance", CC "(" CLS ")" OBJ, FN_PTR(Unsafe_AllocateInstance)}, {CC "throwException", CC "(" THR ")V", FN_PTR(Unsafe_ThrowException)}, - {CC "compareAndSwapObject", CC "(" OBJ "J" OBJ "" OBJ ")Z", FN_PTR(Unsafe_CompareAndSwapObject)}, - {CC "compareAndSwapInt", CC "(" OBJ "J""I""I"")Z", FN_PTR(Unsafe_CompareAndSwapInt)}, - {CC "compareAndSwapLong", CC "(" OBJ "J""J""J"")Z", FN_PTR(Unsafe_CompareAndSwapLong)}, - {CC "compareAndExchangeObjectVolatile", CC "(" OBJ "J" OBJ "" OBJ ")" OBJ, FN_PTR(Unsafe_CompareAndExchangeObject)}, - {CC "compareAndExchangeIntVolatile", CC "(" OBJ "J""I""I"")I", FN_PTR(Unsafe_CompareAndExchangeInt)}, - {CC "compareAndExchangeLongVolatile", CC "(" OBJ "J""J""J"")J", FN_PTR(Unsafe_CompareAndExchangeLong)}, + {CC "compareAndSetObject",CC "(" OBJ "J" OBJ "" OBJ ")Z", FN_PTR(Unsafe_CompareAndSetObject)}, + {CC "compareAndSetInt", CC "(" OBJ "J""I""I"")Z", FN_PTR(Unsafe_CompareAndSetInt)}, + {CC "compareAndSetLong", CC "(" OBJ "J""J""J"")Z", FN_PTR(Unsafe_CompareAndSetLong)}, + {CC "compareAndExchangeObject", CC "(" OBJ "J" OBJ "" OBJ ")" OBJ, FN_PTR(Unsafe_CompareAndExchangeObject)}, + {CC "compareAndExchangeInt", CC "(" OBJ "J""I""I"")I", FN_PTR(Unsafe_CompareAndExchangeInt)}, + {CC "compareAndExchangeLong", CC "(" OBJ "J""J""J"")J", FN_PTR(Unsafe_CompareAndExchangeLong)}, {CC "park", CC "(ZJ)V", FN_PTR(Unsafe_Park)}, {CC "unpark", CC "(" OBJ ")V", FN_PTR(Unsafe_Unpark)},
--- a/hotspot/src/share/vm/runtime/arguments.cpp Fri May 12 15:14:16 2017 -0700 +++ b/hotspot/src/share/vm/runtime/arguments.cpp Wed Jul 05 23:26:38 2017 +0200 @@ -2762,11 +2762,14 @@ build_jvm_args(option->optionString); } - // -verbose:[class/gc/jni] + // -verbose:[class/module/gc/jni] if (match_option(option, "-verbose", &tail)) { if (!strcmp(tail, ":class") || !strcmp(tail, "")) { LogConfiguration::configure_stdout(LogLevel::Info, true, LOG_TAGS(class, load)); LogConfiguration::configure_stdout(LogLevel::Info, true, LOG_TAGS(class, unload)); + } else if (!strcmp(tail, ":module")) { + LogConfiguration::configure_stdout(LogLevel::Info, true, LOG_TAGS(module, load)); + LogConfiguration::configure_stdout(LogLevel::Info, true, LOG_TAGS(module, unload)); } else if (!strcmp(tail, ":gc")) { LogConfiguration::configure_stdout(LogLevel::Info, true, LOG_TAGS(gc)); } else if (!strcmp(tail, ":jni")) {
--- a/hotspot/src/share/vm/runtime/globals.hpp Fri May 12 15:14:16 2017 -0700 +++ b/hotspot/src/share/vm/runtime/globals.hpp Wed Jul 05 23:26:38 2017 +0200 @@ -3848,6 +3848,9 @@ product(bool, StartAttachListener, false, \ "Always start Attach Listener at VM startup") \ \ + product(bool, EnableDynamicAgentLoading, true, \ + "Allow tools to load agents with the attach mechanism") \ + \ manageable(bool, PrintConcurrentLocks, false, \ "Print java.util.concurrent locks in thread dump") \ \
--- a/hotspot/src/share/vm/runtime/thread.cpp Fri May 12 15:14:16 2017 -0700 +++ b/hotspot/src/share/vm/runtime/thread.cpp Wed Jul 05 23:26:38 2017 +0200 @@ -3404,7 +3404,7 @@ // // After phase 2, The VM will begin search classes from -Xbootclasspath/a. static void call_initPhase2(TRAPS) { - TraceTime timer("Phase2 initialization", TRACETIME_LOG(Info, modules, startuptime)); + TraceTime timer("Phase2 initialization", TRACETIME_LOG(Info, module, startuptime)); Klass* k = SystemDictionary::resolve_or_fail(vmSymbols::java_lang_System(), true, CHECK); instanceKlassHandle klass (THREAD, k);
--- a/hotspot/src/share/vm/services/attachListener.cpp Fri May 12 15:14:16 2017 -0700 +++ b/hotspot/src/share/vm/services/attachListener.cpp Wed Jul 05 23:26:38 2017 +0200 @@ -100,6 +100,36 @@ return JNI_OK; } +// Implementation of "load" command. +static jint load_agent(AttachOperation* op, outputStream* out) { + // get agent name and options + const char* agent = op->arg(0); + const char* absParam = op->arg(1); + const char* options = op->arg(2); + + // If loading a java agent then need to ensure that the java.instrument module is loaded + if (strcmp(agent, "instrument") == 0) { + Thread* THREAD = Thread::current(); + ResourceMark rm(THREAD); + HandleMark hm(THREAD); + JavaValue result(T_OBJECT); + Handle h_module_name = java_lang_String::create_from_str("java.instrument", THREAD); + JavaCalls::call_static(&result, + SystemDictionary::module_Modules_klass(), + vmSymbols::loadModule_name(), + vmSymbols::loadModule_signature(), + h_module_name, + THREAD); + if (HAS_PENDING_EXCEPTION) { + java_lang_Throwable::print(PENDING_EXCEPTION, out); + CLEAR_PENDING_EXCEPTION; + return JNI_ERR; + } + } + + return JvmtiExport::load_agent_library(agent, absParam, options, out); +} + // Implementation of "properties" command. // See also: PrintSystemPropertiesDCmd class static jint get_system_properties(AttachOperation* op, outputStream* out) { @@ -282,7 +312,7 @@ { "agentProperties", get_agent_properties }, { "datadump", data_dump }, { "dumpheap", dump_heap }, - { "load", JvmtiExport::load_agent_library }, + { "load", load_agent }, { "properties", get_system_properties }, { "threaddump", thread_dump }, { "inspectheap", heap_inspection }, @@ -321,6 +351,10 @@ // handle special detachall operation if (strcmp(op->name(), AttachOperation::detachall_operation_name()) == 0) { AttachListener::detachall(); + } else if (!EnableDynamicAgentLoading && strcmp(op->name(), "load") == 0) { + st.print("Dynamic agent loading is not enabled. " + "Use -XX:+EnableDynamicAgentLoading to launch target VM."); + res = JNI_ERR; } else { // find the function to dispatch too AttachOperationFunctionInfo* info = NULL;
--- a/hotspot/src/share/vm/services/diagnosticCommand.cpp Fri May 12 15:14:16 2017 -0700 +++ b/hotspot/src/share/vm/services/diagnosticCommand.cpp Wed Jul 05 23:26:38 2017 +0200 @@ -42,6 +42,21 @@ #include "utilities/macros.hpp" #include "oops/objArrayOop.inline.hpp" + +static void loadAgentModule(TRAPS) { + ResourceMark rm(THREAD); + HandleMark hm(THREAD); + + JavaValue result(T_OBJECT); + Handle h_module_name = java_lang_String::create_from_str("jdk.management.agent", CHECK); + JavaCalls::call_static(&result, + SystemDictionary::module_Modules_klass(), + vmSymbols::loadModule_name(), + vmSymbols::loadModule_signature(), + h_module_name, + THREAD); +} + void DCmdRegistrant::register_dcmds(){ // Registration of the diagnostic commands // First argument specifies which interfaces will export the command @@ -753,6 +768,7 @@ // the remote management server. // throw java.lang.NoSuchMethodError if the method doesn't exist + loadAgentModule(CHECK); Handle loader = Handle(THREAD, SystemDictionary::java_system_loader()); Klass* k = SystemDictionary::resolve_or_fail(vmSymbols::jdk_internal_agent_Agent(), loader, Handle(), true, CHECK); instanceKlassHandle ik (THREAD, k); @@ -826,6 +842,7 @@ // the local management server // throw java.lang.NoSuchMethodError if method doesn't exist + loadAgentModule(CHECK); Handle loader = Handle(THREAD, SystemDictionary::java_system_loader()); Klass* k = SystemDictionary::resolve_or_fail(vmSymbols::jdk_internal_agent_Agent(), loader, Handle(), true, CHECK); instanceKlassHandle ik (THREAD, k); @@ -843,6 +860,7 @@ // management server // throw java.lang.NoSuchMethodError if method doesn't exist + loadAgentModule(CHECK); Handle loader = Handle(THREAD, SystemDictionary::java_system_loader()); Klass* k = SystemDictionary::resolve_or_fail(vmSymbols::jdk_internal_agent_Agent(), loader, Handle(), true, CHECK); instanceKlassHandle ik (THREAD, k); @@ -864,6 +882,7 @@ // invoke getManagementAgentStatus() method to generate the status info // throw java.lang.NoSuchMethodError if method doesn't exist + loadAgentModule(CHECK); Handle loader = Handle(THREAD, SystemDictionary::java_system_loader()); Klass* k = SystemDictionary::resolve_or_fail(vmSymbols::jdk_internal_agent_Agent(), loader, Handle(), true, CHECK); instanceKlassHandle ik (THREAD, k);
--- a/hotspot/src/share/vm/shark/sharkIntrinsics.cpp Fri May 12 15:14:16 2017 -0700 +++ b/hotspot/src/share/vm/shark/sharkIntrinsics.cpp Wed Jul 05 23:26:38 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved. * Copyright 2009 Red Hat, Inc. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -66,7 +66,7 @@ return true; // Unsafe - case vmIntrinsics::_compareAndSwapInt: + case vmIntrinsics::_compareAndSetInt: return true; default: @@ -140,8 +140,8 @@ break; // Unsafe - case vmIntrinsics::_compareAndSwapInt: - do_Unsafe_compareAndSwapInt(); + case vmIntrinsics::_compareAndSetInt: + do_Unsafe_compareAndSetInt(); break; default: @@ -241,7 +241,7 @@ true)); } -void SharkIntrinsics::do_Unsafe_compareAndSwapInt() { +void SharkIntrinsics::do_Unsafe_compareAndSetInt() { // Pop the arguments Value *x = state()->pop()->jint_value(); Value *e = state()->pop()->jint_value();
--- a/hotspot/src/share/vm/shark/sharkIntrinsics.hpp Fri May 12 15:14:16 2017 -0700 +++ b/hotspot/src/share/vm/shark/sharkIntrinsics.hpp Wed Jul 05 23:26:38 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved. * Copyright 2009 Red Hat, Inc. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -58,7 +58,7 @@ void do_Object_getClass(); void do_System_currentTimeMillis(); void do_Thread_currentThread(); - void do_Unsafe_compareAndSwapInt(); + void do_Unsafe_compareAndSetInt(); }; #endif // SHARE_VM_SHARK_SHARKINTRINSICS_HPP
--- a/hotspot/test/compiler/intrinsics/unsafe/TestCAEAntiDep.java Fri May 12 15:14:16 2017 -0700 +++ b/hotspot/test/compiler/intrinsics/unsafe/TestCAEAntiDep.java Wed Jul 05 23:26:38 2017 +0200 @@ -1,4 +1,5 @@ /* + * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2016, Red Hat, Inc. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -53,7 +54,7 @@ } static int m(TestCAEAntiDep test, Object expected, Object x) { - C old = (C)UNSAFE.compareAndExchangeObjectVolatile(test, O_OFFSET, expected, x); + C old = (C)UNSAFE.compareAndExchangeObject(test, O_OFFSET, expected, x); int res = old.f1; old.f1 = 0x42; return res;
--- a/hotspot/test/compiler/intrinsics/unsafe/UnsafeTwoCASLong.java Fri May 12 15:14:16 2017 -0700 +++ b/hotspot/test/compiler/intrinsics/unsafe/UnsafeTwoCASLong.java Wed Jul 05 23:26:38 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -72,9 +72,8 @@ } static void testAccess(Object base, long offset) { - UNSAFE.compareAndSwapLong(base, offset, 1L, 2L); - UNSAFE.compareAndSwapLong(base, offset, 2L, 1L); + UNSAFE.compareAndSetLong(base, offset, 1L, 2L); + UNSAFE.compareAndSetLong(base, offset, 2L, 1L); } } -
--- a/hotspot/test/compiler/jsr292/RedefineMethodUsedByMultipleMethodHandles.java Fri May 12 15:14:16 2017 -0700 +++ b/hotspot/test/compiler/jsr292/RedefineMethodUsedByMultipleMethodHandles.java Wed Jul 05 23:26:38 2017 +0200 @@ -32,7 +32,7 @@ * java.management * jdk.attach * - * @run main/othervm compiler.jsr292.RedefineMethodUsedByMultipleMethodHandles + * @run main/othervm -Djdk.attach.allowAttachSelf compiler.jsr292.RedefineMethodUsedByMultipleMethodHandles */ package compiler.jsr292;
--- a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/RedefineClassTest.java Fri May 12 15:14:16 2017 -0700 +++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/RedefineClassTest.java Wed Jul 05 23:26:38 2017 +0200 @@ -29,7 +29,7 @@ * jdk.internal.vm.ci/jdk.vm.ci.runtime * jdk.attach * java.base/jdk.internal.misc - * @run junit/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI -Djvmci.Compiler=null jdk.vm.ci.runtime.test.RedefineClassTest + * @run junit/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI -Djvmci.Compiler=null -Djdk.attach.allowAttachSelf jdk.vm.ci.runtime.test.RedefineClassTest */ package jdk.vm.ci.runtime.test;
--- a/hotspot/test/compiler/profiling/spectrapredefineclass/Launcher.java Fri May 12 15:14:16 2017 -0700 +++ b/hotspot/test/compiler/profiling/spectrapredefineclass/Launcher.java Wed Jul 05 23:26:38 2017 +0200 @@ -33,7 +33,7 @@ * @run driver compiler.profiling.spectrapredefineclass.Launcher * @run main/othervm -XX:-TieredCompilation -XX:-BackgroundCompilation * -XX:-UseOnStackReplacement -XX:TypeProfileLevel=222 - * -XX:ReservedCodeCacheSize=3M + * -XX:ReservedCodeCacheSize=3M -Djdk.attach.allowAttachSelf * compiler.profiling.spectrapredefineclass.Agent */
--- a/hotspot/test/compiler/profiling/spectrapredefineclass_classloaders/Launcher.java Fri May 12 15:14:16 2017 -0700 +++ b/hotspot/test/compiler/profiling/spectrapredefineclass_classloaders/Launcher.java Wed Jul 05 23:26:38 2017 +0200 @@ -36,7 +36,7 @@ * @run driver compiler.profiling.spectrapredefineclass_classloaders.Launcher * @run main/othervm -XX:-TieredCompilation -XX:-BackgroundCompilation * -XX:-UseOnStackReplacement -XX:TypeProfileLevel=222 - * -XX:ReservedCodeCacheSize=3M + * -XX:ReservedCodeCacheSize=3M -Djdk.attach.allowAttachSelf * compiler.profiling.spectrapredefineclass_classloaders.Agent */
--- a/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestBoolean.java Fri May 12 15:14:16 2017 -0700 +++ b/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestBoolean.java Wed Jul 05 23:26:38 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -151,32 +151,32 @@ // Compare { - boolean r = UNSAFE.compareAndSwapBoolean(base, offset, true, false); - assertEquals(r, true, "success compareAndSwap boolean"); + boolean r = UNSAFE.compareAndSetBoolean(base, offset, true, false); + assertEquals(r, true, "success compareAndSet boolean"); boolean x = UNSAFE.getBoolean(base, offset); - assertEquals(x, false, "success compareAndSwap boolean value"); + assertEquals(x, false, "success compareAndSet boolean value"); } { - boolean r = UNSAFE.compareAndSwapBoolean(base, offset, true, false); - assertEquals(r, false, "failing compareAndSwap boolean"); + boolean r = UNSAFE.compareAndSetBoolean(base, offset, true, false); + assertEquals(r, false, "failing compareAndSet boolean"); boolean x = UNSAFE.getBoolean(base, offset); - assertEquals(x, false, "failing compareAndSwap boolean value"); + assertEquals(x, false, "failing compareAndSet boolean value"); } // Advanced compare { - boolean r = UNSAFE.compareAndExchangeBooleanVolatile(base, offset, false, true); - assertEquals(r, false, "success compareAndExchangeVolatile boolean"); + boolean r = UNSAFE.compareAndExchangeBoolean(base, offset, false, true); + assertEquals(r, false, "success compareAndExchange boolean"); boolean x = UNSAFE.getBoolean(base, offset); - assertEquals(x, true, "success compareAndExchangeVolatile boolean value"); + assertEquals(x, true, "success compareAndExchange boolean value"); } { - boolean r = UNSAFE.compareAndExchangeBooleanVolatile(base, offset, false, false); - assertEquals(r, true, "failing compareAndExchangeVolatile boolean"); + boolean r = UNSAFE.compareAndExchangeBoolean(base, offset, false, false); + assertEquals(r, true, "failing compareAndExchange boolean"); boolean x = UNSAFE.getBoolean(base, offset); - assertEquals(x, true, "failing compareAndExchangeVolatile boolean value"); + assertEquals(x, true, "failing compareAndExchange boolean value"); } { @@ -210,41 +210,41 @@ { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = UNSAFE.weakCompareAndSwapBoolean(base, offset, true, false); + success = UNSAFE.weakCompareAndSetBooleanPlain(base, offset, true, false); } - assertEquals(success, true, "weakCompareAndSwap boolean"); + assertEquals(success, true, "weakCompareAndSetPlain boolean"); boolean x = UNSAFE.getBoolean(base, offset); - assertEquals(x, false, "weakCompareAndSwap boolean value"); + assertEquals(x, false, "weakCompareAndSetPlain boolean value"); } { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = UNSAFE.weakCompareAndSwapBooleanAcquire(base, offset, false, true); + success = UNSAFE.weakCompareAndSetBooleanAcquire(base, offset, false, true); } - assertEquals(success, true, "weakCompareAndSwapAcquire boolean"); + assertEquals(success, true, "weakCompareAndSetAcquire boolean"); boolean x = UNSAFE.getBoolean(base, offset); - assertEquals(x, true, "weakCompareAndSwapAcquire boolean"); + assertEquals(x, true, "weakCompareAndSetAcquire boolean"); } { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = UNSAFE.weakCompareAndSwapBooleanRelease(base, offset, true, false); + success = UNSAFE.weakCompareAndSetBooleanRelease(base, offset, true, false); } - assertEquals(success, true, "weakCompareAndSwapRelease boolean"); + assertEquals(success, true, "weakCompareAndSetRelease boolean"); boolean x = UNSAFE.getBoolean(base, offset); - assertEquals(x, false, "weakCompareAndSwapRelease boolean"); + assertEquals(x, false, "weakCompareAndSetRelease boolean"); } { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = UNSAFE.weakCompareAndSwapBooleanVolatile(base, offset, false, true); + success = UNSAFE.weakCompareAndSetBoolean(base, offset, false, true); } - assertEquals(success, true, "weakCompareAndSwapVolatile boolean"); + assertEquals(success, true, "weakCompareAndSet boolean"); boolean x = UNSAFE.getBoolean(base, offset); - assertEquals(x, true, "weakCompareAndSwapVolatile boolean"); + assertEquals(x, true, "weakCompareAndSet boolean"); } UNSAFE.putBoolean(base, offset, false); @@ -260,4 +260,3 @@ } } -
--- a/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestByte.java Fri May 12 15:14:16 2017 -0700 +++ b/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestByte.java Wed Jul 05 23:26:38 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -180,32 +180,32 @@ // Compare { - boolean r = UNSAFE.compareAndSwapByte(base, offset, (byte)0x01, (byte)0x23); - assertEquals(r, true, "success compareAndSwap byte"); + boolean r = UNSAFE.compareAndSetByte(base, offset, (byte)0x01, (byte)0x23); + assertEquals(r, true, "success compareAndSet byte"); byte x = UNSAFE.getByte(base, offset); - assertEquals(x, (byte)0x23, "success compareAndSwap byte value"); + assertEquals(x, (byte)0x23, "success compareAndSet byte value"); } { - boolean r = UNSAFE.compareAndSwapByte(base, offset, (byte)0x01, (byte)0x45); - assertEquals(r, false, "failing compareAndSwap byte"); + boolean r = UNSAFE.compareAndSetByte(base, offset, (byte)0x01, (byte)0x45); + assertEquals(r, false, "failing compareAndSet byte"); byte x = UNSAFE.getByte(base, offset); - assertEquals(x, (byte)0x23, "failing compareAndSwap byte value"); + assertEquals(x, (byte)0x23, "failing compareAndSet byte value"); } // Advanced compare { - byte r = UNSAFE.compareAndExchangeByteVolatile(base, offset, (byte)0x23, (byte)0x01); - assertEquals(r, (byte)0x23, "success compareAndExchangeVolatile byte"); + byte r = UNSAFE.compareAndExchangeByte(base, offset, (byte)0x23, (byte)0x01); + assertEquals(r, (byte)0x23, "success compareAndExchange byte"); byte x = UNSAFE.getByte(base, offset); - assertEquals(x, (byte)0x01, "success compareAndExchangeVolatile byte value"); + assertEquals(x, (byte)0x01, "success compareAndExchange byte value"); } { - byte r = UNSAFE.compareAndExchangeByteVolatile(base, offset, (byte)0x23, (byte)0x45); - assertEquals(r, (byte)0x01, "failing compareAndExchangeVolatile byte"); + byte r = UNSAFE.compareAndExchangeByte(base, offset, (byte)0x23, (byte)0x45); + assertEquals(r, (byte)0x01, "failing compareAndExchange byte"); byte x = UNSAFE.getByte(base, offset); - assertEquals(x, (byte)0x01, "failing compareAndExchangeVolatile byte value"); + assertEquals(x, (byte)0x01, "failing compareAndExchange byte value"); } { @@ -239,41 +239,41 @@ { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = UNSAFE.weakCompareAndSwapByte(base, offset, (byte)0x01, (byte)0x23); + success = UNSAFE.weakCompareAndSetBytePlain(base, offset, (byte)0x01, (byte)0x23); } - assertEquals(success, true, "weakCompareAndSwap byte"); + assertEquals(success, true, "weakCompareAndSetPlain byte"); byte x = UNSAFE.getByte(base, offset); - assertEquals(x, (byte)0x23, "weakCompareAndSwap byte value"); + assertEquals(x, (byte)0x23, "weakCompareAndSetPlain byte value"); } { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = UNSAFE.weakCompareAndSwapByteAcquire(base, offset, (byte)0x23, (byte)0x01); + success = UNSAFE.weakCompareAndSetByteAcquire(base, offset, (byte)0x23, (byte)0x01); } - assertEquals(success, true, "weakCompareAndSwapAcquire byte"); + assertEquals(success, true, "weakCompareAndSetAcquire byte"); byte x = UNSAFE.getByte(base, offset); - assertEquals(x, (byte)0x01, "weakCompareAndSwapAcquire byte"); + assertEquals(x, (byte)0x01, "weakCompareAndSetAcquire byte"); } { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = UNSAFE.weakCompareAndSwapByteRelease(base, offset, (byte)0x01, (byte)0x23); + success = UNSAFE.weakCompareAndSetByteRelease(base, offset, (byte)0x01, (byte)0x23); } - assertEquals(success, true, "weakCompareAndSwapRelease byte"); + assertEquals(success, true, "weakCompareAndSetRelease byte"); byte x = UNSAFE.getByte(base, offset); - assertEquals(x, (byte)0x23, "weakCompareAndSwapRelease byte"); + assertEquals(x, (byte)0x23, "weakCompareAndSetRelease byte"); } { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = UNSAFE.weakCompareAndSwapByteVolatile(base, offset, (byte)0x23, (byte)0x01); + success = UNSAFE.weakCompareAndSetByte(base, offset, (byte)0x23, (byte)0x01); } - assertEquals(success, true, "weakCompareAndSwapVolatile byte"); + assertEquals(success, true, "weakCompareAndSet byte"); byte x = UNSAFE.getByte(base, offset); - assertEquals(x, (byte)0x01, "weakCompareAndSwapVolatile byte"); + assertEquals(x, (byte)0x01, "weakCompareAndSet byte"); } UNSAFE.putByte(base, offset, (byte)0x23); @@ -306,4 +306,3 @@ } } } -
--- a/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestChar.java Fri May 12 15:14:16 2017 -0700 +++ b/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestChar.java Wed Jul 05 23:26:38 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -198,32 +198,32 @@ // Compare { - boolean r = UNSAFE.compareAndSwapChar(base, offset, '\u0123', '\u4567'); - assertEquals(r, true, "success compareAndSwap char"); + boolean r = UNSAFE.compareAndSetChar(base, offset, '\u0123', '\u4567'); + assertEquals(r, true, "success compareAndSet char"); char x = UNSAFE.getChar(base, offset); - assertEquals(x, '\u4567', "success compareAndSwap char value"); + assertEquals(x, '\u4567', "success compareAndSet char value"); } { - boolean r = UNSAFE.compareAndSwapChar(base, offset, '\u0123', '\u89AB'); - assertEquals(r, false, "failing compareAndSwap char"); + boolean r = UNSAFE.compareAndSetChar(base, offset, '\u0123', '\u89AB'); + assertEquals(r, false, "failing compareAndSet char"); char x = UNSAFE.getChar(base, offset); - assertEquals(x, '\u4567', "failing compareAndSwap char value"); + assertEquals(x, '\u4567', "failing compareAndSet char value"); } // Advanced compare { - char r = UNSAFE.compareAndExchangeCharVolatile(base, offset, '\u4567', '\u0123'); - assertEquals(r, '\u4567', "success compareAndExchangeVolatile char"); + char r = UNSAFE.compareAndExchangeChar(base, offset, '\u4567', '\u0123'); + assertEquals(r, '\u4567', "success compareAndExchange char"); char x = UNSAFE.getChar(base, offset); - assertEquals(x, '\u0123', "success compareAndExchangeVolatile char value"); + assertEquals(x, '\u0123', "success compareAndExchange char value"); } { - char r = UNSAFE.compareAndExchangeCharVolatile(base, offset, '\u4567', '\u89AB'); - assertEquals(r, '\u0123', "failing compareAndExchangeVolatile char"); + char r = UNSAFE.compareAndExchangeChar(base, offset, '\u4567', '\u89AB'); + assertEquals(r, '\u0123', "failing compareAndExchange char"); char x = UNSAFE.getChar(base, offset); - assertEquals(x, '\u0123', "failing compareAndExchangeVolatile char value"); + assertEquals(x, '\u0123', "failing compareAndExchange char value"); } { @@ -257,41 +257,41 @@ { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = UNSAFE.weakCompareAndSwapChar(base, offset, '\u0123', '\u4567'); + success = UNSAFE.weakCompareAndSetCharPlain(base, offset, '\u0123', '\u4567'); } - assertEquals(success, true, "weakCompareAndSwap char"); + assertEquals(success, true, "weakCompareAndSetPlain char"); char x = UNSAFE.getChar(base, offset); - assertEquals(x, '\u4567', "weakCompareAndSwap char value"); + assertEquals(x, '\u4567', "weakCompareAndSetPlain char value"); } { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = UNSAFE.weakCompareAndSwapCharAcquire(base, offset, '\u4567', '\u0123'); + success = UNSAFE.weakCompareAndSetCharAcquire(base, offset, '\u4567', '\u0123'); } - assertEquals(success, true, "weakCompareAndSwapAcquire char"); + assertEquals(success, true, "weakCompareAndSetAcquire char"); char x = UNSAFE.getChar(base, offset); - assertEquals(x, '\u0123', "weakCompareAndSwapAcquire char"); + assertEquals(x, '\u0123', "weakCompareAndSetAcquire char"); } { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = UNSAFE.weakCompareAndSwapCharRelease(base, offset, '\u0123', '\u4567'); + success = UNSAFE.weakCompareAndSetCharRelease(base, offset, '\u0123', '\u4567'); } - assertEquals(success, true, "weakCompareAndSwapRelease char"); + assertEquals(success, true, "weakCompareAndSetRelease char"); char x = UNSAFE.getChar(base, offset); - assertEquals(x, '\u4567', "weakCompareAndSwapRelease char"); + assertEquals(x, '\u4567', "weakCompareAndSetRelease char"); } { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = UNSAFE.weakCompareAndSwapCharVolatile(base, offset, '\u4567', '\u0123'); + success = UNSAFE.weakCompareAndSetChar(base, offset, '\u4567', '\u0123'); } - assertEquals(success, true, "weakCompareAndSwapVolatile char"); + assertEquals(success, true, "weakCompareAndSet char"); char x = UNSAFE.getChar(base, offset); - assertEquals(x, '\u0123', "weakCompareAndSwapVolatile char"); + assertEquals(x, '\u0123', "weakCompareAndSet char"); } UNSAFE.putChar(base, offset, '\u4567'); @@ -324,4 +324,3 @@ } } } -
--- a/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestDouble.java Fri May 12 15:14:16 2017 -0700 +++ b/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestDouble.java Wed Jul 05 23:26:38 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -180,32 +180,32 @@ // Compare { - boolean r = UNSAFE.compareAndSwapDouble(base, offset, 1.0d, 2.0d); - assertEquals(r, true, "success compareAndSwap double"); + boolean r = UNSAFE.compareAndSetDouble(base, offset, 1.0d, 2.0d); + assertEquals(r, true, "success compareAndSet double"); double x = UNSAFE.getDouble(base, offset); - assertEquals(x, 2.0d, "success compareAndSwap double value"); + assertEquals(x, 2.0d, "success compareAndSet double value"); } { - boolean r = UNSAFE.compareAndSwapDouble(base, offset, 1.0d, 3.0d); - assertEquals(r, false, "failing compareAndSwap double"); + boolean r = UNSAFE.compareAndSetDouble(base, offset, 1.0d, 3.0d); + assertEquals(r, false, "failing compareAndSet double"); double x = UNSAFE.getDouble(base, offset); - assertEquals(x, 2.0d, "failing compareAndSwap double value"); + assertEquals(x, 2.0d, "failing compareAndSet double value"); } // Advanced compare { - double r = UNSAFE.compareAndExchangeDoubleVolatile(base, offset, 2.0d, 1.0d); - assertEquals(r, 2.0d, "success compareAndExchangeVolatile double"); + double r = UNSAFE.compareAndExchangeDouble(base, offset, 2.0d, 1.0d); + assertEquals(r, 2.0d, "success compareAndExchange double"); double x = UNSAFE.getDouble(base, offset); - assertEquals(x, 1.0d, "success compareAndExchangeVolatile double value"); + assertEquals(x, 1.0d, "success compareAndExchange double value"); } { - double r = UNSAFE.compareAndExchangeDoubleVolatile(base, offset, 2.0d, 3.0d); - assertEquals(r, 1.0d, "failing compareAndExchangeVolatile double"); + double r = UNSAFE.compareAndExchangeDouble(base, offset, 2.0d, 3.0d); + assertEquals(r, 1.0d, "failing compareAndExchange double"); double x = UNSAFE.getDouble(base, offset); - assertEquals(x, 1.0d, "failing compareAndExchangeVolatile double value"); + assertEquals(x, 1.0d, "failing compareAndExchange double value"); } { @@ -239,41 +239,41 @@ { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = UNSAFE.weakCompareAndSwapDouble(base, offset, 1.0d, 2.0d); + success = UNSAFE.weakCompareAndSetDoublePlain(base, offset, 1.0d, 2.0d); } - assertEquals(success, true, "weakCompareAndSwap double"); + assertEquals(success, true, "weakCompareAndSetPlain double"); double x = UNSAFE.getDouble(base, offset); - assertEquals(x, 2.0d, "weakCompareAndSwap double value"); + assertEquals(x, 2.0d, "weakCompareAndSetPlain double value"); } { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = UNSAFE.weakCompareAndSwapDoubleAcquire(base, offset, 2.0d, 1.0d); + success = UNSAFE.weakCompareAndSetDoubleAcquire(base, offset, 2.0d, 1.0d); } - assertEquals(success, true, "weakCompareAndSwapAcquire double"); + assertEquals(success, true, "weakCompareAndSetAcquire double"); double x = UNSAFE.getDouble(base, offset); - assertEquals(x, 1.0d, "weakCompareAndSwapAcquire double"); + assertEquals(x, 1.0d, "weakCompareAndSetAcquire double"); } { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = UNSAFE.weakCompareAndSwapDoubleRelease(base, offset, 1.0d, 2.0d); + success = UNSAFE.weakCompareAndSetDoubleRelease(base, offset, 1.0d, 2.0d); } - assertEquals(success, true, "weakCompareAndSwapRelease double"); + assertEquals(success, true, "weakCompareAndSetRelease double"); double x = UNSAFE.getDouble(base, offset); - assertEquals(x, 2.0d, "weakCompareAndSwapRelease double"); + assertEquals(x, 2.0d, "weakCompareAndSetRelease double"); } { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = UNSAFE.weakCompareAndSwapDoubleVolatile(base, offset, 2.0d, 1.0d); + success = UNSAFE.weakCompareAndSetDouble(base, offset, 2.0d, 1.0d); } - assertEquals(success, true, "weakCompareAndSwapVolatile double"); + assertEquals(success, true, "weakCompareAndSet double"); double x = UNSAFE.getDouble(base, offset); - assertEquals(x, 1.0d, "weakCompareAndSwapVolatile double"); + assertEquals(x, 1.0d, "weakCompareAndSet double"); } UNSAFE.putDouble(base, offset, 2.0d); @@ -306,4 +306,3 @@ } } } -
--- a/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestFloat.java Fri May 12 15:14:16 2017 -0700 +++ b/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestFloat.java Wed Jul 05 23:26:38 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -180,32 +180,32 @@ // Compare { - boolean r = UNSAFE.compareAndSwapFloat(base, offset, 1.0f, 2.0f); - assertEquals(r, true, "success compareAndSwap float"); + boolean r = UNSAFE.compareAndSetFloat(base, offset, 1.0f, 2.0f); + assertEquals(r, true, "success compareAndSet float"); float x = UNSAFE.getFloat(base, offset); - assertEquals(x, 2.0f, "success compareAndSwap float value"); + assertEquals(x, 2.0f, "success compareAndSet float value"); } { - boolean r = UNSAFE.compareAndSwapFloat(base, offset, 1.0f, 3.0f); - assertEquals(r, false, "failing compareAndSwap float"); + boolean r = UNSAFE.compareAndSetFloat(base, offset, 1.0f, 3.0f); + assertEquals(r, false, "failing compareAndSet float"); float x = UNSAFE.getFloat(base, offset); - assertEquals(x, 2.0f, "failing compareAndSwap float value"); + assertEquals(x, 2.0f, "failing compareAndSet float value"); } // Advanced compare { - float r = UNSAFE.compareAndExchangeFloatVolatile(base, offset, 2.0f, 1.0f); - assertEquals(r, 2.0f, "success compareAndExchangeVolatile float"); + float r = UNSAFE.compareAndExchangeFloat(base, offset, 2.0f, 1.0f); + assertEquals(r, 2.0f, "success compareAndExchange float"); float x = UNSAFE.getFloat(base, offset); - assertEquals(x, 1.0f, "success compareAndExchangeVolatile float value"); + assertEquals(x, 1.0f, "success compareAndExchange float value"); } { - float r = UNSAFE.compareAndExchangeFloatVolatile(base, offset, 2.0f, 3.0f); - assertEquals(r, 1.0f, "failing compareAndExchangeVolatile float"); + float r = UNSAFE.compareAndExchangeFloat(base, offset, 2.0f, 3.0f); + assertEquals(r, 1.0f, "failing compareAndExchange float"); float x = UNSAFE.getFloat(base, offset); - assertEquals(x, 1.0f, "failing compareAndExchangeVolatile float value"); + assertEquals(x, 1.0f, "failing compareAndExchange float value"); } { @@ -239,41 +239,41 @@ { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = UNSAFE.weakCompareAndSwapFloat(base, offset, 1.0f, 2.0f); + success = UNSAFE.weakCompareAndSetFloatPlain(base, offset, 1.0f, 2.0f); } - assertEquals(success, true, "weakCompareAndSwap float"); + assertEquals(success, true, "weakCompareAndSetPlain float"); float x = UNSAFE.getFloat(base, offset); - assertEquals(x, 2.0f, "weakCompareAndSwap float value"); + assertEquals(x, 2.0f, "weakCompareAndSetPlain float value"); } { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = UNSAFE.weakCompareAndSwapFloatAcquire(base, offset, 2.0f, 1.0f); + success = UNSAFE.weakCompareAndSetFloatAcquire(base, offset, 2.0f, 1.0f); } - assertEquals(success, true, "weakCompareAndSwapAcquire float"); + assertEquals(success, true, "weakCompareAndSetAcquire float"); float x = UNSAFE.getFloat(base, offset); - assertEquals(x, 1.0f, "weakCompareAndSwapAcquire float"); + assertEquals(x, 1.0f, "weakCompareAndSetAcquire float"); } { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = UNSAFE.weakCompareAndSwapFloatRelease(base, offset, 1.0f, 2.0f); + success = UNSAFE.weakCompareAndSetFloatRelease(base, offset, 1.0f, 2.0f); } - assertEquals(success, true, "weakCompareAndSwapRelease float"); + assertEquals(success, true, "weakCompareAndSetRelease float"); float x = UNSAFE.getFloat(base, offset); - assertEquals(x, 2.0f, "weakCompareAndSwapRelease float"); + assertEquals(x, 2.0f, "weakCompareAndSetRelease float"); } { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = UNSAFE.weakCompareAndSwapFloatVolatile(base, offset, 2.0f, 1.0f); + success = UNSAFE.weakCompareAndSetFloat(base, offset, 2.0f, 1.0f); } - assertEquals(success, true, "weakCompareAndSwapVolatile float"); + assertEquals(success, true, "weakCompareAndSet float"); float x = UNSAFE.getFloat(base, offset); - assertEquals(x, 1.0f, "weakCompareAndSwapVolatile float"); + assertEquals(x, 1.0f, "weakCompareAndSet float"); } UNSAFE.putFloat(base, offset, 2.0f); @@ -306,4 +306,3 @@ } } } -
--- a/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestInt.java Fri May 12 15:14:16 2017 -0700 +++ b/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestInt.java Wed Jul 05 23:26:38 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -198,32 +198,32 @@ // Compare { - boolean r = UNSAFE.compareAndSwapInt(base, offset, 0x01234567, 0x89ABCDEF); - assertEquals(r, true, "success compareAndSwap int"); + boolean r = UNSAFE.compareAndSetInt(base, offset, 0x01234567, 0x89ABCDEF); + assertEquals(r, true, "success compareAndSet int"); int x = UNSAFE.getInt(base, offset); - assertEquals(x, 0x89ABCDEF, "success compareAndSwap int value"); + assertEquals(x, 0x89ABCDEF, "success compareAndSet int value"); } { - boolean r = UNSAFE.compareAndSwapInt(base, offset, 0x01234567, 0xCAFEBABE); - assertEquals(r, false, "failing compareAndSwap int"); + boolean r = UNSAFE.compareAndSetInt(base, offset, 0x01234567, 0xCAFEBABE); + assertEquals(r, false, "failing compareAndSet int"); int x = UNSAFE.getInt(base, offset); - assertEquals(x, 0x89ABCDEF, "failing compareAndSwap int value"); + assertEquals(x, 0x89ABCDEF, "failing compareAndSet int value"); } // Advanced compare { - int r = UNSAFE.compareAndExchangeIntVolatile(base, offset, 0x89ABCDEF, 0x01234567); - assertEquals(r, 0x89ABCDEF, "success compareAndExchangeVolatile int"); + int r = UNSAFE.compareAndExchangeInt(base, offset, 0x89ABCDEF, 0x01234567); + assertEquals(r, 0x89ABCDEF, "success compareAndExchange int"); int x = UNSAFE.getInt(base, offset); - assertEquals(x, 0x01234567, "success compareAndExchangeVolatile int value"); + assertEquals(x, 0x01234567, "success compareAndExchange int value"); } { - int r = UNSAFE.compareAndExchangeIntVolatile(base, offset, 0x89ABCDEF, 0xCAFEBABE); - assertEquals(r, 0x01234567, "failing compareAndExchangeVolatile int"); + int r = UNSAFE.compareAndExchangeInt(base, offset, 0x89ABCDEF, 0xCAFEBABE); + assertEquals(r, 0x01234567, "failing compareAndExchange int"); int x = UNSAFE.getInt(base, offset); - assertEquals(x, 0x01234567, "failing compareAndExchangeVolatile int value"); + assertEquals(x, 0x01234567, "failing compareAndExchange int value"); } { @@ -257,41 +257,41 @@ { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = UNSAFE.weakCompareAndSwapInt(base, offset, 0x01234567, 0x89ABCDEF); + success = UNSAFE.weakCompareAndSetIntPlain(base, offset, 0x01234567, 0x89ABCDEF); } - assertEquals(success, true, "weakCompareAndSwap int"); + assertEquals(success, true, "weakCompareAndSetPlain int"); int x = UNSAFE.getInt(base, offset); - assertEquals(x, 0x89ABCDEF, "weakCompareAndSwap int value"); + assertEquals(x, 0x89ABCDEF, "weakCompareAndSetPlain int value"); } { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = UNSAFE.weakCompareAndSwapIntAcquire(base, offset, 0x89ABCDEF, 0x01234567); + success = UNSAFE.weakCompareAndSetIntAcquire(base, offset, 0x89ABCDEF, 0x01234567); } - assertEquals(success, true, "weakCompareAndSwapAcquire int"); + assertEquals(success, true, "weakCompareAndSetAcquire int"); int x = UNSAFE.getInt(base, offset); - assertEquals(x, 0x01234567, "weakCompareAndSwapAcquire int"); + assertEquals(x, 0x01234567, "weakCompareAndSetAcquire int"); } { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = UNSAFE.weakCompareAndSwapIntRelease(base, offset, 0x01234567, 0x89ABCDEF); + success = UNSAFE.weakCompareAndSetIntRelease(base, offset, 0x01234567, 0x89ABCDEF); } - assertEquals(success, true, "weakCompareAndSwapRelease int"); + assertEquals(success, true, "weakCompareAndSetRelease int"); int x = UNSAFE.getInt(base, offset); - assertEquals(x, 0x89ABCDEF, "weakCompareAndSwapRelease int"); + assertEquals(x, 0x89ABCDEF, "weakCompareAndSetRelease int"); } { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = UNSAFE.weakCompareAndSwapIntVolatile(base, offset, 0x89ABCDEF, 0x01234567); + success = UNSAFE.weakCompareAndSetInt(base, offset, 0x89ABCDEF, 0x01234567); } - assertEquals(success, true, "weakCompareAndSwapVolatile int"); + assertEquals(success, true, "weakCompareAndSet int"); int x = UNSAFE.getInt(base, offset); - assertEquals(x, 0x01234567, "weakCompareAndSwapVolatile int"); + assertEquals(x, 0x01234567, "weakCompareAndSet int"); } UNSAFE.putInt(base, offset, 0x89ABCDEF); @@ -324,4 +324,3 @@ } } } -
--- a/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestLong.java Fri May 12 15:14:16 2017 -0700 +++ b/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestLong.java Wed Jul 05 23:26:38 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -198,32 +198,32 @@ // Compare { - boolean r = UNSAFE.compareAndSwapLong(base, offset, 0x0123456789ABCDEFL, 0xCAFEBABECAFEBABEL); - assertEquals(r, true, "success compareAndSwap long"); + boolean r = UNSAFE.compareAndSetLong(base, offset, 0x0123456789ABCDEFL, 0xCAFEBABECAFEBABEL); + assertEquals(r, true, "success compareAndSet long"); long x = UNSAFE.getLong(base, offset); - assertEquals(x, 0xCAFEBABECAFEBABEL, "success compareAndSwap long value"); + assertEquals(x, 0xCAFEBABECAFEBABEL, "success compareAndSet long value"); } { - boolean r = UNSAFE.compareAndSwapLong(base, offset, 0x0123456789ABCDEFL, 0xDEADBEEFDEADBEEFL); - assertEquals(r, false, "failing compareAndSwap long"); + boolean r = UNSAFE.compareAndSetLong(base, offset, 0x0123456789ABCDEFL, 0xDEADBEEFDEADBEEFL); + assertEquals(r, false, "failing compareAndSet long"); long x = UNSAFE.getLong(base, offset); - assertEquals(x, 0xCAFEBABECAFEBABEL, "failing compareAndSwap long value"); + assertEquals(x, 0xCAFEBABECAFEBABEL, "failing compareAndSet long value"); } // Advanced compare { - long r = UNSAFE.compareAndExchangeLongVolatile(base, offset, 0xCAFEBABECAFEBABEL, 0x0123456789ABCDEFL); - assertEquals(r, 0xCAFEBABECAFEBABEL, "success compareAndExchangeVolatile long"); + long r = UNSAFE.compareAndExchangeLong(base, offset, 0xCAFEBABECAFEBABEL, 0x0123456789ABCDEFL); + assertEquals(r, 0xCAFEBABECAFEBABEL, "success compareAndExchange long"); long x = UNSAFE.getLong(base, offset); - assertEquals(x, 0x0123456789ABCDEFL, "success compareAndExchangeVolatile long value"); + assertEquals(x, 0x0123456789ABCDEFL, "success compareAndExchange long value"); } { - long r = UNSAFE.compareAndExchangeLongVolatile(base, offset, 0xCAFEBABECAFEBABEL, 0xDEADBEEFDEADBEEFL); - assertEquals(r, 0x0123456789ABCDEFL, "failing compareAndExchangeVolatile long"); + long r = UNSAFE.compareAndExchangeLong(base, offset, 0xCAFEBABECAFEBABEL, 0xDEADBEEFDEADBEEFL); + assertEquals(r, 0x0123456789ABCDEFL, "failing compareAndExchange long"); long x = UNSAFE.getLong(base, offset); - assertEquals(x, 0x0123456789ABCDEFL, "failing compareAndExchangeVolatile long value"); + assertEquals(x, 0x0123456789ABCDEFL, "failing compareAndExchange long value"); } { @@ -257,41 +257,41 @@ { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = UNSAFE.weakCompareAndSwapLong(base, offset, 0x0123456789ABCDEFL, 0xCAFEBABECAFEBABEL); + success = UNSAFE.weakCompareAndSetLongPlain(base, offset, 0x0123456789ABCDEFL, 0xCAFEBABECAFEBABEL); } - assertEquals(success, true, "weakCompareAndSwap long"); + assertEquals(success, true, "weakCompareAndSetPlain long"); long x = UNSAFE.getLong(base, offset); - assertEquals(x, 0xCAFEBABECAFEBABEL, "weakCompareAndSwap long value"); + assertEquals(x, 0xCAFEBABECAFEBABEL, "weakCompareAndSetPlain long value"); } { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = UNSAFE.weakCompareAndSwapLongAcquire(base, offset, 0xCAFEBABECAFEBABEL, 0x0123456789ABCDEFL); + success = UNSAFE.weakCompareAndSetLongAcquire(base, offset, 0xCAFEBABECAFEBABEL, 0x0123456789ABCDEFL); } - assertEquals(success, true, "weakCompareAndSwapAcquire long"); + assertEquals(success, true, "weakCompareAndSetAcquire long"); long x = UNSAFE.getLong(base, offset); - assertEquals(x, 0x0123456789ABCDEFL, "weakCompareAndSwapAcquire long"); + assertEquals(x, 0x0123456789ABCDEFL, "weakCompareAndSetAcquire long"); } { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = UNSAFE.weakCompareAndSwapLongRelease(base, offset, 0x0123456789ABCDEFL, 0xCAFEBABECAFEBABEL); + success = UNSAFE.weakCompareAndSetLongRelease(base, offset, 0x0123456789ABCDEFL, 0xCAFEBABECAFEBABEL); } - assertEquals(success, true, "weakCompareAndSwapRelease long"); + assertEquals(success, true, "weakCompareAndSetRelease long"); long x = UNSAFE.getLong(base, offset); - assertEquals(x, 0xCAFEBABECAFEBABEL, "weakCompareAndSwapRelease long"); + assertEquals(x, 0xCAFEBABECAFEBABEL, "weakCompareAndSetRelease long"); } { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = UNSAFE.weakCompareAndSwapLongVolatile(base, offset, 0xCAFEBABECAFEBABEL, 0x0123456789ABCDEFL); + success = UNSAFE.weakCompareAndSetLong(base, offset, 0xCAFEBABECAFEBABEL, 0x0123456789ABCDEFL); } - assertEquals(success, true, "weakCompareAndSwapVolatile long"); + assertEquals(success, true, "weakCompareAndSet long"); long x = UNSAFE.getLong(base, offset); - assertEquals(x, 0x0123456789ABCDEFL, "weakCompareAndSwapVolatile long"); + assertEquals(x, 0x0123456789ABCDEFL, "weakCompareAndSet long"); } UNSAFE.putLong(base, offset, 0xCAFEBABECAFEBABEL); @@ -324,4 +324,3 @@ } } } -
--- a/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestObject.java Fri May 12 15:14:16 2017 -0700 +++ b/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestObject.java Wed Jul 05 23:26:38 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -151,32 +151,32 @@ // Compare { - boolean r = UNSAFE.compareAndSwapObject(base, offset, "foo", "bar"); - assertEquals(r, true, "success compareAndSwap Object"); + boolean r = UNSAFE.compareAndSetObject(base, offset, "foo", "bar"); + assertEquals(r, true, "success compareAndSet Object"); Object x = UNSAFE.getObject(base, offset); - assertEquals(x, "bar", "success compareAndSwap Object value"); + assertEquals(x, "bar", "success compareAndSet Object value"); } { - boolean r = UNSAFE.compareAndSwapObject(base, offset, "foo", "baz"); - assertEquals(r, false, "failing compareAndSwap Object"); + boolean r = UNSAFE.compareAndSetObject(base, offset, "foo", "baz"); + assertEquals(r, false, "failing compareAndSet Object"); Object x = UNSAFE.getObject(base, offset); - assertEquals(x, "bar", "failing compareAndSwap Object value"); + assertEquals(x, "bar", "failing compareAndSet Object value"); } // Advanced compare { - Object r = UNSAFE.compareAndExchangeObjectVolatile(base, offset, "bar", "foo"); - assertEquals(r, "bar", "success compareAndExchangeVolatile Object"); + Object r = UNSAFE.compareAndExchangeObject(base, offset, "bar", "foo"); + assertEquals(r, "bar", "success compareAndExchange Object"); Object x = UNSAFE.getObject(base, offset); - assertEquals(x, "foo", "success compareAndExchangeVolatile Object value"); + assertEquals(x, "foo", "success compareAndExchange Object value"); } { - Object r = UNSAFE.compareAndExchangeObjectVolatile(base, offset, "bar", "baz"); - assertEquals(r, "foo", "failing compareAndExchangeVolatile Object"); + Object r = UNSAFE.compareAndExchangeObject(base, offset, "bar", "baz"); + assertEquals(r, "foo", "failing compareAndExchange Object"); Object x = UNSAFE.getObject(base, offset); - assertEquals(x, "foo", "failing compareAndExchangeVolatile Object value"); + assertEquals(x, "foo", "failing compareAndExchange Object value"); } { @@ -210,41 +210,41 @@ { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = UNSAFE.weakCompareAndSwapObject(base, offset, "foo", "bar"); + success = UNSAFE.weakCompareAndSetObjectPlain(base, offset, "foo", "bar"); } - assertEquals(success, true, "weakCompareAndSwap Object"); + assertEquals(success, true, "weakCompareAndSetPlain Object"); Object x = UNSAFE.getObject(base, offset); - assertEquals(x, "bar", "weakCompareAndSwap Object value"); + assertEquals(x, "bar", "weakCompareAndSetPlain Object value"); } { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = UNSAFE.weakCompareAndSwapObjectAcquire(base, offset, "bar", "foo"); + success = UNSAFE.weakCompareAndSetObjectAcquire(base, offset, "bar", "foo"); } - assertEquals(success, true, "weakCompareAndSwapAcquire Object"); + assertEquals(success, true, "weakCompareAndSetAcquire Object"); Object x = UNSAFE.getObject(base, offset); - assertEquals(x, "foo", "weakCompareAndSwapAcquire Object"); + assertEquals(x, "foo", "weakCompareAndSetAcquire Object"); } { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = UNSAFE.weakCompareAndSwapObjectRelease(base, offset, "foo", "bar"); + success = UNSAFE.weakCompareAndSetObjectRelease(base, offset, "foo", "bar"); } - assertEquals(success, true, "weakCompareAndSwapRelease Object"); + assertEquals(success, true, "weakCompareAndSetRelease Object"); Object x = UNSAFE.getObject(base, offset); - assertEquals(x, "bar", "weakCompareAndSwapRelease Object"); + assertEquals(x, "bar", "weakCompareAndSetRelease Object"); } { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = UNSAFE.weakCompareAndSwapObjectVolatile(base, offset, "bar", "foo"); + success = UNSAFE.weakCompareAndSetObject(base, offset, "bar", "foo"); } - assertEquals(success, true, "weakCompareAndSwapVolatile Object"); + assertEquals(success, true, "weakCompareAndSet Object"); Object x = UNSAFE.getObject(base, offset); - assertEquals(x, "foo", "weakCompareAndSwapVolatile Object"); + assertEquals(x, "foo", "weakCompareAndSet Object"); } UNSAFE.putObject(base, offset, "bar"); @@ -260,4 +260,3 @@ } } -
--- a/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestShort.java Fri May 12 15:14:16 2017 -0700 +++ b/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestShort.java Wed Jul 05 23:26:38 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -198,32 +198,32 @@ // Compare { - boolean r = UNSAFE.compareAndSwapShort(base, offset, (short)0x0123, (short)0x4567); - assertEquals(r, true, "success compareAndSwap short"); + boolean r = UNSAFE.compareAndSetShort(base, offset, (short)0x0123, (short)0x4567); + assertEquals(r, true, "success compareAndSet short"); short x = UNSAFE.getShort(base, offset); - assertEquals(x, (short)0x4567, "success compareAndSwap short value"); + assertEquals(x, (short)0x4567, "success compareAndSet short value"); } { - boolean r = UNSAFE.compareAndSwapShort(base, offset, (short)0x0123, (short)0x89AB); - assertEquals(r, false, "failing compareAndSwap short"); + boolean r = UNSAFE.compareAndSetShort(base, offset, (short)0x0123, (short)0x89AB); + assertEquals(r, false, "failing compareAndSet short"); short x = UNSAFE.getShort(base, offset); - assertEquals(x, (short)0x4567, "failing compareAndSwap short value"); + assertEquals(x, (short)0x4567, "failing compareAndSet short value"); } // Advanced compare { - short r = UNSAFE.compareAndExchangeShortVolatile(base, offset, (short)0x4567, (short)0x0123); - assertEquals(r, (short)0x4567, "success compareAndExchangeVolatile short"); + short r = UNSAFE.compareAndExchangeShort(base, offset, (short)0x4567, (short)0x0123); + assertEquals(r, (short)0x4567, "success compareAndExchange short"); short x = UNSAFE.getShort(base, offset); - assertEquals(x, (short)0x0123, "success compareAndExchangeVolatile short value"); + assertEquals(x, (short)0x0123, "success compareAndExchange short value"); } { - short r = UNSAFE.compareAndExchangeShortVolatile(base, offset, (short)0x4567, (short)0x89AB); - assertEquals(r, (short)0x0123, "failing compareAndExchangeVolatile short"); + short r = UNSAFE.compareAndExchangeShort(base, offset, (short)0x4567, (short)0x89AB); + assertEquals(r, (short)0x0123, "failing compareAndExchange short"); short x = UNSAFE.getShort(base, offset); - assertEquals(x, (short)0x0123, "failing compareAndExchangeVolatile short value"); + assertEquals(x, (short)0x0123, "failing compareAndExchange short value"); } { @@ -257,41 +257,41 @@ { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = UNSAFE.weakCompareAndSwapShort(base, offset, (short)0x0123, (short)0x4567); + success = UNSAFE.weakCompareAndSetShortPlain(base, offset, (short)0x0123, (short)0x4567); } - assertEquals(success, true, "weakCompareAndSwap short"); + assertEquals(success, true, "weakCompareAndSetPlain short"); short x = UNSAFE.getShort(base, offset); - assertEquals(x, (short)0x4567, "weakCompareAndSwap short value"); + assertEquals(x, (short)0x4567, "weakCompareAndSetPlain short value"); } { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = UNSAFE.weakCompareAndSwapShortAcquire(base, offset, (short)0x4567, (short)0x0123); + success = UNSAFE.weakCompareAndSetShortAcquire(base, offset, (short)0x4567, (short)0x0123); } - assertEquals(success, true, "weakCompareAndSwapAcquire short"); + assertEquals(success, true, "weakCompareAndSetAcquire short"); short x = UNSAFE.getShort(base, offset); - assertEquals(x, (short)0x0123, "weakCompareAndSwapAcquire short"); + assertEquals(x, (short)0x0123, "weakCompareAndSetAcquire short"); } { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = UNSAFE.weakCompareAndSwapShortRelease(base, offset, (short)0x0123, (short)0x4567); + success = UNSAFE.weakCompareAndSetShortRelease(base, offset, (short)0x0123, (short)0x4567); } - assertEquals(success, true, "weakCompareAndSwapRelease short"); + assertEquals(success, true, "weakCompareAndSetRelease short"); short x = UNSAFE.getShort(base, offset); - assertEquals(x, (short)0x4567, "weakCompareAndSwapRelease short"); + assertEquals(x, (short)0x4567, "weakCompareAndSetRelease short"); } { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = UNSAFE.weakCompareAndSwapShortVolatile(base, offset, (short)0x4567, (short)0x0123); + success = UNSAFE.weakCompareAndSetShort(base, offset, (short)0x4567, (short)0x0123); } - assertEquals(success, true, "weakCompareAndSwapVolatile short"); + assertEquals(success, true, "weakCompareAndSet short"); short x = UNSAFE.getShort(base, offset); - assertEquals(x, (short)0x0123, "weakCompareAndSwapVolatile short"); + assertEquals(x, (short)0x0123, "weakCompareAndSet short"); } UNSAFE.putShort(base, offset, (short)0x4567); @@ -324,4 +324,3 @@ } } } -
--- a/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestBoolean.java Fri May 12 15:14:16 2017 -0700 +++ b/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestBoolean.java Wed Jul 05 23:26:38 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -138,4 +138,3 @@ } } -
--- a/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestByte.java Fri May 12 15:14:16 2017 -0700 +++ b/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestByte.java Wed Jul 05 23:26:38 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -175,4 +175,3 @@ } } } -
--- a/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestChar.java Fri May 12 15:14:16 2017 -0700 +++ b/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestChar.java Wed Jul 05 23:26:38 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -175,4 +175,3 @@ } } } -
--- a/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestDouble.java Fri May 12 15:14:16 2017 -0700 +++ b/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestDouble.java Wed Jul 05 23:26:38 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -175,4 +175,3 @@ } } } -
--- a/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestFloat.java Fri May 12 15:14:16 2017 -0700 +++ b/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestFloat.java Wed Jul 05 23:26:38 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -175,4 +175,3 @@ } } } -
--- a/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestInt.java Fri May 12 15:14:16 2017 -0700 +++ b/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestInt.java Wed Jul 05 23:26:38 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -216,4 +216,3 @@ } } } -
--- a/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestLong.java Fri May 12 15:14:16 2017 -0700 +++ b/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestLong.java Wed Jul 05 23:26:38 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -216,4 +216,3 @@ } } } -
--- a/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestObject.java Fri May 12 15:14:16 2017 -0700 +++ b/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestObject.java Wed Jul 05 23:26:38 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -170,4 +170,3 @@ } } -
--- a/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestShort.java Fri May 12 15:14:16 2017 -0700 +++ b/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestShort.java Wed Jul 05 23:26:38 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -175,4 +175,3 @@ } } } -
--- a/hotspot/test/compiler/unsafe/X-UnsafeAccessTest.java.template Fri May 12 15:14:16 2017 -0700 +++ b/hotspot/test/compiler/unsafe/X-UnsafeAccessTest.java.template Wed Jul 05 23:26:38 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,7 +26,11 @@ * @bug 8143628 * @summary Test unsafe access for $type$ * +#if[JdkInternalMisc] + * @modules $module$/$package$:+open +#else[JdkInternalMisc] * @modules $module$/$package$ +#end[JdkInternalMisc] * @run testng/othervm -Diters=100 -Xint compiler.unsafe.$Qualifier$UnsafeAccessTest$Type$ * @run testng/othervm -Diters=20000 -XX:TieredStopAtLevel=1 compiler.unsafe.$Qualifier$UnsafeAccessTest$Type$ * @run testng/othervm -Diters=20000 -XX:-TieredCompilation compiler.unsafe.$Qualifier$UnsafeAccessTest$Type$ @@ -219,33 +223,51 @@ // Compare { +#if[JdkInternalMisc] + boolean r = UNSAFE.compareAndSet$Type$(base, offset, $value1$, $value2$); + assertEquals(r, true, "success compareAndSet $type$"); +#else[JdkInternalMisc] boolean r = UNSAFE.compareAndSwap$Type$(base, offset, $value1$, $value2$); assertEquals(r, true, "success compareAndSwap $type$"); +#end[JdkInternalMisc] $type$ x = UNSAFE.get$Type$(base, offset); +#if[JdkInternalMisc] + assertEquals(x, $value2$, "success compareAndSet $type$ value"); +#else[JdkInternalMisc] assertEquals(x, $value2$, "success compareAndSwap $type$ value"); +#end[JdkInternalMisc] } { +#if[JdkInternalMisc] + boolean r = UNSAFE.compareAndSet$Type$(base, offset, $value1$, $value3$); + assertEquals(r, false, "failing compareAndSet $type$"); +#else[JdkInternalMisc] boolean r = UNSAFE.compareAndSwap$Type$(base, offset, $value1$, $value3$); assertEquals(r, false, "failing compareAndSwap $type$"); +#end[JdkInternalMisc] $type$ x = UNSAFE.get$Type$(base, offset); +#if[JdkInternalMisc] + assertEquals(x, $value2$, "failing compareAndSet $type$ value"); +#else[JdkInternalMisc] assertEquals(x, $value2$, "failing compareAndSwap $type$ value"); +#end[JdkInternalMisc] } #if[JdkInternalMisc] // Advanced compare { - $type$ r = UNSAFE.compareAndExchange$Type$Volatile(base, offset, $value2$, $value1$); - assertEquals(r, $value2$, "success compareAndExchangeVolatile $type$"); + $type$ r = UNSAFE.compareAndExchange$Type$(base, offset, $value2$, $value1$); + assertEquals(r, $value2$, "success compareAndExchange $type$"); $type$ x = UNSAFE.get$Type$(base, offset); - assertEquals(x, $value1$, "success compareAndExchangeVolatile $type$ value"); + assertEquals(x, $value1$, "success compareAndExchange $type$ value"); } { - $type$ r = UNSAFE.compareAndExchange$Type$Volatile(base, offset, $value2$, $value3$); - assertEquals(r, $value1$, "failing compareAndExchangeVolatile $type$"); + $type$ r = UNSAFE.compareAndExchange$Type$(base, offset, $value2$, $value3$); + assertEquals(r, $value1$, "failing compareAndExchange $type$"); $type$ x = UNSAFE.get$Type$(base, offset); - assertEquals(x, $value1$, "failing compareAndExchangeVolatile $type$ value"); + assertEquals(x, $value1$, "failing compareAndExchange $type$ value"); } { @@ -279,41 +301,41 @@ { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = UNSAFE.weakCompareAndSwap$Type$(base, offset, $value1$, $value2$); + success = UNSAFE.weakCompareAndSet$Type$Plain(base, offset, $value1$, $value2$); } - assertEquals(success, true, "weakCompareAndSwap $type$"); + assertEquals(success, true, "weakCompareAndSetPlain $type$"); $type$ x = UNSAFE.get$Type$(base, offset); - assertEquals(x, $value2$, "weakCompareAndSwap $type$ value"); + assertEquals(x, $value2$, "weakCompareAndSetPlain $type$ value"); } { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = UNSAFE.weakCompareAndSwap$Type$Acquire(base, offset, $value2$, $value1$); + success = UNSAFE.weakCompareAndSet$Type$Acquire(base, offset, $value2$, $value1$); } - assertEquals(success, true, "weakCompareAndSwapAcquire $type$"); + assertEquals(success, true, "weakCompareAndSetAcquire $type$"); $type$ x = UNSAFE.get$Type$(base, offset); - assertEquals(x, $value1$, "weakCompareAndSwapAcquire $type$"); + assertEquals(x, $value1$, "weakCompareAndSetAcquire $type$"); } { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = UNSAFE.weakCompareAndSwap$Type$Release(base, offset, $value1$, $value2$); + success = UNSAFE.weakCompareAndSet$Type$Release(base, offset, $value1$, $value2$); } - assertEquals(success, true, "weakCompareAndSwapRelease $type$"); + assertEquals(success, true, "weakCompareAndSetRelease $type$"); $type$ x = UNSAFE.get$Type$(base, offset); - assertEquals(x, $value2$, "weakCompareAndSwapRelease $type$"); + assertEquals(x, $value2$, "weakCompareAndSetRelease $type$"); } { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = UNSAFE.weakCompareAndSwap$Type$Volatile(base, offset, $value2$, $value1$); + success = UNSAFE.weakCompareAndSet$Type$(base, offset, $value2$, $value1$); } - assertEquals(success, true, "weakCompareAndSwapVolatile $type$"); + assertEquals(success, true, "weakCompareAndSet $type$"); $type$ x = UNSAFE.get$Type$(base, offset); - assertEquals(x, $value1$, "weakCompareAndSwapVolatile $type$"); + assertEquals(x, $value1$, "weakCompareAndSet $type$"); } #end[JdkInternalMisc] @@ -354,4 +376,3 @@ #end[!boolean] #end[!Object] } -
--- a/hotspot/test/gc/class_unloading/TestClassUnloadingDisabled.java Fri May 12 15:14:16 2017 -0700 +++ b/hotspot/test/gc/class_unloading/TestClassUnloadingDisabled.java Wed Jul 05 23:26:38 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reqserved. + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it
--- a/hotspot/test/native/logging/test_logTagSetDescriptions.cpp Fri May 12 15:14:16 2017 -0700 +++ b/hotspot/test/native/logging/test_logTagSetDescriptions.cpp Wed Jul 05 23:26:38 2017 +0200 @@ -10,7 +10,7 @@ * 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 - * ac_heapanied this code). + * 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,
--- a/hotspot/test/native/memory/test_metachunk.cpp Fri May 12 15:14:16 2017 -0700 +++ b/hotspot/test/native/memory/test_metachunk.cpp Wed Jul 05 23:26:38 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it
--- a/hotspot/test/runtime/CommandLine/OptionsValidation/TestOptionsWithRangesDynamic.java Fri May 12 15:14:16 2017 -0700 +++ b/hotspot/test/runtime/CommandLine/OptionsValidation/TestOptionsWithRangesDynamic.java Wed Jul 05 23:26:38 2017 +0200 @@ -28,7 +28,7 @@ * @modules java.base/jdk.internal.misc * jdk.attach/sun.tools.attach * java.management - * @run main/othervm -XX:MinHeapFreeRatio=0 -XX:MaxHeapFreeRatio=100 TestOptionsWithRangesDynamic + * @run main/othervm -XX:MinHeapFreeRatio=0 -XX:MaxHeapFreeRatio=100 -Djdk.attach.allowAttachSelf TestOptionsWithRangesDynamic */ import java.util.List;
--- a/hotspot/test/runtime/CommandLine/PermGenFlagsTest.java Fri May 12 15:14:16 2017 -0700 +++ b/hotspot/test/runtime/CommandLine/PermGenFlagsTest.java Wed Jul 05 23:26:38 2017 +0200 @@ -8,7 +8,7 @@ * * 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 + * 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). *
--- a/hotspot/test/runtime/Metaspace/DefineClass.java Fri May 12 15:14:16 2017 -0700 +++ b/hotspot/test/runtime/Metaspace/DefineClass.java Wed Jul 05 23:26:38 2017 +0200 @@ -41,8 +41,8 @@ * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:-UnsyncloadClass -XX:-AllowParallelDefineClass test.DefineClass defineClassParallel - * @run main/othervm test.DefineClass redefineClass - * @run main/othervm test.DefineClass redefineClassWithError + * @run main/othervm -Djdk.attach.allowAttachSelf test.DefineClass redefineClass + * @run main/othervm -Djdk.attach.allowAttachSelf test.DefineClass redefineClassWithError * @author volker.simonis@gmail.com */
--- a/hotspot/test/runtime/logging/ModulesTest.java Fri May 12 15:14:16 2017 -0700 +++ b/hotspot/test/runtime/logging/ModulesTest.java Wed Jul 05 23:26:38 2017 +0200 @@ -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 @@ -23,7 +23,7 @@ /* * @test - * @summary modules=debug should have logging from statements in the code + * @summary -Xlog:module should emit logging output * @library /test/lib * @modules java.base/jdk.internal.misc * java.management @@ -35,9 +35,16 @@ public class ModulesTest { public static void main(String[] args) throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( - "-Xlog:modules=trace", "-version"); - OutputAnalyzer output = new OutputAnalyzer(pb.start()); + testModuleTrace("-Xlog:module=trace", "-version"); + testModuleLoad("-Xlog:module+load", "-version"); + testModuleUnload("-Xlog:module+unload", "-version"); + + // same as -Xlog:module+load -Xlog:module+unload + testModuleLoad("-verbose:module", "-version"); + } + + static void testModuleTrace(String... args) throws Exception { + OutputAnalyzer output = run(args); output.shouldContain("define_javabase_module(): Definition of module:"); output.shouldContain("define_javabase_module(): creation of package"); output.shouldContain("define_module(): creation of module"); @@ -48,5 +55,22 @@ output.shouldContain("Setting package: class:"); output.shouldHaveExitValue(0); } + + static void testModuleLoad(String... args) throws Exception { + OutputAnalyzer output = run(args); + output.shouldContain("java.base location:"); + output.shouldContain("java.management location:"); + output.shouldHaveExitValue(0); + } + + static void testModuleUnload(String... args) throws Exception { + OutputAnalyzer output = run(args); + output.shouldHaveExitValue(0); + } + + static OutputAnalyzer run(String... args) throws Exception { + ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(args); + return new OutputAnalyzer(pb.start()); + } }
--- a/hotspot/test/runtime/logging/StartupTimeTest.java Fri May 12 15:14:16 2017 -0700 +++ b/hotspot/test/runtime/logging/StartupTimeTest.java Wed Jul 05 23:26:38 2017 +0200 @@ -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 @@ -57,7 +57,7 @@ static void analyzeModulesOutputOff(ProcessBuilder pb) throws Exception { OutputAnalyzer output = new OutputAnalyzer(pb.start()); - output.shouldNotContain("[modules,startuptime]"); + output.shouldNotContain("[module,startuptime]"); output.shouldHaveExitValue(0); } @@ -70,11 +70,11 @@ InnerClass.class.getName()); analyzeOutputOff(pb); - pb = ProcessTools.createJavaProcessBuilder("-Xlog:startuptime+modules", + pb = ProcessTools.createJavaProcessBuilder("-Xlog:startuptime+module", InnerClass.class.getName()); analyzeModulesOutputOn(pb); - pb = ProcessTools.createJavaProcessBuilder("-Xlog:startuptime+modules=off", + pb = ProcessTools.createJavaProcessBuilder("-Xlog:startuptime+module=off", InnerClass.class.getName()); analyzeModulesOutputOff(pb); }
--- a/hotspot/test/runtime/logging/ThreadLoggingTest.java Fri May 12 15:14:16 2017 -0700 +++ b/hotspot/test/runtime/logging/ThreadLoggingTest.java Wed Jul 05 23:26:38 2017 +0200 @@ -9,7 +9,7 @@ * * 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 + * 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). *
--- a/hotspot/test/runtime/logging/p2/B.jcod Fri May 12 15:14:16 2017 -0700 +++ b/hotspot/test/runtime/logging/p2/B.jcod Wed Jul 05 23:26:38 2017 +0200 @@ -8,7 +8,7 @@ * * 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 + * 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). *
--- a/hotspot/test/runtime/modules/JVMAddModuleExports.java Fri May 12 15:14:16 2017 -0700 +++ b/hotspot/test/runtime/modules/JVMAddModuleExports.java Wed Jul 05 23:26:38 2017 +0200 @@ -41,12 +41,12 @@ MyClassLoader to_cl = new MyClassLoader(); Module from_module, to_module; - from_module = ModuleHelper.ModuleObject("from_module", from_cl, new String[] { "mypackage", "this/package" }); + from_module = ModuleHelper.ModuleObject("from_module", from_cl, new String[] { "mypackage", "x/apackage" }); assertNotNull(from_module, "Module should not be null"); - ModuleHelper.DefineModule(from_module, "9.0", "from_module/here", new String[] { "mypackage", "this/package" }); - to_module = ModuleHelper.ModuleObject("to_module", to_cl, new String[] { "yourpackage", "that/package" }); + ModuleHelper.DefineModule(from_module, "9.0", "from_module/here", new String[] { "mypackage", "x/apackage" }); + to_module = ModuleHelper.ModuleObject("to_module", to_cl, new String[] { "yourpackage", "that/apackage" }); assertNotNull(to_module, "Module should not be null"); - ModuleHelper.DefineModule(to_module, "9.0", "to_module/here", new String[] { "yourpackage", "that/package" }); + ModuleHelper.DefineModule(to_module, "9.0", "to_module/here", new String[] { "yourpackage", "that/apackage" }); // Null from_module argument, expect an NPE try { @@ -117,19 +117,19 @@ // Export a package, that is not in from_module, to from_module try { - ModuleHelper.AddModuleExports(from_module, "that/package", from_module); + ModuleHelper.AddModuleExports(from_module, "that/apackage", from_module); throw new RuntimeException("Failed to get the expected IAE"); } catch(IllegalArgumentException e) { // Expected } // Export the same package twice to the same module - ModuleHelper.AddModuleExports(from_module, "this/package", to_module); - ModuleHelper.AddModuleExports(from_module, "this/package", to_module); + ModuleHelper.AddModuleExports(from_module, "x/apackage", to_module); + ModuleHelper.AddModuleExports(from_module, "x/apackage", to_module); // Export a package, using '.' instead of '/' try { - ModuleHelper.AddModuleExports(from_module, "this.package", to_module); + ModuleHelper.AddModuleExports(from_module, "x.apackage", to_module); throw new RuntimeException("Failed to get the expected IAE"); } catch(IllegalArgumentException e) { // Expected @@ -137,8 +137,8 @@ // Export a package to the unnamed module and then to a specific module. // The qualified export should be ignored. - ModuleHelper.AddModuleExportsToAll(to_module, "that/package"); - ModuleHelper.AddModuleExports(to_module, "that/package", from_module); + ModuleHelper.AddModuleExportsToAll(to_module, "that/apackage"); + ModuleHelper.AddModuleExports(to_module, "that/apackage", from_module); } static class MyClassLoader extends ClassLoader { }
--- a/hotspot/test/runtime/modules/JVMAddModulePackage.java Fri May 12 15:14:16 2017 -0700 +++ b/hotspot/test/runtime/modules/JVMAddModulePackage.java Wed Jul 05 23:26:38 2017 +0200 @@ -49,16 +49,16 @@ module_two = ModuleHelper.ModuleObject("module_two", cl1, new String[] { "yourpackage" }); assertNotNull(module_two, "Module should not be null"); ModuleHelper.DefineModule(module_two, "9.0", "module_two/here", new String[] { "yourpackage" }); - module_three = ModuleHelper.ModuleObject("module_three", cl3, new String[] { "package/num3" }); + module_three = ModuleHelper.ModuleObject("module_three", cl3, new String[] { "apackage/num3" }); assertNotNull(module_three, "Module should not be null"); - ModuleHelper.DefineModule(module_three, "9.0", "module_three/here", new String[] { "package/num3" }); + ModuleHelper.DefineModule(module_three, "9.0", "module_three/here", new String[] { "apackage/num3" }); // Simple call ModuleHelper.AddModulePackage(module_one, "new_package"); // Add a package and export it - ModuleHelper.AddModulePackage(module_one, "package/num3"); - ModuleHelper.AddModuleExportsToAll(module_one, "package/num3"); + ModuleHelper.AddModulePackage(module_one, "apackage/num3"); + ModuleHelper.AddModuleExportsToAll(module_one, "apackage/num3"); // Null module argument, expect an NPE try { @@ -94,7 +94,7 @@ // Invalid package name, expect an IAE try { - ModuleHelper.AddModulePackage(module_one, "your.package"); + ModuleHelper.AddModulePackage(module_one, "your.apackage"); throw new RuntimeException("Failed to get the expected IAE"); } catch(IllegalArgumentException e) { // Expected @@ -102,7 +102,7 @@ // Invalid package name, expect an IAE try { - ModuleHelper.AddModulePackage(module_one, ";your/package"); + ModuleHelper.AddModulePackage(module_one, ";your/apackage"); throw new RuntimeException("Failed to get the expected IAE"); } catch(IllegalArgumentException e) { // Expected
--- a/hotspot/test/runtime/modules/JVMDefineModule.java Fri May 12 15:14:16 2017 -0700 +++ b/hotspot/test/runtime/modules/JVMDefineModule.java Wed Jul 05 23:26:38 2017 +0200 @@ -207,10 +207,10 @@ ModuleHelper.DefineModule(m, "9.0", "module.name/here", new String[] { }); // Invalid package name, expect an IAE - m = ModuleHelper.ModuleObject("moduleFive", cl, new String[] { "your.package" }); + m = ModuleHelper.ModuleObject("moduleFive", cl, new String[] { "your.apackage" }); try { - ModuleHelper.DefineModule(m, "9.0", "module.name/here", new String[] { "your.package" }); - throw new RuntimeException("Failed to get expected IAE for your.package"); + ModuleHelper.DefineModule(m, "9.0", "module.name/here", new String[] { "your.apackage" }); + throw new RuntimeException("Failed to get expected IAE for your.apackage"); } catch(IllegalArgumentException e) { if (!e.getMessage().contains("Invalid package name")) { throw new RuntimeException("Failed to get expected IAE message for bad package name: " + e.getMessage()); @@ -220,8 +220,8 @@ // Invalid package name, expect an IAE m = ModuleHelper.ModuleObject("moduleSix", cl, new String[] { "foo" }); // Name irrelevant try { - ModuleHelper.DefineModule(m, "9.0", "module.name/here", new String[] { ";your/package" }); - throw new RuntimeException("Failed to get expected IAE for ;your.package"); + ModuleHelper.DefineModule(m, "9.0", "module.name/here", new String[] { ";your/apackage" }); + throw new RuntimeException("Failed to get expected IAE for ;your.apackage"); } catch(IllegalArgumentException e) { if (!e.getMessage().contains("Invalid package name")) { throw new RuntimeException("Failed to get expected IAE message for bad package name: " + e.getMessage());
--- a/hotspot/test/runtime/modules/ModuleStress/ModuleStress.java Fri May 12 15:14:16 2017 -0700 +++ b/hotspot/test/runtime/modules/ModuleStress/ModuleStress.java Wed Jul 05 23:26:38 2017 +0200 @@ -53,7 +53,7 @@ // those loaders never die. ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( "-Xbootclasspath/a:.", - "-Xlog:modules=trace", + "-Xlog:module=trace", "-version"); OutputAnalyzer oa = new OutputAnalyzer(pb.start()); @@ -88,7 +88,7 @@ // the same loader and thus have the exact same life cycle. pb = ProcessTools.createJavaProcessBuilder( "-Xbootclasspath/a:.", - "-Xlog:modules=trace", + "-Xlog:module=trace", "ModuleSameCLMain"); oa = new OutputAnalyzer(pb.start()); @@ -102,7 +102,7 @@ // class loaders which could die and thus be unloaded. pb = ProcessTools.createJavaProcessBuilder( "-Xbootclasspath/a:.", - "-Xlog:modules=trace", + "-Xlog:module=trace", "ModuleNonBuiltinCLMain"); oa = new OutputAnalyzer(pb.start()); @@ -120,7 +120,7 @@ pb = ProcessTools.createJavaProcessBuilder( "-Djava.system.class.loader=CustomSystemClassLoader", "-Xbootclasspath/a:.", - "-Xlog:modules=trace", + "-Xlog:module=trace", "ModuleNonBuiltinCLMain"); oa = new OutputAnalyzer(pb.start());
--- a/hotspot/test/runtime/modules/ModuleStress/ModuleStressGC.java Fri May 12 15:14:16 2017 -0700 +++ b/hotspot/test/runtime/modules/ModuleStress/ModuleStressGC.java Wed Jul 05 23:26:38 2017 +0200 @@ -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 @@ -73,7 +73,7 @@ // test's, defined to module jdk.translet, export list at // GC safepoints. ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( - "-Xlog:modules=trace", + "-Xlog:module=trace", "-p", MODS_DIR.toString(), "-m", "jdk.test/test.MainGC"); OutputAnalyzer oa = new OutputAnalyzer(pb.start());
--- a/hotspot/test/testlibrary/ctw/Makefile Fri May 12 15:14:16 2017 -0700 +++ b/hotspot/test/testlibrary/ctw/Makefile Wed Jul 05 23:26:38 2017 +0200 @@ -1,5 +1,5 @@ # -# Copyright (c) 2013, 2016. Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it
--- a/jaxp/.hgtags Fri May 12 15:14:16 2017 -0700 +++ b/jaxp/.hgtags Wed Jul 05 23:26:38 2017 +0200 @@ -418,3 +418,4 @@ 26ed5e84fa13b8dca066b01ece5bc029323611be jdk-10+6 646567dcfa64b9a39b33d71330427737d1c1a0d5 jdk-9+167 23a87f409371fb8ce7b764cccb3a74c3f6b29900 jdk-9+168 +5d9d2a65fb26aa183019346c11d9314819621665 jdk-9+169
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/XPathParser.java Fri May 12 15:14:16 2017 -0700 +++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/XPathParser.java Wed Jul 05 23:26:38 2017 +0200 @@ -1,8 +1,27 @@ - -//---------------------------------------------------- -// The following code was generated by CUP v0.10j -// Thu Oct 06 10:09:26 PDT 2005 -//---------------------------------------------------- +/* + * Copyright (c) 2005, 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.org.apache.xalan.internal.xsltc.compiler; @@ -16,8 +35,10 @@ import com.sun.org.apache.xalan.internal.xsltc.runtime.Operators; import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ErrorMsg; -/** CUP v0.10j generated parser. - */ +/** + * CUP v0.10j generated parser. + * This class was generated by CUP v0.10j on Thu Oct 06 10:09:26 PDT 2005. + */ public class XPathParser extends com.sun.java_cup.internal.runtime.lr_parser { /** Default constructor. */
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/sym.java Fri May 12 15:14:16 2017 -0700 +++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/sym.java Wed Jul 05 23:26:38 2017 +0200 @@ -1,12 +1,34 @@ - -//---------------------------------------------------- -// The following code was generated by CUP v0.10j -// Fri Feb 27 13:01:50 PST 2004 -//---------------------------------------------------- +/* + * Copyright (c) 2004, 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.org.apache.xalan.internal.xsltc.compiler; -/** CUP generated class containing symbol constants. */ +/** + * CUP generated class containing symbol constants. + * This class was generated by CUP v0.10j on Fri Feb 27 13:01:50 PST 2004. + */ public class sym { /* terminals */ public static final int Literal = 26;
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/xs/traversers/XSAttributeChecker.java Fri May 12 15:14:16 2017 -0700 +++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/xs/traversers/XSAttributeChecker.java Wed Jul 05 23:26:38 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/xinclude/XPointerElementHandler.java Fri May 12 15:14:16 2017 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,724 +0,0 @@ -/* - * reserved comment block - * DO NOT REMOVE OR ALTER! - */ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.sun.org.apache.xerces.internal.xinclude; - - -import java.util.Enumeration; -import java.util.StringTokenizer; -import java.util.Stack; - -import com.sun.org.apache.xerces.internal.impl.Constants; -import com.sun.org.apache.xerces.internal.impl.XMLErrorReporter; -import com.sun.org.apache.xerces.internal.impl.dtd.DTDGrammar; -import com.sun.org.apache.xerces.internal.util.ParserConfigurationSettings; -import com.sun.org.apache.xerces.internal.xni.Augmentations; -import com.sun.org.apache.xerces.internal.xni.NamespaceContext; -import com.sun.org.apache.xerces.internal.xni.QName; -import com.sun.org.apache.xerces.internal.xni.XMLAttributes; -import com.sun.org.apache.xerces.internal.xni.XMLDocumentHandler; -import com.sun.org.apache.xerces.internal.xni.XMLLocator; -import com.sun.org.apache.xerces.internal.xni.XMLResourceIdentifier; -import com.sun.org.apache.xerces.internal.xni.XMLString; -import com.sun.org.apache.xerces.internal.xni.XNIException; -import com.sun.org.apache.xerces.internal.xni.grammars.XMLGrammarDescription; -import com.sun.org.apache.xerces.internal.xni.grammars.XMLGrammarPool; -import com.sun.org.apache.xerces.internal.xni.parser.XMLComponentManager; -import com.sun.org.apache.xerces.internal.xni.parser.XMLConfigurationException; -import com.sun.org.apache.xerces.internal.xni.parser.XMLDocumentSource; -import com.sun.org.apache.xerces.internal.xni.parser.XMLEntityResolver; -import com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator; -/** - * @author Arun Yadav, Sun Microsystem - */ -public class XPointerElementHandler implements XPointerSchema { - - - // recognized features and properties - - /** Property identifier: error handler. */ - protected static final String ERROR_REPORTER = - Constants.XERCES_PROPERTY_PREFIX + Constants.ERROR_REPORTER_PROPERTY; - - /** Property identifier: grammar pool . */ - protected static final String GRAMMAR_POOL = - Constants.XERCES_PROPERTY_PREFIX + Constants.XMLGRAMMAR_POOL_PROPERTY; - - /** Property identifier: grammar pool . */ - protected static final String ENTITY_RESOLVER = - Constants.XERCES_PROPERTY_PREFIX + Constants.ENTITY_RESOLVER_PROPERTY; - - protected static final String XPOINTER_SCHEMA = - Constants.XERCES_PROPERTY_PREFIX + Constants.XPOINTER_SCHEMA_PROPERTY; - - /** Recognized features. */ - private static final String[] RECOGNIZED_FEATURES = { - }; - - /** Feature defaults. */ - private static final Boolean[] FEATURE_DEFAULTS = { - }; - - /** Recognized properties. */ - - private static final String[] RECOGNIZED_PROPERTIES = - { ERROR_REPORTER, GRAMMAR_POOL, ENTITY_RESOLVER, XPOINTER_SCHEMA }; - - /** Property defaults. */ - private static final Object[] PROPERTY_DEFAULTS = { null, null, null,null }; - - // Data - - protected XMLDocumentHandler fDocumentHandler; - protected XMLDocumentSource fDocumentSource; - - protected XIncludeHandler fParentXIncludeHandler; - - protected XMLLocator fDocLocation; - protected XIncludeNamespaceSupport fNamespaceContext; - protected XMLErrorReporter fErrorReporter; - protected XMLGrammarPool fGrammarPool; - protected XMLGrammarDescription fGrammarDesc; - protected DTDGrammar fDTDGrammar; - protected XMLEntityResolver fEntityResolver; - protected ParserConfigurationSettings fSettings; - //protected String fPointerSchema; - protected StringBuffer fPointer; - private int elemCount = 0; - - - // The current element depth. - // This is used to access the appropriate level of the following stacks. - private int fDepth; - - // The depth of the first element to actually be part of the result infoset. - // This will normally be 1, but it could be larger when the top-level item - // is an include, and processing goes to the fallback. - private int fRootDepth; - - // this value must be at least 1 - private static final int INITIAL_SIZE = 8; - - - // Used to ensure that fallbacks are always children of include elements, - // and that include elements are never children of other include elements. - // An index contains true if the ancestor of the current element which resides - // at that depth was an include element. - private boolean[] fSawInclude = new boolean[INITIAL_SIZE]; - - - // Ensures that only one fallback element can be at a single depth. - // An index contains true if we have seen any fallback elements at that depth, - // and it is only reset to false when the end tag of the parent is encountered. - private boolean[] fSawFallback = new boolean[INITIAL_SIZE]; - - - // The state of the processor at each given depth. - private int[] fState = new int[INITIAL_SIZE]; - - QName foundElement = null; - boolean skip = false; - // Constructors - - public XPointerElementHandler() { - - - fDepth = 0; - fRootDepth = 0; - fSawFallback[fDepth] = false; - fSawInclude[fDepth] = false; - fSchemaName="element"; - - - } - - // START OF IMPLEMENTATION OF XMLComponent methods ////// - - public void reset(){ - elemCount =0; - fPointerToken = null; - fCurrentTokenint=0; - fCurrentTokenString=null; - fCurrentTokenType=0 ; - fElementCount =0; - fCurrentToken =0; - includeElement = false; - foundElement = null; - skip = false; - fSubResourceIdentified=false; - } - - public void reset(XMLComponentManager componentManager) - throws XNIException { - fNamespaceContext = null; - elemCount =0; - fDepth = 0; - fRootDepth = 0; - fPointerToken = null; - fCurrentTokenint=0; - fCurrentTokenString=null; - fCurrentTokenType=0 ; - foundElement = null; - includeElement = false; - skip = false; - fSubResourceIdentified=false; - - - - - try { - setErrorReporter( - (XMLErrorReporter)componentManager.getProperty(ERROR_REPORTER)); - } - catch (XMLConfigurationException e) { - fErrorReporter = null; - } - try { - fGrammarPool = - (XMLGrammarPool)componentManager.getProperty(GRAMMAR_POOL); - } - catch (XMLConfigurationException e) { - fGrammarPool = null; - } - try { - fEntityResolver = - (XMLEntityResolver)componentManager.getProperty( - ENTITY_RESOLVER); - } - catch (XMLConfigurationException e) { - fEntityResolver = null; - } - - fSettings = new ParserConfigurationSettings(); - - Enumeration xercesFeatures = Constants.getXercesFeatures(); - while (xercesFeatures.hasMoreElements()) { - String featureId = (String)xercesFeatures.nextElement(); - fSettings.addRecognizedFeatures(new String[] { featureId }); - try { - fSettings.setFeature( - featureId, - componentManager.getFeature(featureId)); - } - catch (XMLConfigurationException e) { - // componentManager doesn't support this feature, - // so we won't worry about it - } - } -/* try{ - dtdValidator = (XMLDTDValidator)componentManager.getProperty( Constants.XERCES_PROPERTY_PREFIX + Constants.DTD_VALIDATOR_PROPERTY); - }Catch(Exception ex){ - ex.printStackTrace(); - }*/ - - } // reset(XMLComponentManager) - - /** - * Returns a list of feature identifiers that are recognized by - * this component. This method may return null if no features - * are recognized by this component. - */ - public String[] getRecognizedFeatures() { - return RECOGNIZED_FEATURES; - } // getRecognizedFeatures():String[] - - /** - * Sets the state of a feature. This method is called by the component - * manager any time after reset when a feature changes state. - * <p> - * <strong>Note:</strong> Components should silently ignore features - * that do not affect the operation of the component. - * - * @param featureId The feature identifier. - * @param state The state of the feature. - * - * @throws SAXNotRecognizedException The component should not throw - * this exception. - * @throws SAXNotSupportedException The component should not throw - * this exception. - */ - public void setFeature(String featureId, boolean state) - throws XMLConfigurationException { - if (fSettings != null) { - fSettings.setFeature(featureId, state); - } - - } // setFeature(String,boolean) - - /** - * Returns a list of property identifiers that are recognized by - * this component. This method may return null if no properties - * are recognized by this component. - */ - public String[] getRecognizedProperties() { - return RECOGNIZED_PROPERTIES; - } // getRecognizedProperties():String[] - - /** - * Sets the value of a property. This method is called by the component - * manager any time after reset when a property changes value. - * <p> - * <strong>Note:</strong> Components should silently ignore properties - * that do not affect the operation of the component. - * - * @param propertyId The property identifier. - * @param value The value of the property. - * - * @throws SAXNotRecognizedException The component should not throw - * this exception. - * @throws SAXNotSupportedException The component should not throw - * this exception. - */ - public void setProperty(String propertyId, Object value) - throws XMLConfigurationException { - if (propertyId.equals(ERROR_REPORTER)) { - setErrorReporter((XMLErrorReporter)value); - } - if (propertyId.equals(GRAMMAR_POOL)) { - fGrammarPool = (XMLGrammarPool)value; - } - if (propertyId.equals(ENTITY_RESOLVER)) { - fEntityResolver = (XMLEntityResolver)value; - } - - } // setProperty(String,Object) - - /** - * Returns the default state for a feature, or null if this - * component does not want to report a default value for this - * feature. - * - * @param featureId The feature identifier. - * - * @since Xerces 2.2.0 - */ - public Boolean getFeatureDefault(String featureId) { - for (int i = 0; i < RECOGNIZED_FEATURES.length; i++) { - if (RECOGNIZED_FEATURES[i].equals(featureId)) { - return FEATURE_DEFAULTS[i]; - } - } - return null; - } // getFeatureDefault(String):Boolean - - /** - * Returns the default state for a property, or null if this - * component does not want to report a default value for this - * property. - * - * @param propertyId The property identifier. - * - * @since Xerces 2.2.0 - */ - public Object getPropertyDefault(String propertyId) { - for (int i = 0; i < RECOGNIZED_PROPERTIES.length; i++) { - if (RECOGNIZED_PROPERTIES[i].equals(propertyId)) { - return PROPERTY_DEFAULTS[i]; - } - } - return null; - } // getPropertyDefault(String):Object - - private void setErrorReporter(XMLErrorReporter reporter) { - fErrorReporter = reporter; - if (fErrorReporter != null) { - fErrorReporter.putMessageFormatter( - XIncludeMessageFormatter.XINCLUDE_DOMAIN, - new XIncludeMessageFormatter()); - } - } - ///////// END OF IMPLEMENTATION OF XMLComponents methods. ////////// - - - - //////// START OF IMPLEMENTATION OF XMLDOCUMENTSOURCE INTERFACE ///////// - - public void setDocumentHandler(XMLDocumentHandler handler) { - fDocumentHandler = handler; - } - - public XMLDocumentHandler getDocumentHandler() { - return fDocumentHandler; - } - - /////// END OF IMPLENTATION OF XMLDOCUMENTSOURCE INTERFACE /////////// - - - - - /////////////// Implementation of XPointerSchema Methods ////////////////////// - - String fSchemaName; - String fSchemaPointer; - boolean fSubResourceIdentified; - /** - * set the Schema Name eg element , xpointer - */ - public void setXPointerSchemaName(String schemaName){ - fSchemaName = schemaName; - } - - /** - * Return Schema Name eg element , xpointer - * - */ - public String getXpointerSchemaName(){ - return fSchemaName; - } - - /** - * Parent Contenhandler for the this contenthandler. - * // not sure about the parameter type. It can be Contenthandler instead of Object type. - */ - public void setParent(Object parent){ - fParentXIncludeHandler = (XIncludeHandler)parent; - } - - - /** - * return the Parent Contenthandler - */ - public Object getParent(){ - return fParentXIncludeHandler; - } - - /** - * Content of the XPointer Schema. Xpath to be resolved. - */ - public void setXPointerSchemaPointer(String content){ - fSchemaPointer = content; - } - - /** - * Return the XPointer Schema. - */ - public String getXPointerSchemaPointer(){ - return fSchemaPointer; - } - - public boolean isSubResourceIndentified(){ - return fSubResourceIdentified; - } - - ///////////End Implementation of XPointerSchema Methods ////////////////////// - - - - //////////// Tokens Playground /////////////////// - - Stack fPointerToken = new Stack(); - int fCurrentTokenint=0; - String fCurrentTokenString=null; - int fCurrentTokenType=0 ;// 0 Notype; 1 for integer; 2 for string. - - public void getTokens(){ - fSchemaPointer = fSchemaPointer.substring(fSchemaPointer.indexOf("(")+1, fSchemaPointer.length()); - StringTokenizer st = new StringTokenizer(fSchemaPointer, "/"); - String tempToken; - Integer integerToken =null; - Stack tempPointerToken = new Stack(); - if(fPointerToken == null){ - fPointerToken = new Stack(); - } - while(st.hasMoreTokens()){ - tempToken=st.nextToken(); - try { - integerToken = Integer.valueOf(tempToken); - tempPointerToken.push(integerToken); - }catch(NumberFormatException e){ - tempPointerToken.push(tempToken); - } - } - while(!tempPointerToken.empty()){ - fPointerToken.push(tempPointerToken.pop()); - } - }//getTokens - - - public boolean hasMoreToken(){ - if(fPointerToken.isEmpty()) - return false; - else - return true; - } - - public boolean getNextToken(){ - Object currentToken; - if (!fPointerToken.isEmpty()){ - currentToken = fPointerToken.pop(); - if(currentToken instanceof Integer){ - fCurrentTokenint = ((Integer)currentToken).intValue(); - fCurrentTokenType = 1; - } - else{ - fCurrentTokenString = ((String)currentToken).toString(); - fCurrentTokenType = 2; - } - return true; - } - else { - return false; - } - } - - private boolean isIdAttribute(XMLAttributes attributes,Augmentations augs, int index) { - Object o = augs.getItem(Constants.ID_ATTRIBUTE); - if( o instanceof Boolean ) - return ((Boolean)o).booleanValue(); - return "ID".equals(attributes.getType(index)); - } - - public boolean checkStringToken(QName element, XMLAttributes attributes){ - QName cacheQName = null; - String id =null; - String rawname =null; - QName attrName = new QName(); - String attrType = null; - String attrValue = null; - int attrCount = attributes.getLength(); - for (int i = 0; i < attrCount; i++) { - Augmentations aaugs = attributes.getAugmentations(i); - attributes.getName(i,attrName); - attrType = attributes.getType(i); - attrValue = attributes.getValue(i); - if(attrType != null && attrValue!= null && isIdAttribute(attributes,aaugs,i) && attrValue.equals(fCurrentTokenString)){ - if(hasMoreToken()){ - fCurrentTokenType = 0; - fCurrentTokenString = null; - return true; - } - else{ - foundElement = element; - includeElement = true; - fCurrentTokenType = 0; - fCurrentTokenString = null; - fSubResourceIdentified = true; - return true; - } - } - } - return false; - } - - public boolean checkIntegerToken(QName element){ - if(!skip){ - fElementCount++; - if(fCurrentTokenint == fElementCount){ - if(hasMoreToken()){ - fElementCount=0; - fCurrentTokenType = 0; - return true; - } - else{ - foundElement = element; - includeElement = true; - fCurrentTokenType = 0; - fElementCount=0; - fSubResourceIdentified =true; - return true; - } - }else{ - addQName(element); - skip = true; - return false; - } - } - return false; - } - - public void addQName(QName element){ - QName cacheQName = new QName(element); - ftempCurrentElement.push(cacheQName); - } - - /////////// END TOKEN PLAYGROUND /////////////// - - - ///// START OF IMPLEMTATION OF XMLDocumentHandler methods ////////// - - - public void startDocument(XMLLocator locator, String encoding, - NamespaceContext namespaceContext, Augmentations augs) - throws XNIException { - - getTokens(); - } - - public void doctypeDecl(String rootElement, String publicId, String systemId, - Augmentations augs)throws XNIException { - } - - public void xmlDecl(String version, String encoding, String standalone, - Augmentations augs) throws XNIException { - } - - - public void comment(XMLString text, Augmentations augs) - throws XNIException { - if (fDocumentHandler != null && includeElement) { - fDocumentHandler.comment(text, augs); - } - } - - public void processingInstruction(String target, XMLString data, - Augmentations augs) throws XNIException { - if (fDocumentHandler != null && includeElement) { - fDocumentHandler.processingInstruction(target, data, augs); - - } - } - - Stack ftempCurrentElement = new Stack(); - int fElementCount =0; - int fCurrentToken ; - boolean includeElement; - - - public void startElement(QName element, XMLAttributes attributes, - Augmentations augs)throws XNIException { - - boolean requiredToken=false; - if(fCurrentTokenType == 0) - getNextToken(); - if(fCurrentTokenType ==1) - requiredToken = checkIntegerToken(element); - else if (fCurrentTokenType ==2) - requiredToken = checkStringToken(element, attributes); - if(requiredToken && hasMoreToken()) - getNextToken(); - if(fDocumentHandler != null && includeElement){ - elemCount++; - fDocumentHandler.startElement(element, attributes, augs); - } - - } - - - public void endElement(QName element, Augmentations augs) - throws XNIException { - if(includeElement && foundElement != null ){ - if(elemCount >0 )elemCount --; - fDocumentHandler.endElement(element, augs); - if(elemCount == 0)includeElement = false; - - }else if(!ftempCurrentElement.empty()){ - QName name = (QName)ftempCurrentElement.peek(); - if(name.equals(element)){ - ftempCurrentElement.pop(); - skip = false; - } - } - } - - public void emptyElement(QName element, XMLAttributes attributes, - Augmentations augs)throws XNIException { - if(fDocumentHandler != null && includeElement){ - fDocumentHandler.emptyElement(element, attributes, augs); - } - } - - public void startGeneralEntity(String name, XMLResourceIdentifier resId, - String encoding, - Augmentations augs) - throws XNIException { - if (fDocumentHandler != null && includeElement) { - fDocumentHandler.startGeneralEntity(name, resId, encoding, augs); - } - } - - public void textDecl(String version, String encoding, Augmentations augs) - throws XNIException { - if (fDocumentHandler != null && includeElement) { - fDocumentHandler.textDecl(version, encoding, augs); - } - } - - public void endGeneralEntity(String name, Augmentations augs) - throws XNIException { - if (fDocumentHandler != null) { - fDocumentHandler.endGeneralEntity(name, augs); - } - } - - public void characters(XMLString text, Augmentations augs) - throws XNIException { - if (fDocumentHandler != null && includeElement) { - fDocumentHandler.characters(text, augs); - } - } - - public void ignorableWhitespace(XMLString text, Augmentations augs) - throws XNIException { - if (fDocumentHandler != null && includeElement) { - fDocumentHandler.ignorableWhitespace(text, augs); - } - } - - public void startCDATA(Augmentations augs) throws XNIException { - if (fDocumentHandler != null && includeElement) { - fDocumentHandler.startCDATA(augs); - } - } - - public void endCDATA(Augmentations augs) throws XNIException { - if (fDocumentHandler != null && includeElement) { - fDocumentHandler.endCDATA(augs); - } - } - - public void endDocument(Augmentations augs) throws XNIException { - } - - public void setDocumentSource(XMLDocumentSource source) { - fDocumentSource = source; - } - - public XMLDocumentSource getDocumentSource() { - return fDocumentSource; - } - - - protected void reportFatalError(String key) { - this.reportFatalError(key, null); - } - - protected void reportFatalError(String key, Object[] args) { - if (fErrorReporter != null) { - fErrorReporter.reportError( - fDocLocation, - XIncludeMessageFormatter.XINCLUDE_DOMAIN, - key, - args, - XMLErrorReporter.SEVERITY_FATAL_ERROR); - } - // we won't worry about when error reporter is null, since there should always be - // at least the default error reporter - } - - - - // used to know whether to pass declarations to the document handler - protected boolean isRootDocument() { - return this.fParentXIncludeHandler == null; - } - - -} // class XPointerElementhandler
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/xinclude/XPointerFramework.java Fri May 12 15:14:16 2017 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,170 +0,0 @@ -/* - * reserved comment block - * DO NOT REMOVE OR ALTER! - */ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.sun.org.apache.xerces.internal.xinclude; - -import java.util.Stack; -import com.sun.org.apache.xerces.internal.xinclude.XPointerSchema; - -public class XPointerFramework{ - - /* - Todo's by next integration. - While constructing schema names and uris use a dynamic datastructure. - */ - - XPointerSchema [] fXPointerSchema; - String [] fSchemaPointerName; - String [] fSchemaPointerURI; - String fSchemaPointer; - String fCurrentSchemaPointer; - Stack fSchemaNotAvailable; - int fCountSchemaName = 0; - int schemaLength = 0; - XPointerSchema fDefaultXPointerSchema; - - public XPointerFramework(){ - this(null); - } - - public XPointerFramework(XPointerSchema [] xpointerschema){ - fXPointerSchema = xpointerschema; - fSchemaNotAvailable = new Stack(); - } - - public void reset(){ - fXPointerSchema = null; - fXPointerSchema = null; - fCountSchemaName = 0; - schemaLength = 0; - fSchemaPointerName = null; - fSchemaPointerURI = null; - fDefaultXPointerSchema = null; - fCurrentSchemaPointer = null; - } - - public void setXPointerSchema(XPointerSchema [] xpointerschema){ - fXPointerSchema = xpointerschema; - } - - public void setSchemaPointer(String schemaPointer){ - fSchemaPointer = schemaPointer; - } - - public XPointerSchema getNextXPointerSchema(){ - int i=fCountSchemaName; - if(fSchemaPointerName == null){ - getSchemaNames(); - } - if(fDefaultXPointerSchema == null){ - getDefaultSchema(); - } - if(fDefaultXPointerSchema.getXpointerSchemaName().equalsIgnoreCase(fSchemaPointerName[i])){ - fDefaultXPointerSchema.reset(); - fDefaultXPointerSchema.setXPointerSchemaPointer(fSchemaPointerURI[i]); - fCountSchemaName = ++i; - return getDefaultSchema(); - } - if(fXPointerSchema == null){ - fCountSchemaName = ++i; - return null; - } - - int fschemalength = fXPointerSchema.length; - - for(;fSchemaPointerName[i] != null; i++){ - for(int j=0; j<fschemalength; j++ ){ - if(fSchemaPointerName[i].equalsIgnoreCase(fXPointerSchema[j].getXpointerSchemaName())){ - fXPointerSchema[j].setXPointerSchemaPointer(fSchemaPointerURI[i]); - fCountSchemaName = ++i; - return fXPointerSchema[j]; - } - } - - if(fSchemaNotAvailable == null) - fSchemaNotAvailable = new Stack(); - - fSchemaNotAvailable.push(fSchemaPointerName[i]); - } - return null; - } - - public XPointerSchema getDefaultSchema(){ - if(fDefaultXPointerSchema == null) - fDefaultXPointerSchema = new XPointerElementHandler(); - return fDefaultXPointerSchema; - } - - public void getSchemaNames(){ - int count =0; - int index =0, lastindex =0; - int schemapointerindex =0, schemapointerURIindex=0; - char c; - int length = fSchemaPointer.length(); - fSchemaPointerName = new String [5]; - fSchemaPointerURI = new String [5]; - - index = fSchemaPointer.indexOf('('); - if( index <= 0) - return; - - fSchemaPointerName[schemapointerindex++] = fSchemaPointer.substring(0, index++).trim(); - lastindex = index; - String tempURI = null; - count++; - - while(index < length){ - c = fSchemaPointer.charAt(index); - if(c == '(') - count++; - if(c == ')') - count--; - if(count==0 ){ - tempURI = fSchemaPointer.substring(lastindex, index).trim(); - fSchemaPointerURI[schemapointerURIindex++] = getEscapedURI(tempURI); - lastindex = index; - if((index = fSchemaPointer.indexOf('(', lastindex)) != -1){ - fSchemaPointerName[schemapointerindex++] = fSchemaPointer.substring(lastindex+1, index).trim(); - count++; - lastindex = index+1; - } - else{ - index = lastindex; - } - } - index++; - } - schemaLength = schemapointerURIindex -1; - } - - public String getEscapedURI(String URI){ - return URI; - } - - public int getSchemaCount(){ - return schemaLength; - } - - public int getCurrentPointer(){ - return fCountSchemaName; - } - -}//XPointerFramwork
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/xinclude/XPointerSchema.java Fri May 12 15:14:16 2017 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,45 +0,0 @@ -package com.sun.org.apache.xerces.internal.xinclude; -import com.sun.org.apache.xerces.internal.xni.parser.XMLComponent; -import com.sun.org.apache.xerces.internal.xni.parser.XMLDocumentFilter; - - - -public interface XPointerSchema extends XMLComponent, XMLDocumentFilter{ - - /** - * set the Schema Name eg element , xpointer - */ - public void setXPointerSchemaName(String schemaName); - - /** - * Return Schema Name eg element , xpointer - * - */ - public String getXpointerSchemaName(); - - /** - * Parent Contenhandler for the this contenthandler. - * // not sure about the parameter type. It can be Contenthandler instead of Object type. - */ - public void setParent(Object parent); - - /** - * return the Parent Contenthandler - */ - public Object getParent(); - - /** - * Content of the XPointer Schema. Xpath to be resolved. - */ - public void setXPointerSchemaPointer(String content); - - /** - * Return the XPointer Schema. - */ - public String getXPointerSchemaPointer(); - - public boolean isSubResourceIndentified(); - - public void reset(); - -}
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/ToHTMLStream.java Fri May 12 15:14:16 2017 -0700 +++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/ToHTMLStream.java Wed Jul 05 23:26:38 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2016 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/ToXMLStream.java Fri May 12 15:14:16 2017 -0700 +++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/ToXMLStream.java Wed Jul 05 23:26:38 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2016 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/dom3/DOM3TreeWalker.java Fri May 12 15:14:16 2017 -0700 +++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/dom3/DOM3TreeWalker.java Wed Jul 05 23:26:38 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2016 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more
--- a/jaxp/test/TEST.ROOT Fri May 12 15:14:16 2017 -0700 +++ b/jaxp/test/TEST.ROOT Wed Jul 05 23:26:38 2017 +0200 @@ -25,6 +25,10 @@ # Minimum jtreg version requiredVersion=4.2 b07 +# Path to libraries in the topmost test directory. This is needed so @library +# does not need ../../ notation to reach them +external.lib.roots = ../../ + # Use new module options useNewOptions=true
--- a/jaxp/test/javax/xml/jaxp/libs/jdk/testlibrary/Asserts.java Fri May 12 15:14:16 2017 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,566 +0,0 @@ -/* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package jdk.testlibrary; - -import java.util.Objects; - -/** - * Asserts that can be used for verifying assumptions in tests. - * - * An assertion will throw a {@link RuntimeException} if the assertion isn't true. - * All the asserts can be imported into a test by using a static import: - * - * <pre> - * {@code - * import static jdk.testlibrary.Asserts.*; - * } - * - * Always provide a message describing the assumption if the line number of the - * failing assertion isn't enough to understand why the assumption failed. For - * example, if the assertion is in a loop or in a method that is called - * multiple times, then the line number won't provide enough context to - * understand the failure. - * </pre> - * - * @deprecated This class is deprecated. Use the one from - * {@code <root>/test/lib/share/classes/jdk/test/lib} - */ -@Deprecated -public class Asserts { - - /** - * Shorthand for {@link #assertLessThan(Comparable, Comparable)}. - * - * @param <T> a type - * @param lhs The left hand side of the comparison. - * @param rhs The right hand side of the comparison. - * @see #assertLessThan(Comparable, Comparable) - */ - public static <T extends Comparable<T>> void assertLT(T lhs, T rhs) { - assertLessThan(lhs, rhs); - } - - /** - * Shorthand for {@link #assertLessThan(Comparable, Comparable, String)}. - * - * @param <T> a type - * @param lhs The left hand side of the comparison. - * @param rhs The right hand side of the comparison. - * @param msg A description of the assumption; {@code null} for a default message. - * @see #assertLessThan(Comparable, Comparable, String) - */ - public static <T extends Comparable<T>> void assertLT(T lhs, T rhs, String msg) { - assertLessThan(lhs, rhs, msg); - } - - /** - * Calls {@link #assertLessThan(Comparable, Comparable, String)} with a default message. - * - * @param <T> a type - * @param lhs The left hand side of the comparison. - * @param rhs The right hand side of the comparison. - * @see #assertLessThan(Comparable, Comparable, String) - */ - public static <T extends Comparable<T>> void assertLessThan(T lhs, T rhs) { - assertLessThan(lhs, rhs, null); - } - - /** - * Asserts that {@code lhs} is less than {@code rhs}. - * - * @param <T> a type - * @param lhs The left hand side of the comparison. - * @param rhs The right hand side of the comparison. - * @param msg A description of the assumption; {@code null} for a default message. - * @throws RuntimeException if the assertion is not true. - */ - public static <T extends Comparable<T>>void assertLessThan(T lhs, T rhs, String msg) { - if (!(compare(lhs, rhs, msg) < 0)) { - msg = Objects.toString(msg, "assertLessThan") - + ": expected that " + Objects.toString(lhs) - + " < " + Objects.toString(rhs); - fail(msg); - } - } - - /** - * Shorthand for {@link #assertLessThanOrEqual(Comparable, Comparable)}. - * - * @param <T> a type - * @param lhs The left hand side of the comparison. - * @param rhs The right hand side of the comparison. - * @see #assertLessThanOrEqual(Comparable, Comparable) - */ - public static <T extends Comparable<T>> void assertLTE(T lhs, T rhs) { - assertLessThanOrEqual(lhs, rhs); - } - - /** - * Shorthand for {@link #assertLessThanOrEqual(Comparable, Comparable, String)}. - * - * @param <T> a type - * @param lhs The left hand side of the comparison. - * @param rhs The right hand side of the comparison. - * @param msg A description of the assumption; {@code null} for a default message. - * @see #assertLessThanOrEqual(Comparable, Comparable, String) - */ - public static <T extends Comparable<T>> void assertLTE(T lhs, T rhs, String msg) { - assertLessThanOrEqual(lhs, rhs, msg); - } - - /** - * Calls {@link #assertLessThanOrEqual(Comparable, Comparable, String)} with a default message. - * - * @param <T> a type - * @param lhs The left hand side of the comparison. - * @param rhs The right hand side of the comparison. - * @see #assertLessThanOrEqual(Comparable, Comparable, String) - */ - public static <T extends Comparable<T>> void assertLessThanOrEqual(T lhs, T rhs) { - assertLessThanOrEqual(lhs, rhs, null); - } - - /** - * Asserts that {@code lhs} is less than or equal to {@code rhs}. - * - * @param <T> a type - * @param lhs The left hand side of the comparison. - * @param rhs The right hand side of the comparison. - * @param msg A description of the assumption; {@code null} for a default message. - * @throws RuntimeException if the assertion is not true. - */ - public static <T extends Comparable<T>> void assertLessThanOrEqual(T lhs, T rhs, String msg) { - if (!(compare(lhs, rhs, msg) <= 0)) { - msg = Objects.toString(msg, "assertLessThanOrEqual") - + ": expected that " + Objects.toString(lhs) - + " <= " + Objects.toString(rhs); - fail(msg); - } - } - - /** - * Shorthand for {@link #assertEquals(Object, Object)}. - * - * @param lhs The left hand side of the comparison. - * @param rhs The right hand side of the comparison. - * @see #assertEquals(Object, Object) - */ - public static void assertEQ(Object lhs, Object rhs) { - assertEquals(lhs, rhs); - } - - /** - * Shorthand for {@link #assertEquals(Object, Object, String)}. - * - * @param lhs The left hand side of the comparison. - * @param rhs The right hand side of the comparison. - * @param msg A description of the assumption; {@code null} for a default message. - * @see #assertEquals(Object, Object, String) - */ - public static void assertEQ(Object lhs, Object rhs, String msg) { - assertEquals(lhs, rhs, msg); - } - - /** - * Calls {@link #assertEquals(java.lang.Object, java.lang.Object, java.lang.String)} with a default message. - * - * @param lhs The left hand side of the comparison. - * @param rhs The right hand side of the comparison. - * @see #assertEquals(Object, Object, String) - */ - public static void assertEquals(Object lhs, Object rhs) { - assertEquals(lhs, rhs, null); - } - - /** - * Asserts that {@code lhs} is equal to {@code rhs}. - * - * @param lhs The left hand side of the comparison. - * @param rhs The right hand side of the comparison. - * @param msg A description of the assumption; {@code null} for a default message. - * @throws RuntimeException if the assertion is not true. - */ - public static void assertEquals(Object lhs, Object rhs, String msg) { - if ((lhs != rhs) && ((lhs == null) || !(lhs.equals(rhs)))) { - msg = Objects.toString(msg, "assertEquals") - + ": expected " + Objects.toString(lhs) - + " to equal " + Objects.toString(rhs); - fail(msg); - } - } - - /** - * Calls {@link #assertSame(java.lang.Object, java.lang.Object, java.lang.String)} with a default message. - * - * @param lhs The left hand side of the comparison. - * @param rhs The right hand side of the comparison. - * @see #assertSame(Object, Object, String) - */ - public static void assertSame(Object lhs, Object rhs) { - assertSame(lhs, rhs, null); - } - - /** - * Asserts that {@code lhs} is the same as {@code rhs}. - * - * @param lhs The left hand side of the comparison. - * @param rhs The right hand side of the comparison. - * @param msg A description of the assumption; {@code null} for a default message. - * @throws RuntimeException if the assertion is not true. - */ - public static void assertSame(Object lhs, Object rhs, String msg) { - if (lhs != rhs) { - msg = Objects.toString(msg, "assertSame") - + ": expected " + Objects.toString(lhs) - + " to equal " + Objects.toString(rhs); - fail(msg); - } - } - - /** - * Shorthand for {@link #assertGreaterThanOrEqual(Comparable, Comparable)}. - * - * @param <T> a type - * @param lhs The left hand side of the comparison. - * @param rhs The right hand side of the comparison. - * @see #assertGreaterThanOrEqual(Comparable, Comparable) - */ - public static <T extends Comparable<T>> void assertGTE(T lhs, T rhs) { - assertGreaterThanOrEqual(lhs, rhs); - } - - /** - * Shorthand for {@link #assertGreaterThanOrEqual(Comparable, Comparable, String)}. - * - * @param <T> a type - * @param lhs The left hand side of the comparison. - * @param rhs The right hand side of the comparison. - * @param msg A description of the assumption; {@code null} for a default message. - * @see #assertGreaterThanOrEqual(Comparable, Comparable, String) - */ - public static <T extends Comparable<T>> void assertGTE(T lhs, T rhs, String msg) { - assertGreaterThanOrEqual(lhs, rhs, msg); - } - - /** - * Calls {@link #assertGreaterThanOrEqual(Comparable, Comparable, String)} with a default message. - * - * @param <T> a type - * @param lhs The left hand side of the comparison. - * @param rhs The right hand side of the comparison. - * @see #assertGreaterThanOrEqual(Comparable, Comparable, String) - */ - public static <T extends Comparable<T>> void assertGreaterThanOrEqual(T lhs, T rhs) { - assertGreaterThanOrEqual(lhs, rhs, null); - } - - /** - * Asserts that {@code lhs} is greater than or equal to {@code rhs}. - * - * @param <T> a type - * @param lhs The left hand side of the comparison. - * @param rhs The right hand side of the comparison. - * @param msg A description of the assumption; {@code null} for a default message. - * @throws RuntimeException if the assertion is not true. - */ - public static <T extends Comparable<T>> void assertGreaterThanOrEqual(T lhs, T rhs, String msg) { - if (!(compare(lhs, rhs, msg) >= 0)) { - msg = Objects.toString(msg, "assertGreaterThanOrEqual") - + ": expected " + Objects.toString(lhs) - + " >= " + Objects.toString(rhs); - fail(msg); - } - } - - /** - * Shorthand for {@link #assertGreaterThan(Comparable, Comparable)}. - * - * @param <T> a type - * @param lhs The left hand side of the comparison. - * @param rhs The right hand side of the comparison. - * @see #assertGreaterThan(Comparable, Comparable) - */ - public static <T extends Comparable<T>> void assertGT(T lhs, T rhs) { - assertGreaterThan(lhs, rhs); - } - - /** - * Shorthand for {@link #assertGreaterThan(Comparable, Comparable, String)}. - * - * @param <T> a type - * @param lhs the left hand value - * @param rhs the right hand value - * @param msg A description of the assumption; {@code null} for a default message. - * @see #assertGreaterThan(Comparable, Comparable, String) - */ - public static <T extends Comparable<T>> void assertGT(T lhs, T rhs, String msg) { - assertGreaterThan(lhs, rhs, msg); - } - - /** - * Calls {@link #assertGreaterThan(Comparable, Comparable, String)} with a default message. - * - * @param <T> a type - * @param lhs the left hand value - * @param rhs the right hand value - * @see #assertGreaterThan(Comparable, Comparable, String) - */ - public static <T extends Comparable<T>> void assertGreaterThan(T lhs, T rhs) { - assertGreaterThan(lhs, rhs, null); - } - - /** - * Asserts that {@code lhs} is greater than {@code rhs}. - * - * @param <T> a type - * @param lhs The left hand side of the comparison. - * @param rhs The right hand side of the comparison. - * @param msg A description of the assumption; {@code null} for a default message. - * @throws RuntimeException if the assertion is not true. - */ - public static <T extends Comparable<T>> void assertGreaterThan(T lhs, T rhs, String msg) { - if (!(compare(lhs, rhs, msg) > 0)) { - msg = Objects.toString(msg, "assertGreaterThan") - + ": expected " + Objects.toString(lhs) - + " > " + Objects.toString(rhs); - fail(msg); - } - } - - /** - * Shorthand for {@link #assertNotEquals(Object, Object)}. - * - * @param lhs The left hand side of the comparison. - * @param rhs The right hand side of the comparison. - * @see #assertNotEquals(Object, Object) - */ - public static void assertNE(Object lhs, Object rhs) { - assertNotEquals(lhs, rhs); - } - - /** - * Shorthand for {@link #assertNotEquals(Object, Object, String)}. - * - * @param lhs The left hand side of the comparison. - * @param rhs The right hand side of the comparison. - * @param msg A description of the assumption; {@code null} for a default message. - * @see #assertNotEquals(Object, Object, String) - */ - public static void assertNE(Object lhs, Object rhs, String msg) { - assertNotEquals(lhs, rhs, msg); - } - - /** - * Calls {@link #assertNotEquals(Object, Object, String)} with a default message. - * - * @param lhs The left hand side of the comparison. - * @param rhs The right hand side of the comparison. - * @see #assertNotEquals(Object, Object, String) - */ - public static void assertNotEquals(Object lhs, Object rhs) { - assertNotEquals(lhs, rhs, null); - } - - /** - * Asserts that {@code lhs} is not equal to {@code rhs}. - * - * @param lhs The left hand side of the comparison. - * @param rhs The right hand side of the comparison. - * @param msg A description of the assumption; {@code null} for a default message. - * @throws RuntimeException if the assertion is not true. - */ - public static void assertNotEquals(Object lhs, Object rhs, String msg) { - if ((lhs == rhs) || (lhs != null && lhs.equals(rhs))) { - msg = Objects.toString(msg, "assertNotEquals") - + ": expected " + Objects.toString(lhs) - + " to not equal " + Objects.toString(rhs); - fail(msg); - } - } - - /** - * Calls {@link #assertNull(Object, String)} with a default message. - * - * @param o The reference assumed to be null. - * @see #assertNull(Object, String) - */ - public static void assertNull(Object o) { - assertNull(o, null); - } - - /** - * Asserts that {@code o} is null. - * - * @param o The reference assumed to be null. - * @param msg A description of the assumption; {@code null} for a default message. - * @throws RuntimeException if the assertion is not true. - */ - public static void assertNull(Object o, String msg) { - assertEquals(o, null, msg); - } - - /** - * Calls {@link #assertNotNull(Object, String)} with a default message. - * - * @param o The reference assumed <i>not</i> to be null, - * @see #assertNotNull(Object, String) - */ - public static void assertNotNull(Object o) { - assertNotNull(o, null); - } - - /** - * Asserts that {@code o} is <i>not</i> null. - * - * @param o The reference assumed <i>not</i> to be null, - * @param msg A description of the assumption; {@code null} for a default message. - * @throws RuntimeException if the assertion is not true. - */ - public static void assertNotNull(Object o, String msg) { - assertNotEquals(o, null, msg); - } - - /** - * Calls {@link #assertFalse(boolean, String)} with a default message. - * - * @param value The value assumed to be false. - * @see #assertFalse(boolean, String) - */ - public static void assertFalse(boolean value) { - assertFalse(value, null); - } - - /** - * Asserts that {@code value} is {@code false}. - * - * @param value The value assumed to be false. - * @param msg A description of the assumption; {@code null} for a default message. - * @throws RuntimeException if the assertion is not true. - */ - public static void assertFalse(boolean value, String msg) { - if (value) { - msg = Objects.toString(msg, "assertFalse") - + ": expected false, was true"; - fail(msg); - } - } - - /** - * Calls {@link #assertTrue(boolean, String)} with a default message. - * - * @param value The value assumed to be true. - * @see #assertTrue(boolean, String) - */ - public static void assertTrue(boolean value) { - assertTrue(value, null); - } - - /** - * Asserts that {@code value} is {@code true}. - * - * @param value The value assumed to be true. - * @param msg A description of the assumption; {@code null} for a default message. - * @throws RuntimeException if the assertion is not true. - */ - public static void assertTrue(boolean value, String msg) { - if (!value) { - msg = Objects.toString(msg, "assertTrue") - + ": expected true, was false"; - fail(msg); - } - } - - private static <T extends Comparable<T>> int compare(T lhs, T rhs, String msg) { - if (lhs == null || rhs == null) { - fail(lhs, rhs, msg + ": values must be non-null:", ","); - } - return lhs.compareTo(rhs); - } - - /** - * Returns a string formatted with a message and expected and actual values. - * @param lhs the actual value - * @param rhs the expected value - * @param message the actual value - * @param relation the asserted relationship between lhs and rhs - * @return a formatted string - */ - public static String format(Object lhs, Object rhs, String message, String relation) { - StringBuilder sb = new StringBuilder(80); - if (message != null) { - sb.append(message); - sb.append(' '); - } - sb.append("<"); - sb.append(Objects.toString(lhs)); - sb.append("> "); - sb.append(Objects.toString(relation, ",")); - sb.append(" <"); - sb.append(Objects.toString(rhs)); - sb.append(">"); - return sb.toString(); - } - - /** - * Fail reports a failure with message fail. - * - * @throws RuntimeException always - */ - public static void fail() { - fail("fail"); - } - - /** - * Fail reports a failure with a message. - * @param message for the failure - * @throws RuntimeException always - */ - public static void fail(String message) { - throw new RuntimeException(message); - } - - /** - * Fail reports a failure with a formatted message. - * - * @param lhs the actual value - * @param rhs the expected value - * @param message to be format before the expected and actual values - * @param relation the asserted relationship between lhs and rhs - * @throws RuntimeException always - */ - public static void fail(Object lhs, Object rhs, String message, String relation) { - throw new RuntimeException(format(lhs, rhs, message, relation)); - } - - /** - * Fail reports a failure with a message and a cause. - * @param message to be format before the expected and actual values - * @param cause the exception that caused this failure - * @throws RuntimeException always - */ - public static void fail(String message, Throwable cause) { - throw new RuntimeException(message, cause); - } - -}
--- a/jaxp/test/javax/xml/jaxp/libs/jdk/testlibrary/CompilerUtils.java Fri May 12 15:14:16 2017 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,81 +0,0 @@ -/* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package jdk.testlibrary; - -import javax.tools.JavaCompiler; -import javax.tools.StandardJavaFileManager; -import javax.tools.StandardLocation; -import javax.tools.ToolProvider; -import java.io.IOException; -import java.nio.file.Files; -import java.nio.file.Path; -import java.util.Arrays; -import java.util.Collections; -import java.util.List; -import java.util.stream.Collectors; - -/** - * This class consists exclusively of static utility methods for invoking the - * java compiler. - */ - -public final class CompilerUtils { - private CompilerUtils() { } - - /** - * Compile all the java sources in {@code <source>/**} to - * {@code <destination>/**}. The destination directory will be created if - * it doesn't exist. - * - * All warnings/errors emitted by the compiler are output to System.out/err. - * - * @return true if the compilation is successful - * - * @throws IOException if there is an I/O error scanning the source tree or - * creating the destination directory - */ - public static boolean compile(Path source, Path destination, String ... options) - throws IOException - { - JavaCompiler compiler = ToolProvider.getSystemJavaCompiler(); - StandardJavaFileManager jfm = compiler.getStandardFileManager(null, null, null); - - List<Path> sources - = Files.find(source, Integer.MAX_VALUE, - (file, attrs) -> (file.toString().endsWith(".java"))) - .collect(Collectors.toList()); - - Files.createDirectories(destination); - jfm.setLocation(StandardLocation.CLASS_PATH, Collections.EMPTY_LIST); - jfm.setLocationFromPaths(StandardLocation.CLASS_OUTPUT, - Arrays.asList(destination)); - - List<String> opts = Arrays.asList(options); - JavaCompiler.CompilationTask task - = compiler.getTask(null, jfm, null, opts, null, - jfm.getJavaFileObjectsFromPaths(sources)); - - return task.call(); - } -}
--- a/jaxp/test/javax/xml/jaxp/libs/jdk/testlibrary/JDKToolFinder.java Fri May 12 15:14:16 2017 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,111 +0,0 @@ -/* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package jdk.testlibrary; - -import java.io.FileNotFoundException; -import java.nio.file.Path; -import java.nio.file.Paths; - -/** - * @deprecated This class is deprecated. Use the one from - * {@code <root>/test/lib/share/classes/jdk/test/lib} - */ -@Deprecated -public final class JDKToolFinder { - - private JDKToolFinder() { - } - - /** - * Returns the full path to an executable in jdk/bin based on System - * property {@code test.jdk} or {@code compile.jdk} (both are set by the jtreg test suite) - * - * @return Full path to an executable in jdk/bin - */ - public static String getJDKTool(String tool) { - - // First try to find the executable in test.jdk - try { - return getTool(tool, "test.jdk"); - } catch (FileNotFoundException e) { - - } - - // Now see if it's available in compile.jdk - try { - return getTool(tool, "compile.jdk"); - } catch (FileNotFoundException e) { - throw new RuntimeException("Failed to find " + tool + - ", looked in test.jdk (" + System.getProperty("test.jdk") + - ") and compile.jdk (" + System.getProperty("compile.jdk") + ")"); - } - } - - /** - * Returns the full path to an executable in jdk/bin based on System - * property {@code compile.jdk} - * - * @return Full path to an executable in jdk/bin - */ - public static String getCompileJDKTool(String tool) { - try { - return getTool(tool, "compile.jdk"); - } catch (FileNotFoundException e) { - throw new RuntimeException(e); - } - } - - /** - * Returns the full path to an executable in jdk/bin based on System - * property {@code test.jdk} - * - * @return Full path to an executable in jdk/bin - */ - public static String getTestJDKTool(String tool) { - try { - return getTool(tool, "test.jdk"); - } catch (FileNotFoundException e) { - throw new RuntimeException(e); - } - } - - private static String getTool(String tool, String property) throws FileNotFoundException { - String jdkPath = System.getProperty(property); - - if (jdkPath == null) { - throw new RuntimeException( - "System property '" + property + "' not set. This property is normally set by jtreg. " - + "When running test separately, set this property using '-D" + property + "=/path/to/jdk'."); - } - - Path toolName = Paths.get("bin", tool + (Platform.isWindows() ? ".exe" : "")); - - Path jdkTool = Paths.get(jdkPath, toolName.toString()); - if (!jdkTool.toFile().exists()) { - throw new FileNotFoundException("Could not find file " + jdkTool.toAbsolutePath()); - } - - return jdkTool.toAbsolutePath().toString(); - } -}
--- a/jaxp/test/javax/xml/jaxp/libs/jdk/testlibrary/JDKToolLauncher.java Fri May 12 15:14:16 2017 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,134 +0,0 @@ -/* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package jdk.testlibrary; - -import java.util.ArrayList; -import java.util.List; - -/** - * A utility for constructing command lines for starting JDK tool processes. - * - * The JDKToolLauncher can in particular be combined with a - * java.lang.ProcessBuilder to easily run a JDK tool. For example, the following - * code run {@code jmap -heap} against a process with GC logging turned on for - * the {@code jmap} process: - * - * <pre> - * {@code - * JDKToolLauncher jmap = JDKToolLauncher.create("jmap") - * .addVMArg("-Xlog:gc*=debug") - * .addToolArg("-heap") - * .addToolArg(pid); - * ProcessBuilder pb = new ProcessBuilder(jmap.getCommand()); - * Process p = pb.start(); - * } - * </pre> - * @deprecated This class is deprecated. Use the one from - * {@code <root>/test/lib/share/classes/jdk/test/lib} - */ -@Deprecated -public class JDKToolLauncher { - private final String executable; - private final List<String> vmArgs = new ArrayList<String>(); - private final List<String> toolArgs = new ArrayList<String>(); - - private JDKToolLauncher(String tool, boolean useCompilerJDK) { - if (useCompilerJDK) { - executable = JDKToolFinder.getJDKTool(tool); - } else { - executable = JDKToolFinder.getTestJDKTool(tool); - } - } - - /** - * Creates a new JDKToolLauncher for the specified tool. Using tools path - * from the compiler JDK. - * - * @param tool - * The name of the tool - * @return A new JDKToolLauncher - */ - public static JDKToolLauncher create(String tool) { - return new JDKToolLauncher(tool, true); - } - - /** - * Creates a new JDKToolLauncher for the specified tool in the Tested JDK. - * - * @param tool - * The name of the tool - * - * @return A new JDKToolLauncher - */ - public static JDKToolLauncher createUsingTestJDK(String tool) { - return new JDKToolLauncher(tool, false); - } - - /** - * Adds an argument to the JVM running the tool. - * - * The JVM arguments are passed to the underlying JVM running the tool. - * Arguments will automatically be prepended with "-J". - * - * Any platform specific arguments required for running the tool are - * automatically added. - * - * - * @param arg - * The argument to VM running the tool - * @return The JDKToolLauncher instance - */ - public JDKToolLauncher addVMArg(String arg) { - vmArgs.add(arg); - return this; - } - - /** - * Adds an argument to the tool. - * - * @param arg - * The argument to the tool - * @return The JDKToolLauncher instance - */ - public JDKToolLauncher addToolArg(String arg) { - toolArgs.add(arg); - return this; - } - - /** - * Returns the command that can be used for running the tool. - * - * @return An array whose elements are the arguments of the command. - */ - public String[] getCommand() { - List<String> command = new ArrayList<String>(); - command.add(executable); - // Add -J in front of all vmArgs - for (String arg : vmArgs) { - command.add("-J" + arg); - } - command.addAll(toolArgs); - return command.toArray(new String[command.size()]); - } -}
--- a/jaxp/test/javax/xml/jaxp/libs/jdk/testlibrary/OutputAnalyzer.java Fri May 12 15:14:16 2017 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,576 +0,0 @@ -/* - * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package jdk.testlibrary; - -import static jdk.testlibrary.Asserts.*; - -import java.io.IOException; -import java.io.PrintStream; -import java.util.ArrayList; -import java.util.List; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -/** - * Utility class for verifying output and exit value from a {@code Process}. - * - * @deprecated This class is deprecated. Use the one from - * {@code <root>/test/lib/share/classes/jdk/test/lib/process} - * - */ -@Deprecated -public final class OutputAnalyzer { - private final OutputBuffer output; - private final String stdout; - private final String stderr; - private final int exitValue; // useless now. output contains exit value. - - /** - * Create an OutputAnalyzer, a utility class for verifying output and exit - * value from a Process. - * <p> - * OutputAnalyzer should never be instantiated directly - - * use {@linkplain ProcessTools#executeProcess(ProcessBuilder)} instead - * - * @param process - * Process to analyze - * @throws IOException - * If an I/O error occurs. - */ - OutputAnalyzer(Process process) throws IOException { - output = new OutputBuffer(process); - exitValue = -1; - this.stdout = null; - this.stderr = null; - } - - /** - * Create an OutputAnalyzer, a utility class for verifying output. - * - * @param buf - * String buffer to analyze - */ - OutputAnalyzer(String buf) { - this(buf, buf); - } - - /** - * Create an OutputAnalyzer, a utility class for verifying output - * - * @param stdout - * stdout buffer to analyze - * @param stderr - * stderr buffer to analyze - */ - OutputAnalyzer(String stdout, String stderr) { - this.output = null; - this.stdout = stdout; - this.stderr = stderr; - exitValue = -1; - } - - /** - * Verify that the stdout and stderr contents of output buffer contains the - * string - * - * @param expectedString - * String that buffer should contain - * @throws RuntimeException - * If the string was not found - */ - public OutputAnalyzer shouldContain(String expectedString) { - if (!getStdout().contains(expectedString) - && !getStderr().contains(expectedString)) { - reportDiagnosticSummary(); - throw new RuntimeException("'" + expectedString - + "' missing from stdout/stderr \n"); - } - return this; - } - - /** - * Verify that the stdout contents of output buffer contains the string - * - * @param expectedString - * String that buffer should contain - * @throws RuntimeException - * If the string was not found - */ - public OutputAnalyzer stdoutShouldContain(String expectedString) { - if (!getStdout().contains(expectedString)) { - reportDiagnosticSummary(); - throw new RuntimeException("'" + expectedString - + "' missing from stdout \n"); - } - return this; - } - - /** - * Verify that the stderr contents of output buffer contains the string - * - * @param expectedString - * String that buffer should contain - * @throws RuntimeException - * If the string was not found - */ - public OutputAnalyzer stderrShouldContain(String expectedString) { - if (!getStderr().contains(expectedString)) { - reportDiagnosticSummary(); - throw new RuntimeException("'" + expectedString - + "' missing from stderr \n"); - } - return this; - } - - /** - * Verify that the stdout and stderr contents of output buffer does not - * contain the string - * - * @param notExpectedString - * String that the buffer should not contain - * @throws RuntimeException - * If the string was found - */ - public OutputAnalyzer shouldNotContain(String notExpectedString) { - if (getStdout().contains(notExpectedString)) { - reportDiagnosticSummary(); - throw new RuntimeException("'" + notExpectedString - + "' found in stdout \n"); - } - if (getStderr().contains(notExpectedString)) { - reportDiagnosticSummary(); - throw new RuntimeException("'" + notExpectedString - + "' found in stderr \n"); - } - return this; - } - - /** - * Verify that the stdout contents of output buffer does not contain the - * string - * - * @param notExpectedString - * String that the buffer should not contain - * @throws RuntimeException - * If the string was found - */ - public OutputAnalyzer stdoutShouldNotContain(String notExpectedString) { - if (getStdout().contains(notExpectedString)) { - reportDiagnosticSummary(); - throw new RuntimeException("'" + notExpectedString - + "' found in stdout \n"); - } - return this; - } - - /** - * Verify that the stderr contents of output buffer does not contain the - * string - * - * @param notExpectedString - * String that the buffer should not contain - * @throws RuntimeException - * If the string was found - */ - public OutputAnalyzer stderrShouldNotContain(String notExpectedString) { - if (getStderr().contains(notExpectedString)) { - reportDiagnosticSummary(); - throw new RuntimeException("'" + notExpectedString - + "' found in stderr \n"); - } - return this; - } - - /** - * Verify that the stdout and stderr contents of output buffer matches the - * pattern - * - * @param pattern - * @throws RuntimeException - * If the pattern was not found - */ - public OutputAnalyzer shouldMatch(String pattern) { - Matcher stdoutMatcher = Pattern.compile(pattern, Pattern.MULTILINE) - .matcher(getStdout()); - Matcher stderrMatcher = Pattern.compile(pattern, Pattern.MULTILINE) - .matcher(getStderr()); - if (!stdoutMatcher.find() && !stderrMatcher.find()) { - reportDiagnosticSummary(); - throw new RuntimeException("'" + pattern - + "' missing from stdout/stderr \n"); - } - return this; - } - - /** - * Verify that the stdout contents of output buffer matches the pattern - * - * @param pattern - * @throws RuntimeException - * If the pattern was not found - */ - public OutputAnalyzer stdoutShouldMatch(String pattern) { - Matcher matcher = Pattern.compile(pattern, Pattern.MULTILINE).matcher( - getStdout()); - if (!matcher.find()) { - reportDiagnosticSummary(); - throw new RuntimeException("'" + pattern - + "' missing from stdout \n"); - } - return this; - } - - /** - * Verify that the stderr contents of output buffer matches the pattern - * - * @param pattern - * @throws RuntimeException - * If the pattern was not found - */ - public OutputAnalyzer stderrShouldMatch(String pattern) { - Matcher matcher = Pattern.compile(pattern, Pattern.MULTILINE).matcher( - getStderr()); - if (!matcher.find()) { - reportDiagnosticSummary(); - throw new RuntimeException("'" + pattern - + "' missing from stderr \n"); - } - return this; - } - - /** - * Verify that the stdout and stderr contents of output buffer does not - * match the pattern - * - * @param pattern - * @throws RuntimeException - * If the pattern was found - */ - public OutputAnalyzer shouldNotMatch(String pattern) { - Matcher matcher = Pattern.compile(pattern, Pattern.MULTILINE).matcher( - getStdout()); - if (matcher.find()) { - reportDiagnosticSummary(); - throw new RuntimeException("'" + pattern + "' found in stdout: '" - + matcher.group() + "' \n"); - } - matcher = Pattern.compile(pattern, Pattern.MULTILINE).matcher(getStderr()); - if (matcher.find()) { - reportDiagnosticSummary(); - throw new RuntimeException("'" + pattern + "' found in stderr: '" - + matcher.group() + "' \n"); - } - return this; - } - - /** - * Verify that the stdout contents of output buffer does not match the - * pattern - * - * @param pattern - * @throws RuntimeException - * If the pattern was found - */ - public OutputAnalyzer stdoutShouldNotMatch(String pattern) { - Matcher matcher = Pattern.compile(pattern, Pattern.MULTILINE).matcher( - getStdout()); - if (matcher.find()) { - reportDiagnosticSummary(); - throw new RuntimeException("'" + pattern + "' found in stdout \n"); - } - return this; - } - - /** - * Verify that the stderr contents of output buffer does not match the - * pattern - * - * @param pattern - * @throws RuntimeException - * If the pattern was found - */ - public OutputAnalyzer stderrShouldNotMatch(String pattern) { - Matcher matcher = Pattern.compile(pattern, Pattern.MULTILINE).matcher( - getStderr()); - if (matcher.find()) { - reportDiagnosticSummary(); - throw new RuntimeException("'" + pattern + "' found in stderr \n"); - } - return this; - } - - /** - * Get the captured group of the first string matching the pattern. stderr - * is searched before stdout. - * - * @param pattern - * The multi-line pattern to match - * @param group - * The group to capture - * @return The matched string or null if no match was found - */ - public String firstMatch(String pattern, int group) { - Matcher stderrMatcher = Pattern.compile(pattern, Pattern.MULTILINE) - .matcher(getStderr()); - Matcher stdoutMatcher = Pattern.compile(pattern, Pattern.MULTILINE) - .matcher(getStdout()); - if (stderrMatcher.find()) { - return stderrMatcher.group(group); - } - if (stdoutMatcher.find()) { - return stdoutMatcher.group(group); - } - return null; - } - - /** - * Get the first string matching the pattern. stderr is searched before - * stdout. - * - * @param pattern - * The multi-line pattern to match - * @return The matched string or null if no match was found - */ - public String firstMatch(String pattern) { - return firstMatch(pattern, 0); - } - - /** - * Verify the exit value of the process - * - * @param expectedExitValue - * Expected exit value from process - * @throws RuntimeException - * If the exit value from the process did not match the expected - * value - */ - public OutputAnalyzer shouldHaveExitValue(int expectedExitValue) { - if (getExitValue() != expectedExitValue) { - reportDiagnosticSummary(); - throw new RuntimeException("Expected to get exit value of [" - + expectedExitValue + "]\n"); - } - return this; - } - - /** - * Report summary that will help to diagnose the problem Currently includes: - * - standard input produced by the process under test - standard output - - * exit code Note: the command line is printed by the ProcessTools - */ - private OutputAnalyzer reportDiagnosticSummary() { - String msg = " stdout: [" + getStdout() + "];\n" + " stderr: [" + getStderr() - + "]\n" + " exitValue = " + getExitValue() + "\n"; - - System.err.println(msg); - return this; - } - - /** - * Get the contents of the output buffer (stdout and stderr) - * - * @return Content of the output buffer - */ - public String getOutput() { - return getStdout() + getStderr(); - } - - /** - * Get the contents of the stdout buffer - * - * @return Content of the stdout buffer - */ - public String getStdout() { - return output == null ? stdout : output.getStdout(); - } - - /** - * Get the contents of the stderr buffer - * - * @return Content of the stderr buffer - */ - public String getStderr() { - return output == null ? stderr : output.getStderr(); - } - - /** - * Get the process exit value - * - * @return Process exit value - */ - public int getExitValue() { - return output == null ? exitValue : output.getExitValue(); - } - - - /** - * Print the stdout buffer to the given {@code PrintStream}. - * - * @return this OutputAnalyzer - */ - public OutputAnalyzer outputTo(PrintStream out) { - out.println(getStdout()); - return this; - } - - /** - * Print the stderr buffer to the given {@code PrintStream}. - * - * @return this OutputAnalyzer - */ - public OutputAnalyzer errorTo(PrintStream out) { - out.println(getStderr()); - return this; - } - - - /** - * Get the contents of the output buffer (stdout and stderr) as list of strings. - * Output will be split by system property 'line.separator'. - * - * @return Contents of the output buffer as list of strings - */ - public List<String> asLines() { - return asLines(getOutput()); - } - - private List<String> asLines(String buffer) { - List<String> l = new ArrayList<>(); - String[] a = buffer.split(Utils.NEW_LINE); - for (String string : a) { - l.add(string); - } - return l; - } - - /** - * Check if there is a line matching {@code pattern} and return its index - * - * @param pattern Matching pattern - * @return Index of first matching line - */ - private int indexOf(List<String> lines, String pattern) { - for (int i = 0; i < lines.size(); i++) { - if (lines.get(i).matches(pattern)) { - return i; - } - } - return -1; - } - - /** - * @see #shouldMatchByLine(String, String, String) - */ - public int shouldMatchByLine(String pattern) { - return shouldMatchByLine(null, null, pattern); - } - - /** - * @see #stdoutShouldMatchByLine(String, String, String) - */ - public int stdoutShouldMatchByLine(String pattern) { - return stdoutShouldMatchByLine(null, null, pattern); - } - - /** - * @see #shouldMatchByLine(String, String, String) - */ - public int shouldMatchByLineFrom(String from, String pattern) { - return shouldMatchByLine(from, null, pattern); - } - - /** - * @see #shouldMatchByLine(String, String, String) - */ - public int shouldMatchByLineTo(String to, String pattern) { - return shouldMatchByLine(null, to, pattern); - } - - /** - * Verify that the stdout and stderr contents of output buffer match the - * {@code pattern} line by line. The whole output could be matched or - * just a subset of it. - * - * @param from - * The line from where output will be matched. - * Set {@code from} to null for matching from the first line. - * @param to - * The line until where output will be matched. - * Set {@code to} to null for matching until the last line. - * @param pattern - * Matching pattern - * @return Count of lines which match the {@code pattern} - */ - public int shouldMatchByLine(String from, String to, String pattern) { - return shouldMatchByLine(getOutput(), from, to, pattern); - } - - /** - * Verify that the stdout contents of output buffer matches the - * {@code pattern} line by line. The whole stdout could be matched or - * just a subset of it. - * - * @param from - * The line from where stdout will be matched. - * Set {@code from} to null for matching from the first line. - * @param to - * The line until where stdout will be matched. - * Set {@code to} to null for matching until the last line. - * @param pattern - * Matching pattern - * @return Count of lines which match the {@code pattern} - */ - public int stdoutShouldMatchByLine(String from, String to, String pattern) { - return shouldMatchByLine(getStdout(), from, to, pattern); - } - - private int shouldMatchByLine(String buffer, String from, String to, String pattern) { - List<String> lines = asLines(buffer); - - int fromIndex = 0; - if (from != null) { - fromIndex = indexOf(lines, from); - assertGreaterThan(fromIndex, -1, - "The line/pattern '" + from + "' from where the output should match can not be found"); - } - - int toIndex = lines.size(); - if (to != null) { - toIndex = indexOf(lines, to); - assertGreaterThan(toIndex, -1, - "The line/pattern '" + to + "' until where the output should match can not be found"); - } - - List<String> subList = lines.subList(fromIndex, toIndex); - int matchedCount = 0; - for (String line : subList) { - assertTrue(line.matches(pattern), - "The line '" + line + "' does not match pattern '" + pattern + "'"); - matchedCount++; - } - - return matchedCount; - } - -}
--- a/jaxp/test/javax/xml/jaxp/libs/jdk/testlibrary/OutputBuffer.java Fri May 12 15:14:16 2017 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,113 +0,0 @@ -/* - * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package jdk.testlibrary; - -import java.io.ByteArrayOutputStream; -import java.util.concurrent.CancellationException; -import java.util.concurrent.ExecutionException; -import java.util.concurrent.Future; - -/** - * @deprecated This class is deprecated. Use the one from - * {@code <root>/test/lib/share/classes/jdk/test/lib/process} - */ -@Deprecated -class OutputBuffer { - private static class OutputBufferException extends RuntimeException { - private static final long serialVersionUID = 8528687792643129571L; - - public OutputBufferException(Throwable cause) { - super(cause); - } - } - - private final Process p; - private final Future<Void> outTask; - private final Future<Void> errTask; - private final ByteArrayOutputStream stderrBuffer = new ByteArrayOutputStream(); - private final ByteArrayOutputStream stdoutBuffer = new ByteArrayOutputStream(); - - /** - * Create an OutputBuffer, a class for storing and managing stdout and - * stderr results separately - * - * @param stdout - * stdout result - * @param stderr - * stderr result - */ - OutputBuffer(Process p) { - this.p = p; - StreamPumper outPumper = new StreamPumper(p.getInputStream(), - stdoutBuffer); - StreamPumper errPumper = new StreamPumper(p.getErrorStream(), - stderrBuffer); - - outTask = outPumper.process(); - errTask = errPumper.process(); - } - - /** - * Returns the stdout result - * - * @return stdout result - */ - public String getStdout() { - try { - outTask.get(); - return stdoutBuffer.toString(); - } catch (InterruptedException e) { - Thread.currentThread().interrupt(); - throw new OutputBufferException(e); - } catch (ExecutionException | CancellationException e) { - throw new OutputBufferException(e); - } - } - - /** - * Returns the stderr result - * - * @return stderr result - */ - public String getStderr() { - try { - errTask.get(); - return stderrBuffer.toString(); - } catch (InterruptedException e) { - Thread.currentThread().interrupt(); - throw new OutputBufferException(e); - } catch (ExecutionException | CancellationException e) { - throw new OutputBufferException(e); - } - } - - public int getExitValue() { - try { - return p.waitFor(); - } catch (InterruptedException e) { - Thread.currentThread().interrupt(); - throw new OutputBufferException(e); - } - } -}
--- a/jaxp/test/javax/xml/jaxp/libs/jdk/testlibrary/Platform.java Fri May 12 15:14:16 2017 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,213 +0,0 @@ -/* - * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package jdk.testlibrary; -import java.util.regex.Pattern; -import java.io.RandomAccessFile; -import java.io.FileNotFoundException; -import java.io.IOException; - -/** - * @deprecated This class is deprecated. Use the one from - * {@code <root>/test/lib/share/classes/jdk/test/lib} - */ -@Deprecated -public class Platform { - private static final String osName = System.getProperty("os.name"); - private static final String dataModel = System.getProperty("sun.arch.data.model"); - private static final String vmVersion = System.getProperty("java.vm.version"); - private static final String jdkDebug = System.getProperty("jdk.debug"); - private static final String osArch = System.getProperty("os.arch"); - private static final String vmName = System.getProperty("java.vm.name"); - private static final String userName = System.getProperty("user.name"); - private static final String compiler = System.getProperty("sun.management.compiler"); - - public static boolean isClient() { - return vmName.endsWith(" Client VM"); - } - - public static boolean isServer() { - return vmName.endsWith(" Server VM"); - } - - public static boolean isGraal() { - return vmName.endsWith(" Graal VM"); - } - - public static boolean isMinimal() { - return vmName.endsWith(" Minimal VM"); - } - - public static boolean isEmbedded() { - return vmName.contains("Embedded"); - } - - public static boolean isTieredSupported() { - return compiler.contains("Tiered Compilers"); - } - - - public static boolean is32bit() { - return dataModel.equals("32"); - } - - public static boolean is64bit() { - return dataModel.equals("64"); - } - - public static boolean isAix() { - return isOs("aix"); - } - - public static boolean isLinux() { - return isOs("linux"); - } - - public static boolean isOSX() { - return isOs("mac"); - } - - public static boolean isSolaris() { - return isOs("sunos"); - } - - public static boolean isWindows() { - return isOs("win"); - } - - private static boolean isOs(String osname) { - return osName.toLowerCase().startsWith(osname.toLowerCase()); - } - - public static String getOsName() { - return osName; - } - - public static boolean isDebugBuild() { - return (jdkDebug.toLowerCase().contains("debug")); - } - - public static String getVMVersion() { - return vmVersion; - } - - // Returns true for sparc and sparcv9. - public static boolean isSparc() { - return isArch("sparc.*"); - } - - public static boolean isARM() { - return isArch("arm.*"); - } - - public static boolean isPPC() { - return isArch("ppc.*"); - } - - public static boolean isX86() { - // On Linux it's 'i386', Windows 'x86' without '_64' suffix. - return isArch("(i386)|(x86(?!_64))"); - } - - public static boolean isX64() { - // On OSX it's 'x86_64' and on other (Linux, Windows and Solaris) platforms it's 'amd64' - return isArch("(amd64)|(x86_64)"); - } - - private static boolean isArch(String archnameRE) { - return Pattern.compile(archnameRE, Pattern.CASE_INSENSITIVE) - .matcher(osArch) - .matches(); - } - - public static String getOsArch() { - return osArch; - } - - /** - * Return a boolean for whether we expect to be able to attach - * the SA to our own processes on this system. - */ - public static boolean shouldSAAttach() - throws IOException { - - if (isAix()) { - return false; // SA not implemented. - } else if (isLinux()) { - return canPtraceAttachLinux(); - } else if (isOSX()) { - return canAttachOSX(); - } else { - // Other platforms expected to work: - return true; - } - } - - /** - * On Linux, first check the SELinux boolean "deny_ptrace" and return false - * as we expect to be denied if that is "1". - */ - public static boolean canPtraceAttachLinux() - throws IOException { - - // SELinux deny_ptrace: - try(RandomAccessFile file = new RandomAccessFile("/sys/fs/selinux/booleans/deny_ptrace", "r")) { - if (file.readByte() != '0') { - return false; - } - } - catch(FileNotFoundException ex) { - // Ignored - } - - // YAMA enhanced security ptrace_scope: - // 0 - a process can PTRACE_ATTACH to any other process running under the same uid - // 1 - restricted ptrace: a process must be a children of the inferior or user is root - // 2 - only processes with CAP_SYS_PTRACE may use ptrace or user is root - // 3 - no attach: no processes may use ptrace with PTRACE_ATTACH - - try(RandomAccessFile file = new RandomAccessFile("/proc/sys/kernel/yama/ptrace_scope", "r")) { - byte yama_scope = file.readByte(); - if (yama_scope == '3') { - return false; - } - - if (!userName.equals("root") && yama_scope != '0') { - return false; - } - } - catch(FileNotFoundException ex) { - // Ignored - } - - // Otherwise expect to be permitted: - return true; - } - - /** - * On OSX, expect permission to attach only if we are root. - */ - public static boolean canAttachOSX() { - return userName.equals("root"); - } -}
--- a/jaxp/test/javax/xml/jaxp/libs/jdk/testlibrary/ProcessTools.java Fri May 12 15:14:16 2017 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,560 +0,0 @@ -/* - * Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package jdk.testlibrary; - -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.io.PrintStream; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.concurrent.CountDownLatch; -import java.util.Map; -import java.util.concurrent.ExecutionException; -import java.util.concurrent.Future; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.TimeoutException; -import java.util.function.Predicate; -import java.util.function.Consumer; -import java.util.stream.Collectors; - - -/** - * @deprecated This class is deprecated. Use the one from - * {@code <root>/test/lib/share/classes/jdk/test/lib/process} - */ -@Deprecated -public final class ProcessTools { - private static final class LineForwarder extends StreamPumper.LinePump { - private final PrintStream ps; - private final String prefix; - LineForwarder(String prefix, PrintStream os) { - this.ps = os; - this.prefix = prefix; - } - @Override - protected void processLine(String line) { - ps.println("[" + prefix + "] " + line); - } - } - - private ProcessTools() { - } - - /** - * <p>Starts a process from its builder.</p> - * <span>The default redirects of STDOUT and STDERR are started</span> - * @param name The process name - * @param processBuilder The process builder - * @return Returns the initialized process - * @throws IOException - */ - public static Process startProcess(String name, - ProcessBuilder processBuilder) - throws IOException { - return startProcess(name, processBuilder, (Consumer<String>)null); - } - - /** - * <p>Starts a process from its builder.</p> - * <span>The default redirects of STDOUT and STDERR are started</span> - * <p>It is possible to monitor the in-streams via the provided {@code consumer} - * @param name The process name - * @param consumer {@linkplain Consumer} instance to process the in-streams - * @param processBuilder The process builder - * @return Returns the initialized process - * @throws IOException - */ - @SuppressWarnings("overloads") - public static Process startProcess(String name, - ProcessBuilder processBuilder, - Consumer<String> consumer) - throws IOException { - try { - return startProcess(name, processBuilder, consumer, null, -1, TimeUnit.NANOSECONDS); - } catch (InterruptedException | TimeoutException e) { - // will never happen - throw new RuntimeException(e); - } - } - - /** - * <p>Starts a process from its builder.</p> - * <span>The default redirects of STDOUT and STDERR are started</span> - * <p> - * It is possible to wait for the process to get to a warmed-up state - * via {@linkplain Predicate} condition on the STDOUT - * </p> - * @param name The process name - * @param processBuilder The process builder - * @param linePredicate The {@linkplain Predicate} to use on the STDOUT - * Used to determine the moment the target app is - * properly warmed-up. - * It can be null - in that case the warmup is skipped. - * @param timeout The timeout for the warmup waiting; -1 = no wait; 0 = wait forever - * @param unit The timeout {@linkplain TimeUnit} - * @return Returns the initialized {@linkplain Process} - * @throws IOException - * @throws InterruptedException - * @throws TimeoutException - */ - public static Process startProcess(String name, - ProcessBuilder processBuilder, - final Predicate<String> linePredicate, - long timeout, - TimeUnit unit) - throws IOException, InterruptedException, TimeoutException { - return startProcess(name, processBuilder, null, linePredicate, timeout, unit); - } - - /** - * <p>Starts a process from its builder.</p> - * <span>The default redirects of STDOUT and STDERR are started</span> - * <p> - * It is possible to wait for the process to get to a warmed-up state - * via {@linkplain Predicate} condition on the STDOUT and monitor the - * in-streams via the provided {@linkplain Consumer} - * </p> - * @param name The process name - * @param processBuilder The process builder - * @param lineConsumer The {@linkplain Consumer} the lines will be forwarded to - * @param linePredicate The {@linkplain Predicate} to use on the STDOUT - * Used to determine the moment the target app is - * properly warmed-up. - * It can be null - in that case the warmup is skipped. - * @param timeout The timeout for the warmup waiting; -1 = no wait; 0 = wait forever - * @param unit The timeout {@linkplain TimeUnit} - * @return Returns the initialized {@linkplain Process} - * @throws IOException - * @throws InterruptedException - * @throws TimeoutException - */ - public static Process startProcess(String name, - ProcessBuilder processBuilder, - final Consumer<String> lineConsumer, - final Predicate<String> linePredicate, - long timeout, - TimeUnit unit) - throws IOException, InterruptedException, TimeoutException { - System.out.println("["+name+"]:" + processBuilder.command().stream().collect(Collectors.joining(" "))); - Process p = processBuilder.start(); - StreamPumper stdout = new StreamPumper(p.getInputStream()); - StreamPumper stderr = new StreamPumper(p.getErrorStream()); - - stdout.addPump(new LineForwarder(name, System.out)); - stderr.addPump(new LineForwarder(name, System.err)); - if (lineConsumer != null) { - StreamPumper.LinePump pump = new StreamPumper.LinePump() { - @Override - protected void processLine(String line) { - lineConsumer.accept(line); - } - }; - stdout.addPump(pump); - stderr.addPump(pump); - } - - - CountDownLatch latch = new CountDownLatch(1); - if (linePredicate != null) { - StreamPumper.LinePump pump = new StreamPumper.LinePump() { - @Override - protected void processLine(String line) { - if (latch.getCount() > 0 && linePredicate.test(line)) { - latch.countDown(); - } - } - }; - stdout.addPump(pump); - stderr.addPump(pump); - } else { - latch.countDown(); - } - final Future<Void> stdoutTask = stdout.process(); - final Future<Void> stderrTask = stderr.process(); - - try { - if (timeout > -1) { - if (timeout == 0) { - latch.await(); - } else { - if (!latch.await(Utils.adjustTimeout(timeout), unit)) { - throw new TimeoutException(); - } - } - } - } catch (TimeoutException | InterruptedException e) { - System.err.println("Failed to start a process (thread dump follows)"); - for(Map.Entry<Thread, StackTraceElement[]> s : Thread.getAllStackTraces().entrySet()) { - printStack(s.getKey(), s.getValue()); - } - - if (p.isAlive()) { - p.destroyForcibly(); - } - - stdoutTask.cancel(true); - stderrTask.cancel(true); - throw e; - } - - return new ProcessImpl(p, stdoutTask, stderrTask); - } - - /** - * <p>Starts a process from its builder.</p> - * <span>The default redirects of STDOUT and STDERR are started</span> - * <p> - * It is possible to wait for the process to get to a warmed-up state - * via {@linkplain Predicate} condition on the STDOUT. The warm-up will - * wait indefinitely. - * </p> - * @param name The process name - * @param processBuilder The process builder - * @param linePredicate The {@linkplain Predicate} to use on the STDOUT - * Used to determine the moment the target app is - * properly warmed-up. - * It can be null - in that case the warmup is skipped. - * @return Returns the initialized {@linkplain Process} - * @throws IOException - * @throws InterruptedException - * @throws TimeoutException - */ - @SuppressWarnings("overloads") - public static Process startProcess(String name, - ProcessBuilder processBuilder, - final Predicate<String> linePredicate) - throws IOException, InterruptedException, TimeoutException { - return startProcess(name, processBuilder, linePredicate, 0, TimeUnit.SECONDS); - } - - /** - * Get the process id of the current running Java process - * - * @return Process id - */ - public static long getProcessId() { - return ProcessHandle.current().pid(); - } - - /** - * Create ProcessBuilder using the java launcher from the jdk to be tested, - * and with any platform specific arguments prepended. - * - * @param command Arguments to pass to the java command. - * @return The ProcessBuilder instance representing the java command. - */ - public static ProcessBuilder createJavaProcessBuilder(String... command) { - return createJavaProcessBuilder(false, command); - } - - /** - * Create ProcessBuilder using the java launcher from the jdk to be tested, - * and with any platform specific arguments prepended. - * - * @param addTestVmAndJavaOptions If true, adds test.vm.opts and test.java.opts - * to the java arguments. - * @param command Arguments to pass to the java command. - * @return The ProcessBuilder instance representing the java command. - */ - public static ProcessBuilder createJavaProcessBuilder(boolean addTestVmAndJavaOptions, String... command) { - String javapath = JDKToolFinder.getJDKTool("java"); - - ArrayList<String> args = new ArrayList<>(); - args.add(javapath); - - if (addTestVmAndJavaOptions) { - // -cp is needed to make sure the same classpath is used whether the test is - // run in AgentVM mode or OtherVM mode. It was added to the hotspot version - // of this API as part of 8077608. However, for the jdk version it is only - // added when addTestVmAndJavaOptions is true in order to minimize - // disruption to existing JDK tests, which have yet to be tested with -cp - // being added. At some point -cp should always be added to be consistent - // with what the hotspot version does. - args.add("-cp"); - args.add(System.getProperty("java.class.path")); - Collections.addAll(args, Utils.getTestJavaOpts()); - } - - Collections.addAll(args, command); - - // Reporting - StringBuilder cmdLine = new StringBuilder(); - for (String cmd : args) - cmdLine.append(cmd).append(' '); - System.out.println("Command line: [" + cmdLine.toString() + "]"); - - return new ProcessBuilder(args.toArray(new String[args.size()])); - } - - private static void printStack(Thread t, StackTraceElement[] stack) { - System.out.println("\t" + t + - " stack: (length = " + stack.length + ")"); - if (t != null) { - for (StackTraceElement stack1 : stack) { - System.out.println("\t" + stack1); - } - System.out.println(); - } - } - - /** - * Executes a test java process, waits for it to finish and returns the process output. - * The default options from jtreg, test.vm.opts and test.java.opts, are added. - * The java from the test.jdk is used to execute the command. - * - * The command line will be like: - * {test.jdk}/bin/java {test.vm.opts} {test.java.opts} cmds - * - * The java process will have exited before this method returns. - * - * @param cmds User specifed arguments. - * @return The output from the process. - */ - public static OutputAnalyzer executeTestJava(String... options) throws Exception { - ProcessBuilder pb = createJavaProcessBuilder(Utils.addTestJavaOpts(options)); - return executeProcess(pb); - } - - /** - * @deprecated Use executeTestJava instead - */ - public static OutputAnalyzer executeTestJvm(String... options) throws Exception { - return executeTestJava(options); - } - - /** - * Executes a process, waits for it to finish and returns the process output. - * The process will have exited before this method returns. - * @param pb The ProcessBuilder to execute. - * @return The {@linkplain OutputAnalyzer} instance wrapping the process. - */ - public static OutputAnalyzer executeProcess(ProcessBuilder pb) throws Exception { - return executeProcess(pb, null); - } - - /** - * Executes a process, pipe some text into its STDIN, waits for it - * to finish and returns the process output. The process will have exited - * before this method returns. - * @param pb The ProcessBuilder to execute. - * @param input The text to pipe into STDIN. Can be null. - * @return The {@linkplain OutputAnalyzer} instance wrapping the process. - */ - public static OutputAnalyzer executeProcess(ProcessBuilder pb, String input) - throws Exception { - OutputAnalyzer output = null; - Process p = null; - boolean failed = false; - try { - p = pb.start(); - if (input != null) { - try (OutputStream os = p.getOutputStream(); - PrintStream ps = new PrintStream(os)) { - ps.print(input); - ps.flush(); - } - } - output = new OutputAnalyzer(p); - p.waitFor(); - - return output; - } catch (Throwable t) { - if (p != null) { - p.destroyForcibly().waitFor(); - } - - failed = true; - System.out.println("executeProcess() failed: " + t); - throw t; - } finally { - if (failed) { - System.err.println(getProcessLog(pb, output)); - } - } - } - - /** - * Executes a process, waits for it to finish and returns the process output. - * - * The process will have exited before this method returns. - * - * @param cmds The command line to execute. - * @return The output from the process. - */ - public static OutputAnalyzer executeProcess(String... cmds) throws Throwable { - return executeProcess(new ProcessBuilder(cmds)); - } - - /** - * Used to log command line, stdout, stderr and exit code from an executed process. - * @param pb The executed process. - * @param output The output from the process. - */ - public static String getProcessLog(ProcessBuilder pb, OutputAnalyzer output) { - String stderr = output == null ? "null" : output.getStderr(); - String stdout = output == null ? "null" : output.getStdout(); - String exitValue = output == null ? "null": Integer.toString(output.getExitValue()); - StringBuilder logMsg = new StringBuilder(); - final String nl = System.getProperty("line.separator"); - logMsg.append("--- ProcessLog ---" + nl); - logMsg.append("cmd: " + getCommandLine(pb) + nl); - logMsg.append("exit