From 69fc273f202352f74a313c37db0198be2be08616 Mon Sep 17 00:00:00 2001 From: "Daniel D. Daugherty" Date: Thu, 17 Feb 2022 20:56:46 +0000 Subject: [PATCH 001/340] 8282075: ProblemList 3 compiler/whitebox tests on macosx-x64 Reviewed-by: mikael, bpb --- test/hotspot/jtreg/ProblemList.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/hotspot/jtreg/ProblemList.txt b/test/hotspot/jtreg/ProblemList.txt index a09185a4b19..9c9b1b0b3c5 100644 --- a/test/hotspot/jtreg/ProblemList.txt +++ b/test/hotspot/jtreg/ProblemList.txt @@ -67,9 +67,9 @@ compiler/rtm/print/TestPrintPreciseRTMLockingStatistics.java 8183263 generic-x64 compiler/c2/Test8004741.java 8235801 generic-all -compiler/whitebox/ClearMethodStateTest.java 8265360 macosx-aarch64 -compiler/whitebox/EnqueueMethodForCompilationTest.java 8265360 macosx-aarch64 -compiler/whitebox/MakeMethodNotCompilableTest.java 8265360 macosx-aarch64 +compiler/whitebox/ClearMethodStateTest.java 8265360 macosx-generic +compiler/whitebox/EnqueueMethodForCompilationTest.java 8265360 macosx-generic +compiler/whitebox/MakeMethodNotCompilableTest.java 8265360 macosx-generic compiler/codecache/jmx/PoolsIndependenceTest.java 8264632 macosx-generic compiler/codecache/TestStressCodeBuffers.java 8272094 generic-aarch64 -- GitLab From f830cbec909b91ad0f00f46a3496d83ecb5912ed Mon Sep 17 00:00:00 2001 From: Magnus Ihse Bursie Date: Thu, 17 Feb 2022 21:18:15 +0000 Subject: [PATCH 002/340] 8188073: Add Capstone as backend for hsdis Co-authored-by: Magnus Ihse Bursie Co-authored-by: Jorn Vernee Reviewed-by: erikj --- make/Hsdis.gmk | 151 +++++++++++------- make/autoconf/help.m4 | 4 + make/autoconf/jdk-options.m4 | 42 ++++- make/autoconf/spec.gmk.in | 3 +- src/utils/hsdis/README | 102 ------------ src/utils/hsdis/README.md | 133 +++++++++++++++ .../{hsdis.c => binutils/hsdis-binutils.c} | 0 src/utils/hsdis/capstone/hsdis-capstone.c | 97 +++++++++++ src/utils/hsdis/hsdis.h | 20 ++- 9 files changed, 381 insertions(+), 171 deletions(-) delete mode 100644 src/utils/hsdis/README create mode 100644 src/utils/hsdis/README.md rename src/utils/hsdis/{hsdis.c => binutils/hsdis-binutils.c} (100%) create mode 100644 src/utils/hsdis/capstone/hsdis-capstone.c diff --git a/make/Hsdis.gmk b/make/Hsdis.gmk index 02f09b320f0..fa5238c80f6 100644 --- a/make/Hsdis.gmk +++ b/make/Hsdis.gmk @@ -1,5 +1,5 @@ # -# Copyright (c) 2020, 2021, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2020, 2022, 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 @@ -36,89 +36,111 @@ include JdkNativeCompilation.gmk HSDIS_OUTPUT_DIR := $(SUPPORT_OUTPUTDIR)/hsdis +HSDIS_TOOLCHAIN := TOOLCHAIN_DEFAULT +HSDIS_TOOLCHAIN_CFLAGS := $(CFLAGS_JDKLIB) +HSDIS_TOOLCHAIN_LDFLAGS := $(LDFLAGS_JDKLIB) + ifeq ($(call isTargetOs, windows), true) INSTALLED_HSDIS_DIR := $(JDK_OUTPUTDIR)/bin + IMAGE_HSDIS_DIR := $(JDK_IMAGE_DIR)/bin +else + INSTALLED_HSDIS_DIR := $(JDK_OUTPUTDIR)/lib + IMAGE_HSDIS_DIR := $(JDK_IMAGE_DIR)/lib +endif - # On windows, we need to "fake" a completely different toolchain using gcc - # instead of the normal microsoft toolchain. This is quite hacky... +ifeq ($(HSDIS_BACKEND), capstone) + ifeq ($(call isTargetCpuArch, x86), true) + CAPSTONE_ARCH := CS_ARCH_X86 + CAPSTONE_MODE := CS_MODE_$(OPENJDK_TARGET_CPU_BITS) + else ifeq ($(call isTargetCpuArch, aarch64), true) + CAPSTONE_ARCH := CS_ARCH_ARM64 + CAPSTONE_MODE := CS_MODE_ARM + else + $(error No support for Capstone on this platform) + endif - MINGW_BASE := x86_64-w64-mingw32 + HSDIS_CFLAGS += -DCAPSTONE_ARCH=$(CAPSTONE_ARCH) \ + -DCAPSTONE_MODE=$(CAPSTONE_MODE) +endif + +ifeq ($(HSDIS_BACKEND), binutils) + ifeq ($(call isTargetOs, windows), true) + # On windows, we need to "fake" a completely different toolchain using gcc + # instead of the normal microsoft toolchain. This is quite hacky... - MINGW_SYSROOT = $(shell $(MINGW_BASE)-gcc -print-sysroot) - ifeq ($(wildcard $(MINGW_SYSROOT)), ) - # Use fallback path - MINGW_SYSROOT := /usr/$(MINGW_BASE) + MINGW_BASE := x86_64-w64-mingw32 + + MINGW_SYSROOT = $(shell $(MINGW_BASE)-gcc -print-sysroot) ifeq ($(wildcard $(MINGW_SYSROOT)), ) - $(error mingw sysroot not found) + # Use fallback path + MINGW_SYSROOT := /usr/$(MINGW_BASE) + ifeq ($(wildcard $(MINGW_SYSROOT)), ) + $(error mingw sysroot not found) + endif endif - endif - $(eval $(call DefineNativeToolchain, TOOLCHAIN_MINGW, \ - CC := $(MINGW_BASE)-gcc, \ - LD := $(MINGW_BASE)-ld, \ - OBJCOPY := $(MINGW_BASE)-objcopy, \ - RC := $(RC), \ - SYSROOT_CFLAGS := --sysroot=$(MINGW_SYSROOT), \ - SYSROOT_LDFLAGS := --sysroot=$(MINGW_SYSROOT), \ - )) - - MINGW_SYSROOT_LIB_PATH := $(MINGW_SYSROOT)/mingw/lib - ifeq ($(wildcard $(MINGW_SYSROOT_LIB_PATH)), ) - # Try without mingw - MINGW_SYSROOT_LIB_PATH := $(MINGW_SYSROOT)/lib + $(eval $(call DefineNativeToolchain, TOOLCHAIN_MINGW, \ + CC := $(MINGW_BASE)-gcc, \ + LD := $(MINGW_BASE)-ld, \ + OBJCOPY := $(MINGW_BASE)-objcopy, \ + RC := $(RC), \ + SYSROOT_CFLAGS := --sysroot=$(MINGW_SYSROOT), \ + SYSROOT_LDFLAGS := --sysroot=$(MINGW_SYSROOT), \ + )) + + MINGW_SYSROOT_LIB_PATH := $(MINGW_SYSROOT)/mingw/lib ifeq ($(wildcard $(MINGW_SYSROOT_LIB_PATH)), ) - $(error mingw sysroot lib path not found) + # Try without mingw + MINGW_SYSROOT_LIB_PATH := $(MINGW_SYSROOT)/lib + ifeq ($(wildcard $(MINGW_SYSROOT_LIB_PATH)), ) + $(error mingw sysroot lib path not found) + endif endif - endif - MINGW_VERSION = $(shell $(MINGW_BASE)-gcc -v 2>&1 | $(GREP) "gcc version" | $(CUT) -d " " -f 3) - MINGW_GCC_LIB_PATH := /usr/lib/gcc/$(MINGW_BASE)/$(MINGW_VERSION) - ifeq ($(wildcard $(MINGW_GCC_LIB_PATH)), ) - # Try using only major version number - MINGW_VERSION_MAJOR := $(firstword $(subst ., , $(MINGW_VERSION))) - MINGW_GCC_LIB_PATH := /usr/lib/gcc/$(MINGW_BASE)/$(MINGW_VERSION_MAJOR) + MINGW_VERSION = $(shell $(MINGW_BASE)-gcc -v 2>&1 | $(GREP) "gcc version" | $(CUT) -d " " -f 3) + MINGW_GCC_LIB_PATH := /usr/lib/gcc/$(MINGW_BASE)/$(MINGW_VERSION) ifeq ($(wildcard $(MINGW_GCC_LIB_PATH)), ) - $(error mingw gcc lib path not found) + # Try using only major version number + MINGW_VERSION_MAJOR := $(firstword $(subst ., , $(MINGW_VERSION))) + MINGW_GCC_LIB_PATH := /usr/lib/gcc/$(MINGW_BASE)/$(MINGW_VERSION_MAJOR) + ifeq ($(wildcard $(MINGW_GCC_LIB_PATH)), ) + $(error mingw gcc lib path not found) + endif endif - endif - TOOLCHAIN_TYPE := gcc - OPENJDK_TARGET_OS := linux - CC_OUT_OPTION := -o$(SPACE) - LD_OUT_OPTION := -o$(SPACE) - GENDEPS_FLAGS := -MMD -MF - CFLAGS_DEBUG_SYMBOLS := -g - DISABLED_WARNINGS := - DISABLE_WARNING_PREFIX := -Wno- - CFLAGS_WARNINGS_ARE_ERRORS := -Werror - SHARED_LIBRARY_FLAGS := -shared - - HSDIS_TOOLCHAIN := TOOLCHAIN_MINGW - HSDIS_TOOLCHAIN_CFLAGS := - HSDIS_TOOLCHAIN_LDFLAGS := -L$(MINGW_GCC_LIB_PATH) -L$(MINGW_SYSROOT_LIB_PATH) - MINGW_DLLCRT := $(MINGW_SYSROOT_LIB_PATH)/dllcrt2.o - HSDIS_TOOLCHAIN_LIBS := $(MINGW_DLLCRT) -lmingw32 -lgcc -lgcc_eh -lmoldname \ - -lmingwex -lmsvcrt -lpthread -ladvapi32 -lshell32 -luser32 -lkernel32 -else - INSTALLED_HSDIS_DIR := $(JDK_OUTPUTDIR)/lib - - HSDIS_TOOLCHAIN := TOOLCHAIN_DEFAULT - HSDIS_TOOLCHAIN_CFLAGS := $(CFLAGS_JDKLIB) - HSDIS_TOOLCHAIN_LDFLAGS := $(LDFLAGS_JDKLIB) - HSDIS_TOOLCHAIN_LIBS := -ldl + TOOLCHAIN_TYPE := gcc + OPENJDK_TARGET_OS := linux + CC_OUT_OPTION := -o$(SPACE) + LD_OUT_OPTION := -o$(SPACE) + GENDEPS_FLAGS := -MMD -MF + CFLAGS_DEBUG_SYMBOLS := -g + DISABLED_WARNINGS := + DISABLE_WARNING_PREFIX := -Wno- + CFLAGS_WARNINGS_ARE_ERRORS := -Werror + SHARED_LIBRARY_FLAGS := -shared + + HSDIS_TOOLCHAIN := TOOLCHAIN_MINGW + HSDIS_TOOLCHAIN_CFLAGS := + HSDIS_TOOLCHAIN_LDFLAGS := -L$(MINGW_GCC_LIB_PATH) -L$(MINGW_SYSROOT_LIB_PATH) + MINGW_DLLCRT := $(MINGW_SYSROOT_LIB_PATH)/dllcrt2.o + HSDIS_TOOLCHAIN_LIBS := $(MINGW_DLLCRT) -lmingw32 -lgcc -lgcc_eh -lmoldname \ + -lmingwex -lmsvcrt -lpthread -ladvapi32 -lshell32 -luser32 -lkernel32 + else + HSDIS_TOOLCHAIN_LIBS := -ldl + endif endif - $(eval $(call SetupJdkLibrary, BUILD_HSDIS, \ NAME := hsdis, \ - SRC := $(TOPDIR)/src/utils/hsdis, \ + SRC := $(TOPDIR)/src/utils/hsdis/$(HSDIS_BACKEND), \ + EXTRA_HEADER_DIRS := $(TOPDIR)/src/utils/hsdis, \ TOOLCHAIN := $(HSDIS_TOOLCHAIN), \ OUTPUT_DIR := $(HSDIS_OUTPUT_DIR), \ OBJECT_DIR := $(HSDIS_OUTPUT_DIR), \ DISABLED_WARNINGS_gcc := undef format-nonliteral sign-compare, \ DISABLED_WARNINGS_clang := undef format-nonliteral, \ CFLAGS := $(HSDIS_TOOLCHAIN_CFLAGS) $(HSDIS_CFLAGS), \ - LDFLAGS := $(HSDIS_TOOLCHAIN_LDFLAGS) $(SHARED_LIBRARY_FLAGS), \ + LDFLAGS := $(HSDIS_TOOLCHAIN_LDFLAGS) $(HSDIS_LDFLAGS) $(SHARED_LIBRARY_FLAGS), \ LIBS := $(HSDIS_LIBS) $(HSDIS_TOOLCHAIN_LIBS), \ )) @@ -129,13 +151,18 @@ TARGETS += build INSTALLED_HSDIS_NAME := hsdis-$(OPENJDK_TARGET_CPU_LEGACY_LIB)$(SHARED_LIBRARY_SUFFIX) INSTALLED_HSDIS := $(INSTALLED_HSDIS_DIR)/$(INSTALLED_HSDIS_NAME) +INSTALLED_HSDIS_IMAGE := $(IMAGE_HSDIS_DIR)/$(INSTALLED_HSDIS_NAME) $(INSTALLED_HSDIS): $(BUILD_HSDIS_TARGET) - $(call LogWarn, NOTE: The resulting build might not be redistributable. Seek legal advice before distibuting.) + ifeq ($(HSDIS_BACKEND), binutils) + $(call LogWarn, NOTE: The resulting build might not be redistributable. Seek legal advice before distributing.) + endif $(install-file) +$(INSTALLED_HSDIS_IMAGE): $(INSTALLED_HSDIS) + $(install-file) -install: $(INSTALLED_HSDIS) +install: $(INSTALLED_HSDIS_IMAGE) TARGETS += install diff --git a/make/autoconf/help.m4 b/make/autoconf/help.m4 index 09e82e36c94..486e78d4fcf 100644 --- a/make/autoconf/help.m4 +++ b/make/autoconf/help.m4 @@ -117,6 +117,8 @@ apt_help() { PKGHANDLER_COMMAND="sudo apt-get install ccache" ;; dtrace) PKGHANDLER_COMMAND="sudo apt-get install systemtap-sdt-dev" ;; + capstone) + PKGHANDLER_COMMAND="sudo apt-get install libcapstone-dev" ;; esac } @@ -168,6 +170,8 @@ brew_help() { PKGHANDLER_COMMAND="brew install freetype" ;; ccache) PKGHANDLER_COMMAND="brew install ccache" ;; + capstone) + PKGHANDLER_COMMAND="brew install capstone" ;; esac } diff --git a/make/autoconf/jdk-options.m4 b/make/autoconf/jdk-options.m4 index 0a7145c9116..7692407316a 100644 --- a/make/autoconf/jdk-options.m4 +++ b/make/autoconf/jdk-options.m4 @@ -811,7 +811,10 @@ AC_DEFUN([JDKOPT_BUILD_BINUTILS], AC_DEFUN_ONCE([JDKOPT_SETUP_HSDIS], [ AC_ARG_WITH([hsdis], [AS_HELP_STRING([--with-hsdis], - [what hsdis backend to use ('none', 'binutils') @<:@none@:>@])]) + [what hsdis backend to use ('none', 'capstone', 'binutils') @<:@none@:>@])]) + + AC_ARG_WITH(capstone, [AS_HELP_STRING([--with-capstone], + [where to find the Capstone files needed for hsdis/capstone])]) AC_ARG_WITH([binutils], [AS_HELP_STRING([--with-binutils], [where to find the binutils files needed for hsdis/binutils])]) @@ -826,6 +829,41 @@ AC_DEFUN_ONCE([JDKOPT_SETUP_HSDIS], elif test "x$with_hsdis" = xnone || test "x$with_hsdis" = xno || test "x$with_hsdis" = x; then HSDIS_BACKEND=none AC_MSG_RESULT(['none', hsdis will not be built]) + elif test "x$with_hsdis" = xcapstone; then + HSDIS_BACKEND=capstone + AC_MSG_RESULT(['capstone']) + + if test "x$with_capstone" != x; then + AC_MSG_CHECKING([for capstone]) + CAPSTONE="$with_capstone" + AC_MSG_RESULT([$CAPSTONE]) + + HSDIS_CFLAGS="-I${CAPSTONE}/include/capstone" + if test "x$OPENJDK_TARGET_OS" != xwindows; then + HSDIS_LDFLAGS="-L${CAPSTONE}/lib" + HSDIS_LIBS="-lcapstone" + else + HSDIS_LDFLAGS="-nodefaultlib:libcmt.lib" + HSDIS_LIBS="${CAPSTONE}/capstone.lib" + fi + else + if test "x$OPENJDK_TARGET_OS" = xwindows; then + # There is no way to auto-detect capstone on Windowos + AC_MSG_NOTICE([You must specify capstone location using --with-capstone=]) + AC_MSG_ERROR([Cannot continue]) + fi + + PKG_CHECK_MODULES(CAPSTONE, capstone, [CAPSTONE_FOUND=yes], [CAPSTONE_FOUND=no]) + if test "x$CAPSTONE_FOUND" = xyes; then + HSDIS_CFLAGS="$CAPSTONE_CFLAGS" + HSDIS_LDFLAGS="$CAPSTONE_LDFLAGS" + HSDIS_LIBS="$CAPSTONE_LIBS" + else + HELP_MSG_MISSING_DEPENDENCY([capstone]) + AC_MSG_NOTICE([Cannot locate capstone which is needed for hsdis/capstone. Try using --with-capstone=. $HELP_MSG]) + AC_MSG_ERROR([Cannot continue]) + fi + fi elif test "x$with_hsdis" = xbinutils; then HSDIS_BACKEND=binutils AC_MSG_RESULT(['binutils']) @@ -853,6 +891,7 @@ AC_DEFUN_ONCE([JDKOPT_SETUP_HSDIS], test -e $BINUTILS_DIR/opcodes/libopcodes.a && \ test -e $BINUTILS_DIR/libiberty/libiberty.a; then HSDIS_CFLAGS="-I$BINUTILS_DIR/include -I$BINUTILS_DIR/bfd -DLIBARCH_$OPENJDK_TARGET_CPU_LEGACY_LIB" + HSDIS_LDFLAGS="" HSDIS_LIBS="$BINUTILS_DIR/bfd/libbfd.a $BINUTILS_DIR/opcodes/libopcodes.a $BINUTILS_DIR/libiberty/libiberty.a $BINUTILS_DIR/zlib/libz.a" fi fi @@ -895,5 +934,6 @@ AC_DEFUN_ONCE([JDKOPT_SETUP_HSDIS], AC_SUBST(HSDIS_BACKEND) AC_SUBST(HSDIS_CFLAGS) + AC_SUBST(HSDIS_LDFLAGS) AC_SUBST(HSDIS_LIBS) ]) diff --git a/make/autoconf/spec.gmk.in b/make/autoconf/spec.gmk.in index 3dce730970e..d286d5cc2cc 100644 --- a/make/autoconf/spec.gmk.in +++ b/make/autoconf/spec.gmk.in @@ -1,5 +1,5 @@ # -# Copyright (c) 2011, 2021, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2011, 2022, 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 @@ -361,6 +361,7 @@ ALLOW_ABSOLUTE_PATHS_IN_OUTPUT := @ALLOW_ABSOLUTE_PATHS_IN_OUTPUT@ HSDIS_BACKEND := @HSDIS_BACKEND@ HSDIS_CFLAGS := @HSDIS_CFLAGS@ +HSDIS_LDFLAGS := @HSDIS_LDFLAGS@ HSDIS_LIBS := @HSDIS_LIBS@ # The boot jdk to use. This is overridden in bootcycle-spec.gmk. Make sure to keep diff --git a/src/utils/hsdis/README b/src/utils/hsdis/README deleted file mode 100644 index 64a8ab61a7c..00000000000 --- a/src/utils/hsdis/README +++ /dev/null @@ -1,102 +0,0 @@ -Copyright (c) 2008, 2021, Oracle and/or its affiliates. All rights reserved. -DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - -The Universal Permissive License (UPL), Version 1.0 - -Subject to the condition set forth below, permission is hereby granted to -any person obtaining a copy of this software, associated documentation -and/or data (collectively the "Software"), free of charge and under any -and all copyright rights in the Software, and any and all patent rights -owned or freely licensable by each licensor hereunder covering either (i) -the unmodified Software as contributed to or provided by such licensor, -or (ii) the Larger Works (as defined below), to deal in both - -(a) the Software, and - -(b) any piece of software and/or hardware listed in the lrgrwrks.txt file -if one is included with the Software (each a "Larger Work" to which the -Software is contributed by such licensors), - -without restriction, including without limitation the rights to copy, -create derivative works of, display, perform, and distribute the Software -and make, use, sell, offer for sale, import, export, have made, and have -sold the Software and the Larger Work(s), and to sublicense the foregoing -rights on either these or other terms. - -This license is subject to the following condition: - -The above copyright notice and either this complete permission notice or -at a minimum a reference to the UPL must be included in all copies or -substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -USE OR OTHER DEALINGS IN THE SOFTWARE. - -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. - -________________________________________________________________________ - -'hsdis': A HotSpot plugin for disassembling dynamically generated code. - -The files in this directory are built independently of the HotSpot JVM. - -* Building - -To build this project you need a copy of GNU binutils to build against. It is -known to work with binutils 2.37. Building against versions older than 2.29 is -not supported. Download a copy of the software from -http://directory.fsf.org/project/binutils or one of its mirrors. - -To build this library, you must enable building in configure by "bash configure ---with-hsdis=binutils". - -You must also specify where binutils is located. To facilitate building, you can -point to a place where the (unpacked) binutils sources are located using -"--with-binutils-src=", and configure will build binutils for you. On -repeated runs, you can keep this command line option, since configure will -figure out that the binutils binaries are already present and skip building, or -you can replace it with "--with-binutils=". - -If you have pre-built binutils binaries, you can point to them directly using -"--with-binutils=". - -If you want to build hsdis with binutils provided by system -(e.g. binutils-devel from Fedora, binutils-dev from Ubuntu), you can pass -"--with-binutils=system". "system" is available on Linux only. - -When you have created a proper configuration, you can then build the hsdis -library using "make build-hsdis". - -* Building on Windows - -On Windows, the normal Microsoft Visual Studio toolchain cannot build binutils. -Instead we need to use the mingw compiler. This is available as a cygwin -package. You need to install the "gcc-core" and "mingw64-x86_64-gcc-core" -packages (or "mingw64-i686-gcc-core", if you want the 32-bit version) and -"mingw64-x86_64-glib2.0". - -* Installing - -To build the hsdis library, run "make build-hsdis". This will build the library -in a separate directory, but not make it available to the JDK in the -configuration. To actually install it in the JDK, run "make install-hsdis". - -Note: The resulting build may not be distributable. Please get legal advice if -you intend to distribute the result of your build. - -* Using the library - -The hsdis library will be automatically loaded by Hotspot when you use the -diagnostic option "-XX:+PrintAssembly". Note that since this is a diagnostic -option, you need to unlock these first, so in practice you activate it using -"-XX:+UnlockDiagnosticVMOptions -XX:+PrintAssembly". - -More information is available at the wiki -[https://wiki.openjdk.java.net/display/HotSpot/PrintAssembly]. diff --git a/src/utils/hsdis/README.md b/src/utils/hsdis/README.md new file mode 100644 index 00000000000..bc8bdb767b7 --- /dev/null +++ b/src/utils/hsdis/README.md @@ -0,0 +1,133 @@ +``` +Copyright (c) 2008, 2022, Oracle and/or its affiliates. All rights reserved. +DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + +The Universal Permissive License (UPL), Version 1.0 + +Subject to the condition set forth below, permission is hereby granted to +any person obtaining a copy of this software, associated documentation +and/or data (collectively the "Software"), free of charge and under any +and all copyright rights in the Software, and any and all patent rights +owned or freely licensable by each licensor hereunder covering either (i) +the unmodified Software as contributed to or provided by such licensor, +or (ii) the Larger Works (as defined below), to deal in both + +(a) the Software, and + +(b) any piece of software and/or hardware listed in the lrgrwrks.txt file +if one is included with the Software (each a "Larger Work" to which the +Software is contributed by such licensors), + +without restriction, including without limitation the rights to copy, +create derivative works of, display, perform, and distribute the Software +and make, use, sell, offer for sale, import, export, have made, and have +sold the Software and the Larger Work(s), and to sublicense the foregoing +rights on either these or other terms. + +This license is subject to the following condition: + +The above copyright notice and either this complete permission notice or +at a minimum a reference to the UPL must be included in all copies or +substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +USE OR OTHER DEALINGS IN THE SOFTWARE. + +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. +``` + +--- + +# hsdis - a HotSpot plugin for disassembling dynamically generated code + +The files in this directory are built independently of the HotSpot JVM. + +hsdis is an interface exposed by Hotspot. There are several backends that +implement this interface, using different disassembly engines. Included in the +JDK is support for building hsdis with Capstone or GNU binutils. The interface +is fairly straightforward and easy to implement using other backends. + +## Building and installing + +To compile hsdis, you need to activate hsdis support, and select the proper +backend to use. This is done with the configure switch `--with-hsdis=`, +where `` is either `capstone` or `binutils`. For details, see the +sections on the respective backends below. + +To build the hsdis library, run `make build-hsdis`. This will build the library +in a separate directory, but not make it available to the JDK in the +configuration. To actually install it in the JDK, run `make install-hsdis`. + +**NOTE:** If you do this using the binutils backend, the resulting build may not +be distributable. Please get legal advice if you intend to distribute the result +of your build. + +## Using the library + +The hsdis library will be automatically loaded by Hotspot when you use the +diagnostic option `-XX:+PrintAssembly`. Note that since this is a diagnostic +option, you need to unlock these first, so in practice you activate it using +`-XX:+UnlockDiagnosticVMOptions -XX:+PrintAssembly`. + +More information is available at the [HotSpot +wiki](https://wiki.openjdk.java.net/display/HotSpot/PrintAssembly). + +## Building with Capstone + +To build this project using Capstone you need to have Capstone installed. +Typical ways of installation can be `sudo apt install libcapstone-dev` (on +Debian and derivatives), or `brew install capstone` (on macOS with Homebrew). +For Windows, you need to download the "Core Engine", and unzip it. See the +[Capstone Download +page](https://www.capstone-engine.org/download.html#windows---core-engine-) for +up-to-date download links. + +This has been tested with Capstone v4.0.2, but earlier (and later) versions are +also likely to work. + +To build hsdis using Capstone, you must enable it in configure by `bash +configure --with-hsdis=capstone`. + +On Linux and macOS, the location Capstone can most often be auto-detected. If +this fails, or if you are building on Windows, you need to specify where +Capstone is located using `--with-capstone=`. This path should point to +where you have extracted the Core Engine zip file. + +## Building with binutils + +To build this project using binutils you need a copy of GNU binutils to build +against. It is known to work with binutils 2.37. Building against versions older +than 2.29 is not supported. Download a copy of the software from [FSF binutils +page](http://directory.fsf.org/project/binutils) or one of its mirrors. + +To build this library, you must enable building in configure by `bash configure +--with-hsdis=binutils`. + +You must also specify where binutils is located. To facilitate building, you can +point to a place where the (unpacked) binutils sources are located using +`--with-binutils-src=`, and configure will build binutils for you. On +repeated runs, you can keep this command line option, since configure will +figure out that the binutils binaries are already present and skip building, or +you can replace it with `--with-binutils=`. + +If you have pre-built binutils binaries, you can point to them directly using +`--with-binutils=`. + +If you want to build hsdis with binutils provided by system (e.g. binutils-devel +from Fedora, binutils-dev from Ubuntu), you can pass `--with-binutils=system`. +`system` is available on Linux only. + +### Building with binutils on Windows + +On Windows, the normal Microsoft Visual Studio toolchain cannot build binutils. +Instead we need to use the mingw compiler. This is available as a cygwin +package. You need to install the `gcc-core` and `mingw64-x86_64-gcc-core` +packages (or `mingw64-i686-gcc-core`, if you want the 32-bit version) and +`mingw64-x86_64-glib2.0`. diff --git a/src/utils/hsdis/hsdis.c b/src/utils/hsdis/binutils/hsdis-binutils.c similarity index 100% rename from src/utils/hsdis/hsdis.c rename to src/utils/hsdis/binutils/hsdis-binutils.c diff --git a/src/utils/hsdis/capstone/hsdis-capstone.c b/src/utils/hsdis/capstone/hsdis-capstone.c new file mode 100644 index 00000000000..d71330ee6a7 --- /dev/null +++ b/src/utils/hsdis/capstone/hsdis-capstone.c @@ -0,0 +1,97 @@ +/* + * Copyright (c) 2019, 2022, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * The Universal Permissive License (UPL), Version 1.0 + * + * Subject to the condition set forth below, permission is hereby granted to + * any person obtaining a copy of this software, associated documentation + * and/or data (collectively the "Software"), free of charge and under any + * and all copyright rights in the Software, and any and all patent rights + * owned or freely licensable by each licensor hereunder covering either (i) + * the unmodified Software as contributed to or provided by such licensor, + * or (ii) the Larger Works (as defined below), to deal in both + * + * (a) the Software, and + * + * (b) any piece of software and/or hardware listed in the lrgrwrks.txt file + * if one is included with the Software (each a "Larger Work" to which the + * Software is contributed by such licensors), + * + * without restriction, including without limitation the rights to copy, + * create derivative works of, display, perform, and distribute the Software + * and make, use, sell, offer for sale, import, export, have made, and have + * sold the Software and the Larger Work(s), and to sublicense the foregoing + * rights on either these or other terms. + * + * This license is subject to the following condition: + * + * The above copyright notice and either this complete permission notice or + * at a minimum a reference to the UPL must be included in all copies or + * substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN + * NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + * USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * 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. + * + */ + +/* hsdis.c -- dump a range of addresses as native instructions + This implements the plugin protocol required by the + HotSpot PrintAssembly option. +*/ + +#include + +#include + +#include "hsdis.h" + +/* short names for stuff in hsdis.h */ +typedef decode_instructions_event_callback_ftype event_callback_t; +typedef decode_instructions_printf_callback_ftype printf_callback_t; + +#define print(...) (*printf_callback) (printf_stream, __VA_ARGS__) + +#ifdef _WIN32 +__declspec(dllexport) +#endif +void* decode_instructions_virtual(uintptr_t start_va, uintptr_t end_va, + unsigned char* buffer, uintptr_t length, + void* (*event_callback)(void*, const char*, void*), + void* event_stream, + int (*printf_callback)(void*, const char*, ...), + void* printf_stream, + const char* options, + int newline /* bool value for nice new line */) { + csh cs_handle; + + if (cs_open(CAPSTONE_ARCH, CAPSTONE_MODE, &cs_handle) != CS_ERR_OK) { + print("Could not open cs_handle"); + return NULL; + } + + // TODO: Support intel syntax + cs_option(cs_handle, CS_OPT_SYNTAX, CS_OPT_SYNTAX_ATT); + + cs_insn *insn; + size_t count = cs_disasm(cs_handle, buffer, length, (uintptr_t) buffer, 0 , &insn); + if (count) { + for (unsigned int j = 0; j < count; j++) { + print(" 0x%" PRIx64 ":\t%s\t\t%s\n", insn[j].address, insn[j].mnemonic, insn[j].op_str); + } + cs_free(insn, count); + } + + cs_close(&cs_handle); + + return NULL; +} diff --git a/src/utils/hsdis/hsdis.h b/src/utils/hsdis/hsdis.h index a6b45a57ba8..7e3b8e397af 100644 --- a/src/utils/hsdis/hsdis.h +++ b/src/utils/hsdis/hsdis.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * The Universal Permissive License (UPL), Version 1.0 @@ -72,9 +72,14 @@ #ifndef SHARED_TOOLS_HSDIS_H #define SHARED_TOOLS_HSDIS_H +#ifdef __cplusplus +extern "C" +{ +#endif + extern -#ifdef DLL_EXPORT - DLL_EXPORT +#ifdef _WIN32 +__declspec(dllexport) #endif void* decode_instructions_virtual(uintptr_t start_va, uintptr_t end_va, unsigned char* buffer, uintptr_t length, @@ -87,8 +92,8 @@ void* decode_instructions_virtual(uintptr_t start_va, uintptr_t end_va, /* This is the compatability interface for older versions of hotspot */ extern -#ifdef DLL_ENTRY - DLL_ENTRY +#ifdef _WIN32 +__declspec(dllexport) #endif void* decode_instructions(void* start_pv, void* end_pv, void* (*event_callback)(void*, const char*, void*), @@ -115,4 +120,9 @@ typedef void* (*decode_func_stype) (void* start_pv, void* end_pv, decode_instructions_printf_callback_ftype printf_callback, void* printf_stream, const char* options); + +#ifdef __cplusplus +} +#endif + #endif /* SHARED_TOOLS_HSDIS_H */ -- GitLab From fdce35f3a1c12a64238d0c76c02451a25b0b4abb Mon Sep 17 00:00:00 2001 From: Jie Fu Date: Thu, 17 Feb 2022 22:53:53 +0000 Subject: [PATCH 003/340] 8282025: assert(ctrl != __null) failed: control out is assumed to be unique after JDK-8281732 Reviewed-by: kvn, thartmann, chagedorn --- src/hotspot/share/gc/shenandoah/c2/shenandoahSupport.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/hotspot/share/gc/shenandoah/c2/shenandoahSupport.cpp b/src/hotspot/share/gc/shenandoah/c2/shenandoahSupport.cpp index f46d9436316..849b40f3d79 100644 --- a/src/hotspot/share/gc/shenandoah/c2/shenandoahSupport.cpp +++ b/src/hotspot/share/gc/shenandoah/c2/shenandoahSupport.cpp @@ -1,5 +1,6 @@ /* * Copyright (c) 2015, 2021, Red Hat, Inc. All rights reserved. + * Copyright (C) 2022 THL A29 Limited, a Tencent company. 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 @@ -706,7 +707,7 @@ Node* ShenandoahBarrierC2Support::no_branches(Node* c, Node* dom, bool allow_one Node* iffproj = NULL; while (c != dom) { Node* next = phase->idom(c); - assert(next->unique_ctrl_out() == c || c->is_Proj() || c->is_Region(), "multiple control flow out but no proj or region?"); + assert(next->unique_ctrl_out_or_null() == c || c->is_Proj() || c->is_Region(), "multiple control flow out but no proj or region?"); if (c->is_Region()) { ResourceMark rm; Unique_Node_List wq; -- GitLab From a22f422b7f18dc134e48c6193bf690004635bf7d Mon Sep 17 00:00:00 2001 From: Prasanta Sadhukhan Date: Fri, 18 Feb 2022 04:56:05 +0000 Subject: [PATCH 004/340] 8037573: Typo in DefaultTreeModel docs: askAllowsChildren instead of asksAllowsChildren Reviewed-by: prr, jdv, azvegint --- .../share/classes/javax/swing/tree/DefaultTreeModel.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/java.desktop/share/classes/javax/swing/tree/DefaultTreeModel.java b/src/java.desktop/share/classes/javax/swing/tree/DefaultTreeModel.java index 6d2a692c043..4cdec3f6b38 100644 --- a/src/java.desktop/share/classes/javax/swing/tree/DefaultTreeModel.java +++ b/src/java.desktop/share/classes/javax/swing/tree/DefaultTreeModel.java @@ -204,7 +204,7 @@ public class DefaultTreeModel implements Serializable, TreeModel { /** * Returns whether the specified node is a leaf node. * The way the test is performed depends on the - * askAllowsChildren setting. + * asksAllowsChildren setting. * * @param node the node to check * @return true if the node is a leaf node -- GitLab From c9289583eb6919ced3b4115cf981180f6a957fbf Mon Sep 17 00:00:00 2001 From: Jie Fu Date: Fri, 18 Feb 2022 05:02:19 +0000 Subject: [PATCH 005/340] 8281936: compiler/arguments/TestCodeEntryAlignment.java fails on AVX512 machines Reviewed-by: shade, kvn --- src/hotspot/cpu/x86/sharedRuntime_x86_64.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hotspot/cpu/x86/sharedRuntime_x86_64.cpp b/src/hotspot/cpu/x86/sharedRuntime_x86_64.cpp index 6597c91bb42..8bfbe3303da 100644 --- a/src/hotspot/cpu/x86/sharedRuntime_x86_64.cpp +++ b/src/hotspot/cpu/x86/sharedRuntime_x86_64.cpp @@ -3002,7 +3002,7 @@ RuntimeStub* SharedRuntime::generate_resolve_blob(address destination, const cha // allocate space for the code ResourceMark rm; - CodeBuffer buffer(name, 1000, 512); + CodeBuffer buffer(name, 1200, 512); MacroAssembler* masm = new MacroAssembler(&buffer); int frame_size_in_words; -- GitLab From 7bcca7692b62a37f70c757694f6acff0295371cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roberto=20Casta=C3=B1eda=20Lozano?= Date: Fri, 18 Feb 2022 08:35:52 +0000 Subject: [PATCH 006/340] 8279068: IGV: Update to work with JDK 16 and 17 Reviewed-by: kvn, neliasso, chagedorn --- .../IdealGraphVisualizer/Bytecodes/pom.xml | 6 ++++- .../IdealGraphVisualizer/ControlFlow/pom.xml | 6 ++++- .../IdealGraphVisualizer/Coordinator/pom.xml | 6 ++++- src/utils/IdealGraphVisualizer/Data/pom.xml | 6 ++++- .../IdealGraphVisualizer/Difference/pom.xml | 6 ++++- src/utils/IdealGraphVisualizer/Filter/pom.xml | 8 +++++-- .../IdealGraphVisualizer/FilterWindow/pom.xml | 6 ++++- src/utils/IdealGraphVisualizer/Graal/pom.xml | 6 ++++- src/utils/IdealGraphVisualizer/Graph/pom.xml | 6 ++++- .../HierarchicalLayout/pom.xml | 6 ++++- src/utils/IdealGraphVisualizer/Layout/pom.xml | 6 ++++- .../NetworkConnection/pom.xml | 6 ++++- src/utils/IdealGraphVisualizer/README.md | 2 +- .../SelectionCoordinator/pom.xml | 6 ++++- .../ServerCompiler/pom.xml | 4 ++++ .../IdealGraphVisualizer/Settings/pom.xml | 6 ++++- src/utils/IdealGraphVisualizer/Util/pom.xml | 6 ++++- src/utils/IdealGraphVisualizer/View/pom.xml | 6 ++++- .../IdealGraphVisualizer/application/pom.xml | 5 +++- .../main/resources/idealgraphvisualizer.conf | 24 +++++++++++++++++++ .../IdealGraphVisualizer/branding/pom.xml | 6 ++++- src/utils/IdealGraphVisualizer/pom.xml | 24 ++++++++++++++++++- 22 files changed, 142 insertions(+), 21 deletions(-) create mode 100644 src/utils/IdealGraphVisualizer/application/src/main/resources/idealgraphvisualizer.conf diff --git a/src/utils/IdealGraphVisualizer/Bytecodes/pom.xml b/src/utils/IdealGraphVisualizer/Bytecodes/pom.xml index 188537f81d6..e87ad7fb509 100644 --- a/src/utils/IdealGraphVisualizer/Bytecodes/pom.xml +++ b/src/utils/IdealGraphVisualizer/Bytecodes/pom.xml @@ -1,6 +1,6 @@ diff --git a/src/utils/IdealGraphVisualizer/application/src/main/resources/idealgraphvisualizer.conf b/src/utils/IdealGraphVisualizer/application/src/main/resources/idealgraphvisualizer.conf new file mode 100644 index 00000000000..500ed32f280 --- /dev/null +++ b/src/utils/IdealGraphVisualizer/application/src/main/resources/idealgraphvisualizer.conf @@ -0,0 +1,24 @@ +# Copyright (c) 2022, 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. + +# Open/export modules still accessed by the NetBeans Platform. +# All options must be passed in a single line for multi-platform support. +default_options="-J--add-opens=java.base/java.net=ALL-UNNAMED -J--add-opens=java.desktop/javax.swing.plaf.synth=ALL-UNNAMED -J--add-opens=java.desktop/com.sun.java.swing.plaf.gtk=ALL-UNNAMED -J--add-opens=java.desktop/javax.swing=ALL-UNNAMED -J--add-exports=java.desktop/sun.awt=ALL-UNNAMED" \ No newline at end of file diff --git a/src/utils/IdealGraphVisualizer/branding/pom.xml b/src/utils/IdealGraphVisualizer/branding/pom.xml index 67821ff4621..ed33298d3e4 100644 --- a/src/utils/IdealGraphVisualizer/branding/pom.xml +++ b/src/utils/IdealGraphVisualizer/branding/pom.xml @@ -1,6 +1,6 @@ "; - - private static final boolean PRINT_IR_ENCODING = Boolean.parseBoolean(System.getProperty("PrintIREncoding", "false")); - private static final Pattern IR_ENCODING_PATTERN = - Pattern.compile("(?<=" + IREncodingPrinter.START + "\r?\n)[\\s\\S]*(?=" + IREncodingPrinter.END + ")"); - private static final Pattern COMPILE_ID_PATTERN = Pattern.compile("compile_id='(\\d+)'"); - - private final Map compilations; - private final Class testClass; - private final Map> fails; - private final Pattern compileIdPatternForTestClass; - private final String hotspotPidFileName; - private IRMethod irMethod; // Current IR method to which rules are applied - private Method method; // Current method to which rules are applied - private IR irAnno; // Current IR annotation that is processed. - private int irRuleIndex; // Current IR rule index; - - public IRMatcher(String hotspotPidFileName, String irEncoding, Class testClass) { - this.compilations = new HashMap<>(); - this.fails = new HashMap<>(); - this.testClass = testClass; - this.compileIdPatternForTestClass = Pattern.compile("compile_id='(\\d+)'.*" + Pattern.quote(testClass.getCanonicalName()) - + " (\\S+)"); - this.hotspotPidFileName = hotspotPidFileName; - setupTestMethods(irEncoding); - if (TestFramework.VERBOSE || PRINT_IR_ENCODING) { - System.out.println("Read IR encoding from test VM:"); - System.out.println(irEncoding); - } - if (!compilations.isEmpty()) { - parseHotspotPidFile(); - applyRules(); - } - } - - /** - * Sets up a map testname -> IRMethod (containing the PrintIdeal and PrintOptoAssembly output for testname). - */ - private void setupTestMethods(String irEncoding) { - Map irRulesMap = parseIREncoding(irEncoding); - for (Method m : testClass.getDeclaredMethods()) { - method = m; - IR[] irAnnos = m.getAnnotationsByType(IR.class); - if (irAnnos.length > 0) { - // Validation of legal @IR attributes and placement of the annotation was already done in Test VM. - int[] ids = irRulesMap.get(m.getName()); - TestFramework.check(ids != null, "Should find method name in validIrRulesMap for " + m); - TestFramework.check(ids.length > 0, "Did not find any rule indices for " + m); - TestFramework.check(ids[ids.length - 1] < irAnnos.length, "Invalid IR rule index found in validIrRulesMap for " + m); - if (ids[0] != IREncodingPrinter.NO_RULE_APPLIED) { - // If -1, than there was no matching IR rule for the given conditions. - compilations.put(m.getName(), new IRMethod(m, ids, irAnnos)); - } - } - } - } - - /** - * Read the IR encoding emitted by the test VM to decide if an @IR rule must be checked for a method. - */ - private Map parseIREncoding(String irEncoding) { - Map irRulesMap = new HashMap<>(); - Matcher matcher = IR_ENCODING_PATTERN.matcher(irEncoding); - TestFramework.check(matcher.find(), "Did not find IR encoding"); - String[] lines = matcher.group(0).split("\\R"); - - // Skip first line containing information about the format only - for (int i = 1; i < lines.length; i++) { - String line = lines[i].trim(); - String[] splitComma = line.split(","); - if (splitComma.length < 2) { - throw new TestFrameworkException("Invalid IR match rule encoding. No comma found: " + splitComma[0]); - } - String testName = splitComma[0]; - int[] irRulesIdx = new int[splitComma.length - 1]; - for (int j = 1; j < splitComma.length; j++) { - try { - irRulesIdx[j - 1] = Integer.parseInt(splitComma[j]); - } catch (NumberFormatException e) { - throw new TestFrameworkException("Invalid IR match rule encoding. No number found: " + splitComma[j]); - } - } - irRulesMap.put(testName, irRulesIdx); - } - return irRulesMap; - } - - /** - * Parse the hotspot_pid*.log file from the test VM. Read the PrintIdeal and PrintOptoAssembly entries for all - * methods of the test class that need to be IR matched (according to IR encoding). - */ - private void parseHotspotPidFile() { - Map compileIdMap = new HashMap<>(); - try (var br = Files.newBufferedReader(Paths.get(hotspotPidFileName))) { - String line; - StringBuilder builder = new StringBuilder(); - boolean append = false; - String currentMethod = ""; - while ((line = br.readLine()) != null) { - if (append && line.startsWith(" tag. - } - } else if (isPrintOptoAssemblyStart(line)) { - String methodName = getMethodName(compileIdMap, line); - if (methodName != null) { - TestFramework.check(compilations.containsKey(methodName), "Must be second entry of " + methodName); - currentMethod = methodName; - append = true; // Append all following lines until we hit the closing tag. - } - } - } - } catch (IOException e) { - throw new TestFrameworkException("Error while reading " + hotspotPidFileName, e); - } - } - - /** - * Write the input to the IR method and reset the builder. - */ - private void flushOutput(String line, StringBuilder builder, String currentMethod) { - TestFramework.check(!currentMethod.isEmpty(), "current method must be set"); - IRMethod irMethod = compilations.get(currentMethod); - if (line.startsWith(""); - line = line.replace(""", "\""); - line = line.replace("'", "'"); - line = line.replace("&", "&"); - } - builder.append(line).append(System.lineSeparator()); - } - - private static int getCompileId(Matcher matcher) { - int compileId; - try { - compileId = Integer.parseInt(matcher.group(1)); - } catch (NumberFormatException e) { - throw new TestRunException("Could not parse compile id", e); - } - return compileId; - } - - /** - * Parse the compile id from this line if it belongs to a method that needs to be IR tested (part of test class - * and IR encoding from the test VM specifies that this method has @IR rules to be checked). - */ - private void addTestMethodCompileId(Map compileIdMap, String line) { - Matcher matcher = compileIdPatternForTestClass.matcher(line); - if (matcher.find()) { - // Only care about test class entries. Might have non-class entries as well if user specified additional - // compile commands. Ignore these. - String methodName = matcher.group(2); - if (compilations.containsKey(methodName)) { - // We only care about methods that we are actually gonna IR match based on IR encoding. - int compileId = getCompileId(matcher); - TestRun.check(!methodName.isEmpty(), "method name cannot be empty"); - compileIdMap.put(compileId, methodName); - } - } - } - - /** - * Make sure that line does not contain compile_kind which is used for OSR compilations which we are not - * interested in. - */ - private static boolean isPrintIdealStart(String line) { - return line.startsWith(" compileIdMap, String line) { - Matcher matcher = COMPILE_ID_PATTERN.matcher(line); - TestFramework.check(matcher.find(), "Is " + hotspotPidFileName + " corrupted?"); - int compileId = getCompileId(matcher); - return compileIdMap.get(compileId); - } - - /** - * Do an IR matching of all methods with appliable @IR rules fetched during parsing of the hotspot pid file. - */ - private void applyRules() { - compilations.values().forEach(this::applyRulesForMethod); - reportFailuresIfAny(); - } - - private void applyRulesForMethod(IRMethod irMethod) { - this.irMethod = irMethod; - method = irMethod.getMethod(); - String testOutput = irMethod.getOutput(); - if (testOutput.isEmpty()) { - String msg = "Method was not compiled. Did you specify any compiler directives preventing a compilation or used a " + - "@Run method in STANDALONE mode? In the latter case, make sure to always trigger a C2 compilation " + - "by invoking the test enough times."; - fails.computeIfAbsent(method, k -> new ArrayList<>()).add(msg); - return; - } - - if (TestFramework.VERBOSE) { - System.out.println("Output of " + method + ":"); - System.out.println(testOutput); - } - Arrays.stream(irMethod.getRuleIds()).forEach(this::applyIRRule); - } - - /** - * Apply a single @IR rule as part of a method. - */ - private void applyIRRule(int id) { - irAnno = irMethod.getIrAnno(id); - irRuleIndex = id; - StringBuilder failMsg = new StringBuilder(); - applyFailOn(failMsg); - try { - applyCounts(failMsg); - } catch (TestFormatException e) { - // Logged. Continue to check other rules. - } - if (!failMsg.isEmpty()) { - failMsg.insert(0, "@IR rule " + (id + 1) + ": \"" + irAnno + "\"" + System.lineSeparator()); - fails.computeIfAbsent(method, k -> new ArrayList<>()).add(failMsg.toString()); - } - } - - /** - * Apply the failOn regexes of the @IR rule. - */ - private void applyFailOn(StringBuilder failMsg) { - if (irAnno.failOn().length != 0) { - String failOnRegex = String.join("|", IRNode.mergeNodes(irAnno.failOn())); - Pattern pattern = Pattern.compile(failOnRegex); - Matcher matcher = pattern.matcher(irMethod.getOutput()); - long matchCount = matcher.results().count(); - if (matchCount > 0) { - addFailOnFailsForOutput(failMsg, pattern, matchCount); - } - } - } - - /** - * A failOn regex failed. Apply all regexes again to log the exact regex which failed. The failure is later reported - * to the user. - */ - private void addFailOnFailsForOutput(StringBuilder failMsg, Pattern pattern, long matchCount) { - long idealCount = pattern.matcher(irMethod.getIdealOutput()).results().count(); - long optoAssemblyCount = pattern.matcher(irMethod.getOptoAssemblyOutput()).results().count(); - if (matchCount != idealCount + optoAssemblyCount || (idealCount != 0 && optoAssemblyCount != 0)) { - // Report with Ideal and Opto Assembly - addFailOnFailsForOutput(failMsg, irMethod.getOutput()); - irMethod.needsAllOutput(); - } else if (optoAssemblyCount == 0) { - // Report with Ideal only - addFailOnFailsForOutput(failMsg, irMethod.getIdealOutput()); - irMethod.needsIdeal(); - } else { - // Report with Opto Assembly only - addFailOnFailsForOutput(failMsg, irMethod.getOptoAssemblyOutput()); - irMethod.needsOptoAssembly(); - } - } - - /** - * Apply the regexes to the testOutput and log the failures. - */ - private void addFailOnFailsForOutput(StringBuilder failMsg, String testOutput) { - List failOnNodes = IRNode.mergeNodes(irAnno.failOn()); - Pattern pattern; - Matcher matcher; - failMsg.append("- failOn: Graph contains forbidden nodes:").append(System.lineSeparator()); - int nodeId = 1; - for (String nodeRegex : failOnNodes) { - pattern = Pattern.compile(nodeRegex); - matcher = pattern.matcher(testOutput); - long matchCount = matcher.results().count(); - if (matchCount > 0) { - matcher.reset(); - failMsg.append(" Regex ").append(nodeId).append(": ").append(nodeRegex).append(System.lineSeparator()); - failMsg.append(" Matched forbidden node").append(matchCount > 1 ? "s (" + matchCount + ")" : "") - .append(":").append(System.lineSeparator()); - matcher.results().forEach(r -> failMsg.append(" ").append(r.group()).append(System.lineSeparator())); - } - nodeId++; - } - } - - /** - * Apply the counts regexes of the @IR rule. - */ - private void applyCounts(StringBuilder failMsg) { - if (irAnno.counts().length != 0) { - boolean hasFails = false; - String testOutput = irMethod.getOutput(); - int countsId = 1; - final List nodesWithCount = IRNode.mergeNodes(irAnno.counts()); - for (int i = 0; i < nodesWithCount.size(); i += 2) { - String node = nodesWithCount.get(i); - TestFormat.check(i + 1 < nodesWithCount.size(), "Missing count" + getPostfixErrorMsg(node)); - String countString = nodesWithCount.get(i + 1); - long expectedCount; - ParsedComparator parsedComparator; - try { - parsedComparator = ParsedComparator.parseComparator(countString); - expectedCount = Long.parseLong(parsedComparator.getStrippedString()); - } catch (NumberFormatException e) { - TestFormat.fail("Provided invalid count \"" + countString + "\"" + getPostfixErrorMsg(node)); - return; - } catch (CheckedTestFrameworkException e) { - TestFormat.fail("Invalid comparator \"" + e.getMessage() + "\" in \"" + countString + "\" for count" + getPostfixErrorMsg(node)); - return; - } catch (IndexOutOfBoundsException e) { - TestFormat.fail("Provided empty value" + getPostfixErrorMsg(node)); - return; - } - TestFormat.check(expectedCount >= 0,"Provided invalid negative count \"" + countString + "\"" + getPostfixErrorMsg(node)); - - Pattern pattern = Pattern.compile(node); - Matcher matcher = pattern.matcher(testOutput); - long actualCount = matcher.results().count(); - if (!parsedComparator.getPredicate().test(actualCount, expectedCount)) { - if (!hasFails) { - failMsg.append("- counts: Graph contains wrong number of nodes:").append(System.lineSeparator()); - hasFails = true; - } - addCountsFail(failMsg, node, pattern, expectedCount, actualCount, countsId); - } - countsId++; - } - } - } - - private String getPostfixErrorMsg(String node) { - return " for IR rule " + irRuleIndex + ", node \"" + node + "\" at " + method; - } - - /** - * A counts regex failed. Apply all regexes again to log the exact regex which failed. The failure is later reported - * to the user. - */ - private void addCountsFail(StringBuilder failMsg, String node, Pattern pattern, long expectedCount, long actualCount, int countsId) { - failMsg.append(" Regex ").append(countsId).append(": ").append(node).append(System.lineSeparator()); - failMsg.append(" Expected ").append(expectedCount).append(" but found ").append(actualCount); - - if (actualCount > 0) { - Matcher matcher = pattern.matcher(irMethod.getOutput()); - long idealCount = pattern.matcher(irMethod.getIdealOutput()).results().count(); - long optoAssemblyCount = pattern.matcher(irMethod.getOptoAssemblyOutput()).results().count(); - if (actualCount != idealCount + optoAssemblyCount || (idealCount != 0 && optoAssemblyCount != 0)) { - irMethod.needsAllOutput(); - } else if (optoAssemblyCount == 0) { - irMethod.needsIdeal(); - } else { - irMethod.needsOptoAssembly(); - } - failMsg.append(" node").append(actualCount > 1 ? "s" : "").append(":").append(System.lineSeparator()); - matcher.results().forEach(r -> failMsg.append(" ").append(r.group()).append(System.lineSeparator())); - } else { - irMethod.needsAllOutput(); - failMsg.append(" nodes.").append(System.lineSeparator()); - } - } - - /** - * Report all IR violations in a pretty format to the user. Depending on the failed regex, we only report - * PrintIdeal or PrintOptoAssembly if the match failed there. If there were failures that matched things - * in both outputs than the entire output is reported. Throws IRViolationException from which the compilation - * can be read and reported to the stdout separately. The exception message only includes the summary of the - * failures. - */ - private void reportFailuresIfAny() { - TestFormat.reportIfAnyFailures(); - if (!fails.isEmpty()) { - StringBuilder failuresBuilder = new StringBuilder(); - StringBuilder compilationsBuilder = new StringBuilder(); - int failures = 0; - for (Map.Entry> entry : fails.entrySet()) { - Method method = entry.getKey(); - compilationsBuilder.append(">>> Compilation of ").append(method).append(":").append(System.lineSeparator()); - IRMethod irMethod = compilations.get(method.getName()); - String output; - if (irMethod.usesIdeal() && irMethod.usesOptoAssembly()) { - output = irMethod.getOutput(); - } else if (irMethod.usesIdeal()) { - output = irMethod.getIdealOutput(); - } else if (irMethod.usesOptoAssembly()) { - output = irMethod.getOptoAssemblyOutput(); - } else { - output = ""; - } - compilationsBuilder.append(output).append(System.lineSeparator()).append(System.lineSeparator()); - List list = entry.getValue(); - failuresBuilder.append("- Method \"").append(method).append("\":").append(System.lineSeparator()); - failures += list.size(); - list.forEach(s -> failuresBuilder.append(" * ") - .append(s.replace(System.lineSeparator(), - System.lineSeparator() + " ").trim()) - .append(System.lineSeparator())); - failuresBuilder.append(System.lineSeparator()); - } - failuresBuilder.insert(0, ("One or more @IR rules failed:" + System.lineSeparator() - + System.lineSeparator() + "Failed IR Rules (" + failures + ")" - + System.lineSeparator()) + "-----------------" - + "-".repeat(String.valueOf(failures).length()) + System.lineSeparator()); - failuresBuilder.append(">>> Check stdout for compilation output of the failed methods") - .append(System.lineSeparator()).append(System.lineSeparator()); - - // In some very rare cases, the VM output to regex match on contains "" - // (emitted by ttyLocker::break_tty_for_safepoint) which might be the reason for a matching error. - // Do not throw an exception in this case (i.e. bailout). - String compilations = compilationsBuilder.toString(); - if (!compilations.contains(SAFEPOINT_WHILE_PRINTING_MESSAGE)) { - throw new IRViolationException(failuresBuilder.toString(), compilations); - } else { - System.out.println("Found " + SAFEPOINT_WHILE_PRINTING_MESSAGE + ", bail out of IR matching"); - } - } - } -} diff --git a/test/hotspot/jtreg/compiler/lib/ir_framework/driver/TestVMProcess.java b/test/hotspot/jtreg/compiler/lib/ir_framework/driver/TestVMProcess.java index 0bec4c0e5da..d8e10e76315 100644 --- a/test/hotspot/jtreg/compiler/lib/ir_framework/driver/TestVMProcess.java +++ b/test/hotspot/jtreg/compiler/lib/ir_framework/driver/TestVMProcess.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2022, 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 @@ -194,13 +194,13 @@ public class TestVMProcess { if (!testListBuilder.isEmpty()) { System.out.println("Run flag defined test list"); System.out.println("--------------------------"); - System.out.println(testListBuilder.toString()); + System.out.println(testListBuilder); System.out.println(); } if (!messagesBuilder.isEmpty()) { System.out.println("Messages from Test VM"); System.out.println("---------------------"); - System.out.println(messagesBuilder.toString()); + System.out.println(messagesBuilder); } irEncoding = nonStdOutBuilder.toString(); } else { @@ -226,7 +226,7 @@ public class TestVMProcess { */ private void throwTestVMException() { String stdErr = oa.getStderr(); - if (stdErr.contains("TestFormat.reportIfAnyFailures")) { + if (stdErr.contains("TestFormat.throwIfAnyFailures")) { Pattern pattern = Pattern.compile("Violations \\(\\d+\\)[\\s\\S]*(?=/============/)"); Matcher matcher = pattern.matcher(stdErr); TestFramework.check(matcher.find(), "Must find violation matches"); diff --git a/test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/CompilationOutputBuilder.java b/test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/CompilationOutputBuilder.java new file mode 100644 index 00000000000..b93d2386564 --- /dev/null +++ b/test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/CompilationOutputBuilder.java @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2022, 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 compiler.lib.ir_framework.driver.irmatching; + +import compiler.lib.ir_framework.driver.irmatching.irmethod.IRMethodMatchResult; + +import java.util.List; + +/** + * Class to build the compilation output of IR matching failures. + * + * @see IRMethodMatchResult + */ +class CompilationOutputBuilder { + + public static String build(List results) { + StringBuilder compilationsBuilder = new StringBuilder(); + for (IRMethodMatchResult result : results) { + if (result.fail()) { + compilationsBuilder.append(buildMatchedCompilationMessage(result)); + } + } + return compilationsBuilder.toString(); + } + + private static String buildMatchedCompilationMessage(IRMethodMatchResult result) { + return result.getMatchedCompilationOutput() + System.lineSeparator() + System.lineSeparator(); + } +} diff --git a/test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/IRMatcher.java b/test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/IRMatcher.java new file mode 100644 index 00000000000..c39d68ab127 --- /dev/null +++ b/test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/IRMatcher.java @@ -0,0 +1,96 @@ +/* + * Copyright (c) 2021, 2022, 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 compiler.lib.ir_framework.driver.irmatching; + +import compiler.lib.ir_framework.*; +import compiler.lib.ir_framework.driver.irmatching.irmethod.IRMethodMatchResult; +import compiler.lib.ir_framework.driver.irmatching.irmethod.IRMethod; +import compiler.lib.ir_framework.driver.irmatching.parser.IRMethodParser; + +import java.util.*; + +/** + * This class parses the hotspot_pid* file of the test VM to match all applicable @IR rules afterwards. + */ +public class IRMatcher { + public static final String SAFEPOINT_WHILE_PRINTING_MESSAGE = ""; + + public IRMatcher(String hotspotPidFileName, String irEncoding, Class testClass) { + IRMethodParser irMethodParser = new IRMethodParser(testClass); + Collection irMethods = irMethodParser.parse(hotspotPidFileName, irEncoding); + if (irMethods != null) { + applyIRRules(irMethods); + } + } + + /** + * Do an IR matching of all methods with applicable @IR rules prepared with by the {@link IRMethodParser}. + */ + private void applyIRRules(Collection irMethods) { + List results = new ArrayList<>(); + irMethods.forEach(irMethod -> applyIRRule(irMethod, results)); + if (!results.isEmpty()) { + reportFailures(results); + } + } + + private void applyIRRule(IRMethod irMethod, List results) { + if (TestFramework.VERBOSE) { + printMethodOutput(irMethod); + } + IRMethodMatchResult result = irMethod.applyIRRules(); + if (result.fail()) { + results.add(result); + } + } + + private void printMethodOutput(IRMethod irMethod) { + System.out.println("Output of " + irMethod.getOutput() + ":"); + System.out.println(irMethod.getOutput()); + } + + /** + * Report all IR violations in a pretty format to the user. Depending on the failed regex, we only report + * PrintIdeal or PrintOptoAssembly if the match failed there. If there were failures that matched things + * in both outputs then the entire output is reported. Throws IRViolationException from which the compilation + * can be read and reported to the stdout separately. The exception message only includes the summary of the + * failures. + */ + private void reportFailures(List results) { + Collections.sort(results); // Alphabetically + throwIfNoSafepointWhilePrinting(IRMatcherFailureMessageBuilder.build(results), + CompilationOutputBuilder.build(results)); + } + + // In some very rare cases, the VM output to regex match on contains "" + // (emitted by ttyLocker::break_tty_for_safepoint) which might be the reason for a matching error. + // Do not throw an exception in this case (i.e. bailout). + private void throwIfNoSafepointWhilePrinting(String failures, String compilations) { + if (!compilations.contains(SAFEPOINT_WHILE_PRINTING_MESSAGE)) { + throw new IRViolationException(failures, compilations); + } else { + System.out.println("Found " + SAFEPOINT_WHILE_PRINTING_MESSAGE + ", bail out of IR matching"); + } + } +} diff --git a/test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/IRMatcherFailureMessageBuilder.java b/test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/IRMatcherFailureMessageBuilder.java new file mode 100644 index 00000000000..4cdff9a2aae --- /dev/null +++ b/test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/IRMatcherFailureMessageBuilder.java @@ -0,0 +1,81 @@ +/* + * Copyright (c) 2022, 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 compiler.lib.ir_framework.driver.irmatching; + +import compiler.lib.ir_framework.driver.irmatching.irmethod.IRMethodMatchResult; + +import java.util.List; + +/** + * Class to build the failure message output of IR matching failures. + * + * @see IRMethodMatchResult + */ +class IRMatcherFailureMessageBuilder { + + public static String build(List results) { + StringBuilder failuresBuilder = new StringBuilder(); + failuresBuilder.append(buildHeaderMessage(results)); + int failureNumber = 1; + for (IRMethodMatchResult irMethodResult : results) { + if (irMethodResult.fail()) { + failuresBuilder.append(buildIRMethodFailureMessage(failureNumber, irMethodResult)); + failureNumber++; + } + } + failuresBuilder.append(buildFooterMessage()); + return failuresBuilder.toString(); + } + + private static String buildHeaderMessage(List results) { + int failedIRRulesCount = getFailedIRRulesCount(results); + long failedMethodCount = getFailedMethodCount(results); + return "One or more @IR rules failed:" + System.lineSeparator() + System.lineSeparator() + + "Failed IR Rules (" + failedIRRulesCount + ") of Methods (" + failedMethodCount + ")" + + System.lineSeparator() + + "-".repeat(32 + digitCount(failedIRRulesCount) + digitCount(failedMethodCount)) + + System.lineSeparator(); + } + + private static int getFailedIRRulesCount(List results) { + return results.stream().map(IRMethodMatchResult::getFailedIRRuleCount).reduce(0, Integer::sum); + } + + private static long getFailedMethodCount(List results) { + return results.stream().filter(IRMethodMatchResult::fail).count(); + } + + private static int digitCount(long digit) { + return String.valueOf(digit).length(); + } + + private static String buildIRMethodFailureMessage(int failureNumber, IRMethodMatchResult result) { + return failureNumber + ")" + result.buildFailureMessage() + System.lineSeparator(); + } + + private static String buildFooterMessage() { + return ">>> Check stdout for compilation output of the failed methods" + System.lineSeparator() + System.lineSeparator(); + } + +} diff --git a/test/hotspot/jtreg/compiler/lib/ir_framework/driver/IRViolationException.java b/test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/IRViolationException.java similarity index 94% rename from test/hotspot/jtreg/compiler/lib/ir_framework/driver/IRViolationException.java rename to test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/IRViolationException.java index bacf3536dad..c11de93df06 100644 --- a/test/hotspot/jtreg/compiler/lib/ir_framework/driver/IRViolationException.java +++ b/test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/IRViolationException.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2022, 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 @@ -21,7 +21,7 @@ * questions. */ -package compiler.lib.ir_framework.driver; +package compiler.lib.ir_framework.driver.irmatching; import compiler.lib.ir_framework.IR; import compiler.lib.ir_framework.Test; diff --git a/test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/MatchResult.java b/test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/MatchResult.java new file mode 100644 index 00000000000..bc892505f87 --- /dev/null +++ b/test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/MatchResult.java @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2022, 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 compiler.lib.ir_framework.driver.irmatching; + +/** + * Interface used by all classes which represent a IR match result. A result should also provide a failure message + * in a pretty format to be used by the {@link IRMatcher}. + */ +public interface MatchResult { + /** + * Does this match result represent a failure? + */ + boolean fail(); + + /** + * Builds a failure message in a pretty format to be used by the IR matching failure reporting. + */ + String buildFailureMessage(); +} diff --git a/test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/OutputMatch.java b/test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/OutputMatch.java new file mode 100644 index 00000000000..85cc81725ed --- /dev/null +++ b/test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/OutputMatch.java @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2022, 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 compiler.lib.ir_framework.driver.irmatching; + +import compiler.lib.ir_framework.driver.irmatching.irrule.IRRuleMatchResult; + +/** + * Enum to describe what kind of compilation output that was matched for a method during IR matching. + * + * @see IRRuleMatchResult + */ +public enum OutputMatch { + /** + * There was no compilation output. Should not happen and results in a failure. + */ + NONE, + /** + * Matched on PrintIdeal. + */ + IDEAL, + /** + * Matched on PrintOptoAssembly. + */ + OPTO_ASSEMBLY, + /** + * Matched on PrintIdeal and PrintOptoAssembly. + */ + BOTH +} diff --git a/test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/irmethod/FailureMessageBuilder.java b/test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/irmethod/FailureMessageBuilder.java new file mode 100644 index 00000000000..057a4cd8ce9 --- /dev/null +++ b/test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/irmethod/FailureMessageBuilder.java @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2022, 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 compiler.lib.ir_framework.driver.irmatching.irmethod; + +import compiler.lib.ir_framework.driver.irmatching.irrule.IRRuleMatchResult; + +import java.util.List; + +/** + * Base class to build the failure message output for an IR method. + * + * @see IRMethodMatchResult + */ +abstract class FailureMessageBuilder { + protected final IRMethod irMethod; + + public FailureMessageBuilder(IRMethod irMethod) { + this.irMethod = irMethod; + } + + abstract public String build(); +} diff --git a/test/hotspot/jtreg/compiler/lib/ir_framework/driver/IRMethod.java b/test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/irmethod/IRMethod.java similarity index 66% rename from test/hotspot/jtreg/compiler/lib/ir_framework/driver/IRMethod.java rename to test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/irmethod/IRMethod.java index dbad17034af..3250f825e00 100644 --- a/test/hotspot/jtreg/compiler/lib/ir_framework/driver/IRMethod.java +++ b/test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/irmethod/IRMethod.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2022, 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 @@ -21,30 +21,34 @@ * questions. */ -package compiler.lib.ir_framework.driver; +package compiler.lib.ir_framework.driver.irmatching.irmethod; import compiler.lib.ir_framework.IR; +import compiler.lib.ir_framework.TestFramework; +import compiler.lib.ir_framework.driver.irmatching.irrule.IRRule; +import compiler.lib.ir_framework.driver.irmatching.irrule.IRRuleMatchResult; import java.lang.reflect.Method; +import java.util.ArrayList; +import java.util.List; /** * Helper class to store information about a method that needs to be IR matched. */ -class IRMethod { +public class IRMethod { private final Method method; - private final int[] ruleIds; - private final IR[] irAnnos; + private final List irRules; private final StringBuilder outputBuilder; private String output; private String idealOutput; private String optoAssemblyOutput; - private boolean needsIdeal; - private boolean needsOptoAssembly; public IRMethod(Method method, int[] ruleIds, IR[] irAnnos) { this.method = method; - this.ruleIds = ruleIds; - this.irAnnos = irAnnos; + this.irRules = new ArrayList<>(); + for (int i : ruleIds) { + irRules.add(new IRRule(this, i, irAnnos[i - 1])); + } this.outputBuilder = new StringBuilder(); this.output = ""; this.idealOutput = ""; @@ -55,13 +59,6 @@ class IRMethod { return method; } - public int[] getRuleIds() { - return ruleIds; - } - - public IR getIrAnno(int idx) { - return irAnnos[idx]; - } /** * The Ideal output comes always before the Opto Assembly output. We might parse multiple C2 compilations of this method. @@ -94,24 +91,26 @@ class IRMethod { return optoAssemblyOutput; } - public void needsAllOutput() { - needsIdeal(); - needsOptoAssembly(); - } - - public void needsIdeal() { - needsIdeal = true; - } - - public boolean usesIdeal() { - return needsIdeal; - } - - public void needsOptoAssembly() { - needsOptoAssembly = true; + /** + * Apply all IR rules of this IR method. + */ + public IRMethodMatchResult applyIRRules() { + TestFramework.check(!irRules.isEmpty(), "IRMethod cannot be created if there are no IR rules to apply"); + List results = new ArrayList<>(); + if (!output.isEmpty()) { + return getNormalMatchResult(results); + } else { + return new MissingCompilationResult(this, irRules.size()); + } } - public boolean usesOptoAssembly() { - return needsOptoAssembly; + private NormalMatchResult getNormalMatchResult(List results) { + for (IRRule irRule : irRules) { + IRRuleMatchResult result = irRule.applyCheckAttribute(); + if (result.fail()) { + results.add(result); + } + } + return new NormalMatchResult(this, results); } } diff --git a/test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/irmethod/IRMethodMatchResult.java b/test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/irmethod/IRMethodMatchResult.java new file mode 100644 index 00000000000..78e4dec5fee --- /dev/null +++ b/test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/irmethod/IRMethodMatchResult.java @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2022, 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 compiler.lib.ir_framework.driver.irmatching.irmethod; + +import compiler.lib.ir_framework.driver.irmatching.MatchResult; +import compiler.lib.ir_framework.driver.irmatching.irrule.IRRuleMatchResult; + +/** + * This base class represents an IR matching result of all IR rules of a method. + * + * @see IRRuleMatchResult + * @see IRMethod + */ +abstract public class IRMethodMatchResult implements Comparable, MatchResult { + protected final IRMethod irMethod; + + IRMethodMatchResult(IRMethod irMethod) { + this.irMethod = irMethod; + } + + abstract public String getMatchedCompilationOutput(); + + abstract public int getFailedIRRuleCount(); + + /** + * Used to sort the failed IR methods alphabetically. + */ + @Override + public int compareTo(IRMethodMatchResult other) { + return this.irMethod.getMethod().getName().compareTo(other.irMethod.getMethod().getName()); + } +} diff --git a/test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/irmethod/MatchedCompilationOutputBuilder.java b/test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/irmethod/MatchedCompilationOutputBuilder.java new file mode 100644 index 00000000000..d58bdc1fd36 --- /dev/null +++ b/test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/irmethod/MatchedCompilationOutputBuilder.java @@ -0,0 +1,77 @@ +/* + * Copyright (c) 2022, 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 compiler.lib.ir_framework.driver.irmatching.irmethod; + +import compiler.lib.ir_framework.driver.irmatching.OutputMatch; +import compiler.lib.ir_framework.driver.irmatching.irrule.IRRuleMatchResult; +import compiler.lib.ir_framework.shared.TestFrameworkException; + +import java.util.List; + +/** + * Class to build the compilation output for an IR method. + * + * @see IRMethodMatchResult + */ +class MatchedCompilationOutputBuilder { + private final IRMethod irMethod; + private final OutputMatch outputMatch; + + public MatchedCompilationOutputBuilder(IRMethod irMethod, List irRulesMatchResults) { + this.irMethod = irMethod; + this.outputMatch = getOutputMatch(irRulesMatchResults); + } + + private OutputMatch getOutputMatch(List irRulesMatchResults) { + OutputMatch outputMatch; + if (allMatchesOn(irRulesMatchResults, OutputMatch.IDEAL)) { + outputMatch = OutputMatch.IDEAL; + } else if (allMatchesOn(irRulesMatchResults, OutputMatch.OPTO_ASSEMBLY)) { + outputMatch = OutputMatch.OPTO_ASSEMBLY; + } else { + outputMatch = OutputMatch.BOTH; + } + return outputMatch; + } + + private boolean allMatchesOn(List irRulesMatchResults, OutputMatch outputMatch) { + return irRulesMatchResults.stream().allMatch(r -> r.getOutputMatch() == outputMatch); + } + + public String build() { + StringBuilder builder = new StringBuilder(); + builder.append(getMethodLine()); + switch (outputMatch) { + case IDEAL -> builder.append(irMethod.getIdealOutput()); + case OPTO_ASSEMBLY -> builder.append(irMethod.getOptoAssemblyOutput()); + case BOTH -> builder.append(irMethod.getOutput()); + default -> throw new TestFrameworkException("found unexpected OutputMatch " + outputMatch.name()); + } + return builder.toString(); + } + + private String getMethodLine() { + return ">>> Compilation of " + irMethod.getMethod() + ":" + System.lineSeparator(); + } +} diff --git a/test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/irmethod/MissingCompilationMessageBuilder.java b/test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/irmethod/MissingCompilationMessageBuilder.java new file mode 100644 index 00000000000..7d3097640eb --- /dev/null +++ b/test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/irmethod/MissingCompilationMessageBuilder.java @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2022, 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 compiler.lib.ir_framework.driver.irmatching.irmethod; + +import compiler.lib.ir_framework.driver.irmatching.irrule.IRRuleMatchResult; + +import java.util.List; + +/** + * Class to build the failure message output for an IR method with a missing compilation output. + * + * @see IRMethodMatchResult + */ +class MissingCompilationMessageBuilder extends FailureMessageBuilder { + + public MissingCompilationMessageBuilder(IRMethod irMethod) { + super(irMethod); + } + + @Override + public String build() { + return getMethodLine() + getMissingCompilationMessage(); + } + + private String getMissingCompilationMessage() { + return " * Method was not compiled. Did you specify any compiler directives preventing a compilation " + + "or used a @Run method in STANDALONE mode? In the latter case, make sure to always trigger a C2 " + + "compilation by " + "invoking the test enough times."; + } + private String getMethodLine() { + return " Method \"" + irMethod.getMethod() + "\":" + System.lineSeparator(); + } +} diff --git a/test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/irmethod/MissingCompilationResult.java b/test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/irmethod/MissingCompilationResult.java new file mode 100644 index 00000000000..16e008f247a --- /dev/null +++ b/test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/irmethod/MissingCompilationResult.java @@ -0,0 +1,68 @@ +/* + * Copyright (c) 2022, 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 compiler.lib.ir_framework.driver.irmatching.irmethod; + +import compiler.lib.ir_framework.driver.irmatching.irrule.IRRuleMatchResult; + +/** + * This class represents an IR matching result where the compilation output was empty. + * + * @see IRRuleMatchResult + * @see IRMethod + */ +public class MissingCompilationResult extends IRMethodMatchResult { + private final int failedIRRules; + private final MissingCompilationMessageBuilder failureMessageBuilder; + + MissingCompilationResult(IRMethod irMethod, int failedIRRules) { + super(irMethod); + this.failedIRRules = failedIRRules; + this.failureMessageBuilder = new MissingCompilationMessageBuilder(irMethod); + } + + @Override + public boolean fail() { + return true; + } + + @Override + public String getMatchedCompilationOutput() { + return ""; + } + + @Override + public String buildFailureMessage() { + return failureMessageBuilder.build(); + } + + private String getMethodLine() { + return " Method \"" + irMethod.getMethod() + "\":" + System.lineSeparator(); + } + + @Override + public int getFailedIRRuleCount() { + return failedIRRules; + } + +} diff --git a/test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/irmethod/NormalFailureMessageBuilder.java b/test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/irmethod/NormalFailureMessageBuilder.java new file mode 100644 index 00000000000..a6d202407ef --- /dev/null +++ b/test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/irmethod/NormalFailureMessageBuilder.java @@ -0,0 +1,64 @@ +/* + * Copyright (c) 2022, 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 compiler.lib.ir_framework.driver.irmatching.irmethod; + +import compiler.lib.ir_framework.driver.irmatching.irrule.IRRuleMatchResult; + +import java.util.List; +import java.util.stream.Collectors; + +/** + * Class to build the failure message output for an IR method for failed IR rules. + * + * @see IRMethodMatchResult + */ +class NormalFailureMessageBuilder extends FailureMessageBuilder { + private final List irRulesMatchResults; + + public NormalFailureMessageBuilder(IRMethod irMethod, List irRulesMatchResults) { + super(irMethod); + this.irRulesMatchResults = irRulesMatchResults.stream() + .filter(IRRuleMatchResult::fail) + .collect(Collectors.toList()); + } + + @Override + public String build() { + return getMethodLine() + getIRRulesFailureMessage(); + } + + private String getMethodLine() { + int failures = irRulesMatchResults.size(); + return " Method \"" + irMethod.getMethod() + "\" - [Failed IR rules: " + failures + "]:" + + System.lineSeparator(); + } + + private String getIRRulesFailureMessage() { + StringBuilder failMsg = new StringBuilder(); + for (IRRuleMatchResult irRuleResult : irRulesMatchResults) { + failMsg.append(irRuleResult.buildFailureMessage()); + } + return failMsg.toString(); + } +} diff --git a/test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/irmethod/NormalMatchResult.java b/test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/irmethod/NormalMatchResult.java new file mode 100644 index 00000000000..280f2909fcf --- /dev/null +++ b/test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/irmethod/NormalMatchResult.java @@ -0,0 +1,67 @@ +/* + * Copyright (c) 2022, 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 compiler.lib.ir_framework.driver.irmatching.irmethod; + +import compiler.lib.ir_framework.driver.irmatching.irrule.IRRuleMatchResult; + +import java.util.List; + +/** + * This class represents a normal IR matching result of all IR rules of a method. + * + * @see IRRuleMatchResult + * @see IRMethod + */ +class NormalMatchResult extends IRMethodMatchResult { + private final List irRulesMatchResults; + private final NormalFailureMessageBuilder failureMessageBuilder; + private final MatchedCompilationOutputBuilder matchedCompilationOutputBuilder; + + NormalMatchResult(IRMethod irMethod, List irRulesMatchResults) { + super(irMethod); + this.irRulesMatchResults = irRulesMatchResults; + this.failureMessageBuilder = new NormalFailureMessageBuilder(irMethod, irRulesMatchResults); + this.matchedCompilationOutputBuilder = new MatchedCompilationOutputBuilder(irMethod, irRulesMatchResults); + } + + @Override + public boolean fail() { + return !irRulesMatchResults.isEmpty(); + } + + @Override + public String getMatchedCompilationOutput() { + return matchedCompilationOutputBuilder.build(); + } + + @Override + public String buildFailureMessage() { + return failureMessageBuilder.build(); + } + + @Override + public int getFailedIRRuleCount() { + return irRulesMatchResults.size(); + } +} diff --git a/test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/irrule/CheckAttribute.java b/test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/irrule/CheckAttribute.java new file mode 100644 index 00000000000..a22a43a3871 --- /dev/null +++ b/test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/irrule/CheckAttribute.java @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2022, 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 compiler.lib.ir_framework.driver.irmatching.irrule; + +import compiler.lib.ir_framework.IR; + +import java.util.ArrayList; +import java.util.List; +import java.util.regex.Matcher; + +/** + * Base class representing a check attribute of an IR rule. + * + * @see IR + */ +abstract class CheckAttribute { + + abstract public CheckAttributeMatchResult apply(String compilation); + + protected List getMatchedNodes(Matcher m) { + List matches = new ArrayList<>(); + do { + matches.add(m.group()); + } while (m.find()); + return matches; + } +} diff --git a/test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/irrule/CheckAttributeMatchResult.java b/test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/irrule/CheckAttributeMatchResult.java new file mode 100644 index 00000000000..8307957a60c --- /dev/null +++ b/test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/irrule/CheckAttributeMatchResult.java @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2022, 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 compiler.lib.ir_framework.driver.irmatching.irrule; + +import compiler.lib.ir_framework.IR; +import compiler.lib.ir_framework.driver.irmatching.MatchResult; + +import java.util.List; + +/** + * Base class representing a result of an applied check attribute of an IR rule. + * + * @see IR + */ +abstract class CheckAttributeMatchResult implements MatchResult { + protected List regexFailures = null; + + @Override + public boolean fail() { + return regexFailures != null; + } + + public int getMatchesCount() { + if (fail()) { + return regexFailures.stream().map(RegexFailure::getMatchesCount).reduce(0, Integer::sum); + } else { + return 0; + } + } + + protected String collectRegexFailureMessages() { + StringBuilder failMsg = new StringBuilder(); + for (RegexFailure regexFailure : regexFailures) { + failMsg.append(regexFailure.buildFailureMessage()); + } + return failMsg.toString(); + } +} diff --git a/test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/irrule/Counts.java b/test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/irrule/Counts.java new file mode 100644 index 00000000000..4bda941c887 --- /dev/null +++ b/test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/irrule/Counts.java @@ -0,0 +1,121 @@ +/* + * Copyright (c) 2022, 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 compiler.lib.ir_framework.driver.irmatching.irrule; + +import compiler.lib.ir_framework.IR; +import compiler.lib.ir_framework.shared.Comparison; +import compiler.lib.ir_framework.shared.ComparisonConstraintParser; +import compiler.lib.ir_framework.shared.TestFormat; + +import java.util.ArrayList; +import java.util.List; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +/** + * Class representing a counts attribute of an IR rule. + * + * @see IR#counts() + */ +class Counts extends CheckAttribute { + public List constraints; + + private Counts(List constraints) { + this.constraints = constraints; + } + + public static Counts create(List nodesWithCountConstraint, IRRule irRule) { + List constraints = new ArrayList<>(); + int nodeId = 1; + for (int i = 0; i < nodesWithCountConstraint.size(); i += 2, nodeId++) { + String node = nodesWithCountConstraint.get(i); + TestFormat.check(i + 1 < nodesWithCountConstraint.size(), + "Missing count " + getPostfixErrorMsg(irRule, node)); + String countConstraint = nodesWithCountConstraint.get(i + 1); + Comparison comparison = parseComparison(irRule, node, countConstraint); + constraints.add(new Constraint(node, comparison, nodeId)); + } + return new Counts(constraints); + } + + private static String getPostfixErrorMsg(IRRule irRule, String node) { + return "for IR rule " + irRule.getRuleId() + ", node \"" + node + "\" at " + irRule.getMethod(); + } + + private static Comparison parseComparison(IRRule irRule, String node, String constraint) { + String postfixErrorMsg = "in count constraint " + getPostfixErrorMsg(irRule, node); + return ComparisonConstraintParser.parse(constraint, Long::parseLong, postfixErrorMsg); + } + + @Override + public CheckAttributeMatchResult apply(String compilation) { + CountsMatchResult result = new CountsMatchResult(); + checkConstraints(result, compilation); + return result; + } + + private void checkConstraints(CountsMatchResult result, String compilation) { + for (Constraint constraint : constraints) { + checkConstraint(result, compilation, constraint); + } + } + + private void checkConstraint(CountsMatchResult result, String compilation, Constraint constraint) { + long foundCount = getFoundCount(compilation, constraint); + Comparison comparison = constraint.comparison; + if (!comparison.compare(foundCount)) { + result.addFailure(createRegexFailure(compilation, constraint, foundCount)); + } + } + + private long getFoundCount(String compilation, Constraint constraint) { + Pattern pattern = Pattern.compile(constraint.nodeRegex); + Matcher matcher = pattern.matcher(compilation); + return matcher.results().count(); + } + + private CountsRegexFailure createRegexFailure(String compilation, Constraint constraint, long foundCount) { + Pattern p = Pattern.compile(constraint.nodeRegex); + Matcher m = p.matcher(compilation); + List matches; + if (m.find()) { + matches = getMatchedNodes(m); + } else { + matches = new ArrayList<>(); + } + return new CountsRegexFailure(constraint.nodeRegex, constraint.nodeId, foundCount, constraint.comparison, matches); + } + + static class Constraint { + final String nodeRegex; + final Comparison comparison; + private final int nodeId; + + Constraint(String nodeRegex, Comparison comparison, int nodeId) { + this.nodeRegex = nodeRegex; + this.comparison = comparison; + this.nodeId = nodeId; + } + } +} diff --git a/test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/irrule/CountsMatchResult.java b/test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/irrule/CountsMatchResult.java new file mode 100644 index 00000000000..4830bb1b46a --- /dev/null +++ b/test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/irrule/CountsMatchResult.java @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2022, 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 compiler.lib.ir_framework.driver.irmatching.irrule; + +import compiler.lib.ir_framework.IR; + +import java.util.ArrayList; + +/** + * Class representing a result of an applied counts attribute of an IR rule. + * + * @see IR#counts() + */ +class CountsMatchResult extends CheckAttributeMatchResult { + + public void addFailure(RegexFailure regexFailure) { + if (regexFailures == null) { + regexFailures = new ArrayList<>(); + } + regexFailures.add(regexFailure); + } + + @Override + public String buildFailureMessage() { + return " - counts: Graph contains wrong number of nodes:" + System.lineSeparator() + + collectRegexFailureMessages(); + } +} diff --git a/test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/irrule/CountsRegexFailure.java b/test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/irrule/CountsRegexFailure.java new file mode 100644 index 00000000000..ae7b235ffd0 --- /dev/null +++ b/test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/irrule/CountsRegexFailure.java @@ -0,0 +1,73 @@ +/* + * Copyright (c) 2022, 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 compiler.lib.ir_framework.driver.irmatching.irrule; + +import compiler.lib.ir_framework.shared.Comparison; + +import java.util.List; + +/** + * This class represents an IR matching failure of a regex of a counts attribute of an IR rule. + * + * @see Counts + */ +class CountsRegexFailure extends RegexFailure { + String failedComparison; + + public CountsRegexFailure(String nodeRegex, int nodeId, long foundValue, Comparison comparison, List matches) { + super(nodeRegex, nodeId, matches); + this.failedComparison = "[found] " + foundValue + " " + comparison.getComparator() + " " + + comparison.getGivenValue() + " [given]"; + } + + @Override + public String buildFailureMessage() { + return getRegexLine() + + getFailedComparison() + + getMatchedNodesBlock(); + } + + private String getFailedComparison() { + return " - Failed comparison: " + failedComparison + System.lineSeparator(); + } + + @Override + protected String getMatchedNodesBlock() { + if (matches.isEmpty()) { + return getEmptyNodeMatchesLine(); + } else { + return super.getMatchedNodesBlock(); + } + } + + private String getEmptyNodeMatchesLine() { + return getMatchedNodesWhiteSpace() + "- No nodes matched!" + System.lineSeparator(); + } + + @Override + protected String getMatchedPrefix() { + return "Matched"; + } + +} diff --git a/test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/irrule/FailOn.java b/test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/irrule/FailOn.java new file mode 100644 index 00000000000..fa49a029ef9 --- /dev/null +++ b/test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/irrule/FailOn.java @@ -0,0 +1,73 @@ +/* + * Copyright (c) 2022, 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 compiler.lib.ir_framework.driver.irmatching.irrule; + +import compiler.lib.ir_framework.IR; + +import java.util.ArrayList; +import java.util.List; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +/** + * Class representing a failOn attribute of an IR rule. + * + * @see IR#failOn() + */ +class FailOn extends CheckAttribute { + private final Pattern quickPattern; + private final List nodes; + + public FailOn(List nodes) { + this.nodes = nodes; + this.quickPattern = Pattern.compile(String.join("|", nodes)); + } + + @Override + public CheckAttributeMatchResult apply(String compilation) { + FailOnMatchResult result = new FailOnMatchResult(); + Matcher matcher = quickPattern.matcher(compilation); + if (matcher.find()) { + result.setFailures(createFailOnFailures(compilation)); + } + return result; + } + + private List createFailOnFailures(String compilation) { + List regexFailures = new ArrayList<>(); + for (int i = 0; i < nodes.size(); i++) { + checkNode(regexFailures, compilation, nodes.get(i), i + 1); + } + return regexFailures; + } + + private void checkNode(List regexFailures, String compilation, String node, int nodeId) { + Pattern p = Pattern.compile(node); + Matcher m = p.matcher(compilation); + if (m.find()) { + List matches = getMatchedNodes(m); + regexFailures.add(new FailOnRegexFailure(node, nodeId, matches)); + } + } +} diff --git a/test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/irrule/FailOnMatchResult.java b/test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/irrule/FailOnMatchResult.java new file mode 100644 index 00000000000..99c6312ee02 --- /dev/null +++ b/test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/irrule/FailOnMatchResult.java @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2022, 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 compiler.lib.ir_framework.driver.irmatching.irrule; + +import compiler.lib.ir_framework.IR; + +import java.util.List; + +/** + * Class representing a result of an applied failOn attribute of an IR rule. + * + * @see IR#failOn() + */ +class FailOnMatchResult extends CheckAttributeMatchResult { + public void setFailures(List regexFailures) { + this.regexFailures = regexFailures; + } + + @Override + public String buildFailureMessage() { + return " - failOn: Graph contains forbidden nodes:" + System.lineSeparator() + + collectRegexFailureMessages(); + } +} diff --git a/test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/irrule/FailOnRegexFailure.java b/test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/irrule/FailOnRegexFailure.java new file mode 100644 index 00000000000..24c96aef5e9 --- /dev/null +++ b/test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/irrule/FailOnRegexFailure.java @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2022, 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 compiler.lib.ir_framework.driver.irmatching.irrule; + +import java.util.List; + +/** + * This class represents an IR matching failure of a regex of a failOn attribute of an IR rule. + * + * @see FailOn + */ +class FailOnRegexFailure extends RegexFailure { + + public FailOnRegexFailure(String nodeRegex, int nodeId, List matches) { + super(nodeRegex, nodeId, matches); + } + + @Override + public String buildFailureMessage() { + return getRegexLine() + + getMatchedNodesBlock(); + } + + @Override + protected String getMatchedPrefix() { + return "Matched forbidden"; + } +} diff --git a/test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/irrule/IRRule.java b/test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/irrule/IRRule.java new file mode 100644 index 00000000000..5b2e8c7718a --- /dev/null +++ b/test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/irrule/IRRule.java @@ -0,0 +1,149 @@ +/* + * Copyright (c) 2022, 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 compiler.lib.ir_framework.driver.irmatching.irrule; + +import compiler.lib.ir_framework.IR; +import compiler.lib.ir_framework.IRNode; +import compiler.lib.ir_framework.driver.irmatching.irmethod.IRMethod; +import compiler.lib.ir_framework.driver.irmatching.OutputMatch; +import compiler.lib.ir_framework.shared.*; + +import java.lang.reflect.Method; +import java.util.function.Consumer; + +public class IRRule { + private final IRMethod irMethod; + private final int ruleId; + private final IR irAnno; + private final FailOn failOn; + private final Counts counts; + + public IRRule(IRMethod irMethod, int ruleId, IR irAnno) { + this.irMethod = irMethod; + this.ruleId = ruleId; + this.irAnno = irAnno; + this.failOn = initFailOn(irAnno); + this.counts = initCounts(irAnno); + } + + private Counts initCounts(IR irAnno) { + String[] countsConstraints = irAnno.counts(); + if (countsConstraints.length != 0) { + try { + return Counts.create(IRNode.mergeNodes(countsConstraints), this); + } catch (TestFormatException e) { + // Logged and reported later. Continue. + } + } + return null; + } + + private FailOn initFailOn(IR irAnno) { + String[] failOnNodes = irAnno.failOn(); + if (failOnNodes.length != 0) { + return new FailOn(IRNode.mergeNodes(failOnNodes)); + } + return null; + } + + public int getRuleId() { + return ruleId; + } + + public IR getIRAnno() { + return irAnno; + } + + public Method getMethod() { + return irMethod.getMethod(); + } + + /** + * Apply this IR rule by checking any failOn and counts attributes. + */ + public IRRuleMatchResult applyCheckAttribute() { + IRRuleMatchResult result = new IRRuleMatchResult(this); + if (failOn != null) { + applyCheckAttribute(failOn, result, result::setFailOnFailures); + } + if (counts != null) { + applyCheckAttribute(counts, result, result::setCountsFailures); + } + return result; + } + + private void applyCheckAttribute(CheckAttribute checkAttribute, IRRuleMatchResult result, + Consumer setFailures) { + CheckAttributeMatchResult checkAttributeResult = checkAttribute.apply(irMethod.getOutput()); + if (checkAttributeResult.fail()) { + setFailures.accept(checkAttributeResult); + result.updateOutputMatch(getOutputMatch(checkAttribute, checkAttributeResult)); + } + } + + /** + * Determine how the output was matched by reapplying the check attribute for the PrintIdeal and PrintOptoAssembly + * output separately. + */ + private OutputMatch getOutputMatch(CheckAttribute checkAttribute, CheckAttributeMatchResult checkAttributeResult) { + int totalMatches = checkAttributeResult.getMatchesCount(); + int idealFailuresCount = getMatchesCount(checkAttribute, irMethod.getIdealOutput()); + int optoAssemblyFailuresCount = getMatchesCount(checkAttribute, irMethod.getOptoAssemblyOutput()); + return findOutputMatch(totalMatches, idealFailuresCount, optoAssemblyFailuresCount); + } + + private int getMatchesCount(CheckAttribute checkAttribute, String compilation) { + CheckAttributeMatchResult result = checkAttribute.apply(compilation); + return result.getMatchesCount(); + } + + /** + * Compare different counts to find out, on what output a failure was matched. + */ + private OutputMatch findOutputMatch(int totalMatches, int idealFailuresCount, int optoAssemblyFailuresCount) { + if (totalMatches == 0 + || someRegexMatchOnlyEntireOutput(totalMatches, idealFailuresCount, optoAssemblyFailuresCount) + || anyMatchOnIdealAndOptoAssembly(idealFailuresCount, optoAssemblyFailuresCount)) { + return OutputMatch.BOTH; + } else if (optoAssemblyFailuresCount == 0) { + return OutputMatch.IDEAL; + } else { + return OutputMatch.OPTO_ASSEMBLY; + } + } + + /** + * Do we have a regex that is only matched on the entire ideal + opto assembly output? + */ + private boolean someRegexMatchOnlyEntireOutput(int totalCount, int idealFailuresCount, int optoAssemblyFailuresCount) { + return totalCount != idealFailuresCount + optoAssemblyFailuresCount; + } + + /** + * Do we have a match on ideal and opto assembly for this rule? + */ + private boolean anyMatchOnIdealAndOptoAssembly(int idealFailuresCount, int optoAssemblyFailuresCount) { + return idealFailuresCount > 0 && optoAssemblyFailuresCount > 0; + } +} diff --git a/test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/irrule/IRRuleMatchResult.java b/test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/irrule/IRRuleMatchResult.java new file mode 100644 index 00000000000..c7d44498d55 --- /dev/null +++ b/test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/irrule/IRRuleMatchResult.java @@ -0,0 +1,102 @@ +/* + * Copyright (c) 2022, 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 compiler.lib.ir_framework.driver.irmatching.irrule; + +import compiler.lib.ir_framework.TestFramework; +import compiler.lib.ir_framework.driver.irmatching.MatchResult; +import compiler.lib.ir_framework.driver.irmatching.OutputMatch; + +/** + * This class represents an IR matching result of an IR rule. + * + * @see CheckAttributeMatchResult + * @see IRRule + */ +public class IRRuleMatchResult implements MatchResult { + private final IRRule irRule; + private CheckAttributeMatchResult failOnFailures = null; + private CheckAttributeMatchResult countsFailures = null; + private OutputMatch outputMatch; + + public IRRuleMatchResult(IRRule irRule) { + this.irRule = irRule; + this.outputMatch = OutputMatch.NONE; + } + + private boolean hasFailOnFailures() { + return failOnFailures != null; + } + + public void setFailOnFailures(CheckAttributeMatchResult failOnFailures) { + this.failOnFailures = failOnFailures; + } + + private boolean hasCountsFailures() { + return countsFailures != null; + } + + public void setCountsFailures(CheckAttributeMatchResult countsFailures) { + this.countsFailures = countsFailures; + } + + public OutputMatch getOutputMatch() { + return outputMatch; + } + + @Override + public boolean fail() { + return failOnFailures != null || countsFailures != null; + } + + public void updateOutputMatch(OutputMatch newOutputMatch) { + TestFramework.check(newOutputMatch != OutputMatch.NONE, "must be valid state"); + switch (outputMatch) { + case NONE -> outputMatch = newOutputMatch; + case IDEAL -> outputMatch = newOutputMatch != OutputMatch.IDEAL + ? OutputMatch.BOTH : OutputMatch.IDEAL; + case OPTO_ASSEMBLY -> outputMatch = newOutputMatch != OutputMatch.OPTO_ASSEMBLY + ? OutputMatch.BOTH : OutputMatch.OPTO_ASSEMBLY; + } + } + + /** + * Build a failure message based on the collected failures of this object. + */ + @Override + public String buildFailureMessage() { + StringBuilder failMsg = new StringBuilder(); + failMsg.append(getIRRuleLine()); + if (hasFailOnFailures()) { + failMsg.append(failOnFailures.buildFailureMessage()); + } + if (hasCountsFailures()) { + failMsg.append(countsFailures.buildFailureMessage()); + } + return failMsg.toString(); + } + + private String getIRRuleLine() { + return " * @IR rule " + irRule.getRuleId() + ": \"" + irRule.getIRAnno() + "\"" + System.lineSeparator(); + } +} diff --git a/test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/irrule/RegexFailure.java b/test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/irrule/RegexFailure.java new file mode 100644 index 00000000000..821da618fa6 --- /dev/null +++ b/test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/irrule/RegexFailure.java @@ -0,0 +1,90 @@ +/* + * Copyright (c) 2022, 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 compiler.lib.ir_framework.driver.irmatching.irrule; + +import java.util.List; +import java.util.stream.Collectors; + +/** + * Base class representing an IR matching failure of a regex of a check attribute of an IR rule. + * + * @see CheckAttributeMatchResult + * @see CheckAttribute + * @see IRRule + */ +abstract class RegexFailure { + protected final String nodeRegex; + protected final int nodeId; + protected final List matches; + + public RegexFailure(String nodeRegex, int nodeId, List matches) { + this.nodeRegex = nodeRegex; + this.nodeId = nodeId; + this.matches = addWhiteSpacePrefixForEachLine(matches); + } + + private List addWhiteSpacePrefixForEachLine(List matches) { + return matches + .stream() + .map(s -> s.replaceAll(System.lineSeparator(), System.lineSeparator() + + getMatchedNodesItemWhiteSpace() + " ")) + .collect(Collectors.toList()); + } + + abstract public String buildFailureMessage(); + + public int getMatchesCount() { + return matches.size(); + } + + protected String getRegexLine() { + return " * Regex " + nodeId + ": " + nodeRegex + System.lineSeparator(); + } + + protected String getMatchedNodesBlock() { + return getMatchedNodesHeader() + getMatchesNodeLines(); + } + + protected String getMatchedNodesHeader() { + int matchCount = matches.size(); + return "" + getMatchedNodesWhiteSpace() + "- " + getMatchedPrefix() + " node" + + (matchCount != 1 ? "s (" + matchCount + ")" : "") + ":" + System.lineSeparator(); + } + + protected String getMatchedNodesWhiteSpace() { + return " "; + } + + abstract protected String getMatchedPrefix(); + + protected String getMatchesNodeLines() { + StringBuilder builder = new StringBuilder(); + matches.forEach(match -> builder.append(getMatchedNodesItemWhiteSpace()).append("* ").append(match).append(System.lineSeparator())); + return builder.toString(); + } + + private String getMatchedNodesItemWhiteSpace() { + return " "; + } +} diff --git a/test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/parser/AbstractLine.java b/test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/parser/AbstractLine.java new file mode 100644 index 00000000000..19bca430709 --- /dev/null +++ b/test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/parser/AbstractLine.java @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2022, 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 compiler.lib.ir_framework.driver.irmatching.parser; + +import java.io.BufferedReader; +import java.io.IOException; + +/** + * Base class of a read line from the hotspot_pid* file. + */ +abstract class AbstractLine { + private final BufferedReader reader; + protected String line; + + public AbstractLine(BufferedReader reader) { + this.reader = reader; + } + + public String getLine() { + return line; + } + + /** + * Read next line and return it. If we've reached the end of the file, return NULL instead. + */ + public boolean readLine() throws IOException { + line = reader.readLine(); + return line != null; + } +} diff --git a/test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/parser/BlockLine.java b/test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/parser/BlockLine.java new file mode 100644 index 00000000000..0fa91a43c5e --- /dev/null +++ b/test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/parser/BlockLine.java @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2022, 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 compiler.lib.ir_framework.driver.irmatching.parser; + +import java.io.BufferedReader; + +/** + * Class representing a block line inside a PrintIdeal or PrintOptoAssembly output block read from the hotspot_pid* file. + */ +class BlockLine extends AbstractLine { + + public BlockLine(BufferedReader reader) { + super(reader); + } + + /** + * Is this line an end of a PrintIdeal or PrintOptoAssembly output block? + */ + public boolean isBlockEnd() { + return line.startsWith(""); + line = line.replace(""", "\""); + line = line.replace("'", "'"); + line = line.replace("&", "&"); + } + return line; + } +} diff --git a/test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/parser/FileCorruptedException.java b/test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/parser/FileCorruptedException.java new file mode 100644 index 00000000000..5681eb662ee --- /dev/null +++ b/test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/parser/FileCorruptedException.java @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2022, 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 compiler.lib.ir_framework.driver.irmatching.parser; + +/** + * Exception thrown when facing an unexpected format during parsing of the hotspot-pid* file + */ +class FileCorruptedException extends RuntimeException { + public FileCorruptedException(String s) { + super(s); + } +} diff --git a/test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/parser/HotSpotPidFileParser.java b/test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/parser/HotSpotPidFileParser.java new file mode 100644 index 00000000000..2e5a1d33456 --- /dev/null +++ b/test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/parser/HotSpotPidFileParser.java @@ -0,0 +1,142 @@ +/* + * Copyright (c) 2022, 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 compiler.lib.ir_framework.driver.irmatching.parser; + +import compiler.lib.ir_framework.TestFramework; +import compiler.lib.ir_framework.driver.irmatching.irmethod.IRMethod; +import compiler.lib.ir_framework.shared.TestFrameworkException; + +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.util.Collection; +import java.util.HashMap; +import java.util.Map; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +/** + * Class to parse the PrintIdeal and PrintOptoAssembly outputs of the test class from the hotspot_pid* file and add them + * to the collection of {@link IRMethod} created by {@link IREncodingParser}. + * + * @see IRMethod + * @see IREncodingParser + */ +class HotSpotPidFileParser { + private static final Pattern COMPILE_ID_PATTERN = Pattern.compile("compile_id='(\\d+)'"); + + private final Pattern compileIdPatternForTestClass; + private Map compilationsMap; + + public HotSpotPidFileParser(String testClass) { + this.compileIdPatternForTestClass = Pattern.compile("compile_id='(\\d+)'.*" + Pattern.quote(testClass) + " (\\S+)"); + } + + public void setCompilationsMap(Map compilationsMap) { + this.compilationsMap = compilationsMap; + } + /** + * Parse the hotspot_pid*.log file from the test VM. Read the PrintIdeal and PrintOptoAssembly outputs for all + * methods of the test class that need to be IR matched (found in compilations map). + */ + public Collection parseCompilations(String hotspotPidFileName) { + try { + processFileLines(hotspotPidFileName); + return compilationsMap.values(); + } catch (IOException e) { + throw new TestFrameworkException("Error while reading " + hotspotPidFileName, e); + } catch (FileCorruptedException e) { + throw new TestFrameworkException("Unexpected format of " + hotspotPidFileName, e); + } + } + + private void processFileLines(String hotspotPidFileName) throws IOException { + Map compileIdMap = new HashMap<>(); + try (var reader = Files.newBufferedReader(Paths.get(hotspotPidFileName))) { + Line line = new Line(reader, compileIdPatternForTestClass); + BlockOutputReader blockOutputReader = new BlockOutputReader(reader); + while (line.readLine()) { + if (line.isTestClassCompilation()) { + parseTestMethodCompileId(compileIdMap, line.getLine()); + } else if (isTestMethodBlockStart(line, compileIdMap)) { + String blockOutput = blockOutputReader.readBlock(); + setIRMethodOutput(blockOutput, line, compileIdMap); + } + } + } + } + + private void parseTestMethodCompileId(Map compileIdMap, String line) { + String methodName = parseMethodName(line); + if (isTestAnnotatedMethod(methodName)) { + int compileId = getCompileId(line); + compileIdMap.put(compileId, getIrMethod(methodName)); + } + } + + private String parseMethodName(String line) { + Matcher matcher = compileIdPatternForTestClass.matcher(line); + TestFramework.check(matcher.find(), "must find match"); + return matcher.group(2); + } + + private boolean isTestAnnotatedMethod(String testMethodName) { + return compilationsMap.containsKey(testMethodName); + } + + private IRMethod getIrMethod(String testMethodName) { + return compilationsMap.get(testMethodName); + } + + + + private int getCompileId(String line) { + Matcher matcher = COMPILE_ID_PATTERN.matcher(line); + if (!matcher.find()) { + throw new FileCorruptedException("Unexpected format found on this line: " + line); + } + return Integer.parseInt(matcher.group(1)); + } + + private boolean isTestMethodBlockStart(Line line, Map compileIdMap) { + return line.isBlockStart() && isTestClassMethodBlock(line, compileIdMap); + } + + private boolean isTestClassMethodBlock(Line line, Map compileIdMap) { + return compileIdMap.containsKey(getCompileId(line.getLine())); + } + + public void setIRMethodOutput(String blockOutput, Line blockStartLine, Map compileIdMap) { + IRMethod irMethod = compileIdMap.get(getCompileId(blockStartLine.getLine())); + setIRMethodOutput(blockOutput, blockStartLine, irMethod); + } + + private void setIRMethodOutput(String blockOutput, Line blockStartLine, IRMethod irMethod) { + if (blockStartLine.isPrintIdealStart()) { + irMethod.setIdealOutput(blockOutput); + } else { + irMethod.setOptoAssemblyOutput(blockOutput); + } + } +} diff --git a/test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/parser/IREncodingParser.java b/test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/parser/IREncodingParser.java new file mode 100644 index 00000000000..5e539a25962 --- /dev/null +++ b/test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/parser/IREncodingParser.java @@ -0,0 +1,153 @@ +/* + * Copyright (c) 2022, 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 compiler.lib.ir_framework.driver.irmatching.parser; + +import compiler.lib.ir_framework.IR; +import compiler.lib.ir_framework.TestFramework; +import compiler.lib.ir_framework.driver.irmatching.irmethod.IRMethod; +import compiler.lib.ir_framework.shared.TestFormat; +import compiler.lib.ir_framework.shared.TestFrameworkException; +import compiler.lib.ir_framework.test.IREncodingPrinter; + +import java.lang.reflect.Method; +import java.util.HashMap; +import java.util.Map; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +/** + * Class to parse the IR encoding emitted by the test VM and creating {@link IRMethod} objects for each entry. + * + * @see IRMethod + */ +class IREncodingParser { + + private static final boolean PRINT_IR_ENCODING = Boolean.parseBoolean(System.getProperty("PrintIREncoding", "false")); + private static final Pattern IR_ENCODING_PATTERN = + Pattern.compile("(?<=" + IREncodingPrinter.START + "\r?\n).*\\R([\\s\\S]*)(?=" + IREncodingPrinter.END + ")"); + + private final Map compilations; + private final Class testClass; + + public IREncodingParser(Class testClass) { + this.testClass = testClass; + this.compilations = new HashMap<>(); + } + + public Map parseIRMethods(String irEncoding) { + if (TestFramework.VERBOSE || PRINT_IR_ENCODING) { + System.out.println("Read IR encoding from test VM:"); + System.out.println(irEncoding); + } + createCompilationsMap(irEncoding, testClass); + // We could have found format errors in @IR annotations. Report them now with an exception. + TestFormat.throwIfAnyFailures(); + return compilations; + } + + /** + * Sets up a map testname -> IRMethod (containing the PrintIdeal and PrintOptoAssembly output for testname). + */ + private void createCompilationsMap(String irEncoding, Class testClass) { + Map irRulesMap = parseIREncoding(irEncoding); + createIRMethodsWithEncoding(testClass, irRulesMap); + } + + /** + * Read the IR encoding emitted by the test VM to decide if an @IR rule must be checked for a method. + */ + private Map parseIREncoding(String irEncoding) { + Map irRulesMap = new HashMap<>(); + String[] irEncodingLines = getIREncodingLines(irEncoding); + for (String s : irEncodingLines) { + String line = s.trim(); + String[] splitLine = line.split(","); + if (splitLine.length < 2) { + throw new TestFrameworkException("Invalid IR match rule encoding. No comma found: " + splitLine[0]); + } + String testName = splitLine[0]; + int[] irRulesIdx = getRuleIndexes(splitLine); + irRulesMap.put(testName, irRulesIdx); + } + return irRulesMap; + } + + /** + * Parse the IR encoding lines without header, explanation line and footer and return them in an array. + */ + private String[] getIREncodingLines(String irEncoding) { + Matcher matcher = IR_ENCODING_PATTERN.matcher(irEncoding); + TestFramework.check(matcher.find(), "Did not find IR encoding"); + String lines = matcher.group(1).trim(); + if (lines.isEmpty()) { + // Nothing to IR match. + return new String[0]; + } + return lines.split("\\R"); + } + + /** + * Parse rule indexes from IR encoding line of the format: + */ + private int[] getRuleIndexes(String[] splitLine) { + int[] irRulesIdx = new int[splitLine.length - 1]; + for (int i = 1; i < splitLine.length; i++) { + try { + irRulesIdx[i - 1] = Integer.parseInt(splitLine[i]); + } catch (NumberFormatException e) { + throw new TestFrameworkException("Invalid IR match rule encoding. No number found: " + splitLine[i]); + } + } + return irRulesIdx; + } + + private void createIRMethodsWithEncoding(Class testClass, Map irRulesMap) { + for (Method m : testClass.getDeclaredMethods()) { + IR[] irAnnos = m.getAnnotationsByType(IR.class); + if (irAnnos.length > 0) { + // Validation of legal @IR attributes and placement of the annotation was already done in Test VM. + int[] irRuleIds = irRulesMap.get(m.getName()); + validateIRRuleIds(m, irAnnos, irRuleIds); + if (hasAnyApplicableIRRules(irRuleIds)) { + compilations.put(m.getName(), new IRMethod(m, irRuleIds, irAnnos)); + } + } + } + } + + private void validateIRRuleIds(Method m, IR[] irAnnos, int[] ids) { + TestFramework.check(ids != null, "Should find method name in validIrRulesMap for " + m); + TestFramework.check(ids.length > 0, "Did not find any rule indices for " + m); + TestFramework.check((ids[0] >= 1 || ids[0] == IREncodingPrinter.NO_RULE_APPLIED) + && ids[ids.length - 1] <= irAnnos.length, + "Invalid IR rule index found in validIrRulesMap for " + m); + } + + /** + * Does the list of IR rules contain any applicable IR rules for the given conditions? + */ + private boolean hasAnyApplicableIRRules(int[] irRuleIds) { + return irRuleIds[0] != IREncodingPrinter.NO_RULE_APPLIED; + } +} diff --git a/test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/parser/IRMethodParser.java b/test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/parser/IRMethodParser.java new file mode 100644 index 00000000000..332b88d96c6 --- /dev/null +++ b/test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/parser/IRMethodParser.java @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2022, 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 compiler.lib.ir_framework.driver.irmatching.parser; + +import compiler.lib.ir_framework.driver.irmatching.irmethod.IRMethod; + +import java.util.Collection; +import java.util.Map; + +/** + * Class to parse the PrintIdeal and PrintOptoAssembly outputs of the test class and store them into a collection + * of dedicated IRMethod objects used throughout IR matching. + * + * @see IRMethod + */ +public class IRMethodParser { + private final IREncodingParser irEncodingParser; + private final HotSpotPidFileParser hotSpotPidFileParser; + + public IRMethodParser(Class testClass) { + this.irEncodingParser = new IREncodingParser(testClass); + this.hotSpotPidFileParser = new HotSpotPidFileParser(testClass.getName()); + } + + /** + * Parse the IR encoding and hotspot_pid* file to create a collection of {@link IRMethod} objects. + * Return null if there are no applicable @IR rules in any method of the test class. + */ + public Collection parse(String hotspotPidFileName, String irEncoding) { + Map compilationsMap = irEncodingParser.parseIRMethods(irEncoding); + if (!compilationsMap.isEmpty()) { + hotSpotPidFileParser.setCompilationsMap(compilationsMap); + return hotSpotPidFileParser.parseCompilations(hotspotPidFileName); + } + return null; + } +} diff --git a/test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/parser/Line.java b/test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/parser/Line.java new file mode 100644 index 00000000000..16ef31b719d --- /dev/null +++ b/test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/parser/Line.java @@ -0,0 +1,97 @@ +/* + * Copyright (c) 2022, 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 compiler.lib.ir_framework.driver.irmatching.parser; + +import java.io.BufferedReader; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +/** + * Class representing a normal line read from the hotspot_pid* file. + */ +class Line extends AbstractLine { + private final Pattern compileIdPatternForTestClass; + + public Line(BufferedReader reader, Pattern compileIdPatternForTestClass) { + super(reader); + this.compileIdPatternForTestClass = compileIdPatternForTestClass; + } + + /** + * Is this line a start of a @Test annotated method? We only care about test class entries. There might be non-class + * entries as well if user specified additional compile commands. Ignore these. + */ + public boolean isTestClassCompilation() { + if (isCompilation()) { + Matcher matcher = compileIdPatternForTestClass.matcher(line); + return matcher.find(); + } + return false; + } + + /** + * Is this header a C2 non-OSR compilation header entry? + */ + public boolean isCompilation() { + return line.startsWith("> { + private final T givenValue; // Right hand side + private final BiPredicate comparisonPredicate; + private final String comparator; + + public Comparison(T givenValue, String comparator, BiPredicate comparisonPredicate) { + this.givenValue = givenValue; + this.comparator = comparator; + this.comparisonPredicate = comparisonPredicate; + } + + public T getGivenValue() { + return givenValue; + } + + public String getComparator() { + return comparator; + } + + /** + * Comparison: foundValue OP givenValue + */ + public boolean compare(T foundValue) { + return comparisonPredicate.test(foundValue, givenValue); + } +} diff --git a/test/hotspot/jtreg/compiler/lib/ir_framework/shared/ComparisonConstraintParser.java b/test/hotspot/jtreg/compiler/lib/ir_framework/shared/ComparisonConstraintParser.java new file mode 100644 index 00000000000..4848a32859f --- /dev/null +++ b/test/hotspot/jtreg/compiler/lib/ir_framework/shared/ComparisonConstraintParser.java @@ -0,0 +1,150 @@ +/* + * Copyright (c) 2021, 2022, 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 compiler.lib.ir_framework.shared; + +import java.util.function.BiPredicate; +import java.util.function.Function; + +/** + * Utility class to parse a comparator either in the applyIf* or in the counts properties of an @IR rules. + */ +public class ComparisonConstraintParser> { + + private enum Comparator { + ONE_CHAR, TWO_CHARS + } + + public static > Comparison parse(String constraint, Function parseFunction, + String postfixErrorMsg) { + try { + return parseConstraintAndValue(constraint, parseFunction); + } catch (EmptyConstraintException e) { + TestFormat.fail("Provided empty value " + postfixErrorMsg); + throw new UnreachableCodeException(); + } catch (MissingConstraintValueException e) { + TestFormat.fail("Provided empty value after comparator \"" + e.getComparator() + "\" " + postfixErrorMsg); + throw new UnreachableCodeException(); + } catch (InvalidComparatorException e) { + TestFormat.fail("Provided invalid comparator \"" + e.getComparator() + "\" " + postfixErrorMsg); + throw new UnreachableCodeException(); + } catch (InvalidConstraintValueException e) { + String comparator = e.getComparator(); + if (!comparator.isEmpty()) { + comparator = " after comparator \"" + comparator + "\""; + } + TestFormat.fail("Provided invalid value \"" + e.getInvalidValue() + "\"" + + comparator + " " + postfixErrorMsg); + throw new UnreachableCodeException(); + } + } + + private static > Comparison parseConstraintAndValue(String constraint, + Function parseFunction) throws + EmptyConstraintException, MissingConstraintValueException, + InvalidComparatorException, InvalidConstraintValueException { + ParsedResult result = parse(constraint); + T givenValue = parseGivenValue(parseFunction, result); + return new Comparison<>(givenValue, result.comparator, result.comparisonPredicate); + } + + private static > ParsedResult parse(String constraint) throws + EmptyConstraintException, MissingConstraintValueException, InvalidComparatorException { + constraint = constraint.trim(); + if (constraint.isEmpty()) { + throw new EmptyConstraintException(); + } + switch (constraint.charAt(0)) { + case '<' -> { + throwIfNoValueAfterComparator(constraint, Comparator.ONE_CHAR); + if (constraint.charAt(1) == '=') { + throwIfNoValueAfterComparator(constraint, Comparator.TWO_CHARS); + return new ParsedResult<>(constraint.substring(2).trim(), "<=", (x, y) -> x.compareTo(y) <= 0); + } else { + return new ParsedResult<>(constraint.substring(1).trim(), "<", (x, y) -> x.compareTo(y) < 0); + } + } + case '>' -> { + throwIfNoValueAfterComparator(constraint, Comparator.ONE_CHAR); + if (constraint.charAt(1) == '=') { + throwIfNoValueAfterComparator(constraint, Comparator.TWO_CHARS); + return new ParsedResult<>(constraint.substring(2).trim(), ">=", (x, y) -> x.compareTo(y) >= 0); + } else { + return new ParsedResult<>(constraint.substring(1).trim(), ">", (x, y) -> x.compareTo(y) > 0); + } + } + case '!' -> { + throwIfNoValueAfterComparator(constraint, Comparator.ONE_CHAR); + if (constraint.charAt(1) != '=') { + throw new InvalidComparatorException("!"); + } + throwIfNoValueAfterComparator(constraint, Comparator.TWO_CHARS); + return new ParsedResult<>(constraint.substring(2).trim(), "!=", (x, y) -> x.compareTo(y) != 0); + } + case '=' -> { // Allowed syntax, equivalent to not using any symbol. + throwIfNoValueAfterComparator(constraint, Comparator.ONE_CHAR); + return new ParsedResult<>(constraint.substring(1).trim(), "=", (x, y) -> x.compareTo(y) == 0); + } + default -> { + return new ParsedResult<>(constraint.trim(), "=", (x, y) -> x.compareTo(y) == 0); + } + } + } + + private static void throwIfNoValueAfterComparator(String constraint, Comparator comparator) throws MissingConstraintValueException { + switch (comparator) { + case ONE_CHAR -> { + if (constraint.length() == 1) { + throw new MissingConstraintValueException(constraint); + } + } + case TWO_CHARS -> { + if (constraint.length() == 2) { + throw new MissingConstraintValueException(constraint); + } + } + } + } + + private static > T parseGivenValue(Function parseFunction, ParsedResult result) + throws InvalidConstraintValueException { + try { + return parseFunction.apply(result.value); + } + catch (NumberFormatException e) { + throw new InvalidConstraintValueException(result.value, result.comparator); + } + } + + static class ParsedResult { + public String value; + public BiPredicate comparisonPredicate; + public String comparator; + + public ParsedResult(String value, String comparator,BiPredicate comparisonPredicate) { + this.value = value; + this.comparator = comparator; + this.comparisonPredicate = comparisonPredicate; + } + } +} diff --git a/test/hotspot/jtreg/compiler/lib/ir_framework/shared/EmptyConstraintException.java b/test/hotspot/jtreg/compiler/lib/ir_framework/shared/EmptyConstraintException.java new file mode 100644 index 00000000000..6dfd31819ee --- /dev/null +++ b/test/hotspot/jtreg/compiler/lib/ir_framework/shared/EmptyConstraintException.java @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2022, 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 compiler.lib.ir_framework.shared; + +/** + * Exception thrown when {@link ComparisonConstraintParser} cannot find a constraint. + */ +class EmptyConstraintException extends Exception { +} diff --git a/test/hotspot/jtreg/compiler/lib/ir_framework/shared/InvalidComparatorException.java b/test/hotspot/jtreg/compiler/lib/ir_framework/shared/InvalidComparatorException.java new file mode 100644 index 00000000000..4ab550e8be8 --- /dev/null +++ b/test/hotspot/jtreg/compiler/lib/ir_framework/shared/InvalidComparatorException.java @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2022, 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 compiler.lib.ir_framework.shared; + +/** + * Exception threw when {@link ComparisonConstraintParser} parses an invalid comparator. + */ +public class InvalidComparatorException extends Exception { + private final String comparator; + + public InvalidComparatorException(String comparator) { + this.comparator = comparator; + } + + public String getComparator() { + return comparator; + } +} diff --git a/test/hotspot/jtreg/compiler/lib/ir_framework/shared/InvalidConstraintValueException.java b/test/hotspot/jtreg/compiler/lib/ir_framework/shared/InvalidConstraintValueException.java new file mode 100644 index 00000000000..a415ebf4046 --- /dev/null +++ b/test/hotspot/jtreg/compiler/lib/ir_framework/shared/InvalidConstraintValueException.java @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2022, 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 compiler.lib.ir_framework.shared; + +/** + * Exception thrown when {@link ComparisonConstraintParser} parses an invalid value. + */ +class InvalidConstraintValueException extends Exception { + private final String invalidValue; + private final String comparator; + + public InvalidConstraintValueException(String invalidValue, String comparator) { + this.invalidValue = invalidValue; + this.comparator = comparator; + } + + public String getInvalidValue() { + return invalidValue; + } + + public String getComparator() { + return comparator; + } +} diff --git a/test/hotspot/jtreg/compiler/lib/ir_framework/shared/MissingConstraintValueException.java b/test/hotspot/jtreg/compiler/lib/ir_framework/shared/MissingConstraintValueException.java new file mode 100644 index 00000000000..12230f9219c --- /dev/null +++ b/test/hotspot/jtreg/compiler/lib/ir_framework/shared/MissingConstraintValueException.java @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2022, 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 compiler.lib.ir_framework.shared; + +/** + * Exception thrown when {@link ComparisonConstraintParser} cannot find a value in a constraint after a comparator. + */ +class MissingConstraintValueException extends Exception { + private final String comparator; + + public MissingConstraintValueException(String comparator) { + this.comparator = comparator; + } + + public String getComparator() { + return comparator; + } +} diff --git a/test/hotspot/jtreg/compiler/lib/ir_framework/shared/ParsedComparator.java b/test/hotspot/jtreg/compiler/lib/ir_framework/shared/ParsedComparator.java deleted file mode 100644 index 9d574bc50a4..00000000000 --- a/test/hotspot/jtreg/compiler/lib/ir_framework/shared/ParsedComparator.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * Copyright (c) 2021, 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 compiler.lib.ir_framework.shared; - -import java.util.function.BiPredicate; - -/** - * Utility class to parse a comparator either in the applyIf* or in the counts properties of an @IR rules. - */ -public class ParsedComparator> { - private final String strippedString; - private final BiPredicate predicate; - private final String comparator; - - public ParsedComparator(String strippedString, BiPredicate predicate, String comparator) { - this.strippedString = strippedString; - this.predicate = predicate; - this.comparator = comparator; - } - - public String getStrippedString() { - return strippedString; - } - - public BiPredicate getPredicate() { - return predicate; - } - - public String getComparator() { - return comparator; - } - - /** - * Return parsed comparator object which provides the predicate to perform the test. - * Allowed comparators: <, <=, >, =>, =, != - */ - public static > ParsedComparator parseComparator(String value) throws CheckedTestFrameworkException { - BiPredicate comparison; - value = value.trim(); - String comparator = ""; - switch (value.charAt(0)) { - case '<': - if (value.charAt(1) == '=') { - comparator = "<="; - comparison = (x, y) -> x.compareTo(y) <= 0; - value = value.substring(2).trim(); - } else { - comparator = "<"; - comparison = (x, y) -> x.compareTo(y) < 0; - value = value.substring(1).trim(); - } - break; - case '>': - if (value.charAt(1) == '=') { - comparator = ">="; - comparison = (x, y) -> x.compareTo(y) >= 0; - value = value.substring(2).trim(); - } else { - comparator = ">"; - comparison = (x, y) -> x.compareTo(y) > 0; - value = value.substring(1).trim(); - } - break; - case '!': - if (value.charAt(1) != '=') { - throw new CheckedTestFrameworkException(value.substring(0, 1)); - } - comparator = "!="; - comparison = (x, y) -> x.compareTo(y) != 0; - value = value.substring(2).trim(); - break; - case '=': // Allowed syntax, equivalent to not using any symbol. - comparator = "="; - value = value.substring(1).trim(); - // Fall through - default: - comparison = (x, y) -> x.compareTo(y) == 0; - value = value.trim(); - break; - } - return new ParsedComparator<>(value, comparison, comparator); - } -} diff --git a/test/hotspot/jtreg/compiler/lib/ir_framework/shared/TestFormat.java b/test/hotspot/jtreg/compiler/lib/ir_framework/shared/TestFormat.java index 624753fee2f..d7a93228a6b 100644 --- a/test/hotspot/jtreg/compiler/lib/ir_framework/shared/TestFormat.java +++ b/test/hotspot/jtreg/compiler/lib/ir_framework/shared/TestFormat.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2022, 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 @@ -53,7 +53,7 @@ public class TestFormat { FAILURES.add(failureMessage); } - public static void reportIfAnyFailures() { + public static void throwIfAnyFailures() { if (FAILURES.isEmpty()) { // No format violation detected. return; diff --git a/test/hotspot/jtreg/compiler/lib/ir_framework/shared/UnreachableCodeException.java b/test/hotspot/jtreg/compiler/lib/ir_framework/shared/UnreachableCodeException.java new file mode 100644 index 00000000000..274b05dd323 --- /dev/null +++ b/test/hotspot/jtreg/compiler/lib/ir_framework/shared/UnreachableCodeException.java @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2022, 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 compiler.lib.ir_framework.shared; + +/** + * The error reporting of the IR framework is throwing exceptions unconditionally in separate methods. The calling methods, + * however, do not see these exceptions. As a result, Java and/or some IDEs could complain about impossible states + * (e.g. uninitialized variables, null pointer dereferences etc. even though an exception will be thrown earlier). + * To avoid that, throw an instance of this class instead. + */ +class UnreachableCodeException extends RuntimeException { + public UnreachableCodeException() { + super("Unreachable code"); + } +} diff --git a/test/hotspot/jtreg/compiler/lib/ir_framework/test/IREncodingPrinter.java b/test/hotspot/jtreg/compiler/lib/ir_framework/test/IREncodingPrinter.java index dc3a2d304eb..5f7438a36da 100644 --- a/test/hotspot/jtreg/compiler/lib/ir_framework/test/IREncodingPrinter.java +++ b/test/hotspot/jtreg/compiler/lib/ir_framework/test/IREncodingPrinter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2022, 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 @@ -37,7 +37,7 @@ import java.util.function.Function; /** * Prints an encoding to the dedicated test framework socket whether @IR rules of @Test methods should be applied or not. * This is done during the execution of the test VM by checking the active VM flags. This encoding is eventually parsed - * and checked by the IRMatcher class in the driver VM after the termination of the test VM. + * and checked by the IRMatcher class in the driver VM after the termination of the test VM. IR rule indices start at 1. */ public class IREncodingPrinter { public static final String START = "##### IRMatchRulesEncoding - used by TestFramework #####"; @@ -73,7 +73,7 @@ public class IREncodingPrinter { ruleIndex = i + 1; try { if (shouldApplyIrRule(irAnno)) { - validRules.add(i); + validRules.add(ruleIndex); } } catch (TestFormatException e) { // Catch logged failure and continue to check other IR annotations. @@ -206,11 +206,11 @@ public class IREncodingPrinter { } actualFlagValue = LONG_GETTERS.stream().map(f -> f.apply(flag)).filter(Objects::nonNull).findAny().orElse(null); if (actualFlagValue != null) { - return checkLongFlag(flag, value, (Long) actualFlagValue); + return checkFlag(Long::parseLong, "integer", flag, value, (Long) actualFlagValue); } actualFlagValue = WHITE_BOX.getDoubleVMFlag(flag); if (actualFlagValue != null) { - return checkDoubleFlag(flag, value, (Double) actualFlagValue); + return checkFlag(Double::parseDouble, "floating point", flag, value, (Double) actualFlagValue); } actualFlagValue = WHITE_BOX.getStringVMFlag(flag); if (actualFlagValue != null) { @@ -242,60 +242,20 @@ public class IREncodingPrinter { return booleanValue == actualFlagValue; } - private boolean checkLongFlag(String flag, String value, long actualFlagValue) { - long longValue; - ParsedComparator parsedComparator; + private > boolean checkFlag(Function parseFunction, String kind, String flag, + String value, T actualFlagValue) { try { - parsedComparator = ParsedComparator.parseComparator(value); - } catch (CheckedTestFrameworkException e) { - TestFormat.failNoThrow("Invalid comparator in \"" + value + "\" for integer based flag " + flag + failAt()); - return false; - } catch (IndexOutOfBoundsException e) { - TestFormat.failNoThrow("Provided empty value for integer based flag " + flag + failAt()); - return false; - } - try { - longValue = Long.parseLong(parsedComparator.getStrippedString()); - } catch (NumberFormatException e) { - String comparator = parsedComparator.getComparator(); - if (!comparator.isEmpty()) { - comparator = "after comparator \"" + parsedComparator.getComparator() + "\""; - } - TestFormat.failNoThrow("Invalid value \"" + parsedComparator.getStrippedString() + "\" " - + comparator + " for integer based flag " + flag + failAt()); - return false; - } - return parsedComparator.getPredicate().test(actualFlagValue, longValue); - } - - private boolean checkDoubleFlag(String flag, String value, double actualFlagValue) { - double doubleValue; - ParsedComparator parsedComparator; - try { - parsedComparator = ParsedComparator.parseComparator(value); - } catch (CheckedTestFrameworkException e) { - TestFormat.failNoThrow("Invalid comparator in \"" + value + "\" for floating point based flag " + flag + failAt()); - return false; - } catch (IndexOutOfBoundsException e) { - TestFormat.failNoThrow("Provided empty value for floating point based flag " + flag + failAt()); - return false; - } - try { - doubleValue = Double.parseDouble(parsedComparator.getStrippedString()); - } catch (NumberFormatException e) { - String comparator = parsedComparator.getComparator(); - if (!comparator.isEmpty()) { - comparator = "after comparator \"" + parsedComparator.getComparator() + "\""; - } - TestFormat.failNoThrow("Invalid value \"" + parsedComparator.getStrippedString() + "\" " - + comparator + " for floating point based flag " + flag + failAt()); + String postFixErrorMsg = "for " + kind + " based flag \"" + flag + "\"" + failAt(); + Comparison comparison = ComparisonConstraintParser.parse(value, parseFunction, postFixErrorMsg); + return comparison.compare(actualFlagValue); + } catch (TestFormatException e) { + // Format exception, do not apply rule. return false; } - return parsedComparator.getPredicate().test(actualFlagValue, doubleValue); } private String failAt() { - return " for @IR rule " + ruleIndex + " at " + method; + return " in @IR rule " + ruleIndex + " at " + method; } public void emit() { diff --git a/test/hotspot/jtreg/compiler/lib/ir_framework/test/TestVM.java b/test/hotspot/jtreg/compiler/lib/ir_framework/test/TestVM.java index 0ed89a1f633..6a35b27cd44 100644 --- a/test/hotspot/jtreg/compiler/lib/ir_framework/test/TestVM.java +++ b/test/hotspot/jtreg/compiler/lib/ir_framework/test/TestVM.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2022, 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 @@ -267,7 +267,7 @@ public class TestVM { if (PRINT_VALID_IR_RULES) { irMatchRulePrinter.emit(); } - TestFormat.reportIfAnyFailures(); + TestFormat.throwIfAnyFailures(); declaredTests.clear(); testMethodMap.clear(); } diff --git a/test/hotspot/jtreg/compiler/vectorapi/TestMaskedMacroLogicVector.java b/test/hotspot/jtreg/compiler/vectorapi/TestMaskedMacroLogicVector.java index e5f2e34040d..0c303f8c39f 100644 --- a/test/hotspot/jtreg/compiler/vectorapi/TestMaskedMacroLogicVector.java +++ b/test/hotspot/jtreg/compiler/vectorapi/TestMaskedMacroLogicVector.java @@ -37,9 +37,6 @@ package compiler.vectorapi; import java.util.concurrent.Callable; import compiler.lib.ir_framework.*; -import compiler.lib.ir_framework.driver.IRViolationException; -import jdk.test.lib.Asserts; -import jdk.test.lib.Asserts; import jdk.test.lib.Utils; import java.util.Random; diff --git a/test/hotspot/jtreg/testlibrary_tests/ir_framework/examples/IRExample.java b/test/hotspot/jtreg/testlibrary_tests/ir_framework/examples/IRExample.java index 950cca3844f..9142d313078 100644 --- a/test/hotspot/jtreg/testlibrary_tests/ir_framework/examples/IRExample.java +++ b/test/hotspot/jtreg/testlibrary_tests/ir_framework/examples/IRExample.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,7 +24,7 @@ package ir_framework.examples; import compiler.lib.ir_framework.*; -import compiler.lib.ir_framework.driver.IRViolationException; +import compiler.lib.ir_framework.driver.irmatching.IRViolationException; /* * @test diff --git a/test/hotspot/jtreg/testlibrary_tests/ir_framework/tests/TestCheckedTests.java b/test/hotspot/jtreg/testlibrary_tests/ir_framework/tests/TestCheckedTests.java index 6a8d5c50c6a..c08635b14bc 100644 --- a/test/hotspot/jtreg/testlibrary_tests/ir_framework/tests/TestCheckedTests.java +++ b/test/hotspot/jtreg/testlibrary_tests/ir_framework/tests/TestCheckedTests.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,7 +24,7 @@ package ir_framework.tests; import compiler.lib.ir_framework.*; -import compiler.lib.ir_framework.driver.IRViolationException; +import compiler.lib.ir_framework.driver.irmatching.IRViolationException; import compiler.lib.ir_framework.driver.TestVMException; import java.io.ByteArrayOutputStream; import java.io.PrintStream; diff --git a/test/hotspot/jtreg/testlibrary_tests/ir_framework/tests/TestCompileThreshold.java b/test/hotspot/jtreg/testlibrary_tests/ir_framework/tests/TestCompileThreshold.java index 76090b94efc..145430f61f9 100644 --- a/test/hotspot/jtreg/testlibrary_tests/ir_framework/tests/TestCompileThreshold.java +++ b/test/hotspot/jtreg/testlibrary_tests/ir_framework/tests/TestCompileThreshold.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,7 +24,7 @@ package ir_framework.tests; import compiler.lib.ir_framework.*; -import compiler.lib.ir_framework.driver.IRViolationException; +import compiler.lib.ir_framework.driver.irmatching.IRViolationException; import jdk.test.lib.Asserts; /* diff --git a/test/hotspot/jtreg/testlibrary_tests/ir_framework/tests/TestIRMatching.java b/test/hotspot/jtreg/testlibrary_tests/ir_framework/tests/TestIRMatching.java index f4ce560d2f4..c6c81d8c204 100644 --- a/test/hotspot/jtreg/testlibrary_tests/ir_framework/tests/TestIRMatching.java +++ b/test/hotspot/jtreg/testlibrary_tests/ir_framework/tests/TestIRMatching.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,7 +24,7 @@ package ir_framework.tests; import compiler.lib.ir_framework.*; -import compiler.lib.ir_framework.driver.IRViolationException; +import compiler.lib.ir_framework.driver.irmatching.IRViolationException; import jdk.test.lib.Asserts; import jdk.test.lib.Platform; import sun.hotspot.WhiteBox; @@ -60,7 +60,7 @@ public class TestIRMatching { private static void addException(Exception e) { System.out.flush(); System.err.flush(); - exceptions.put(e, baos.toString() + System.lineSeparator() + baosErr.toString()); + exceptions.put(e, baos + System.lineSeparator() + baosErr); } public static void main(String[] args) { @@ -285,20 +285,20 @@ public class TestIRMatching { runWithArguments(FlagComparisons.class, "-XX:TLABRefillWasteFraction=50"); System.out.flush(); String output = baos.toString(); - findIrIds(output, "testMatchAllIf50", 0, 21); + findIrIds(output, "testMatchAllIf50", 1, 22); findIrIds(output, "testMatchNoneIf50", -1, -1); runWithArguments(FlagComparisons.class, "-XX:TLABRefillWasteFraction=49"); System.out.flush(); output = baos.toString(); - findIrIds(output, "testMatchAllIf50", 4, 6, 13, 18); - findIrIds(output, "testMatchNoneIf50", 0, 3, 8, 10, 17, 22); + findIrIds(output, "testMatchAllIf50", 5, 7, 14, 19); + findIrIds(output, "testMatchNoneIf50", 1, 4, 9, 11, 18, 23); runWithArguments(FlagComparisons.class, "-XX:TLABRefillWasteFraction=51"); System.out.flush(); output = baos.toString(); - findIrIds(output, "testMatchAllIf50", 7, 12, 19, 21); - findIrIds(output, "testMatchNoneIf50", 4, 7, 11, 16, 20, 22); + findIrIds(output, "testMatchAllIf50", 8, 13, 20, 22); + findIrIds(output, "testMatchNoneIf50", 5, 8, 12, 17, 21, 23); System.setOut(oldOut); System.setErr(oldErr); @@ -395,7 +395,7 @@ public class TestIRMatching { } } if (!output.contains(builder.toString())) { - addException(new RuntimeException("Could not find encoding: \"" + builder.toString() + System.lineSeparator())); + addException(new RuntimeException("Could not find encoding: \"" + builder + System.lineSeparator())); } } } @@ -550,20 +550,20 @@ class MultipleFailOnBad { class FlagComparisons { // Applies all IR rules if TLABRefillWasteFraction=50 @Test - @IR(failOn = IRNode.CALL, applyIf = {"TLABRefillWasteFraction", "50"}) // Index 0 + @IR(failOn = IRNode.CALL, applyIf = {"TLABRefillWasteFraction", "50"}) // Index 1 @IR(failOn = IRNode.CALL, applyIf = {"TLABRefillWasteFraction", "=50"}) @IR(failOn = IRNode.CALL, applyIf = {"TLABRefillWasteFraction", "= 50"}) @IR(failOn = IRNode.CALL, applyIf = {"TLABRefillWasteFraction", " = 50"}) - @IR(failOn = IRNode.CALL, applyIf = {"TLABRefillWasteFraction", "<=50"}) // Index 4 + @IR(failOn = IRNode.CALL, applyIf = {"TLABRefillWasteFraction", "<=50"}) // Index 5 @IR(failOn = IRNode.CALL, applyIf = {"TLABRefillWasteFraction", "<= 50"}) @IR(failOn = IRNode.CALL, applyIf = {"TLABRefillWasteFraction", " <= 50"}) - @IR(failOn = IRNode.CALL, applyIf = {"TLABRefillWasteFraction", ">=50"}) // Index 7 + @IR(failOn = IRNode.CALL, applyIf = {"TLABRefillWasteFraction", ">=50"}) // Index 8 @IR(failOn = IRNode.CALL, applyIf = {"TLABRefillWasteFraction", ">= 50"}) @IR(failOn = IRNode.CALL, applyIf = {"TLABRefillWasteFraction", " >= 50"}) @IR(failOn = IRNode.CALL, applyIf = {"TLABRefillWasteFraction", ">49"}) @IR(failOn = IRNode.CALL, applyIf = {"TLABRefillWasteFraction", "> 49"}) @IR(failOn = IRNode.CALL, applyIf = {"TLABRefillWasteFraction", " > 49"}) - @IR(failOn = IRNode.CALL, applyIf = {"TLABRefillWasteFraction", "<51"}) // Index 13 + @IR(failOn = IRNode.CALL, applyIf = {"TLABRefillWasteFraction", "<51"}) // Index 14 @IR(failOn = IRNode.CALL, applyIf = {"TLABRefillWasteFraction", "< 51"}) @IR(failOn = IRNode.CALL, applyIf = {"TLABRefillWasteFraction", " < 51"}) @IR(failOn = IRNode.CALL, applyIf = {"TLABRefillWasteFraction", "!=51"}) @@ -571,34 +571,34 @@ class FlagComparisons { @IR(failOn = IRNode.CALL, applyIf = {"TLABRefillWasteFraction", " != 51"}) @IR(failOn = IRNode.CALL, applyIf = {"TLABRefillWasteFraction", "!=49"}) @IR(failOn = IRNode.CALL, applyIf = {"TLABRefillWasteFraction", "!= 49"}) - @IR(failOn = IRNode.CALL, applyIf = {"TLABRefillWasteFraction", " != 49"}) // Index 21 + @IR(failOn = IRNode.CALL, applyIf = {"TLABRefillWasteFraction", " != 49"}) // Index 22 public void testMatchAllIf50() {} // Applies no IR rules if TLABRefillWasteFraction=50 @Test - @IR(failOn = IRNode.CALL, applyIf = {"TLABRefillWasteFraction", "49"}) // Index 0 + @IR(failOn = IRNode.CALL, applyIf = {"TLABRefillWasteFraction", "49"}) // Index 1 @IR(failOn = IRNode.CALL, applyIf = {"TLABRefillWasteFraction", "=49"}) @IR(failOn = IRNode.CALL, applyIf = {"TLABRefillWasteFraction", "= 49"}) @IR(failOn = IRNode.CALL, applyIf = {"TLABRefillWasteFraction", " = 49"}) - @IR(failOn = IRNode.CALL, applyIf = {"TLABRefillWasteFraction", "51"}) // Index 4 + @IR(failOn = IRNode.CALL, applyIf = {"TLABRefillWasteFraction", "51"}) // Index 5 @IR(failOn = IRNode.CALL, applyIf = {"TLABRefillWasteFraction", "=51"}) @IR(failOn = IRNode.CALL, applyIf = {"TLABRefillWasteFraction", "= 51"}) @IR(failOn = IRNode.CALL, applyIf = {"TLABRefillWasteFraction", " = 51"}) - @IR(failOn = IRNode.CALL, applyIf = {"TLABRefillWasteFraction", "<=49"}) // Index 8 + @IR(failOn = IRNode.CALL, applyIf = {"TLABRefillWasteFraction", "<=49"}) // Index 9 @IR(failOn = IRNode.CALL, applyIf = {"TLABRefillWasteFraction", "<= 49"}) @IR(failOn = IRNode.CALL, applyIf = {"TLABRefillWasteFraction", " <= 49"}) - @IR(failOn = IRNode.CALL, applyIf = {"TLABRefillWasteFraction", ">=51"}) // Index 11 + @IR(failOn = IRNode.CALL, applyIf = {"TLABRefillWasteFraction", ">=51"}) // Index 12 @IR(failOn = IRNode.CALL, applyIf = {"TLABRefillWasteFraction", ">= 51"}) @IR(failOn = IRNode.CALL, applyIf = {"TLABRefillWasteFraction", " >= 51"}) @IR(failOn = IRNode.CALL, applyIf = {"TLABRefillWasteFraction", ">50"}) @IR(failOn = IRNode.CALL, applyIf = {"TLABRefillWasteFraction", "> 50"}) @IR(failOn = IRNode.CALL, applyIf = {"TLABRefillWasteFraction", " > 50"}) - @IR(failOn = IRNode.CALL, applyIf = {"TLABRefillWasteFraction", "<50"}) // Index 17 + @IR(failOn = IRNode.CALL, applyIf = {"TLABRefillWasteFraction", "<50"}) // Index 18 @IR(failOn = IRNode.CALL, applyIf = {"TLABRefillWasteFraction", "< 50"}) @IR(failOn = IRNode.CALL, applyIf = {"TLABRefillWasteFraction", " < 50"}) @IR(failOn = IRNode.CALL, applyIf = {"TLABRefillWasteFraction", "!=50"}) @IR(failOn = IRNode.CALL, applyIf = {"TLABRefillWasteFraction", "!= 50"}) - @IR(failOn = IRNode.CALL, applyIf = {"TLABRefillWasteFraction", " != 50"}) // Index 22 + @IR(failOn = IRNode.CALL, applyIf = {"TLABRefillWasteFraction", " != 50"}) // Index 23 public void testMatchNoneIf50() {} } @@ -814,14 +814,14 @@ class BadCount { int iFld; int result; @Test - @IR(counts = {IRNode.LOAD, "!= 1"}) + @IR(counts = {IRNode.LOAD, "!= 1"}) // fail @IR(counts = {IRNode.STORE, "> 0"}) public void bad1() { result = iFld; } @Test - @IR(counts = {IRNode.LOAD, "1"}) + @IR(counts = {IRNode.LOAD, "1"}) // fail @IR(counts = {IRNode.STORE, "< 1"}) public void bad2() { result = iFld; @@ -829,8 +829,8 @@ class BadCount { @Test - @IR(counts = {IRNode.LOAD, "0"}) - @IR(counts = {IRNode.STORE, " <= 0"}) + @IR(counts = {IRNode.LOAD, "0"}) // fail + @IR(counts = {IRNode.STORE, " <= 0"}) // fail public void bad3() { result = iFld; } @@ -1514,7 +1514,7 @@ abstract class Constraint { } } } - Asserts.assertTrue(matched, toString() + " should have been matched"); + Asserts.assertTrue(matched, this + " should have been matched"); } abstract protected void checkIRRule(String irRule); @@ -1732,7 +1732,7 @@ class BadCountsConstraint extends RegexConstraint { private static List getMatchesList(int foundCount, String[] matches, List strings) { List matchesList = new ArrayList<>(); - matchesList.add("but found " + foundCount); + matchesList.add("Failed comparison: [found] " + foundCount); if (matches != null) { matchesList.addAll(strings); } diff --git a/test/hotspot/jtreg/testlibrary_tests/ir_framework/tests/TestRunTests.java b/test/hotspot/jtreg/testlibrary_tests/ir_framework/tests/TestRunTests.java index 780075f50dd..d2c83edde7e 100644 --- a/test/hotspot/jtreg/testlibrary_tests/ir_framework/tests/TestRunTests.java +++ b/test/hotspot/jtreg/testlibrary_tests/ir_framework/tests/TestRunTests.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,7 +24,7 @@ package ir_framework.tests; import compiler.lib.ir_framework.*; -import compiler.lib.ir_framework.driver.IRViolationException; +import compiler.lib.ir_framework.driver.irmatching.IRViolationException; import compiler.lib.ir_framework.shared.TestRunException; import jdk.test.lib.Asserts; diff --git a/test/hotspot/jtreg/testlibrary_tests/ir_framework/tests/Utils.java b/test/hotspot/jtreg/testlibrary_tests/ir_framework/tests/Utils.java index 2b4e76a6805..10c10473457 100644 --- a/test/hotspot/jtreg/testlibrary_tests/ir_framework/tests/Utils.java +++ b/test/hotspot/jtreg/testlibrary_tests/ir_framework/tests/Utils.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,7 @@ package ir_framework.tests; import compiler.lib.ir_framework.Scenario; -import compiler.lib.ir_framework.driver.IRMatcher; -import compiler.lib.ir_framework.driver.TestVMProcess; +import compiler.lib.ir_framework.driver.irmatching.IRMatcher; import jdk.test.lib.Asserts; import java.util.Arrays; -- GitLab From b1f935c1d0d3729470b57832cf74c43d49ea1f71 Mon Sep 17 00:00:00 2001 From: Tobias Holenstein Date: Thu, 3 Mar 2022 07:59:45 +0000 Subject: [PATCH 132/340] 8277055: Assert "missing inlining msg" with -XX:+PrintIntrinsics Reviewed-by: roland, thartmann --- src/hotspot/share/opto/callGenerator.cpp | 8 ++++++++ test/hotspot/jtreg/compiler/print/PrintInlining.java | 9 ++++++--- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/hotspot/share/opto/callGenerator.cpp b/src/hotspot/share/opto/callGenerator.cpp index 9931f256298..7819965f57d 100644 --- a/src/hotspot/share/opto/callGenerator.cpp +++ b/src/hotspot/share/opto/callGenerator.cpp @@ -526,12 +526,20 @@ bool LateInlineVirtualCallGenerator::do_late_inline_check(Compile* C, JVMState* Node* receiver = jvms->map()->argument(jvms, 0); const Type* recv_type = C->initial_gvn()->type(receiver); if (recv_type->maybe_null()) { + if (C->print_inlining() || C->print_intrinsics()) { + C->print_inlining(method(), jvms->depth()-1, call_node()->jvms()->bci(), + "late call devirtualization failed (receiver may be null)"); + } return false; } // Even if inlining is not allowed, a virtual call can be strength-reduced to a direct call. bool allow_inline = C->inlining_incrementally(); if (!allow_inline && _callee->holder()->is_interface()) { // Don't convert the interface call to a direct call guarded by an interface subtype check. + if (C->print_inlining() || C->print_intrinsics()) { + C->print_inlining(method(), jvms->depth()-1, call_node()->jvms()->bci(), + "late call devirtualization failed (interface call)"); + } return false; } CallGenerator* cg = C->call_generator(_callee, diff --git a/test/hotspot/jtreg/compiler/print/PrintInlining.java b/test/hotspot/jtreg/compiler/print/PrintInlining.java index deb1ae0aae0..4b45a32949f 100644 --- a/test/hotspot/jtreg/compiler/print/PrintInlining.java +++ b/test/hotspot/jtreg/compiler/print/PrintInlining.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2022, 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,11 +23,14 @@ /* * @test - * @bug 8022585 + * @bug 8022585 8277055 * @summary VM crashes when ran with -XX:+PrintInlining * @run main/othervm -Xcomp -XX:+UnlockDiagnosticVMOptions -XX:+PrintInlining * compiler.print.PrintInlining - * + * @run main/othervm -Xcomp -XX:-TieredCompilation -XX:+UnlockDiagnosticVMOptions -XX:+PrintInlining + * compiler.print.PrintInlining + * @run main/othervm -Xcomp -XX:-TieredCompilation -XX:+UnlockDiagnosticVMOptions -XX:+PrintIntrinsics + * compiler.print.PrintInlining */ package compiler.print; -- GitLab From d4d1fbc27a2382d8d9545b7bf672cdcc81654404 Mon Sep 17 00:00:00 2001 From: Thomas Schatzl Date: Thu, 3 Mar 2022 09:26:41 +0000 Subject: [PATCH 133/340] 8282484: G1: Predicted old time in log always zero Reviewed-by: ayang, iwalulya --- src/hotspot/share/gc/g1/g1Policy.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/hotspot/share/gc/g1/g1Policy.cpp b/src/hotspot/share/gc/g1/g1Policy.cpp index d41ffcbee7b..6de90942ff5 100644 --- a/src/hotspot/share/gc/g1/g1Policy.cpp +++ b/src/hotspot/share/gc/g1/g1Policy.cpp @@ -1313,7 +1313,6 @@ void G1Policy::calculate_old_collection_set_regions(G1CollectionSetCandidates* c num_optional_regions = 0; uint num_expensive_regions = 0; - double predicted_old_time_ms = 0.0; double predicted_initial_time_ms = 0.0; double predicted_optional_time_ms = 0.0; @@ -1344,7 +1343,7 @@ void G1Policy::calculate_old_collection_set_regions(G1CollectionSetCandidates* c time_remaining_ms = MAX2(time_remaining_ms - predicted_time_ms, 0.0); // Add regions to old set until we reach the minimum amount if (num_initial_regions < min_old_cset_length) { - predicted_old_time_ms += predicted_time_ms; + predicted_initial_time_ms += predicted_time_ms; num_initial_regions++; // Record the number of regions added with no time remaining if (time_remaining_ms == 0.0) { @@ -1358,7 +1357,7 @@ void G1Policy::calculate_old_collection_set_regions(G1CollectionSetCandidates* c } else { // Keep adding regions to old set until we reach the optional threshold if (time_remaining_ms > optional_threshold_ms) { - predicted_old_time_ms += predicted_time_ms; + predicted_initial_time_ms += predicted_time_ms; num_initial_regions++; } else if (time_remaining_ms > 0) { // Keep adding optional regions until time is up. @@ -1382,7 +1381,7 @@ void G1Policy::calculate_old_collection_set_regions(G1CollectionSetCandidates* c } log_debug(gc, ergo, cset)("Finish choosing collection set old regions. Initial: %u, optional: %u, " - "predicted old time: %1.2fms, predicted optional time: %1.2fms, time remaining: %1.2f", + "predicted initial time: %1.2fms, predicted optional time: %1.2fms, time remaining: %1.2f", num_initial_regions, num_optional_regions, predicted_initial_time_ms, predicted_optional_time_ms, time_remaining_ms); } -- GitLab From 0402a288f309d589d1dc8860e95e4ed42a1ef9f4 Mon Sep 17 00:00:00 2001 From: Prasanta Sadhukhan Date: Thu, 3 Mar 2022 09:51:08 +0000 Subject: [PATCH 134/340] 8037965: NullPointerException in TextLayout.getBaselineFromGraphic() for JTextComponents Reviewed-by: prr, aivanov --- .../classes/java/awt/font/TextLayout.java | 3 ++ .../swing/JTextField/SwingUnicodeTest.java | 38 +++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 test/jdk/javax/swing/JTextField/SwingUnicodeTest.java diff --git a/src/java.desktop/share/classes/java/awt/font/TextLayout.java b/src/java.desktop/share/classes/java/awt/font/TextLayout.java index 1793bc73a48..ddc5199b843 100644 --- a/src/java.desktop/share/classes/java/awt/font/TextLayout.java +++ b/src/java.desktop/share/classes/java/awt/font/TextLayout.java @@ -2638,6 +2638,9 @@ public final class TextLayout implements Cloneable { static byte getBaselineFromGraphic(GraphicAttribute graphic) { + if (graphic == null) { + return (byte)GraphicAttribute.ROMAN_BASELINE; + } byte alignment = (byte) graphic.getAlignment(); if (alignment == GraphicAttribute.BOTTOM_ALIGNMENT || diff --git a/test/jdk/javax/swing/JTextField/SwingUnicodeTest.java b/test/jdk/javax/swing/JTextField/SwingUnicodeTest.java new file mode 100644 index 00000000000..94053602de5 --- /dev/null +++ b/test/jdk/javax/swing/JTextField/SwingUnicodeTest.java @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +import javax.swing.SwingUtilities; +import javax.swing.JTextField; + +/* + * @test + * @bug 8037965 + * @summary Verifies NPE in TextLayout.getBaselineFromGraphic() for invalid + * Unicode characters + */ +public class SwingUnicodeTest { + public static void main(String[] args) throws Exception { + SwingUtilities.invokeAndWait(() -> + new JTextField(new StringBuilder().appendCodePoint(0xFFFF). + appendCodePoint(0x10000).toString())); + } +} -- GitLab From 832729b41e690d6f05da71997bbe2a74b2d6dada Mon Sep 17 00:00:00 2001 From: Prasanta Sadhukhan Date: Thu, 3 Mar 2022 09:53:14 +0000 Subject: [PATCH 135/340] 6911375: mouseWheel has no effect without vertical scrollbar Reviewed-by: aivanov --- .../swing/plaf/basic/BasicScrollPaneUI.java | 13 +- .../JScrollPane/TestMouseWheelScroll.java | 127 ++++++++++++++++++ 2 files changed, 137 insertions(+), 3 deletions(-) create mode 100644 test/jdk/javax/swing/JScrollPane/TestMouseWheelScroll.java diff --git a/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicScrollPaneUI.java b/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicScrollPaneUI.java index e017ac6722b..188e1dca581 100644 --- a/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicScrollPaneUI.java +++ b/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicScrollPaneUI.java @@ -1006,11 +1006,18 @@ public class BasicScrollPaneUI // find which scrollbar to scroll, or return if none if (toScroll == null || !toScroll.isVisible() || e.isShiftDown()) { - toScroll = scrollpane.getHorizontalScrollBar(); - if (toScroll == null || !toScroll.isVisible()) { + JScrollBar hScroll = scrollpane.getHorizontalScrollBar(); + if (hScroll == null) { return; + } else if (hScroll.isVisible()) { + toScroll = hScroll; + orientation = SwingConstants.HORIZONTAL; + } else if (!hScroll.isVisible()) { + if (e.isShiftDown()) { + return; + } + orientation = SwingConstants.VERTICAL; } - orientation = SwingConstants.HORIZONTAL; } e.consume(); diff --git a/test/jdk/javax/swing/JScrollPane/TestMouseWheelScroll.java b/test/jdk/javax/swing/JScrollPane/TestMouseWheelScroll.java new file mode 100644 index 00000000000..180a697a3f3 --- /dev/null +++ b/test/jdk/javax/swing/JScrollPane/TestMouseWheelScroll.java @@ -0,0 +1,127 @@ +/* + * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +import java.awt.Point; +import java.awt.Robot; +import java.awt.event.InputEvent; +import javax.swing.DefaultListModel; +import javax.swing.ListModel; +import javax.swing.JScrollPane; +import javax.swing.JFrame; +import javax.swing.JList; +import javax.swing.SwingUtilities; +import javax.swing.UIManager; +import javax.swing.UnsupportedLookAndFeelException; + +/* + * @test + * @key headful + * @requires (os.family != "mac") + * @bug 6911375 + * @summary Verifies mouseWheel effect on JList without scrollBar + */ +public class TestMouseWheelScroll { + + static JFrame frame; + static JScrollPane scrollPane; + static volatile Point p; + static volatile int width; + static volatile int height; + static volatile Point viewPosition; + static volatile Point newPosition; + + private static void setLookAndFeel(UIManager.LookAndFeelInfo laf) { + try { + UIManager.setLookAndFeel(laf.getClassName()); + } catch (UnsupportedLookAndFeelException ignored) { + System.out.println("Unsupported L&F: " + laf.getClassName()); + } catch (ClassNotFoundException | InstantiationException + | IllegalAccessException e) { + throw new RuntimeException(e); + } + } + + public static void main(String[] args) throws Exception { + + for (UIManager.LookAndFeelInfo laf : UIManager.getInstalledLookAndFeels()) { + System.out.println("Testing L&F: " + laf.getClassName()); + SwingUtilities.invokeAndWait(() -> setLookAndFeel(laf)); + Robot robot = new Robot(); + robot.setAutoDelay(100); + + try { + SwingUtilities.invokeAndWait(() -> { + frame = new JFrame(); + JList list = new JList(createListModel()); + // disable list bindings + list.getInputMap().getParent().clear(); + scrollPane = new JScrollPane(list); + + scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_NEVER); + frame.add(scrollPane); + frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); + frame.setSize(200,200); + frame.setLocationRelativeTo(null); + frame.setVisible(true); + }); + robot.waitForIdle(); + robot.delay(1000); + SwingUtilities.invokeAndWait(() -> { + p = frame.getLocationOnScreen(); + width = frame.getWidth(); + height = frame.getHeight(); + }); + robot.mouseMove(p.x + width / 2, p.y + height / 2); + robot.mousePress(InputEvent.BUTTON1_DOWN_MASK); + robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); + robot.waitForIdle(); + SwingUtilities.invokeAndWait(() -> { + viewPosition = scrollPane.getViewport().getViewPosition(); + }); + robot.delay(1000); + robot.mouseWheel(1); + robot.delay(500); + SwingUtilities.invokeAndWait(() -> { + newPosition = scrollPane.getViewport().getViewPosition(); + }); + robot.delay(1000); + if (newPosition.equals(viewPosition)) { + throw new RuntimeException("Mouse wheel not handled"); + } + } finally { + SwingUtilities.invokeAndWait(() -> { + if (frame != null) { + frame.dispose(); + } + }); + } + } + } + + private static ListModel createListModel() { + DefaultListModel model = new DefaultListModel(); + for (int i = 0; i < 100; i++) { + model.addElement("element " + i); + } + return model; + } +} -- GitLab From 7822cbce10e0c0c6f9bf521faebc89a0af20734e Mon Sep 17 00:00:00 2001 From: Coleen Phillimore Date: Thu, 3 Mar 2022 13:20:58 +0000 Subject: [PATCH 136/340] 8276711: compiler/codecache/cli tests failing when SegmentedCodeCache used with -Xint Reviewed-by: kvn, dholmes --- src/hotspot/share/code/codeCache.cpp | 2 +- .../share/compiler/compilerDefinitions.cpp | 7 +++++-- .../cli/TestSegmentedCodeCacheOption.java | 18 +++++++----------- .../codeheapsize/TestCodeHeapSizeOptions.java | 8 +------- .../cli/common/CodeCacheCLITestCase.java | 10 +++++----- 5 files changed, 19 insertions(+), 26 deletions(-) diff --git a/src/hotspot/share/code/codeCache.cpp b/src/hotspot/share/code/codeCache.cpp index a8e9e2fb42b..0c1a579ea34 100644 --- a/src/hotspot/share/code/codeCache.cpp +++ b/src/hotspot/share/code/codeCache.cpp @@ -368,7 +368,7 @@ bool CodeCache::heap_available(int code_blob_type) { if (!SegmentedCodeCache) { // No segmentation: use a single code heap return (code_blob_type == CodeBlobType::All); - } else if (Arguments::is_interpreter_only()) { + } else if (CompilerConfig::is_interpreter_only()) { // Interpreter only: we don't need any method code heaps return (code_blob_type == CodeBlobType::NonNMethod); } else if (CompilerConfig::is_c1_profiling()) { diff --git a/src/hotspot/share/compiler/compilerDefinitions.cpp b/src/hotspot/share/compiler/compilerDefinitions.cpp index a6445c161b2..aa8dd0a1be8 100644 --- a/src/hotspot/share/compiler/compilerDefinitions.cpp +++ b/src/hotspot/share/compiler/compilerDefinitions.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2022, 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 @@ -310,7 +310,6 @@ void CompilerConfig::set_compilation_policy_flags() { } } - if (CompileThresholdScaling < 0) { vm_exit_during_initialization("Negative value specified for CompileThresholdScaling", NULL); } @@ -509,6 +508,10 @@ bool CompilerConfig::check_args_consistency(bool status) { } FLAG_SET_CMDLINE(TieredCompilation, false); } + if (SegmentedCodeCache) { + warning("SegmentedCodeCache has no meaningful effect with -Xint"); + FLAG_SET_DEFAULT(SegmentedCodeCache, false); + } #if INCLUDE_JVMCI if (EnableJVMCI) { if (!FLAG_IS_DEFAULT(EnableJVMCI) || !FLAG_IS_DEFAULT(UseJVMCICompiler)) { diff --git a/test/hotspot/jtreg/compiler/codecache/cli/TestSegmentedCodeCacheOption.java b/test/hotspot/jtreg/compiler/codecache/cli/TestSegmentedCodeCacheOption.java index 294dc28f84a..49fa9b013ef 100644 --- a/test/hotspot/jtreg/compiler/codecache/cli/TestSegmentedCodeCacheOption.java +++ b/test/hotspot/jtreg/compiler/codecache/cli/TestSegmentedCodeCacheOption.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2022, 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 @@ -56,6 +56,9 @@ public class TestSegmentedCodeCacheOption { private static final String[] UNEXPECTED_MESSAGES = new String[] { ".*" + SEGMENTED_CODE_CACHE + ".*" }; + private static final String[] XINT_EXPECTED_MESSAGE = new String[] { + "SegmentedCodeCache has no meaningful effect with -Xint" + }; private static enum TestCase { @@ -86,10 +89,11 @@ public class TestSegmentedCodeCacheOption { // ... and even w/ Xint. testCaseExitCodeMessage = "It should be possible to use " + USE_SEGMENTED_CODE_CACHE + " in interpreted mode " - + "without any errors."; + + "but it produces a warning that it is ignored."; CommandLineOptionTest.verifyJVMStartup( - /* expected messages */ null, UNEXPECTED_MESSAGES, + XINT_EXPECTED_MESSAGE, + /* unexpected messages */ null, testCaseExitCodeMessage, testCaseWarningMessage, ExitCode.OK, false, INT_MODE, USE_SEGMENTED_CODE_CACHE); } @@ -117,14 +121,6 @@ public class TestSegmentedCodeCacheOption { CommandLineOptionTest.prepareNumericFlag( BlobType.All.sizeOptionName, BELOW_THRESHOLD_CC_SIZE)); - // SCC could be explicitly enabled w/ Xint - errorMessage = String.format("It should be possible to " - + "explicitly enable %s in interpreted mode.", - SEGMENTED_CODE_CACHE); - - CommandLineOptionTest.verifyOptionValue(SEGMENTED_CODE_CACHE, - "true", errorMessage, false, INT_MODE, - USE_SEGMENTED_CODE_CACHE); // SCC could be explicitly enabled w/o TieredCompilation and w/ // small ReservedCodeCacheSize value errorMessage = String.format("It should be possible to " diff --git a/test/hotspot/jtreg/compiler/codecache/cli/codeheapsize/TestCodeHeapSizeOptions.java b/test/hotspot/jtreg/compiler/codecache/cli/codeheapsize/TestCodeHeapSizeOptions.java index 9d27c90cfaa..52cf28a196b 100644 --- a/test/hotspot/jtreg/compiler/codecache/cli/codeheapsize/TestCodeHeapSizeOptions.java +++ b/test/hotspot/jtreg/compiler/codecache/cli/codeheapsize/TestCodeHeapSizeOptions.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2022, 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 @@ -63,15 +63,9 @@ public class TestCodeHeapSizeOptions extends CodeCacheCLITestBase { private TestCodeHeapSizeOptions() { super(CodeCacheCLITestBase.OPTIONS_SET, - new CodeCacheCLITestCase(CodeCacheCLITestCase - .CommonDescriptions.INT_MODE.description, - GENERIC_RUNNER), new CodeCacheCLITestCase(CodeCacheCLITestCase .CommonDescriptions.NON_TIERED.description, GENERIC_RUNNER), - new CodeCacheCLITestCase(CodeCacheCLITestCase - .CommonDescriptions.TIERED_LEVEL_0.description, - GENERIC_RUNNER), new CodeCacheCLITestCase(CodeCacheCLITestCase .CommonDescriptions.TIERED_LEVEL_1.description, GENERIC_RUNNER), diff --git a/test/hotspot/jtreg/compiler/codecache/cli/common/CodeCacheCLITestCase.java b/test/hotspot/jtreg/compiler/codecache/cli/common/CodeCacheCLITestCase.java index 1c28a1feac8..91736ca1442 100644 --- a/test/hotspot/jtreg/compiler/codecache/cli/common/CodeCacheCLITestCase.java +++ b/test/hotspot/jtreg/compiler/codecache/cli/common/CodeCacheCLITestCase.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2022, 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 @@ -66,9 +66,9 @@ public class CodeCacheCLITestCase { public enum CommonDescriptions { /** * Verifies that in interpreted mode PrintCodeCache output contains - * only NonNMethod code heap. + * the whole code cache. Int mode disables SegmentedCodeCache with a warning. */ - INT_MODE(ONLY_SEGMENTED, EnumSet.of(BlobType.NonNMethod), USE_INT_MODE), + INT_MODE(ONLY_SEGMENTED, EnumSet.of(BlobType.All), USE_INT_MODE), /** * Verifies that with disabled SegmentedCodeCache PrintCodeCache output * contains only CodeCache's entry. @@ -87,11 +87,11 @@ public class CodeCacheCLITestCase { false)), /** * Verifies that with TieredStopAtLevel=0 PrintCodeCache output will - * contain information about non-nmethods and non-profiled nmethods + * warn about SegmentedCodeCache and contain information about all * heaps only. */ TIERED_LEVEL_0(SEGMENTED_SERVER, - EnumSet.of(BlobType.NonNMethod, BlobType.MethodNonProfiled), + EnumSet.of(BlobType.All), CommandLineOptionTest.prepareBooleanFlag(TIERED_COMPILATION, true), CommandLineOptionTest.prepareNumericFlag(TIERED_STOP_AT, 0)), -- GitLab From 5c187e34a58769a129a0aae9e4937907c9060202 Mon Sep 17 00:00:00 2001 From: Thomas Stuefe Date: Thu, 3 Mar 2022 13:25:10 +0000 Subject: [PATCH 137/340] 8282593: JDK-8281472 breaks 32-bit builds and gtests Reviewed-by: jiefu, dholmes --- test/hotspot/gtest/runtime/test_largeOptions.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/test/hotspot/gtest/runtime/test_largeOptions.cpp b/test/hotspot/gtest/runtime/test_largeOptions.cpp index 6c9ff3ffcfc..a8d5af24915 100644 --- a/test/hotspot/gtest/runtime/test_largeOptions.cpp +++ b/test/hotspot/gtest/runtime/test_largeOptions.cpp @@ -43,7 +43,7 @@ public: } }; - +#ifdef _LP64 // CompilerDirectivesLimit is a diagnostic int option. TEST_VM(LARGE_OPTION, large_ints) { for (intx x = max_jint - 1; x <= (intx)max_jint + 1; x++) { @@ -57,7 +57,6 @@ TEST_VM(LARGE_OPTION, large_ints) { } } - TEST_VM(LARGE_OPTION, small_ints) { for (intx x = min_jint + 1; x >= (intx)min_jint - 1; x--) { bool result = LargeOptionsTest::test_option_value("CompilerDirectivesLimit", x); @@ -70,11 +69,10 @@ TEST_VM(LARGE_OPTION, small_ints) { } } - TEST_VM(LARGE_OPTION, large_int_overflow) { // Test 0x100000000 ASSERT_FALSE(LargeOptionsTest::test_option_value("CompilerDirectivesLimit", 4294967296)); } - +#endif // HandshakeTimeout is a diagnostic uint option. TEST_VM(LARGE_OPTION, large_uints) { @@ -89,7 +87,7 @@ TEST_VM(LARGE_OPTION, large_uints) { } } - +#ifdef _LP64 // MaxJNILocalCapacity is an intx option. TEST_VM(LARGE_OPTION, large_intxs) { // max_intx + 1 equals min_intx! @@ -99,7 +97,6 @@ TEST_VM(LARGE_OPTION, large_intxs) { } } - TEST_VM(LARGE_OPTION, small_intxs) { ASSERT_TRUE(LargeOptionsTest::test_option_value("MaxJNILocalCapacity", min_intx + 1)); ASSERT_EQ(MaxJNILocalCapacity, -9223372036854775807); @@ -108,3 +105,4 @@ TEST_VM(LARGE_OPTION, small_intxs) { // Test value that's less than min_intx (-0x8000000000000001). ASSERT_FALSE(LargeOptionsTest::test_option_value("MaxJNILocalCapacity=-9223372036854775809")); } +#endif -- GitLab From 57020fd5822148b02e72b60b462a7402658d979a Mon Sep 17 00:00:00 2001 From: Jonathan Gibbons Date: Thu, 3 Mar 2022 14:54:02 +0000 Subject: [PATCH 138/340] 8282582: Unused methods in Utils Reviewed-by: prappo --- .../internal/doclets/toolkit/util/Utils.java | 280 ------------------ 1 file changed, 280 deletions(-) diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Utils.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Utils.java index f6939eaafd7..12db421eaf4 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Utils.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Utils.java @@ -184,14 +184,6 @@ public class Utils { return getSymbol("java.io.Externalizable"); } - public TypeMirror getIllegalArgumentExceptionType() { - return getSymbol("java.lang.IllegalArgumentException"); - } - - public TypeMirror getNullPointerExceptionType() { - return getSymbol("java.lang.NullPointerException"); - } - public TypeMirror getDeprecatedType() { return getSymbol("java.lang.Deprecated"); } @@ -200,22 +192,6 @@ public class Utils { return getSymbol("java.lang.FunctionalInterface"); } - /** - * Return array of class members whose documentation is to be generated. - * If the member is deprecated do not include such a member in the - * returned array. - * - * @param members Array of members to choose from. - * @return List List of eligible members for whom - * documentation is getting generated. - */ - public List excludeDeprecatedMembers(List members) { - return members.stream() - .filter(member -> !isDeprecated(member)) - .sorted(comparators.makeGeneralPurposeComparator()) - .collect(Collectors.toCollection(ArrayList::new)); - } - /** * Search for the given method in the given class. * @@ -309,10 +285,6 @@ public class Utils { return !e.getAnnotationMirrors().isEmpty(); } - public boolean isAnnotated(Element e) { - return !e.getAnnotationMirrors().isEmpty(); - } - public boolean isAnnotationType(Element e) { return new SimpleElementVisitor14() { @Override @@ -350,10 +322,6 @@ public class Utils { return e.getKind() == ENUM; } - boolean isEnumConstant(Element e) { - return e.getKind() == ENUM_CONSTANT; - } - public boolean isField(Element e) { return e.getKind() == FIELD; } @@ -500,28 +468,6 @@ public class Utils { return typeUtils.isSubtype(te.asType(), getThrowableType()); } - public boolean isPrimitive(TypeMirror t) { - return new SimpleTypeVisitor14() { - - @Override - public Boolean visitNoType(NoType t, Void p) { - return t.getKind() == VOID; - } - @Override - public Boolean visitPrimitive(PrimitiveType t, Void p) { - return true; - } - @Override - public Boolean visitArray(ArrayType t, Void p) { - return visit(t.getComponentType()); - } - @Override - protected Boolean defaultAction(TypeMirror e, Void p) { - return false; - } - }.visit(t); - } - public boolean isExecutableElement(Element e) { return switch (e.getKind()) { case CONSTRUCTOR, METHOD, INSTANCE_INIT -> true; @@ -673,14 +619,6 @@ public class Utils { return t.getKind() == DECLARED; } - public boolean isErrorType(TypeMirror t) { - return t.getKind() == ERROR; - } - - public boolean isIntersectionType(TypeMirror t) { - return t.getKind() == INTERSECTION; - } - public boolean isTypeParameterElement(Element e) { return e.getKind() == TYPE_PARAMETER; } @@ -693,10 +631,6 @@ public class Utils { return t.getKind() == VOID; } - public boolean isWildCard(TypeMirror t) { - return t.getKind() == WILDCARD; - } - public boolean ignoreBounds(TypeMirror bound) { return typeUtils.isSameType(bound, getObjectType()) && !isAnnotated(bound); } @@ -789,20 +723,6 @@ public class Utils { return getType(t); } - /** - * Return the class that originally defined the method that - * is overridden by the current definition, or null if no - * such class exists. - * - * @return a TypeElement representing the superclass that - * originally defined this method, or null if this method does - * not override a definition in a superclass. - */ - public TypeElement overriddenClass(ExecutableElement ee) { - TypeMirror type = overriddenType(ee); - return (type != null) ? asTypeElement(type) : null; - } - public ExecutableElement overriddenMethod(ExecutableElement method) { if (isStatic(method)) { return null; @@ -985,13 +905,6 @@ public class Utils { return searchResult; } - /** - * Enclose in quotes, used for paths and filenames that contains spaces - */ - public String quote(String filepath) { - return ("\"" + filepath + "\""); - } - /** * Parse the package name. We only want to display package name up to * 2 levels. @@ -1558,19 +1471,6 @@ public class Utils { return compareStrings(true, s1, s2); } - /** - * A general purpose case sensitive String comparator, which - * compares two Strings using a Collator strength of "SECONDARY". - * - * @param s1 first String to compare. - * @param s2 second String to compare. - * @return a negative integer, zero, or a positive integer as the first - * argument is less than, equal to, or greater than the second. - */ - public int compareCaseCompare(String s1, String s2) { - return compareStrings(false, s1, s2); - } - private DocCollator tertiaryCollator = null; private DocCollator secondaryCollator = null; @@ -1762,26 +1662,6 @@ public class Utils { } - /** - * Returns the documented annotation interfaces in a package. - * - * @param pkg the package - * @return the annotation interfaces - */ - public List getAnnotationTypes(PackageElement pkg) { - return getDocumentedItems(pkg, ANNOTATION_TYPE, TypeElement.class); - } - - /** - * Returns the documented record classes in a package. - * - * @param pkg the package - * @return the record classes - */ - public List getRecords(PackageElement pkg) { - return getDocumentedItems(pkg, RECORD, TypeElement.class); - } - /** * Returns the documented fields in a type element. * @@ -1834,13 +1714,6 @@ public class Utils { return getDocumentedItems(te, METHOD, ExecutableElement.class); } - public int getOrdinalValue(VariableElement member) { - if (member == null || member.getKind() != ENUM_CONSTANT) { - throw new IllegalArgumentException("must be an enum constant: " + member); - } - return member.getEnclosingElement().getEnclosedElements().indexOf(member); - } - private Map> modulePackageMap = null; public Map> getModulePackageMap() { if (modulePackageMap == null) { @@ -1912,16 +1785,6 @@ public class Utils { return lineMap.getLineNumber(pos); } - /** - * Returns the documented interfaces in a package. - * - * @param pkg the package - * @return the interfaces - */ - public List getInterfaces(PackageElement pkg) { - return getDocumentedItems(pkg, INTERFACE, TypeElement.class); - } - /** * Returns the documented enum constants in a type element. * @@ -1932,16 +1795,6 @@ public class Utils { return getDocumentedItems(te, ENUM_CONSTANT, VariableElement.class); } - /** - * Returns the documented enum classes in a package. - * - * @param pkg the package - * @return the interfaces - */ - public List getEnums(PackageElement pkg) { - return getDocumentedItems(pkg, ENUM, TypeElement.class); - } - /** * Returns all the classes in a package. * @@ -2343,102 +2196,6 @@ public class Utils { return mdle.getQualifiedName().toString(); } - public boolean isAttribute(DocTree doctree) { - return isKind(doctree, ATTRIBUTE); - } - - public boolean isAuthor(DocTree doctree) { - return isKind(doctree, AUTHOR); - } - - public boolean isComment(DocTree doctree) { - return isKind(doctree, COMMENT); - } - - public boolean isDeprecated(DocTree doctree) { - return isKind(doctree, DEPRECATED); - } - - public boolean isDocComment(DocTree doctree) { - return isKind(doctree, DOC_COMMENT); - } - - public boolean isDocRoot(DocTree doctree) { - return isKind(doctree, DOC_ROOT); - } - - public boolean isEndElement(DocTree doctree) { - return isKind(doctree, END_ELEMENT); - } - - public boolean isEntity(DocTree doctree) { - return isKind(doctree, ENTITY); - } - - public boolean isErroneous(DocTree doctree) { - return isKind(doctree, ERRONEOUS); - } - - public boolean isException(DocTree doctree) { - return isKind(doctree, EXCEPTION); - } - - public boolean isIdentifier(DocTree doctree) { - return isKind(doctree, IDENTIFIER); - } - - public boolean isInheritDoc(DocTree doctree) { - return isKind(doctree, INHERIT_DOC); - } - - public boolean isLink(DocTree doctree) { - return isKind(doctree, LINK); - } - - public boolean isLinkPlain(DocTree doctree) { - return isKind(doctree, LINK_PLAIN); - } - - public boolean isLiteral(DocTree doctree) { - return isKind(doctree, LITERAL); - } - - public boolean isOther(DocTree doctree) { - return doctree.getKind() == DocTree.Kind.OTHER; - } - - public boolean isParam(DocTree doctree) { - return isKind(doctree, PARAM); - } - - public boolean isReference(DocTree doctree) { - return isKind(doctree, REFERENCE); - } - - public boolean isReturn(DocTree doctree) { - return isKind(doctree, RETURN); - } - - public boolean isSee(DocTree doctree) { - return isKind(doctree, SEE); - } - - public boolean isSerial(DocTree doctree) { - return isKind(doctree, SERIAL); - } - - public boolean isSerialData(DocTree doctree) { - return isKind(doctree, SERIAL_DATA); - } - - public boolean isSerialField(DocTree doctree) { - return isKind(doctree, SERIAL_FIELD); - } - - public boolean isSince(DocTree doctree) { - return isKind(doctree, SINCE); - } - public boolean isStartElement(DocTree doctree) { return isKind(doctree, START_ELEMENT); } @@ -2447,26 +2204,6 @@ public class Utils { return isKind(doctree, TEXT); } - public boolean isThrows(DocTree doctree) { - return isKind(doctree, THROWS); - } - - public boolean isUnknownBlockTag(DocTree doctree) { - return isKind(doctree, UNKNOWN_BLOCK_TAG); - } - - public boolean isUnknownInlineTag(DocTree doctree) { - return isKind(doctree, UNKNOWN_INLINE_TAG); - } - - public boolean isValue(DocTree doctree) { - return isKind(doctree, VALUE); - } - - public boolean isVersion(DocTree doctree) { - return isKind(doctree, VERSION); - } - private boolean isKind(DocTree doctree, DocTree.Kind match) { return doctree.getKind() == match; } @@ -2512,10 +2249,6 @@ public class Utils { return getBlockTags(element, t -> t.getKind() == kind, tClass); } - public List getBlockTags(Element element, DocTree.Kind kind, DocTree.Kind altKind) { - return getBlockTags(element, t -> t.getKind() == kind || t.getKind() == altKind); - } - public List getBlockTags(Element element, Taglet taglet) { return getBlockTags(element, t -> { if (taglet instanceof BaseTaglet baseTaglet) { @@ -2791,19 +2524,6 @@ public class Utils { return elementUtils.getPackageOf(e); } - public TypeElement getTopMostContainingTypeElement(Element e) { - if (isPackage(e)) { - return null; - } - TypeElement outer = getEnclosingTypeElement(e); - if (outer == null) - return (TypeElement)e; - while (outer != null && outer.getNestingKind().isNested()) { - outer = getEnclosingTypeElement(outer); - } - return outer; - } - /** * A memory-sensitive cache for {@link CommentHelper} objects, * which are expensive to compute. -- GitLab From 080baffa6e0b27dbbf169d6c68980351aa484b8e Mon Sep 17 00:00:00 2001 From: Pavel Rappo Date: Thu, 3 Mar 2022 16:10:18 +0000 Subject: [PATCH 139/340] 8282483: Ensure that Utils.getAllInterfaces returns unique instances Reviewed-by: jjg --- .../internal/doclets/toolkit/util/Utils.java | 46 +++++++++++++++++-- 1 file changed, 42 insertions(+), 4 deletions(-) diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Utils.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Utils.java index 12db421eaf4..21f16a01c5c 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Utils.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Utils.java @@ -825,21 +825,59 @@ public class Utils { */ public Set getAllInterfaces(TypeElement te) { Set results = new LinkedHashSet<>(); - addSuperInterfaces(te.asType(), results); + addSuperInterfaces(te.asType(), results, new HashSet<>()); + assert noSameTypes(results); return results; } - private void addSuperInterfaces(TypeMirror type, Set results) { + private boolean noSameTypes(Set results) { + for (TypeMirror t1 : results) { + for (TypeMirror t2 : results) { + if (t1 == t2) { + continue; + } + if (typeUtils.isSameType(t1, t2)) { + return false; + } + } + } + return true; + } + + /* + * Instances of TypeMirror should be compared using + * Types.isSameType. However, there's no hash function + * consistent with that method. This makes it problematic to + * store TypeMirror in a collection that relies on hashing. + * + * To work around that, along with accumulating the resulting set of type + * mirrors, we also maintain a set of elements that correspond to those + * type mirrors. Element provides strong equals and hashCode. We only add + * a type mirror into the result set if we don't already have an element + * that corresponds to this type mirror in the set of seen elements. + * + * Although this might seem wrong, as an instance of Element corresponds + * to multiple instances of TypeMirror (one-to-many), in an + * inheritance hierarchy the correspondence is effectively one-to-one. + * This is because it is NOT possible for a type to be a subtype + * of different generic invocations of the same supertype; e.g., + * + * interface X extends G, G + */ + private void addSuperInterfaces(TypeMirror type, Set results, Set visited) { TypeMirror superType = null; for (TypeMirror t : typeUtils.directSupertypes(type)) { if (typeUtils.isSameType(t, getObjectType())) continue; TypeElement e = asTypeElement(t); if (isInterface(e)) { + if (!visited.add(e)) { + continue; // seen it before + } if (isPublic(e) || isLinkable(e)) { results.add(t); } - addSuperInterfaces(t, results); + addSuperInterfaces(t, results, visited); } else { // there can be at most one superclass and it is not null assert superType == null && t != null : superType; @@ -849,7 +887,7 @@ public class Utils { } // Collect the super-interfaces of the supertype. if (superType != null) - addSuperInterfaces(superType, results); + addSuperInterfaces(superType, results, visited); } /** -- GitLab From c777bb3df3234faff24b92e55977c7f4ae750647 Mon Sep 17 00:00:00 2001 From: Thomas Schatzl Date: Thu, 3 Mar 2022 16:16:44 +0000 Subject: [PATCH 140/340] 8282619: G1: Fix indentation in G1CollectedHeap::mark_evac_failure_object Reviewed-by: ayang, iwalulya --- src/hotspot/share/gc/g1/g1CollectedHeap.inline.hpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/hotspot/share/gc/g1/g1CollectedHeap.inline.hpp b/src/hotspot/share/gc/g1/g1CollectedHeap.inline.hpp index 9cdf6c35432..af778e43b13 100644 --- a/src/hotspot/share/gc/g1/g1CollectedHeap.inline.hpp +++ b/src/hotspot/share/gc/g1/g1CollectedHeap.inline.hpp @@ -235,10 +235,10 @@ inline bool G1CollectedHeap::is_obj_dead_full(const oop obj) const { } inline void G1CollectedHeap::mark_evac_failure_object(const oop obj, uint worker_id) const { - // All objects failing evacuation are live. What we'll do is - // that we'll update the prev marking info so that they are - // all under PTAMS and explicitly marked. - _cm->par_mark_in_prev_bitmap(obj); + // All objects failing evacuation are live. What we'll do is + // that we'll update the prev marking info so that they are + // all under PTAMS and explicitly marked. + _cm->par_mark_in_prev_bitmap(obj); } inline void G1CollectedHeap::set_humongous_reclaim_candidate(uint region, bool value) { -- GitLab From 268fa693188b685de6289927ee5a1e99473a50f6 Mon Sep 17 00:00:00 2001 From: Xue-Lei Andrew Fan Date: Thu, 3 Mar 2022 19:20:16 +0000 Subject: [PATCH 141/340] 8282511: Use fixed certificate validation date in SSLExampleCert template Reviewed-by: rhalade --- .../net/ssl/ServerName/EndingDotHostname.java | 3 +- .../net/ssl/templates/SSLExampleCert.java | 394 ++++++++++-------- 2 files changed, 216 insertions(+), 181 deletions(-) diff --git a/test/jdk/javax/net/ssl/ServerName/EndingDotHostname.java b/test/jdk/javax/net/ssl/ServerName/EndingDotHostname.java index cac5147250f..bac110aa033 100644 --- a/test/jdk/javax/net/ssl/ServerName/EndingDotHostname.java +++ b/test/jdk/javax/net/ssl/ServerName/EndingDotHostname.java @@ -26,7 +26,8 @@ * @bug 8065422 * @summary Trailing dot in hostname causes TLS handshake to fail * @library /javax/net/ssl/templates - * @run main/othervm -Djdk.net.hosts.file=hostsForExample EndingDotHostname + * @run main/othervm --add-opens java.base/sun.security.ssl=ALL-UNNAMED + * -Djdk.net.hosts.file=hostsForExample EndingDotHostname */ import javax.net.ssl.*; diff --git a/test/jdk/javax/net/ssl/templates/SSLExampleCert.java b/test/jdk/javax/net/ssl/templates/SSLExampleCert.java index 657106a3d2d..0b82aed3b7b 100644 --- a/test/jdk/javax/net/ssl/templates/SSLExampleCert.java +++ b/test/jdk/javax/net/ssl/templates/SSLExampleCert.java @@ -21,42 +21,53 @@ * questions. */ -import javax.net.ssl.KeyManagerFactory; -import javax.net.ssl.SSLContext; -import javax.net.ssl.TrustManagerFactory; +import javax.net.ssl.*; import java.io.*; +import java.lang.reflect.Field; import java.net.InetAddress; import java.security.KeyFactory; import java.security.KeyStore; import java.security.PrivateKey; import java.security.cert.Certificate; import java.security.cert.CertificateFactory; +import java.security.cert.PKIXBuilderParameters; import java.security.spec.PKCS8EncodedKeySpec; +import java.text.DateFormat; +import java.text.SimpleDateFormat; import java.util.Base64; +import java.util.Date; -/* A template to use "www.example.com" as the server name. The caller should - set a virtual hosts file with System Property, "jdk.net.hosts.file". This - class will map the loopback address to "www.example.com", and write to - the specified hosts file. - - Commands used: - # Root CA - > openssl req -new -config openssl.cnf -out root-ca.csr -keyout private/root-ca.key -days 7300 -newkey rsa:2048 - > openssl ca -selfsign -config openssl.cnf -in root-ca.csr -out certs/root-ca.crt -extensions v3_ca - -keyfile private/root-ca.key -days 7300 - - # www.example.com - > openssl req -new -keyout private/example.key -out example.csr -days 7299 -newkey rsa:2048 - > openssl ca -config openssl.cnf -in example.csr -out certs/example.crt -extensions usr_cert - -keyfile private/root-ca.key -days 7299 - - # Client - > openssl req -new -keyout private/client.key -out client.csr -days 7299 -newkey rsa:2048 - > openssl ca -config openssl.cnf -in client.csr -out certs/client.crt -extensions usr_cert - -keyfile private/root-ca.key -days 7299 - - The key files should be in PKCS8 format: - > openssl pkcs8 -topk8 -inform PEM -outform pem -in private/example.key -out private/example-pkcs.key -nocrypt +/** + * A template to use "www.example.com" as the server name. The caller should + * set a virtual hosts file with System Property, "jdk.net.hosts.file". This + * class will map the loopback address to "www.example.com", and write to + * the specified hosts file. + * + * Commands used: + * # Root CA + * > openssl req -new -config openssl.cnf -out root-ca.csr \ + * -keyout private/root-ca.key -days 7300 -newkey rsa:2048 + * > openssl ca -selfsign -config openssl.cnf -in root-ca.csr \ + * -out certs/root-ca.crt -extensions v3_ca + * -keyfile private/root-ca.key -days 7300 + * + * # www.example.com + * > openssl req -new -keyout private/example.key \ + * -out example.csr -days 7299 -newkey rsa:2048 + * > openssl ca -config openssl.cnf -in example.csr \ + * -out certs/example.crt -extensions usr_cert + * -keyfile private/root-ca.key -days 7299 + * + * # Client + * > openssl req -new -keyout private/client.key \ + * -out client.csr -days 7299 -newkey rsa:2048 + * > openssl ca -config openssl.cnf -in client.csr \ + * -out certs/client.crt -extensions usr_cert + * -keyfile private/root-ca.key -days 7299 + * + * The key files should be in PKCS8 format: + * > openssl pkcs8 -topk8 -inform PEM -outform pem \ + * -in private/example.key -out private/example-pkcs.key -nocrypt */ public enum SSLExampleCert { // Version: 3 (0x2) @@ -71,60 +82,60 @@ public enum SSLExampleCert { // Public Key Algorithm: rsaEncryption // RSA Public-Key: (2048 bit) CA_RSA("RSA", - """ - -----BEGIN CERTIFICATE----- - MIIDtDCCApygAwIBAgICEAEwDQYJKoZIhvcNAQELBQAwQzELMAkGA1UEBhMCVVMx - EzARBgNVBAgTCkNhbGlmb3JuaWExEDAOBgNVBAoTB0V4YW1wbGUxDTALBgNVBAsT - BFRlc3QwHhcNMjIwMjI1MjAxMjA0WhcNNDIwMjIwMjAxMjA0WjBDMQswCQYDVQQG - EwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEQMA4GA1UEChMHRXhhbXBsZTENMAsG - A1UECxMEVGVzdDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKOGhEDj - lZ5R6o20kJdgrIRcY1he4qKLWQ4vU0thqAg4mEcKCZZn4/NL05UgJCFLwYaxMZZe - etb/WaTRvQpDDFh7AhsMR24m6zKKJVk9E/e/8ur7sGDIVq8hZOBTq85ZdxPj/zKW - wB1BR/RcY4DsGno1USlkV7TVeZc1qpJHTPImesevzH7zX8nhnFlf4TTQbpQt6RxU - cr+udWpMOyP9xMerIyp7jpPy79tIaGP2x7ryt2BB9FU4RwPk4DcdfOkmdS86md1c - GI9H5qM5rUzyqey0J8wMRLj+E0Vx0F1XELZeTtyulbIbhrBhu/KOXZG2zNIeK+2F - XxDlx9tD+bbcJfUCAwEAAaOBsTCBrjAdBgNVHQ4EFgQULjM9fwJnC3Tp1QYM8HNL - y60btl0wbAYDVR0jBGUwY4AULjM9fwJnC3Tp1QYM8HNLy60btl2hR6RFMEMxCzAJ - BgNVBAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlhMRAwDgYDVQQKEwdFeGFtcGxl - MQ0wCwYDVQQLEwRUZXN0ggIQATAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQE - AwIBBjANBgkqhkiG9w0BAQsFAAOCAQEAR0Mk+2X/rr4kYYfHsQUIsROwDZSQhQr3 - QOeLc7fyTjkM96OHXN2dKVoOcpzgKi1goHW7lh8vVmKRQk2wfFqRZV9/kQBFK/gz - QtN5gp+pA8Wk912Uj5gD0loiPcRf5bDElvLnr2iwt4VdKkvGIYa9Eu9CYbkf1x3t - ahVLmrZLBkqvKxo4MG4KGYXkqtII3M6clM4ScFa/0rR1nGZOgZyqG7AMMHc01csA - oLlEZx2hUcpJbz+sfCGUWYaF2uKJvuWMNFbGSDhfs8pOMGgelMOHaKVtgOEfEASN - TSqzqn0vzjJ78Mi6mN7/6L/onDKzROxClw0hc6L+PIhIHftD1ckvVQ== - -----END CERTIFICATE-----""", - - """ - MIIFHDBOBgkqhkiG9w0BBQ0wQTApBgkqhkiG9w0BBQwwHAQIn/uWtEzLDK8CAggA - MAwGCCqGSIb3DQIJBQAwFAYIKoZIhvcNAwcECIk7+JC4ErMDBIIEyA3yvNhMm/Oj - ZdkN0HSzPyLv9bOfUyyx4NA121kizZIq/FkUjn8pGxzU63rzMk2vU1hmp2/O3ymr - vmV7gzXRp4ULZCjFwn4cLxi9ieKgBOr9MmgTlRc1oZ9P/Y8eWhmjGxA2CU3fy7Kv - DyzftqAetV8YzTelk8xqxLrGevB16O3zDbFj4dcmG7a0i75kqlI8QyQklJ9uyE10 - SELWFlV6w+3GD82YrbR/8v4fE5KP/nAPbtN4h4C7MY3kJQL+apHr5B3Jst+6N62t - JzmxGS5z3ZVT3Bn3mxi8awo8/XS8s+ZOSnH6nHvz83NBUQwSkVbtujlg+yMD2jg4 - Nt3LWfLnF8Q6n4oAQ1ZP9KJyVIh8+PN12txIRoWq1pF74hJmbfVfiCSR/tMrw6lr - XqlkG1Mi7RmpTCz9ScTUBWY/dyScYFITenv/WE+UnfQ+DXBC+78lkmL36M0Rx/ip - S4O1Tgy/z/MIv1s+ZpAFsRRczlpo9lbVEMuSGEWWTIQJCRPFV8Y1NKHmWUgeZpl3 - 2YUjpHNyQt/a1s1h1g5w9+UNuABt/3cUUnlA7psueb6l4x6M92QFBOpe1xUDL51D - RpaipVl1luFWvE84hqgCIv8Kh9EbkAlclmK8CIOkMQAabk0GmhCfEdm+PCW61Cao - rfCMwZ9Bx6zAcXGRrvl0sK35z8C3r8wLftaS/5xF6RTJBy6XY2iiFW6D44qZDFbh - 0rWV8zDtCf2+OZtEvPkeUn3sjevDW78TM6F7HBjXAeIFrNyJGVe2CTlEJLoZi5pX - W1blhMJ93N1mLiDYisILANmJRBfGMt0tYE/pGcJRlkuqG0qylnqRojjL83CTQvFy - 46q/obR36enRDvCZPvQrX2dB7Vkgpkz/drZ6+avmKdQcTjY/ycCd3DclwexhgUoX - QDntZuJQLp7C4tFfHRy2uh4DOEjzMP6a/NQ3q7p6vc6BTNTFZRUAdyNwcEDIzSLM - nZSPFBiz+gukhtNSCO28kLc8OX1hYsSAMgzbImcMtAiQHG3bFAJ0cs0jF4U9VrJt - 4/97kiDBuCgGb2b5t0+uDqipE6G4B6494IGm5KoIPAPbXMJQstmuzjTJt95UTF+p - e60AnWIXcvEOouIIMzC7gH2g23St5Bo6NixfxcmVfkFa92TDlCTxEz5Z5mnma06k - Pao4Km1eJkYS/QaCDnCZs/yCAMhINUTTDd0/7Y9YE3Dmd5B1s2wOa+ovESSL3Mdv - dZoxh91QR+6hQuz3iYztC/BszMtATH8MznAoco0QFAhKi56Wppe+p1ATLWFMqk4W - elX9vtw5XLucKy5cMkQYh144SnrerlPJTAOGy0XXKunj8ceZfEN6zcS9Us9IN5aF - iENMFHjPsscrrKFhKypaMIn67PuIhVhw4PnGrWejr6TM1gUx+zOcRCwT+5ka2L7U - aqmgS8cDg5ZfAHcbig7No9kku/OSk+5QzkVKca2TZQHm++60oQTzRl3/NWiELO+e - Sl6r8i7dS0Kv3bB/AbLfIHtDgebxUh78qXMel/OUWd58ezxBS74rZ4AQTpYcdTbR - jKHploWi8h5yXYn/YdEZG1vW/zYseFNb7QKT5Cznucl8O/+lNZIOVw63Pq368dTD - tG1GZkIlwM+jlJjRew05YQ== - """), + """ + -----BEGIN CERTIFICATE----- + MIIDtDCCApygAwIBAgICEAEwDQYJKoZIhvcNAQELBQAwQzELMAkGA1UEBhMCVVMx + EzARBgNVBAgTCkNhbGlmb3JuaWExEDAOBgNVBAoTB0V4YW1wbGUxDTALBgNVBAsT + BFRlc3QwHhcNMjIwMjI1MjAxMjA0WhcNNDIwMjIwMjAxMjA0WjBDMQswCQYDVQQG + EwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEQMA4GA1UEChMHRXhhbXBsZTENMAsG + A1UECxMEVGVzdDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKOGhEDj + lZ5R6o20kJdgrIRcY1he4qKLWQ4vU0thqAg4mEcKCZZn4/NL05UgJCFLwYaxMZZe + etb/WaTRvQpDDFh7AhsMR24m6zKKJVk9E/e/8ur7sGDIVq8hZOBTq85ZdxPj/zKW + wB1BR/RcY4DsGno1USlkV7TVeZc1qpJHTPImesevzH7zX8nhnFlf4TTQbpQt6RxU + cr+udWpMOyP9xMerIyp7jpPy79tIaGP2x7ryt2BB9FU4RwPk4DcdfOkmdS86md1c + GI9H5qM5rUzyqey0J8wMRLj+E0Vx0F1XELZeTtyulbIbhrBhu/KOXZG2zNIeK+2F + XxDlx9tD+bbcJfUCAwEAAaOBsTCBrjAdBgNVHQ4EFgQULjM9fwJnC3Tp1QYM8HNL + y60btl0wbAYDVR0jBGUwY4AULjM9fwJnC3Tp1QYM8HNLy60btl2hR6RFMEMxCzAJ + BgNVBAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlhMRAwDgYDVQQKEwdFeGFtcGxl + MQ0wCwYDVQQLEwRUZXN0ggIQATAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQE + AwIBBjANBgkqhkiG9w0BAQsFAAOCAQEAR0Mk+2X/rr4kYYfHsQUIsROwDZSQhQr3 + QOeLc7fyTjkM96OHXN2dKVoOcpzgKi1goHW7lh8vVmKRQk2wfFqRZV9/kQBFK/gz + QtN5gp+pA8Wk912Uj5gD0loiPcRf5bDElvLnr2iwt4VdKkvGIYa9Eu9CYbkf1x3t + ahVLmrZLBkqvKxo4MG4KGYXkqtII3M6clM4ScFa/0rR1nGZOgZyqG7AMMHc01csA + oLlEZx2hUcpJbz+sfCGUWYaF2uKJvuWMNFbGSDhfs8pOMGgelMOHaKVtgOEfEASN + TSqzqn0vzjJ78Mi6mN7/6L/onDKzROxClw0hc6L+PIhIHftD1ckvVQ== + -----END CERTIFICATE-----""", + + """ + MIIFHDBOBgkqhkiG9w0BBQ0wQTApBgkqhkiG9w0BBQwwHAQIn/uWtEzLDK8CAggA + MAwGCCqGSIb3DQIJBQAwFAYIKoZIhvcNAwcECIk7+JC4ErMDBIIEyA3yvNhMm/Oj + ZdkN0HSzPyLv9bOfUyyx4NA121kizZIq/FkUjn8pGxzU63rzMk2vU1hmp2/O3ymr + vmV7gzXRp4ULZCjFwn4cLxi9ieKgBOr9MmgTlRc1oZ9P/Y8eWhmjGxA2CU3fy7Kv + DyzftqAetV8YzTelk8xqxLrGevB16O3zDbFj4dcmG7a0i75kqlI8QyQklJ9uyE10 + SELWFlV6w+3GD82YrbR/8v4fE5KP/nAPbtN4h4C7MY3kJQL+apHr5B3Jst+6N62t + JzmxGS5z3ZVT3Bn3mxi8awo8/XS8s+ZOSnH6nHvz83NBUQwSkVbtujlg+yMD2jg4 + Nt3LWfLnF8Q6n4oAQ1ZP9KJyVIh8+PN12txIRoWq1pF74hJmbfVfiCSR/tMrw6lr + XqlkG1Mi7RmpTCz9ScTUBWY/dyScYFITenv/WE+UnfQ+DXBC+78lkmL36M0Rx/ip + S4O1Tgy/z/MIv1s+ZpAFsRRczlpo9lbVEMuSGEWWTIQJCRPFV8Y1NKHmWUgeZpl3 + 2YUjpHNyQt/a1s1h1g5w9+UNuABt/3cUUnlA7psueb6l4x6M92QFBOpe1xUDL51D + RpaipVl1luFWvE84hqgCIv8Kh9EbkAlclmK8CIOkMQAabk0GmhCfEdm+PCW61Cao + rfCMwZ9Bx6zAcXGRrvl0sK35z8C3r8wLftaS/5xF6RTJBy6XY2iiFW6D44qZDFbh + 0rWV8zDtCf2+OZtEvPkeUn3sjevDW78TM6F7HBjXAeIFrNyJGVe2CTlEJLoZi5pX + W1blhMJ93N1mLiDYisILANmJRBfGMt0tYE/pGcJRlkuqG0qylnqRojjL83CTQvFy + 46q/obR36enRDvCZPvQrX2dB7Vkgpkz/drZ6+avmKdQcTjY/ycCd3DclwexhgUoX + QDntZuJQLp7C4tFfHRy2uh4DOEjzMP6a/NQ3q7p6vc6BTNTFZRUAdyNwcEDIzSLM + nZSPFBiz+gukhtNSCO28kLc8OX1hYsSAMgzbImcMtAiQHG3bFAJ0cs0jF4U9VrJt + 4/97kiDBuCgGb2b5t0+uDqipE6G4B6494IGm5KoIPAPbXMJQstmuzjTJt95UTF+p + e60AnWIXcvEOouIIMzC7gH2g23St5Bo6NixfxcmVfkFa92TDlCTxEz5Z5mnma06k + Pao4Km1eJkYS/QaCDnCZs/yCAMhINUTTDd0/7Y9YE3Dmd5B1s2wOa+ovESSL3Mdv + dZoxh91QR+6hQuz3iYztC/BszMtATH8MznAoco0QFAhKi56Wppe+p1ATLWFMqk4W + elX9vtw5XLucKy5cMkQYh144SnrerlPJTAOGy0XXKunj8ceZfEN6zcS9Us9IN5aF + iENMFHjPsscrrKFhKypaMIn67PuIhVhw4PnGrWejr6TM1gUx+zOcRCwT+5ka2L7U + aqmgS8cDg5ZfAHcbig7No9kku/OSk+5QzkVKca2TZQHm++60oQTzRl3/NWiELO+e + Sl6r8i7dS0Kv3bB/AbLfIHtDgebxUh78qXMel/OUWd58ezxBS74rZ4AQTpYcdTbR + jKHploWi8h5yXYn/YdEZG1vW/zYseFNb7QKT5Cznucl8O/+lNZIOVw63Pq368dTD + tG1GZkIlwM+jlJjRew05YQ== + """), // Version: 3 (0x2) // Serial Number: 4098 (0x1002) @@ -138,57 +149,57 @@ public enum SSLExampleCert { // Public Key Algorithm: rsaEncryption // RSA Public-Key: (2048 bit) SERVER_EXAMPLE_RSA("RSA", - """ - -----BEGIN CERTIFICATE----- - MIIDaTCCAlGgAwIBAgICEAIwDQYJKoZIhvcNAQELBQAwQzELMAkGA1UEBhMCVVMx - EzARBgNVBAgTCkNhbGlmb3JuaWExEDAOBgNVBAoTB0V4YW1wbGUxDTALBgNVBAsT - BFRlc3QwHhcNMjIwMjI1MjAzMTI5WhcNNDIwMjE5MjAzMTI5WjBdMQswCQYDVQQG - EwJVUzETMBEGA1UECAwKQ2FsaWZvcm5pYTEQMA4GA1UECgwHRXhhbXBsZTENMAsG - A1UECwwEVGVzdDEYMBYGA1UEAwwPd3d3LmV4YW1wbGUuY29tMIIBIjANBgkqhkiG - 9w0BAQEFAAOCAQ8AMIIBCgKCAQEA3crcRzecIV08Muh6kA0CuVKnPkU2bLC+6bpV - 7/iBZ4D3qMwO8Q02+gP71pPNoAQ1nsifxR4k9mBVYOjar35RVpuFmLRRVMargrxg - 4WWDfVgLMhOeCy8+Tl4Mp/yRL3nkr0MJd57RCOPcPE84J/1Crq1Luy2+hsXSj25L - VJKx2o6LE0tfwPWnufdNUHzHRuNoBR83OpqIT0uXH15THZS+0ZcQwrJMcKYe4JWl - 6oXWcsWbtTG+r7QLIRKck2IG7jjHFpE83Q6Iv2HkhctgGZofwSTZyMmJ8eClovva - WFLDaLL2WuI3NwZM//knjMyfsEWtWsILXayCn5NTT74ClQjWQQIDAQABo00wSzAJ - BgNVHRMEAjAAMB0GA1UdDgQWBBQ9nPjenO4PMLtMTBddNiIDsPywjzAfBgNVHSME - GDAWgBQuMz1/AmcLdOnVBgzwc0vLrRu2XTANBgkqhkiG9w0BAQsFAAOCAQEAVOvM - fMDOxOCkWB244cx7J+f2qZU6/1qGlJUiL0WRLRj1XEmB8AYSZEb6Os1suF8sotka - nA9Aw1SFA/wNyrSKazXNlOKo0In1mu/OjHU7n6XYVAyDmFGziYY8zTqG1h8ZPrI7 - oAkNgnNDwmwy7uCAvMj+Q4QQ0Q4YxTHV/i3X1HuEwThRgz9cJGdDRIAsimRHDSDO - 5hsIJo6VASz0ISrYMxNZQ1og+XktdNssPK616bPf+APwXXnsWSuGkIdGDU059DII - cTSsLTbWkTWDXAAQo+sfDZUrvqopCK000eoywEmPQrTf7O8oAQdRvTsyxwMvOONd - EWQ9pDW9+RC8l5DtRA== - -----END CERTIFICATE-----""", + """ + -----BEGIN CERTIFICATE----- + MIIDaTCCAlGgAwIBAgICEAIwDQYJKoZIhvcNAQELBQAwQzELMAkGA1UEBhMCVVMx + EzARBgNVBAgTCkNhbGlmb3JuaWExEDAOBgNVBAoTB0V4YW1wbGUxDTALBgNVBAsT + BFRlc3QwHhcNMjIwMjI1MjAzMTI5WhcNNDIwMjE5MjAzMTI5WjBdMQswCQYDVQQG + EwJVUzETMBEGA1UECAwKQ2FsaWZvcm5pYTEQMA4GA1UECgwHRXhhbXBsZTENMAsG + A1UECwwEVGVzdDEYMBYGA1UEAwwPd3d3LmV4YW1wbGUuY29tMIIBIjANBgkqhkiG + 9w0BAQEFAAOCAQ8AMIIBCgKCAQEA3crcRzecIV08Muh6kA0CuVKnPkU2bLC+6bpV + 7/iBZ4D3qMwO8Q02+gP71pPNoAQ1nsifxR4k9mBVYOjar35RVpuFmLRRVMargrxg + 4WWDfVgLMhOeCy8+Tl4Mp/yRL3nkr0MJd57RCOPcPE84J/1Crq1Luy2+hsXSj25L + VJKx2o6LE0tfwPWnufdNUHzHRuNoBR83OpqIT0uXH15THZS+0ZcQwrJMcKYe4JWl + 6oXWcsWbtTG+r7QLIRKck2IG7jjHFpE83Q6Iv2HkhctgGZofwSTZyMmJ8eClovva + WFLDaLL2WuI3NwZM//knjMyfsEWtWsILXayCn5NTT74ClQjWQQIDAQABo00wSzAJ + BgNVHRMEAjAAMB0GA1UdDgQWBBQ9nPjenO4PMLtMTBddNiIDsPywjzAfBgNVHSME + GDAWgBQuMz1/AmcLdOnVBgzwc0vLrRu2XTANBgkqhkiG9w0BAQsFAAOCAQEAVOvM + fMDOxOCkWB244cx7J+f2qZU6/1qGlJUiL0WRLRj1XEmB8AYSZEb6Os1suF8sotka + nA9Aw1SFA/wNyrSKazXNlOKo0In1mu/OjHU7n6XYVAyDmFGziYY8zTqG1h8ZPrI7 + oAkNgnNDwmwy7uCAvMj+Q4QQ0Q4YxTHV/i3X1HuEwThRgz9cJGdDRIAsimRHDSDO + 5hsIJo6VASz0ISrYMxNZQ1og+XktdNssPK616bPf+APwXXnsWSuGkIdGDU059DII + cTSsLTbWkTWDXAAQo+sfDZUrvqopCK000eoywEmPQrTf7O8oAQdRvTsyxwMvOONd + EWQ9pDW9+RC8l5DtRA== + -----END CERTIFICATE-----""", """ - MIIEwAIBADANBgkqhkiG9w0BAQEFAASCBKowggSmAgEAAoIBAQDdytxHN5whXTwy - 6HqQDQK5Uqc+RTZssL7pulXv+IFngPeozA7xDTb6A/vWk82gBDWeyJ/FHiT2YFVg - 6NqvflFWm4WYtFFUxquCvGDhZYN9WAsyE54LLz5OXgyn/JEveeSvQwl3ntEI49w8 - Tzgn/UKurUu7Lb6GxdKPbktUkrHajosTS1/A9ae5901QfMdG42gFHzc6mohPS5cf - XlMdlL7RlxDCskxwph7glaXqhdZyxZu1Mb6vtAshEpyTYgbuOMcWkTzdDoi/YeSF - y2AZmh/BJNnIyYnx4KWi+9pYUsNosvZa4jc3Bkz/+SeMzJ+wRa1awgtdrIKfk1NP - vgKVCNZBAgMBAAECggEBAMUMAtJe7J6Tx/TuqF0swfvGHAHt2eGM0cCzpMATh1xe - rylPSgMNG4faXDcSj4AX3U+ZrKCjHHGruo7jsc5yqm8IsxOtOAjajOwU0vnNh5mn - zCKMXUBQk8lqM1JXyOFmKS8wnsug1NRSJIuMUjbtAf5QxlSg2oHAZUa61cBoqAyk - KXbw9uBYnM4n8WGXdax/LLPuonjnz2Sc35CC1LhRAF/K7oyjg7KvScnphIFRaLiU - X4tFH0nLpcao5de0fP5eUEkbUZ3hE6MEZvOsxn5CFkjH2VdtZ9D5dc3ArV3UMe26 - +3swdenriYZ73HNJDiLAdeIVh9IrGVxhH9UowF9psIUCgYEA/Ldlx4vTTlM7URFn - luqK7D8WH9x4JiCLEGxU80nJxxIgF8eqhOFzsQemytTrf4o1xAkyyPIweHzwApCA - lBdwC4Mc44DjoLFVdTET9hEq7E/UK81znc0mD4v8Hz2JI6h3f2sQrcEAPBvjBwtc - TpS9WlSBKSO3NOb3Hlucq7COVKcCgYEA4KyZ+dOyKVLyGjd0g22v4YW7VC016Hql - uQ7SN1vuI3zQMa2rZfEv5z2L7olJKrDFcmqk8W1tfElrMaSsuohm8khhx0lPtHMw - 4Su/tci/3rEUl+DPrQExdjrrDXCqpUunOAlMP9qElsNBGdkrQ6QlMnSVVi2v8Vf1 - f86Mey2UEtcCgYEAqcOlmqPigfZFnZLcjLPoOQW0HhkjmTE5WgH8GybRZmpVpsPZ - V8R/zEeAkzbvMFEvBw7Kz9RqHTaIoKBjz5fjC8i7ClVWFGesKbqbVyx3MiH6PKaa - aUIbtEvsRSw4SPztsWnB3YcOWlK9csj97Efc36Zu0a0NcHtLPFh8aZWEN3cCgYEA - oQFv8oWPlmeXkcwN1iWjtfT1EtS3XhuOaXjCkuNxW8MVG5S+UHawAoGrpsyBP3Og - e2cLPuxRWpDunYvKMH6Rb60JTRwvXzxxWdvVLbtoLHkwLcrwaKWDQZvlWCNWVtBJ - TDH1j4jUHYpdO93SUE3wTiEX58Mj48tJ5kYpjBhUlc8CgYEA7PG3ORGqZtfCiNmj - CxvPtQiFC+ogf+v8cMQtrKVTgpnI2pxzG+cSXYvL4cnyY2JnwqarWorUic8JU2e2 - EhW53PWUg7VpITlLsqOpATIDiviFAN4qOOxgDt5v0C1PyB3aXe2B5VA3IgczssyR - OLy7p/DhOpu2bqnpKyIkAuzZgFc= - """), + MIIEwAIBADANBgkqhkiG9w0BAQEFAASCBKowggSmAgEAAoIBAQDdytxHN5whXTwy + 6HqQDQK5Uqc+RTZssL7pulXv+IFngPeozA7xDTb6A/vWk82gBDWeyJ/FHiT2YFVg + 6NqvflFWm4WYtFFUxquCvGDhZYN9WAsyE54LLz5OXgyn/JEveeSvQwl3ntEI49w8 + Tzgn/UKurUu7Lb6GxdKPbktUkrHajosTS1/A9ae5901QfMdG42gFHzc6mohPS5cf + XlMdlL7RlxDCskxwph7glaXqhdZyxZu1Mb6vtAshEpyTYgbuOMcWkTzdDoi/YeSF + y2AZmh/BJNnIyYnx4KWi+9pYUsNosvZa4jc3Bkz/+SeMzJ+wRa1awgtdrIKfk1NP + vgKVCNZBAgMBAAECggEBAMUMAtJe7J6Tx/TuqF0swfvGHAHt2eGM0cCzpMATh1xe + rylPSgMNG4faXDcSj4AX3U+ZrKCjHHGruo7jsc5yqm8IsxOtOAjajOwU0vnNh5mn + zCKMXUBQk8lqM1JXyOFmKS8wnsug1NRSJIuMUjbtAf5QxlSg2oHAZUa61cBoqAyk + KXbw9uBYnM4n8WGXdax/LLPuonjnz2Sc35CC1LhRAF/K7oyjg7KvScnphIFRaLiU + X4tFH0nLpcao5de0fP5eUEkbUZ3hE6MEZvOsxn5CFkjH2VdtZ9D5dc3ArV3UMe26 + +3swdenriYZ73HNJDiLAdeIVh9IrGVxhH9UowF9psIUCgYEA/Ldlx4vTTlM7URFn + luqK7D8WH9x4JiCLEGxU80nJxxIgF8eqhOFzsQemytTrf4o1xAkyyPIweHzwApCA + lBdwC4Mc44DjoLFVdTET9hEq7E/UK81znc0mD4v8Hz2JI6h3f2sQrcEAPBvjBwtc + TpS9WlSBKSO3NOb3Hlucq7COVKcCgYEA4KyZ+dOyKVLyGjd0g22v4YW7VC016Hql + uQ7SN1vuI3zQMa2rZfEv5z2L7olJKrDFcmqk8W1tfElrMaSsuohm8khhx0lPtHMw + 4Su/tci/3rEUl+DPrQExdjrrDXCqpUunOAlMP9qElsNBGdkrQ6QlMnSVVi2v8Vf1 + f86Mey2UEtcCgYEAqcOlmqPigfZFnZLcjLPoOQW0HhkjmTE5WgH8GybRZmpVpsPZ + V8R/zEeAkzbvMFEvBw7Kz9RqHTaIoKBjz5fjC8i7ClVWFGesKbqbVyx3MiH6PKaa + aUIbtEvsRSw4SPztsWnB3YcOWlK9csj97Efc36Zu0a0NcHtLPFh8aZWEN3cCgYEA + oQFv8oWPlmeXkcwN1iWjtfT1EtS3XhuOaXjCkuNxW8MVG5S+UHawAoGrpsyBP3Og + e2cLPuxRWpDunYvKMH6Rb60JTRwvXzxxWdvVLbtoLHkwLcrwaKWDQZvlWCNWVtBJ + TDH1j4jUHYpdO93SUE3wTiEX58Mj48tJ5kYpjBhUlc8CgYEA7PG3ORGqZtfCiNmj + CxvPtQiFC+ogf+v8cMQtrKVTgpnI2pxzG+cSXYvL4cnyY2JnwqarWorUic8JU2e2 + EhW53PWUg7VpITlLsqOpATIDiviFAN4qOOxgDt5v0C1PyB3aXe2B5VA3IgczssyR + OLy7p/DhOpu2bqnpKyIkAuzZgFc= + """), // Version: 3 (0x2) @@ -203,57 +214,57 @@ public enum SSLExampleCert { // Public Key Algorithm: rsaEncryption // RSA Public-Key: (2048 bit) CLIENT_EXAMPLE_RSA("RSA", - """ - -----BEGIN CERTIFICATE----- - MIIDZjCCAk6gAwIBAgICEAMwDQYJKoZIhvcNAQELBQAwQzELMAkGA1UEBhMCVVMx - EzARBgNVBAgTCkNhbGlmb3JuaWExEDAOBgNVBAoTB0V4YW1wbGUxDTALBgNVBAsT - BFRlc3QwHhcNMjIwMjI1MjAzMzU5WhcNNDIwMjE5MjAzMzU5WjBaMQswCQYDVQQG - EwJVUzETMBEGA1UECAwKQ2FsaWZvcm5pYTEQMA4GA1UECgwHRXhhbXBsZTENMAsG - A1UECwwEVGVzdDEVMBMGA1UEAwwMRG8tTm90LVJlcGx5MIIBIjANBgkqhkiG9w0B - AQEFAAOCAQ8AMIIBCgKCAQEA2yJgm3Lthr+97vdEWTb4zaNuLTa/DkCXdmVNIQk9 - kVn2hjZrPc+JghBCaWpohGVTQ+zxplIJXk+QVZ0ePEimE7ahBClz4MlAgMpt1uxy - mYYUAsSZDCaFUI9Cpx1f0BiSWu330196K/AfRIoT+/SOZucnpbepxyrt+Az5SKrH - TJR/OSqeX4XKGPoRI96pKxDOV8pY5/I9h9yKGuxfufbpOdVODngVLcMKgBAkiD+2 - sguEHM+iGLx970+W6yycu1dFY1CAgWLUF3evUxe8avwePgx7lTFXnNueYt96Ny9v - L1o/WzoBe3z1mTl5Qb//3tYbXn8vdiDYm0dT8wImpDbpvwIDAQABo00wSzAJBgNV - HRMEAjAAMB0GA1UdDgQWBBSXqW/B1BVjNgowSwa3MBiHMkzp6zAfBgNVHSMEGDAW - gBQuMz1/AmcLdOnVBgzwc0vLrRu2XTANBgkqhkiG9w0BAQsFAAOCAQEABIMAjT5T - lZDV/1wmdKCyJQJ7WUjA44N5/yBGtEmpAJ0VM7/COnk8lqiYxrk50wK7lt0tiklX - 4aLqbAgnDc27z9AQGHOqB69dZprGQT9PsTByjK6i7KPGs30ygyND41j0rju/GM2e - 3xprZbusODENRyL196QV4ai0WVe1hEvv0wTMIcnXYmZHMP8ArdVRHWaDQF6zW0Mh - QbFqklt5W0ZIl2ZmC8z7z2Z6jv/BYyDo3U96LfdCWsEKxSKiX/PGHqZu4D3A4VSE - 0+fE7cX61kgRdGvZJgFjtYxtfkXd1HlyJ48Dqilzl+rvgvR5XA68zijjN0khPhml - wZhPIOCIaWMZYw== - -----END CERTIFICATE-----""", + """ + -----BEGIN CERTIFICATE----- + MIIDZjCCAk6gAwIBAgICEAMwDQYJKoZIhvcNAQELBQAwQzELMAkGA1UEBhMCVVMx + EzARBgNVBAgTCkNhbGlmb3JuaWExEDAOBgNVBAoTB0V4YW1wbGUxDTALBgNVBAsT + BFRlc3QwHhcNMjIwMjI1MjAzMzU5WhcNNDIwMjE5MjAzMzU5WjBaMQswCQYDVQQG + EwJVUzETMBEGA1UECAwKQ2FsaWZvcm5pYTEQMA4GA1UECgwHRXhhbXBsZTENMAsG + A1UECwwEVGVzdDEVMBMGA1UEAwwMRG8tTm90LVJlcGx5MIIBIjANBgkqhkiG9w0B + AQEFAAOCAQ8AMIIBCgKCAQEA2yJgm3Lthr+97vdEWTb4zaNuLTa/DkCXdmVNIQk9 + kVn2hjZrPc+JghBCaWpohGVTQ+zxplIJXk+QVZ0ePEimE7ahBClz4MlAgMpt1uxy + mYYUAsSZDCaFUI9Cpx1f0BiSWu330196K/AfRIoT+/SOZucnpbepxyrt+Az5SKrH + TJR/OSqeX4XKGPoRI96pKxDOV8pY5/I9h9yKGuxfufbpOdVODngVLcMKgBAkiD+2 + sguEHM+iGLx970+W6yycu1dFY1CAgWLUF3evUxe8avwePgx7lTFXnNueYt96Ny9v + L1o/WzoBe3z1mTl5Qb//3tYbXn8vdiDYm0dT8wImpDbpvwIDAQABo00wSzAJBgNV + HRMEAjAAMB0GA1UdDgQWBBSXqW/B1BVjNgowSwa3MBiHMkzp6zAfBgNVHSMEGDAW + gBQuMz1/AmcLdOnVBgzwc0vLrRu2XTANBgkqhkiG9w0BAQsFAAOCAQEABIMAjT5T + lZDV/1wmdKCyJQJ7WUjA44N5/yBGtEmpAJ0VM7/COnk8lqiYxrk50wK7lt0tiklX + 4aLqbAgnDc27z9AQGHOqB69dZprGQT9PsTByjK6i7KPGs30ygyND41j0rju/GM2e + 3xprZbusODENRyL196QV4ai0WVe1hEvv0wTMIcnXYmZHMP8ArdVRHWaDQF6zW0Mh + QbFqklt5W0ZIl2ZmC8z7z2Z6jv/BYyDo3U96LfdCWsEKxSKiX/PGHqZu4D3A4VSE + 0+fE7cX61kgRdGvZJgFjtYxtfkXd1HlyJ48Dqilzl+rvgvR5XA68zijjN0khPhml + wZhPIOCIaWMZYw== + -----END CERTIFICATE-----""", """ - MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDbImCbcu2Gv73u - 90RZNvjNo24tNr8OQJd2ZU0hCT2RWfaGNms9z4mCEEJpamiEZVND7PGmUgleT5BV - nR48SKYTtqEEKXPgyUCAym3W7HKZhhQCxJkMJoVQj0KnHV/QGJJa7ffTX3or8B9E - ihP79I5m5yelt6nHKu34DPlIqsdMlH85Kp5fhcoY+hEj3qkrEM5Xyljn8j2H3Ioa - 7F+59uk51U4OeBUtwwqAECSIP7ayC4Qcz6IYvH3vT5brLJy7V0VjUICBYtQXd69T - F7xq/B4+DHuVMVec255i33o3L28vWj9bOgF7fPWZOXlBv//e1htefy92INibR1Pz - AiakNum/AgMBAAECggEAW0WxWW4AMyzwDnWdWU+FSBm3TUvNPkF3FNBS1NzFcSI4 - hWRrPJ6R1sOw9blleSe/C77IVA89abPYGWDM9C0KR5G89T/SzSDmJf6qy2dGwF1R - PmnmmWH+CzTwfSzF+KYTZ55QqBDPkTd9vo2Ij1woaAIFyId8RsHBxpyYxESlqGY4 - C6IzEqxFQ0obHXasNR+dP4iOWS4ONhxeUHixcrDHxbmoqmHt0WuJwXhlOjxHgr+i - lUPTe5y+Y2B1gVNYrN4KlDTJqJ6lu4n6MFQ46jhfddzTk3uiEOTVWK6nE8Cf0NM7 - djTzTcR8xAVpoY5XDlk0aBfEd8Np7TLSjV4vU3J04QKBgQD6scazH/H9Yu9ZbR7w - EeN/k7uDDlgahWg8/93syzdFtSNIRGvdalNMhTfM/zXaM/Cl63gvZilWxC+56Uvg - 6QC+rBUwzZrm7ryb6hT6Zyoo4w72bw3jGOJ3e2/bclSLrAcJnL/1Gq87J3CS16wl - NIHrlOlY8orToEdki+6HaagyEQKBgQDfxZz4Uqsa+jDO/rEm959+nz2RkaXYu1Ld - DhYONxmlw69/BbwzOvzr88qKNbd+b+oIK8kpm7Lvpc2/cuqItTFdehmw+tGhMWYo - XizKCeKeCByFTjXI2/PEPUHMy0D8M68Tx/Hq0NbIYqCyzkaamHhXpuJGftxGfd3/ - U0NB4WGOzwKBgQDgnyN7YfcwY1I0XUqoLk8aA2Oy5MpaUQh6B4RwZBENO2T2np/L - TzZ9zKuX2WAGOB26fMY+KhqGLNjaike7qOpK7eM6zC6sFmMWjGHpj0A+TFwewJi/ - z48zIX2zMbjBQQ05NqLkWdmCdi8u02HiIC78x3thgEiVn/n4BE1gNXJIEQKBgEdr - dfcXw36/vZZDWd07CU/LmUX9u3YaC498MHPnCCuM8lVTSkb7m7/fNpS4IlGbfJGR - EApUpF6yh6GEFvD9C71u/AYtd3zAHH/j1t3BG/AeXKP7W1U5RmsqtfacJKiaAlYI - 6eBtOTAJsop/Ja+v3DD1laC0Wq+w+orEU2ISgiWnAoGBAK9/9m3RCYPNYzS/PQ2B - AgE2FQRuY8FXxHegZo2tBBwIojPeVHO1OoThYVNgiQfW9k27dFkRwXVAtt6Jqgax - fvOby8rWRStXH2qHVyvHicceL7iXs6v2bX20Szsy44eMkoFfAImea6ZdErLdVWvI - fxlYpTIVpBt3Nu2BRJn28ili - """); + MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDbImCbcu2Gv73u + 90RZNvjNo24tNr8OQJd2ZU0hCT2RWfaGNms9z4mCEEJpamiEZVND7PGmUgleT5BV + nR48SKYTtqEEKXPgyUCAym3W7HKZhhQCxJkMJoVQj0KnHV/QGJJa7ffTX3or8B9E + ihP79I5m5yelt6nHKu34DPlIqsdMlH85Kp5fhcoY+hEj3qkrEM5Xyljn8j2H3Ioa + 7F+59uk51U4OeBUtwwqAECSIP7ayC4Qcz6IYvH3vT5brLJy7V0VjUICBYtQXd69T + F7xq/B4+DHuVMVec255i33o3L28vWj9bOgF7fPWZOXlBv//e1htefy92INibR1Pz + AiakNum/AgMBAAECggEAW0WxWW4AMyzwDnWdWU+FSBm3TUvNPkF3FNBS1NzFcSI4 + hWRrPJ6R1sOw9blleSe/C77IVA89abPYGWDM9C0KR5G89T/SzSDmJf6qy2dGwF1R + PmnmmWH+CzTwfSzF+KYTZ55QqBDPkTd9vo2Ij1woaAIFyId8RsHBxpyYxESlqGY4 + C6IzEqxFQ0obHXasNR+dP4iOWS4ONhxeUHixcrDHxbmoqmHt0WuJwXhlOjxHgr+i + lUPTe5y+Y2B1gVNYrN4KlDTJqJ6lu4n6MFQ46jhfddzTk3uiEOTVWK6nE8Cf0NM7 + djTzTcR8xAVpoY5XDlk0aBfEd8Np7TLSjV4vU3J04QKBgQD6scazH/H9Yu9ZbR7w + EeN/k7uDDlgahWg8/93syzdFtSNIRGvdalNMhTfM/zXaM/Cl63gvZilWxC+56Uvg + 6QC+rBUwzZrm7ryb6hT6Zyoo4w72bw3jGOJ3e2/bclSLrAcJnL/1Gq87J3CS16wl + NIHrlOlY8orToEdki+6HaagyEQKBgQDfxZz4Uqsa+jDO/rEm959+nz2RkaXYu1Ld + DhYONxmlw69/BbwzOvzr88qKNbd+b+oIK8kpm7Lvpc2/cuqItTFdehmw+tGhMWYo + XizKCeKeCByFTjXI2/PEPUHMy0D8M68Tx/Hq0NbIYqCyzkaamHhXpuJGftxGfd3/ + U0NB4WGOzwKBgQDgnyN7YfcwY1I0XUqoLk8aA2Oy5MpaUQh6B4RwZBENO2T2np/L + TzZ9zKuX2WAGOB26fMY+KhqGLNjaike7qOpK7eM6zC6sFmMWjGHpj0A+TFwewJi/ + z48zIX2zMbjBQQ05NqLkWdmCdi8u02HiIC78x3thgEiVn/n4BE1gNXJIEQKBgEdr + dfcXw36/vZZDWd07CU/LmUX9u3YaC498MHPnCCuM8lVTSkb7m7/fNpS4IlGbfJGR + EApUpF6yh6GEFvD9C71u/AYtd3zAHH/j1t3BG/AeXKP7W1U5RmsqtfacJKiaAlYI + 6eBtOTAJsop/Ja+v3DD1laC0Wq+w+orEU2ISgiWnAoGBAK9/9m3RCYPNYzS/PQ2B + AgE2FQRuY8FXxHegZo2tBBwIojPeVHO1OoThYVNgiQfW9k27dFkRwXVAtt6Jqgax + fvOby8rWRStXH2qHVyvHicceL7iXs6v2bX20Szsy44eMkoFfAImea6ZdErLdVWvI + fxlYpTIVpBt3Nu2BRJn28ili + """); final String keyAlgo; final String certStr; @@ -359,10 +370,24 @@ public enum SSLExampleCert { } } + // Set the date for the verifying of certificates. + DateFormat df = new SimpleDateFormat("MM/dd/yyyy"); + Date verifyingDate = df.parse("02/02/2023"); + // Create an SSLContext object. TrustManagerFactory tmf = TrustManagerFactory.getInstance("PKIX"); - tmf.init(ts); + if (ts != null) { + PKIXBuilderParameters pkixParams = + new PKIXBuilderParameters(ts, null); + pkixParams.setDate(verifyingDate); + pkixParams.setRevocationEnabled(false); + ManagerFactoryParameters managerFactoryParameters = + new CertPathTrustManagerParameters(pkixParams); + tmf.init(managerFactoryParameters); + } else { + tmf.init((KeyStore)null); + } SSLContext context = SSLContext.getInstance("TLS"); if (endEntityCerts != null && endEntityCerts.length != 0) { @@ -370,7 +395,16 @@ public enum SSLExampleCert { KeyManagerFactory.getInstance("NewSunX509"); kmf.init(ks, passphrase); - context.init(kmf.getKeyManagers(), tmf.getTrustManagers(), null); + KeyManager[] kms = kmf.getKeyManagers(); + if (kms != null && kms.length != 0) { + KeyManager km = kms[0]; + Field verificationDateField = + km.getClass().getDeclaredField("verificationDate"); + verificationDateField.setAccessible(true); + verificationDateField.set(km, verifyingDate); + } + + context.init(kms, tmf.getTrustManagers(), null); } else { context.init(null, tmf.getTrustManagers(), null); } -- GitLab From 1581e3faa06358f192799b3a89718028c7f6a24b Mon Sep 17 00:00:00 2001 From: Manukumar V S Date: Thu, 3 Mar 2022 19:30:07 +0000 Subject: [PATCH 142/340] 8282402: Create a regression test for JDK-4666101 Reviewed-by: aivanov --- .../4666101/JEditorPaneNavigationTest.java | 197 ++++++++++++++++++ 1 file changed, 197 insertions(+) create mode 100644 test/jdk/javax/swing/JEditorPane/4666101/JEditorPaneNavigationTest.java diff --git a/test/jdk/javax/swing/JEditorPane/4666101/JEditorPaneNavigationTest.java b/test/jdk/javax/swing/JEditorPane/4666101/JEditorPaneNavigationTest.java new file mode 100644 index 00000000000..c88e284556e --- /dev/null +++ b/test/jdk/javax/swing/JEditorPane/4666101/JEditorPaneNavigationTest.java @@ -0,0 +1,197 @@ +/* + * Copyright (c) 2002, 2022, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Dimension; +import java.awt.Point; +import java.awt.Rectangle; +import java.awt.Robot; +import java.awt.Toolkit; +import java.awt.event.InputEvent; +import java.awt.event.KeyEvent; +import java.io.File; +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.concurrent.atomic.AtomicBoolean; +import java.util.concurrent.atomic.AtomicReference; +import java.util.stream.Collectors; +import javax.imageio.ImageIO; +import javax.swing.JEditorPane; +import javax.swing.JFrame; +import javax.swing.JPanel; +import javax.swing.SwingUtilities; +import javax.swing.UIManager; +import javax.swing.UIManager.LookAndFeelInfo; +import javax.swing.UnsupportedLookAndFeelException; + +import static javax.swing.UIManager.getInstalledLookAndFeels; + +/* + * @test + * @key headful + * @bug 4666101 + * @summary Verifies that in a JEditorPane, the down arrow is honoured after you + add text on a line preceding a blank line. + * @run main JEditorPaneNavigationTest + */ +public class JEditorPaneNavigationTest { + + private static volatile int caretPos; + private static JEditorPane jep; + private static JFrame frame; + private static Robot robot; + + public static void main(String[] args) throws Exception { + robot = new Robot(); + robot.setAutoWaitForIdle(true); + robot.setAutoDelay(100); + + List lafs = Arrays.stream(getInstalledLookAndFeels()) + .map(LookAndFeelInfo::getClassName) + .collect(Collectors.toList()); + for (final String laf : lafs) { + try { + AtomicBoolean lafSetSuccess = new AtomicBoolean(false); + SwingUtilities.invokeAndWait(() -> { + lafSetSuccess.set(setLookAndFeel(laf)); + if (lafSetSuccess.get()) { + createUI(); + } + }); + if (!lafSetSuccess.get()) { + continue; + } + robot.waitForIdle(); + + AtomicReference pt = new AtomicReference<>(); + SwingUtilities.invokeAndWait(() -> pt.set(jep.getLocationOnScreen())); + caretPos = 0; + final Point jEditorLoc = pt.get(); + + // Click on JEditorPane + robot.mouseMove(jEditorLoc.x + 50, jEditorLoc.y + 50); + robot.mousePress(InputEvent.BUTTON1_DOWN_MASK); + robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); + + keyType(KeyEvent.VK_ENTER); + keyType(KeyEvent.VK_ENTER); + + typeSomeText(); + + keyType(KeyEvent.VK_UP); + keyType(KeyEvent.VK_UP); + + typeSomeText(); + + keyType(KeyEvent.VK_DOWN); + + System.out.println(" test1 caret pos = " + caretPos); + + // Check whether the caret position is at the expected value 5 + if (caretPos != 5) { + captureScreen(); + throw new RuntimeException("Test Failed in " + laf + + " expected initial caret position is 5, but actual is " + caretPos); + } + + keyType(KeyEvent.VK_DOWN); + + System.out.println(" test2 caret pos = " + caretPos); + + // Check whether the caret position is at the expected value 10 + if (caretPos != 10) { + captureScreen(); + throw new RuntimeException("Test Failed in " + laf + + " expected final caret position is 10, but actual is " + caretPos); + } + + System.out.println("Test Passed in " + laf); + + } finally { + SwingUtilities.invokeAndWait(JEditorPaneNavigationTest::disposeFrame); + } + } + } + + private static void captureScreen() { + Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); + try { + ImageIO.write( + robot.createScreenCapture(new Rectangle(0, 0, screenSize.width, screenSize.height)), + "png", + new File("JEditorPaneNavigationTest.png") + ); + } catch (IOException ignore) { + } + } + + private static void typeSomeText() { + keyType(KeyEvent.VK_T); + keyType(KeyEvent.VK_E); + keyType(KeyEvent.VK_X); + keyType(KeyEvent.VK_T); + } + + private static void keyType(int keyCode) { + robot.keyPress(keyCode); + robot.keyRelease(keyCode); + } + + + private static void createUI() { + frame = new JFrame(); + jep = new JEditorPane(); + jep.setPreferredSize(new Dimension(100, 100)); + jep.addCaretListener(e -> caretPos = jep.getCaretPosition()); + jep.setEditable(true); + JPanel panel = new JPanel(); + panel.add(jep); + frame.add(panel); + frame.setLocationRelativeTo(null); + frame.setAlwaysOnTop(true); + frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); + frame.pack(); + frame.setVisible(true); + } + + private static boolean setLookAndFeel(String lafName) { + try { + UIManager.setLookAndFeel(lafName); + } catch (UnsupportedLookAndFeelException ignored) { + System.out.println("Ignoring Unsupported laf : " + lafName); + return false; + } catch (ClassNotFoundException | InstantiationException + | IllegalAccessException e) { + throw new RuntimeException(e); + } + return true; + } + + private static void disposeFrame() { + if (frame != null) { + frame.dispose(); + frame = null; + } + } + +} -- GitLab From fb6b929e6e935baeccfd03a7fbc048cc8b531ce5 Mon Sep 17 00:00:00 2001 From: Hai-May Chao Date: Thu, 3 Mar 2022 23:01:26 +0000 Subject: [PATCH 143/340] 8277474: jarsigner does not check if algorithm parameters are disabled Reviewed-by: mullan, weijun --- .../util/DisabledAlgorithmConstraints.java | 2 +- .../sun/security/tools/jarsigner/Main.java | 40 +++++++-- .../security/tools/jarsigner/Resources.java | 2 + .../tools/jarsigner/CheckAlgParams.java | 85 +++++++++++++++++++ 4 files changed, 120 insertions(+), 9 deletions(-) create mode 100644 test/jdk/sun/security/tools/jarsigner/CheckAlgParams.java diff --git a/src/java.base/share/classes/sun/security/util/DisabledAlgorithmConstraints.java b/src/java.base/share/classes/sun/security/util/DisabledAlgorithmConstraints.java index 67fe86762af..0cdb85decaf 100644 --- a/src/java.base/share/classes/sun/security/util/DisabledAlgorithmConstraints.java +++ b/src/java.base/share/classes/sun/security/util/DisabledAlgorithmConstraints.java @@ -202,7 +202,7 @@ public class DisabledAlgorithmConstraints extends AbstractAlgorithmConstraints { } } - private void permits(AlgorithmParameters ap, ConstraintsParameters cp) + public void permits(AlgorithmParameters ap, ConstraintsParameters cp) throws CertPathValidatorException { switch (ap.getAlgorithm().toUpperCase(Locale.ENGLISH)) { diff --git a/src/jdk.jartool/share/classes/sun/security/tools/jarsigner/Main.java b/src/jdk.jartool/share/classes/sun/security/tools/jarsigner/Main.java index 78f54e535d2..750b125f10d 100644 --- a/src/jdk.jartool/share/classes/sun/security/tools/jarsigner/Main.java +++ b/src/jdk.jartool/share/classes/sun/security/tools/jarsigner/Main.java @@ -1021,6 +1021,8 @@ public class Main { si.getDigestAlgorithmId(), si.getDigestEncryptionAlgorithmId(), si.getAuthenticatedAttributes() == null); + AlgorithmId encAlgId = si.getDigestEncryptionAlgorithmId(); + AlgorithmParameters sigAlgParams = encAlgId.getParameters(); PublicKey key = signer.getPublicKey(); PKCS7 tsToken = si.getTsToken(); if (tsToken != null) { @@ -1035,6 +1037,8 @@ public class Main { tsSi.getDigestAlgorithmId(), tsSi.getDigestEncryptionAlgorithmId(), tsSi.getAuthenticatedAttributes() == null); + AlgorithmId tsEncAlgId = tsSi.getDigestEncryptionAlgorithmId(); + AlgorithmParameters tsSigAlgParams = tsEncAlgId.getParameters(); Calendar c = Calendar.getInstance( TimeZone.getTimeZone("UTC"), Locale.getDefault(Locale.Category.FORMAT)); @@ -1049,13 +1053,13 @@ public class Main { history = String.format( rb.getString("history.with.ts"), signer.getSubjectX500Principal(), - verifyWithWeak(digestAlg, DIGEST_PRIMITIVE_SET, false, jcp), - verifyWithWeak(sigAlg, SIG_PRIMITIVE_SET, false, jcp), + verifyWithWeak(digestAlg, DIGEST_PRIMITIVE_SET, false, jcp, null), + verifyWithWeak(sigAlg, SIG_PRIMITIVE_SET, false, jcp, sigAlgParams), verifyWithWeak(key, jcp), c, tsSigner.getSubjectX500Principal(), - verifyWithWeak(tsDigestAlg, DIGEST_PRIMITIVE_SET, true, jcpts), - verifyWithWeak(tsSigAlg, SIG_PRIMITIVE_SET, true, jcpts), + verifyWithWeak(tsDigestAlg, DIGEST_PRIMITIVE_SET, true, jcpts, null), + verifyWithWeak(tsSigAlg, SIG_PRIMITIVE_SET, true, jcpts, tsSigAlgParams), verifyWithWeak(tsKey, jcpts)); } else { JarConstraintsParameters jcp = @@ -1063,8 +1067,8 @@ public class Main { history = String.format( rb.getString("history.without.ts"), signer.getSubjectX500Principal(), - verifyWithWeak(digestAlg, DIGEST_PRIMITIVE_SET, false, jcp), - verifyWithWeak(sigAlg, SIG_PRIMITIVE_SET, false, jcp), + verifyWithWeak(digestAlg, DIGEST_PRIMITIVE_SET, false, jcp, null), + verifyWithWeak(sigAlg, SIG_PRIMITIVE_SET, false, jcp, sigAlgParams), verifyWithWeak(key, jcp)); } } catch (Exception e) { @@ -1393,7 +1397,7 @@ public class Main { } private String verifyWithWeak(String alg, Set primitiveSet, - boolean tsa, JarConstraintsParameters jcp) { + boolean tsa, JarConstraintsParameters jcp, AlgorithmParameters algParams) { try { JAR_DISABLED_CHECK.permits(alg, jcp, false); @@ -1401,9 +1405,18 @@ public class Main { disabledAlgFound = true; return String.format(rb.getString("with.disabled"), alg); } + if (algParams != null) { + try { + JAR_DISABLED_CHECK.permits(algParams, jcp); + } catch (CertPathValidatorException e) { + disabledAlgFound = true; + return String.format(rb.getString("with.algparams.disabled"), + alg, algParams); + } + } + try { LEGACY_CHECK.permits(alg, jcp, false); - return alg; } catch (CertPathValidatorException e) { if (primitiveSet == SIG_PRIMITIVE_SET) { legacyAlg |= 2; @@ -1419,6 +1432,17 @@ public class Main { } return String.format(rb.getString("with.weak"), alg); } + if (algParams != null) { + try { + LEGACY_CHECK.permits(algParams, jcp); + } catch (CertPathValidatorException e) { + legacyAlg |= 2; + legacySigAlg = alg; + return String.format(rb.getString("with.algparams.weak"), + alg, algParams); + } + } + return alg; } private String verifyWithWeak(PublicKey key, JarConstraintsParameters jcp) { diff --git a/src/jdk.jartool/share/classes/sun/security/tools/jarsigner/Resources.java b/src/jdk.jartool/share/classes/sun/security/tools/jarsigner/Resources.java index 265af66f9b3..f5a1bb2e3cb 100644 --- a/src/jdk.jartool/share/classes/sun/security/tools/jarsigner/Resources.java +++ b/src/jdk.jartool/share/classes/sun/security/tools/jarsigner/Resources.java @@ -176,7 +176,9 @@ public class Resources extends java.util.ListResourceBundle { {"history.nobk", "- Missing block file for signature-related file META-INF/%s.SF"}, {"with.weak", "%s (weak)"}, + {"with.algparams.weak", "%1$s using %2$s (weak)"}, {"with.disabled", "%s (disabled)"}, + {"with.algparams.disabled", "%1$s using %2$s (disabled)"}, {"key.bit", "%d-bit key"}, {"key.bit.weak", "%d-bit key (weak)"}, {"key.bit.disabled", "%d-bit key (disabled)"}, diff --git a/test/jdk/sun/security/tools/jarsigner/CheckAlgParams.java b/test/jdk/sun/security/tools/jarsigner/CheckAlgParams.java new file mode 100644 index 00000000000..d0a4338fee3 --- /dev/null +++ b/test/jdk/sun/security/tools/jarsigner/CheckAlgParams.java @@ -0,0 +1,85 @@ +/* + * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 8277474 + * @summary jarsigner -verify should check if the algorithm parameters of + * its signature algorithm use disabled or legacy algorithms + * @library /test/lib + */ + +import jdk.test.lib.SecurityTools; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.util.JarUtils; + +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; + +public class CheckAlgParams { + private static final String JAVA_SECURITY_FILE = "java.security"; + + public static void main(String[] args) throws Exception{ + + SecurityTools.keytool("-keystore ks -storepass changeit " + + "-genkeypair -keyalg RSASSA-PSS -alias ca -dname CN=CA " + + "-ext bc:c") + .shouldHaveExitValue(0); + + JarUtils.createJarFile(Path.of("a.jar"), Path.of("."), Path.of("ks")); + + SecurityTools.jarsigner("-keystore ks -storepass changeit " + + "-signedjar signeda.jar " + + "-verbose" + + " a.jar ca") + .shouldHaveExitValue(0); + + Files.writeString(Files.createFile(Paths.get(JAVA_SECURITY_FILE)), + "jdk.jar.disabledAlgorithms=SHA256\n" + + "jdk.security.legacyAlgorithms=\n"); + + SecurityTools.jarsigner("-verify signeda.jar " + + "-J-Djava.security.properties=" + + JAVA_SECURITY_FILE + + " -keystore ks -storepass changeit -verbose -debug") + .shouldMatch("Digest algorithm: SHA-256.*(disabled)") + .shouldMatch("Signature algorithm: RSASSA-PSS using PSSParameterSpec.*hashAlgorithm=SHA-256.*(disabled)") + .shouldContain("The jar will be treated as unsigned") + .shouldHaveExitValue(0); + + Files.deleteIfExists(Paths.get(JAVA_SECURITY_FILE)); + Files.writeString(Files.createFile(Paths.get(JAVA_SECURITY_FILE)), + "jdk.jar.disabledAlgorithms=\n" + + "jdk.security.legacyAlgorithms=SHA256\n"); + + SecurityTools.jarsigner("-verify signeda.jar " + + "-J-Djava.security.properties=" + + JAVA_SECURITY_FILE + + " -keystore ks -storepass changeit -verbose -debug") + .shouldMatch("Digest algorithm: SHA-256.*(weak)") + .shouldMatch("Signature algorithm: RSASSA-PSS using PSSParameterSpec.*hashAlgorithm=SHA-256.*(weak)") + .shouldNotContain("The jar will be treated as unsigned") + .shouldHaveExitValue(0); + } +} -- GitLab From 8478173d837113bf603aadb614badd461f474250 Mon Sep 17 00:00:00 2001 From: Joe Wang Date: Fri, 4 Mar 2022 03:15:35 +0000 Subject: [PATCH 144/340] 8282583: Update BCEL md to include the copyright notice Reviewed-by: lancea, iris, naoto --- src/java.xml/share/legal/bcel.md | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/java.xml/share/legal/bcel.md b/src/java.xml/share/legal/bcel.md index aca04ab4a8d..6dffd077c81 100644 --- a/src/java.xml/share/legal/bcel.md +++ b/src/java.xml/share/legal/bcel.md @@ -3,14 +3,11 @@ ### Apache Commons BCEL Notice
 
-    =========================================================================
-    ==  NOTICE file corresponding to the section 4 d of                    ==
-    ==  the Apache License, Version 2.0,                                   ==
-    ==  in this case for the Apache Commons BCEL distribution.             ==
-    =========================================================================
-
-   This product includes software developed by
-   The Apache Software Foundation (http://www.apache.org/).
+    Apache Commons BCEL
+    Copyright 2004-2020 The Apache Software Foundation
+
+    This product includes software developed at
+    The Apache Software Foundation (https://www.apache.org/).
 
 
-- GitLab From 7e1c67d4af76eba688927a24d711181570e965ef Mon Sep 17 00:00:00 2001 From: Mandy Chung Date: Fri, 4 Mar 2022 03:41:41 +0000 Subject: [PATCH 145/340] 8282608: RawNativeLibraryImpl can't be passed to NativeLibraries::findEntry0 Reviewed-by: mcimadamore, dholmes --- .../jdk/internal/loader/NativeLibraries.java | 10 ++-------- .../classes/jdk/internal/loader/NativeLibrary.java | 14 ++++++++++---- .../jdk/internal/loader/RawNativeLibraries.java | 7 ++----- .../share/native/libjava/NativeLibraries.c | 14 ++++---------- 4 files changed, 18 insertions(+), 27 deletions(-) diff --git a/src/java.base/share/classes/jdk/internal/loader/NativeLibraries.java b/src/java.base/share/classes/jdk/internal/loader/NativeLibraries.java index 6230bcde48a..c5ede021e00 100644 --- a/src/java.base/share/classes/jdk/internal/loader/NativeLibraries.java +++ b/src/java.base/share/classes/jdk/internal/loader/NativeLibraries.java @@ -281,7 +281,7 @@ public final class NativeLibraries { * the VM when it loads the library, and used by the VM to pass the correct * version of JNI to the native methods. */ - static class NativeLibraryImpl implements NativeLibrary { + static class NativeLibraryImpl extends NativeLibrary { // the class from which the library is loaded, also indicates // the loader this native library belongs. final Class fromClass; @@ -309,7 +309,7 @@ public final class NativeLibraries { @Override public long find(String name) { - return findEntry0(this, name); + return findEntry0(handle, name); } /* @@ -534,10 +534,4 @@ public final class NativeLibraries { */ private static native void unload(String name, boolean isBuiltin, long handle); private static native String findBuiltinLib(String name); - - /* - * Returns the address of the named symbol defined in the given library. - * Returns 0 if not found. - */ - static native long findEntry0(NativeLibrary lib, String name); } diff --git a/src/java.base/share/classes/jdk/internal/loader/NativeLibrary.java b/src/java.base/share/classes/jdk/internal/loader/NativeLibrary.java index 2b684e0bf35..228356e0773 100644 --- a/src/java.base/share/classes/jdk/internal/loader/NativeLibrary.java +++ b/src/java.base/share/classes/jdk/internal/loader/NativeLibrary.java @@ -28,8 +28,8 @@ package jdk.internal.loader; /** * NativeLibrary represents a loaded native library instance. */ -public interface NativeLibrary { - String name(); +public abstract class NativeLibrary { + public abstract String name(); /** * Finds the address of the entry of the given name. Returns 0 @@ -37,7 +37,7 @@ public interface NativeLibrary { * * @param name the name of the symbol to be found */ - long find(String name); + public abstract long find(String name); /** * Finds the address of the entry of the given name. @@ -45,11 +45,17 @@ public interface NativeLibrary { * @param name the name of the symbol to be found * @throws NoSuchMethodException if the named entry is not found. */ - default long lookup(String name) throws NoSuchMethodException { + public final long lookup(String name) throws NoSuchMethodException { long addr = find(name); if (0 == addr) { throw new NoSuchMethodException("Cannot find symbol " + name + " in library " + name()); } return addr; } + + /* + * Returns the address of the named symbol defined in the library of + * the given handle. Returns 0 if not found. + */ + static native long findEntry0(long handle, String name); } diff --git a/src/java.base/share/classes/jdk/internal/loader/RawNativeLibraries.java b/src/java.base/share/classes/jdk/internal/loader/RawNativeLibraries.java index fd7558d9fe8..972e34e1fd2 100644 --- a/src/java.base/share/classes/jdk/internal/loader/RawNativeLibraries.java +++ b/src/java.base/share/classes/jdk/internal/loader/RawNativeLibraries.java @@ -35,9 +35,6 @@ import java.util.Map; import java.util.Objects; import java.util.concurrent.ConcurrentHashMap; -import static jdk.internal.loader.NativeLibraries.*; - - /** * RawNativeLibraries has the following properties: * 1. Native libraries loaded in this RawNativeLibraries instance are @@ -136,7 +133,7 @@ public final class RawNativeLibraries { nl.close(); } - static class RawNativeLibraryImpl implements NativeLibrary { + static class RawNativeLibraryImpl extends NativeLibrary { // the name of the raw native library. final String name; // opaque handle to raw native library, used in native code. @@ -153,7 +150,7 @@ public final class RawNativeLibraries { @Override public long find(String name) { - return findEntry0(this, name); + return findEntry0(handle, name); } /* diff --git a/src/java.base/share/native/libjava/NativeLibraries.c b/src/java.base/share/native/libjava/NativeLibraries.c index 7aa89fe21f7..28b632aecc2 100644 --- a/src/java.base/share/native/libjava/NativeLibraries.c +++ b/src/java.base/share/native/libjava/NativeLibraries.c @@ -218,24 +218,18 @@ Java_jdk_internal_loader_NativeLibraries_unload JNU_ReleaseStringPlatformChars(env, name, cname); } - /* - * Class: jdk_internal_loader_NativeLibraries + * Class: jdk_internal_loader_NativeLibrary * Method: findEntry0 - * Signature: (Ljdk/internal/loader/NativeLibrary;Ljava/lang/String;)J + * Signature: (JLjava/lang/String;)J */ JNIEXPORT jlong JNICALL -Java_jdk_internal_loader_NativeLibraries_findEntry0 - (JNIEnv *env, jclass cls, jobject lib, jstring name) +Java_jdk_internal_loader_NativeLibrary_findEntry0 + (JNIEnv *env, jclass cls, jlong handle, jstring name) { - jlong handle; const char *cname; jlong res; - if (!initIDs(env)) - return jlong_zero; - - handle = (*env)->GetLongField(env, lib, handleID); cname = (*env)->GetStringUTFChars(env, name, 0); if (cname == 0) return jlong_zero; -- GitLab From b629782b8d44e8aa8a99c6a3381663a6169aa1ad Mon Sep 17 00:00:00 2001 From: Igor Veresov Date: Fri, 4 Mar 2022 03:49:37 +0000 Subject: [PATCH 146/340] 8279886: C1: Turn off SelectivePhiFunctions in presence of irreducible loops Reviewed-by: kvn, dlong --- src/hotspot/share/c1/c1_Compilation.cpp | 1 + src/hotspot/share/c1/c1_Compilation.hpp | 3 + src/hotspot/share/c1/c1_GraphBuilder.cpp | 76 ++++++++++++++---------- src/hotspot/share/c1/c1_Instruction.cpp | 5 +- src/hotspot/share/c1/c1_Instruction.hpp | 7 ++- 5 files changed, 56 insertions(+), 36 deletions(-) diff --git a/src/hotspot/share/c1/c1_Compilation.cpp b/src/hotspot/share/c1/c1_Compilation.cpp index 27c20a9c5fe..ac415edb1f5 100644 --- a/src/hotspot/share/c1/c1_Compilation.cpp +++ b/src/hotspot/share/c1/c1_Compilation.cpp @@ -560,6 +560,7 @@ Compilation::Compilation(AbstractCompiler* compiler, ciEnv* env, ciMethod* metho , _has_exception_handlers(false) , _has_fpu_code(true) // pessimistic assumption , _has_unsafe_access(false) +, _has_irreducible_loops(false) , _would_profile(false) , _has_method_handle_invokes(false) , _has_reserved_stack_access(method->has_reserved_stack_access()) diff --git a/src/hotspot/share/c1/c1_Compilation.hpp b/src/hotspot/share/c1/c1_Compilation.hpp index f3be9ed7cee..02a2f367df3 100644 --- a/src/hotspot/share/c1/c1_Compilation.hpp +++ b/src/hotspot/share/c1/c1_Compilation.hpp @@ -77,6 +77,7 @@ class Compilation: public StackObj { bool _has_exception_handlers; bool _has_fpu_code; bool _has_unsafe_access; + bool _has_irreducible_loops; bool _would_profile; bool _has_method_handle_invokes; // True if this method has MethodHandle invokes. bool _has_reserved_stack_access; @@ -135,6 +136,7 @@ class Compilation: public StackObj { bool has_exception_handlers() const { return _has_exception_handlers; } bool has_fpu_code() const { return _has_fpu_code; } bool has_unsafe_access() const { return _has_unsafe_access; } + bool has_irreducible_loops() const { return _has_irreducible_loops; } int max_vector_size() const { return 0; } ciMethod* method() const { return _method; } int osr_bci() const { return _osr_bci; } @@ -162,6 +164,7 @@ class Compilation: public StackObj { void set_has_exception_handlers(bool f) { _has_exception_handlers = f; } void set_has_fpu_code(bool f) { _has_fpu_code = f; } void set_has_unsafe_access(bool f) { _has_unsafe_access = f; } + void set_has_irreducible_loops(bool f) { _has_irreducible_loops = f; } void set_would_profile(bool f) { _would_profile = f; } void set_has_access_indexed(bool f) { _has_access_indexed = f; } // Add a set of exception handlers covering the given PC offset diff --git a/src/hotspot/share/c1/c1_GraphBuilder.cpp b/src/hotspot/share/c1/c1_GraphBuilder.cpp index f90143e01db..6bb39e38f69 100644 --- a/src/hotspot/share/c1/c1_GraphBuilder.cpp +++ b/src/hotspot/share/c1/c1_GraphBuilder.cpp @@ -59,7 +59,7 @@ class BlockListBuilder { // fields used by mark_loops ResourceBitMap _active; // for iteration of control flow graph ResourceBitMap _visited; // for iteration of control flow graph - intArray _loop_map; // caches the information if a block is contained in a loop + GrowableArray _loop_map; // caches the information if a block is contained in a loop int _next_loop_index; // next free loop number int _next_block_number; // for reverse postorder numbering of blocks @@ -84,7 +84,7 @@ class BlockListBuilder { void make_loop_header(BlockBegin* block); void mark_loops(); - int mark_loops(BlockBegin* b, bool in_subroutine); + BitMap& mark_loops(BlockBegin* b, bool in_subroutine); // debugging #ifndef PRODUCT @@ -376,17 +376,36 @@ void BlockListBuilder::mark_loops() { _active.initialize(BlockBegin::number_of_blocks()); _visited.initialize(BlockBegin::number_of_blocks()); - _loop_map = intArray(BlockBegin::number_of_blocks(), BlockBegin::number_of_blocks(), 0); + _loop_map = GrowableArray(BlockBegin::number_of_blocks(), BlockBegin::number_of_blocks(), ResourceBitMap()); + for (int i = 0; i < BlockBegin::number_of_blocks(); i++) { + _loop_map.at(i).initialize(BlockBegin::number_of_blocks()); + } _next_loop_index = 0; _next_block_number = _blocks.length(); - // recursively iterate the control flow graph - mark_loops(_bci2block->at(0), false); + // The loop detection algorithm works as follows: + // - We maintain the _loop_map, where for each block we have a bitmap indicating which loops contain this block. + // - The CFG is recursively traversed (depth-first) and if we detect a loop, we assign the loop a unique number that is stored + // in the bitmap associated with the loop header block. Until we return back through that loop header the bitmap contains + // only a single bit corresponding to the loop number. + // - The bit is then propagated for all the blocks in the loop after we exit them (post-order). There could be multiple bits + // of course in case of nested loops. + // - When we exit the loop header we remove that single bit and assign the real loop state for it. + // - Now, the tricky part here is how we detect irriducible loops. In the algorithm above the loop state bits + // are propagated to the predecessors. If we encounter an irreducible loop (a loop with multiple heads) we would see + // a node with some loop bit set that would then propagate back and be never cleared because we would + // never go back through the original loop header. Therefore if there are any irreducible loops the bits in the states + // for these loops are going to propagate back to the root. + BitMap& loop_state = mark_loops(_bci2block->at(0), false); + if (!loop_state.is_empty()) { + compilation()->set_has_irreducible_loops(true); + } assert(_next_block_number >= 0, "invalid block numbers"); // Remove dangling Resource pointers before the ResourceMark goes out-of-scope. _active.resize(0); _visited.resize(0); + _loop_map.clear(); } void BlockListBuilder::make_loop_header(BlockBegin* block) { @@ -398,19 +417,17 @@ void BlockListBuilder::make_loop_header(BlockBegin* block) { if (!block->is_set(BlockBegin::parser_loop_header_flag)) { block->set(BlockBegin::parser_loop_header_flag); - assert(_loop_map.at(block->block_id()) == 0, "must not be set yet"); - assert(0 <= _next_loop_index && _next_loop_index < BitsPerInt, "_next_loop_index is used as a bit-index in integer"); - _loop_map.at_put(block->block_id(), 1 << _next_loop_index); - if (_next_loop_index < 31) _next_loop_index++; + assert(_loop_map.at(block->block_id()).is_empty(), "must not be set yet"); + assert(0 <= _next_loop_index && _next_loop_index < BlockBegin::number_of_blocks(), "_next_loop_index is too large"); + _loop_map.at(block->block_id()).set_bit(_next_loop_index++); } else { // block already marked as loop header - assert(is_power_of_2((unsigned int)_loop_map.at(block->block_id())), "exactly one bit must be set"); + assert(_loop_map.at(block->block_id()).count_one_bits() == 1, "exactly one bit must be set"); } } -int BlockListBuilder::mark_loops(BlockBegin* block, bool in_subroutine) { +BitMap& BlockListBuilder::mark_loops(BlockBegin* block, bool in_subroutine) { int block_id = block->block_id(); - if (_visited.at(block_id)) { if (_active.at(block_id)) { // reached block via backward branch @@ -428,10 +445,11 @@ int BlockListBuilder::mark_loops(BlockBegin* block, bool in_subroutine) { _visited.set_bit(block_id); _active.set_bit(block_id); - intptr_t loop_state = 0; + ResourceMark rm; + ResourceBitMap loop_state(BlockBegin::number_of_blocks()); for (int i = number_of_successors(block) - 1; i >= 0; i--) { // recursively process all successors - loop_state |= mark_loops(successor_at(block, i), in_subroutine); + loop_state.set_union(mark_loops(successor_at(block, i), in_subroutine)); } // clear active-bit after all successors are processed @@ -441,26 +459,22 @@ int BlockListBuilder::mark_loops(BlockBegin* block, bool in_subroutine) { block->set_depth_first_number(_next_block_number); _next_block_number--; - if (loop_state != 0 || in_subroutine ) { + if (!loop_state.is_empty() || in_subroutine ) { // block is contained at least in one loop, so phi functions are necessary // phi functions are also necessary for all locals stored in a subroutine scope()->requires_phi_function().set_union(block->stores_to_locals()); } if (block->is_set(BlockBegin::parser_loop_header_flag)) { - int header_loop_state = _loop_map.at(block_id); - assert(is_power_of_2((unsigned)header_loop_state), "exactly one bit must be set"); - - // If the highest bit is set (i.e. when integer value is negative), the method - // has 32 or more loops. This bit is never cleared because it is used for multiple loops - if (header_loop_state >= 0) { - clear_bits(loop_state, header_loop_state); - } + BitMap& header_loop_state = _loop_map.at(block_id); + assert(header_loop_state.count_one_bits() == 1, "exactly one bit must be set"); + // remove the bit with the loop number for the state (header is outside of the loop) + loop_state.set_difference(header_loop_state); } // cache and return loop information for this block - _loop_map.at_put(block_id, loop_state); - return loop_state; + _loop_map.at(block_id).set_from(loop_state); + return _loop_map.at(block_id); } inline int BlockListBuilder::number_of_successors(BlockBegin* block) @@ -2496,7 +2510,7 @@ XHandlers* GraphBuilder::handle_exception(Instruction* instruction) { // The only test case we've seen so far which exhibits this // problem is caught by the infinite recursion test in // GraphBuilder::jsr() if the join doesn't work. - if (!entry->try_merge(cur_state)) { + if (!entry->try_merge(cur_state, compilation()->has_irreducible_loops())) { BAILOUT_("error while joining with exception handler, prob. due to complicated jsr/rets", exception_handlers); } @@ -2982,7 +2996,7 @@ BlockEnd* GraphBuilder::iterate_bytecodes_for_block(int bci) { BlockBegin* sux = end->sux_at(i); assert(sux->is_predecessor(block()), "predecessor missing"); // be careful, bailout if bytecodes are strange - if (!sux->try_merge(end->state())) BAILOUT_("block join failed", NULL); + if (!sux->try_merge(end->state(), compilation()->has_irreducible_loops())) BAILOUT_("block join failed", NULL); scope_data()->add_to_work_list(end->sux_at(i)); } @@ -3136,7 +3150,7 @@ BlockBegin* GraphBuilder::setup_start_block(int osr_bci, BlockBegin* std_entry, if (base->std_entry()->state() == NULL) { // setup states for header blocks - base->std_entry()->merge(state); + base->std_entry()->merge(state, compilation()->has_irreducible_loops()); } assert(base->std_entry()->state() != NULL, ""); @@ -3219,7 +3233,7 @@ void GraphBuilder::setup_osr_entry_block() { Goto* g = new Goto(target, false); append(g); _osr_entry->set_end(g); - target->merge(_osr_entry->end()->state()); + target->merge(_osr_entry->end()->state(), compilation()->has_irreducible_loops()); scope_data()->set_stream(NULL); } @@ -3278,7 +3292,7 @@ GraphBuilder::GraphBuilder(Compilation* compilation, IRScope* scope) // setup state for std entry _initial_state = state_at_entry(); - start_block->merge(_initial_state); + start_block->merge(_initial_state, compilation->has_irreducible_loops()); // End nulls still exist here @@ -4029,7 +4043,7 @@ bool GraphBuilder::try_inline_full(ciMethod* callee, bool holder_known, bool ign // the entry bci for the callee instead of the call site bci. append_with_bci(goto_callee, 0); _block->set_end(goto_callee); - callee_start_block->merge(callee_state); + callee_start_block->merge(callee_state, compilation()->has_irreducible_loops()); _last = _block = callee_start_block; diff --git a/src/hotspot/share/c1/c1_Instruction.cpp b/src/hotspot/share/c1/c1_Instruction.cpp index 4b66796a543..75cb0c2ccd6 100644 --- a/src/hotspot/share/c1/c1_Instruction.cpp +++ b/src/hotspot/share/c1/c1_Instruction.cpp @@ -719,7 +719,7 @@ void BlockBegin::block_values_do(ValueVisitor* f) { #endif -bool BlockBegin::try_merge(ValueStack* new_state) { +bool BlockBegin::try_merge(ValueStack* new_state, bool has_irreducible_loops) { TRACE_PHI(tty->print_cr("********** try_merge for block B%d", block_id())); // local variables used for state iteration @@ -760,10 +760,9 @@ bool BlockBegin::try_merge(ValueStack* new_state) { } BitMap& requires_phi_function = new_state->scope()->requires_phi_function(); - for_each_local_value(new_state, index, new_value) { bool requires_phi = requires_phi_function.at(index) || (new_value->type()->is_double_word() && requires_phi_function.at(index + 1)); - if (requires_phi || !SelectivePhiFunctions) { + if (requires_phi || !SelectivePhiFunctions || has_irreducible_loops) { new_state->setup_phi_for_local(this, index); TRACE_PHI(tty->print_cr("creating phi-function %c%d for local %d", new_state->local_at(index)->type()->tchar(), new_state->local_at(index)->id(), index)); } diff --git a/src/hotspot/share/c1/c1_Instruction.hpp b/src/hotspot/share/c1/c1_Instruction.hpp index a813121cf48..10bc7eb4fdf 100644 --- a/src/hotspot/share/c1/c1_Instruction.hpp +++ b/src/hotspot/share/c1/c1_Instruction.hpp @@ -1779,8 +1779,11 @@ LEAF(BlockBegin, StateSplit) int loop_index() const { return _loop_index; } // merging - bool try_merge(ValueStack* state); // try to merge states at block begin - void merge(ValueStack* state) { bool b = try_merge(state); assert(b, "merge failed"); } + bool try_merge(ValueStack* state, bool has_irreducible_loops); // try to merge states at block begin + void merge(ValueStack* state, bool has_irreducible_loops) { + bool b = try_merge(state, has_irreducible_loops); + assert(b, "merge failed"); + } // debugging void print_block() PRODUCT_RETURN; -- GitLab From b3837808bf13de2aa3d8c6c21cf61baac9baf2b2 Mon Sep 17 00:00:00 2001 From: Manukumar V S Date: Fri, 4 Mar 2022 10:56:11 +0000 Subject: [PATCH 147/340] 8282343: Create a regression test for JDK-4518432 Reviewed-by: aivanov --- .../JTree/4518432/JTreeNodeCopyPasteTest.java | 217 ++++++++++++++++++ 1 file changed, 217 insertions(+) create mode 100644 test/jdk/javax/swing/JTree/4518432/JTreeNodeCopyPasteTest.java diff --git a/test/jdk/javax/swing/JTree/4518432/JTreeNodeCopyPasteTest.java b/test/jdk/javax/swing/JTree/4518432/JTreeNodeCopyPasteTest.java new file mode 100644 index 00000000000..7ca69edfa22 --- /dev/null +++ b/test/jdk/javax/swing/JTree/4518432/JTreeNodeCopyPasteTest.java @@ -0,0 +1,217 @@ +/* + * Copyright (c) 2002, 2022, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Dimension; +import java.awt.Point; +import java.awt.Rectangle; +import java.awt.Robot; +import java.awt.event.InputEvent; +import java.awt.event.KeyEvent; +import java.util.Arrays; +import java.util.List; +import java.util.concurrent.atomic.AtomicBoolean; +import java.util.concurrent.atomic.AtomicReference; +import java.util.stream.Collectors; +import javax.swing.JFrame; +import javax.swing.JTree; +import javax.swing.SwingUtilities; +import javax.swing.UIManager; +import javax.swing.UIManager.LookAndFeelInfo; +import javax.swing.UnsupportedLookAndFeelException; + +import static javax.swing.UIManager.getInstalledLookAndFeels; + +/* + * @test + * @key headful + * @bug 4518432 + * @summary Verifies that Copying from JTree node and then changing the data in the component that was copied from, + * is not causing the pastes to use the new edited data instead of the original copied data. + * @run main JTreeNodeCopyPasteTest + */ +public class JTreeNodeCopyPasteTest { + + private static JFrame frame; + private static JTree tree; + private static Robot robot; + private static boolean isMac; + + public static void main(String[] args) throws Exception { + runTest(); + } + + private static void runTest() throws Exception { + isMac = System.getProperty("os.name").toLowerCase().contains("os x"); + robot = new Robot(); + robot.setAutoDelay(100); + robot.setAutoWaitForIdle(true); + + // Filter out Motif laf, as it doesn't support copy-paste in JTree. + List lafs = Arrays.stream(getInstalledLookAndFeels()) + .filter(laf -> !laf.getName().contains("Motif")) + .map(LookAndFeelInfo::getClassName) + .collect(Collectors.toList()); + for (final String laf : lafs) { + try { + AtomicBoolean lafSetSuccess = new AtomicBoolean(false); + SwingUtilities.invokeAndWait(() -> { + lafSetSuccess.set(setLookAndFeel(laf)); + if (lafSetSuccess.get()) { + createUI(); + } + }); + if (!lafSetSuccess.get()) { + continue; + } + + robot.waitForIdle(); + + // Select the node named as 'colors' + Point pt = getNodeLocation(1); + robot.mouseMove(pt.x, pt.y); + robot.mousePress(InputEvent.BUTTON1_DOWN_MASK); + robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); + + String expectedNodeName = getCurrentNodeName(); + + // Copy the contents of that node + copyOrPaste(KeyEvent.VK_C, laf); + + // Edit the Contents of that cell + mouseTripleClick(); + + typeSomeText(); + + robot.keyPress(KeyEvent.VK_ENTER); + robot.keyRelease(KeyEvent.VK_ENTER); + + // Select next node + pt = getNodeLocation(2); + robot.mouseMove(pt.x, pt.y); + + // Edit the Contents of that cell + mouseTripleClick(); + + // paste the content copied earlier + copyOrPaste(KeyEvent.VK_V, laf); + + robot.keyPress(KeyEvent.VK_ENTER); + robot.keyRelease(KeyEvent.VK_ENTER); + + // Now get the node contents of second node + String actualNodeName = getCurrentNodeName(); + + if (expectedNodeName.equals(actualNodeName)) { + System.out.println("Test Passed in " + laf); + } else { + throw new RuntimeException("Test Failed in " + laf + ", Expected : " + expectedNodeName + + ", but actual : " + actualNodeName); + } + } finally { + SwingUtilities.invokeAndWait(JTreeNodeCopyPasteTest::disposeFrame); + } + } + } + + private static String getCurrentNodeName() throws Exception { + AtomicReference nodeName = new AtomicReference<>(); + SwingUtilities.invokeAndWait(() -> { + nodeName.set(tree.getLastSelectedPathComponent().toString().trim()); + }); + return nodeName.get(); + } + + private static Point getNodeLocation(int rowCount) throws Exception { + AtomicReference treeNodeLoc = new AtomicReference<>(); + SwingUtilities.invokeAndWait(() -> { + final Point locationOnScreen = tree.getLocationOnScreen(); + Rectangle rt = tree.getPathBounds(tree.getPathForRow(rowCount)); + locationOnScreen.translate((int) (rt.getX() + rt.getWidth() / 2), (int) (rt.getY() + rt.getHeight() / 2)); + treeNodeLoc.set(locationOnScreen); + }); + return treeNodeLoc.get(); + } + + private static void copyOrPaste(int keyCode, String laf) { + // For AquaLookAndFeel in Mac, the key combination for copy/paste is META + (C or V) + // For other OSes and other lafs, the key combination is CONTROL + (C or V) + robot.keyPress(isMac && laf.contains("Aqua") ? KeyEvent.VK_META : KeyEvent.VK_CONTROL); + robot.keyPress(keyCode); + robot.keyRelease(keyCode); + robot.keyRelease(isMac && laf.contains("Aqua") ? KeyEvent.VK_META : KeyEvent.VK_CONTROL); + } + + private static void mouseTripleClick() { + robot.mousePress(InputEvent.BUTTON1_DOWN_MASK); + robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); + robot.mousePress(InputEvent.BUTTON1_DOWN_MASK); + robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); + robot.mousePress(InputEvent.BUTTON1_DOWN_MASK); + robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); + } + + private static void typeSomeText() { + robot.keyPress(KeyEvent.VK_T); + robot.keyRelease(KeyEvent.VK_T); + robot.keyPress(KeyEvent.VK_E); + robot.keyRelease(KeyEvent.VK_E); + robot.keyPress(KeyEvent.VK_X); + robot.keyRelease(KeyEvent.VK_X); + robot.keyPress(KeyEvent.VK_T); + robot.keyRelease(KeyEvent.VK_T); + } + + private static void createUI() { + frame = new JFrame(); + tree = new JTree(); + tree.setEditable(true); + frame.setContentPane(tree); + frame.setSize(new Dimension(200, 200)); + frame.setAlwaysOnTop(true); + frame.setLocationRelativeTo(null); + frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); + frame.toFront(); + frame.setVisible(true); + } + + private static boolean setLookAndFeel(String lafName) { + try { + UIManager.setLookAndFeel(lafName); + } catch (UnsupportedLookAndFeelException ignored) { + System.out.println("Ignoring Unsupported laf : " + lafName); + return false; + } catch (ClassNotFoundException | InstantiationException + | IllegalAccessException e) { + throw new RuntimeException(e); + } + return true; + } + + private static void disposeFrame() { + if (frame != null) { + frame.dispose(); + frame = null; + } + } + +} -- GitLab From d5e8e52f02413e02200701fe8dab7a5c6ab5c77b Mon Sep 17 00:00:00 2001 From: Julian Waters Date: Fri, 4 Mar 2022 12:42:07 +0000 Subject: [PATCH 148/340] 8282532: Allow explicitly setting build platform alongside --openjdk-target Reviewed-by: ihse --- doc/building.html | 7 +++++-- doc/building.md | 17 +++++++++++------ make/autoconf/configure | 35 ++++++++++++++++++++++------------- 3 files changed, 38 insertions(+), 21 deletions(-) diff --git a/doc/building.html b/doc/building.html index 9cb1807345c..cbc7edd7e10 100644 --- a/doc/building.html +++ b/doc/building.html @@ -163,6 +163,8 @@

Building on aarch64

At a minimum, a machine with 8 cores is advisable, as well as 8 GB of RAM. (The more cores to use, the more memory you need.) At least 6 GB of free disk space is required.

+

Branch Protection

+

In order to use Branch Protection features in the VM, --enable-branch-protection must be used. This option requires C++ compiler support (GCC 9.1.0+ or Clang 10+). The resulting build can be run on both machines with and without support for branch protection in hardware. Branch Protection is only supported for Linux targets.

Building on 32-bit arm

This is not recommended. Instead, see the section on Cross-compiling.

Operating System Requirements

@@ -214,7 +216,7 @@

Unfortunately, Cygwin can be unreliable in certain circumstances. If you experience build tool crashes or strange issues when building on Windows, please check the Cygwin FAQ on the "BLODA" list and the section on fork() failures.

Windows Subsystem for Linux (WSL)

Windows 10 1809 or newer is supported due to a dependency on the wslpath utility and support for environment variable sharing through WSLENV. Version 1803 can work but intermittent build failures have been observed.

-

It's possible to build both Windows and Linux binaries from WSL. To build Windows binaries, you must use a Windows boot JDK (located in a Windows-accessible directory). To build Linux binaries, you must use a Linux boot JDK. The default behavior is to build for Windows. To build for Linux, pass --build=x86_64-unknown-linux-gnu --host=x86_64-unknown-linux-gnu to configure.

+

It's possible to build both Windows and Linux binaries from WSL. To build Windows binaries, you must use a Windows boot JDK (located in a Windows-accessible directory). To build Linux binaries, you must use a Linux boot JDK. The default behavior is to build for Windows. To build for Linux, pass --build=x86_64-unknown-linux-gnu --openjdk-target=x86_64-unknown-linux-gnu to configure.

If building Windows binaries, the source code must be located in a Windows- accessible directory. This is because Windows executables (such as Visual Studio and the boot JDK) must be able to access the source code. Also, the drive where the source is stored must be mounted as case-insensitive by changing either /etc/fstab or /etc/wsl.conf in WSL. Individual directories may be corrected using the fsutil tool in case the source was cloned before changing the mount options.

Note that while it's possible to build on WSL, testing is still not fully supported.

macOS

@@ -568,7 +570,8 @@ x86_64-linux-gnu-to-ppc64le-linux-gnu

To be able to build, we need a "Build JDK", which is a JDK built from the current sources (that is, the same as the end result of the entire build process), but able to run on the build system, and not the target system. (In contrast, the Boot JDK should be from an older release, e.g. JDK 8 when building JDK 9.)

The build process will create a minimal Build JDK for you, as part of building. To speed up the build, you can use --with-build-jdk to configure to point to a pre-built Build JDK. Please note that the build result is unpredictable, and can possibly break in subtle ways, if the Build JDK does not exactly match the current sources.

Specifying the Target Platform

-

You must specify the target platform when cross-compiling. Doing so will also automatically turn the build into a cross-compiling mode. The simplest way to do this is to use the --openjdk-target argument, e.g. --openjdk-target=arm-linux-gnueabihf. or --openjdk-target=aarch64-oe-linux. This will automatically set the --build, --host and --target options for autoconf, which can otherwise be confusing. (In autoconf terminology, the "target" is known as "host", and "target" is used for building a Canadian cross-compiler.)

+

You must specify the target platform when cross-compiling. Doing so will also automatically turn the build into a cross-compiling mode. The simplest way to do this is to use the --openjdk-target argument, e.g. --openjdk-target=arm-linux-gnueabihf. or --openjdk-target=aarch64-oe-linux. This will automatically set the --host and --target options for autoconf, which can otherwise be confusing. (In autoconf terminology, the "target" is known as "host", and "target" is used for building a Canadian cross-compiler.)

+

If --build has not been explicitly passed to configure, --openjdk-target will autodetect the build platform and internally set the flag automatically, otherwise the platform that was explicitly passed to --build will be used instead.

Toolchain Considerations

You will need two copies of your toolchain, one which generates output that can run on the target system (the normal, or target, toolchain), and one that generates output that can run on the build system (the build toolchain). Note that cross-compiling is only supported for gcc at the time being. The gcc standard is to prefix cross-compiling toolchains with the target denominator. If you follow this standard, configure is likely to pick up the toolchain correctly.

The build toolchain will be autodetected just the same way the normal build/target toolchain will be autodetected when not cross-compiling. If this is not what you want, or if the autodetection fails, you can specify a devkit containing the build toolchain using --with-build-devkit to configure, or by giving BUILD_CC and BUILD_CXX arguments.

diff --git a/doc/building.md b/doc/building.md index 9e6687f6b81..f71e4e2e730 100644 --- a/doc/building.md +++ b/doc/building.md @@ -244,8 +244,8 @@ It's possible to build both Windows and Linux binaries from WSL. To build Windows binaries, you must use a Windows boot JDK (located in a Windows-accessible directory). To build Linux binaries, you must use a Linux boot JDK. The default behavior is to build for Windows. To build for Linux, pass -`--build=x86_64-unknown-linux-gnu --host=x86_64-unknown-linux-gnu` to -`configure`. +`--build=x86_64-unknown-linux-gnu --openjdk-target=x86_64-unknown-linux-gnu` +to `configure`. If building Windows binaries, the source code must be located in a Windows- accessible directory. This is because Windows executables (such as Visual Studio @@ -382,9 +382,9 @@ available for this update. ### Microsoft Visual Studio -For aarch64 machines running Windows the minimum accepted version is Visual Studio 2019 -(16.8 or higher). For all other platforms the minimum accepted version of -Visual Studio is 2017. Older versions will not be accepted by `configure` and will +For aarch64 machines running Windows the minimum accepted version is Visual Studio 2019 +(16.8 or higher). For all other platforms the minimum accepted version of +Visual Studio is 2017. Older versions will not be accepted by `configure` and will not work. For all platforms the maximum accepted version of Visual Studio is 2022. If you have multiple versions of Visual Studio installed, `configure` will by @@ -986,11 +986,16 @@ You *must* specify the target platform when cross-compiling. Doing so will also automatically turn the build into a cross-compiling mode. The simplest way to do this is to use the `--openjdk-target` argument, e.g. `--openjdk-target=arm-linux-gnueabihf`. or `--openjdk-target=aarch64-oe-linux`. -This will automatically set the `--build`, `--host` and `--target` options for +This will automatically set the `--host` and `--target` options for autoconf, which can otherwise be confusing. (In autoconf terminology, the "target" is known as "host", and "target" is used for building a Canadian cross-compiler.) +If `--build` has not been explicitly passed to configure, `--openjdk-target` +will autodetect the build platform and internally set the flag automatically, +otherwise the platform that was explicitly passed to `--build` will be used +instead. + ### Toolchain Considerations You will need two copies of your toolchain, one which generates output that can diff --git a/make/autoconf/configure b/make/autoconf/configure index 7e0ece129f4..4b26e3d7061 100644 --- a/make/autoconf/configure +++ b/make/autoconf/configure @@ -274,11 +274,11 @@ do # Check for certain autoconf options that require extra action case $conf_option in -build | --build | --buil | --bui | --bu |-build=* | --build=* | --buil=* | --bui=* | --bu=*) - conf_legacy_crosscompile="$conf_legacy_crosscompile $conf_option" ;; + conf_build_set=true ;; -target | --target | --targe | --targ | --tar | --ta | --t | -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) - conf_legacy_crosscompile="$conf_legacy_crosscompile $conf_option" ;; + conf_incompatible_crosscompile="$conf_incompatible_crosscompile $conf_option" ;; -host | --host | --hos | --ho | -host=* | --host=* | --hos=* | --ho=*) - conf_legacy_crosscompile="$conf_legacy_crosscompile $conf_option" ;; + conf_incompatible_crosscompile="$conf_incompatible_crosscompile $conf_option" ;; -help | --help | --hel | --he | -h) conf_print_help=true ;; esac @@ -287,23 +287,30 @@ done # Save the quoted command line CONFIGURE_COMMAND_LINE="${conf_quoted_arguments[@]}" -if test "x$conf_legacy_crosscompile" != "x"; then +if test "x$conf_incompatible_crosscompile" != "x"; then if test "x$conf_openjdk_target" != "x"; then - echo "Error: Specifying --openjdk-target together with autoconf" - echo "legacy cross-compilation flags is not supported." - echo "You specified: --openjdk-target=$conf_openjdk_target and $conf_legacy_crosscompile." - echo "The recommended use is just --openjdk-target." + echo "Error: --openjdk-target was specified together with" + echo "incompatible autoconf cross-compilation flags." + echo "You specified: --openjdk-target=$conf_openjdk_target and $conf_incompatible_crosscompile." + echo "It is recommended that you only use --openjdk-target." exit 1 else - echo "Warning: You are using legacy autoconf cross-compilation flags." - echo "It is recommended that you use --openjdk-target instead." + echo "Warning: You are using misleading autoconf cross-compilation flag(s)." + echo "This is not encouraged as use of such flags during building can" + echo "quickly become confusing." + echo "It is highly recommended that you use --openjdk-target instead." echo "" fi fi if test "x$conf_openjdk_target" != "x"; then - conf_build_platform=`sh $conf_script_dir/build-aux/config.guess` - conf_processed_arguments=("--build=$conf_build_platform" "--host=$conf_openjdk_target" "--target=$conf_openjdk_target" "${conf_processed_arguments[@]}") + conf_processed_arguments=("--host=$conf_openjdk_target" "--target=$conf_openjdk_target" "${conf_processed_arguments[@]}") + + # If --build has been explicitly set don't override that flag with our own + if test "x$conf_build_set" != xtrue; then + conf_build_platform=`sh $conf_script_dir/build-aux/config.guess` + conf_processed_arguments=("--build=$conf_build_platform" "${conf_processed_arguments[@]}") + fi fi # Make configure exit with error on invalid options as default. @@ -341,7 +348,9 @@ Additional (non-autoconf) OpenJDK Options: --openjdk-target=TARGET cross-compile with TARGET as target platform (i.e. the one you will run the resulting binary on). Equivalent to --host=TARGET --target=TARGET - --build= + --build=, or the platform you + have provided if you have explicitly passed + --build to configure --debug-configure Run the configure script with additional debug logging enabled. -- GitLab From a584c904a9e386d7ce80fb9cc6d49fece065d3da Mon Sep 17 00:00:00 2001 From: Emanuel Peter Date: Fri, 4 Mar 2022 12:55:57 +0000 Subject: [PATCH 149/340] 8282573: ByteBufferTest.java: replace endless recursion with RuntimeException in void ck(double x, double y) Reviewed-by: psandoz, thartmann --- .../jtreg/compiler/intrinsics/unsafe/ByteBufferTest.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/test/hotspot/jtreg/compiler/intrinsics/unsafe/ByteBufferTest.java b/test/hotspot/jtreg/compiler/intrinsics/unsafe/ByteBufferTest.java index 6294e90a8a9..18695062056 100644 --- a/test/hotspot/jtreg/compiler/intrinsics/unsafe/ByteBufferTest.java +++ b/test/hotspot/jtreg/compiler/intrinsics/unsafe/ByteBufferTest.java @@ -216,8 +216,10 @@ class MyByteBuffer { } void ck(double x, double y) { - if (x == x && y == y && x != y) { - ck(x, y); + if (x != y) { + throw new RuntimeException(" x = " + Double.toString(x) + ", y = " + Double.toString(y) + + " (x = " + Long.toHexString(Double.doubleToRawLongBits(x)) + + ", y = " + Long.toHexString(Double.doubleToRawLongBits(y)) + ")"); } } -- GitLab From 52471539c002e38a5c815045913458776381d369 Mon Sep 17 00:00:00 2001 From: Thomas Schatzl Date: Fri, 4 Mar 2022 13:40:57 +0000 Subject: [PATCH 150/340] 8282615: G1: Fix some includes Reviewed-by: ayang, iwalulya --- src/hotspot/share/gc/g1/g1CardSetContainers.hpp | 2 +- src/hotspot/share/gc/g1/g1CardSetContainers.inline.hpp | 1 + src/hotspot/share/gc/g1/g1CollectedHeap.hpp | 1 + src/hotspot/share/gc/g1/g1EvacFailureRegions.cpp | 1 + 4 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/hotspot/share/gc/g1/g1CardSetContainers.hpp b/src/hotspot/share/gc/g1/g1CardSetContainers.hpp index b74a68c84ae..4f861baf4eb 100644 --- a/src/hotspot/share/gc/g1/g1CardSetContainers.hpp +++ b/src/hotspot/share/gc/g1/g1CardSetContainers.hpp @@ -28,7 +28,7 @@ #include "gc/g1/g1CardSet.hpp" #include "memory/allocation.hpp" #include "runtime/atomic.hpp" -#include "utilities/bitMap.inline.hpp" +#include "utilities/bitMap.hpp" #include "utilities/globalDefinitions.hpp" #include "utilities/spinYield.hpp" diff --git a/src/hotspot/share/gc/g1/g1CardSetContainers.inline.hpp b/src/hotspot/share/gc/g1/g1CardSetContainers.inline.hpp index df0e43f0d84..13e70302b02 100644 --- a/src/hotspot/share/gc/g1/g1CardSetContainers.inline.hpp +++ b/src/hotspot/share/gc/g1/g1CardSetContainers.inline.hpp @@ -27,6 +27,7 @@ #include "gc/g1/g1CardSetContainers.hpp" #include "gc/g1/g1GCPhaseTimes.hpp" +#include "utilities/bitMap.inline.hpp" #include "utilities/globalDefinitions.hpp" inline G1CardSetInlinePtr::CardSetPtr G1CardSetInlinePtr::merge(CardSetPtr orig_value, uint card_in_region, uint idx, uint bits_per_card) { diff --git a/src/hotspot/share/gc/g1/g1CollectedHeap.hpp b/src/hotspot/share/gc/g1/g1CollectedHeap.hpp index 90a4dd05b21..1fad936447d 100644 --- a/src/hotspot/share/gc/g1/g1CollectedHeap.hpp +++ b/src/hotspot/share/gc/g1/g1CollectedHeap.hpp @@ -28,6 +28,7 @@ #include "gc/g1/g1BarrierSet.hpp" #include "gc/g1/g1BiasedArray.hpp" #include "gc/g1/g1CardTable.hpp" +#include "gc/g1/g1CardSet.hpp" #include "gc/g1/g1CollectionSet.hpp" #include "gc/g1/g1CollectorState.hpp" #include "gc/g1/g1ConcurrentMark.hpp" diff --git a/src/hotspot/share/gc/g1/g1EvacFailureRegions.cpp b/src/hotspot/share/gc/g1/g1EvacFailureRegions.cpp index 855c549cd04..a67fb06a333 100644 --- a/src/hotspot/share/gc/g1/g1EvacFailureRegions.cpp +++ b/src/hotspot/share/gc/g1/g1EvacFailureRegions.cpp @@ -29,6 +29,7 @@ #include "gc/g1/heapRegion.hpp" #include "memory/allocation.hpp" #include "runtime/atomic.hpp" +#include "utilities/bitMap.inline.hpp" G1EvacFailureRegions::G1EvacFailureRegions() : _regions_failed_evacuation(mtGC), -- GitLab From 603050bfe00d7a0185d84acab2a24a803aa86f82 Mon Sep 17 00:00:00 2001 From: Emanuel Peter Date: Fri, 4 Mar 2022 16:26:14 +0000 Subject: [PATCH 151/340] 8282661: [BACKOUT] ByteBufferTest.java: replace endless recursion with RuntimeException in void ck(double x, double y) Reviewed-by: chagedorn, psandoz --- .../jtreg/compiler/intrinsics/unsafe/ByteBufferTest.java | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/test/hotspot/jtreg/compiler/intrinsics/unsafe/ByteBufferTest.java b/test/hotspot/jtreg/compiler/intrinsics/unsafe/ByteBufferTest.java index 18695062056..6294e90a8a9 100644 --- a/test/hotspot/jtreg/compiler/intrinsics/unsafe/ByteBufferTest.java +++ b/test/hotspot/jtreg/compiler/intrinsics/unsafe/ByteBufferTest.java @@ -216,10 +216,8 @@ class MyByteBuffer { } void ck(double x, double y) { - if (x != y) { - throw new RuntimeException(" x = " + Double.toString(x) + ", y = " + Double.toString(y) - + " (x = " + Long.toHexString(Double.doubleToRawLongBits(x)) - + ", y = " + Long.toHexString(Double.doubleToRawLongBits(y)) + ")"); + if (x == x && y == y && x != y) { + ck(x, y); } } -- GitLab From f9f9c0a8552f6815b22893e8984edb58991d4554 Mon Sep 17 00:00:00 2001 From: Magnus Ihse Bursie Date: Fri, 4 Mar 2022 16:32:58 +0000 Subject: [PATCH 152/340] 8252769: Warn in configure if git config autocrlf has invalid value Reviewed-by: erikj --- make/autoconf/basic_tools.m4 | 2 +- make/autoconf/basic_windows.m4 | 12 +++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/make/autoconf/basic_tools.m4 b/make/autoconf/basic_tools.m4 index 9ce90303d45..1611e9fd531 100644 --- a/make/autoconf/basic_tools.m4 +++ b/make/autoconf/basic_tools.m4 @@ -80,6 +80,7 @@ AC_DEFUN_ONCE([BASIC_SETUP_FUNDAMENTAL_TOOLS], # Optional tools, we can do without them UTIL_LOOKUP_PROGS(DF, df) + UTIL_LOOKUP_PROGS(GIT, git) UTIL_LOOKUP_PROGS(NICE, nice) UTIL_LOOKUP_PROGS(READLINK, greadlink readlink) @@ -339,7 +340,6 @@ AC_DEFUN_ONCE([BASIC_SETUP_COMPLEX_TOOLS], UTIL_LOOKUP_PROGS(READELF, greadelf readelf) UTIL_LOOKUP_PROGS(DOT, dot) UTIL_LOOKUP_PROGS(HG, hg) - UTIL_LOOKUP_PROGS(GIT, git) UTIL_LOOKUP_PROGS(STAT, stat) UTIL_LOOKUP_PROGS(TIME, time) UTIL_LOOKUP_PROGS(FLOCK, flock) diff --git a/make/autoconf/basic_windows.m4 b/make/autoconf/basic_windows.m4 index 25d10d9b8fe..fb6fc526bfa 100644 --- a/make/autoconf/basic_windows.m4 +++ b/make/autoconf/basic_windows.m4 @@ -1,5 +1,5 @@ # -# Copyright (c) 2011, 2021, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2011, 2022, 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 @@ -185,6 +185,16 @@ AC_DEFUN([BASIC_SETUP_PATHS_WINDOWS], AC_MSG_RESULT([unknown]) AC_MSG_WARN([It seems that your find utility is non-standard.]) fi + + if test "x$GIT" != x && test -e $TOPDIR/.git; then + git_autocrlf=`$GIT config core.autocrlf` + if test "x$git_autocrlf" != x && test "x$git_autocrlf" != "xfalse"; then + AC_MSG_NOTICE([Your git configuration does not set core.autocrlf to false.]) + AC_MSG_NOTICE([If you checked out this code using that setting, the build WILL fail.]) + AC_MSG_NOTICE([To correct, run "git config --global core.autocrlf false" and re-clone the repo.]) + AC_MSG_WARN([Code is potentially incorrectly cloned. HIGH RISK of build failure!]) + fi + fi ]) # Verify that the directory is usable on Windows -- GitLab From 733c7907b0059cc734fd1aa5b8d31f9c3e2e3079 Mon Sep 17 00:00:00 2001 From: Naoto Sato Date: Fri, 4 Mar 2022 16:57:54 +0000 Subject: [PATCH 153/340] 8282081: java.time.DateTimeFormatter: wrong definition of symbol F Reviewed-by: joehw, scolebourne, lancea, rriggs --- .../share/classes/java/time/format/DateTimeFormatter.java | 2 +- .../classes/java/time/format/DateTimeFormatterBuilder.java | 4 ++-- .../test/java/time/format/TestDateTimeFormatterBuilder.java | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/java.base/share/classes/java/time/format/DateTimeFormatter.java b/src/java.base/share/classes/java/time/format/DateTimeFormatter.java index 449be4ed758..d5a5c162fd2 100644 --- a/src/java.base/share/classes/java/time/format/DateTimeFormatter.java +++ b/src/java.base/share/classes/java/time/format/DateTimeFormatter.java @@ -297,7 +297,7 @@ import sun.util.locale.provider.TimeZoneNameUtility; * W week-of-month number 4 * E day-of-week text Tue; Tuesday; T * e/c localized day-of-week number/text 2; 02; Tue; Tuesday; T - * F day-of-week-in-month number 3 + * F aligned-week-of-month number 3 * * a am-pm-of-day text PM * B period-of-day text in the morning diff --git a/src/java.base/share/classes/java/time/format/DateTimeFormatterBuilder.java b/src/java.base/share/classes/java/time/format/DateTimeFormatterBuilder.java index 62ea488ede7..d45bfa03f91 100644 --- a/src/java.base/share/classes/java/time/format/DateTimeFormatterBuilder.java +++ b/src/java.base/share/classes/java/time/format/DateTimeFormatterBuilder.java @@ -1774,7 +1774,7 @@ public final class DateTimeFormatterBuilder { * D 1 appendValue(ChronoField.DAY_OF_YEAR) * DD 2 appendValue(ChronoField.DAY_OF_YEAR, 2, 3, SignStyle.NOT_NEGATIVE) * DDD 3 appendValue(ChronoField.DAY_OF_YEAR, 3) - * F 1 appendValue(ChronoField.ALIGNED_DAY_OF_WEEK_IN_MONTH) + * F 1 appendValue(ChronoField.ALIGNED_WEEK_OF_MONTH) * g..g 1..n appendValue(JulianFields.MODIFIED_JULIAN_DAY, n, 19, SignStyle.NORMAL) * E 1 appendText(ChronoField.DAY_OF_WEEK, TextStyle.SHORT) * EE 2 appendText(ChronoField.DAY_OF_WEEK, TextStyle.SHORT) @@ -2183,7 +2183,7 @@ public final class DateTimeFormatterBuilder { FIELD_MAP.put('L', ChronoField.MONTH_OF_YEAR); // SDF, LDML (stand-alone) FIELD_MAP.put('D', ChronoField.DAY_OF_YEAR); // SDF, LDML FIELD_MAP.put('d', ChronoField.DAY_OF_MONTH); // SDF, LDML - FIELD_MAP.put('F', ChronoField.ALIGNED_DAY_OF_WEEK_IN_MONTH); // SDF, LDML + FIELD_MAP.put('F', ChronoField.ALIGNED_WEEK_OF_MONTH); // SDF, LDML FIELD_MAP.put('E', ChronoField.DAY_OF_WEEK); // SDF, LDML (different to both for 1/2 chars) FIELD_MAP.put('c', ChronoField.DAY_OF_WEEK); // LDML (stand-alone) FIELD_MAP.put('e', ChronoField.DAY_OF_WEEK); // LDML (needs localized week number) diff --git a/test/jdk/java/time/test/java/time/format/TestDateTimeFormatterBuilder.java b/test/jdk/java/time/test/java/time/format/TestDateTimeFormatterBuilder.java index 6dd54ad6880..567b331b004 100644 --- a/test/jdk/java/time/test/java/time/format/TestDateTimeFormatterBuilder.java +++ b/test/jdk/java/time/test/java/time/format/TestDateTimeFormatterBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2022, 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 @@ -1051,7 +1051,7 @@ public class TestDateTimeFormatterBuilder { {"d", "Value(DayOfMonth)"}, {"dd", "Value(DayOfMonth,2)"}, - {"F", "Value(AlignedDayOfWeekInMonth)"}, + {"F", "Value(AlignedWeekOfMonth)"}, {"Q", "Value(QuarterOfYear)"}, {"QQ", "Value(QuarterOfYear,2)"}, -- GitLab From 9c817d38806708f84139e3180ac86a3805dcce5f Mon Sep 17 00:00:00 2001 From: Damon Nguyen Date: Fri, 4 Mar 2022 19:26:12 +0000 Subject: [PATCH 154/340] 8015854: [macosx] JButton's HTML ImageView adding unwanted padding Reviewed-by: psadhukhan, aivanov --- .../classes/com/apple/laf/AquaButtonUI.java | 11 +- .../HtmlButtonImageTest.java | 115 ++++++++++++++++++ 2 files changed, 124 insertions(+), 2 deletions(-) create mode 100644 test/jdk/javax/swing/JButton/HtmlButtonImageTest/HtmlButtonImageTest.java diff --git a/src/java.desktop/macosx/classes/com/apple/laf/AquaButtonUI.java b/src/java.desktop/macosx/classes/com/apple/laf/AquaButtonUI.java index 38f409f81fd..1ed74c0d9b0 100644 --- a/src/java.desktop/macosx/classes/com/apple/laf/AquaButtonUI.java +++ b/src/java.desktop/macosx/classes/com/apple/laf/AquaButtonUI.java @@ -305,7 +305,15 @@ public class AquaButtonUI extends BasicButtonUI implements Sizeable { } // performs icon and text rect calculations - final String text = layoutAndGetText(g, b, aquaBorder, i, viewRect, iconRect, textRect); + final String text; + final View v = (View)c.getClientProperty(BasicHTML.propertyKey); + if (v != null) { + // use zero insets for view since layout only handles text calculations + text = layoutAndGetText(g, b, aquaBorder, new Insets(0,0,0,0), + viewRect, iconRect, textRect); + } else { + text = layoutAndGetText(g, b, aquaBorder, i, viewRect, iconRect, textRect); + } // Paint the Icon if (b.getIcon() != null) { @@ -317,7 +325,6 @@ public class AquaButtonUI extends BasicButtonUI implements Sizeable { } if (text != null && !text.isEmpty()) { - final View v = (View)c.getClientProperty(BasicHTML.propertyKey); if (v != null) { v.paint(g, textRect); } else { diff --git a/test/jdk/javax/swing/JButton/HtmlButtonImageTest/HtmlButtonImageTest.java b/test/jdk/javax/swing/JButton/HtmlButtonImageTest/HtmlButtonImageTest.java new file mode 100644 index 00000000000..b7fed2cff03 --- /dev/null +++ b/test/jdk/javax/swing/JButton/HtmlButtonImageTest/HtmlButtonImageTest.java @@ -0,0 +1,115 @@ +/* + * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. +*/ + +/* + * @test + * @bug 8015854 + * @requires (os.family == "mac") + * @summary Tests HTML image as JButton text for unwanted padding on macOS Aqua LAF + * @run main HtmlButtonImageTest + */ + +import java.awt.Color; +import java.awt.Dimension; +import java.awt.Graphics2D; +import java.awt.image.BufferedImage; +import java.io.File; +import java.io.IOException; +import java.nio.file.Path; + +import javax.imageio.ImageIO; +import javax.swing.JButton; +import javax.swing.SwingUtilities; +import javax.swing.UIManager; + +import static java.awt.image.BufferedImage.TYPE_INT_ARGB; + +public final class HtmlButtonImageTest { + private static JButton button; + private static Path testDir; + private static BufferedImage image; + + private static final int BUTTON_HEIGHT = 37; + private static final int BUTTON_WIDTH = 37; + private static final int SQUARE_HEIGHT = 19; + private static final int SQUARE_WIDTH = 19; + private static final int centerX = BUTTON_WIDTH / 2; + private static final int centerY = BUTTON_HEIGHT / 2; + private static final int minX = centerX - (SQUARE_WIDTH / 2); + private static final int minY = centerY - (SQUARE_HEIGHT / 2); + private static final int maxX = centerX + (SQUARE_WIDTH / 2); + private static final int maxY = centerY + (SQUARE_HEIGHT / 2); + + public static void main(String[] args) throws Exception { + UIManager.setLookAndFeel("com.apple.laf.AquaLookAndFeel"); + testDir = Path.of(System.getProperty("test.classes", ".")); + generateRedSquare(); + + SwingUtilities.invokeAndWait(HtmlButtonImageTest::createButton); + SwingUtilities.invokeAndWait(HtmlButtonImageTest::paintButton); + + testImageCentering(image.getRGB(centerX, centerY), + image.getRGB(minX, minY), + image.getRGB(minX, maxY), + image.getRGB(maxX, minY), + image.getRGB(maxX, maxY)); + } + + private static void generateRedSquare() throws IOException { + BufferedImage bImg = new BufferedImage(SQUARE_WIDTH, SQUARE_HEIGHT, + TYPE_INT_ARGB); + Graphics2D cg = bImg.createGraphics(); + cg.setColor(Color.RED); + cg.fillRect(0, 0, SQUARE_WIDTH, SQUARE_HEIGHT); + ImageIO.write(bImg, "png", new File(testDir + "/red_square.png")); + } + + private static void createButton() { + button = new JButton(); + button.setSize(new Dimension(BUTTON_WIDTH, BUTTON_HEIGHT)); + button.setText(""); + } + + private static void paintButton() { + image = new BufferedImage(BUTTON_HEIGHT, BUTTON_WIDTH, TYPE_INT_ARGB); + Graphics2D graphics2D = image.createGraphics(); + button.paint(graphics2D); + graphics2D.dispose(); + } + + private static boolean checkRedColor(int rgb) { + return (rgb == Color.RED.getRGB()); + } + + private static void testImageCentering(int... colors) throws IOException { + for (int c : colors) { + if (!checkRedColor(c)) { + ImageIO.write(image, "png", + new File(testDir + "/fail_image.png")); + throw new RuntimeException("HTML image not centered in button"); + } + } + System.out.println("Passed"); + } +} -- GitLab From e07fd395bdc314867886a621ec76cf74a5f76b89 Mon Sep 17 00:00:00 2001 From: Ioi Lam Date: Fri, 4 Mar 2022 20:14:11 +0000 Subject: [PATCH 155/340] 8281181: Do not use CPU Shares to compute active processor count Reviewed-by: dholmes, sgehwolf --- .../os/linux/cgroupSubsystem_linux.cpp | 7 ++- src/hotspot/os/linux/globals_linux.hpp | 12 ++++-- src/hotspot/share/runtime/arguments.cpp | 2 + .../jtreg/containers/cgroup/PlainRead.java | 4 +- .../containers/docker/TestCPUAwareness.java | 43 ++++++++++++++----- .../CommandLine/VMDeprecatedOptions.java | 2 + 6 files changed, 52 insertions(+), 18 deletions(-) diff --git a/src/hotspot/os/linux/cgroupSubsystem_linux.cpp b/src/hotspot/os/linux/cgroupSubsystem_linux.cpp index dd858a30e4c..1346cf8915f 100644 --- a/src/hotspot/os/linux/cgroupSubsystem_linux.cpp +++ b/src/hotspot/os/linux/cgroupSubsystem_linux.cpp @@ -495,7 +495,12 @@ int CgroupSubsystem::active_processor_count() { cpu_count = limit_count = os::Linux::active_processor_count(); int quota = cpu_quota(); int period = cpu_period(); - int share = cpu_shares(); + + // It's not a good idea to use cpu_shares() to limit the number + // of CPUs used by the JVM. See JDK-8281181. + // UseContainerCpuShares and PreferContainerQuotaForCPUCount are + // deprecated and will be removed in the next JDK release. + int share = UseContainerCpuShares ? cpu_shares() : -1; if (quota > -1 && period > 0) { quota_count = ceilf((float)quota / (float)period); diff --git a/src/hotspot/os/linux/globals_linux.hpp b/src/hotspot/os/linux/globals_linux.hpp index 72915b5afbb..2fc4a404b34 100644 --- a/src/hotspot/os/linux/globals_linux.hpp +++ b/src/hotspot/os/linux/globals_linux.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2022, 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 @@ -59,10 +59,14 @@ product(bool, UseContainerSupport, true, \ "Enable detection and runtime container configuration support") \ \ + product(bool, UseContainerCpuShares, false, \ + "(Deprecated) Include CPU shares in the CPU availability" \ + " calculation.") \ + \ product(bool, PreferContainerQuotaForCPUCount, true, \ - "Calculate the container CPU availability based on the value" \ - " of quotas (if set), when true. Otherwise, use the CPU" \ - " shares value, provided it is less than quota.") \ + "(Deprecated) Calculate the container CPU availability based" \ + " on the value of quotas (if set), when true. Otherwise, use" \ + " the CPU shares value, provided it is less than quota.") \ \ product(bool, AdjustStackSizeForTLS, false, \ "Increase the thread stack size to include space for glibc " \ diff --git a/src/hotspot/share/runtime/arguments.cpp b/src/hotspot/share/runtime/arguments.cpp index fb7adf6ca6c..a38e70b0b26 100644 --- a/src/hotspot/share/runtime/arguments.cpp +++ b/src/hotspot/share/runtime/arguments.cpp @@ -538,6 +538,8 @@ static SpecialFlag const special_jvm_flags[] = { { "UseHeavyMonitors", JDK_Version::jdk(18), JDK_Version::jdk(19), JDK_Version::jdk(20) }, #endif { "ExtendedDTraceProbes", JDK_Version::jdk(19), JDK_Version::jdk(20), JDK_Version::jdk(21) }, + { "UseContainerCpuShares", JDK_Version::jdk(19), JDK_Version::jdk(20), JDK_Version::jdk(21) }, + { "PreferContainerQuotaForCPUCount", JDK_Version::jdk(19), JDK_Version::jdk(20), JDK_Version::jdk(21) }, // --- Deprecated alias flags (see also aliased_jvm_flags) - sorted by obsolete_in then expired_in: { "DefaultMaxRAMFraction", JDK_Version::jdk(8), JDK_Version::undefined(), JDK_Version::undefined() }, diff --git a/test/hotspot/jtreg/containers/cgroup/PlainRead.java b/test/hotspot/jtreg/containers/cgroup/PlainRead.java index 3bd74d9437e..d0938374409 100644 --- a/test/hotspot/jtreg/containers/cgroup/PlainRead.java +++ b/test/hotspot/jtreg/containers/cgroup/PlainRead.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2022, 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 @@ -50,7 +50,7 @@ public class PlainRead { static final String good_value = "(\\d+|-1|-2|Unlimited)"; static final String bad_value = "(failed)"; - static final String[] variables = {"Memory Limit is:", "CPU Shares is:", "CPU Quota is:", "CPU Period is:", "active_processor_count:"}; + static final String[] variables = {"Memory Limit is:", "CPU Quota is:", "CPU Period is:", "active_processor_count:"}; static public void isContainer(OutputAnalyzer oa) { for (String v: variables) { diff --git a/test/hotspot/jtreg/containers/docker/TestCPUAwareness.java b/test/hotspot/jtreg/containers/docker/TestCPUAwareness.java index d8246bfc2c5..a72441182cd 100644 --- a/test/hotspot/jtreg/containers/docker/TestCPUAwareness.java +++ b/test/hotspot/jtreg/containers/docker/TestCPUAwareness.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2022, 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 @@ -100,6 +100,11 @@ public class TestCPUAwareness { String cpuSetStr = CPUSetsReader.readFromProcStatus("Cpus_allowed_list"); System.out.println("cpuSetStr = " + cpuSetStr); + // OLD = use the deprecated -XX:+UseContainerCpuShares flag, which + // will be removed in the next JDK release. See JDK-8281181. + boolean OLD = true; + boolean NEW = false; + if (cpuSetStr == null) { System.out.printf("The cpuset test cases are skipped"); } else { @@ -108,23 +113,32 @@ public class TestCPUAwareness { // Test subset of cpuset with one element if (cpuSet.size() >= 1) { String testCpuSet = CPUSetsReader.listToString(cpuSet, 1); - testAPCCombo(testCpuSet, 200*1000, 100*1000, 4*1024, true, 1); + testAPCCombo(OLD, testCpuSet, 200*1000, 100*1000, 4*1024, true, 1); + testAPCCombo(NEW, testCpuSet, 200*1000, 100*1000, 4*1024, true, 1); } // Test subset of cpuset with two elements if (cpuSet.size() >= 2) { String testCpuSet = CPUSetsReader.listToString(cpuSet, 2); - testAPCCombo(testCpuSet, 200*1000, 100*1000, 4*1024, true, 2); - testAPCCombo(testCpuSet, 200*1000, 100*1000, 1023, true, 2); - testAPCCombo(testCpuSet, 200*1000, 100*1000, 1023, false, 1); + testAPCCombo(OLD, testCpuSet, 200*1000, 100*1000, 4*1024, true, 2); + testAPCCombo(OLD, testCpuSet, 200*1000, 100*1000, 1023, true, 2); + testAPCCombo(OLD, testCpuSet, 200*1000, 100*1000, 1023, false,1); + + testAPCCombo(NEW, testCpuSet, 200*1000, 100*1000, 4*1024, true, 2); + testAPCCombo(NEW, testCpuSet, 200*1000, 100*1000, 1023, true, 2); + testAPCCombo(NEW, testCpuSet, 200*1000, 100*1000, 1023, false,2); } // Test subset of cpuset with three elements if (cpuSet.size() >= 3) { String testCpuSet = CPUSetsReader.listToString(cpuSet, 3); - testAPCCombo(testCpuSet, 100*1000, 100*1000, 2*1024, true, 1); - testAPCCombo(testCpuSet, 200*1000, 100*1000, 1023, true, 2); - testAPCCombo(testCpuSet, 200*1000, 100*1000, 1023, false, 1); + testAPCCombo(OLD, testCpuSet, 100*1000, 100*1000, 2*1024, true, 1); + testAPCCombo(OLD, testCpuSet, 200*1000, 100*1000, 1023, true, 2); + testAPCCombo(OLD, testCpuSet, 200*1000, 100*1000, 1023, false,1); + + testAPCCombo(NEW, testCpuSet, 100*1000, 100*1000, 2*1024, true, 1); + testAPCCombo(NEW, testCpuSet, 200*1000, 100*1000, 1023, true, 2); + testAPCCombo(NEW, testCpuSet, 200*1000, 100*1000, 1023, false,2); } } } @@ -181,8 +195,11 @@ public class TestCPUAwareness { } - // Test correctess of automatically selected active processor cound - private static void testAPCCombo(String cpuset, int quota, int period, int shares, + // Test correctess of automatically selected active processor count + // Note: when -XX:+UseContainerCpuShares is removed, + // useContainerCpuShares, shares, and usePreferContainerQuotaForCPUCount + // should also be removed. + private static void testAPCCombo(boolean useContainerCpuShares, String cpuset, int quota, int period, int shares, boolean usePreferContainerQuotaForCPUCount, int expectedAPC) throws Exception { Common.logNewTestCase("test APC Combo"); @@ -190,6 +207,7 @@ public class TestCPUAwareness { System.out.println("quota = " + quota); System.out.println("period = " + period); System.out.println("shares = " + shares); + System.out.println("useContainerCpuShares = " + useContainerCpuShares); System.out.println("usePreferContainerQuotaForCPUCount = " + usePreferContainerQuotaForCPUCount); System.out.println("expectedAPC = " + expectedAPC); @@ -201,13 +219,15 @@ public class TestCPUAwareness { .addDockerOpts("--cpu-quota=" + quota) .addDockerOpts("--cpu-shares=" + shares); - if (!usePreferContainerQuotaForCPUCount) opts.addJavaOpts("-XX:-PreferContainerQuotaForCPUCount"); + if (useContainerCpuShares) opts.addJavaOpts("-XX:+UseContainerCpuShares"); // deprecated + if (!usePreferContainerQuotaForCPUCount) opts.addJavaOpts("-XX:-PreferContainerQuotaForCPUCount"); // deprecated Common.run(opts) .shouldMatch("active_processor_count.*" + expectedAPC); } + // Note: when -XX:+UseContainerCpuShares is removed, this test should also be removed. private static void testCpuShares(int shares, int expectedAPC) throws Exception { Common.logNewTestCase("test cpu shares, shares = " + shares); System.out.println("expectedAPC = " + expectedAPC); @@ -216,6 +236,7 @@ public class TestCPUAwareness { DockerRunOptions opts = Common.newOpts(imageName) .addDockerOpts("--cpu-shares=" + shares); + opts.addJavaOpts("-XX:+UseContainerCpuShares"); // deprecated OutputAnalyzer out = Common.run(opts); // Cgroups v2 needs to do some scaling of raw shares values. Hence, // 256 CPU shares come back as 264. Raw value written to cpu.weight diff --git a/test/hotspot/jtreg/runtime/CommandLine/VMDeprecatedOptions.java b/test/hotspot/jtreg/runtime/CommandLine/VMDeprecatedOptions.java index a8b5bb31194..164aaa4d9a0 100644 --- a/test/hotspot/jtreg/runtime/CommandLine/VMDeprecatedOptions.java +++ b/test/hotspot/jtreg/runtime/CommandLine/VMDeprecatedOptions.java @@ -54,6 +54,8 @@ public class VMDeprecatedOptions { {"InitialRAMFraction", "64"}, {"TLABStats", "false"}, {"AllowRedefinitionToAddDeleteMethods", "true"}, + {"UseContainerCpuShares", "false"}, + {"PreferContainerQuotaForCPUCount", "true"}, // deprecated alias flags (see also aliased_jvm_flags): {"DefaultMaxRAMFraction", "4"}, -- GitLab From b0028a459c7e99b5e4090cc19127f6347fe220ba Mon Sep 17 00:00:00 2001 From: Jonathan Gibbons Date: Fri, 4 Mar 2022 21:01:52 +0000 Subject: [PATCH 156/340] 8272853: improve `JavadocTester.runTests` Reviewed-by: hannesw --- .../lib/javadoc/tester/JavadocTester.java | 113 +++++++- .../testJavadocTester/TestRunTests.java | 272 ++++++++++++++++++ 2 files changed, 374 insertions(+), 11 deletions(-) create mode 100644 test/langtools/jdk/javadoc/testJavadocTester/TestRunTests.java diff --git a/test/langtools/jdk/javadoc/lib/javadoc/tester/JavadocTester.java b/test/langtools/jdk/javadoc/lib/javadoc/tester/JavadocTester.java index 1892fa2ebd5..6c6415cf6de 100644 --- a/test/langtools/jdk/javadoc/lib/javadoc/tester/JavadocTester.java +++ b/test/langtools/jdk/javadoc/lib/javadoc/tester/JavadocTester.java @@ -58,6 +58,7 @@ import java.util.function.Function; import java.util.regex.Matcher; import java.util.regex.Pattern; import java.util.stream.Collectors; +import java.util.stream.Stream; import javax.tools.StandardJavaFileManager; @@ -266,39 +267,129 @@ public abstract class JavadocTester { /** * Run all methods annotated with @Test, followed by printSummary. - * Typically called on a tester object in main() + * The methods are invoked in the order found using getDeclaredMethods. + * The arguments for the invocation are provided {@link #getTestArgs(Method)}. + * + * Typically called on a tester object in main(). * + * @throws IllegalArgumentException if any test method does not have a recognized signature * @throws Exception if any errors occurred */ public void runTests() throws Exception { - runTests(m -> new Object[0]); + runTests(this::getTestArgs); } /** * Runs all methods annotated with @Test, followed by printSummary. + * The methods are invoked in the order found using getDeclaredMethods. + * The arguments for the invocation are provided by a given function. + * * Typically called on a tester object in main() * * @param f a function which will be used to provide arguments to each * invoked method - * @throws Exception if any errors occurred + * @throws Exception if any errors occurred while executing a test method */ public void runTests(Function f) throws Exception { - for (Method m: getClass().getDeclaredMethods()) { + for (Method m : getClass().getDeclaredMethods()) { Annotation a = m.getAnnotation(Test.class); if (a != null) { - try { - out.println("Running test " + m.getName()); - m.invoke(this, f.apply(m)); - } catch (InvocationTargetException e) { - Throwable cause = e.getCause(); - throw (cause instanceof Exception) ? ((Exception) cause) : e; - } + runTest(m, f); out.println(); } } printSummary(); } + /** + * Run the specified methods annotated with @Test, or all methods annotated + * with @Test if none are specified, followed by printSummary. + * The methods are invoked in the order given in the methodNames argument, + * or the order returned by getDeclaredMethods if no names are provided. + * The arguments for the invocation are provided {@link #getTestArgs(Method)}. + * + * Typically called on a tester object in main(String[] args), perhaps using + * args as the list of method names. + * + * @throws IllegalStateException if any methods annotated with @Test are overloaded + * @throws IllegalArgumentException if any of the method names does not name a suitable method + * @throws NullPointerException if {@code methodNames} is {@code null}, or if any of the names are {@code null} + * @throws Exception if any errors occurred while executing a test method + */ + public void runTests(String... methodNames) throws Exception { + runTests(this::getTestArgs, methodNames); + } + + /** + * Run the specified methods annotated with @Test, or all methods annotated + * with @Test if non are specified, followed by printSummary. + * The methods are invoked in the order given in the methodNames argument, + * or the order returned by getDeclaredMethods if no names are provided. + * The arguments for the invocation are provided {@link #getTestArgs(Method)}. + * + * Typically called on a tester object in main(String[] args), perhaps using + * args as the list of method names. + * + * @throws IllegalStateException if any methods annotated with @Test are overloaded + * @throws IllegalArgumentException if any of the method names does not name a suitable method + * @throws NullPointerException if {@code methodNames} is {@code null}, or if any of the names are {@code null} + * @throws Exception if any errors occurred while executing a test method + */ + public void runTests(Function f, String... methodNames) throws Exception { + if (methodNames.length == 0) { + runTests(f); + } else { + Map testMethods = Stream.of(getClass().getDeclaredMethods()) + .filter(this::isTestMethod) + .collect(Collectors.toMap(Method::getName, Function.identity(), + (o, n) -> { + throw new IllegalStateException("test method " + o.getName() + " is overloaded"); + })); + + List list = new ArrayList<>(); + for (String mn : methodNames) { + Method m = testMethods.get(mn); + if (m == null) { + throw new IllegalArgumentException("test method " + mn + " not found"); + } + list.add(m); + } + + for (Method m : list) { + runTest(m, f); + } + } + } + + protected boolean isTestMethod(Method m) { + return m.getAnnotation(Test.class) != null; + } + + protected Object[] getTestArgs(Method m) throws IllegalArgumentException { + Class[] paramTypes = m.getParameterTypes(); + if (paramTypes.length == 0) { + return new Object[] {}; + } else if (paramTypes.length == 1 && paramTypes[0] == Path.class) { + return new Object[] { Path.of(m.getName())}; + } else { + throw new IllegalArgumentException("unknown signature for method " + + m + Stream.of(paramTypes) + .map(Class::toString) + .collect(Collectors.joining(", ", "(", ")"))) ; + } + } + + protected void runTest(Method m, Function f) throws Exception { + try { + out.println("Running test " + m.getName()); + m.invoke(this, f.apply(m)); + } catch (InvocationTargetException e) { + Throwable cause = e.getCause(); + throw (cause instanceof Exception) ? ((Exception) cause) : e; + } + + } + /** * Runs javadoc. * The output directory used by this call and the final exit code diff --git a/test/langtools/jdk/javadoc/testJavadocTester/TestRunTests.java b/test/langtools/jdk/javadoc/testJavadocTester/TestRunTests.java new file mode 100644 index 00000000000..ae5c97fd5a6 --- /dev/null +++ b/test/langtools/jdk/javadoc/testJavadocTester/TestRunTests.java @@ -0,0 +1,272 @@ +/* + * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + + +/* + * @test + * @bug 8272853 + * @summary improve `JavadocTester.runTests` + * @library /tools/lib/ ../lib + * @modules jdk.javadoc/jdk.javadoc.internal.tool + * @build toolbox.ToolBox javadoc.tester.* + * @run main TestRunTests + */ + +import javadoc.tester.JavadocTester; + +import java.io.PrintStream; +import java.lang.annotation.Annotation; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.nio.file.Path; +import java.util.ArrayList; +import java.util.List; +import java.util.Locale; +import java.util.Set; +import java.util.function.Function; + +public class TestRunTests { + @Retention(RetentionPolicy.RUNTIME) + public @interface RunTest { + } + + public static void main(String... args) throws Exception { + TestRunTests t = new TestRunTests(); + t.run(); + } + + PrintStream out = System.out; + + void run() throws Exception { + for (Method m : getClass().getDeclaredMethods()) { + Annotation a = m.getAnnotation(RunTest.class); + if (a != null) { + try { + out.println("Running " + m); + m.invoke(this); + out.println(); + } catch (InvocationTargetException e) { + error("Invocation Target Exception while running " + m + ": " + e.getCause()); + } catch (Exception e) { + error("Exception while running " + m + ": " + e); + } + } + } + out.flush(); + if (errors > 0) { + out.println(errors + " errors occurred"); + throw new Exception(errors + " errors occurred"); + } + } + + int errors; + + @RunTest + public void testNoArgs() throws Exception { + MainGroup g = new MainGroup(); + g.runTests(); + checkEqualUnordered(g.log, Set.of("m1()", "m2(m2)", "m3()", "m4(m4)")); + } + + @RunTest + public void testMethodNames() throws Exception { + MainGroup g = new MainGroup(); + g.runTests("m1", "m4", "m2"); + checkEqualOrdered(g.log, List.of("m1()", "m4(m4)", "m2(m2)")); + } + + @RunTest + public void testFunction() throws Exception { + Function f = m -> + switch (m.getName()) { + case "m1", "m3" -> new Object[]{}; + case "m2", "m4" -> new Object[]{Path.of(m.getName().toUpperCase(Locale.ROOT))}; + default -> throw new IllegalArgumentException(m.toString()); + }; + MainGroup g = new MainGroup(); + g.runTests(f); + checkEqualUnordered(g.log, Set.of("m1()", "m2(M2)", "m3()", "m4(M4)")); + } + + @RunTest + public void testFunctionMethodNames() throws Exception { + Function f = m -> + switch (m.getName()) { + case "m1", "m3" -> new Object[]{}; + case "m2", "m4" -> new Object[]{Path.of(m.getName().toUpperCase(Locale.ROOT))}; + default -> throw new IllegalArgumentException(m.toString()); + }; + MainGroup g = new MainGroup(); + g.runTests(f, "m1", "m4", "m2"); + checkEqualOrdered(g.log, List.of("m1()", "m4(M4)", "m2(M2)")); + } + + @RunTest + public void testMethodNotFound() throws Exception { + MainGroup g = new MainGroup(); + try { + g.runTests("m1", "m2", "mx", "m3", "m4"); + } catch (IllegalArgumentException e) { + g.log.add(e.toString()); + } + // implicit in the following is that the error was detected before any test methods were executed + checkEqualOrdered(g.log, List.of("java.lang.IllegalArgumentException: test method mx not found")); + } + + @RunTest + public void testInvalidSignature() throws Exception { + InvalidSignatureGroup g = new InvalidSignatureGroup(); + try { + g.runTests(); + } catch (IllegalArgumentException e) { + g.log.add(e.toString()); + } + // since the exception comes from the nested use of `getTestArgs`, it will be thrown + // when the test method is being called, and so is not constrained to be thrown + // before any test method is called + checkContainsAll(g.log, List.of("java.lang.IllegalArgumentException: unknown signature for method " + + "public void TestRunTests$InvalidSignatureGroup.invalidSignature(java.lang.Object)(class java.lang.Object)")); + } + + @RunTest + public void testOverloadedMethod() throws Exception { + OverloadGroup g = new OverloadGroup(); + try { + g.runTests("m1"); + } catch (IllegalStateException e) { + g.log.add(e.toString()); + } + // implicit in the following is that the error was detected before any test methods were executed + checkEqualOrdered(g.log, List.of("java.lang.IllegalStateException: test method m1 is overloaded")); + } + + void checkContainsAll(List found, List expect) { + if (!found.containsAll(expect)) { + out.println("Found: " + found); + out.println("Expect: " + expect); + error("Expected results not found"); + } + } + + void checkEqualOrdered(List found, List expect) { + if (!found.equals(expect)) { + out.println("Found: " + found); + out.println("Expect: " + expect); + error("Expected results not found"); + } + } + + void checkEqualUnordered(List found, Set expect) { + if (!(found.containsAll(expect) && expect.containsAll(found))) { + out.println("Found: " + found); + out.println("Expect: " + expect); + error("Expected results not found"); + } + } + + void error(String message) { + out.println("Error: " + message); + errors++; + } + + /** + * A group of tests to be executed by different overloads of {@code runTests}. + */ + public static class MainGroup extends JavadocTester { + List log = new ArrayList<>(); + + @Test + public void m1() { + log.add("m1()"); + checking("m1"); + passed("OK"); + } + + @Test + public void m2(Path p) { + log.add("m2(" + p.getFileName() + ")"); + checking("m2"); + passed("OK"); + } + + @Test + public void m3() { + log.add("m3()"); + checking("m3"); + passed("OK"); + } + + @Test + public void m4(Path p) { + log.add("m4(" + p.getFileName() + ")"); + checking("m4"); + passed("OK"); + } + } + + /** + * A group of tests containing one with an invalid (unrecognized) signature. + * The invalid signature should cause an exception when trying to run that test. + */ + public static class InvalidSignatureGroup extends JavadocTester { + List log = new ArrayList<>(); + + @Test + public void m1() { + log.add("m1()"); + checking("m1"); + passed("OK"); + } + + @Test + public void invalidSignature(Object o) { + log.add("invalidSignature(" + o + ")"); + checking("invalidSignature"); + passed("OK"); + } + } + + /** + * A group of tests including an overloaded test method. + * The overload should cause an exception when trying to run that test by name. + */ + public static class OverloadGroup extends JavadocTester { + List log = new ArrayList<>(); + + @Test + public void m1() { + log.add("m1()"); + checking("m1"); + passed("OK"); + } + + @Test + public void m1(Path p) { + log.add("m1(" + p + ")"); + checking("m1"); + passed("OK"); + } + } +} -- GitLab From bae0d5e7174fed8ffa8a30408c3cffa6e4dd3ddc Mon Sep 17 00:00:00 2001 From: TejeshR13 Date: Fri, 4 Mar 2022 22:50:32 +0000 Subject: [PATCH 157/340] 8236907: JTable added to nested panels does not paint last visible row Reviewed-by: psadhukhan, prr --- .../classes/javax/swing/TablePrintable.java | 11 +- .../javax/swing/plaf/basic/BasicTableUI.java | 17 -- .../swing/JTable/8236907/LastVisibleRow.java | 221 ++++++++++++++++++ 3 files changed, 228 insertions(+), 21 deletions(-) create mode 100644 test/jdk/javax/swing/JTable/8236907/LastVisibleRow.java diff --git a/src/java.desktop/share/classes/javax/swing/TablePrintable.java b/src/java.desktop/share/classes/javax/swing/TablePrintable.java index 4c8eb0529ab..a6de3de2b09 100644 --- a/src/java.desktop/share/classes/javax/swing/TablePrintable.java +++ b/src/java.desktop/share/classes/javax/swing/TablePrintable.java @@ -395,11 +395,14 @@ class TablePrintable implements Printable { // draw a box around the table g2d.setColor(Color.BLACK); + Rectangle bounds = table.getBounds(); + bounds.x = bounds.y = 0; + // compute the visible portion of table and draw the rect around it - Rectangle visibleBounds = clip.intersection(table.getBounds()); + Rectangle visibleBounds = clip.intersection(bounds); Point upperLeft = visibleBounds.getLocation(); - Point lowerRight = new Point(visibleBounds.x + visibleBounds.width, - visibleBounds.y + visibleBounds.height); + Point lowerRight = new Point(visibleBounds.x + visibleBounds.width - 1, + visibleBounds.y + visibleBounds.height - 1); int rMin = table.rowAtPoint(upperLeft); int rMax = table.rowAtPoint(lowerRight); @@ -410,7 +413,7 @@ class TablePrintable implements Printable { rMax = table.getRowCount(); } int rowHeight = 0; - for(int visrow = rMin; visrow < rMax; visrow++) { + for(int visrow = rMin; visrow <= rMax; visrow++) { rowHeight += table.getRowHeight(visrow); } // If PrintMode is FIT_WIDTH, then draw rect for entire column width while diff --git a/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicTableUI.java b/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicTableUI.java index 37ebb12823c..59f966df2c3 100644 --- a/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicTableUI.java +++ b/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicTableUI.java @@ -1872,23 +1872,6 @@ public class BasicTableUI extends TableUI comp = comp.getParent(); } - if (comp != null && !(comp instanceof JViewport) && !(comp instanceof JScrollPane)) { - // We did rMax-1 to paint the same number of rows that are drawn on console - // otherwise 1 extra row is printed per page than that are displayed - // when there is no scrollPane and we do printing of table - // but not when rmax is already pointing to index of last row - // and if there is any selected rows - if (rMax != (table.getRowCount() - 1) && - (table.getSelectedRow() == -1)) { - // Do not decrement rMax if rMax becomes - // less than or equal to rMin - // else cells will not be painted - if (rMax - rMin > 1) { - rMax = rMax - 1; - } - } - } - // Paint the grid. paintGrid(g, rMin, rMax, cMin, cMax); diff --git a/test/jdk/javax/swing/JTable/8236907/LastVisibleRow.java b/test/jdk/javax/swing/JTable/8236907/LastVisibleRow.java new file mode 100644 index 00000000000..6ca33c96356 --- /dev/null +++ b/test/jdk/javax/swing/JTable/8236907/LastVisibleRow.java @@ -0,0 +1,221 @@ +/* + * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + * @test + * @key headful + * @bug 8236907 + * @summary Verifies if JTable last row is visible. + * @run main LastVisibleRow + */ + +import java.awt.BorderLayout; +import java.awt.Container; +import java.awt.Dimension; +import java.awt.event.InputEvent; +import java.awt.image.BufferedImage; +import java.awt.Point; +import java.awt.Rectangle; +import java.awt.Robot; +import java.lang.reflect.InvocationTargetException; + +import javax.print.attribute.HashPrintRequestAttributeSet; +import javax.print.attribute.PrintRequestAttributeSet; + +import javax.swing.BorderFactory; +import javax.swing.JFrame; +import javax.swing.JPanel; +import javax.swing.JTable; +import javax.swing.SwingUtilities; +import javax.swing.WindowConstants; + +public class LastVisibleRow { + static JFrame frame; + static JTable table; + static Robot testRobot; + + public static void main(String[] args) throws Exception { + Point clkPoint; + try { + testRobot = new Robot(); + + SwingUtilities.invokeAndWait(new Runnable() { + + public void run() { + createAndShowGUI(); + } + }); + testRobot.delay(1000); + testRobot.waitForIdle(); + BufferedImage bufferedImageBefore = testRobot.createScreenCapture(getCaptureRect()); + testRobot.delay(1000); + testRobot.waitForIdle(); + clkPoint = getMousePosition(); + mouseEvents(clkPoint); + testRobot.waitForIdle(); + clearSelect(); + testRobot.waitForIdle(); + BufferedImage bufferedImageAfter = testRobot.createScreenCapture(getCaptureRect()); + testRobot.delay(1000); + + if (!compare(bufferedImageBefore, bufferedImageAfter)) { + throw new RuntimeException("Test Case Failed!!"); + } + } finally { + if (frame != null) SwingUtilities.invokeAndWait(() -> frame.dispose()); + } + } + + /* + * + * Get clickable screen point for particular row and column of a table + * param row Row Number + * param column Column Number + * return Point + */ + private static Point getCellClickPoint(final int row, final int column) { + Point result; + + Rectangle rect = table.getCellRect(row, column, false); + Point point = new Point(rect.x + rect.width / 2, + rect.y + rect.height / 2); + SwingUtilities.convertPointToScreen(point, table); + result = point; + + return result; + } + + private static void createAndShowGUI() { + final PrintRequestAttributeSet printReqAttr = new HashPrintRequestAttributeSet(); + printReqAttr.add(javax.print.attribute.standard.OrientationRequested.LANDSCAPE); + frame = new JFrame(); + frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); + Container contentPane = frame.getContentPane(); + JPanel centerPane = new JPanel(new BorderLayout()); + centerPane.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); + JPanel tablePaneContainer = new JPanel(new BorderLayout()); + JPanel tablePane = new JPanel(new BorderLayout()); + table = new JTable(new Object[][]{{"row_1_col_1", "row_1_col_2", "row_1_col_3"}, {"row_2_col_1", "row_2_col_2", "row_2_col_3"}, {"row_3_col_1", "row_3_col_2", "row_3_col_3"}, {"row_4_col_1", "row_4_col_2", "row_4_col_3"}}, new String[]{"Col1", "Col2", "Col3"}); + table.setPreferredSize(new Dimension(0, (table.getRowHeight() * 3))); + + tablePane.add(table.getTableHeader(), BorderLayout.NORTH); + tablePane.add(table, BorderLayout.CENTER); + tablePaneContainer.add(tablePane, BorderLayout.CENTER); + centerPane.add(tablePaneContainer, BorderLayout.NORTH); + contentPane.add(centerPane, BorderLayout.CENTER); + frame.setSize(400, 120); + frame.setVisible(true); + frame.setLocationRelativeTo(null); + + } + + /* + * + * mouseEvents for last row click + */ + + private static void mouseEvents(Point clkPnt) { + testRobot.mouseMove(clkPnt.x, clkPnt.y); + testRobot.delay(50); + testRobot.mousePress(InputEvent.BUTTON1_DOWN_MASK); + testRobot.delay(50); + testRobot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); + testRobot.delay(50); + } + /* + * + * getMousePosition Actions for last row click + * returns Point + * throws Exception + */ + + private static Point getMousePosition() throws Exception { + final Point[] clickPoint = new Point[1]; + SwingUtilities.invokeAndWait(new Runnable() { + @Override + public void run() { + clickPoint[0] = getCellClickPoint(2, 0); + } + }); + return clickPoint[0]; + } + + /* + * + * Clears the selected table row + * throws Exception + */ + + private static void clearSelect() throws Exception { + SwingUtilities.invokeAndWait(new Runnable() { + @Override + public void run() { + table.getSelectionModel().clearSelection(); + table.setFocusable(false); + } + }); + } + + /* + * getCaptureRect Method - To Compute the Rectangle for + * Screen Capturing the Last Row for comparison + * return Rectangle + */ + + private static Rectangle getCaptureRect() throws InterruptedException, InvocationTargetException { + final Rectangle[] captureRect = new Rectangle[1]; + SwingUtilities.invokeAndWait(new Runnable() { + @Override + public void run() { + Rectangle cellRect = table.getCellRect(2, 0, true); + Point point = new Point(cellRect.x, cellRect.y); + SwingUtilities.convertPointToScreen(point, table); + + captureRect[0] = new Rectangle(point.x, point.y, table.getColumnCount() * cellRect.width, cellRect.height); + } + }); + return captureRect[0]; + } + + /* + * Compare method - to compare two images. + * param bufferedImage1 Buffered Image Before click + * param bufferedImage2 Buffered Image After click + * return Boolean + */ + + static Boolean compare(BufferedImage bufferedImage1, BufferedImage bufferedImage2) { + if (bufferedImage1.getWidth() == bufferedImage2.getWidth() + && bufferedImage1.getHeight() == bufferedImage2.getHeight()) { + for (int x = 0; x < bufferedImage1.getWidth(); x++) { + for (int y = 0; y < bufferedImage1.getHeight(); y++) { + if (bufferedImage1.getRGB(x, y) != bufferedImage2.getRGB(x, y)) { + return false; + } + } + } + } else { + return false; + } + return true; + } +} -- GitLab From c459f8f406a99cf78814bb5722f546ae1cdb6c6f Mon Sep 17 00:00:00 2001 From: wanghaomin Date: Sat, 5 Mar 2022 00:01:49 +0000 Subject: [PATCH 158/340] 8282142: [TestCase] compiler/inlining/ResolvedClassTest.java will fail when --with-jvm-features=-compiler1 Reviewed-by: jiefu, kvn --- test/hotspot/jtreg/compiler/inlining/ResolvedClassTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/hotspot/jtreg/compiler/inlining/ResolvedClassTest.java b/test/hotspot/jtreg/compiler/inlining/ResolvedClassTest.java index dfeee6cdd7b..44b21cb6815 100644 --- a/test/hotspot/jtreg/compiler/inlining/ResolvedClassTest.java +++ b/test/hotspot/jtreg/compiler/inlining/ResolvedClassTest.java @@ -25,7 +25,7 @@ * @test * @bug 8279515 * - * @requires vm.flagless + * @requires vm.flagless & vm.compiler1.enabled & vm.compiler2.enabled * @modules java.base/jdk.internal.misc * @library /test/lib / * -- GitLab From 52278b80c4b68af566327cf46b53dda5eda25a51 Mon Sep 17 00:00:00 2001 From: Mikael Vidstedt Date: Sat, 5 Mar 2022 01:36:02 +0000 Subject: [PATCH 159/340] 8282694: ProblemList runtime/CommandLine/VMDeprecatedOptions.java Reviewed-by: jjg --- test/hotspot/jtreg/ProblemList.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/test/hotspot/jtreg/ProblemList.txt b/test/hotspot/jtreg/ProblemList.txt index 518238d9c0a..5f007410904 100644 --- a/test/hotspot/jtreg/ProblemList.txt +++ b/test/hotspot/jtreg/ProblemList.txt @@ -102,6 +102,7 @@ runtime/os/TestTracePageSizes.java#compiler-options 8267460 linux-aarch64 runtime/os/TestTracePageSizes.java#G1 8267460 linux-aarch64 runtime/os/TestTracePageSizes.java#Parallel 8267460 linux-aarch64 runtime/os/TestTracePageSizes.java#Serial 8267460 linux-aarch64 +runtime/CommandLine/VMDeprecatedOptions.java 8282690 generic-all runtime/ErrorHandling/CreateCoredumpOnCrash.java 8267433 macosx-x64 applications/jcstress/copy.java 8229852 linux-all -- GitLab From bc42e7cbbfd586308338bfdf535c4fcab0cdbc48 Mon Sep 17 00:00:00 2001 From: Thomas Stuefe Date: Sat, 5 Mar 2022 06:37:39 +0000 Subject: [PATCH 160/340] 8282382: Report glibc malloc tunables in error reports Reviewed-by: zgu, dholmes --- src/hotspot/os/linux/os_linux.cpp | 47 ++++++++++++++++++++++++++----- 1 file changed, 40 insertions(+), 7 deletions(-) diff --git a/src/hotspot/os/linux/os_linux.cpp b/src/hotspot/os/linux/os_linux.cpp index 18b908cfc8f..33acc06df53 100644 --- a/src/hotspot/os/linux/os_linux.cpp +++ b/src/hotspot/os/linux/os_linux.cpp @@ -1,5 +1,6 @@ /* * Copyright (c) 1999, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2022 SAP SE. 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 @@ -2092,6 +2093,34 @@ bool os::Linux::query_process_memory_info(os::Linux::meminfo_t* info) { return false; } +#ifdef __GLIBC__ +// For Glibc, print a one-liner with the malloc tunables. +// Most important and popular is MALLOC_ARENA_MAX, but we are +// thorough and print them all. +static void print_glibc_malloc_tunables(outputStream* st) { + static const char* var[] = { + // the new variant + "GLIBC_TUNABLES", + // legacy variants + "MALLOC_CHECK_", "MALLOC_TOP_PAD_", "MALLOC_PERTURB_", + "MALLOC_MMAP_THRESHOLD_", "MALLOC_TRIM_THRESHOLD_", + "MALLOC_MMAP_MAX_", "MALLOC_ARENA_TEST", "MALLOC_ARENA_MAX", + NULL}; + st->print("glibc malloc tunables: "); + bool printed = false; + for (int i = 0; var[i] != NULL; i ++) { + const char* const val = ::getenv(var[i]); + if (val != NULL) { + st->print("%s%s=%s", (printed ? ", " : ""), var[i], val); + printed = true; + } + } + if (!printed) { + st->print("(default)"); + } +} +#endif // __GLIBC__ + void os::Linux::print_process_memory_info(outputStream* st) { st->print_cr("Process Memory:"); @@ -2114,8 +2143,9 @@ void os::Linux::print_process_memory_info(outputStream* st) { st->print_cr("Could not open /proc/self/status to get process memory related information"); } - // Print glibc outstanding allocations. - // (note: there is no implementation of mallinfo for muslc) + // glibc only: + // - Print outstanding allocations using mallinfo + // - Print glibc tunables #ifdef __GLIBC__ size_t total_allocated = 0; bool might_have_wrapped = false; @@ -2123,9 +2153,10 @@ void os::Linux::print_process_memory_info(outputStream* st) { struct glibc_mallinfo2 mi = _mallinfo2(); total_allocated = mi.uordblks; } else if (_mallinfo != NULL) { - // mallinfo is an old API. Member names mean next to nothing and, beyond that, are int. - // So values may have wrapped around. Still useful enough to see how much glibc thinks - // we allocated. + // mallinfo is an old API. Member names mean next to nothing and, beyond that, are 32-bit signed. + // So for larger footprints the values may have wrapped around. We try to detect this here: if the + // process whole resident set size is smaller than 4G, malloc footprint has to be less than that + // and the numbers are reliable. struct glibc_mallinfo mi = _mallinfo(); total_allocated = (size_t)(unsigned)mi.uordblks; // Since mallinfo members are int, glibc values may have wrapped. Warn about this. @@ -2136,8 +2167,10 @@ void os::Linux::print_process_memory_info(outputStream* st) { total_allocated / K, might_have_wrapped ? " (may have wrapped)" : ""); } -#endif // __GLIBC__ - + // Tunables + print_glibc_malloc_tunables(st); + st->cr(); +#endif } bool os::Linux::print_ld_preload_file(outputStream* st) { -- GitLab From 974ef5542fe52f9cb8ffd8751df8a020bca503c9 Mon Sep 17 00:00:00 2001 From: Jaikiran Pai Date: Sun, 6 Mar 2022 08:16:39 +0000 Subject: [PATCH 161/340] 8282617: sun.net.www.protocol.https.HttpsClient#putInKeepAliveCache() doesn't use a lock while dealing with "inCache" field Reviewed-by: dfuchs, michaelm --- .../sun/net/www/protocol/https/HttpsClient.java | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/java.base/share/classes/sun/net/www/protocol/https/HttpsClient.java b/src/java.base/share/classes/sun/net/www/protocol/https/HttpsClient.java index 4818f945bcc..1cb435f7fdf 100644 --- a/src/java.base/share/classes/sun/net/www/protocol/https/HttpsClient.java +++ b/src/java.base/share/classes/sun/net/www/protocol/https/HttpsClient.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2022, 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 @@ -661,12 +661,17 @@ final class HttpsClient extends HttpClient @Override protected void putInKeepAliveCache() { - if (inCache) { - assert false : "Duplicate put to keep alive cache"; - return; + lock(); + try { + if (inCache) { + assert false : "Duplicate put to keep alive cache"; + return; + } + inCache = true; + kac.put(url, sslSocketFactory, this); + } finally { + unlock(); } - inCache = true; - kac.put(url, sslSocketFactory, this); } /* -- GitLab From 415bf44191632cd8dbcc158c0ff0992c0b61c3ba Mon Sep 17 00:00:00 2001 From: Masanori Yano Date: Sun, 6 Mar 2022 23:53:50 +0000 Subject: [PATCH 162/340] 8275715: D3D pipeline processes multiple PaintEvent at initial drawing Reviewed-by: prr --- .../java2d/d3d/D3DScreenUpdateManager.java | 10 ++- .../MultiPaintEventTest.java | 86 +++++++++++++++++++ 2 files changed, 92 insertions(+), 4 deletions(-) create mode 100644 test/jdk/sun/java2d/DirectX/MultiPaintEventTest/MultiPaintEventTest.java diff --git a/src/java.desktop/windows/classes/sun/java2d/d3d/D3DScreenUpdateManager.java b/src/java.desktop/windows/classes/sun/java2d/d3d/D3DScreenUpdateManager.java index d2850927120..4d65e2700ab 100644 --- a/src/java.desktop/windows/classes/sun/java2d/d3d/D3DScreenUpdateManager.java +++ b/src/java.desktop/windows/classes/sun/java2d/d3d/D3DScreenUpdateManager.java @@ -258,7 +258,7 @@ public class D3DScreenUpdateManager extends ScreenUpdateManager { if (!done && sd instanceof D3DWindowSurfaceData) { D3DWindowSurfaceData d3dw = (D3DWindowSurfaceData)sd; - if (!d3dw.isSurfaceLost() || validate(d3dw)) { + if (!d3dw.isSurfaceLost() || validate(d3dw, false)) { trackScreenSurface(d3dw); return new SunGraphics2D(sd, fgColor, bgColor, font); } @@ -452,7 +452,7 @@ public class D3DScreenUpdateManager extends ScreenUpdateManager } finally { rq.unlock(); } - } else if (!validate(sd)) { + } else if (!validate(sd, true)) { // it is possible that the validation may never // succeed, we need to detect this and replace // the d3dw surface with gdi; the replacement of @@ -474,7 +474,7 @@ public class D3DScreenUpdateManager extends ScreenUpdateManager * @return true if surface wasn't lost or if restoration was successful, * false otherwise */ - private boolean validate(D3DWindowSurfaceData sd) { + private boolean validate(D3DWindowSurfaceData sd, boolean postEvent) { if (sd.isSurfaceLost()) { try { sd.restoreSurface(); @@ -491,7 +491,9 @@ public class D3DScreenUpdateManager extends ScreenUpdateManager sd.markClean(); // since the surface was successfully restored we need to // repaint whole window to repopulate the back-buffer - repaintPeerTarget(sd.getPeer()); + if (postEvent) { + repaintPeerTarget(sd.getPeer()); + } } catch (InvalidPipeException ipe) { return false; } diff --git a/test/jdk/sun/java2d/DirectX/MultiPaintEventTest/MultiPaintEventTest.java b/test/jdk/sun/java2d/DirectX/MultiPaintEventTest/MultiPaintEventTest.java new file mode 100644 index 00000000000..69042d07635 --- /dev/null +++ b/test/jdk/sun/java2d/DirectX/MultiPaintEventTest/MultiPaintEventTest.java @@ -0,0 +1,86 @@ +/* + * Copyright (c) 2021 Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @key headful + * @bug 8275715 + * @summary Tests that paint method is not called twice + * @run main/othervm MultiPaintEventTest + */ + +import java.awt.*; + +public class MultiPaintEventTest extends Canvas { + + private int count = 0; + private final Object lock = new Object(); + + public void paint(Graphics g) { + synchronized(lock) { + count++; + } + + int w = getWidth(); + int h = getHeight(); + + Graphics2D g2d = (Graphics2D)g; + if (count % 2 == 1) { + g2d.setColor(Color.green); + } else { + g2d.setColor(Color.red); + } + g2d.fillRect(0, 0, w, h); + } + + public int getCount() { + synchronized(lock) { + return count; + } + } + + public Dimension getPreferredSize() { + return new Dimension(400, 400); + } + + public static void main(String[] args) { + MultiPaintEventTest test = new MultiPaintEventTest(); + Frame frame = new Frame(); + frame.setUndecorated(true); + frame.add(test); + frame.pack(); + frame.setLocationRelativeTo(null); + frame.setVisible(true); + + try { + Thread.sleep(2000); + if (test.getCount() > 1) { + throw new RuntimeException("Processed unnecessary paint()."); + } + } catch (InterruptedException ex) { + throw new RuntimeException("Failed: Interrupted"); + } finally { + frame.dispose(); + } + } +} -- GitLab From 894ffb098c80bfeb4209038c017d01dbf53fac0f Mon Sep 17 00:00:00 2001 From: Masanori Yano Date: Mon, 7 Mar 2022 01:33:41 +0000 Subject: [PATCH 163/340] 8282713: Invalid copyright notice in new test added by JDK-8275715 Reviewed-by: dholmes --- .../java2d/DirectX/MultiPaintEventTest/MultiPaintEventTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/jdk/sun/java2d/DirectX/MultiPaintEventTest/MultiPaintEventTest.java b/test/jdk/sun/java2d/DirectX/MultiPaintEventTest/MultiPaintEventTest.java index 69042d07635..27d54af6a0b 100644 --- a/test/jdk/sun/java2d/DirectX/MultiPaintEventTest/MultiPaintEventTest.java +++ b/test/jdk/sun/java2d/DirectX/MultiPaintEventTest/MultiPaintEventTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 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 -- GitLab From 6fc73f709ba9a7f4810027f6c888b63a4604f004 Mon Sep 17 00:00:00 2001 From: Thomas Schatzl Date: Mon, 7 Mar 2022 13:52:19 +0000 Subject: [PATCH 164/340] 8282620: G1/Parallel: Constify is_in_young() predicates Reviewed-by: iwalulya, ayang --- src/hotspot/share/gc/g1/g1CollectedHeap.hpp | 2 +- src/hotspot/share/gc/g1/g1CollectedHeap.inline.hpp | 2 +- src/hotspot/share/gc/parallel/parallelScavengeHeap.hpp | 3 +-- src/hotspot/share/gc/parallel/parallelScavengeHeap.inline.hpp | 2 +- 4 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/hotspot/share/gc/g1/g1CollectedHeap.hpp b/src/hotspot/share/gc/g1/g1CollectedHeap.hpp index 1fad936447d..6c1b60a3faa 100644 --- a/src/hotspot/share/gc/g1/g1CollectedHeap.hpp +++ b/src/hotspot/share/gc/g1/g1CollectedHeap.hpp @@ -1179,7 +1179,7 @@ public: size_t max_tlab_size() const override; size_t unsafe_max_tlab_alloc(Thread* ignored) const override; - inline bool is_in_young(const oop obj); + inline bool is_in_young(const oop obj) const; // Returns "true" iff the given word_size is "very large". static bool is_humongous(size_t word_size) { diff --git a/src/hotspot/share/gc/g1/g1CollectedHeap.inline.hpp b/src/hotspot/share/gc/g1/g1CollectedHeap.inline.hpp index af778e43b13..13231603533 100644 --- a/src/hotspot/share/gc/g1/g1CollectedHeap.inline.hpp +++ b/src/hotspot/share/gc/g1/g1CollectedHeap.inline.hpp @@ -208,7 +208,7 @@ void G1CollectedHeap::register_optional_region_with_region_attr(HeapRegion* r) { _region_attr.set_optional(r->hrm_index(), r->rem_set()->is_tracked()); } -inline bool G1CollectedHeap::is_in_young(const oop obj) { +inline bool G1CollectedHeap::is_in_young(const oop obj) const { if (obj == NULL) { return false; } diff --git a/src/hotspot/share/gc/parallel/parallelScavengeHeap.hpp b/src/hotspot/share/gc/parallel/parallelScavengeHeap.hpp index cda8d7446ca..3ee16e5d8b9 100644 --- a/src/hotspot/share/gc/parallel/parallelScavengeHeap.hpp +++ b/src/hotspot/share/gc/parallel/parallelScavengeHeap.hpp @@ -184,8 +184,7 @@ class ParallelScavengeHeap : public CollectedHeap { bool is_in_reserved(const void* p) const; - bool is_in_young(oop p); // reserved part - bool is_in_old(oop p); // reserved part + bool is_in_young(const oop p) const; MemRegion reserved_region() const { return _reserved; } HeapWord* base() const { return _reserved.start(); } diff --git a/src/hotspot/share/gc/parallel/parallelScavengeHeap.inline.hpp b/src/hotspot/share/gc/parallel/parallelScavengeHeap.inline.hpp index a867c689c98..80efa1b8fc6 100644 --- a/src/hotspot/share/gc/parallel/parallelScavengeHeap.inline.hpp +++ b/src/hotspot/share/gc/parallel/parallelScavengeHeap.inline.hpp @@ -43,7 +43,7 @@ inline void ParallelScavengeHeap::invoke_scavenge() { PSScavenge::invoke(); } -inline bool ParallelScavengeHeap::is_in_young(oop p) { +inline bool ParallelScavengeHeap::is_in_young(const oop p) const { // Assumes the the old gen address range is lower than that of the young gen. bool result = cast_from_oop(p) >= young_gen()->reserved().start(); assert(result == young_gen()->is_in_reserved(p), -- GitLab From 104e3cb24b4de5512abf9f5491f9c530b26838d3 Mon Sep 17 00:00:00 2001 From: Joe Darcy Date: Mon, 7 Mar 2022 14:47:52 +0000 Subject: [PATCH 165/340] 8282696: Add constructors taking a cause to InvalidObjectException and InvalidClassException Reviewed-by: lancea --- .../java/io/InvalidClassException.java | 27 ++++++++- .../java/io/InvalidObjectException.java | 18 +++++- .../classes/java/io/ObjectInputStream.java | 44 +++++--------- .../classes/java/io/ObjectStreamClass.java | 7 ++- .../java/io/ObjectStreamException.java | 24 +++++++- .../TestIceConstructors.java | 58 +++++++++++++++++++ .../TestIoeConstructors.java | 56 ++++++++++++++++++ 7 files changed, 198 insertions(+), 36 deletions(-) create mode 100644 test/jdk/java/io/Serializable/InvalidClassException/TestIceConstructors.java create mode 100644 test/jdk/java/io/Serializable/InvalidObjectException/TestIoeConstructors.java diff --git a/src/java.base/share/classes/java/io/InvalidClassException.java b/src/java.base/share/classes/java/io/InvalidClassException.java index 6de0e70f760..be187597726 100644 --- a/src/java.base/share/classes/java/io/InvalidClassException.java +++ b/src/java.base/share/classes/java/io/InvalidClassException.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2022, 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,9 +73,34 @@ public class InvalidClassException extends ObjectStreamException { classname = cname; } + /** + * Report an InvalidClassException for the reason and cause specified. + * + * @param reason String describing the reason for the exception. + * @param cause the cause + * @since 19 + */ + public InvalidClassException(String reason, Throwable cause) { + super(reason, cause); + } + + /** + * Report an InvalidClassException for the reason and cause specified. + * + * @param cname a String naming the invalid class. + * @param reason String describing the reason for the exception. + * @param cause the cause + * @since 19 + */ + public InvalidClassException(String cname, String reason, Throwable cause) { + super(reason, cause); + classname = cname; + } + /** * Produce the message and include the classname, if present. */ + @Override public String getMessage() { if (classname == null) return super.getMessage(); diff --git a/src/java.base/share/classes/java/io/InvalidObjectException.java b/src/java.base/share/classes/java/io/InvalidObjectException.java index c6e626b238f..a6331de45ab 100644 --- a/src/java.base/share/classes/java/io/InvalidObjectException.java +++ b/src/java.base/share/classes/java/io/InvalidObjectException.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -45,7 +45,21 @@ public class InvalidObjectException extends ObjectStreamException { * * @see ObjectInputValidation */ - public InvalidObjectException(String reason) { + public InvalidObjectException(String reason) { super(reason); } + + /** + * Constructs an {@code InvalidObjectException} with the given + * reason and cause. + * + * @param reason Detailed message explaining the reason for the failure. + * @param cause the cause + * + * @see ObjectInputValidation + * @since 19 + */ + public InvalidObjectException(String reason, Throwable cause) { + super(reason, cause); + } } diff --git a/src/java.base/share/classes/java/io/ObjectInputStream.java b/src/java.base/share/classes/java/io/ObjectInputStream.java index 714785cd117..14812fea9ad 100644 --- a/src/java.base/share/classes/java/io/ObjectInputStream.java +++ b/src/java.base/share/classes/java/io/ObjectInputStream.java @@ -1429,9 +1429,7 @@ public class ObjectInputStream event.commit(); } if (serialFilter != null && (status == null || status == ObjectInputFilter.Status.REJECTED)) { - InvalidClassException ice = new InvalidClassException("filter status: " + status); - ice.initCause(ex); - throw ice; + throw new InvalidClassException("filter status: " + status, ex); } } @@ -1996,14 +1994,10 @@ public class ObjectInputStream } catch (ClassNotFoundException ex) { resolveEx = ex; } catch (IllegalAccessError aie) { - IOException ice = new InvalidClassException(aie.getMessage()); - ice.initCause(aie); - throw ice; + throw new InvalidClassException(aie.getMessage(), aie); } catch (OutOfMemoryError memerr) { - IOException ex = new InvalidObjectException("Proxy interface limit exceeded: " + - Arrays.toString(ifaces)); - ex.initCause(memerr); - throw ex; + throw new InvalidObjectException("Proxy interface limit exceeded: " + + Arrays.toString(ifaces), memerr); } // Call filterCheck on the class before reading anything else @@ -2016,10 +2010,8 @@ public class ObjectInputStream depth++; desc.initProxy(cl, resolveEx, readClassDesc(false)); } catch (OutOfMemoryError memerr) { - IOException ex = new InvalidObjectException("Proxy interface limit exceeded: " + - Arrays.toString(ifaces)); - ex.initCause(memerr); - throw ex; + throw new InvalidObjectException("Proxy interface limit exceeded: " + + Arrays.toString(ifaces), memerr); } finally { depth--; } @@ -2050,8 +2042,8 @@ public class ObjectInputStream try { readDesc = readClassDescriptor(); } catch (ClassNotFoundException ex) { - throw (IOException) new InvalidClassException( - "failed to read class descriptor").initCause(ex); + throw new InvalidClassException("failed to read class descriptor", + ex); } Class cl = null; @@ -2221,9 +2213,8 @@ public class ObjectInputStream Enum en = Enum.valueOf((Class)cl, name); result = en; } catch (IllegalArgumentException ex) { - throw (IOException) new InvalidObjectException( - "enum constant " + name + " does not exist in " + - cl).initCause(ex); + throw new InvalidObjectException("enum constant " + + name + " does not exist in " + cl, ex); } if (!unshared) { handles.setObject(enumHandle, result); @@ -2262,9 +2253,8 @@ public class ObjectInputStream try { obj = desc.isInstantiable() ? desc.newInstance() : null; } catch (Exception ex) { - throw (IOException) new InvalidClassException( - desc.forClass().getName(), - "unable to create instance").initCause(ex); + throw new InvalidClassException(desc.forClass().getName(), + "unable to create instance", ex); } passHandle = handles.assign(unshared ? unsharedMarker : obj); @@ -2388,16 +2378,12 @@ public class ObjectInputStream try { return (Object) ctrMH.invokeExact(fieldValues.primValues, fieldValues.objValues); } catch (Exception e) { - InvalidObjectException ioe = new InvalidObjectException(e.getMessage()); - ioe.initCause(e); - throw ioe; + throw new InvalidObjectException(e.getMessage(), e); } catch (Error e) { throw e; } catch (Throwable t) { - ObjectStreamException ose = new InvalidObjectException( - "ReflectiveOperationException during deserialization"); - ose.initCause(t); - throw ose; + throw new InvalidObjectException("ReflectiveOperationException " + + "during deserialization", t); } } diff --git a/src/java.base/share/classes/java/io/ObjectStreamClass.java b/src/java.base/share/classes/java/io/ObjectStreamClass.java index 86ed2b839d1..c41e8b1744a 100644 --- a/src/java.base/share/classes/java/io/ObjectStreamClass.java +++ b/src/java.base/share/classes/java/io/ObjectStreamClass.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2022, 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 @@ -709,8 +709,9 @@ public class ObjectStreamClass implements Serializable { try { fields[i] = new ObjectStreamField(fname, signature, false); } catch (RuntimeException e) { - throw (IOException) new InvalidClassException(name, - "invalid descriptor for field " + fname).initCause(e); + throw new InvalidClassException(name, + "invalid descriptor for field " + + fname, e); } } computeFieldOffsets(); diff --git a/src/java.base/share/classes/java/io/ObjectStreamException.java b/src/java.base/share/classes/java/io/ObjectStreamException.java index 779cc0627d3..a7d19cdc1fa 100644 --- a/src/java.base/share/classes/java/io/ObjectStreamException.java +++ b/src/java.base/share/classes/java/io/ObjectStreamException.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2022, 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 @@ -44,10 +44,32 @@ public abstract class ObjectStreamException extends IOException { super(message); } + /** + * Create an ObjectStreamException with the specified message and + * cause. + * + * @param message the detailed message for the exception + * @param cause the cause + * @since 19 + */ + protected ObjectStreamException(String message, Throwable cause) { + super(message, cause); + } + /** * Create an ObjectStreamException. */ protected ObjectStreamException() { super(); } + + /** + * Create an ObjectStreamException with the specified cause. + * + * @param cause the cause + * @since 19 + */ + protected ObjectStreamException(Throwable cause) { + super(cause); + } } diff --git a/test/jdk/java/io/Serializable/InvalidClassException/TestIceConstructors.java b/test/jdk/java/io/Serializable/InvalidClassException/TestIceConstructors.java new file mode 100644 index 00000000000..991ec32ec8f --- /dev/null +++ b/test/jdk/java/io/Serializable/InvalidClassException/TestIceConstructors.java @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 8282696 + * @summary Verify message and cause handling of InvalidClassException + */ +import java.io.*; +import java.util.Objects; + +public class TestIceConstructors { + public static void main(String... args) { + String reason = "reason"; + Throwable cause = new RuntimeException(); + + testException(new InvalidClassException(reason), + reason, null); + testException(new InvalidClassException(reason, cause), + reason, cause); + testException(new InvalidClassException("prefix", reason, cause), + "prefix" + "; " + reason, cause); + } + + private static void testException(InvalidClassException ice, + String expectedMessage, + Throwable expectedCause) { + var message = ice.getMessage(); + if (!Objects.equals(message, expectedMessage)) { + throw new RuntimeException("Unexpected message " + message); + } + + var cause = ice.getCause(); + if (cause != expectedCause) { + throw new RuntimeException("Unexpected cause"); + } + } +} diff --git a/test/jdk/java/io/Serializable/InvalidObjectException/TestIoeConstructors.java b/test/jdk/java/io/Serializable/InvalidObjectException/TestIoeConstructors.java new file mode 100644 index 00000000000..d3a952e62df --- /dev/null +++ b/test/jdk/java/io/Serializable/InvalidObjectException/TestIoeConstructors.java @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 8282696 + * @summary Verify message and cause handling of InvalidObjectException + */ +import java.io.*; +import java.util.Objects; + +public class TestIoeConstructors { + public static void main(String... args) { + String reason = "reason"; + Throwable cause = new RuntimeException(); + + testException(new InvalidObjectException(reason), + reason, null); + testException(new InvalidObjectException(reason, cause), + reason, cause); + } + + private static void testException(InvalidObjectException ioe, + String expectedMessage, + Throwable expectedCause) { + var message = ioe.getMessage(); + if (!Objects.equals(message, expectedMessage)) { + throw new RuntimeException("Unexpected message " + message); + } + + var cause = ioe.getCause(); + if (cause != expectedCause) { + throw new RuntimeException("Unexpected cause"); + } + } +} -- GitLab From e544e354a425a242f23cee1049d6ba31b30740e0 Mon Sep 17 00:00:00 2001 From: Ivan Walulya Date: Mon, 7 Mar 2022 15:05:42 +0000 Subject: [PATCH 166/340] 8282621: G1: G1SegmentedArray remove unnecessary template parameter Reviewed-by: kbarrett, tschatzl --- src/hotspot/share/gc/g1/g1CardSetMemory.cpp | 54 ++++++++++-------- src/hotspot/share/gc/g1/g1CardSetMemory.hpp | 56 ++++--------------- .../share/gc/g1/g1CardSetMemory.inline.hpp | 13 ++--- src/hotspot/share/gc/g1/g1SegmentedArray.hpp | 2 +- .../share/gc/g1/g1SegmentedArray.inline.hpp | 42 +++++++------- 5 files changed, 70 insertions(+), 97 deletions(-) diff --git a/src/hotspot/share/gc/g1/g1CardSetMemory.cpp b/src/hotspot/share/gc/g1/g1CardSetMemory.cpp index 24b482ac597..b68c50b5cb1 100644 --- a/src/hotspot/share/gc/g1/g1CardSetMemory.cpp +++ b/src/hotspot/share/gc/g1/g1CardSetMemory.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -30,10 +30,9 @@ #include "runtime/atomic.hpp" #include "utilities/ostream.hpp" -template -G1CardSetAllocator::G1CardSetAllocator(const char* name, - const G1CardSetAllocOptions* alloc_options, - G1CardSetFreeList* free_segment_list) : +G1CardSetAllocator::G1CardSetAllocator(const char* name, + const G1CardSetAllocOptions* alloc_options, + G1CardSetFreeList* free_segment_list) : _segmented_array(alloc_options, free_segment_list), _free_slots_list(name, &_segmented_array) { @@ -41,26 +40,38 @@ G1CardSetAllocator::G1CardSetAllocator(const char* name, assert(slot_size >= sizeof(G1CardSetContainer), "Slot instance size %u for allocator %s too small", slot_size, name); } -template -G1CardSetAllocator::~G1CardSetAllocator() { +G1CardSetAllocator::~G1CardSetAllocator() { drop_all(); } -template -void G1CardSetAllocator::free(Slot* slot) { +void G1CardSetAllocator::free(void* slot) { assert(slot != nullptr, "precondition"); - slot->~Slot(); _free_slots_list.release(slot); } -template -void G1CardSetAllocator::drop_all() { +void G1CardSetAllocator::drop_all() { _free_slots_list.reset(); _segmented_array.drop_all(); } -template -void G1CardSetAllocator::print(outputStream* os) { +size_t G1CardSetAllocator::mem_size() const { + return sizeof(*this) + + _segmented_array.num_segments() * sizeof(G1CardSetSegment) + + _segmented_array.num_available_slots() * _segmented_array.slot_size(); +} + +size_t G1CardSetAllocator::wasted_mem_size() const { + uint num_wasted_slots = _segmented_array.num_available_slots() - + _segmented_array.num_allocated_slots() - + (uint)_free_slots_list.pending_count(); + return num_wasted_slots * _segmented_array.slot_size(); +} + +uint G1CardSetAllocator::num_segments() const { + return _segmented_array.num_segments(); +} + +void G1CardSetAllocator::print(outputStream* os) { uint num_allocated_slots = _segmented_array.num_allocated_slots(); uint num_available_slots = _segmented_array.num_available_slots(); uint highest = _segmented_array.first_array_segment() != nullptr @@ -82,13 +93,13 @@ void G1CardSetAllocator::print(outputStream* os) { G1CardSetMemoryManager::G1CardSetMemoryManager(G1CardSetConfiguration* config, G1CardSetFreePool* free_list_pool) : _config(config) { - _allocators = NEW_C_HEAP_ARRAY(G1CardSetAllocator, + _allocators = NEW_C_HEAP_ARRAY(G1CardSetAllocator, _config->num_mem_object_types(), mtGC); for (uint i = 0; i < num_mem_object_types(); i++) { - new (&_allocators[i]) G1CardSetAllocator(_config->mem_object_type_name_str(i), - _config->mem_object_alloc_options(i), - free_list_pool->free_list(i)); + new (&_allocators[i]) G1CardSetAllocator(_config->mem_object_type_name_str(i), + _config->mem_object_alloc_options(i), + free_list_pool->free_list(i)); } } @@ -106,7 +117,7 @@ G1CardSetMemoryManager::~G1CardSetMemoryManager() { void G1CardSetMemoryManager::free(uint type, void* value) { assert(type < num_mem_object_types(), "must be"); - _allocators[type].free((G1CardSetContainer*)value); + _allocators[type].free(value); } void G1CardSetMemoryManager::flush() { @@ -127,9 +138,8 @@ size_t G1CardSetMemoryManager::mem_size() const { for (uint i = 0; i < num_mem_object_types(); i++) { result += _allocators[i].mem_size(); } - return sizeof(*this) - - (sizeof(G1CardSetAllocator) * num_mem_object_types()) + - result; + return sizeof(*this) + result - + (sizeof(G1CardSetAllocator) * num_mem_object_types()); } size_t G1CardSetMemoryManager::wasted_mem_size() const { diff --git a/src/hotspot/share/gc/g1/g1CardSetMemory.hpp b/src/hotspot/share/gc/g1/g1CardSetMemory.hpp index c455706a616..c2663b41cf1 100644 --- a/src/hotspot/share/gc/g1/g1CardSetMemory.hpp +++ b/src/hotspot/share/gc/g1/g1CardSetMemory.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -62,37 +62,12 @@ typedef G1SegmentedArraySegment G1CardSetSegment; typedef G1SegmentedArrayFreeList G1CardSetFreeList; -// Arena-like allocator for (card set) heap memory objects (Slot slots). +// Arena-like allocator for (card set) heap memory objects. // -// Allocation and deallocation in the first phase on G1CardSetContainer basis -// may occur by multiple threads at once. -// -// Allocation occurs from an internal free list of G1CardSetContainers first, -// only then trying to bump-allocate from the current G1CardSetSegment. If there is -// none, this class allocates a new G1CardSetSegment (allocated from the C heap, -// asking the G1CardSetAllocOptions instance about sizes etc) and uses that one. -// -// The SegmentStack free list is a linked list of G1CardSetContainers -// within all G1CardSetSegment instances allocated so far. It uses a separate -// pending list and global synchronization to avoid the ABA problem when the -// user frees a memory object. -// -// The class also manages a few counters for statistics using atomic operations. -// Their values are only consistent within each other with extra global -// synchronization. -// -// Since it is expected that every CardSet (and in extension each region) has its -// own set of allocators, there is intentionally no padding between them to save -// memory. -template +// Allocation occurs from an internal free list of objects first. If the free list is +// empty then tries to allocate from the G1SegmentedArray. class G1CardSetAllocator { - // G1CardSetSegment management. - - typedef G1SegmentedArray SegmentedArray; - // G1CardSetContainer slot management within the G1CardSetSegments allocated - // by this allocator. - - SegmentedArray _segmented_array; + G1SegmentedArray _segmented_array; FreeListAllocator _free_slots_list; public: @@ -101,27 +76,18 @@ public: G1CardSetFreeList* free_segment_list); ~G1CardSetAllocator(); - Slot* allocate(); - void free(Slot* slot); + void* allocate(); + void free(void* slot); // Deallocate all segments to the free segment list and reset this allocator. Must // be called in a globally synchronized area. void drop_all(); - size_t mem_size() const { - return sizeof(*this) + - _segmented_array.num_segments() * sizeof(G1CardSetSegment) + - _segmented_array.num_available_slots() * _segmented_array.slot_size(); - } + size_t mem_size() const; - size_t wasted_mem_size() const { - uint num_wasted_slots = _segmented_array.num_available_slots() - - _segmented_array.num_allocated_slots() - - (uint)_free_slots_list.pending_count(); - return num_wasted_slots * _segmented_array.slot_size(); - } + size_t wasted_mem_size() const; - inline uint num_segments() { return _segmented_array.num_segments(); } + uint num_segments() const; void print(outputStream* os); }; @@ -131,7 +97,7 @@ typedef G1SegmentedArrayFreePool G1CardSetFreePool; class G1CardSetMemoryManager : public CHeapObj { G1CardSetConfiguration* _config; - G1CardSetAllocator* _allocators; + G1CardSetAllocator* _allocators; uint num_mem_object_types() const; public: diff --git a/src/hotspot/share/gc/g1/g1CardSetMemory.inline.hpp b/src/hotspot/share/gc/g1/g1CardSetMemory.inline.hpp index 7d75f86bb7d..bdf69e227df 100644 --- a/src/hotspot/share/gc/g1/g1CardSetMemory.inline.hpp +++ b/src/hotspot/share/gc/g1/g1CardSetMemory.inline.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2022, 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,16 +26,13 @@ #define SHARE_GC_G1_G1CARDSETMEMORY_INLINE_HPP #include "gc/g1/g1CardSetMemory.hpp" -#include "gc/g1/g1CardSetContainers.hpp" -#include "gc/g1/g1SegmentedArray.inline.hpp" -#include "utilities/ostream.hpp" - #include "gc/g1/g1CardSetContainers.inline.hpp" +#include "gc/g1/g1SegmentedArray.inline.hpp" #include "utilities/globalCounter.inline.hpp" +#include "utilities/ostream.hpp" -template -Slot* G1CardSetAllocator::allocate() { - Slot* slot = ::new (_free_slots_list.allocate()) Slot(); +inline void* G1CardSetAllocator::allocate() { + void* slot = _free_slots_list.allocate(); assert(slot != nullptr, "must be"); return slot; } diff --git a/src/hotspot/share/gc/g1/g1SegmentedArray.hpp b/src/hotspot/share/gc/g1/g1SegmentedArray.hpp index bddb6af15fe..6c73e9855cc 100644 --- a/src/hotspot/share/gc/g1/g1SegmentedArray.hpp +++ b/src/hotspot/share/gc/g1/g1SegmentedArray.hpp @@ -181,7 +181,7 @@ public: // The class also manages a few counters for statistics using atomic operations. // Their values are only consistent within each other with extra global // synchronization. -template +template class G1SegmentedArray : public FreeListConfig { // G1SegmentedArrayAllocOptions provides parameters for allocation segment // sizing and expansion. diff --git a/src/hotspot/share/gc/g1/g1SegmentedArray.inline.hpp b/src/hotspot/share/gc/g1/g1SegmentedArray.inline.hpp index 51b778d82f0..69c3526e58d 100644 --- a/src/hotspot/share/gc/g1/g1SegmentedArray.inline.hpp +++ b/src/hotspot/share/gc/g1/g1SegmentedArray.inline.hpp @@ -115,8 +115,8 @@ void G1SegmentedArrayFreeList::free_all() { Atomic::sub(&_mem_size, mem_size_freed, memory_order_relaxed); } -template -G1SegmentedArraySegment* G1SegmentedArray::create_new_segment(G1SegmentedArraySegment* const prev) { +template +G1SegmentedArraySegment* G1SegmentedArray::create_new_segment(G1SegmentedArraySegment* const prev) { // Take an existing segment if available. G1SegmentedArraySegment* next = _free_segment_list->get(); if (next == nullptr) { @@ -125,7 +125,7 @@ G1SegmentedArraySegment* G1SegmentedArray::create_new_segment( next = new G1SegmentedArraySegment(slot_size(), num_slots, prev); } else { assert(slot_size() == next->slot_size() , - "Mismatch %d != %d Slot %zu", slot_size(), next->slot_size(), sizeof(Slot)); + "Mismatch %d != %d", slot_size(), next->slot_size()); next->reset(prev); } @@ -148,14 +148,14 @@ G1SegmentedArraySegment* G1SegmentedArray::create_new_segment( } } -template -uint G1SegmentedArray::slot_size() const { +template +uint G1SegmentedArray::slot_size() const { return _alloc_options->slot_size(); } -template -G1SegmentedArray::G1SegmentedArray(const G1SegmentedArrayAllocOptions* alloc_options, - G1SegmentedArrayFreeList* free_segment_list) : +template +G1SegmentedArray::G1SegmentedArray(const G1SegmentedArrayAllocOptions* alloc_options, + G1SegmentedArrayFreeList* free_segment_list) : _alloc_options(alloc_options), _first(nullptr), _last(nullptr), @@ -167,13 +167,13 @@ G1SegmentedArray::G1SegmentedArray(const G1SegmentedArrayAllocOption assert(_free_segment_list != nullptr, "precondition!"); } -template -G1SegmentedArray::~G1SegmentedArray() { +template +G1SegmentedArray::~G1SegmentedArray() { drop_all(); } -template -void G1SegmentedArray::drop_all() { +template +void G1SegmentedArray::drop_all() { G1SegmentedArraySegment* cur = Atomic::load_acquire(&_first); if (cur != nullptr) { @@ -209,8 +209,8 @@ void G1SegmentedArray::drop_all() { _num_allocated_slots = 0; } -template -void* G1SegmentedArray::allocate() { +template +void* G1SegmentedArray::allocate() { assert(slot_size() > 0, "instance size not set."); G1SegmentedArraySegment* cur = Atomic::load_acquire(&_first); @@ -219,7 +219,7 @@ void* G1SegmentedArray::allocate() { } while (true) { - Slot* slot = (Slot*)cur->get_new_slot(); + void* slot = cur->get_new_slot(); if (slot != nullptr) { Atomic::inc(&_num_allocated_slots, memory_order_relaxed); guarantee(is_aligned(slot, _alloc_options->slot_alignment()), @@ -232,8 +232,8 @@ void* G1SegmentedArray::allocate() { } } -template -inline uint G1SegmentedArray::num_segments() const { +template +inline uint G1SegmentedArray::num_segments() const { return Atomic::load(&_num_segments); } @@ -251,17 +251,17 @@ public: } }; -template -uint G1SegmentedArray::calculate_length() const { +template +uint G1SegmentedArray::calculate_length() const { LengthClosure closure; iterate_segments(closure); return closure.length(); } #endif -template +template template -void G1SegmentedArray::iterate_segments(SegmentClosure& closure) const { +void G1SegmentedArray::iterate_segments(SegmentClosure& closure) const { G1SegmentedArraySegment* cur = Atomic::load_acquire(&_first); assert((cur != nullptr) == (_last != nullptr), -- GitLab From 8e70f4c3dca4cefe813c5b0fd39c386230ca2fd7 Mon Sep 17 00:00:00 2001 From: Aleksey Shipilev Date: Mon, 7 Mar 2022 15:23:10 +0000 Subject: [PATCH 167/340] 8282224: Correct TIG::bang_stack_shadow_pages comments Reviewed-by: coleenp --- src/hotspot/cpu/x86/templateInterpreterGenerator_x86.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/hotspot/cpu/x86/templateInterpreterGenerator_x86.cpp b/src/hotspot/cpu/x86/templateInterpreterGenerator_x86.cpp index ca7bcd8e50e..7177d7ca34c 100644 --- a/src/hotspot/cpu/x86/templateInterpreterGenerator_x86.cpp +++ b/src/hotspot/cpu/x86/templateInterpreterGenerator_x86.cpp @@ -755,8 +755,8 @@ void TemplateInterpreterGenerator::bang_stack_shadow_pages(bool native_call) { __ bang_stack_with_offset(p*page_size); } - // Record a new watermark, unless the update is above the safe limit. - // Otherwise, the next time around a check above would pass the safe limit. + // Record the new watermark, but only if update is above the safe limit. + // Otherwise, the next time around the check above would pass the safe limit. __ cmpptr(rsp, Address(thread, JavaThread::shadow_zone_safe_limit())); __ jccb(Assembler::belowEqual, L_done); __ movptr(Address(thread, JavaThread::shadow_zone_growth_watermark()), rsp); -- GitLab From f0995abe62b81cf9c96cc07caa0ac27d00c96ff1 Mon Sep 17 00:00:00 2001 From: Lance Andersen Date: Mon, 7 Mar 2022 16:10:31 +0000 Subject: [PATCH 168/340] 8280404: Unexpected exception thrown when CEN file entry comment length is not valid Reviewed-by: alanb --- .../share/classes/java/util/zip/ZipFile.java | 11 +- .../zip/ZipFile/InvalidCommentLengthTest.java | 345 ++++++++++++++++++ 2 files changed, 355 insertions(+), 1 deletion(-) create mode 100644 test/jdk/java/util/zip/ZipFile/InvalidCommentLengthTest.java diff --git a/src/java.base/share/classes/java/util/zip/ZipFile.java b/src/java.base/share/classes/java/util/zip/ZipFile.java index b89de2cef62..8538b4aef89 100644 --- a/src/java.base/share/classes/java/util/zip/ZipFile.java +++ b/src/java.base/share/classes/java/util/zip/ZipFile.java @@ -1206,8 +1206,17 @@ public class ZipFile implements ZipConstants, Closeable { entries[index++] = hash; entries[index++] = next; entries[index ] = pos; + // Validate comment if it exists + // if the bytes representing the comment cannot be converted to + // a String via zcp.toString, an Exception will be thrown + int clen = CENCOM(cen, pos); + if (clen > 0) { + int elen = CENEXT(cen, pos); + int start = entryPos + nlen + elen; + zcp.toString(cen, start, clen); + } } catch (Exception e) { - zerror("invalid CEN header (bad entry name)"); + zerror("invalid CEN header (bad entry name or comment)"); } return nlen; } diff --git a/test/jdk/java/util/zip/ZipFile/InvalidCommentLengthTest.java b/test/jdk/java/util/zip/ZipFile/InvalidCommentLengthTest.java new file mode 100644 index 00000000000..1910107f0d3 --- /dev/null +++ b/test/jdk/java/util/zip/ZipFile/InvalidCommentLengthTest.java @@ -0,0 +1,345 @@ +/* + * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + * + */ + +import org.testng.annotations.AfterTest; +import org.testng.annotations.BeforeTest; +import org.testng.annotations.Test; + +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.Arrays; +import java.util.jar.JarFile; +import java.util.zip.ZipEntry; +import java.util.zip.ZipException; +import java.util.zip.ZipFile; + +import static org.testng.Assert.*; + +/** + * @test + * @bug 8280404 + * @summary Validate that Zip/JarFile will throw a ZipException when the CEN + * comment length field contains an incorrect value + * @run testng/othervm InvalidCommentLengthTest + */ +public class InvalidCommentLengthTest { + + // Name used to create a JAR with an invalid comment length + public static final Path INVALID_CEN_COMMENT_LENGTH_JAR = + Path.of("Invalid-CEN-Comment-Length.jar"); + // Name used to create a JAR with a valid comment length + public static final Path VALID_CEN_COMMENT_LENGTH_JAR = + Path.of("Valid-CEN-Comment-Length.jar"); + // Zip/Jar CEN file header entry that will be modified + public static final String META_INF_MANIFEST_MF = "META-INF/MANIFEST.MF"; + // Expected ZipException message when the comment length corrupts the + // Zip/Jar file + public static final String INVALID_CEN_HEADER_BAD_ENTRY_NAME_OR_COMMENT = + "invalid CEN header (bad entry name or comment)"; + + /** + * Byte array representing a valid jar file prior modifying the comment length + * entry in a CEN file header. + * The "Valid-CEN-Comment-Length.jar" jar file was created via: + *
+     *     {@code
+     *     jar cvf Valid-CEN-Comment-Length.jar Hello.txt Tennis.txt BruceWayne.txt
+     *     added manifest
+     *     adding: Hello.txt(in = 12) (out= 14)(deflated -16%)
+     *     adding: Tennis.txt(in = 53) (out= 53)(deflated 0%)
+     *     adding: BruceWayne.txt(in = 12) (out= 14)(deflated -16%)
+     *     }
+     * 
+ * Its contents are: + *
+     *     {@code
+     *     jar tvf Valid-CEN-Comment-Length.jar
+     *      0 Wed Mar 02 06:39:24 EST 2022 META-INF/
+     *     66 Wed Mar 02 06:39:24 EST 2022 META-INF/MANIFEST.MF
+     *     12 Wed Mar 02 06:39:06 EST 2022 Hello.txt
+     *     53 Wed Mar 02 13:04:48 EST 2022 Tennis.txt
+     *     12 Wed Mar 02 15:15:34 EST 2022 BruceWayne.txt
+     *     }
+     * 
+ * The ByteArray was created by: + *
+     *  {@code
+     *     var jar = Files.readAllBytes("Valid-CEN-Comment-Length.jar");
+     *     var validEntryName = createByteArray(fooJar,
+     *           "VALID_ZIP_WITH_NO_COMMENTS_BYTES");
+     *  }
+     * 
+ */ + public static byte[] VALID_ZIP_WITH_NO_COMMENTS_BYTES = { + (byte) 0x50, (byte) 0x4b, (byte) 0x3, (byte) 0x4, (byte) 0x14, + (byte) 0x0, (byte) 0x8, (byte) 0x8, (byte) 0x8, (byte) 0x0, + (byte) 0xec, (byte) 0x34, (byte) 0x62, (byte) 0x54, (byte) 0x0, + (byte) 0x0, (byte) 0x0, (byte) 0x0, (byte) 0x0, (byte) 0x0, + (byte) 0x0, (byte) 0x0, (byte) 0x0, (byte) 0x0, (byte) 0x0, + (byte) 0x0, (byte) 0x9, (byte) 0x0, (byte) 0x4, (byte) 0x0, + (byte) 0x4d, (byte) 0x45, (byte) 0x54, (byte) 0x41, (byte) 0x2d, + (byte) 0x49, (byte) 0x4e, (byte) 0x46, (byte) 0x2f, (byte) 0xfe, + (byte) 0xca, (byte) 0x0, (byte) 0x0, (byte) 0x3, (byte) 0x0, + (byte) 0x50, (byte) 0x4b, (byte) 0x7, (byte) 0x8, (byte) 0x0, + (byte) 0x0, (byte) 0x0, (byte) 0x0, (byte) 0x2, (byte) 0x0, + (byte) 0x0, (byte) 0x0, (byte) 0x0, (byte) 0x0, (byte) 0x0, + (byte) 0x0, (byte) 0x50, (byte) 0x4b, (byte) 0x3, (byte) 0x4, + (byte) 0x14, (byte) 0x0, (byte) 0x8, (byte) 0x8, (byte) 0x8, + (byte) 0x0, (byte) 0xec, (byte) 0x34, (byte) 0x62, (byte) 0x54, + (byte) 0x0, (byte) 0x0, (byte) 0x0, (byte) 0x0, (byte) 0x0, + (byte) 0x0, (byte) 0x0, (byte) 0x0, (byte) 0x0, (byte) 0x0, + (byte) 0x0, (byte) 0x0, (byte) 0x14, (byte) 0x0, (byte) 0x0, + (byte) 0x0, (byte) 0x4d, (byte) 0x45, (byte) 0x54, (byte) 0x41, + (byte) 0x2d, (byte) 0x49, (byte) 0x4e, (byte) 0x46, (byte) 0x2f, + (byte) 0x4d, (byte) 0x41, (byte) 0x4e, (byte) 0x49, (byte) 0x46, + (byte) 0x45, (byte) 0x53, (byte) 0x54, (byte) 0x2e, (byte) 0x4d, + (byte) 0x46, (byte) 0xf3, (byte) 0x4d, (byte) 0xcc, (byte) 0xcb, + (byte) 0x4c, (byte) 0x4b, (byte) 0x2d, (byte) 0x2e, (byte) 0xd1, + (byte) 0xd, (byte) 0x4b, (byte) 0x2d, (byte) 0x2a, (byte) 0xce, + (byte) 0xcc, (byte) 0xcf, (byte) 0xb3, (byte) 0x52, (byte) 0x30, + (byte) 0xd4, (byte) 0x33, (byte) 0xe0, (byte) 0xe5, (byte) 0x72, + (byte) 0x2e, (byte) 0x4a, (byte) 0x4d, (byte) 0x2c, (byte) 0x49, + (byte) 0x4d, (byte) 0xd1, (byte) 0x75, (byte) 0xaa, (byte) 0x4, + (byte) 0xa, (byte) 0x98, (byte) 0xe8, (byte) 0x19, (byte) 0xe8, + (byte) 0x19, (byte) 0x2a, (byte) 0x68, (byte) 0xf8, (byte) 0x17, + (byte) 0x25, (byte) 0x26, (byte) 0xe7, (byte) 0xa4, (byte) 0x2a, + (byte) 0x38, (byte) 0xe7, (byte) 0x17, (byte) 0x15, (byte) 0xe4, + (byte) 0x17, (byte) 0x25, (byte) 0x96, (byte) 0x0, (byte) 0x15, + (byte) 0x6b, (byte) 0xf2, (byte) 0x72, (byte) 0xf1, (byte) 0x72, + (byte) 0x1, (byte) 0x0, (byte) 0x50, (byte) 0x4b, (byte) 0x7, + (byte) 0x8, (byte) 0xf4, (byte) 0x59, (byte) 0xdc, (byte) 0xa6, + (byte) 0x42, (byte) 0x0, (byte) 0x0, (byte) 0x0, (byte) 0x42, + (byte) 0x0, (byte) 0x0, (byte) 0x0, (byte) 0x50, (byte) 0x4b, + (byte) 0x3, (byte) 0x4, (byte) 0x14, (byte) 0x0, (byte) 0x8, + (byte) 0x8, (byte) 0x8, (byte) 0x0, (byte) 0xe3, (byte) 0x34, + (byte) 0x62, (byte) 0x54, (byte) 0x0, (byte) 0x0, (byte) 0x0, + (byte) 0x0, (byte) 0x0, (byte) 0x0, (byte) 0x0, (byte) 0x0, + (byte) 0x0, (byte) 0x0, (byte) 0x0, (byte) 0x0, (byte) 0x9, + (byte) 0x0, (byte) 0x0, (byte) 0x0, (byte) 0x48, (byte) 0x65, + (byte) 0x6c, (byte) 0x6c, (byte) 0x6f, (byte) 0x2e, (byte) 0x74, + (byte) 0x78, (byte) 0x74, (byte) 0xf3, (byte) 0x48, (byte) 0xcd, + (byte) 0xc9, (byte) 0xc9, (byte) 0x57, (byte) 0x28, (byte) 0xcf, + (byte) 0x2f, (byte) 0xca, (byte) 0x49, (byte) 0xe1, (byte) 0x2, + (byte) 0x0, (byte) 0x50, (byte) 0x4b, (byte) 0x7, (byte) 0x8, + (byte) 0xd5, (byte) 0xe0, (byte) 0x39, (byte) 0xb7, (byte) 0xe, + (byte) 0x0, (byte) 0x0, (byte) 0x0, (byte) 0xc, (byte) 0x0, + (byte) 0x0, (byte) 0x0, (byte) 0x50, (byte) 0x4b, (byte) 0x3, + (byte) 0x4, (byte) 0x14, (byte) 0x0, (byte) 0x8, (byte) 0x8, + (byte) 0x8, (byte) 0x0, (byte) 0x98, (byte) 0x68, (byte) 0x62, + (byte) 0x54, (byte) 0x0, (byte) 0x0, (byte) 0x0, (byte) 0x0, + (byte) 0x0, (byte) 0x0, (byte) 0x0, (byte) 0x0, (byte) 0x0, + (byte) 0x0, (byte) 0x0, (byte) 0x0, (byte) 0xa, (byte) 0x0, + (byte) 0x0, (byte) 0x0, (byte) 0x54, (byte) 0x65, (byte) 0x6e, + (byte) 0x6e, (byte) 0x69, (byte) 0x73, (byte) 0x2e, (byte) 0x74, + (byte) 0x78, (byte) 0x74, (byte) 0x73, (byte) 0xf2, (byte) 0xb, + (byte) 0x50, (byte) 0x8, (byte) 0x48, (byte) 0x2c, (byte) 0xca, + (byte) 0x4c, (byte) 0x4a, (byte) 0x2c, (byte) 0x56, (byte) 0xf0, + (byte) 0x2f, (byte) 0x48, (byte) 0xcd, (byte) 0x53, (byte) 0xc8, + (byte) 0x2c, (byte) 0x56, (byte) 0x48, (byte) 0x54, (byte) 0x48, + (byte) 0x2b, (byte) 0xcd, (byte) 0x53, (byte) 0x8, (byte) 0x49, + (byte) 0xcd, (byte) 0xcb, (byte) 0x3, (byte) 0x72, (byte) 0x42, + (byte) 0xf2, (byte) 0x4b, (byte) 0x8b, (byte) 0xf2, (byte) 0x12, + (byte) 0x73, (byte) 0x53, (byte) 0xf3, (byte) 0x4a, (byte) 0x14, + (byte) 0x4a, (byte) 0xf2, (byte) 0x15, (byte) 0xca, (byte) 0x13, + (byte) 0x4b, (byte) 0x92, (byte) 0x33, (byte) 0xb8, (byte) 0x0, + (byte) 0x50, (byte) 0x4b, (byte) 0x7, (byte) 0x8, (byte) 0xaa, + (byte) 0xad, (byte) 0x14, (byte) 0xd, (byte) 0x35, (byte) 0x0, + (byte) 0x0, (byte) 0x0, (byte) 0x35, (byte) 0x0, (byte) 0x0, + (byte) 0x0, (byte) 0x50, (byte) 0x4b, (byte) 0x3, (byte) 0x4, + (byte) 0x14, (byte) 0x0, (byte) 0x8, (byte) 0x8, (byte) 0x8, + (byte) 0x0, (byte) 0xf1, (byte) 0x79, (byte) 0x62, (byte) 0x54, + (byte) 0x0, (byte) 0x0, (byte) 0x0, (byte) 0x0, (byte) 0x0, + (byte) 0x0, (byte) 0x0, (byte) 0x0, (byte) 0x0, (byte) 0x0, + (byte) 0x0, (byte) 0x0, (byte) 0xe, (byte) 0x0, (byte) 0x0, + (byte) 0x0, (byte) 0x42, (byte) 0x72, (byte) 0x75, (byte) 0x63, + (byte) 0x65, (byte) 0x57, (byte) 0x61, (byte) 0x79, (byte) 0x6e, + (byte) 0x65, (byte) 0x2e, (byte) 0x74, (byte) 0x78, (byte) 0x74, + (byte) 0xf3, (byte) 0x54, (byte) 0x48, (byte) 0xcc, (byte) 0x55, + (byte) 0x70, (byte) 0x4a, (byte) 0x2c, (byte) 0xc9, (byte) 0x4d, + (byte) 0xcc, (byte) 0xe3, (byte) 0x2, (byte) 0x0, (byte) 0x50, + (byte) 0x4b, (byte) 0x7, (byte) 0x8, (byte) 0x6c, (byte) 0x70, + (byte) 0x60, (byte) 0xbd, (byte) 0xe, (byte) 0x0, (byte) 0x0, + (byte) 0x0, (byte) 0xc, (byte) 0x0, (byte) 0x0, (byte) 0x0, + (byte) 0x50, (byte) 0x4b, (byte) 0x1, (byte) 0x2, (byte) 0x14, + (byte) 0x0, (byte) 0x14, (byte) 0x0, (byte) 0x8, (byte) 0x8, + (byte) 0x8, (byte) 0x0, (byte) 0xec, (byte) 0x34, (byte) 0x62, + (byte) 0x54, (byte) 0x0, (byte) 0x0, (byte) 0x0, (byte) 0x0, + (byte) 0x2, (byte) 0x0, (byte) 0x0, (byte) 0x0, (byte) 0x0, + (byte) 0x0, (byte) 0x0, (byte) 0x0, (byte) 0x9, (byte) 0x0, + (byte) 0x4, (byte) 0x0, (byte) 0x0, (byte) 0x0, (byte) 0x0, + (byte) 0x0, (byte) 0x0, (byte) 0x0, (byte) 0x0, (byte) 0x0, + (byte) 0x0, (byte) 0x0, (byte) 0x0, (byte) 0x0, (byte) 0x0, + (byte) 0x0, (byte) 0x4d, (byte) 0x45, (byte) 0x54, (byte) 0x41, + (byte) 0x2d, (byte) 0x49, (byte) 0x4e, (byte) 0x46, (byte) 0x2f, + (byte) 0xfe, (byte) 0xca, (byte) 0x0, (byte) 0x0, (byte) 0x50, + (byte) 0x4b, (byte) 0x1, (byte) 0x2, (byte) 0x14, (byte) 0x0, + (byte) 0x14, (byte) 0x0, (byte) 0x8, (byte) 0x8, (byte) 0x8, + (byte) 0x0, (byte) 0xec, (byte) 0x34, (byte) 0x62, (byte) 0x54, + (byte) 0xf4, (byte) 0x59, (byte) 0xdc, (byte) 0xa6, (byte) 0x42, + (byte) 0x0, (byte) 0x0, (byte) 0x0, (byte) 0x42, (byte) 0x0, + (byte) 0x0, (byte) 0x0, (byte) 0x14, (byte) 0x0, (byte) 0x0, + (byte) 0x0, (byte) 0x0, (byte) 0x0, (byte) 0x0, (byte) 0x0, + (byte) 0x0, (byte) 0x0, (byte) 0x0, (byte) 0x0, (byte) 0x0, + (byte) 0x0, (byte) 0x3d, (byte) 0x0, (byte) 0x0, (byte) 0x0, + (byte) 0x4d, (byte) 0x45, (byte) 0x54, (byte) 0x41, (byte) 0x2d, + (byte) 0x49, (byte) 0x4e, (byte) 0x46, (byte) 0x2f, (byte) 0x4d, + (byte) 0x41, (byte) 0x4e, (byte) 0x49, (byte) 0x46, (byte) 0x45, + (byte) 0x53, (byte) 0x54, (byte) 0x2e, (byte) 0x4d, (byte) 0x46, + (byte) 0x50, (byte) 0x4b, (byte) 0x1, (byte) 0x2, (byte) 0x14, + (byte) 0x0, (byte) 0x14, (byte) 0x0, (byte) 0x8, (byte) 0x8, + (byte) 0x8, (byte) 0x0, (byte) 0xe3, (byte) 0x34, (byte) 0x62, + (byte) 0x54, (byte) 0xd5, (byte) 0xe0, (byte) 0x39, (byte) 0xb7, + (byte) 0xe, (byte) 0x0, (byte) 0x0, (byte) 0x0, (byte) 0xc, + (byte) 0x0, (byte) 0x0, (byte) 0x0, (byte) 0x9, (byte) 0x0, + (byte) 0x0, (byte) 0x0, (byte) 0x0, (byte) 0x0, (byte) 0x0, + (byte) 0x0, (byte) 0x0, (byte) 0x0, (byte) 0x0, (byte) 0x0, + (byte) 0x0, (byte) 0x0, (byte) 0xc1, (byte) 0x0, (byte) 0x0, + (byte) 0x0, (byte) 0x48, (byte) 0x65, (byte) 0x6c, (byte) 0x6c, + (byte) 0x6f, (byte) 0x2e, (byte) 0x74, (byte) 0x78, (byte) 0x74, + (byte) 0x50, (byte) 0x4b, (byte) 0x1, (byte) 0x2, (byte) 0x14, + (byte) 0x0, (byte) 0x14, (byte) 0x0, (byte) 0x8, (byte) 0x8, + (byte) 0x8, (byte) 0x0, (byte) 0x98, (byte) 0x68, (byte) 0x62, + (byte) 0x54, (byte) 0xaa, (byte) 0xad, (byte) 0x14, (byte) 0xd, + (byte) 0x35, (byte) 0x0, (byte) 0x0, (byte) 0x0, (byte) 0x35, + (byte) 0x0, (byte) 0x0, (byte) 0x0, (byte) 0xa, (byte) 0x0, + (byte) 0x0, (byte) 0x0, (byte) 0x0, (byte) 0x0, (byte) 0x0, + (byte) 0x0, (byte) 0x0, (byte) 0x0, (byte) 0x0, (byte) 0x0, + (byte) 0x0, (byte) 0x0, (byte) 0x6, (byte) 0x1, (byte) 0x0, + (byte) 0x0, (byte) 0x54, (byte) 0x65, (byte) 0x6e, (byte) 0x6e, + (byte) 0x69, (byte) 0x73, (byte) 0x2e, (byte) 0x74, (byte) 0x78, + (byte) 0x74, (byte) 0x50, (byte) 0x4b, (byte) 0x1, (byte) 0x2, + (byte) 0x14, (byte) 0x0, (byte) 0x14, (byte) 0x0, (byte) 0x8, + (byte) 0x8, (byte) 0x8, (byte) 0x0, (byte) 0xf1, (byte) 0x79, + (byte) 0x62, (byte) 0x54, (byte) 0x6c, (byte) 0x70, (byte) 0x60, + (byte) 0xbd, (byte) 0xe, (byte) 0x0, (byte) 0x0, (byte) 0x0, + (byte) 0xc, (byte) 0x0, (byte) 0x0, (byte) 0x0, (byte) 0xe, + (byte) 0x0, (byte) 0x0, (byte) 0x0, (byte) 0x0, (byte) 0x0, + (byte) 0x0, (byte) 0x0, (byte) 0x0, (byte) 0x0, (byte) 0x0, + (byte) 0x0, (byte) 0x0, (byte) 0x0, (byte) 0x73, (byte) 0x1, + (byte) 0x0, (byte) 0x0, (byte) 0x42, (byte) 0x72, (byte) 0x75, + (byte) 0x63, (byte) 0x65, (byte) 0x57, (byte) 0x61, (byte) 0x79, + (byte) 0x6e, (byte) 0x65, (byte) 0x2e, (byte) 0x74, (byte) 0x78, + (byte) 0x74, (byte) 0x50, (byte) 0x4b, (byte) 0x5, (byte) 0x6, + (byte) 0x0, (byte) 0x0, (byte) 0x0, (byte) 0x0, (byte) 0x5, + (byte) 0x0, (byte) 0x5, (byte) 0x0, (byte) 0x28, (byte) 0x1, + (byte) 0x0, (byte) 0x0, (byte) 0xbd, (byte) 0x1, (byte) 0x0, + (byte) 0x0, (byte) 0x0, (byte) 0x0, + }; + + /** + * Create Jar files used by the tests. + * The {@code byte} array {@code VALID_ZIP_WITH_NO_COMMENTS_BYTES} is written + * to disk to create the jar file: {@code Valid-CEN-Comment-Length.jar}. + * + * The jar file {@code InValid-CEN-Comment-Length.jar} is created by copying + * the {@code byte} array {@code VALID_ZIP_WITH_NO_COMMENTS_BYTES} and modifying + * the CEN file header comment length entry for "META-INF/MANIFEST.MF" so that + * new comment length will forward the CEN to a subsequent CEN file header + * entry. + * + * For {@code InValid-CEN-Comment-Length.jar}, the comment length is changed + * from {@code 0x0} to the {@code 0x37}. + * + * @throws IOException If an error occurs + */ + @BeforeTest + public void setup() throws IOException { + Files.deleteIfExists(VALID_CEN_COMMENT_LENGTH_JAR); + Files.deleteIfExists(INVALID_CEN_COMMENT_LENGTH_JAR); + // Create the valid jar + Files.write(VALID_CEN_COMMENT_LENGTH_JAR, VALID_ZIP_WITH_NO_COMMENTS_BYTES); + // Now create an invalid jar + byte[] invalid_bytes = Arrays.copyOf(VALID_ZIP_WITH_NO_COMMENTS_BYTES, + VALID_ZIP_WITH_NO_COMMENTS_BYTES.length); + // Change CEN file Header comment length so that the length will + // result in the offset pointing to a subsequent CEN file header + // resulting in an invalid comment + invalid_bytes[536] = 55; + Files.write(INVALID_CEN_COMMENT_LENGTH_JAR, invalid_bytes); + } + + /** + * Clean up after the test run + * + * @throws IOException If an error occurs + */ + @AfterTest + public static void cleanup() throws IOException { + Files.deleteIfExists(VALID_CEN_COMMENT_LENGTH_JAR); + Files.deleteIfExists(INVALID_CEN_COMMENT_LENGTH_JAR); + } + + /** + * Validate that the original(valid) Jar file can be opened by {@code ZipFile} + * and the expected Zip entry can be found + * @throws IOException If an error occurs + */ + @Test + public static void ZipFileValidCommentLengthTest() throws IOException { + try (ZipFile jf = new ZipFile(VALID_CEN_COMMENT_LENGTH_JAR.toFile())) { + ZipEntry ze = jf.getEntry(META_INF_MANIFEST_MF); + assertNotNull(ze); + assertEquals(ze.getName(), META_INF_MANIFEST_MF); + } + } + + /** + * Validate that the original(valid) Jar file can be opened by {@code JarFile} + * and the expected Zip entry can be found + * @throws IOException If an error occurs + */ + @Test + public static void JarFileValidCommentLengthTest() throws IOException { + try (JarFile jf = new JarFile(VALID_CEN_COMMENT_LENGTH_JAR.toFile())) { + ZipEntry ze = jf.getEntry(META_INF_MANIFEST_MF); + assertNotNull(ze); + assertEquals(ze.getName(), META_INF_MANIFEST_MF); + } + } + + /** + * Validate that a ZipException is thrown when the CEN file header comment + * length is non-zero and the CEN entry does not contain a comment when + * the Jar file is opened by {@code ZipFile} + */ + @Test + public static void ZipFileInValidCommentLengthTest() { + var ex= expectThrows(ZipException.class, + () -> new ZipFile(INVALID_CEN_COMMENT_LENGTH_JAR.toFile())); + assertEquals(ex.getMessage(), INVALID_CEN_HEADER_BAD_ENTRY_NAME_OR_COMMENT); + } + + /** + * Validate that a ZipException is thrown when the CEN file header comment + * length is non-zero and the CEN entry does not contain a comment when + * the Jar file is opened by {@code JarFile} + */ + @Test + public static void JarFileInValidCommentLengthTest() { + var ex= expectThrows(ZipException.class, + () -> new JarFile(INVALID_CEN_COMMENT_LENGTH_JAR.toFile())); + assertEquals(ex.getMessage(), INVALID_CEN_HEADER_BAD_ENTRY_NAME_OR_COMMENT); + } +} -- GitLab From ef266d77b6eb54d7e30a0aafd8a3e8c8f4f0e43a Mon Sep 17 00:00:00 2001 From: Roland Westrelin Date: Mon, 7 Mar 2022 16:26:19 +0000 Subject: [PATCH 169/340] 8278296: Generalize long range check transformation Reviewed-by: jrose, thartmann --- src/hotspot/share/opto/loopPredicate.cpp | 2 +- src/hotspot/share/opto/loopTransform.cpp | 246 +++++++++++++----- src/hotspot/share/opto/loopnode.cpp | 242 ++++++++++------- src/hotspot/share/opto/loopnode.hpp | 13 +- src/hotspot/share/opto/node.hpp | 7 +- .../c2/irTests/TestLongRangeChecks.java | 146 +++++++++++ .../rangechecks/TestLongRangeCheck.java | 222 +++++++++++----- 7 files changed, 644 insertions(+), 234 deletions(-) diff --git a/src/hotspot/share/opto/loopPredicate.cpp b/src/hotspot/share/opto/loopPredicate.cpp index 584df763156..ee88d0fabf4 100644 --- a/src/hotspot/share/opto/loopPredicate.cpp +++ b/src/hotspot/share/opto/loopPredicate.cpp @@ -759,7 +759,7 @@ bool IdealLoopTree::is_range_check_if(IfNode *iff, PhaseIdealLoop *phase, BasicT } scale = 0; offset = NULL; - if (!phase->is_scaled_iv_plus_offset(cmp->in(1), iv, &scale, &offset, bt)) { + if (!phase->is_scaled_iv_plus_offset(cmp->in(1), iv, bt, &scale, &offset)) { return false; } return true; diff --git a/src/hotspot/share/opto/loopTransform.cpp b/src/hotspot/share/opto/loopTransform.cpp index 21dab9335c0..a997439f43f 100644 --- a/src/hotspot/share/opto/loopTransform.cpp +++ b/src/hotspot/share/opto/loopTransform.cpp @@ -1121,18 +1121,18 @@ bool IdealLoopTree::policy_range_check(PhaseIdealLoop* phase, bool provisional, continue; // not RC } Node *cmp = bol->in(1); - Node *rc_exp = cmp->in(1); - Node *limit = cmp->in(2); if (provisional) { // Try to pattern match with either cmp inputs, do not check // whether one of the inputs is loop independent as it may not // have had a chance to be hoisted yet. - if (!phase->is_scaled_iv_plus_offset(cmp->in(1), trip_counter, NULL, NULL, bt) && - !phase->is_scaled_iv_plus_offset(cmp->in(2), trip_counter, NULL, NULL, bt)) { + if (!phase->is_scaled_iv_plus_offset(cmp->in(1), trip_counter, bt, NULL, NULL) && + !phase->is_scaled_iv_plus_offset(cmp->in(2), trip_counter, bt, NULL, NULL)) { continue; } } else { + Node *rc_exp = cmp->in(1); + Node *limit = cmp->in(2); Node *limit_c = phase->get_ctrl(limit); if (limit_c == phase->C->top()) { return false; // Found dead test on live IF? No RCE! @@ -1147,7 +1147,7 @@ bool IdealLoopTree::policy_range_check(PhaseIdealLoop* phase, bool provisional, } } - if (!phase->is_scaled_iv_plus_offset(rc_exp, trip_counter, NULL, NULL, bt)) { + if (!phase->is_scaled_iv_plus_offset(rc_exp, trip_counter, bt, NULL, NULL)) { continue; } } @@ -2522,127 +2522,202 @@ void PhaseIdealLoop::add_constraint(jlong stride_con, jlong scale_con, Node* off } } +//----------------------------------is_iv------------------------------------ +// Return true if exp is the value (of type bt) of the given induction var. +// This grammar of cases is recognized, where X is I|L according to bt: +// VIV[iv] = iv | (CastXX VIV[iv]) | (ConvI2X VIV[iv]) bool PhaseIdealLoop::is_iv(Node* exp, Node* iv, BasicType bt) { - if (exp == iv) { + exp = exp->uncast(); + if (exp == iv && iv->bottom_type()->isa_integer(bt)) { return true; } - if (bt == T_LONG && iv->bottom_type()->isa_int() && exp->Opcode() == Op_ConvI2L && exp->in(1) == iv) { + if (bt == T_LONG && iv->bottom_type()->isa_int() && exp->Opcode() == Op_ConvI2L && exp->in(1)->uncast() == iv) { return true; } return false; } //------------------------------is_scaled_iv--------------------------------- -// Return true if exp is a constant times an induction var -bool PhaseIdealLoop::is_scaled_iv(Node* exp, Node* iv, jlong* p_scale, BasicType bt, bool* converted) { - exp = exp->uncast(); - assert(bt == T_INT || bt == T_LONG, "unexpected int type"); - if (is_iv(exp, iv, bt)) { +// Return true if exp is a constant times the given induction var (of type bt). +// The multiplication is either done in full precision (exactly of type bt), +// or else bt is T_LONG but iv is scaled using 32-bit arithmetic followed by a ConvI2L. +// This grammar of cases is recognized, where X is I|L according to bt: +// SIV[iv] = VIV[iv] | (CastXX SIV[iv]) +// | (MulX VIV[iv] ConX) | (MulX ConX VIV[iv]) +// | (LShiftX VIV[iv] ConI) +// | (ConvI2L SIV[iv]) -- a "short-scale" can occur here; note recursion +// | (SubX 0 SIV[iv]) -- same as MulX(iv, -scale); note recursion +// VIV[iv] = [either iv or its value converted; see is_iv() above] +// On success, the constant scale value is stored back to *p_scale. +// The value (*p_short_scale) reports if such a ConvI2L conversion was present. +bool PhaseIdealLoop::is_scaled_iv(Node* exp, Node* iv, BasicType bt, jlong* p_scale, bool* p_short_scale, int depth) { + BasicType exp_bt = bt; + exp = exp->uncast(); //strip casts + assert(exp_bt == T_INT || exp_bt == T_LONG, "unexpected int type"); + if (is_iv(exp, iv, exp_bt)) { if (p_scale != NULL) { *p_scale = 1; } + if (p_short_scale != NULL) { + *p_short_scale = false; + } return true; } - if (bt == T_LONG && iv->bottom_type()->isa_int() && exp->Opcode() == Op_ConvI2L) { + if (exp_bt == T_LONG && iv->bottom_type()->isa_int() && exp->Opcode() == Op_ConvI2L) { exp = exp->in(1); - bt = T_INT; - if (converted != NULL) { - *converted = true; - } + exp_bt = T_INT; } int opc = exp->Opcode(); + int which = 0; // this is which subexpression we find the iv in // Can't use is_Mul() here as it's true for AndI and AndL - if (opc == Op_Mul(bt)) { - if (is_iv(exp->in(1)->uncast(), iv, bt) && exp->in(2)->is_Con()) { + if (opc == Op_Mul(exp_bt)) { + if ((is_iv(exp->in(which = 1), iv, exp_bt) && exp->in(2)->is_Con()) || + (is_iv(exp->in(which = 2), iv, exp_bt) && exp->in(1)->is_Con())) { + Node* factor = exp->in(which == 1 ? 2 : 1); // the other argument + jlong scale = factor->find_integer_as_long(exp_bt, 0); + if (scale == 0) { + return false; // might be top + } if (p_scale != NULL) { - *p_scale = exp->in(2)->get_integer_as_long(bt); + *p_scale = scale; + } + if (p_short_scale != NULL) { + // (ConvI2L (MulI iv K)) can be 64-bit linear if iv is kept small enough... + *p_short_scale = (exp_bt != bt && scale != 1); } return true; } - if (is_iv(exp->in(2)->uncast(), iv, bt) && exp->in(1)->is_Con()) { + } else if (opc == Op_LShift(exp_bt)) { + if (is_iv(exp->in(1), iv, exp_bt) && exp->in(2)->is_Con()) { + jint shift_amount = exp->in(2)->find_int_con(min_jint); + if (shift_amount == min_jint) { + return false; // might be top + } + jlong scale; + if (exp_bt == T_INT) { + scale = java_shift_left((jint)1, (juint)shift_amount); + } else if (exp_bt == T_LONG) { + scale = java_shift_left((jlong)1, (julong)shift_amount); + } if (p_scale != NULL) { - *p_scale = exp->in(1)->get_integer_as_long(bt); + *p_scale = scale; + } + if (p_short_scale != NULL) { + // (ConvI2L (MulI iv K)) can be 64-bit linear if iv is kept small enough... + *p_short_scale = (exp_bt != bt && scale != 1); } return true; } - } else if (opc == Op_LShift(bt)) { - if (is_iv(exp->in(1)->uncast(), iv, bt) && exp->in(2)->is_Con()) { + } else if (opc == Op_Sub(exp_bt) && + exp->in(1)->find_integer_as_long(exp_bt, -1) == 0) { + jlong scale = 0; + if (depth == 0 && is_scaled_iv(exp->in(2), iv, exp_bt, &scale, p_short_scale, depth + 1)) { + // SubX(0, iv*K) => iv*(-K) + if (scale == min_signed_integer(exp_bt)) { + // This should work even if -K overflows, but let's not. + return false; + } + scale = java_multiply(scale, (jlong)-1); if (p_scale != NULL) { - jint shift_amount = exp->in(2)->get_int(); - if (bt == T_INT) { - *p_scale = java_shift_left((jint)1, (juint)shift_amount); - } else if (bt == T_LONG) { - *p_scale = java_shift_left((jlong)1, (julong)shift_amount); - } + *p_scale = scale; + } + if (p_short_scale != NULL) { + // (ConvI2L (MulI iv K)) can be 64-bit linear if iv is kept small enough... + *p_short_scale = *p_short_scale || (exp_bt != bt && scale != 1); } return true; } } + // We could also recognize (iv*K1)*K2, even with overflow, but let's not. return false; } -//-----------------------------is_scaled_iv_plus_offset------------------------------ -// Return true if exp is a simple induction variable expression: k1*iv + (invar + k2) -bool PhaseIdealLoop::is_scaled_iv_plus_offset(Node* exp, Node* iv, jlong* p_scale, Node** p_offset, BasicType bt, bool* converted, int depth) { +//-------------------------is_scaled_iv_plus_offset-------------------------- +// Return true if exp is a simple linear transform of the given induction var. +// The scale must be constant and the addition tree (if any) must be simple. +// This grammar of cases is recognized, where X is I|L according to bt: +// +// OIV[iv] = SIV[iv] | (CastXX OIV[iv]) +// | (AddX SIV[iv] E) | (AddX E SIV[iv]) +// | (SubX SIV[iv] E) | (SubX E SIV[iv]) +// SSIV[iv] = (ConvI2X SIV[iv]) -- a "short scale" might occur here +// SIV[iv] = [a possibly scaled value of iv; see is_scaled_iv() above] +// +// On success, the constant scale value is stored back to *p_scale unless null. +// Likewise, the addend (perhaps a synthetic AddX node) is stored to *p_offset. +// Also, (*p_short_scale) reports if a ConvI2L conversion was seen after a MulI, +// meaning bt is T_LONG but iv was scaled using 32-bit arithmetic. +// To avoid looping, the match is depth-limited, and so may fail to match the grammar to complex expressions. +bool PhaseIdealLoop::is_scaled_iv_plus_offset(Node* exp, Node* iv, BasicType bt, jlong* p_scale, Node** p_offset, bool* p_short_scale, int depth) { assert(bt == T_INT || bt == T_LONG, "unexpected int type"); - if (is_scaled_iv(exp, iv, p_scale, bt, converted)) { + jlong scale = 0; // to catch result from is_scaled_iv() + BasicType exp_bt = bt; + exp = exp->uncast(); + if (is_scaled_iv(exp, iv, exp_bt, &scale, p_short_scale)) { + if (p_scale != NULL) { + *p_scale = scale; + } if (p_offset != NULL) { - Node *zero = _igvn.integercon(0, bt); + Node *zero = _igvn.zerocon(bt); set_ctrl(zero, C->root()); *p_offset = zero; } return true; } - exp = exp->uncast(); + if (exp_bt != bt) { + // We would now be matching inputs like (ConvI2L exp:(AddI (MulI iv S) E)). + // It's hard to make 32-bit arithmetic linear if it overflows. Although we do + // cope with overflowing multiplication by S, it would be even more work to + // handle overflowing addition of E. So we bail out here on ConvI2L input. + return false; + } int opc = exp->Opcode(); - if (opc == Op_Add(bt)) { - if (is_scaled_iv(exp->in(1), iv, p_scale, bt, converted)) { + int which = 0; // this is which subexpression we find the iv in + Node* offset = NULL; + if (opc == Op_Add(exp_bt)) { + // Check for a scaled IV in (AddX (MulX iv S) E) or (AddX E (MulX iv S)). + if (is_scaled_iv(exp->in(which = 1), iv, bt, &scale, p_short_scale) || + is_scaled_iv(exp->in(which = 2), iv, bt, &scale, p_short_scale)) { + offset = exp->in(which == 1 ? 2 : 1); // the other argument + if (p_scale != NULL) { + *p_scale = scale; + } if (p_offset != NULL) { - *p_offset = exp->in(2); + *p_offset = offset; } return true; } - if (is_scaled_iv(exp->in(2), iv, p_scale, bt, converted)) { - if (p_offset != NULL) { - *p_offset = exp->in(1); - } + // Check for more addends, like (AddX (AddX (MulX iv S) E1) E2), etc. + if (is_scaled_iv_plus_extra_offset(exp->in(1), exp->in(2), iv, bt, p_scale, p_offset, p_short_scale, depth) || + is_scaled_iv_plus_extra_offset(exp->in(2), exp->in(1), iv, bt, p_scale, p_offset, p_short_scale, depth)) { return true; } - if (exp->in(2)->is_Con()) { - Node* offset2 = NULL; - if (depth < 2 && - is_scaled_iv_plus_offset(exp->in(1), iv, p_scale, - p_offset != NULL ? &offset2 : NULL, bt, converted, depth+1)) { - if (p_offset != NULL) { - Node *ctrl_off2 = get_ctrl(offset2); - Node* offset = AddNode::make(offset2, exp->in(2), bt); - register_new_node(offset, ctrl_off2); - *p_offset = offset; + } else if (opc == Op_Sub(exp_bt)) { + if (is_scaled_iv(exp->in(which = 1), iv, bt, &scale, p_short_scale) || + is_scaled_iv(exp->in(which = 2), iv, bt, &scale, p_short_scale)) { + // Match (SubX SIV[iv] E) as if (AddX SIV[iv] (SubX 0 E)), and + // match (SubX E SIV[iv]) as if (AddX E (SubX 0 SIV[iv])). + offset = exp->in(which == 1 ? 2 : 1); // the other argument + if (which == 2) { + // We can't handle a scale of min_jint (or min_jlong) here as -1 * min_jint = min_jint + if (scale == min_signed_integer(bt)) { + return false; // cannot negate the scale of the iv } - return true; + scale = java_multiply(scale, (jlong)-1); } - } - } else if (opc == Op_Sub(bt)) { - if (is_scaled_iv(exp->in(1), iv, p_scale, bt, converted)) { - if (p_offset != NULL) { - Node *zero = _igvn.integercon(0, bt); - set_ctrl(zero, C->root()); - Node *ctrl_off = get_ctrl(exp->in(2)); - Node* offset = SubNode::make(zero, exp->in(2), bt); - register_new_node(offset, ctrl_off); - *p_offset = offset; + if (p_scale != NULL) { + *p_scale = scale; } - return true; - } - if (is_scaled_iv(exp->in(2), iv, p_scale, bt, converted)) { if (p_offset != NULL) { - // We can't handle a scale of min_jint (or min_jlong) here as -1 * min_jint = min_jint - if (*p_scale == min_signed_integer(bt)) { - return false; + if (which == 1) { // must negate the extracted offset + Node *zero = _igvn.integercon(0, exp_bt); + set_ctrl(zero, C->root()); + Node *ctrl_off = get_ctrl(offset); + offset = SubNode::make(zero, offset, exp_bt); + register_new_node(offset, ctrl_off); } - *p_scale *= -1; - *p_offset = exp->in(1); + *p_offset = offset; } return true; } @@ -2650,6 +2725,33 @@ bool PhaseIdealLoop::is_scaled_iv_plus_offset(Node* exp, Node* iv, jlong* p_scal return false; } +// Helper for is_scaled_iv_plus_offset(), not called separately. +// The caller encountered (AddX exp1 offset3) or (AddX offset3 exp1). +// Here, exp1 is inspected to see if it is a simple linear transform of iv. +// If so, the offset3 is combined with any other offset2 from inside exp1. +bool PhaseIdealLoop::is_scaled_iv_plus_extra_offset(Node* exp1, Node* offset3, Node* iv, + BasicType bt, + jlong* p_scale, Node** p_offset, + bool* p_short_scale, int depth) { + // By the time we reach here, it is unlikely that exp1 is a simple iv*K. + // If is a linear iv transform, it is probably an add or subtract. + // Let's collect the internal offset2 from it. + Node* offset2 = NULL; + if (offset3->is_Con() && + depth < 2 && + is_scaled_iv_plus_offset(exp1, iv, bt, p_scale, + &offset2, p_short_scale, depth+1)) { + if (p_offset != NULL) { + Node* ctrl_off2 = get_ctrl(offset2); + Node* offset = AddNode::make(offset2, offset3, bt); + register_new_node(offset, ctrl_off2); + *p_offset = offset; + } + return true; + } + return false; +} + // Same as PhaseIdealLoop::duplicate_predicates() but for range checks // eliminated by iteration splitting. Node* PhaseIdealLoop::add_range_check_predicate(IdealLoopTree* loop, CountedLoopNode* cl, diff --git a/src/hotspot/share/opto/loopnode.cpp b/src/hotspot/share/opto/loopnode.cpp index 25bf93883d9..6732c6dee01 100644 --- a/src/hotspot/share/opto/loopnode.cpp +++ b/src/hotspot/share/opto/loopnode.cpp @@ -1122,9 +1122,6 @@ void PhaseIdealLoop::strip_mined_nest_back_to_counted_loop(IdealLoopTree* loop, int PhaseIdealLoop::extract_long_range_checks(const IdealLoopTree* loop, jlong stride_con, int iters_limit, PhiNode* phi, Node_List& range_checks) { - if (stride_con < 0) { // only for stride_con > 0 && scale > 0 for now - return iters_limit; - } const jlong min_iters = 2; jlong reduced_iters_limit = iters_limit; jlong original_iters_limit = iters_limit; @@ -1139,7 +1136,6 @@ int PhaseIdealLoop::extract_long_range_checks(const IdealLoopTree* loop, jlong s RangeCheckNode* rc = c->in(0)->as_RangeCheck(); if (loop->is_range_check_if(rc, this, T_LONG, phi, range, offset, scale) && loop->is_invariant(range) && loop->is_invariant(offset) && - scale > 0 && // only for stride_con > 0 && scale > 0 for now original_iters_limit / ABS(scale * stride_con) >= min_iters) { reduced_iters_limit = MIN2(reduced_iters_limit, original_iters_limit/ABS(scale)); range_checks.push(c); @@ -1154,27 +1150,29 @@ int PhaseIdealLoop::extract_long_range_checks(const IdealLoopTree* loop, jlong s // One execution of the inner loop covers a sub-range of the entire iteration range of the loop: [A,Z), aka [A=init, // Z=limit). If the loop has at least one trip (which is the case here), the iteration variable i always takes A as its // first value, followed by A+S (S is the stride), next A+2S, etc. The limit is exclusive, so that the final value B of -// i is never Z. It will be B=Z-1 if S=1, or B=Z+1 if S=-1. If |S|>1 the formula for the last value requires a floor -// operation, specifically B=floor((Z-sgn(S)-A)/S)*S+A. Thus i ranges as i:[A,B] or i:[A,Z) or i:[A,Z-U) for some U 0) to simplify the logic for clamping 32-bit bounds (L_2, R_2). -// For restrictions on S and K, see the guards in extract_long_range_checks. +// If |S|>1 the formula for the last value B would require a floor operation, specifically B=floor((Z-sgn(S)-A)/S)*S+A, +// which is B=Z-sgn(S)U for some U in [1,|S|]. So when S>0, i ranges as i:[A,Z) or i:[A,B=Z-U], or else (in reverse) +// as i:(Z,A] or i:[B=Z+U,A]. It will become important to reason about this inclusive range [A,B] or [B,A]. // Within the loop there may be many range checks. Each such range check (R.C.) is of the form 0 <= i*K+L < R, where K // is a scale factor applied to the loop iteration variable i, and L is some offset; K, L, and R are loop-invariant. -// Because R is never negative, this check can always be simplified to an unsigned check i*K+L 0), where the limit is +// chosen to prevent various cases of 32-bit overflow (including multiplications j*K below). In the sub-loop the +// logical value i is offset from j by a 64-bit constant C, so i ranges in i:C+[0,Z_2). -// The union of all the C+[0,Z_2) ranges from the sub-loops must be identical to the whole range [A,B]. Assuming S>0, -// the first C must be A itself, and the next C value is the previous C+Z_2. In each sub-loop, j counts up from zero -// and exits just before i=C+Z_2. +// For S<0, j ranges (in reverse!) through j:[-|B_2|,0] or (-|Z_2|,0]. For either sign of S, we can say i=j+C and j +// ranges through 32-bit ranges [A_2,B_2] or [B_2,A_2] (A_2=0 of course). -// (N.B. If S<0 the formulas are different, because all the loops count downward.) +// The disjoint union of all the C+[A_2,B_2] ranges from the sub-loops must be identical to the whole range [A,B]. +// Assuming S>0, the first C must be A itself, and the next C value is the previous C+B_2, plus S. If |S|=1, the next +// C value is also the previous C+Z_2. In each sub-loop, j counts from j=A_2=0 and i counts from C+0 and exits at +// j=B_2 (i=C+B_2), just before it gets to i=C+Z_2. Both i and j count up (from C and 0) if S>0; otherwise they count +// down (from C and 0 again). // Returning to range checks, we see that each i*K+L 0 and K>0), Q_min=A_2*K+Q and Q_max=Q (if S<0 and K>0), +// Q_min=B_2*K+Q and Q_max=Q if (S>0 and K<0), Q_min=Q and Q_max=A_2*K+Q (if S<0 and K<0) -// N.B. If (S*K)<0 then the formulas for Q_min and Q_max may differ; the values may need to be swapped and adjusted to -// the correct type of bound (inclusive or exclusive). +// Note that the first R.C. value is always Q=(S*K>0 ? Q_min : Q_max). Also Q_{min,max} = Q + {min,max}(A_2*K,B_2*K). +// If S*K>0 then, as the loop iterations progress, each R.C. value i*K+L = j*K+Q goes up from Q=Q_min towards Q_max. +// If S*K<0 then j*K+Q starts at Q=Q_max and goes down towards Q_min. // Case A: Some Negatives (but no overflow). // Number line: // |s64_min . . . 0 . . . s64_max| // | . Q_min..Q_max . 0 . . . . | s64 negative +// | . . . . R=0 R< R< R< R< | (against R values) // | . . . Q_min..0..Q_max . . . | small mixed +// | . . . . R R R< R< R< | (against R values) +// +// R values which are out of range (>Q_max+1) are reduced to max(0,Q_max+1). They are marked on the number line as R<. // -// if Q_min 0 (R.C.E. steps upward) +// j*K + s32_trunc(Q_max) R R R< R< | (against R values) // | . . . . 0 . Q_min..Q_max . | s64 positive +// | . . . . R> R> R R R< | (against R values) +// +// R values which are out of range (Q_max+1) are reduced as marked: R> up to Q_min, R< down to Q_max+1. +// Then the whole comparison is shifted left by Q_min, so it can take place at zero, which is a nice 32-bit value. // -// if both Q_min, Q_max >=s64 0, then use this test: -// j*K + 0 =s64 0, then use this test: +// j*K + 0 0 +// More generally: +// j*K + Q - Q_min R> R> R> R | (against R values) +// +// In this case, Q_min >s64 Q_max+1, even though the mathematical values of Q_min and Q_max+1 are correctly ordered. +// The formulas from the previous case can be used, except that the bad upper bound Q_max is replaced by max_jlong. +// (In fact, we could use any replacement bound from R to max_jlong inclusive, as the input to the clamp function.) +// +// So if Q_min >=s64 0 but Q_max+1 0 +// More generally: +// j*K + Q - Q_min =s64 0 but Q_max H, it returns L not H. // -// Tests above can be merged into a single one: -// L_clamp = Q_min < 0 ? 0 : Q_min -// H_clamp = Q_max < Q_min ? R : Q_max -// j*K + Q_min - L_clamp = 0 ? max_jlong : Q_max+1 +// Q_first = Q = (S*K>0 ? Q_min : Q_max) = (C*K+L) +// R_clamp = clamp(R, L_clamp, H_clamp) --reduced dynamic range +// replacement R.C.: +// j*K + Q_first - L_clamp root()); + Node* int_zero = _igvn.intcon(0); + set_ctrl(int_zero, this->C->root()); + Node* long_one = _igvn.longcon(1); + set_ctrl(long_one, this->C->root()); + Node* int_stride = _igvn.intcon(checked_cast(stride_con)); + set_ctrl(int_stride, this->C->root()); for (uint i = 0; i < range_checks.size(); i++) { ProjNode* proj = range_checks.at(i)->as_Proj(); @@ -1266,8 +1303,8 @@ void PhaseIdealLoop::transform_long_range_checks(int stride_con, const Node_List // could be shared and have already been taken care of continue; } - bool converted = false; - bool ok = is_scaled_iv_plus_offset(rc_cmp->in(1), iv_add, &scale, &offset, T_LONG, &converted); + bool short_scale = false; + bool ok = is_scaled_iv_plus_offset(rc_cmp->in(1), iv_add, T_LONG, &scale, &offset, &short_scale); assert(ok, "inconsistent: was tested before"); Node* range = rc_cmp->in(2); Node* c = rc->in(0); @@ -1279,33 +1316,33 @@ void PhaseIdealLoop::transform_long_range_checks(int stride_con, const Node_List Node* L = offset; - if (converted) { + if (short_scale) { // This converts: - // i*K + L (long)max_jint and < R - // and so i*(long)K + L u64 (long)max_jint and still is root()); Node* max_range = new AddLNode(max_jint_plus_one_long, L); @@ -1315,26 +1352,38 @@ void PhaseIdealLoop::transform_long_range_checks(int stride_con, const Node_List } Node* C = outer_phi; - Node* Z_2 = new ConvI2LNode(inner_iters_actual_int, TypeLong::LONG); - register_new_node(Z_2, entry_control); // Start with 64-bit values: // i*K + L C, int_zero, inner_iters_actual_int, int_stride); + register_new_node(B_2, entry_control); + B_2 = new SubINode(B_2, int_stride); + register_new_node(B_2, entry_control); + B_2 = new ConvI2LNode(B_2); + register_new_node(B_2, entry_control); + + Node* Q_max = new MulLNode(B_2, K); register_new_node(Q_max, entry_control); - Q_max = new AddLNode(Q_max, L_2); + Q_max = new AddLNode(Q_max, Q_first); register_new_node(Q_max, entry_control); + if (scale * stride_con < 0) { + swap(Q_min, Q_max); + } + // Now, mathematically, Q_max > Q_min, and they are close enough so that (Q_max-Q_min) fits in 32 bits. + // L_clamp = Q_min < 0 ? 0 : Q_min Node* Q_min_cmp = new CmpLNode(Q_min, long_zero); register_new_node(Q_min_cmp, entry_control); @@ -1342,38 +1391,53 @@ void PhaseIdealLoop::transform_long_range_checks(int stride_con, const Node_List register_new_node(Q_min_bool, entry_control); Node* L_clamp = new CMoveLNode(Q_min_bool, Q_min, long_zero, TypeLong::LONG); register_new_node(L_clamp, entry_control); + // (This could also be coded bitwise as L_clamp = Q_min & ~(Q_min>>63).) + + Node* Q_max_plus_one = new AddLNode(Q_max, long_one); + register_new_node(Q_max_plus_one, entry_control); - // H_clamp = Q_max < Q_min ? R : Q_max - Node* Q_max_cmp = new CmpLNode(Q_max, Q_min); + // H_clamp = Q_max+1 < Q_min ? max_jlong : Q_max+1 + // (Because Q_min and Q_max are close, the overflow check could also be encoded as Q_max+1 < 0 & Q_min >= 0.) + Node* max_jlong_long = _igvn.longcon(max_jlong); + set_ctrl(max_jlong_long, this->C->root()); + Node* Q_max_cmp = new CmpLNode(Q_max_plus_one, Q_min); register_new_node(Q_max_cmp, entry_control); Node* Q_max_bool = new BoolNode(Q_max_cmp, BoolTest::lt); register_new_node(Q_max_bool, entry_control); - Node* H_clamp = new CMoveLNode(Q_max_bool, Q_max, R, TypeLong::LONG); + Node* H_clamp = new CMoveLNode(Q_max_bool, Q_max_plus_one, max_jlong_long, TypeLong::LONG); register_new_node(H_clamp, entry_control); + // (This could also be coded bitwise as H_clamp = ((Q_max+1)<<1 | M)>>>1 where M = (Q_max+1)>>63 & ~Q_min>>63.) // R_2 = clamp(R, L_clamp, H_clamp) - L_clamp - // that is: R_2 = clamp(R, L_clamp, H_clamp) if Q_min < 0 - // or: R_2 = clamp(R, L_clamp, H_clamp) - Q_min if Q_min > 0 + // that is: R_2 = clamp(R, L_clamp=0, H_clamp=Q_max) if Q_min < 0 + // or else: R_2 = clamp(R, L_clamp, H_clamp) - Q_min if Q_min >= 0 + // and also: R_2 = clamp(R, L_clamp, Q_max+1) - L_clamp if Q_min < Q_max+1 (no overflow) + // or else: R_2 = clamp(R, L_clamp, *no limit*)- L_clamp if Q_max+1 < Q_min (overflow) Node* R_2 = clamp(R, L_clamp, H_clamp); R_2 = new SubLNode(R_2, L_clamp); register_new_node(R_2, entry_control); R_2 = new ConvL2INode(R_2, TypeInt::POS); register_new_node(R_2, entry_control); - // Q = Q_min - L_clamp - // that is: Q = Q_min - 0 if Q_min < 0 - // or: Q = Q_min - Q_min = 0 if Q_min > 0 - Node* Q = new SubLNode(Q_min, L_clamp); - register_new_node(Q, entry_control); - Q = new ConvL2INode(Q, TypeInt::INT); - register_new_node(Q, entry_control); + // L_2 = Q_first - L_clamp + // We are subtracting L_clamp from both sides of the 0, then Q_first == 0 and the R.C. expression at -L_clamp and steps upward to Q_max-L_clamp. + // If S*K<0, then Q_first != 0 and the R.C. expression starts high and steps downward to Q_min-L_clamp. + Node* L_2 = new SubLNode(Q_first, L_clamp); + register_new_node(L_2, entry_control); + L_2 = new ConvL2INode(L_2, TypeInt::INT); + register_new_node(L_2, entry_control); - // Transform the range check + // Transform the range check using the computed values L_2/R_2 + // from: i*K + L (scale)); set_ctrl(K, this->C->root()); Node* scaled_iv = new MulINode(inner_phi, K); register_new_node(scaled_iv, c); - Node* scaled_iv_plus_offset = scaled_iv_plus_offset = new AddINode(scaled_iv, Q); + Node* scaled_iv_plus_offset = scaled_iv_plus_offset = new AddINode(scaled_iv, L_2); register_new_node(scaled_iv_plus_offset, c); Node* new_rc_cmp = new CmpUNode(scaled_iv_plus_offset, R_2); diff --git a/src/hotspot/share/opto/loopnode.hpp b/src/hotspot/share/opto/loopnode.hpp index 9b9a52f80af..606d9c46331 100644 --- a/src/hotspot/share/opto/loopnode.hpp +++ b/src/hotspot/share/opto/loopnode.hpp @@ -1265,15 +1265,15 @@ public: void mark_reductions( IdealLoopTree *loop ); // Return true if exp is a constant times an induction var - bool is_scaled_iv(Node* exp, Node* iv, jlong* p_scale, BasicType bt, bool* converted); + bool is_scaled_iv(Node* exp, Node* iv, BasicType bt, jlong* p_scale, bool* p_short_scale, int depth = 0); bool is_iv(Node* exp, Node* iv, BasicType bt); // Return true if exp is a scaled induction var plus (or minus) constant - bool is_scaled_iv_plus_offset(Node* exp, Node* iv, jlong* p_scale, Node** p_offset, BasicType bt, bool* converted = NULL, int depth = 0); + bool is_scaled_iv_plus_offset(Node* exp, Node* iv, BasicType bt, jlong* p_scale, Node** p_offset, bool* p_short_scale = NULL, int depth = 0); bool is_scaled_iv_plus_offset(Node* exp, Node* iv, int* p_scale, Node** p_offset) { jlong long_scale; - if (is_scaled_iv_plus_offset(exp, iv, &long_scale, p_offset, T_INT)) { + if (is_scaled_iv_plus_offset(exp, iv, T_INT, &long_scale, p_offset)) { int int_scale = checked_cast(long_scale); if (p_scale != NULL) { *p_scale = int_scale; @@ -1282,6 +1282,12 @@ public: } return false; } + // Helper for finding more complex matches to is_scaled_iv_plus_offset. + bool is_scaled_iv_plus_extra_offset(Node* exp1, Node* offset2, Node* iv, + BasicType bt, + jlong* p_scale, Node** p_offset, + bool* p_short_scale, int depth); + // Enum to determine the action to be performed in create_new_if_for_predicate() when processing phis of UCT regions. enum class UnswitchingAction { @@ -1658,6 +1664,7 @@ public: void strip_mined_nest_back_to_counted_loop(IdealLoopTree* loop, const BaseCountedLoopNode* head, Node* back_control, IfNode*&exit_test, SafePointNode*&safepoint); + void push_pinned_nodes_thru_region(IfNode* dom_if, Node* region); bool try_merge_identical_ifs(Node* n); diff --git a/src/hotspot/share/opto/node.hpp b/src/hotspot/share/opto/node.hpp index 6a03a080c82..748db286710 100644 --- a/src/hotspot/share/opto/node.hpp +++ b/src/hotspot/share/opto/node.hpp @@ -1153,7 +1153,12 @@ public: jlong get_integer_as_long(BasicType bt) const { const TypeInteger* t = find_integer_type(bt); - guarantee(t != NULL, "must be con"); + guarantee(t != NULL && t->is_con(), "must be con"); + return t->get_con_as_long(bt); + } + jlong find_integer_as_long(BasicType bt, jlong value_if_unknown) const { + const TypeInteger* t = find_integer_type(bt); + if (t == NULL || !t->is_con()) return value_if_unknown; return t->get_con_as_long(bt); } const TypePtr* get_ptr_type() const; diff --git a/test/hotspot/jtreg/compiler/c2/irTests/TestLongRangeChecks.java b/test/hotspot/jtreg/compiler/c2/irTests/TestLongRangeChecks.java index 4fd677ab4c0..e84f3062f14 100644 --- a/test/hotspot/jtreg/compiler/c2/irTests/TestLongRangeChecks.java +++ b/test/hotspot/jtreg/compiler/c2/irTests/TestLongRangeChecks.java @@ -96,4 +96,150 @@ public class TestLongRangeChecks { private void testStridePosScalePosInIntLoop2_runner() { testStridePosScalePosInIntLoop2(0, 100, 200, 0); } + + @Test + @IR(counts = { IRNode.LOOP, "1"}) + @IR(failOn = { IRNode.COUNTEDLOOP}) + public static void testStrideNegScaleNeg(long start, long stop, long length, long offset) { + final long scale = -1; + final long stride = 1; + for (long i = stop; i > start; i -= stride) { + Objects.checkIndex(scale * i + offset, length); + } + } + + @Run(test = "testStrideNegScaleNeg") + private void testStrideNegScaleNeg_runner() { + testStrideNegScaleNeg(0, 100, 100, 100); + } + + @Test + @IR(counts = { IRNode.LOOP, "1" }) + @IR(failOn = { IRNode.COUNTEDLOOP }) + public static void testStrideNegScaleNegInIntLoop1(int start, int stop, long length, long offset) { + final long scale = -2; + final int stride = 1; + + for (int i = stop; i > start; i -= stride) { + Objects.checkIndex(scale * i + offset, length); + } + } + + @Run(test = "testStrideNegScaleNegInIntLoop1") + private void testStrideNegScaleNegInIntLoop1_runner() { + testStrideNegScaleNegInIntLoop1(0, 100, 200, 200); + } + + @Test + @IR(counts = { IRNode.LOOP, "1" }) + @IR(failOn = { IRNode.COUNTEDLOOP }) + public static void testStrideNegScaleNegInIntLoop2(int start, int stop, long length, long offset) { + final int scale = -2; + final int stride = 1; + + for (int i = stop; i > start; i -= stride) { + Objects.checkIndex(scale * i + offset, length); + } + } + + @Run(test = "testStrideNegScaleNegInIntLoop2") + private void testStrideNegScaleNegInIntLoop2_runner() { + testStrideNegScaleNegInIntLoop2(0, 100, 200, 200); + } + + @Test + @IR(counts = { IRNode.LOOP, "1"}) + @IR(failOn = { IRNode.COUNTEDLOOP}) + public static void testStrideNegScalePos(long start, long stop, long length, long offset) { + final long scale = 1; + final long stride = 1; + for (long i = stop-1; i >= start; i -= stride) { + Objects.checkIndex(scale * i + offset, length); + } + } + + @Run(test = "testStrideNegScalePos") + private void testStrideNegScalePos_runner() { + testStrideNegScalePos(0, 100, 100, 0); + } + + @Test + @IR(counts = { IRNode.LOOP, "1" }) + @IR(failOn = { IRNode.COUNTEDLOOP }) + public static void testStrideNegScalePosInIntLoop1(int start, int stop, long length, long offset) { + final long scale = 2; + final int stride = 1; + for (int i = stop-1; i >= start; i -= stride) { + Objects.checkIndex(scale * i + offset, length); + } + } + + @Run(test = "testStrideNegScalePosInIntLoop1") + private void testStrideNegScalePosInIntLoop1_runner() { + testStrideNegScalePosInIntLoop1(0, 100, 200, 0); + } + + @Test + @IR(counts = { IRNode.LOOP, "1" }) + @IR(failOn = { IRNode.COUNTEDLOOP }) + public static void testStrideNegScalePosInIntLoop2(int start, int stop, long length, long offset) { + final int scale = 2; + final int stride = 1; + for (int i = stop-1; i >= start; i -= stride) { + Objects.checkIndex(scale * i + offset, length); + } + } + + @Run(test = "testStrideNegScalePosInIntLoop2") + private void testStrideNegScalePosInIntLoop2_runner() { + testStrideNegScalePosInIntLoop1(0, 100, 200, 0); + } + + @Test + @IR(counts = { IRNode.LOOP, "1"}) + @IR(failOn = { IRNode.COUNTEDLOOP}) + public static void testStridePosScaleNeg(long start, long stop, long length, long offset) { + final long scale = -1; + final long stride = 1; + for (long i = start; i < stop; i += stride) { + Objects.checkIndex(scale * i + offset, length); + } + } + + @Run(test = "testStridePosScaleNeg") + private void testStridePosScaleNeg_runner() { + testStridePosScaleNeg(0, 100, 100, 99); + } + + @Test + @IR(counts = { IRNode.LOOP, "1"}) + @IR(failOn = { IRNode.COUNTEDLOOP}) + public static void testStridePosScaleNegInIntLoop1(int start, int stop, long length, long offset) { + final long scale = -2; + final int stride = 1; + for (int i = start; i < stop; i += stride) { + Objects.checkIndex(scale * i + offset, length); + } + } + + @Run(test = "testStridePosScaleNegInIntLoop1") + private void testStridePosScaleNegInIntLoop1_runner() { + testStridePosScaleNegInIntLoop1(0, 100, 200, 198); + } + + @Test + @IR(counts = { IRNode.LOOP, "1"}) + @IR(failOn = { IRNode.COUNTEDLOOP}) + public static void testStridePosScaleNegInIntLoop2(int start, int stop, long length, long offset) { + final int scale = -2; + final int stride = 1; + for (int i = start; i < stop; i += stride) { + Objects.checkIndex(scale * i + offset, length); + } + } + + @Run(test = "testStridePosScaleNegInIntLoop2") + private void testStridePosScaleNegInIntLoop2_runner() { + testStridePosScaleNegInIntLoop1(0, 100, 200, 198); + } } diff --git a/test/hotspot/jtreg/compiler/rangechecks/TestLongRangeCheck.java b/test/hotspot/jtreg/compiler/rangechecks/TestLongRangeCheck.java index d56d19278cf..1cd04523ba7 100644 --- a/test/hotspot/jtreg/compiler/rangechecks/TestLongRangeCheck.java +++ b/test/hotspot/jtreg/compiler/rangechecks/TestLongRangeCheck.java @@ -127,6 +127,73 @@ public class TestLongRangeCheck { assertIsNotCompiled(m); } + private static void testOverflow(String method, long start, long stop, long length, long offset0, long offset1) throws Exception { + Method m = newClassLoader().loadClass("TestLongRangeCheck").getDeclaredMethod(method, long.class, long.class, long.class, long.class); + m.invoke(null, start, stop, length, offset0); + compile(m); + + m.invoke(null, start, stop, length, offset0); + assertIsCompiled(m); + try { + m.invoke(null, start, stop, length, offset1); + throw new RuntimeException("should have thrown"); + } catch(InvocationTargetException e) { + if (!(e.getCause() instanceof IndexOutOfBoundsException)) { + throw new RuntimeException("unexpected exception"); + } + } + assertIsNotCompiled(m); + } + + private static void testConditional(String method, long start, long stop, long length, long offset0, long offset1, long start1, long stop1) throws Exception { + Method m; + + if (start1 != start) { + m = newClassLoader().loadClass("TestLongRangeCheck").getDeclaredMethod(method, long.class, long.class, long.class, long.class, long.class, long.class); + m.invoke(null, start, stop, length, offset0, start, stop); + compile(m); + + m.invoke(null, start, stop, length, offset0, start, stop); + assertIsCompiled(m); + try { + m.invoke(null, start, stop, length, offset1, start1-1, stop1); + throw new RuntimeException("should have thrown"); + } catch(InvocationTargetException e) { + if (!(e.getCause() instanceof IndexOutOfBoundsException)) { + throw new RuntimeException("unexpected exception"); + } + } + assertIsNotCompiled(m); + } + + if (stop1 != stop) { + m = newClassLoader().loadClass("TestLongRangeCheck").getDeclaredMethod(method, long.class, long.class, long.class, long.class, long.class, long.class); + m.invoke(null, start, stop, length, offset0, start, stop); + compile(m); + + m.invoke(null, start, stop, length, offset0, start, stop); + assertIsCompiled(m); + try { + m.invoke(null, start, stop, length, offset1, start1, stop1+1); + throw new RuntimeException("should have thrown"); + } catch(InvocationTargetException e) { + if (!(e.getCause() instanceof IndexOutOfBoundsException)) { + throw new RuntimeException("unexpected exception"); + } + } + assertIsNotCompiled(m); + } + + m = newClassLoader().loadClass("TestLongRangeCheck").getDeclaredMethod(method, long.class, long.class, long.class, long.class, long.class, long.class); + m.invoke(null, start, stop, length, offset0, start, stop); + compile(m); + + m.invoke(null, start, stop, length, offset0, start, stop); + assertIsCompiled(m); + + m.invoke(null, start, stop, length, offset1, start1, stop1); + assertIsCompiled(m); + } public static void main(String[] args) throws Exception { @@ -157,42 +224,20 @@ public class TestLongRangeCheck { test("testStridePosNotOneScaleNeg", -v, v, v * 2, v-1); // offset causes overflow - - { - Method m = newClassLoader().loadClass("TestLongRangeCheck").getDeclaredMethod("testStridePosScalePos", long.class, long.class, long.class, long.class); - m.invoke(null, 0, 100, 100, 0); - compile(m); - - m.invoke(null, 0, 100, 100, 0); - assertIsCompiled(m); - try { - m.invoke(null, 0, 100, 100, Long.MAX_VALUE - 50); - throw new RuntimeException("should have thrown"); - } catch(InvocationTargetException e) { - if (!(e.getCause() instanceof IndexOutOfBoundsException)) { - throw new RuntimeException("unexpected exception"); - } - } - assertIsNotCompiled(m); - } + testOverflow("testStridePosScalePos", 0, 100, 100, 0, Long.MAX_VALUE - 50); + testOverflow("testStrideNegScaleNeg", 0, 100, 100, 100, Long.MIN_VALUE + 50); + testOverflow("testStrideNegScalePos", 0, 100, 100, 0, Long.MAX_VALUE - 50); + testOverflow("testStridePosScaleNeg", 0, 100, 100, 99, Long.MIN_VALUE + 50); // no spurious deopt if the range check doesn't fail because not executed - { - Method m = newClassLoader().loadClass("TestLongRangeCheck").getDeclaredMethod("testStridePosScalePosConditional", long.class, long.class, long.class, long.class, long.class, long.class); - m.invoke(null, 0, 100, 100, 0, 0, 100); - compile(m); - - m.invoke(null, 0, 100, 100, -50, 50, 100); - assertIsCompiled(m); - } - { - Method m = newClassLoader().loadClass("TestLongRangeCheck").getDeclaredMethod("testStridePosScalePosConditional", long.class, long.class, long.class, long.class, long.class, long.class); - m.invoke(null, 0, 100, 100, 0, 0, 100); - compile(m); - - m.invoke(null, 0, 100, Long.MAX_VALUE, Long.MAX_VALUE - 50, 0, 50); - assertIsCompiled(m); - } + testConditional("testStridePosScalePosConditional", 0, 100, 100, 0, -50, 50, 100); + testConditional("testStridePosScalePosConditional", 0, 100, Long.MAX_VALUE, 0, Long.MAX_VALUE - 50, 0, 50); + testConditional("testStrideNegScaleNegConditional", 0, 100, 100, 100, 50, 0, 51); + testConditional("testStrideNegScaleNegConditional", 0, 100, Long.MAX_VALUE, 100, Long.MIN_VALUE + 50, 52, 100); + testConditional("testStrideNegScalePosConditional", 0, 100, 100, 0, -50, 50, 100); + testConditional("testStrideNegScalePosConditional", 0, 100, Long.MAX_VALUE, 100, Long.MAX_VALUE - 50, 0, 50); + testConditional("testStridePosScaleNegConditional", 0, 100, 100, 99, 50, 0, 51); + testConditional("testStridePosScaleNegConditional", 0, 100, Long.MAX_VALUE, 99, Long.MIN_VALUE + 50, 52, 100); test("testStridePosScalePosInIntLoop", 0, 100, 100, 0); @@ -221,40 +266,19 @@ public class TestLongRangeCheck { test("testStridePosNotOneScaleNegInIntLoop", -v, v, v * 4, 2 * v - 1); // offset causes overflow - { - Method m = newClassLoader().loadClass("TestLongRangeCheck").getDeclaredMethod("testStridePosScalePosInIntLoop", long.class, long.class, long.class, long.class); - m.invoke(null, 0, 100, 100, 0); - compile(m); - - m.invoke(null, 0, 100, 100, 0); - assertIsCompiled(m); - try { - m.invoke(null, 0, 100, 100, Long.MAX_VALUE - 50); - throw new RuntimeException("should have thrown"); - } catch(InvocationTargetException e) { - if (!(e.getCause() instanceof IndexOutOfBoundsException)) { - throw new RuntimeException("unexpected exception"); - } - } - assertIsNotCompiled(m); - } + testOverflow("testStridePosScalePosInIntLoop", 0, 100, 100, 0, Long.MAX_VALUE - 50); + testOverflow("testStrideNegScaleNegInIntLoop", 0, 100, 100, 100, Long.MIN_VALUE + 50); + testOverflow("testStrideNegScalePosInIntLoop", 0, 100, 100, 0, Long.MAX_VALUE - 50); + testOverflow("testStridePosScaleNegInIntLoop", 0, 100, 100, 99, Long.MIN_VALUE + 50); // no spurious deopt if the range check doesn't fail because not executed - { - Method m = newClassLoader().loadClass("TestLongRangeCheck").getDeclaredMethod("testStridePosScalePosConditional", long.class, long.class, long.class, long.class, long.class, long.class); - m.invoke(null, 0, 100, 100, 0, 0, 100); - compile(m); - - m.invoke(null, 0, 100, 100, -50, 50, 100); - assertIsCompiled(m); - } - { - Method m = newClassLoader().loadClass("TestLongRangeCheck").getDeclaredMethod("testStridePosScalePosConditional", long.class, long.class, long.class, long.class, long.class, long.class); - m.invoke(null, 0, 100, 100, 0, 0, 100); - compile(m); - - m.invoke(null, 0, 100, Long.MAX_VALUE, Long.MAX_VALUE - 50, 0, 50); - assertIsCompiled(m); - } + testConditional("testStridePosScalePosConditionalInIntLoop", 0, 100, 100, 0, -50, 50, 100); + testConditional("testStridePosScalePosConditionalInIntLoop", 0, 100, Long.MAX_VALUE, 0, Long.MAX_VALUE - 50, 0, 50); + testConditional("testStrideNegScaleNegConditionalInIntLoop", 0, 100, 100, 100, 50, 0, 51); + testConditional("testStrideNegScaleNegConditionalInIntLoop", 0, 100, Long.MAX_VALUE, 100, Long.MIN_VALUE + 50, 52, 100); + testConditional("testStrideNegScalePosConditionalInIntLoop", 0, 100, 100, 0, -50, 50, 100); + testConditional("testStrideNegScalePosConditionalInIntLoop", 0, 100, Long.MAX_VALUE, 100, Long.MAX_VALUE - 50, 0, 50); + testConditional("testStridePosScaleNegConditionalInIntLoop", 0, 100, 100, 99, 50, 0, 51); + testConditional("testStridePosScaleNegConditionalInIntLoop", 0, 100, Long.MAX_VALUE, 99, Long.MIN_VALUE + 50, 52, 100); test("testStridePosScalePosNotOneInIntLoop2", 0, 100, 1090, 0); @@ -411,6 +435,36 @@ public class TestLongRangeCheck { } } + public static void testStrideNegScaleNegConditional(long start, long stop, long length, long offset, long start2, long stop2) { + final long scale = -1; + final long stride = 1; + for (long i = stop; i > start; i -= stride) { + if (i >= start2 && i < stop2) { + Preconditions.checkIndex(scale * i + offset, length, null); + } + } + } + + public static void testStrideNegScalePosConditional(long start, long stop, long length, long offset, long start2, long stop2) { + final long scale = 1; + final long stride = 1; + for (long i = stop-1; i >= start; i -= stride) { + if (i >= start2 && i < stop2) { + Preconditions.checkIndex(scale * i + offset, length, null); + } + } + } + + public static void testStridePosScaleNegConditional(long start, long stop, long length, long offset, long start2, long stop2) { + final long scale = -1; + final long stride = 1; + for (long i = start; i < stop; i += stride) { + if (i >= start2 && i < stop2) { + Preconditions.checkIndex(scale * i + offset, length, null); + } + } + } + private static void checkInputs(long... inputs) { for (int i = 0; i < inputs.length; i++) { if ((long)((int)inputs[i]) != inputs[i]) { @@ -529,7 +583,6 @@ public class TestLongRangeCheck { public static void testStridePosScalePosConditionalInIntLoop(long start, long stop, long length, long offset, long start2, long stop2) { checkInputs(start, stop, start2, stop2); - Preconditions.checkIndex(0, length, null); final long scale = 1; final int stride = 1; for (int i = (int)start; i < (int)stop; i += stride) { @@ -539,6 +592,39 @@ public class TestLongRangeCheck { } } + public static void testStrideNegScaleNegConditionalInIntLoop(long start, long stop, long length, long offset, long start2, long stop2) { + checkInputs(start, stop, start2, stop2); + final long scale = -1; + final int stride = 1; + for (int i = (int)stop; i > (int)start; i -= stride) { + if (i >= (int)start2 && i < (int)stop2) { + Preconditions.checkIndex(scale * i + offset, length, null); + } + } + } + + public static void testStrideNegScalePosConditionalInIntLoop(long start, long stop, long length, long offset, long start2, long stop2) { + checkInputs(start, stop, start2, stop2); + final long scale = 1; + final int stride = 1; + for (int i = (int)(stop-1); i >= (int)start; i -= stride) { + if (i >= (int)start2 && i < (int)stop2) { + Preconditions.checkIndex(scale * i + offset, length, null); + } + } + } + + public static void testStridePosScaleNegConditionalInIntLoop(long start, long stop, long length, long offset, long start2, long stop2) { + checkInputs(start, stop, start2, stop2); + final long scale = -1; + final int stride = 1; + for (int i = (int)start; i < (int)stop; i += stride) { + if (i >= (int)start2 && i < (int)stop2) { + Preconditions.checkIndex(scale * i + offset, length, null); + } + } + } + public static void testStridePosScalePosNotOneInIntLoop2(long start, long stop, long length, long offset) { checkInputs(start, stop); final int scale = 11; -- GitLab From 7194097bcae7e0fd32488834277bb18cb97cea8b Mon Sep 17 00:00:00 2001 From: Kim Barrett Date: Mon, 7 Mar 2022 17:35:21 +0000 Subject: [PATCH 170/340] 8252577: HotSpot Style Guide should link to One-True-Brace-Style description Reviewed-by: stuefe, dcubed, dholmes --- doc/hotspot-style.html | 2 +- doc/hotspot-style.md | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/doc/hotspot-style.html b/doc/hotspot-style.html index eb0c8de2ae5..75211788c6b 100644 --- a/doc/hotspot-style.html +++ b/doc/hotspot-style.html @@ -153,7 +153,7 @@

Whitespace

  • In general, don't change whitespace unless it improves readability or consistency. Gratuitous whitespace changes will make integrations and backports more difficult.

  • -
  • Use One-True-Brace-Style. The opening brace for a function or class is normally at the end of the line; it is sometimes moved to the beginning of the next line for emphasis. Substatements are enclosed in braces, even if there is only a single statement. Extremely simple one-line statements may drop braces around a substatement.

  • +
  • Use One-True-Brace-Style. The opening brace for a function or class is normally at the end of the line; it is sometimes moved to the beginning of the next line for emphasis. Substatements are enclosed in braces, even if there is only a single statement. Extremely simple one-line statements may drop braces around a substatement.

  • Indentation levels are two columns.

  • There is no hard line length limit. That said, bear in mind that excessively long lines can cause difficulties. Some people like to have multiple side-by-side windows in their editors, and long lines may force them to choose among unpleasant options. They can use wide windows, reducing the number that can fit across the screen, and wasting a lot of screen real estate because most lines are not that long. Alternatively, they can have more windows across the screen, with long lines wrapping (or worse, requiring scrolling to see in their entirety), which is harder to read. Similar issues exist for side-by-side code reviews.

  • Tabs are not allowed in code. Set your editor accordingly.
    (Emacs: (setq-default indent-tabs-mode nil).)

  • diff --git a/doc/hotspot-style.md b/doc/hotspot-style.md index 4efce0301b2..4720c9f558c 100644 --- a/doc/hotspot-style.md +++ b/doc/hotspot-style.md @@ -294,7 +294,9 @@ well. or consistency. Gratuitous whitespace changes will make integrations and backports more difficult. -* Use One-True-Brace-Style. The opening brace for a function or class +* Use [One-True-Brace-Style]( +https://en.wikipedia.org/wiki/Indentation_style#Variant:_1TBS_(OTBS)). +The opening brace for a function or class is normally at the end of the line; it is sometimes moved to the beginning of the next line for emphasis. Substatements are enclosed in braces, even if there is only a single statement. Extremely simple -- GitLab From 1faa5c8092f8baec3ca08ed059653876ec46db46 Mon Sep 17 00:00:00 2001 From: Joe Darcy Date: Mon, 7 Mar 2022 17:52:04 +0000 Subject: [PATCH 171/340] 8282686: Add constructors taking a cause to SocketException Reviewed-by: alanb, xuelei, lancea, dfuchs --- .../classes/java/net/DatagramSocket.java | 6 +-- .../classes/java/net/SocketException.java | 25 ++++++++- .../classes/javax/net/SocketFactory.java | 10 ++-- .../javax/net/ssl/SSLServerSocketFactory.java | 3 +- .../javax/net/ssl/SSLSocketFactory.java | 3 +- .../sun/nio/ch/DatagramSocketAdaptor.java | 14 ++--- .../TestSocketExceptionCtor.java | 54 +++++++++++++++++++ 7 files changed, 90 insertions(+), 25 deletions(-) create mode 100644 test/jdk/java/net/SocketException/TestSocketExceptionCtor.java diff --git a/src/java.base/share/classes/java/net/DatagramSocket.java b/src/java.base/share/classes/java/net/DatagramSocket.java index 114794be1f9..1833dd2470d 100644 --- a/src/java.base/share/classes/java/net/DatagramSocket.java +++ b/src/java.base/share/classes/java/net/DatagramSocket.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1995, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1995, 2022, 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 @@ -1353,9 +1353,7 @@ public class DatagramSocket implements java.io.Closeable { Throwable cause = e.getCause(); if (cause instanceof SocketException) return (SocketException) cause; - SocketException se = new SocketException(e.getMessage()); - se.initCause(e); - return se; + return new SocketException(e.getMessage(), e); } /** diff --git a/src/java.base/share/classes/java/net/SocketException.java b/src/java.base/share/classes/java/net/SocketException.java index f4a412258df..7b738249923 100644 --- a/src/java.base/share/classes/java/net/SocketException.java +++ b/src/java.base/share/classes/java/net/SocketException.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1995, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1995, 2022, 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 @@ -52,4 +52,27 @@ public class SocketException extends IOException { */ public SocketException() { } + + /** + * Constructs a new {@code SocketException} with the + * specified detail message and cause. + * + * @param msg the detail message. + * @param cause the cause + * @since 19 + */ + public SocketException(String msg, Throwable cause) { + super(msg, cause); + } + + /** + * Constructs a new {@code SocketException} with the + * specified cause. + * + * @param cause the cause + * @since 19 + */ + public SocketException(Throwable cause) { + super(cause); + } } diff --git a/src/java.base/share/classes/javax/net/SocketFactory.java b/src/java.base/share/classes/javax/net/SocketFactory.java index 5d56483b9de..285167500b8 100644 --- a/src/java.base/share/classes/javax/net/SocketFactory.java +++ b/src/java.base/share/classes/javax/net/SocketFactory.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2022, 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 @@ -120,12 +120,8 @@ public abstract class SocketFactory // The Exception is used by HttpsClient to signal that // unconnected sockets have not been implemented. // - UnsupportedOperationException uop = new - UnsupportedOperationException(); - SocketException se = new SocketException( - "Unconnected sockets not implemented"); - se.initCause(uop); - throw se; + throw new SocketException("Unconnected sockets not implemented", + new UnsupportedOperationException()); } diff --git a/src/java.base/share/classes/javax/net/ssl/SSLServerSocketFactory.java b/src/java.base/share/classes/javax/net/ssl/SSLServerSocketFactory.java index 68c09c02a6f..22f64f98f29 100644 --- a/src/java.base/share/classes/javax/net/ssl/SSLServerSocketFactory.java +++ b/src/java.base/share/classes/javax/net/ssl/SSLServerSocketFactory.java @@ -173,8 +173,7 @@ class DefaultSSLServerSocketFactory extends SSLServerSocketFactory { } private ServerSocket throwException() throws SocketException { - throw (SocketException) - new SocketException(reason.toString()).initCause(reason); + throw new SocketException(reason.toString(), reason); } @Override diff --git a/src/java.base/share/classes/javax/net/ssl/SSLSocketFactory.java b/src/java.base/share/classes/javax/net/ssl/SSLSocketFactory.java index dd10f422f3e..6a01687dc56 100644 --- a/src/java.base/share/classes/javax/net/ssl/SSLSocketFactory.java +++ b/src/java.base/share/classes/javax/net/ssl/SSLSocketFactory.java @@ -263,8 +263,7 @@ class DefaultSSLSocketFactory extends SSLSocketFactory } private Socket throwException() throws SocketException { - throw (SocketException) - new SocketException(reason.toString()).initCause(reason); + throw new SocketException(reason.toString(), reason); } @Override diff --git a/src/java.base/share/classes/sun/nio/ch/DatagramSocketAdaptor.java b/src/java.base/share/classes/sun/nio/ch/DatagramSocketAdaptor.java index abe33000cda..d962cdf3693 100644 --- a/src/java.base/share/classes/sun/nio/ch/DatagramSocketAdaptor.java +++ b/src/java.base/share/classes/sun/nio/ch/DatagramSocketAdaptor.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2022, 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 @@ -219,9 +219,7 @@ public class DatagramSocketAdaptor } catch (AlreadyConnectedException e) { throw new IllegalArgumentException("Connected and packet address differ"); } catch (ClosedChannelException e) { - var exc = new SocketException("Socket closed"); - exc.initCause(e); - throw exc; + throw new SocketException("Socket closed", e); } } finally { if (bb != null) { @@ -249,9 +247,7 @@ public class DatagramSocketAdaptor p.setSocketAddress(sender); } } catch (ClosedChannelException e) { - var exc = new SocketException("Socket closed"); - exc.initCause(e); - throw exc; + throw new SocketException("Socket closed", e); } finally { Util.offerFirstTemporaryDirectBuffer(bb); } @@ -481,7 +477,7 @@ public class DatagramSocketAdaptor joinGroup(new InetSocketAddress(group, 0), null); } catch (IllegalArgumentException iae) { // 1-arg joinGroup does not specify IllegalArgumentException - throw (SocketException) new SocketException("joinGroup failed").initCause(iae); + throw new SocketException("joinGroup failed", iae); } } @@ -493,7 +489,7 @@ public class DatagramSocketAdaptor leaveGroup(new InetSocketAddress(group, 0), null); } catch (IllegalArgumentException iae) { // 1-arg leaveGroup does not specify IllegalArgumentException - throw (SocketException) new SocketException("leaveGroup failed").initCause(iae); + throw new SocketException("leaveGroup failed", iae); } } diff --git a/test/jdk/java/net/SocketException/TestSocketExceptionCtor.java b/test/jdk/java/net/SocketException/TestSocketExceptionCtor.java new file mode 100644 index 00000000000..18611924bec --- /dev/null +++ b/test/jdk/java/net/SocketException/TestSocketExceptionCtor.java @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 8282686 + * @summary Verify cause and message handling of SocketException + */ +import java.net.SocketException; +import java.util.Objects; + +public class TestSocketExceptionCtor { + public static void main(String... args) { + String message = "message"; + Throwable cause = new RuntimeException(); + + testException(new SocketException(cause), cause.toString(), cause); + testException(new SocketException(message, cause), message, cause); + } + + private static void testException(SocketException se, + String expectedMessage, + Throwable expectedCause) { + var message = se.getMessage(); + if (!Objects.equals(message, expectedMessage)) { + throw new RuntimeException("Unexpected message " + message); + } + + var cause = se.getCause(); + if (cause != expectedCause) { + throw new RuntimeException("Unexpected cause"); + } + } +} -- GitLab From 5953b229bf6d7834d575862e7577522ded0b6791 Mon Sep 17 00:00:00 2001 From: Kim Barrett Date: Mon, 7 Mar 2022 18:12:14 +0000 Subject: [PATCH 172/340] 8257589: HotSpot Style Guide should link to rfc7282 Reviewed-by: dcubed, dholmes --- doc/hotspot-style.html | 2 +- doc/hotspot-style.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/hotspot-style.html b/doc/hotspot-style.html index 75211788c6b..4fd5c5a9064 100644 --- a/doc/hotspot-style.html +++ b/doc/hotspot-style.html @@ -68,7 +68,7 @@

    Many of the guidelines mentioned here have (sometimes widespread) counterexamples in the HotSpot code base. Finding a counterexample is not sufficient justification for new code to follow the counterexample as a precedent, since readers of your code will rightfully expect your code to follow the greater bulk of precedents documented here.

    Occasionally a guideline mentioned here may be just out of synch with the actual HotSpot code base. If you find that a guideline is consistently contradicted by a large number of counterexamples, please bring it up for discussion and possible change. The architectural rule, of course, is "When in Rome do as the Romans". Sometimes in the suburbs of Rome the rules are a little different; these differences can be pointed out here.

    Proposed changes should be discussed on the HotSpot Developers mailing list. Changes are likely to be cautious and incremental, since HotSpot coders have been using these guidelines for years.

    -

    Substantive changes are approved by rough consensus of the HotSpot Group Members. The Group Lead determines whether consensus has been reached.

    +

    Substantive changes are approved by rough consensus of the HotSpot Group Members. The Group Lead determines whether consensus has been reached.

    Editorial changes (changes that only affect the description of HotSpot style, not its substance) do not require the full consensus gathering process. The normal HotSpot pull request process may be used for editorial changes, with the additional requirement that the requisite reviewers are also HotSpot Group Members.

    Structure and Formatting

    Factoring and Class Design

    diff --git a/doc/hotspot-style.md b/doc/hotspot-style.md index 4720c9f558c..5d25cdb6667 100644 --- a/doc/hotspot-style.md +++ b/doc/hotspot-style.md @@ -60,7 +60,7 @@ list. Changes are likely to be cautious and incremental, since HotSpot coders have been using these guidelines for years. Substantive changes are approved by -[rough consensus](https://en.wikipedia.org/wiki/Rough_consensus) of +[rough consensus](https://www.rfc-editor.org/rfc/rfc7282.html) of the [HotSpot Group](https://openjdk.java.net/census#hotspot) Members. The Group Lead determines whether consensus has been reached. -- GitLab From 2e298b8bf45edc37269b8b70f7784082a8f87306 Mon Sep 17 00:00:00 2001 From: Kim Barrett Date: Mon, 7 Mar 2022 18:20:01 +0000 Subject: [PATCH 173/340] 8272691: Fix HotSpot style guide terminology for "non-local variables" Reviewed-by: dcubed, dholmes --- doc/hotspot-style.html | 2 +- doc/hotspot-style.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/hotspot-style.html b/doc/hotspot-style.html index 4fd5c5a9064..453b9fbc14b 100644 --- a/doc/hotspot-style.html +++ b/doc/hotspot-style.html @@ -438,7 +438,7 @@ while ( test_foo(args...) ) { // No, excess spaces around control

    Inline namespaces (n2535) — HotSpot makes very limited use of namespaces.

  • using namespace directives. In particular, don't use using namespace std; to avoid needing to qualify Standard Library names.

  • Propagating exceptions (n2179) — HotSpot does not permit the use of exceptions, so this feature isn't useful.

  • -
  • Avoid namespace-scoped variables with non-constexpr initialization. In particular, avoid variables with types requiring non-trivial initialization or destruction. Initialization order problems can be difficult to deal with and lead to surprises, as can destruction ordering. HotSpot doesn't generally try to cleanup on exit, and running destructors at exit can also lead to problems.

  • +
  • Avoid non-local variables with non-constexpr initialization. In particular, avoid variables with types requiring non-trivial initialization or destruction. Initialization order problems can be difficult to deal with and lead to surprises, as can destruction ordering. HotSpot doesn't generally try to cleanup on exit, and running destructors at exit can also lead to problems.

  • [[deprecated]] attribute (n3760) — Not relevant in HotSpot code.

  • Avoid most operator overloading, preferring named functions. When operator overloading is used, ensure the semantics conform to the normal expected behavior of the operation.

  • Avoid most implicit conversion constructors and (implicit or explicit) conversion operators. (Note that conversion to bool isn't needed in HotSpot code because of the "no implicit boolean" guideline.)

  • diff --git a/doc/hotspot-style.md b/doc/hotspot-style.md index 5d25cdb6667..84cb22a1bda 100644 --- a/doc/hotspot-style.md +++ b/doc/hotspot-style.md @@ -1066,7 +1066,7 @@ namespace std;` to avoid needing to qualify Standard Library names. ([n2179](http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2179.html)) — HotSpot does not permit the use of exceptions, so this feature isn't useful. -* Avoid namespace-scoped variables with non-constexpr initialization. +* Avoid non-local variables with non-constexpr initialization. In particular, avoid variables with types requiring non-trivial initialization or destruction. Initialization order problems can be difficult to deal with and lead to surprises, as can destruction -- GitLab From 3996782c5af7b0396d5133fab457c507758d9340 Mon Sep 17 00:00:00 2001 From: Ravi Reddy Date: Mon, 7 Mar 2022 19:36:54 +0000 Subject: [PATCH 174/340] 8281093: Violating Attribute-Value Normalization in the XML specification 1.0 Reviewed-by: joehw --- .../org/apache/xerces/internal/impl/XMLEntityScanner.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/XMLEntityScanner.java b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/XMLEntityScanner.java index 33ffe9831b8..5fb78877e21 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/XMLEntityScanner.java +++ b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/XMLEntityScanner.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. */ /* @@ -57,7 +57,7 @@ import java.util.Locale; * @author Arnaud Le Hors, IBM * @author K.Venugopal Sun Microsystems * - * @LastModified: Sep 2021 + * @LastModified: Mar 2022 */ public class XMLEntityScanner implements XMLLocator { @@ -2162,7 +2162,7 @@ public class XMLEntityScanner implements XMLLocator { break; } } - if (c == '\r') { + if (c == '\r' && isExternal) { int cc = fCurrentEntity.ch[fCurrentEntity.position]; if (cc == '\n' || (version == XML_VERSION_1_1 && cc == 0x85)) { fCurrentEntity.position++; -- GitLab From 5d5bf16b0af419781fd336fe33d8eab5adf8be5a Mon Sep 17 00:00:00 2001 From: Magnus Ihse Bursie Date: Mon, 7 Mar 2022 19:40:34 +0000 Subject: [PATCH 175/340] 8282567: Improve source-date handling in build system Reviewed-by: erikj, sgehwolf --- doc/building.html | 42 +++++++------- doc/building.md | 104 ++++++++++++++++++++++------------- make/InitSupport.gmk | 23 ++++---- make/autoconf/configure.ac | 2 +- make/autoconf/help.m4 | 7 +++ make/autoconf/hotspot.m4 | 18 +++++- make/autoconf/jdk-options.m4 | 41 +++++++++++--- make/autoconf/spec.gmk.in | 7 +++ 8 files changed, 162 insertions(+), 82 deletions(-) diff --git a/doc/building.html b/doc/building.html index cbc7edd7e10..09ea7dc7f72 100644 --- a/doc/building.html +++ b/doc/building.html @@ -890,30 +890,28 @@ spawn failed

    If you need general help or advice about developing for the JDK, you can also contact the Adoption Group. See the section on Contributing to OpenJDK for more information.

    Reproducible Builds

    Build reproducibility is the property of getting exactly the same bits out when building, every time, independent on who builds the product, or where. This is for many reasons a harder goal than it initially appears, but it is an important goal, for security reasons and others. Please see Reproducible Builds for more information about the background and reasons for reproducible builds.

    -

    Currently, it is not possible to build OpenJDK fully reproducibly, but getting there is an ongoing effort. There are some things you can do to minimize non-determinism and make a larger part of the build reproducible:

    +

    Currently, it is not possible to build OpenJDK fully reproducibly, but getting there is an ongoing effort.

    +

    An absolute prerequisite for building reproducible is to speficy a fixed build time, since time stamps are embedded in many file formats. This is done by setting the SOURCE_DATE_EPOCH environment variable, which is an industry standard, that many tools, such as gcc, recognize, and use in place of the current time when generating output.

    +

    To generate reproducible builds, you must set SOURCE_DATE_EPOCH before running configure. The value in SOURCE_DATE_EPOCH will be stored in the configuration, and used by make. Setting SOURCE_DATE_EPOCH before running make will have no effect on the build.

    +

    You must also make sure your build does not rely on configure's default adhoc version strings. Default adhoc version strings OPT segment include user name and source directory. You can either override just the OPT segment using --with-version-opt=<any fixed string>, or you can specify the entire version string using --with-version-string=<your version>.

    +

    This is a typical example of how to build the JDK in a reproducible way:

    +
    export SOURCE_DATE_EPOCH=946684800
    +bash configure --with-version-opt=adhoc
    +make
    +

    Note that regardless if you specify a source date for configure or not, the JDK build system will set SOURCE_DATE_EPOCH for all build tools when building. If --with-source-date has the value updated (which is the default unless SOURCE_DATE_EPOCH is found by in the environment by configure), the source date value will be determined at build time.

    +

    There are several aspects of reproducible builds that can be individually adjusted by configure arguments. If any of these are given, they will override the value derived from SOURCE_DATE_EPOCH. These arguments are:

      -
    • Turn on build system support for reproducible builds
    • +
    • --with-source-date

      +

      This option controls how the JDK build sets SOURCE_DATE_EPOCH when building. It can be set to a value describing a date, either an epoch based timestamp as an integer, or a valid ISO-8601 date.

      +

      It can also be set to one of the special values current, updated or version. current means that the time of running configure will be used. version will use the nominal release date for the current JDK version. updated, which means that SOURCE_DATE_EPOCH will be set to the current time each time you are running make. All choices, except for updated, will set a fixed value for the source date timestamp.

      +

      When SOURCE_DATE_EPOCH is set, the default value for --with-source-date will be the value given by SOURCE_DATE_EPOCH. Otherwise, the default value is updated.

    • +
    • --with-hotspot-build-time

      +

      This option controls the build time string that will be included in the hotspot library (libjvm.so or jvm.dll). When the source date is fixed (e.g. by setting SOURCE_DATE_EPOCH), the default value for --with-hotspot-build-time will be an ISO 8601 representation of that time stamp. Otherwise the default value will be the current time when building hotspot.

    • +
    • --with-copyright-year

      +

      This option controls the copyright year in some generated text files. When the source date is fixed (e.g. by setting SOURCE_DATE_EPOCH), the default value for --with-copyright-year will be the year of that time stamp. Otherwise the default is the current year at the time of running configure. This can be overridden by --with-copyright-year=<year>.

    • +
    • --enable-reproducible-build

      +

      This option controls some additional behavior needed to make the build reproducible. When the source date is fixed (e.g. by setting SOURCE_DATE_EPOCH), this flag will be turned on by default. Otherwise, the value is determined by heuristics. If it is explicitly turned off, the build might not be reproducible.

    -

    Add the flag --enable-reproducible-build to your configure command line. This will turn on support for reproducible builds where it could otherwise be lacking.

    -
      -
    • Do not rely on configure's default adhoc version strings
    • -
    -

    Default adhoc version strings OPT segment include user name, source directory and timestamp. You can either override just the OPT segment using --with-version-opt=<any fixed string>, or you can specify the entire version string using --with-version-string=<your version>.

    -
      -
    • Specify how the build sets SOURCE_DATE_EPOCH
    • -
    -

    The JDK build system will set the SOURCE_DATE_EPOCH environment variable during building, depending on the value of the --with-source-date option for configure. The default value is updated, which means that SOURCE_DATE_EPOCH will be set to the current time each time you are running make.

    -

    The SOURCE_DATE_EPOCH environment variable is an industry standard, that many tools, such as gcc, recognize, and use in place of the current time when generating output.

    -

    For reproducible builds, you need to set this to a fixed value. You can use the special value version which will use the nominal release date for the current JDK version, or a value describing a date, either an epoch based timestamp as an integer, or a valid ISO-8601 date.

    -

    Hint: If your build environment already sets SOURCE_DATE_EPOCH, you can propagate this using --with-source-date=$SOURCE_DATE_EPOCH.

    -
      -
    • Specify a hotspot build time
    • -
    -

    Set a fixed hotspot build time. This will be included in the hotspot library (libjvm.so or jvm.dll) and defaults to the current time when building hotspot. Use --with-hotspot-build-time=<any fixed string> for reproducible builds. It's a string so you don't need to format it specifically, so e.g. n/a will do. Another solution is to use the SOURCE_DATE_EPOCH variable, e.g. --with-hotspot-build-time=$(date --date=@$SOURCE_DATE_EPOCH).

    -
      -
    • Copyright year
    • -
    -

    The copyright year in some generated text files are normally set to the current year. This can be overridden by --with-copyright-year=<year>. For fully reproducible builds, this needs to be set to a fixed value.

    Hints and Suggestions for Advanced Users

    Bash Completion

    The configure and make commands tries to play nice with bash command-line completion (using <tab> or <tab><tab>). To use this functionality, make sure you enable completion in your ~/.bashrc (see instructions for bash in your operating system).

    diff --git a/doc/building.md b/doc/building.md index f71e4e2e730..e83c2bada21 100644 --- a/doc/building.md +++ b/doc/building.md @@ -1527,57 +1527,85 @@ https://reproducible-builds.org) for more information about the background and reasons for reproducible builds. Currently, it is not possible to build OpenJDK fully reproducibly, but getting -there is an ongoing effort. There are some things you can do to minimize -non-determinism and make a larger part of the build reproducible: +there is an ongoing effort. + +An absolute prerequisite for building reproducible is to speficy a fixed build +time, since time stamps are embedded in many file formats. This is done by +setting the `SOURCE_DATE_EPOCH` environment variable, which is an [industry +standard]( https://reproducible-builds.org/docs/source-date-epoch/), that many +tools, such as gcc, recognize, and use in place of the current time when +generating output. + +To generate reproducible builds, you must set `SOURCE_DATE_EPOCH` before running +`configure`. The value in `SOURCE_DATE_EPOCH` will be stored in the +configuration, and used by `make`. Setting `SOURCE_DATE_EPOCH` before running +`make` will have no effect on the build. + +You must also make sure your build does not rely on `configure`'s default adhoc +version strings. Default adhoc version strings `OPT` segment include user name +and source directory. You can either override just the `OPT` segment using +`--with-version-opt=`, or you can specify the entire version +string using `--with-version-string=`. - * Turn on build system support for reproducible builds +This is a typical example of how to build the JDK in a reproducible way: + +``` +export SOURCE_DATE_EPOCH=946684800 +bash configure --with-version-opt=adhoc +make +``` -Add the flag `--enable-reproducible-build` to your `configure` command line. -This will turn on support for reproducible builds where it could otherwise be -lacking. +Note that regardless if you specify a source date for `configure` or not, the +JDK build system will set `SOURCE_DATE_EPOCH` for all build tools when building. +If `--with-source-date` has the value `updated` (which is the default unless +`SOURCE_DATE_EPOCH` is found by in the environment by `configure`), the source +date value will be determined at build time. - * Do not rely on `configure`'s default adhoc version strings +There are several aspects of reproducible builds that can be individually +adjusted by `configure` arguments. If any of these are given, they will override +the value derived from `SOURCE_DATE_EPOCH`. These arguments are: -Default adhoc version strings OPT segment include user name, source directory -and timestamp. You can either override just the OPT segment using -`--with-version-opt=`, or you can specify the entire version -string using `--with-version-string=`. + * `--with-source-date` - * Specify how the build sets `SOURCE_DATE_EPOCH` + This option controls how the JDK build sets `SOURCE_DATE_EPOCH` when + building. It can be set to a value describing a date, either an epoch based + timestamp as an integer, or a valid ISO-8601 date. -The JDK build system will set the `SOURCE_DATE_EPOCH` environment variable -during building, depending on the value of the `--with-source-date` option for -`configure`. The default value is `updated`, which means that -`SOURCE_DATE_EPOCH` will be set to the current time each time you are running -`make`. + It can also be set to one of the special values `current`, `updated` or + `version`. `current` means that the time of running `configure` will be + used. `version` will use the nominal release date for the current JDK + version. `updated`, which means that `SOURCE_DATE_EPOCH` will be set to the + current time each time you are running `make`. All choices, except for + `updated`, will set a fixed value for the source date timestamp. -The [`SOURCE_DATE_EPOCH` environment variable]( -https://reproducible-builds.org/docs/source-date-epoch/) is an industry -standard, that many tools, such as gcc, recognize, and use in place of the -current time when generating output. + When `SOURCE_DATE_EPOCH` is set, the default value for `--with-source-date` + will be the value given by `SOURCE_DATE_EPOCH`. Otherwise, the default value + is `updated`. -For reproducible builds, you need to set this to a fixed value. You can use the -special value `version` which will use the nominal release date for the current -JDK version, or a value describing a date, either an epoch based timestamp as an -integer, or a valid ISO-8601 date. + * `--with-hotspot-build-time` -**Hint:** If your build environment already sets `SOURCE_DATE_EPOCH`, you can -propagate this using `--with-source-date=$SOURCE_DATE_EPOCH`. + This option controls the build time string that will be included in the + hotspot library (`libjvm.so` or `jvm.dll`). When the source date is fixed + (e.g. by setting `SOURCE_DATE_EPOCH`), the default value for + `--with-hotspot-build-time` will be an ISO 8601 representation of that time + stamp. Otherwise the default value will be the current time when building + hotspot. - * Specify a hotspot build time + * `--with-copyright-year` -Set a fixed hotspot build time. This will be included in the hotspot library -(`libjvm.so` or `jvm.dll`) and defaults to the current time when building -hotspot. Use `--with-hotspot-build-time=` for reproducible -builds. It's a string so you don't need to format it specifically, so e.g. `n/a` -will do. Another solution is to use the `SOURCE_DATE_EPOCH` variable, e.g. -`--with-hotspot-build-time=$(date --date=@$SOURCE_DATE_EPOCH)`. + This option controls the copyright year in some generated text files. When + the source date is fixed (e.g. by setting `SOURCE_DATE_EPOCH`), the default + value for `--with-copyright-year` will be the year of that time stamp. + Otherwise the default is the current year at the time of running configure. + This can be overridden by `--with-copyright-year=`. - * Copyright year + * `--enable-reproducible-build` -The copyright year in some generated text files are normally set to the current -year. This can be overridden by `--with-copyright-year=`. For fully -reproducible builds, this needs to be set to a fixed value. + This option controls some additional behavior needed to make the build + reproducible. When the source date is fixed (e.g. by setting + `SOURCE_DATE_EPOCH`), this flag will be turned on by default. Otherwise, the + value is determined by heuristics. If it is explicitly turned off, the build + might not be reproducible. ## Hints and Suggestions for Advanced Users diff --git a/make/InitSupport.gmk b/make/InitSupport.gmk index d2291c50f21..62fdc438c8a 100644 --- a/make/InitSupport.gmk +++ b/make/InitSupport.gmk @@ -1,5 +1,5 @@ # -# Copyright (c) 2011, 2021, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2011, 2022, 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 @@ -310,17 +310,16 @@ else # $(HAS_SPEC)=true # level of reproducible builds define SetupReproducibleBuild ifeq ($$(SOURCE_DATE), updated) - SOURCE_DATE := $$(shell $$(DATE) +"%s") - endif - export SOURCE_DATE_EPOCH := $$(SOURCE_DATE) - ifeq ($$(IS_GNU_DATE), yes) - export SOURCE_DATE_ISO_8601 := $$(shell $$(DATE) --utc \ - --date="@$$(SOURCE_DATE_EPOCH)" \ - +"%Y-%m-%dT%H:%M:%SZ" 2> /dev/null) - else - export SOURCE_DATE_ISO_8601 := $$(shell $$(DATE) -u \ - -j -f "%s" "$$(SOURCE_DATE_EPOCH)" \ - +"%Y-%m-%dT%H:%M:%SZ" 2> /dev/null) + # For static values of SOURCE_DATE (not "updated"), these are set in spec.gmk + export SOURCE_DATE_EPOCH := $$(shell $$(DATE) +"%s") + ifeq ($$(IS_GNU_DATE), yes) + export SOURCE_DATE_ISO_8601 := $$(shell $$(DATE) --utc \ + --date="@$$(SOURCE_DATE_EPOCH)" +"$$(ISO_8601_FORMAT_STRING)" \ + 2> /dev/null) + else + export SOURCE_DATE_ISO_8601 := $$(shell $$(DATE) -u -j -f "%s" \ + "$$(SOURCE_DATE_EPOCH)" +"$$(ISO_8601_FORMAT_STRING)" 2> /dev/null) + endif endif endef diff --git a/make/autoconf/configure.ac b/make/autoconf/configure.ac index d52ad2c4315..5e58696e34d 100644 --- a/make/autoconf/configure.ac +++ b/make/autoconf/configure.ac @@ -152,6 +152,7 @@ BOOTJDK_SETUP_DOCS_REFERENCE_JDK # ############################################################################### +JDKOPT_SETUP_REPRODUCIBLE_BUILD JDKOPT_SETUP_JDK_OPTIONS ############################################################################### @@ -207,7 +208,6 @@ PLATFORM_SETUP_OPENJDK_TARGET_BITS PLATFORM_SETUP_OPENJDK_TARGET_ENDIANNESS # Configure flags for the tools. Need to know if we should build reproducible. -JDKOPT_SETUP_REPRODUCIBLE_BUILD FLAGS_SETUP_FLAGS # Setup debug symbols (need objcopy from the toolchain for that) diff --git a/make/autoconf/help.m4 b/make/autoconf/help.m4 index 486e78d4fcf..3d6963c7d4d 100644 --- a/make/autoconf/help.m4 +++ b/make/autoconf/help.m4 @@ -296,6 +296,13 @@ AC_DEFUN_ONCE([HELP_PRINT_SUMMARY_AND_WARNINGS], printf "* OpenJDK target: OS: $OPENJDK_TARGET_OS, CPU architecture: $OPENJDK_TARGET_CPU_ARCH, address length: $OPENJDK_TARGET_CPU_BITS\n" printf "* Version string: $VERSION_STRING ($VERSION_SHORT)\n" + if test "x$SOURCE_DATE" != xupdated; then + source_date_info="$SOURCE_DATE ($SOURCE_DATE_ISO_8601)" + else + source_date_info="Determined at build time" + fi + printf "* Source date: $source_date_info\n" + printf "\n" printf "Tools summary:\n" if test "x$OPENJDK_BUILD_OS" = "xwindows"; then diff --git a/make/autoconf/hotspot.m4 b/make/autoconf/hotspot.m4 index 1cac6bb00c6..18f46036fe5 100644 --- a/make/autoconf/hotspot.m4 +++ b/make/autoconf/hotspot.m4 @@ -1,5 +1,5 @@ # -# Copyright (c) 2011, 2020, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2011, 2022, 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 @@ -114,12 +114,26 @@ AC_DEFUN_ONCE([HOTSPOT_SETUP_MISC], HOTSPOT_TARGET_CPU_ARCH=zero fi + AC_ARG_WITH([hotspot-build-time], [AS_HELP_STRING([--with-hotspot-build-time], - [timestamp to use in hotspot version string, empty for on-the-fly @<:@empty@:>@])]) + [timestamp to use in hotspot version string, empty means determined at build time @<:@source-date/empty@:>@])]) + + AC_MSG_CHECKING([what hotspot build time to use]) if test "x$with_hotspot_build_time" != x; then HOTSPOT_BUILD_TIME="$with_hotspot_build_time" + AC_MSG_RESULT([$HOTSPOT_BUILD_TIME (from --with-hotspot-build-time)]) + else + if test "x$SOURCE_DATE" = xupdated; then + HOTSPOT_BUILD_TIME="" + AC_MSG_RESULT([determined at build time (default)]) + else + # If we have a fixed value for SOURCE_DATE, use it as default + HOTSPOT_BUILD_TIME="$SOURCE_DATE_ISO_8601" + AC_MSG_RESULT([$HOTSPOT_BUILD_TIME (from --with-source-date)]) + fi fi + AC_SUBST(HOTSPOT_BUILD_TIME) diff --git a/make/autoconf/jdk-options.m4 b/make/autoconf/jdk-options.m4 index 70806149203..2034934cd73 100644 --- a/make/autoconf/jdk-options.m4 +++ b/make/autoconf/jdk-options.m4 @@ -211,16 +211,16 @@ AC_DEFUN_ONCE([JDKOPT_SETUP_JDK_OPTIONS], # Setup default copyright year. Mostly overridden when building close to a new year. AC_ARG_WITH(copyright-year, [AS_HELP_STRING([--with-copyright-year], - [Set copyright year value for build @<:@current year@:>@])]) + [Set copyright year value for build @<:@current year/source-date@:>@])]) if test "x$with_copyright_year" = xyes; then AC_MSG_ERROR([Copyright year must have a value]) elif test "x$with_copyright_year" != x; then COPYRIGHT_YEAR="$with_copyright_year" - elif test "x$SOURCE_DATE_EPOCH" != x; then + elif test "x$SOURCE_DATE" != xupdated; then if test "x$IS_GNU_DATE" = xyes; then - COPYRIGHT_YEAR=`date --date=@$SOURCE_DATE_EPOCH +%Y` + COPYRIGHT_YEAR=`$DATE --date=@$SOURCE_DATE +%Y` else - COPYRIGHT_YEAR=`date -j -f %s $SOURCE_DATE_EPOCH +%Y` + COPYRIGHT_YEAR=`$DATE -j -f %s $SOURCE_DATE +%Y` fi else COPYRIGHT_YEAR=`$DATE +'%Y'` @@ -662,15 +662,28 @@ AC_DEFUN([JDKOPT_ALLOW_ABSOLUTE_PATHS_IN_OUTPUT], AC_DEFUN_ONCE([JDKOPT_SETUP_REPRODUCIBLE_BUILD], [ AC_ARG_WITH([source-date], [AS_HELP_STRING([--with-source-date], - [how to set SOURCE_DATE_EPOCH ('updated', 'current', 'version' a timestamp or an ISO-8601 date) @<:@updated@:>@])], + [how to set SOURCE_DATE_EPOCH ('updated', 'current', 'version' a timestamp or an ISO-8601 date) @<:@updated/value of SOURCE_DATE_EPOCH@:>@])], [with_source_date_present=true], [with_source_date_present=false]) + if test "x$SOURCE_DATE_EPOCH" != x && test "x$with_source_date" != x; then + AC_MSG_WARN([--with-source-date will override SOURCE_DATE_EPOCH]) + fi + AC_MSG_CHECKING([what source date to use]) if test "x$with_source_date" = xyes; then AC_MSG_ERROR([--with-source-date must have a value]) - elif test "x$with_source_date" = xupdated || test "x$with_source_date" = x; then - # Tell the makefiles to update at each build + elif test "x$with_source_date" = x; then + if test "x$SOURCE_DATE_EPOCH" != x; then + SOURCE_DATE=$SOURCE_DATE_EPOCH + with_source_date_present=true + AC_MSG_RESULT([$SOURCE_DATE, from SOURCE_DATE_EPOCH]) + else + # Tell the makefiles to update at each build + SOURCE_DATE=updated + AC_MSG_RESULT([determined at build time (default)]) + fi + elif test "x$with_source_date" = xupdated; then SOURCE_DATE=updated AC_MSG_RESULT([determined at build time, from 'updated']) elif test "x$with_source_date" = xcurrent; then @@ -702,6 +715,18 @@ AC_DEFUN_ONCE([JDKOPT_SETUP_REPRODUCIBLE_BUILD], fi fi + ISO_8601_FORMAT_STRING="%Y-%m-%dT%H:%M:%SZ" + if test "x$SOURCE_DATE" != xupdated; then + # If we have a fixed value for SOURCE_DATE, we need to set SOURCE_DATE_EPOCH + # for the rest of configure. + SOURCE_DATE_EPOCH="$SOURCE_DATE" + if test "x$IS_GNU_DATE" = xyes; then + SOURCE_DATE_ISO_8601=`$DATE --utc --date="@$SOURCE_DATE" +"$ISO_8601_FORMAT_STRING" 2> /dev/null` + else + SOURCE_DATE_ISO_8601=`$DATE -u -j -f "%s" "$SOURCE_DATE" +"$ISO_8601_FORMAT_STRING" 2> /dev/null` + fi + fi + REPRODUCIBLE_BUILD_DEFAULT=$with_source_date_present if test "x$OPENJDK_BUILD_OS" = xwindows && \ @@ -726,4 +751,6 @@ AC_DEFUN_ONCE([JDKOPT_SETUP_REPRODUCIBLE_BUILD], AC_SUBST(SOURCE_DATE) AC_SUBST(ENABLE_REPRODUCIBLE_BUILD) + AC_SUBST(ISO_8601_FORMAT_STRING) + AC_SUBST(SOURCE_DATE_ISO_8601) ]) diff --git a/make/autoconf/spec.gmk.in b/make/autoconf/spec.gmk.in index 01bcc32a24e..5671d4a9f3e 100644 --- a/make/autoconf/spec.gmk.in +++ b/make/autoconf/spec.gmk.in @@ -130,6 +130,13 @@ RELEASE_FILE_LIBC:=@RELEASE_FILE_LIBC@ SOURCE_DATE := @SOURCE_DATE@ ENABLE_REPRODUCIBLE_BUILD := @ENABLE_REPRODUCIBLE_BUILD@ +ISO_8601_FORMAT_STRING := @ISO_8601_FORMAT_STRING@ + +ifneq ($(SOURCE_DATE), updated) + # For "updated" source date value, these are set in InitSupport.gmk + export SOURCE_DATE_EPOCH := $(SOURCE_DATE) + SOURCE_DATE_ISO_8601 := @SOURCE_DATE_ISO_8601@ +endif LIBM:=@LIBM@ LIBDL:=@LIBDL@ -- GitLab From ccad39237ab860c5c5579537f740177e3f1adcc9 Mon Sep 17 00:00:00 2001 From: Matteo Baccan Date: Mon, 7 Mar 2022 21:33:40 +0000 Subject: [PATCH 176/340] 8282657: Code cleanup: removing double semicolons at the end of lines Reviewed-by: lancea, rriggs, ihse, prr, iris, wetmore, darcy, dholmes --- .../build/tools/generatecharacter/CharacterScript.java | 2 +- make/langtools/tools/genstubs/GenStubs.java | 2 +- src/java.base/share/classes/java/io/File.java | 2 +- src/java.base/share/classes/java/util/WeakHashMap.java | 2 +- .../share/classes/sun/util/logging/PlatformLogger.java | 2 +- .../share/classes/javax/swing/RepaintManager.java | 2 +- src/java.rmi/share/classes/java/rmi/server/LogStream.java | 2 +- .../sun/security/krb5/internal/rcache/AuthTime.java | 4 ++-- .../com/sun/rowset/internal/CachedRowSetWriter.java | 2 +- .../classes/javax/sql/rowset/serial/SQLOutputImpl.java | 2 +- .../apache/xalan/internal/xsltc/compiler/XPathParser.java | 2 +- .../javac/processing/JavacProcessingEnvironment.java | 2 +- .../share/classes/sun/jvm/hotspot/gc/z/ZGlobals.java | 2 +- .../classes/sun/jvm/hotspot/ui/FindInCodeCachePanel.java | 2 +- .../share/classes/sun/jvm/hotspot/ui/FindInHeapPanel.java | 2 +- .../classes/com/sun/tools/classfile/TypeAnnotation.java | 2 +- .../instrument/SocketChannelImplInstrumentor.java | 2 +- .../share/classes/jdk/jfr/internal/tool/JSONWriter.java | 2 +- .../share/classes/jdk/internal/jshell/tool/Selector.java | 2 +- .../java/com/sun/hotspot/tools/compiler/LogParser.java | 2 +- test/hotspot/jtreg/compiler/codegen/Test6909839.java | 8 ++++---- .../compiler/jvmci/compilerToVM/CompileCodeTestCase.java | 2 +- .../jtreg/compiler/unsafe/TestMisalignedUnsafeAccess.java | 2 +- test/hotspot/jtreg/runtime/cds/appcds/TestCommon.java | 2 +- .../cds/appcds/customLoader/SameNameInTwoLoadersTest.java | 2 +- .../jvmti/Heap/IterateHeapWithEscapeAnalysisEnabled.java | 2 +- .../ctw/src/sun/hotspot/tools/ctw/CtwRunner.java | 2 +- test/hotspot/jtreg/vmTestbase/jit/series/series.java | 2 +- .../nsk/jdb/unmonitor/unmonitor001/unmonitor001.java | 2 +- .../vmTestbase/nsk/jdi/BScenarios/multithrd/tc02x003.java | 2 +- .../ClassObjectReference/reflectedType/reflectype002.java | 2 +- .../nsk/jdi/LocalVariable/isVisible/isvisible001.java | 2 +- .../nsk/jdi/ThreadReference/frames/frames001.java | 2 +- .../scenarios/hotswap/HS203/hs203t002/hs203t002.java | 2 +- test/hotspot/jtreg/vmTestbase/nsk/share/jdb/Launcher.java | 2 +- test/jdk/com/sun/jdi/ConstantPoolInfo.java | 2 +- test/jdk/com/sun/jdi/GenericsTest.java | 2 +- .../CompEventOnHiddenComponent.java | 2 +- .../EmbeddedFrameGrabTest/EmbeddedFrameGrabTest.java | 2 +- test/jdk/java/awt/PrintJob/PrintArcTest/PrintArcTest.java | 2 +- test/jdk/java/awt/SplashScreen/GenerateTestImage.java | 2 +- test/jdk/java/awt/print/PrinterJob/PrtException.java | 2 +- test/jdk/java/io/File/GetXSpace.java | 2 +- test/jdk/java/io/File/createTempFile/NameTooLong.java | 2 +- test/jdk/java/io/RandomAccessFile/WriteBytesChars.java | 2 +- test/jdk/java/lang/invoke/8022701/BogoLoader.java | 2 +- .../java/lang/invoke/accessProtectedSuper/BogoLoader.java | 2 +- .../management/RuntimeMXBean/GetSystemProperties.java | 2 +- .../jdk/java/net/httpclient/AggregateRequestBodyTest.java | 2 +- .../nio/channels/SocketChannel/CloseTimeoutChannel.java | 2 +- .../java/rmi/dgc/dgcImplInsulation/DGCImplInsulation.java | 2 +- test/jdk/java/time/tck/java/time/zone/TCKZoneRules.java | 2 +- test/jdk/java/util/logging/TestAppletLoggerContext.java | 2 +- test/jdk/javax/net/ssl/ServerName/SSLSocketExplorer.java | 2 +- .../net/ssl/ServerName/SSLSocketExplorerFailure.java | 2 +- .../net/ssl/ServerName/SSLSocketExplorerMatchedSNI.java | 2 +- .../net/ssl/ServerName/SSLSocketExplorerUnmatchedSNI.java | 2 +- .../net/ssl/ServerName/SSLSocketExplorerWithCliSNI.java | 2 +- .../net/ssl/ServerName/SSLSocketExplorerWithSrvSNI.java | 2 +- .../NewModelIdentifierStringStringInt.java | 2 +- .../jdk/javax/sound/midi/Gervill/SoftChannel/NoteOff.java | 2 +- .../javax/sound/midi/Gervill/SoftChannel/NoteOff2.java | 2 +- .../jdk/javax/sql/testng/test/rowset/BaseRowSetTests.java | 2 +- .../sql/testng/test/rowset/serial/SQLInputImplTests.java | 2 +- .../sql/testng/test/rowset/serial/SerialArrayTests.java | 2 +- .../testng/test/rowset/serial/SerialExceptionTests.java | 2 +- .../sql/testng/test/rowset/serial/SerialStructTests.java | 2 +- test/jdk/jdk/jfr/api/consumer/TestRecordingFile.java | 4 ++-- test/jdk/jdk/jfr/api/consumer/filestream/TestReuse.java | 2 +- test/jdk/jdk/jfr/api/recording/event/TestEventTime.java | 4 ++-- .../jdk/jdk/jfr/event/runtime/TestActiveSettingEvent.java | 4 ++-- .../src/com/sun/swingset3/demos/tooltip/ToolTipDemo.java | 4 ++-- test/jdk/sun/java2d/cmm/ColorConvertOp/ImageFactory.java | 4 ++-- .../provider/certpath/DisabledAlgorithms/CPBuilder.java | 2 +- .../certpath/DisabledAlgorithms/CPBuilderWithMD5.java | 2 +- test/jdk/sun/tools/jhsdb/BasicLauncherTest.java | 4 ++-- test/jdk/tools/jar/modularJar/Basic.java | 2 +- .../jar/multiRelease/data/test13/v10/version/Nested.java | 2 +- .../jdk/javadoc/tool/api/basic/JavadocTaskImplTest.java | 2 +- test/langtools/jdk/jshell/VariablesTest.java | 2 +- test/langtools/tools/doclint/RunTest.java | 2 +- .../tools/javac/generics/inference/4954546/T4954546.java | 4 ++-- 82 files changed, 93 insertions(+), 93 deletions(-) diff --git a/make/jdk/src/classes/build/tools/generatecharacter/CharacterScript.java b/make/jdk/src/classes/build/tools/generatecharacter/CharacterScript.java index fda7a561e87..d242cb8ed42 100644 --- a/make/jdk/src/classes/build/tools/generatecharacter/CharacterScript.java +++ b/make/jdk/src/classes/build/tools/generatecharacter/CharacterScript.java @@ -115,7 +115,7 @@ public class CharacterScript { for (j = 0; j < scriptSize; j++) { for (int cp = scripts[j][0]; cp <= scripts[j][1]; cp++) { - String name = names[scripts[j][2]].toUpperCase(Locale.ENGLISH);; + String name = names[scripts[j][2]].toUpperCase(Locale.ENGLISH); if (cp > 0xffff) System.out.printf("%05X %s%n", cp, name); else diff --git a/make/langtools/tools/genstubs/GenStubs.java b/make/langtools/tools/genstubs/GenStubs.java index 9f8fc7a7a59..bcf73fc5f71 100644 --- a/make/langtools/tools/genstubs/GenStubs.java +++ b/make/langtools/tools/genstubs/GenStubs.java @@ -213,7 +213,7 @@ public class GenStubs { long prevClassMods = currClassMods; currClassMods = tree.mods.flags; try { - super.visitClassDef(tree);; + super.visitClassDef(tree); } finally { currClassMods = prevClassMods; } diff --git a/src/java.base/share/classes/java/io/File.java b/src/java.base/share/classes/java/io/File.java index 3f7cd86cf70..f279ee56bf5 100644 --- a/src/java.base/share/classes/java/io/File.java +++ b/src/java.base/share/classes/java/io/File.java @@ -2012,7 +2012,7 @@ public class File int prefixLength = prefix.length(); int nusLength = nus.length(); - int suffixLength = suffix.length();; + int suffixLength = suffix.length(); String name; int nameMax = fs.getNameMax(dir.getPath()); diff --git a/src/java.base/share/classes/java/util/WeakHashMap.java b/src/java.base/share/classes/java/util/WeakHashMap.java index 03aee09e992..d74c7d65728 100644 --- a/src/java.base/share/classes/java/util/WeakHashMap.java +++ b/src/java.base/share/classes/java/util/WeakHashMap.java @@ -1040,7 +1040,7 @@ public class WeakHashMap Objects.requireNonNull(function); int expectedModCount = modCount; - Entry[] tab = getTable();; + Entry[] tab = getTable(); for (Entry entry : tab) { while (entry != null) { Object key = entry.get(); diff --git a/src/java.base/share/classes/sun/util/logging/PlatformLogger.java b/src/java.base/share/classes/sun/util/logging/PlatformLogger.java index 07c6878c151..db85d9c317b 100644 --- a/src/java.base/share/classes/sun/util/logging/PlatformLogger.java +++ b/src/java.base/share/classes/sun/util/logging/PlatformLogger.java @@ -371,7 +371,7 @@ public class PlatformLogger { @Deprecated public void setLevel(Level newLevel) { final ConfigurableBridge.LoggerConfiguration spi = - PlatformLogger.ConfigurableBridge.getLoggerConfiguration(loggerProxy);; + PlatformLogger.ConfigurableBridge.getLoggerConfiguration(loggerProxy); if (spi != null) { spi.setPlatformLevel(newLevel); } diff --git a/src/java.desktop/share/classes/javax/swing/RepaintManager.java b/src/java.desktop/share/classes/javax/swing/RepaintManager.java index fe414fc16af..3831a66a01c 100644 --- a/src/java.desktop/share/classes/javax/swing/RepaintManager.java +++ b/src/java.desktop/share/classes/javax/swing/RepaintManager.java @@ -966,7 +966,7 @@ public class RepaintManager tmp.setBounds(dirtyComponents.get(dirtyComponent)); // System.out.println("Collect dirty component for bound " + tmp + - // "component bounds is " + cBounds);; + // "component bounds is " + cBounds); SwingUtilities.computeIntersection(0,0,w,h,tmp); if (tmp.isEmpty()) { diff --git a/src/java.rmi/share/classes/java/rmi/server/LogStream.java b/src/java.rmi/share/classes/java/rmi/server/LogStream.java index 7d501ffb4af..ca554569d3b 100644 --- a/src/java.rmi/share/classes/java/rmi/server/LogStream.java +++ b/src/java.rmi/share/classes/java/rmi/server/LogStream.java @@ -176,7 +176,7 @@ public class LogStream extends PrintStream { synchronized (this) { synchronized (logOut) { // construct prefix for log messages: - buffer.setLength(0);; + buffer.setLength(0); buffer.append( // date/time stamp... (new Date()).toString()); buffer.append(':'); diff --git a/src/java.security.jgss/share/classes/sun/security/krb5/internal/rcache/AuthTime.java b/src/java.security.jgss/share/classes/sun/security/krb5/internal/rcache/AuthTime.java index 695268735a9..d9cd765d12e 100644 --- a/src/java.security.jgss/share/classes/sun/security/krb5/internal/rcache/AuthTime.java +++ b/src/java.security.jgss/share/classes/sun/security/krb5/internal/rcache/AuthTime.java @@ -134,8 +134,8 @@ public class AuthTime { * Encodes to be used in a dfl file */ protected byte[] encode0(String cstring, String sstring) { - byte[] c = cstring.getBytes(StandardCharsets.UTF_8);; - byte[] s = sstring.getBytes(StandardCharsets.UTF_8);; + byte[] c = cstring.getBytes(StandardCharsets.UTF_8); + byte[] s = sstring.getBytes(StandardCharsets.UTF_8); byte[] zero = new byte[1]; int len = 4 + c.length + 1 + 4 + s.length + 1 + 4 + 4; ByteBuffer bb = ByteBuffer.allocate(len) diff --git a/src/java.sql.rowset/share/classes/com/sun/rowset/internal/CachedRowSetWriter.java b/src/java.sql.rowset/share/classes/com/sun/rowset/internal/CachedRowSetWriter.java index a588c1dd94a..21b9614d746 100644 --- a/src/java.sql.rowset/share/classes/com/sun/rowset/internal/CachedRowSetWriter.java +++ b/src/java.sql.rowset/share/classes/com/sun/rowset/internal/CachedRowSetWriter.java @@ -276,7 +276,7 @@ public class CachedRowSetWriter implements TransactionalWriter, Serializable { // We assume caller is a CachedRowSet CachedRowSetImpl crs = (CachedRowSetImpl)caller; // crsResolve = new CachedRowSetImpl(); - this.crsResolve = new CachedRowSetImpl();; + this.crsResolve = new CachedRowSetImpl(); // The reader is registered with the writer at design time. // This is not required, in general. The reader has logic diff --git a/src/java.sql.rowset/share/classes/javax/sql/rowset/serial/SQLOutputImpl.java b/src/java.sql.rowset/share/classes/javax/sql/rowset/serial/SQLOutputImpl.java index 136fff08d2a..1affa2634ec 100644 --- a/src/java.sql.rowset/share/classes/javax/sql/rowset/serial/SQLOutputImpl.java +++ b/src/java.sql.rowset/share/classes/javax/sql/rowset/serial/SQLOutputImpl.java @@ -535,7 +535,7 @@ public class SQLOutputImpl implements SQLOutput { */ @SuppressWarnings("unchecked") public void writeStruct(Struct x) throws SQLException { - SerialStruct s = new SerialStruct(x,map);; + SerialStruct s = new SerialStruct(x,map); attribs.add(s); } diff --git a/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/XPathParser.java b/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/XPathParser.java index ab12a274a46..e0259cb8c3f 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/XPathParser.java +++ b/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/XPathParser.java @@ -1011,7 +1011,7 @@ public class XPathParser extends lr_parser { if (axis == Axis.NAMESPACE) { nodeType = (name.toString().equals("*")) ? -1 - : _xsltc.registerNamespacePrefix(name);; + : _xsltc.registerNamespacePrefix(name); } else { final String uri = name.getNamespace(); final String local = name.getLocalPart(); diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java index 594bb4e95b4..9dd94f74252 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java @@ -493,7 +493,7 @@ public class JavacProcessingEnvironment implements ProcessingEnvironment, Closea } private class NameServiceIterator extends ServiceIterator { - private Map namedProcessorsMap = new HashMap<>();; + private Map namedProcessorsMap = new HashMap<>(); private Iterator processorNames = null; private Processor nextProc = null; diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/z/ZGlobals.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/z/ZGlobals.java index 5f129b51a96..8e1c005d6a1 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/z/ZGlobals.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/z/ZGlobals.java @@ -78,7 +78,7 @@ public class ZGlobals { ZPageSizeMediumShift = db.lookupLongConstant("ZPageSizeMediumShift").longValue(); ZObjectAlignmentMediumShift = db.lookupIntConstant("ZObjectAlignmentMediumShift").intValue(); - ZObjectAlignmentLargeShift = db.lookupIntConstant("ZObjectAlignmentLargeShift").intValue();; + ZObjectAlignmentLargeShift = db.lookupIntConstant("ZObjectAlignmentLargeShift").intValue(); ZAddressOffsetShift = db.lookupLongConstant("ZAddressOffsetShift").longValue(); diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/ui/FindInCodeCachePanel.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/ui/FindInCodeCachePanel.java index 21619b1f5ae..c83d7912650 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/ui/FindInCodeCachePanel.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/ui/FindInCodeCachePanel.java @@ -79,7 +79,7 @@ public class FindInCodeCachePanel extends SAPanel { } begin = begin.addOffsetTo(addressSize); } - iterated = end.minus(base);; + iterated = end.minus(base); updateProgressBar(null); } diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/ui/FindInHeapPanel.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/ui/FindInHeapPanel.java index ced929dea16..c9808063ad3 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/ui/FindInHeapPanel.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/ui/FindInHeapPanel.java @@ -195,7 +195,7 @@ public class FindInHeapPanel extends JPanel { for (String update : updates) { textArea.append(update); } - updates = new ArrayList<>();; + updates = new ArrayList<>(); } pendingUpdate = false; } diff --git a/src/jdk.jdeps/share/classes/com/sun/tools/classfile/TypeAnnotation.java b/src/jdk.jdeps/share/classes/com/sun/tools/classfile/TypeAnnotation.java index 5d591705d52..707cb831540 100644 --- a/src/jdk.jdeps/share/classes/com/sun/tools/classfile/TypeAnnotation.java +++ b/src/jdk.jdeps/share/classes/com/sun/tools/classfile/TypeAnnotation.java @@ -130,7 +130,7 @@ public class TypeAnnotation { break; // class extends or implements clause case CLASS_EXTENDS: - position.type_index = cr.readUnsignedShort();; + position.type_index = cr.readUnsignedShort(); break; // throws case THROWS: diff --git a/src/jdk.jfr/share/classes/jdk/jfr/internal/instrument/SocketChannelImplInstrumentor.java b/src/jdk.jfr/share/classes/jdk/jfr/internal/instrument/SocketChannelImplInstrumentor.java index 6d353112dff..a83fabfbaa8 100644 --- a/src/jdk.jfr/share/classes/jdk/jfr/internal/instrument/SocketChannelImplInstrumentor.java +++ b/src/jdk.jfr/share/classes/jdk/jfr/internal/instrument/SocketChannelImplInstrumentor.java @@ -52,7 +52,7 @@ final class SocketChannelImplInstrumentor { int bytesRead = 0; long start = 0; try { - start = EventHandler.timestamp();; + start = EventHandler.timestamp(); bytesRead = read(dst); } finally { long duration = EventHandler.timestamp() - start; diff --git a/src/jdk.jfr/share/classes/jdk/jfr/internal/tool/JSONWriter.java b/src/jdk.jfr/share/classes/jdk/jfr/internal/tool/JSONWriter.java index cbf508306d5..3be2dd6c199 100644 --- a/src/jdk.jfr/share/classes/jdk/jfr/internal/tool/JSONWriter.java +++ b/src/jdk.jfr/share/classes/jdk/jfr/internal/tool/JSONWriter.java @@ -63,7 +63,7 @@ final class JSONWriter extends EventPrintWriter { @Override protected void printEnd() { - printArrayEnd();; + printArrayEnd(); printObjectEnd(); printObjectEnd(); } diff --git a/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/Selector.java b/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/Selector.java index 9d540847148..aec5116bb2e 100644 --- a/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/Selector.java +++ b/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/Selector.java @@ -302,7 +302,7 @@ class Selector { & SelectorInstanceWithDoc> SelectorKind(Class k) { - this.all = EnumSet.allOf(FormatCase.class);; + this.all = EnumSet.allOf(FormatCase.class); this.k = k; } } diff --git a/src/utils/LogCompilation/src/main/java/com/sun/hotspot/tools/compiler/LogParser.java b/src/utils/LogCompilation/src/main/java/com/sun/hotspot/tools/compiler/LogParser.java index b0fc682f65a..05407f8c969 100644 --- a/src/utils/LogCompilation/src/main/java/com/sun/hotspot/tools/compiler/LogParser.java +++ b/src/utils/LogCompilation/src/main/java/com/sun/hotspot/tools/compiler/LogParser.java @@ -973,7 +973,7 @@ public class LogParser extends DefaultHandler implements ErrorHandler { m.setHolder(type(search(atts, "holder"))); m.setName(search(atts, "name")); m.setReturnType(type(search(atts, "return"))); - String arguments = atts.getValue("arguments");; + String arguments = atts.getValue("arguments"); if (arguments == null) { m.setSignature("()" + sigtype(atts.getValue("return"))); } else { diff --git a/test/hotspot/jtreg/compiler/codegen/Test6909839.java b/test/hotspot/jtreg/compiler/codegen/Test6909839.java index d6fa98d8155..5fcd5ceacee 100644 --- a/test/hotspot/jtreg/compiler/codegen/Test6909839.java +++ b/test/hotspot/jtreg/compiler/codegen/Test6909839.java @@ -241,7 +241,7 @@ public class Test6909839 { static void testp() { Object a = new Object(); - Object b = new Object();; + Object b = new Object(); int total = 0; for (int i = 0 ; i < 10000; i++) { total += ((i % 4 != 0) ? a : b).hashCode(); @@ -251,7 +251,7 @@ public class Test6909839 { static void testup() { Object a = new Object(); - Object b = new Object();; + Object b = new Object(); int total = 0; for (int i = 0 ; i < 10000; i++) { int v = i % 4; @@ -262,7 +262,7 @@ public class Test6909839 { static void testdp() { Object a = new Object(); - Object b = new Object();; + Object b = new Object(); int total = 0; for (int i = 0 ; i < 10000; i++) { int v = i % 4; @@ -272,7 +272,7 @@ public class Test6909839 { } static void testfp() { Object a = new Object(); - Object b = new Object();; + Object b = new Object(); int total = 0; for (int i = 0 ; i < 10000; i++) { int v = i % 4; diff --git a/test/hotspot/jtreg/compiler/jvmci/compilerToVM/CompileCodeTestCase.java b/test/hotspot/jtreg/compiler/jvmci/compilerToVM/CompileCodeTestCase.java index e15b151ec06..797bef95edc 100644 --- a/test/hotspot/jtreg/compiler/jvmci/compilerToVM/CompileCodeTestCase.java +++ b/test/hotspot/jtreg/compiler/jvmci/compilerToVM/CompileCodeTestCase.java @@ -244,7 +244,7 @@ public class CompileCodeTestCase { } static { - Map, Object> map = new HashMap<>();; + Map, Object> map = new HashMap<>(); map.put(CompileCodeTestCase.DummyEx.class, new CompileCodeTestCase.DummyEx()); map.put(CompileCodeTestCase.Dummy.class, diff --git a/test/hotspot/jtreg/compiler/unsafe/TestMisalignedUnsafeAccess.java b/test/hotspot/jtreg/compiler/unsafe/TestMisalignedUnsafeAccess.java index 10d766cf122..84752a0ccf0 100644 --- a/test/hotspot/jtreg/compiler/unsafe/TestMisalignedUnsafeAccess.java +++ b/test/hotspot/jtreg/compiler/unsafe/TestMisalignedUnsafeAccess.java @@ -37,7 +37,7 @@ import jdk.test.lib.Asserts; public class TestMisalignedUnsafeAccess { - private static final Unsafe UNSAFE = Unsafe.getUnsafe();; + private static final Unsafe UNSAFE = Unsafe.getUnsafe(); private static short onHeapStaticMemory; // For static field testing private static final Object onHeapStaticMemoryBase; diff --git a/test/hotspot/jtreg/runtime/cds/appcds/TestCommon.java b/test/hotspot/jtreg/runtime/cds/appcds/TestCommon.java index 959d43173d0..55c10299ed6 100644 --- a/test/hotspot/jtreg/runtime/cds/appcds/TestCommon.java +++ b/test/hotspot/jtreg/runtime/cds/appcds/TestCommon.java @@ -466,7 +466,7 @@ public class TestCommon extends CDSTestUtils { public static Result runWithoutCDS(String... suffix) throws Exception { AppCDSOptions opts = (new AppCDSOptions()); - opts.addSuffix(suffix).setXShareMode("off");; + opts.addSuffix(suffix).setXShareMode("off"); return new Result(opts, runWithArchive(opts)); } diff --git a/test/hotspot/jtreg/runtime/cds/appcds/customLoader/SameNameInTwoLoadersTest.java b/test/hotspot/jtreg/runtime/cds/appcds/customLoader/SameNameInTwoLoadersTest.java index 72d62c64179..2aeb2d41559 100644 --- a/test/hotspot/jtreg/runtime/cds/appcds/customLoader/SameNameInTwoLoadersTest.java +++ b/test/hotspot/jtreg/runtime/cds/appcds/customLoader/SameNameInTwoLoadersTest.java @@ -54,7 +54,7 @@ public class SameNameInTwoLoadersTest { customJar = JarBuilder.build("SameNameInTwoLoadersTest_custom", "CustomLoadee", "CustomLoadee3"); useWbParam = "-Xbootclasspath/a:" + - JarBuilder.build(true, "WhiteBox", "sun/hotspot/WhiteBox");; + JarBuilder.build(true, "WhiteBox", "sun/hotspot/WhiteBox"); // ====== unrelated loaders executeTestCase(getClassList_FP(), diff --git a/test/hotspot/jtreg/serviceability/jvmti/Heap/IterateHeapWithEscapeAnalysisEnabled.java b/test/hotspot/jtreg/serviceability/jvmti/Heap/IterateHeapWithEscapeAnalysisEnabled.java index 03e388df6c3..6b835ca7ac8 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/Heap/IterateHeapWithEscapeAnalysisEnabled.java +++ b/test/hotspot/jtreg/serviceability/jvmti/Heap/IterateHeapWithEscapeAnalysisEnabled.java @@ -590,7 +590,7 @@ public class IterateHeapWithEscapeAnalysisEnabled { // The new instance is an ArgEscape instance and escapes to the JVMTI agent // while the target thread is in the call to dontinline_endlessLoop(). At this // location there is no local variable that references the ArgEscape. - ((ABBox) dontinline_endlessLoop(new ABBox(this))).synchronizedSlowInc();; + ((ABBox) dontinline_endlessLoop(new ABBox(this))).synchronizedSlowInc(); } } diff --git a/test/hotspot/jtreg/testlibrary/ctw/src/sun/hotspot/tools/ctw/CtwRunner.java b/test/hotspot/jtreg/testlibrary/ctw/src/sun/hotspot/tools/ctw/CtwRunner.java index 3f8a6b3765a..2f0dca67427 100644 --- a/test/hotspot/jtreg/testlibrary/ctw/src/sun/hotspot/tools/ctw/CtwRunner.java +++ b/test/hotspot/jtreg/testlibrary/ctw/src/sun/hotspot/tools/ctw/CtwRunner.java @@ -93,7 +93,7 @@ public class CtwRunner { errors = new ArrayList<>(); if (start.endsWith("%") && stop.endsWith("%")) { - int startPercentage = Integer.parseInt(start.substring(0, start.length() - 1));; + int startPercentage = Integer.parseInt(start.substring(0, start.length() - 1)); int stopPercentage = Integer.parseInt(stop.substring(0, stop.length() - 1)); if (startPercentage < 0 || startPercentage > 100 || stopPercentage < 0 || stopPercentage > 100) { diff --git a/test/hotspot/jtreg/vmTestbase/jit/series/series.java b/test/hotspot/jtreg/vmTestbase/jit/series/series.java index c17e24427f9..eef54c2c81a 100644 --- a/test/hotspot/jtreg/vmTestbase/jit/series/series.java +++ b/test/hotspot/jtreg/vmTestbase/jit/series/series.java @@ -192,7 +192,7 @@ fres); { series patObj = new series(); if (patObj.runit()!=0) - throw new TestFailure("Test failed.");; + throw new TestFailure("Test failed."); series.goldChecker.check(); } } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdb/unmonitor/unmonitor001/unmonitor001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdb/unmonitor/unmonitor001/unmonitor001.java index 54a90a930f2..9fe8a7e5703 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdb/unmonitor/unmonitor001/unmonitor001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdb/unmonitor/unmonitor001/unmonitor001.java @@ -172,7 +172,7 @@ public class unmonitor001 extends JdbTest { private boolean checkCommands(String[] reply) { Paragrep grep; String found; - Vector v = new Vector();; + Vector v = new Vector(); boolean result = true; int count; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/multithrd/tc02x003.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/multithrd/tc02x003.java index 4fd48e21ff0..79bb11fc706 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/multithrd/tc02x003.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/multithrd/tc02x003.java @@ -146,7 +146,7 @@ public class tc02x003 { hitEvent(clsEvent); mthdReq = evm.createMethodEntryRequest(); - ReferenceType testedClass = clsEvent.referenceType();; + ReferenceType testedClass = clsEvent.referenceType(); mthdReq.addClassFilter(testedClass); mthdReq.enable(); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassObjectReference/reflectedType/reflectype002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassObjectReference/reflectedType/reflectype002.java index da528cee5b3..46608d9b07d 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassObjectReference/reflectedType/reflectype002.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassObjectReference/reflectedType/reflectype002.java @@ -166,7 +166,7 @@ public class reflectype002 extends Log { print_log_on_verbose ("--> reflectype002: getting ClassObjectReference object for loaded checked class..."); - ClassObjectReference class_obj_ref = refType.classObject();; + ClassObjectReference class_obj_ref = refType.classObject(); print_log_on_verbose("--> reflectype002: getting ClassObjectReference object - DONE!"); print_log_on_verbose diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/LocalVariable/isVisible/isvisible001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/LocalVariable/isVisible/isvisible001.java index 9d5dba92c75..5593aabe31b 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/LocalVariable/isVisible/isvisible001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/LocalVariable/isVisible/isvisible001.java @@ -415,7 +415,7 @@ public class isvisible001 { expresult = returnCode1; } } catch ( IllegalArgumentException e ) { - log3("ERROR: IllegalArgumentException for i3 in stackFrame");; + log3("ERROR: IllegalArgumentException for i3 in stackFrame"); expresult = returnCode1; } } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/frames/frames001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/frames/frames001.java index cc75403caf6..2e361e65cab 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/frames/frames001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/frames/frames001.java @@ -373,7 +373,7 @@ public class frames001 { log2(" getting new List of frames"); try { - frameList = thread2.frames();; + frameList = thread2.frames(); } catch ( IndexOutOfBoundsException e1 ) { log3("ERROR: IndexOutOfBoundsException"); expresult = returnCode1; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS203/hs203t002/hs203t002.java b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS203/hs203t002/hs203t002.java index f872a6dcba3..d9dd4a88c80 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS203/hs203t002/hs203t002.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS203/hs203t002/hs203t002.java @@ -79,7 +79,7 @@ public class hs203t002 extends RedefineAgent { Thread.sleep(10000); popThreadFrame(mt); resumeThread(mt); - while(!MyThread.resume2.get());; + while(!MyThread.resume2.get()); Thread.sleep(10000); suspendThread(mt); //mt.suspend(); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/jdb/Launcher.java b/test/hotspot/jtreg/vmTestbase/nsk/share/jdb/Launcher.java index d7aa6c30219..a78dabdbe25 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/share/jdb/Launcher.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/jdb/Launcher.java @@ -184,7 +184,7 @@ public class Launcher extends DebugeeBinder { connect.append(argumentHandler.getConnectorName() + ":"); String connectorAddress; - String vmAddress = makeTransportAddress();; + String vmAddress = makeTransportAddress(); if (argumentHandler.isRawLaunchingConnector()) { diff --git a/test/jdk/com/sun/jdi/ConstantPoolInfo.java b/test/jdk/com/sun/jdi/ConstantPoolInfo.java index 097ab535cf2..5d5c2a6a5d9 100644 --- a/test/jdk/com/sun/jdi/ConstantPoolInfo.java +++ b/test/jdk/com/sun/jdi/ConstantPoolInfo.java @@ -241,7 +241,7 @@ public class ConstantPoolInfo extends TestScaffold { if (magic != JAVA_MAGIC) { failure("fatal bad class file format"); } - expectedMinorVersion = in.readShort();; + expectedMinorVersion = in.readShort(); expectedMajorVersion = in.readShort(); expectedCpoolCount = in.readUnsignedShort(); in.close(); diff --git a/test/jdk/com/sun/jdi/GenericsTest.java b/test/jdk/com/sun/jdi/GenericsTest.java index 28a3d69a8d6..f12a5f74322 100644 --- a/test/jdk/com/sun/jdi/GenericsTest.java +++ b/test/jdk/com/sun/jdi/GenericsTest.java @@ -40,7 +40,7 @@ import java.util.*; /********** target program **********/ class GenericsTarg { - static Gen1 genField = new Gen1();; + static Gen1 genField = new Gen1(); static Sub1 sub1Field = new Sub1(); String[] strArray = null; diff --git a/test/jdk/java/awt/Component/CompEventOnHiddenComponent/CompEventOnHiddenComponent.java b/test/jdk/java/awt/Component/CompEventOnHiddenComponent/CompEventOnHiddenComponent.java index c643aae1f00..0c1734cb1cc 100644 --- a/test/jdk/java/awt/Component/CompEventOnHiddenComponent/CompEventOnHiddenComponent.java +++ b/test/jdk/java/awt/Component/CompEventOnHiddenComponent/CompEventOnHiddenComponent.java @@ -86,7 +86,7 @@ public class CompEventOnHiddenComponent EventQueue.invokeLater(new Runnable() { public void run() { JFrame parentWindow = new JFrame("JFrame 1"); - JButton component = new JButton("JButton 1");; + JButton component = new JButton("JButton 1"); JButton smallButton = new JButton("Small Button"); diff --git a/test/jdk/java/awt/EmbeddedFrame/EmbeddedFrameGrabTest/EmbeddedFrameGrabTest.java b/test/jdk/java/awt/EmbeddedFrame/EmbeddedFrameGrabTest/EmbeddedFrameGrabTest.java index e186e7ac132..535e6c68aa5 100644 --- a/test/jdk/java/awt/EmbeddedFrame/EmbeddedFrameGrabTest/EmbeddedFrameGrabTest.java +++ b/test/jdk/java/awt/EmbeddedFrame/EmbeddedFrameGrabTest/EmbeddedFrameGrabTest.java @@ -81,7 +81,7 @@ public class EmbeddedFrameGrabTest { = clazz.getConstructor(new Class[]{long.class}); final Frame embedded_frame = (Frame) constructor.newInstance(new Object[]{ - new Long(hwnd)});; + new Long(hwnd)}); final JComboBox combo = new JComboBox<>(new String[]{ "Item 1", "Item 2" }); diff --git a/test/jdk/java/awt/PrintJob/PrintArcTest/PrintArcTest.java b/test/jdk/java/awt/PrintJob/PrintArcTest/PrintArcTest.java index 15cf121607c..7e9023b1afc 100644 --- a/test/jdk/java/awt/PrintJob/PrintArcTest/PrintArcTest.java +++ b/test/jdk/java/awt/PrintJob/PrintArcTest/PrintArcTest.java @@ -65,7 +65,7 @@ public class PrintArcTest extends Panel implements ActionListener { } private Frame getFrame() { - Container cont = getParent();; + Container cont = getParent(); while ( !(cont instanceof Frame ) ) { cont = cont.getParent(); diff --git a/test/jdk/java/awt/SplashScreen/GenerateTestImage.java b/test/jdk/java/awt/SplashScreen/GenerateTestImage.java index 93def334756..ddde69ca295 100644 --- a/test/jdk/java/awt/SplashScreen/GenerateTestImage.java +++ b/test/jdk/java/awt/SplashScreen/GenerateTestImage.java @@ -43,7 +43,7 @@ public class GenerateTestImage { Graphics2D graphics2D = image.createGraphics(); graphics2D.setColor(Color.red); graphics2D.fillOval(0, 0, IMAGE_SIZE, IMAGE_SIZE); - graphics2D.dispose();; + graphics2D.dispose(); ImageIO.write(image, "png", file); } diff --git a/test/jdk/java/awt/print/PrinterJob/PrtException.java b/test/jdk/java/awt/print/PrinterJob/PrtException.java index 152fe70d485..bb590fd6cd9 100644 --- a/test/jdk/java/awt/print/PrinterJob/PrtException.java +++ b/test/jdk/java/awt/print/PrinterJob/PrtException.java @@ -50,7 +50,7 @@ public class PrtException implements Printable { } System.out.println("PrintService found : "+defService); - pj = PrinterJob.getPrinterJob();; + pj = PrinterJob.getPrinterJob(); pj.setPrintService(defService); //pj.setPrintable(this); // commenting this line should not result in PrinterException pj.print(); diff --git a/test/jdk/java/io/File/GetXSpace.java b/test/jdk/java/io/File/GetXSpace.java index ac80bdf68fd..d53b246994e 100644 --- a/test/jdk/java/io/File/GetXSpace.java +++ b/test/jdk/java/io/File/GetXSpace.java @@ -154,7 +154,7 @@ public class GetXSpace { // cygwin's df lists windows path as FileSystem (1st group) name = Platform.isWindows() ? m.group(1) : m.group(4); } - al.add(new Space(m.group(2), m.group(3), name));; + al.add(new Space(m.group(2), m.group(3), name)); } j = m.end(); } else { diff --git a/test/jdk/java/io/File/createTempFile/NameTooLong.java b/test/jdk/java/io/File/createTempFile/NameTooLong.java index 75d604b81e1..fe7bd03f95e 100644 --- a/test/jdk/java/io/File/createTempFile/NameTooLong.java +++ b/test/jdk/java/io/File/createTempFile/NameTooLong.java @@ -54,7 +54,7 @@ public class NameTooLong { if (ps[1].startsWith(".") && !s.contains(ps[1].substring(0, 4))) { System.err.printf("%s did not contain %s%n", s, - ps[1].substring(0, 4));; + ps[1].substring(0, 4)); failures++; } } catch (IOException e) { diff --git a/test/jdk/java/io/RandomAccessFile/WriteBytesChars.java b/test/jdk/java/io/RandomAccessFile/WriteBytesChars.java index cc89709b7e7..7b564bc633a 100644 --- a/test/jdk/java/io/RandomAccessFile/WriteBytesChars.java +++ b/test/jdk/java/io/RandomAccessFile/WriteBytesChars.java @@ -37,7 +37,7 @@ public class WriteBytesChars { byte[] b = new byte[80]; File fn = new File("x.WriteBytesChars"); - RandomAccessFile raf = new RandomAccessFile(fn , "rw");; + RandomAccessFile raf = new RandomAccessFile(fn , "rw"); try { for (int i = 0; i < 80; i++) { buf[i] = 'a'; diff --git a/test/jdk/java/lang/invoke/8022701/BogoLoader.java b/test/jdk/java/lang/invoke/8022701/BogoLoader.java index e8c579a27c8..568ff62089e 100644 --- a/test/jdk/java/lang/invoke/8022701/BogoLoader.java +++ b/test/jdk/java/lang/invoke/8022701/BogoLoader.java @@ -120,7 +120,7 @@ public class BogoLoader extends ClassLoader { if (verbose) { System.err.println("Loading classloader class " + name); } - byte[] classData = getClass(name);; + byte[] classData = getClass(name); boolean expanded = false; if (!noReplace && replaced.containsKey(name)) { if (verbose) { diff --git a/test/jdk/java/lang/invoke/accessProtectedSuper/BogoLoader.java b/test/jdk/java/lang/invoke/accessProtectedSuper/BogoLoader.java index a129ea254a4..b4d19fe8a05 100644 --- a/test/jdk/java/lang/invoke/accessProtectedSuper/BogoLoader.java +++ b/test/jdk/java/lang/invoke/accessProtectedSuper/BogoLoader.java @@ -121,7 +121,7 @@ public class BogoLoader extends ClassLoader { if (verbose) { System.err.println("Loading classloader class " + name); } - byte[] classData = getClass(name);; + byte[] classData = getClass(name); boolean expanded = false; if (!noReplace && replaced.containsKey(name)) { if (verbose) { diff --git a/test/jdk/java/lang/management/RuntimeMXBean/GetSystemProperties.java b/test/jdk/java/lang/management/RuntimeMXBean/GetSystemProperties.java index 5f6923526ab..ac6de886b25 100644 --- a/test/jdk/java/lang/management/RuntimeMXBean/GetSystemProperties.java +++ b/test/jdk/java/lang/management/RuntimeMXBean/GetSystemProperties.java @@ -40,7 +40,7 @@ public class GetSystemProperties { // system properties to be omitted private static final String KEY3 = "test.property.key3"; - private static final Long VALUE3 = new Long(0);; + private static final Long VALUE3 = new Long(0); private static final Object KEY4 = new Object(); private static final String VALUE4 = "test.property.value4"; diff --git a/test/jdk/java/net/httpclient/AggregateRequestBodyTest.java b/test/jdk/java/net/httpclient/AggregateRequestBodyTest.java index 05d27547a15..60a35a42a06 100644 --- a/test/jdk/java/net/httpclient/AggregateRequestBodyTest.java +++ b/test/jdk/java/net/httpclient/AggregateRequestBodyTest.java @@ -485,7 +485,7 @@ public class AggregateRequestBodyTest implements HttpServerAdapters { subscriber.subscriptionCF.thenAccept(s -> s.request(1)); List result = subscriber.resultCF.join(); assertEquals(result, List.of()); - assertTrue(subscriber.items.isEmpty());; + assertTrue(subscriber.items.isEmpty()); } // verifies that error emitted by upstream publishers are propagated downstream. diff --git a/test/jdk/java/nio/channels/SocketChannel/CloseTimeoutChannel.java b/test/jdk/java/nio/channels/SocketChannel/CloseTimeoutChannel.java index 10fdcaaaea6..c715cad8c7c 100644 --- a/test/jdk/java/nio/channels/SocketChannel/CloseTimeoutChannel.java +++ b/test/jdk/java/nio/channels/SocketChannel/CloseTimeoutChannel.java @@ -102,7 +102,7 @@ public class CloseTimeoutChannel { System.out.println(INDENT+"Listening on port "+ _listener.socket().getLocalPort()); ByteBuffer buf=ByteBuffer.allocate(5); - Socket client=_listener.accept().socket();; + Socket client=_listener.accept().socket(); System.out.println(INDENT+"Accepted client"); OutputStream out=client.getOutputStream(); diff --git a/test/jdk/java/rmi/dgc/dgcImplInsulation/DGCImplInsulation.java b/test/jdk/java/rmi/dgc/dgcImplInsulation/DGCImplInsulation.java index c4a15b28bb1..9a0490beb0f 100644 --- a/test/jdk/java/rmi/dgc/dgcImplInsulation/DGCImplInsulation.java +++ b/test/jdk/java/rmi/dgc/dgcImplInsulation/DGCImplInsulation.java @@ -68,7 +68,7 @@ public class DGCImplInsulation implements java.rmi.Remote { new ProtectionDomain( new CodeSource(null, (Certificate[]) null), perms) }); - Remote impl = new DGCImplInsulation();; + Remote impl = new DGCImplInsulation(); try { Remote stub = (Remote) java.security.AccessController.doPrivileged( diff --git a/test/jdk/java/time/tck/java/time/zone/TCKZoneRules.java b/test/jdk/java/time/tck/java/time/zone/TCKZoneRules.java index 3f6c17b277a..d44216b69b5 100644 --- a/test/jdk/java/time/tck/java/time/zone/TCKZoneRules.java +++ b/test/jdk/java/time/tck/java/time/zone/TCKZoneRules.java @@ -1072,7 +1072,7 @@ public class TCKZoneRules { ); OffsetDateTime before_time_of_stdOffsetTransition1 = OffsetDateTime.of(time_of_stdOffsetTransition1, stdOffset1).minusSeconds(1); - OffsetDateTime after_time_of_stdOffsetTransition1 = OffsetDateTime.of(time_of_stdOffsetTransition1, stdOffset1).plusSeconds(1);; + OffsetDateTime after_time_of_stdOffsetTransition1 = OffsetDateTime.of(time_of_stdOffsetTransition1, stdOffset1).plusSeconds(1); assertEquals(zoneRule.getStandardOffset(before_time_of_stdOffsetTransition1.toInstant()), stdOffset1); assertEquals(zoneRule.getStandardOffset(after_time_of_stdOffsetTransition1.toInstant()), stdOffset2); diff --git a/test/jdk/java/util/logging/TestAppletLoggerContext.java b/test/jdk/java/util/logging/TestAppletLoggerContext.java index 6fbe975b5e4..b69497a626e 100644 --- a/test/jdk/java/util/logging/TestAppletLoggerContext.java +++ b/test/jdk/java/util/logging/TestAppletLoggerContext.java @@ -447,7 +447,7 @@ public class TestAppletLoggerContext { Logger logger4b = manager.getLogger(Logger.GLOBAL_LOGGER_NAME); assertNotNull(logger4); assertNotNull(logger4b); - expected = (System.getSecurityManager() == null ? global : global2);; + expected = (System.getSecurityManager() == null ? global : global2); assertEquals(logger4, expected); assertEquals(logger4b, expected); diff --git a/test/jdk/javax/net/ssl/ServerName/SSLSocketExplorer.java b/test/jdk/javax/net/ssl/ServerName/SSLSocketExplorer.java index 4992553eba9..3ae2e777810 100644 --- a/test/jdk/javax/net/ssl/ServerName/SSLSocketExplorer.java +++ b/test/jdk/javax/net/ssl/ServerName/SSLSocketExplorer.java @@ -134,7 +134,7 @@ public class SSLSocketExplorer { position += n; } - capabilities = SSLExplorer.explore(buffer, 0, recordLength);; + capabilities = SSLExplorer.explore(buffer, 0, recordLength); if (capabilities != null) { System.out.println("Record version: " + capabilities.getRecordVersion()); diff --git a/test/jdk/javax/net/ssl/ServerName/SSLSocketExplorerFailure.java b/test/jdk/javax/net/ssl/ServerName/SSLSocketExplorerFailure.java index 00d00001d87..7193fcaf136 100644 --- a/test/jdk/javax/net/ssl/ServerName/SSLSocketExplorerFailure.java +++ b/test/jdk/javax/net/ssl/ServerName/SSLSocketExplorerFailure.java @@ -135,7 +135,7 @@ public class SSLSocketExplorerFailure { position += n; } - capabilities = SSLExplorer.explore(buffer, 0, recordLength);; + capabilities = SSLExplorer.explore(buffer, 0, recordLength); if (capabilities != null) { System.out.println("Record version: " + capabilities.getRecordVersion()); diff --git a/test/jdk/javax/net/ssl/ServerName/SSLSocketExplorerMatchedSNI.java b/test/jdk/javax/net/ssl/ServerName/SSLSocketExplorerMatchedSNI.java index 724a37e1a80..0cea7323b83 100644 --- a/test/jdk/javax/net/ssl/ServerName/SSLSocketExplorerMatchedSNI.java +++ b/test/jdk/javax/net/ssl/ServerName/SSLSocketExplorerMatchedSNI.java @@ -138,7 +138,7 @@ public class SSLSocketExplorerMatchedSNI { position += n; } - capabilities = SSLExplorer.explore(buffer, 0, recordLength);; + capabilities = SSLExplorer.explore(buffer, 0, recordLength); if (capabilities != null) { System.out.println("Record version: " + capabilities.getRecordVersion()); diff --git a/test/jdk/javax/net/ssl/ServerName/SSLSocketExplorerUnmatchedSNI.java b/test/jdk/javax/net/ssl/ServerName/SSLSocketExplorerUnmatchedSNI.java index 732e0cf3097..619a997eda2 100644 --- a/test/jdk/javax/net/ssl/ServerName/SSLSocketExplorerUnmatchedSNI.java +++ b/test/jdk/javax/net/ssl/ServerName/SSLSocketExplorerUnmatchedSNI.java @@ -130,7 +130,7 @@ public class SSLSocketExplorerUnmatchedSNI { position += n; } - capabilities = SSLExplorer.explore(buffer, 0, recordLength);; + capabilities = SSLExplorer.explore(buffer, 0, recordLength); if (capabilities != null) { System.out.println("Record version: " + capabilities.getRecordVersion()); diff --git a/test/jdk/javax/net/ssl/ServerName/SSLSocketExplorerWithCliSNI.java b/test/jdk/javax/net/ssl/ServerName/SSLSocketExplorerWithCliSNI.java index 8f2b7816864..8451b44f0bf 100644 --- a/test/jdk/javax/net/ssl/ServerName/SSLSocketExplorerWithCliSNI.java +++ b/test/jdk/javax/net/ssl/ServerName/SSLSocketExplorerWithCliSNI.java @@ -129,7 +129,7 @@ public class SSLSocketExplorerWithCliSNI { position += n; } - capabilities = SSLExplorer.explore(buffer, 0, recordLength);; + capabilities = SSLExplorer.explore(buffer, 0, recordLength); if (capabilities != null) { System.out.println("Record version: " + capabilities.getRecordVersion()); diff --git a/test/jdk/javax/net/ssl/ServerName/SSLSocketExplorerWithSrvSNI.java b/test/jdk/javax/net/ssl/ServerName/SSLSocketExplorerWithSrvSNI.java index f026f32e781..8b891e804e4 100644 --- a/test/jdk/javax/net/ssl/ServerName/SSLSocketExplorerWithSrvSNI.java +++ b/test/jdk/javax/net/ssl/ServerName/SSLSocketExplorerWithSrvSNI.java @@ -129,7 +129,7 @@ public class SSLSocketExplorerWithSrvSNI { position += n; } - capabilities = SSLExplorer.explore(buffer, 0, recordLength);; + capabilities = SSLExplorer.explore(buffer, 0, recordLength); if (capabilities != null) { System.out.println("Record version: " + capabilities.getRecordVersion()); diff --git a/test/jdk/javax/sound/midi/Gervill/ModelIdentifier/NewModelIdentifierStringStringInt.java b/test/jdk/javax/sound/midi/Gervill/ModelIdentifier/NewModelIdentifierStringStringInt.java index 348012f54bf..fdd6e542440 100644 --- a/test/jdk/javax/sound/midi/Gervill/ModelIdentifier/NewModelIdentifierStringStringInt.java +++ b/test/jdk/javax/sound/midi/Gervill/ModelIdentifier/NewModelIdentifierStringStringInt.java @@ -37,7 +37,7 @@ import com.sun.media.sound.*; public class NewModelIdentifierStringStringInt { public static void main(String[] args) throws Exception { - ModelIdentifier id = new ModelIdentifier("test","a",1);; + ModelIdentifier id = new ModelIdentifier("test","a",1); if(!id.getObject().equals("test")) throw new RuntimeException("id.getObject() doesn't return \"test\"!"); if(!id.getVariable().equals("a")) diff --git a/test/jdk/javax/sound/midi/Gervill/SoftChannel/NoteOff.java b/test/jdk/javax/sound/midi/Gervill/SoftChannel/NoteOff.java index 0330628c8b6..eaff35c2c3c 100644 --- a/test/jdk/javax/sound/midi/Gervill/SoftChannel/NoteOff.java +++ b/test/jdk/javax/sound/midi/Gervill/SoftChannel/NoteOff.java @@ -56,7 +56,7 @@ public class NoteOff { assertEquals(v[0].active, true); channel.noteOff(60); soft.read(1); - v = soft.synth.getVoiceStatus();; + v = soft.synth.getVoiceStatus(); assertEquals(v[0].active, false); soft.close(); diff --git a/test/jdk/javax/sound/midi/Gervill/SoftChannel/NoteOff2.java b/test/jdk/javax/sound/midi/Gervill/SoftChannel/NoteOff2.java index 71172a049da..8143ee846a5 100644 --- a/test/jdk/javax/sound/midi/Gervill/SoftChannel/NoteOff2.java +++ b/test/jdk/javax/sound/midi/Gervill/SoftChannel/NoteOff2.java @@ -56,7 +56,7 @@ public class NoteOff2 { assertEquals(v[0].active, true); channel.noteOff(60); soft.read(1); - v = soft.synth.getVoiceStatus();; + v = soft.synth.getVoiceStatus(); assertEquals(v[0].active, false); soft.close(); diff --git a/test/jdk/javax/sql/testng/test/rowset/BaseRowSetTests.java b/test/jdk/javax/sql/testng/test/rowset/BaseRowSetTests.java index 95883556a05..c1d2d9a2ed0 100644 --- a/test/jdk/javax/sql/testng/test/rowset/BaseRowSetTests.java +++ b/test/jdk/javax/sql/testng/test/rowset/BaseRowSetTests.java @@ -355,7 +355,7 @@ public class BaseRowSetTests extends CommonRowSetTests { Blob aBlob = new SerialBlob(new StubBlob()); Clob aClob = new SerialClob(new StubClob()); Reader rdr = new StringReader(query); - InputStream is = new StringBufferInputStream(query);; + InputStream is = new StringBufferInputStream(query); brs = new StubBaseRowSet(); brs.setBytes(1, bytes); brs.setAsciiStream(2, is, query.length()); diff --git a/test/jdk/javax/sql/testng/test/rowset/serial/SQLInputImplTests.java b/test/jdk/javax/sql/testng/test/rowset/serial/SQLInputImplTests.java index a6756a13a4a..95cc508828a 100644 --- a/test/jdk/javax/sql/testng/test/rowset/serial/SQLInputImplTests.java +++ b/test/jdk/javax/sql/testng/test/rowset/serial/SQLInputImplTests.java @@ -183,7 +183,7 @@ public class SQLInputImplTests extends BaseTest { */ @Test(enabled = true) public void test10() throws Exception { - URL u = new URL("http://www.oracle.com/");; + URL u = new URL("http://www.oracle.com/"); Object[] values = {u}; SQLInputImpl sqli = new SQLInputImpl(values, map); URL u2 = sqli.readURL(); diff --git a/test/jdk/javax/sql/testng/test/rowset/serial/SerialArrayTests.java b/test/jdk/javax/sql/testng/test/rowset/serial/SerialArrayTests.java index 077ce43da85..345315b7f05 100644 --- a/test/jdk/javax/sql/testng/test/rowset/serial/SerialArrayTests.java +++ b/test/jdk/javax/sql/testng/test/rowset/serial/SerialArrayTests.java @@ -230,7 +230,7 @@ public class SerialArrayTests extends BaseTest { @Test public void test18() throws Exception { SerialArray sa = new SerialArray(a); - SerialArray sa1 = serializeDeserializeObject(sa);; + SerialArray sa1 = serializeDeserializeObject(sa); assertTrue(sa.equals(sa1)); } } diff --git a/test/jdk/javax/sql/testng/test/rowset/serial/SerialExceptionTests.java b/test/jdk/javax/sql/testng/test/rowset/serial/SerialExceptionTests.java index ff963ae7ba8..8ef215584a9 100644 --- a/test/jdk/javax/sql/testng/test/rowset/serial/SerialExceptionTests.java +++ b/test/jdk/javax/sql/testng/test/rowset/serial/SerialExceptionTests.java @@ -108,6 +108,6 @@ public class SerialExceptionTests extends BaseTest { assertTrue(ex1.getMessage().equals(reason) && ex1.getSQLState() == null && ex1.getCause() == null - && ex1.getErrorCode() == 0);; + && ex1.getErrorCode() == 0); } } diff --git a/test/jdk/javax/sql/testng/test/rowset/serial/SerialStructTests.java b/test/jdk/javax/sql/testng/test/rowset/serial/SerialStructTests.java index 84a0ff2aaaf..79ac2421c9a 100644 --- a/test/jdk/javax/sql/testng/test/rowset/serial/SerialStructTests.java +++ b/test/jdk/javax/sql/testng/test/rowset/serial/SerialStructTests.java @@ -134,7 +134,7 @@ public class SerialStructTests extends BaseTest { @Test public void test08() throws Exception { SerialStruct ss = new SerialStruct(struct, map); - SerialStruct ss1 = serializeDeserializeObject(ss);; + SerialStruct ss1 = serializeDeserializeObject(ss); assertTrue(ss.equals(ss1)); } } diff --git a/test/jdk/jdk/jfr/api/consumer/TestRecordingFile.java b/test/jdk/jdk/jfr/api/consumer/TestRecordingFile.java index 923895447c7..a81262f9405 100644 --- a/test/jdk/jdk/jfr/api/consumer/TestRecordingFile.java +++ b/test/jdk/jdk/jfr/api/consumer/TestRecordingFile.java @@ -194,11 +194,11 @@ public class TestRecordingFile { rotator.stop(); } r2.stop(); - r2.dump(twoEventTypes);; + r2.dump(twoEventTypes); } FlightRecorder.register(Event3.class); r1.stop(); - r1.dump(threeEventTypes);; + r1.dump(threeEventTypes); } try (RecordingFile f = new RecordingFile(twoEventTypes)) { List types = f.readEventTypes(); diff --git a/test/jdk/jdk/jfr/api/consumer/filestream/TestReuse.java b/test/jdk/jdk/jfr/api/consumer/filestream/TestReuse.java index 3d7d143f44c..3dbe26eea16 100644 --- a/test/jdk/jdk/jfr/api/consumer/filestream/TestReuse.java +++ b/test/jdk/jdk/jfr/api/consumer/filestream/TestReuse.java @@ -89,7 +89,7 @@ public class TestReuse { es.setReuse(true); es.onEvent(e -> { if(events.containsKey(e)) { - success.set(true);; + success.set(true); es.close(); } events.put(e,e); diff --git a/test/jdk/jdk/jfr/api/recording/event/TestEventTime.java b/test/jdk/jdk/jfr/api/recording/event/TestEventTime.java index af740a6e559..7ee9748520a 100644 --- a/test/jdk/jdk/jfr/api/recording/event/TestEventTime.java +++ b/test/jdk/jdk/jfr/api/recording/event/TestEventTime.java @@ -101,7 +101,7 @@ public class TestEventTime { MyEvent event = new MyEvent(id); event.begin(); if (!CommonHelper.hasFastTimeEnabled()) { - CommonHelper.waitForSystemCurrentMillisToChange();; + CommonHelper.waitForSystemCurrentMillisToChange(); } actualOrder.add(new TimeEvent(id, true)); return event; @@ -110,7 +110,7 @@ public class TestEventTime { private static void endEvent(MyEvent event) throws Exception { event.end(); if (!CommonHelper.hasFastTimeEnabled()) { - CommonHelper.waitForSystemCurrentMillisToChange();; + CommonHelper.waitForSystemCurrentMillisToChange(); } event.commit(); actualOrder.add(new TimeEvent(event.id, false)); diff --git a/test/jdk/jdk/jfr/event/runtime/TestActiveSettingEvent.java b/test/jdk/jdk/jfr/event/runtime/TestActiveSettingEvent.java index 5be87e78e10..7f6f7be79d2 100644 --- a/test/jdk/jdk/jfr/event/runtime/TestActiveSettingEvent.java +++ b/test/jdk/jdk/jfr/event/runtime/TestActiveSettingEvent.java @@ -58,8 +58,8 @@ public final class TestActiveSettingEvent { private static final String ACTIVE_SETTING_EVENT_NAME = EventNames.ActiveSetting; public static void main(String[] args) throws Throwable { - testDefaultSettings();; - testProfileSettings();; + testDefaultSettings(); + testProfileSettings(); testNewSettings(); testChangedSetting(); testUnregistered(); diff --git a/test/jdk/sanity/client/lib/SwingSet3/src/com/sun/swingset3/demos/tooltip/ToolTipDemo.java b/test/jdk/sanity/client/lib/SwingSet3/src/com/sun/swingset3/demos/tooltip/ToolTipDemo.java index 724a16715bb..105160237cc 100644 --- a/test/jdk/sanity/client/lib/SwingSet3/src/com/sun/swingset3/demos/tooltip/ToolTipDemo.java +++ b/test/jdk/sanity/client/lib/SwingSet3/src/com/sun/swingset3/demos/tooltip/ToolTipDemo.java @@ -58,9 +58,9 @@ public class ToolTipDemo extends JPanel { public static final String DEMO_TITLE = ToolTipDemo.class.getAnnotation(DemoProperties.class).value(); private final static ResourceManager resourceManager = new ResourceManager(ToolTipDemo.class); - public static final String PLAIN_TOOLTIP_COMP_TITLE = resourceManager.getString("ToolTipDemo.plain");; + public static final String PLAIN_TOOLTIP_COMP_TITLE = resourceManager.getString("ToolTipDemo.plain"); public static final String PLAIN_TOOLTIP_TEXT = "A simple one line tip."; - public static final String HTML_TOOLTIP_COMP_TITLE = resourceManager.getString("ToolTipDemo.html");; + public static final String HTML_TOOLTIP_COMP_TITLE = resourceManager.getString("ToolTipDemo.html"); public static final String HTML_TOOLTIP_TEXT = "In case you thought that tooltips had to be

    " + "boring, one line descriptions, the Swing! team

    " + "is happy to shatter your illusions.

    " + diff --git a/test/jdk/sun/java2d/cmm/ColorConvertOp/ImageFactory.java b/test/jdk/sun/java2d/cmm/ColorConvertOp/ImageFactory.java index a16f37f1236..62cc0f52720 100644 --- a/test/jdk/sun/java2d/cmm/ColorConvertOp/ImageFactory.java +++ b/test/jdk/sun/java2d/cmm/ColorConvertOp/ImageFactory.java @@ -258,7 +258,7 @@ public class ImageFactory { for (int j = 0; j < HEIGHT; j++) { pixel[0] = (i/255.0)*(cs.getMaxValue(0) - cs.getMinValue(0)) + - cs.getMinValue(0);; + cs.getMinValue(0); sm.setPixel(i, j, pixel, data); } } @@ -268,7 +268,7 @@ public class ImageFactory { for (int j = 0; j < HEIGHT; j++) { pixel[0] = (i/255.0f)*(cs.getMaxValue(0) - cs.getMinValue(0)) + - cs.getMinValue(0);; + cs.getMinValue(0); sm.setPixel(i, j, pixel, data); } } diff --git a/test/jdk/sun/security/provider/certpath/DisabledAlgorithms/CPBuilder.java b/test/jdk/sun/security/provider/certpath/DisabledAlgorithms/CPBuilder.java index 3edf02d70d7..0037ac7bad6 100644 --- a/test/jdk/sun/security/provider/certpath/DisabledAlgorithms/CPBuilder.java +++ b/test/jdk/sun/security/provider/certpath/DisabledAlgorithms/CPBuilder.java @@ -348,7 +348,7 @@ public class CPBuilder { for (String key : certmap.keySet()) { String certStr = certmap.get(key); ByteArrayInputStream is = - new ByteArrayInputStream(certStr.getBytes());; + new ByteArrayInputStream(certStr.getBytes()); Certificate cert = cf.generateCertificate(is); entries.add(cert); } diff --git a/test/jdk/sun/security/provider/certpath/DisabledAlgorithms/CPBuilderWithMD5.java b/test/jdk/sun/security/provider/certpath/DisabledAlgorithms/CPBuilderWithMD5.java index e6a9765037b..9785b270299 100644 --- a/test/jdk/sun/security/provider/certpath/DisabledAlgorithms/CPBuilderWithMD5.java +++ b/test/jdk/sun/security/provider/certpath/DisabledAlgorithms/CPBuilderWithMD5.java @@ -353,7 +353,7 @@ public class CPBuilderWithMD5 { for (String key : certmap.keySet()) { String certStr = certmap.get(key); ByteArrayInputStream is = - new ByteArrayInputStream(certStr.getBytes());; + new ByteArrayInputStream(certStr.getBytes()); Certificate cert = cf.generateCertificate(is); entries.add(cert); } diff --git a/test/jdk/sun/tools/jhsdb/BasicLauncherTest.java b/test/jdk/sun/tools/jhsdb/BasicLauncherTest.java index 401dfe6ca31..d2ca78f044a 100644 --- a/test/jdk/sun/tools/jhsdb/BasicLauncherTest.java +++ b/test/jdk/sun/tools/jhsdb/BasicLauncherTest.java @@ -134,7 +134,7 @@ public class BasicLauncherTest { launcher.addToolArg("--pid=" + Long.toString(theApp.getPid())); ProcessBuilder processBuilder = SATestUtils.createProcessBuilder(launcher); - OutputAnalyzer output = ProcessTools.executeProcess(processBuilder);; + OutputAnalyzer output = ProcessTools.executeProcess(processBuilder); output.shouldContain("No deadlocks found"); output.shouldNotContain("illegal bci"); output.shouldNotContain("AssertionFailure"); @@ -171,7 +171,7 @@ public class BasicLauncherTest { ProcessBuilder processBuilder = SATestUtils.createProcessBuilder(launcher); processBuilder.redirectError(ProcessBuilder.Redirect.INHERIT); - OutputAnalyzer output = ProcessTools.executeProcess(processBuilder);; + OutputAnalyzer output = ProcessTools.executeProcess(processBuilder); output.shouldContain(expectedMessage); unexpectedMessage.ifPresent(output::shouldNotContain); output.shouldHaveExitValue(0); diff --git a/test/jdk/tools/jar/modularJar/Basic.java b/test/jdk/tools/jar/modularJar/Basic.java index 26e9b835a49..177ae2a8453 100644 --- a/test/jdk/tools/jar/modularJar/Basic.java +++ b/test/jdk/tools/jar/modularJar/Basic.java @@ -123,7 +123,7 @@ public class Basic { moduleName = mn; mainClass = mc; version = v; message = m; hashes = h; this.requires = requires != null ? requires : Collections.emptySet(); this.exports = exports != null ? exports : Collections.emptySet(); - this.uses = uses != null ? uses : Collections.emptySet();; + this.uses = uses != null ? uses : Collections.emptySet(); this.provides = provides != null ? provides : Collections.emptySet(); this.packages = Stream.concat(this.exports.stream(), contains.stream()) .collect(Collectors.toSet()); diff --git a/test/jdk/tools/jar/multiRelease/data/test13/v10/version/Nested.java b/test/jdk/tools/jar/multiRelease/data/test13/v10/version/Nested.java index 7acd05676b4..35f43edcb39 100644 --- a/test/jdk/tools/jar/multiRelease/data/test13/v10/version/Nested.java +++ b/test/jdk/tools/jar/multiRelease/data/test13/v10/version/Nested.java @@ -12,7 +12,7 @@ public class Nested { int save = getVersion(); class nestnested { - int save = getVersion();; + int save = getVersion(); } } } diff --git a/test/langtools/jdk/javadoc/tool/api/basic/JavadocTaskImplTest.java b/test/langtools/jdk/javadoc/tool/api/basic/JavadocTaskImplTest.java index 1a8f1d89f77..ab84566e827 100644 --- a/test/langtools/jdk/javadoc/tool/api/basic/JavadocTaskImplTest.java +++ b/test/langtools/jdk/javadoc/tool/api/basic/JavadocTaskImplTest.java @@ -104,7 +104,7 @@ public class JavadocTaskImplTest extends APITest { File outDir = getOutDir(); fm.setLocation(DocumentationTool.Location.DOCUMENTATION_OUTPUT, Arrays.asList(outDir)); try { - DocumentationTask t = new JavadocTaskImpl(c, null, null, files);; + DocumentationTask t = new JavadocTaskImpl(c, null, null, files); error("getTask succeeded, no exception thrown"); } catch (NullPointerException e) { System.err.println("exception caught as expected: " + e); diff --git a/test/langtools/jdk/jshell/VariablesTest.java b/test/langtools/jdk/jshell/VariablesTest.java index 4224331b331..be957d5065e 100644 --- a/test/langtools/jdk/jshell/VariablesTest.java +++ b/test/langtools/jdk/jshell/VariablesTest.java @@ -340,7 +340,7 @@ public class VariablesTest extends KullaTesting { //assertEquals(getState().source(snippet), src); //assertEquals(snippet, undefKey); assertEquals(getState().status(undefKey), RECOVERABLE_NOT_DEFINED); - List unr = getState().unresolvedDependencies((VarSnippet) undefKey).collect(toList());; + List unr = getState().unresolvedDependencies((VarSnippet) undefKey).collect(toList()); assertEquals(unr.size(), 1); assertEquals(unr.get(0), "class undefined"); assertVariables(variable("undefined", "d")); diff --git a/test/langtools/tools/doclint/RunTest.java b/test/langtools/tools/doclint/RunTest.java index 2d287136b47..aff4b6c855b 100644 --- a/test/langtools/tools/doclint/RunTest.java +++ b/test/langtools/tools/doclint/RunTest.java @@ -59,7 +59,7 @@ public class RunTest { System.err.println("test: " + m.getName()); try { StringWriter sw = new StringWriter(); - PrintWriter pw = new PrintWriter(sw);; + PrintWriter pw = new PrintWriter(sw); m.invoke(this, new Object[] { pw }); String out = sw.toString(); System.err.println(">>> " + out.replace("\n", "\n>>> ")); diff --git a/test/langtools/tools/javac/generics/inference/4954546/T4954546.java b/test/langtools/tools/javac/generics/inference/4954546/T4954546.java index 7ce1dcb5a3a..456624b8333 100644 --- a/test/langtools/tools/javac/generics/inference/4954546/T4954546.java +++ b/test/langtools/tools/javac/generics/inference/4954546/T4954546.java @@ -46,7 +46,7 @@ public class T4954546 { f(true, new A(), new B()); } static void f(boolean cond, A a, B b) { - (cond?a:b).f();; - (cond?a:b).g();; + (cond?a:b).f(); + (cond?a:b).g(); } } -- GitLab From 50eb915a74aed2daf03c7d39670d3a1ac8d5cbfb Mon Sep 17 00:00:00 2001 From: Andrey Turbanov Date: Mon, 7 Mar 2022 22:00:11 +0000 Subject: [PATCH 177/340] 8282632: Cleanup unnecessary calls to Throwable.initCause() in java.security.jgss Reviewed-by: mullan, rhalade --- .../www/protocol/http/spnego/NegotiatorImpl.java | 10 +++------- .../sun/security/krb5/internal/KRBError.java | 8 +++----- .../krb5/internal/crypto/dk/ArcFourCrypto.java | 13 +++---------- 3 files changed, 9 insertions(+), 22 deletions(-) diff --git a/src/java.security.jgss/share/classes/sun/net/www/protocol/http/spnego/NegotiatorImpl.java b/src/java.security.jgss/share/classes/sun/net/www/protocol/http/spnego/NegotiatorImpl.java index 82f2391816b..aa5795448c9 100644 --- a/src/java.security.jgss/share/classes/sun/net/www/protocol/http/spnego/NegotiatorImpl.java +++ b/src/java.security.jgss/share/classes/sun/net/www/protocol/http/spnego/NegotiatorImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2022, 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 @@ -127,9 +127,7 @@ public class NegotiatorImpl extends Negotiator { "fallback to other scheme if allowed. Reason:"); e.printStackTrace(); } - IOException ioe = new IOException("Negotiate support not initiated"); - ioe.initCause(e); - throw ioe; + throw new IOException("Negotiate support not initiated", e); } } @@ -157,9 +155,7 @@ public class NegotiatorImpl extends Negotiator { System.out.println("Negotiate support cannot continue. Reason:"); e.printStackTrace(); } - IOException ioe = new IOException("Negotiate support cannot continue"); - ioe.initCause(e); - throw ioe; + throw new IOException("Negotiate support cannot continue", e); } } } diff --git a/src/java.security.jgss/share/classes/sun/security/krb5/internal/KRBError.java b/src/java.security.jgss/share/classes/sun/security/krb5/internal/KRBError.java index 93505216090..206bbfc46f5 100644 --- a/src/java.security.jgss/share/classes/sun/security/krb5/internal/KRBError.java +++ b/src/java.security.jgss/share/classes/sun/security/krb5/internal/KRBError.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2022, 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 @@ -234,10 +234,8 @@ public class KRBError implements java.io.Serializable { System.out.println("Unable to parse eData field of KRB-ERROR:\n" + new sun.security.util.HexDumpEncoder().encodeBuffer(data)); } - IOException ioe = new IOException( - "Unable to parse eData field of KRB-ERROR"); - ioe.initCause(e); - throw ioe; + throw new IOException( + "Unable to parse eData field of KRB-ERROR", e); } } else { if (DEBUG) { diff --git a/src/java.security.jgss/share/classes/sun/security/krb5/internal/crypto/dk/ArcFourCrypto.java b/src/java.security.jgss/share/classes/sun/security/krb5/internal/crypto/dk/ArcFourCrypto.java index cb9912df6c2..a8bda6008f6 100644 --- a/src/java.security.jgss/share/classes/sun/security/krb5/internal/crypto/dk/ArcFourCrypto.java +++ b/src/java.security.jgss/share/classes/sun/security/krb5/internal/crypto/dk/ArcFourCrypto.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2008, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -29,7 +29,6 @@ import java.security.*; import javax.crypto.*; import javax.crypto.spec.*; import java.util.*; -import sun.security.krb5.EncryptedData; import sun.security.krb5.KrbCryptoException; import sun.security.krb5.Confounder; import sun.security.krb5.internal.crypto.KeyUsage; @@ -159,10 +158,7 @@ public class ArcFourCrypto extends DkCrypto { System.arraycopy(ss, 0, new_ss, 0, ss.length); Ksign = getHmac(baseKey, new_ss); } catch (Exception e) { - GeneralSecurityException gse = - new GeneralSecurityException("Calculate Checkum Failed!"); - gse.initCause(e); - throw gse; + throw new GeneralSecurityException("Calculate Checksum Failed!", e); } // get the salt using key usage @@ -173,10 +169,7 @@ public class ArcFourCrypto extends DkCrypto { try { messageDigest = MessageDigest.getInstance("MD5"); } catch (NoSuchAlgorithmException e) { - GeneralSecurityException gse = - new GeneralSecurityException("Calculate Checkum Failed!"); - gse.initCause(e); - throw gse; + throw new GeneralSecurityException("Calculate Checksum Failed!", e); } messageDigest.update(salt); messageDigest.update(input, start, len); -- GitLab From cde923dd471a22cd69ea2cd4994bb16eba780804 Mon Sep 17 00:00:00 2001 From: Ioi Lam Date: Tue, 8 Mar 2022 00:19:07 +0000 Subject: [PATCH 178/340] 8282690: runtime/CommandLine/VMDeprecatedOptions.java fails after JDK-8281181 Reviewed-by: dholmes, dcubed --- test/hotspot/jtreg/ProblemList.txt | 1 - .../jtreg/runtime/CommandLine/VMDeprecatedOptions.java | 8 ++++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/test/hotspot/jtreg/ProblemList.txt b/test/hotspot/jtreg/ProblemList.txt index 5f007410904..518238d9c0a 100644 --- a/test/hotspot/jtreg/ProblemList.txt +++ b/test/hotspot/jtreg/ProblemList.txt @@ -102,7 +102,6 @@ runtime/os/TestTracePageSizes.java#compiler-options 8267460 linux-aarch64 runtime/os/TestTracePageSizes.java#G1 8267460 linux-aarch64 runtime/os/TestTracePageSizes.java#Parallel 8267460 linux-aarch64 runtime/os/TestTracePageSizes.java#Serial 8267460 linux-aarch64 -runtime/CommandLine/VMDeprecatedOptions.java 8282690 generic-all runtime/ErrorHandling/CreateCoredumpOnCrash.java 8267433 macosx-x64 applications/jcstress/copy.java 8229852 linux-all diff --git a/test/hotspot/jtreg/runtime/CommandLine/VMDeprecatedOptions.java b/test/hotspot/jtreg/runtime/CommandLine/VMDeprecatedOptions.java index 164aaa4d9a0..ee93c740cf1 100644 --- a/test/hotspot/jtreg/runtime/CommandLine/VMDeprecatedOptions.java +++ b/test/hotspot/jtreg/runtime/CommandLine/VMDeprecatedOptions.java @@ -45,6 +45,8 @@ public class VMDeprecatedOptions { */ public static final String[][] DEPRECATED_OPTIONS; static { + // Use an ArrayList so platform-specific flags can be + // optionally added. ArrayList deprecated = new ArrayList( Arrays.asList(new String[][] { // deprecated non-alias flags: @@ -54,14 +56,16 @@ public class VMDeprecatedOptions { {"InitialRAMFraction", "64"}, {"TLABStats", "false"}, {"AllowRedefinitionToAddDeleteMethods", "true"}, - {"UseContainerCpuShares", "false"}, - {"PreferContainerQuotaForCPUCount", "true"}, // deprecated alias flags (see also aliased_jvm_flags): {"DefaultMaxRAMFraction", "4"}, {"CreateMinidumpOnCrash", "false"} } )); + if (Platform.isLinux()) { + deprecated.add(new String[] {"UseContainerCpuShares", "false"}); + deprecated.add(new String[] {"PreferContainerQuotaForCPUCount", "true"}); + } DEPRECATED_OPTIONS = deprecated.toArray(new String[][]{}); }; -- GitLab From 3f0684d0b85662724af845a4ee6b97d9c5ceacbd Mon Sep 17 00:00:00 2001 From: Yi Yang Date: Tue, 8 Mar 2022 03:14:21 +0000 Subject: [PATCH 179/340] 8275775: Add jcmd VM.classes to print details of all classes Reviewed-by: dholmes, iklam, stuefe --- src/hotspot/share/oops/instanceKlass.cpp | 52 ++++++++++++++++++- src/hotspot/share/oops/instanceKlass.hpp | 10 ++++ src/hotspot/share/runtime/vmOperation.hpp | 1 + .../share/services/diagnosticCommand.cpp | 37 +++++++++++++ .../share/services/diagnosticCommand.hpp | 22 ++++++++ .../runtime/CommandLine/PrintClasses.java | 51 ++++++++++++++++++ 6 files changed, 172 insertions(+), 1 deletion(-) create mode 100644 test/hotspot/jtreg/runtime/CommandLine/PrintClasses.java diff --git a/src/hotspot/share/oops/instanceKlass.cpp b/src/hotspot/share/oops/instanceKlass.cpp index 5545732a1c1..e5dbd1f293e 100644 --- a/src/hotspot/share/oops/instanceKlass.cpp +++ b/src/hotspot/share/oops/instanceKlass.cpp @@ -2074,6 +2074,52 @@ Method* InstanceKlass::lookup_method_in_all_interfaces(Symbol* name, return NULL; } +PrintClassClosure::PrintClassClosure(outputStream* st, bool verbose) + :_st(st), _verbose(verbose) { + ResourceMark rm; + _st->print("%-18s ", "KlassAddr"); + _st->print("%-4s ", "Size"); + _st->print("%-20s ", "State"); + _st->print("%-7s ", "Flags"); + _st->print("%-5s ", "ClassName"); + _st->cr(); +} + +void PrintClassClosure::do_klass(Klass* k) { + ResourceMark rm; + // klass pointer + _st->print(INTPTR_FORMAT " ", p2i(k)); + // klass size + _st->print("%4d ", k->size()); + // initialization state + if (k->is_instance_klass()) { + _st->print("%-20s ",InstanceKlass::cast(k)->init_state_name()); + } else { + _st->print("%-20s ",""); + } + // misc flags(Changes should synced with ClassesDCmd::ClassesDCmd help doc) + char buf[10]; + int i = 0; + if (k->has_finalizer()) buf[i++] = 'F'; + if (k->has_final_method()) buf[i++] = 'f'; + if (k->is_instance_klass()) { + InstanceKlass* ik = InstanceKlass::cast(k); + if (ik->is_rewritten()) buf[i++] = 'W'; + if (ik->is_contended()) buf[i++] = 'C'; + if (ik->has_been_redefined()) buf[i++] = 'R'; + if (ik->is_shared()) buf[i++] = 'S'; + } + buf[i++] = '\0'; + _st->print("%-7s ", buf); + // klass name + _st->print("%-5s ", k->external_name()); + // end + _st->cr(); + if (_verbose) { + k->print_on(_st); + } +} + /* jni_id_for for jfieldIds only */ JNIid* InstanceKlass::jni_id_for(int offset) { MutexLocker ml(JfieldIdCreation_lock); @@ -3393,6 +3439,10 @@ static void print_vtable(vtableEntry* start, int len, outputStream* st) { return print_vtable(reinterpret_cast(start), len, st); } +const char* InstanceKlass::init_state_name() const { + return state_names[_init_state]; +} + void InstanceKlass::print_on(outputStream* st) const { assert(is_klass(), "must be klass"); Klass::print_on(st); @@ -3400,7 +3450,7 @@ void InstanceKlass::print_on(outputStream* st) const { st->print(BULLET"instance size: %d", size_helper()); st->cr(); st->print(BULLET"klass size: %d", size()); st->cr(); st->print(BULLET"access: "); access_flags().print_on(st); st->cr(); - st->print(BULLET"state: "); st->print_cr("%s", state_names[_init_state]); + st->print(BULLET"state: "); st->print_cr("%s", init_state_name()); st->print(BULLET"name: "); name()->print_value_on(st); st->cr(); st->print(BULLET"super: "); Metadata::print_value_on_maybe_null(st, super()); st->cr(); st->print(BULLET"sub: "); diff --git a/src/hotspot/share/oops/instanceKlass.hpp b/src/hotspot/share/oops/instanceKlass.hpp index 11f03cc149b..9ec3535e0dc 100644 --- a/src/hotspot/share/oops/instanceKlass.hpp +++ b/src/hotspot/share/oops/instanceKlass.hpp @@ -547,6 +547,7 @@ public: bool is_in_error_state() const { return _init_state == initialization_error; } bool is_reentrant_initialization(Thread *thread) { return thread == _init_thread; } ClassState init_state() { return (ClassState)_init_state; } + const char* init_state_name() const; bool is_rewritten() const { return (_misc_flags & _misc_rewritten) != 0; } // is this a sealed class @@ -1277,6 +1278,15 @@ inline u2 InstanceKlass::next_method_idnum() { } } +class PrintClassClosure : public KlassClosure { +private: + outputStream* _st; + bool _verbose; +public: + PrintClassClosure(outputStream* st, bool verbose); + + void do_klass(Klass* k); +}; /* JNIid class for jfieldIDs only */ class JNIid: public CHeapObj { diff --git a/src/hotspot/share/runtime/vmOperation.hpp b/src/hotspot/share/runtime/vmOperation.hpp index 5489770f386..e6e9f3f6457 100644 --- a/src/hotspot/share/runtime/vmOperation.hpp +++ b/src/hotspot/share/runtime/vmOperation.hpp @@ -95,6 +95,7 @@ template(CleanClassLoaderDataMetaspaces) \ template(PrintCompileQueue) \ template(PrintClassHierarchy) \ + template(PrintClasses) \ template(ICBufferFull) \ template(PrintMetadata) \ template(GTestExecuteAtSafepoint) \ diff --git a/src/hotspot/share/services/diagnosticCommand.cpp b/src/hotspot/share/services/diagnosticCommand.cpp index 06b9539a94d..725d8016134 100644 --- a/src/hotspot/share/services/diagnosticCommand.cpp +++ b/src/hotspot/share/services/diagnosticCommand.cpp @@ -26,6 +26,7 @@ #include "jvm.h" #include "classfile/classLoaderHierarchyDCmd.hpp" #include "classfile/classLoaderStats.hpp" +#include "classfile/classLoaderDataGraph.hpp" #include "classfile/javaClasses.hpp" #include "classfile/systemDictionary.hpp" #include "classfile/vmClasses.hpp" @@ -102,6 +103,7 @@ void DCmdRegistrant::register_dcmds(){ DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl(full_export, true, false)); DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl(full_export, true, false)); DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl(full_export, true, false)); + DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl(full_export, true, false)); DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl(full_export, true, false)); DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl(full_export, true, false)); DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl(full_export, true, false)); @@ -954,6 +956,41 @@ void TouchedMethodsDCmd::execute(DCmdSource source, TRAPS) { VMThread::execute(&dumper); } +ClassesDCmd::ClassesDCmd(outputStream* output, bool heap) : + DCmdWithParser(output, heap), + _verbose("-verbose", + "Dump the detailed content of a Java class. " + "Some classes are annotated with flags: " + "F = has, or inherits, a non-empty finalize method, " + "f = has final method, " + "W = methods rewritten, " + "C = marked with @Contended annotation, " + "R = has been redefined, " + "S = is shared class", + "BOOLEAN", false, "false") { + _dcmdparser.add_dcmd_option(&_verbose); +} + +class VM_PrintClasses : public VM_Operation { +private: + outputStream* _out; + bool _verbose; +public: + VM_PrintClasses(outputStream* out, bool verbose) : _out(out), _verbose(verbose) {} + + virtual VMOp_Type type() const { return VMOp_PrintClasses; } + + virtual void doit() { + PrintClassClosure closure(_out, _verbose); + ClassLoaderDataGraph::classes_do(&closure); + } +}; + +void ClassesDCmd::execute(DCmdSource source, TRAPS) { + VM_PrintClasses vmop(output(), _verbose.is_set()); + VMThread::execute(&vmop); +} + #if INCLUDE_CDS DumpSharedArchiveDCmd::DumpSharedArchiveDCmd(outputStream* output, bool heap) : DCmdWithParser(output, heap), diff --git a/src/hotspot/share/services/diagnosticCommand.hpp b/src/hotspot/share/services/diagnosticCommand.hpp index d276a3ca756..dfcdc783f88 100644 --- a/src/hotspot/share/services/diagnosticCommand.hpp +++ b/src/hotspot/share/services/diagnosticCommand.hpp @@ -858,6 +858,28 @@ public: virtual void execute(DCmdSource source, TRAPS); }; +class ClassesDCmd : public DCmdWithParser { +protected: + DCmdArgument _verbose; +public: + ClassesDCmd(outputStream* output, bool heap); + static const char* name() { + return "VM.classes"; + } + static const char* description() { + return "Print all loaded classes"; + } + static const char* impact() { + return "Medium: Depends on number of loaded classes."; + } + static const JavaPermission permission() { + JavaPermission p = {"java.lang.management.ManagementPermission", + "monitor", NULL}; + return p; + } + virtual void execute(DCmdSource source, TRAPS); +}; + #if INCLUDE_JVMTI class DebugOnCmdStartDCmd : public DCmd { public: diff --git a/test/hotspot/jtreg/runtime/CommandLine/PrintClasses.java b/test/hotspot/jtreg/runtime/CommandLine/PrintClasses.java new file mode 100644 index 00000000000..7c45e2ea02f --- /dev/null +++ b/test/hotspot/jtreg/runtime/CommandLine/PrintClasses.java @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2022, Alibaba Group Holding Limited. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + + +/* + * @test + * @bug 8275775 + * @summary Test jcmd VM.classes + * @library /test/lib + * @run main/othervm PrintClasses + */ + +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.JDKToolFinder; + +public class PrintClasses { + public static void main(String args[]) throws Exception { + var pid = Long.toString(ProcessHandle.current().pid()); + var pb = new ProcessBuilder(); + + pb.command(new String[] { JDKToolFinder.getJDKTool("jcmd"), pid, "VM.classes"}); + var output = new OutputAnalyzer(pb.start()); + output.shouldNotContain("instance size"); + output.shouldContain(PrintClasses.class.getSimpleName()); + + pb.command(new String[] { JDKToolFinder.getJDKTool("jcmd"), pid, "VM.classes", "-verbose"}); + output = new OutputAnalyzer(pb.start()); + output.shouldContain("instance size"); + output.shouldContain(PrintClasses.class.getSimpleName()); + } +} -- GitLab From 8b45dbdae6e5dee85ef65ce25850ce692ad3e965 Mon Sep 17 00:00:00 2001 From: Jamil Nimeh Date: Tue, 8 Mar 2022 05:50:41 +0000 Subject: [PATCH 180/340] 8282312: Minor corrections to evbroadcasti32x4 intrinsic on x86 Reviewed-by: dlong --- src/hotspot/cpu/x86/assembler_x86.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/hotspot/cpu/x86/assembler_x86.cpp b/src/hotspot/cpu/x86/assembler_x86.cpp index e9652fa04b2..be8c18b0710 100644 --- a/src/hotspot/cpu/x86/assembler_x86.cpp +++ b/src/hotspot/cpu/x86/assembler_x86.cpp @@ -9864,12 +9864,12 @@ void Assembler::vpbroadcastq(XMMRegister dst, Address src, int vector_len) { void Assembler::evbroadcasti32x4(XMMRegister dst, Address src, int vector_len) { assert(vector_len != Assembler::AVX_128bit, ""); - assert(VM_Version::supports_avx512dq(), ""); + assert(VM_Version::supports_evex(), ""); assert(dst != xnoreg, "sanity"); InstructionMark im(this); InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); attributes.set_rex_vex_w_reverted(); - attributes.set_address_attributes(/* tuple_type */ EVEX_T2, /* input_size_in_bits */ EVEX_64bit); + attributes.set_address_attributes(/* tuple_type */ EVEX_T4, /* input_size_in_bits */ EVEX_32bit); // swap src<->dst for encoding vex_prefix(src, 0, dst->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes); emit_int8(0x5A); -- GitLab From e607287204dbb551b75e82f4de64ea3cd0f47f24 Mon Sep 17 00:00:00 2001 From: Albert Mingkun Yang Date: Tue, 8 Mar 2022 08:24:10 +0000 Subject: [PATCH 181/340] 8282728: Serial: Remove unused BlockOffsetArray::Action Reviewed-by: tschatzl --- .../share/gc/shared/blockOffsetTable.cpp | 42 ++++--------------- .../share/gc/shared/blockOffsetTable.hpp | 10 +---- 2 files changed, 10 insertions(+), 42 deletions(-) diff --git a/src/hotspot/share/gc/shared/blockOffsetTable.cpp b/src/hotspot/share/gc/shared/blockOffsetTable.cpp index e350e70ad5f..2a4f3a48fa3 100644 --- a/src/hotspot/share/gc/shared/blockOffsetTable.cpp +++ b/src/hotspot/share/gc/shared/blockOffsetTable.cpp @@ -248,14 +248,10 @@ BlockOffsetArray::alloc_block(HeapWord* blk_start, HeapWord* blk_end) { single_block(blk_start, blk_end); } -// Action_mark - update the BOT for the block [blk_start, blk_end). -// Current typical use is for splitting a block. -// Action_single - udpate the BOT for an allocation. -// Action_verify - BOT verification. void BlockOffsetArray::do_block_internal(HeapWord* blk_start, HeapWord* blk_end, - Action action, bool reducing) { + bool reducing) { assert(_sp->is_in_reserved(blk_start), "reference must be into the space"); assert(_sp->is_in_reserved(blk_end-1), @@ -284,33 +280,13 @@ BlockOffsetArray::do_block_internal(HeapWord* blk_start, } assert(start_index <= end_index, "monotonicity of index_for()"); assert(boundary <= (HeapWord*)boundary_before_end, "tautology"); - switch (action) { - case Action_mark: { - if (init_to_zero()) { - _array->set_offset_array(start_index, boundary, blk_start, reducing); - break; - } // Else fall through to the next case - } - case Action_single: { - _array->set_offset_array(start_index, boundary, blk_start, reducing); - // We have finished marking the "offset card". We need to now - // mark the subsequent cards that this blk spans. - if (start_index < end_index) { - HeapWord* rem_st = _array->address_for_index(start_index) + BOTConstants::card_size_in_words(); - HeapWord* rem_end = _array->address_for_index(end_index) + BOTConstants::card_size_in_words(); - set_remainder_to_point_to_start(rem_st, rem_end, reducing); - } - break; - } - case Action_check: { - _array->check_offset_array(start_index, boundary, blk_start); - // We have finished checking the "offset card". We need to now - // check the subsequent cards that this blk spans. - check_all_cards(start_index + 1, end_index); - break; - } - default: - ShouldNotReachHere(); + _array->set_offset_array(start_index, boundary, blk_start, reducing); + // We have finished marking the "offset card". We need to now + // mark the subsequent cards that this blk spans. + if (start_index < end_index) { + HeapWord* rem_st = _array->address_for_index(start_index) + BOTConstants::card_size_in_words(); + HeapWord* rem_end = _array->address_for_index(end_index) + BOTConstants::card_size_in_words(); + set_remainder_to_point_to_start(rem_st, rem_end, reducing); } } } @@ -322,7 +298,7 @@ BlockOffsetArray::do_block_internal(HeapWord* blk_start, void BlockOffsetArray::single_block(HeapWord* blk_start, HeapWord* blk_end) { - do_block_internal(blk_start, blk_end, Action_single); + do_block_internal(blk_start, blk_end); } void BlockOffsetArray::verify() const { diff --git a/src/hotspot/share/gc/shared/blockOffsetTable.hpp b/src/hotspot/share/gc/shared/blockOffsetTable.hpp index 9a32594c123..6adc224876d 100644 --- a/src/hotspot/share/gc/shared/blockOffsetTable.hpp +++ b/src/hotspot/share/gc/shared/blockOffsetTable.hpp @@ -279,14 +279,6 @@ class Space; class BlockOffsetArray: public BlockOffsetTable { friend class VMStructs; protected: - // The following enums are used by do_block_internal() below - enum Action { - Action_single, // BOT records a single block (see single_block()) - Action_mark, // BOT marks the start of a block (see mark_block()) - Action_check // Check that BOT records block correctly - // (see verify_single_block()). - }; - // The shared array, which is shared with other BlockOffsetArray's // corresponding to different spaces within a generation or span of // memory. @@ -315,7 +307,7 @@ class BlockOffsetArray: public BlockOffsetTable { void set_remainder_to_point_to_start_incl(size_t start, size_t end, bool reducing = false); // A helper function for BOT adjustment/verification work - void do_block_internal(HeapWord* blk_start, HeapWord* blk_end, Action action, bool reducing = false); + void do_block_internal(HeapWord* blk_start, HeapWord* blk_end, bool reducing = false); public: // The space may not have its bottom and top set yet, which is why the -- GitLab From 65ca0a5776df229ee91f420585ca1e8f91e489c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20Gr=C3=B6nlund?= Date: Tue, 8 Mar 2022 09:28:46 +0000 Subject: [PATCH 182/340] 8276333: jdk/jfr/event/oldobject/TestLargeRootSet.java failed "assert(!contains(edge->reference())) failed: invariant" Reviewed-by: egahlin --- .../jfr/leakprofiler/chains/dfsClosure.cpp | 19 +++++++++---------- .../jfr/leakprofiler/chains/edgeStore.cpp | 15 +++++++++++++-- test/jdk/ProblemList.txt | 1 - 3 files changed, 22 insertions(+), 13 deletions(-) diff --git a/src/hotspot/share/jfr/leakprofiler/chains/dfsClosure.cpp b/src/hotspot/share/jfr/leakprofiler/chains/dfsClosure.cpp index 8161e172215..c6d368a9020 100644 --- a/src/hotspot/share/jfr/leakprofiler/chains/dfsClosure.cpp +++ b/src/hotspot/share/jfr/leakprofiler/chains/dfsClosure.cpp @@ -80,24 +80,23 @@ void DFSClosure::closure_impl(UnifiedOopRef reference, const oop pointee) { if (GranularTimer::is_finished()) { return; } + if (_depth == 0 && _ignore_root_set) { // Root set is already marked, but we want // to continue, so skip is_marked check. assert(_mark_bits->is_marked(pointee), "invariant"); - } else { + _reference_stack[_depth] = reference; + } else { if (_mark_bits->is_marked(pointee)) { return; } + _mark_bits->mark_obj(pointee); + _reference_stack[_depth] = reference; + // is the pointee a sample object? + if (pointee->mark().is_marked()) { + add_chain(); + } } - _reference_stack[_depth] = reference; - _mark_bits->mark_obj(pointee); - assert(_mark_bits->is_marked(pointee), "invariant"); - - // is the pointee a sample object? - if (pointee->mark().is_marked()) { - add_chain(); - } - assert(_max_depth >= 1, "invariant"); if (_depth < _max_depth - 1) { _depth++; diff --git a/src/hotspot/share/jfr/leakprofiler/chains/edgeStore.cpp b/src/hotspot/share/jfr/leakprofiler/chains/edgeStore.cpp index 8ba9409df56..c9bee7d1ab6 100644 --- a/src/hotspot/share/jfr/leakprofiler/chains/edgeStore.cpp +++ b/src/hotspot/share/jfr/leakprofiler/chains/edgeStore.cpp @@ -234,7 +234,15 @@ static int leak_context_edge_idx(const ObjectSample* sample) { } bool EdgeStore::has_leak_context(const ObjectSample* sample) const { - return leak_context_edge_idx(sample) != 0; + const int idx = leak_context_edge_idx(sample); + if (idx == 0) { + return false; + } + assert(idx > 0, "invariant"); + assert(_leak_context_edges != nullptr, "invariant"); + assert(idx < _leak_context_edges->length(), "invariant"); + assert(_leak_context_edges->at(idx) != nullptr, "invariant"); + return true; } const StoredEdge* EdgeStore::get(const ObjectSample* sample) const { @@ -243,7 +251,10 @@ const StoredEdge* EdgeStore::get(const ObjectSample* sample) const { assert(SafepointSynchronize::is_at_safepoint(), "invariant"); const int idx = leak_context_edge_idx(sample); if (idx > 0) { - return _leak_context_edges->at(idx); + assert(idx < _leak_context_edges->length(), "invariant"); + const StoredEdge* const edge =_leak_context_edges->at(idx); + assert(edge != nullptr, "invariant"); + return edge; } } return get(UnifiedOopRef::encode_in_native(sample->object_addr())); diff --git a/test/jdk/ProblemList.txt b/test/jdk/ProblemList.txt index 5bbb2e79340..fc1979b6ed6 100644 --- a/test/jdk/ProblemList.txt +++ b/test/jdk/ProblemList.txt @@ -826,7 +826,6 @@ jdk/jfr/event/compiler/TestCodeSweeper.java 8225209 generic- jdk/jfr/event/os/TestThreadContextSwitches.java 8247776 windows-all jdk/jfr/startupargs/TestStartName.java 8214685 windows-x64 jdk/jfr/startupargs/TestStartDuration.java 8214685 windows-x64 -jdk/jfr/event/oldobject/TestLargeRootSet.java 8276333 generic-x64 jdk/jfr/api/consumer/recordingstream/TestOnEvent.java 8255404 linux-x64 jdk/jfr/jvm/TestWaste.java 8282427 generic-all -- GitLab From 5fab27e1b8fdf2ea27cb3b349bd339a4a6ec828b Mon Sep 17 00:00:00 2001 From: Jim Laskey Date: Tue, 8 Mar 2022 13:25:34 +0000 Subject: [PATCH 183/340] 8282144: RandomSupport.convertSeedBytesToLongs sign extension overwrites previous bytes Reviewed-by: bpb --- .../internal/util/random/RandomSupport.java | 2 +- test/jdk/java/util/Random/T8282144.java | 71 +++++++++++++++++++ 2 files changed, 72 insertions(+), 1 deletion(-) create mode 100644 test/jdk/java/util/Random/T8282144.java diff --git a/src/java.base/share/classes/jdk/internal/util/random/RandomSupport.java b/src/java.base/share/classes/jdk/internal/util/random/RandomSupport.java index 1fc1eeff46a..24a73f734d3 100644 --- a/src/java.base/share/classes/jdk/internal/util/random/RandomSupport.java +++ b/src/java.base/share/classes/jdk/internal/util/random/RandomSupport.java @@ -265,7 +265,7 @@ public class RandomSupport { final int m = Math.min(seed.length, n << 3); // Distribute seed bytes into the words to be formed. for (int j = 0; j < m; j++) { - result[j>>3] = (result[j>>3] << 8) | seed[j]; + result[j>>3] = (result[j>>3] << 8) | (seed[j] & 0xFF); } // If there aren't enough seed bytes for all the words we need, // use a SplitMix-style PRNG to fill in the rest. diff --git a/test/jdk/java/util/Random/T8282144.java b/test/jdk/java/util/Random/T8282144.java new file mode 100644 index 00000000000..4a0218602f2 --- /dev/null +++ b/test/jdk/java/util/Random/T8282144.java @@ -0,0 +1,71 @@ +/* + * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.util.random.*; +import jdk.internal.util.random.RandomSupport; + +/** + * @test + * @summary RandomSupport.convertSeedBytesToLongs sign extension overwrites previous bytes. + * @bug 8282144 + * @modules java.base/jdk.internal.util.random + * @run main T8282144 + * @key randomness + */ + + +public class T8282144 { + public static void main(String[] args) { + RandomGenerator rng = RandomGeneratorFactory.of("L64X128MixRandom").create(42); + + for (int i = 1; i < 8; i++) { + byte[] seed = new byte[i]; + + for (int j = 0; j < 10; j++) { + rng.nextBytes(seed); + + long[] existing = RandomSupport.convertSeedBytesToLongs(seed, 1, 1); + long[] testing = convertSeedBytesToLongsFixed(seed, 1, 1); + + for (int k = 0; k < existing.length; k++) { + if (existing[k] != testing[k]) { + throw new RuntimeException("convertSeedBytesToLongs incorrect"); + } + } + } + } + } + + + public static long[] convertSeedBytesToLongsFixed(byte[] seed, int n, int z) { + final long[] result = new long[n]; + final int m = Math.min(seed.length, n << 3); + + // Distribute seed bytes into the words to be formed. + for (int j = 0; j < m; j++) { + result[j >> 3] = (result[j >> 3] << 8) | (seed[j] & 0xff); + } + + return result; + } +} -- GitLab From c6d743fb920e740c7b0aac0c0ef5bdc3d60252ad Mon Sep 17 00:00:00 2001 From: Magnus Ihse Bursie Date: Tue, 8 Mar 2022 13:57:59 +0000 Subject: [PATCH 184/340] 8282770: Set source date in jib profiles from buildId Reviewed-by: erikj --- make/conf/jib-profiles.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/make/conf/jib-profiles.js b/make/conf/jib-profiles.js index 5e4c5791859..137d7cc7bb2 100644 --- a/make/conf/jib-profiles.js +++ b/make/conf/jib-profiles.js @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2022, 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 @@ -258,7 +258,6 @@ var getJibProfilesCommon = function (input, data) { common.release_profile_base = { configure_args: [ "--enable-reproducible-build", - "--with-source-date=current", ], }; // Extra settings for debug profiles @@ -1447,6 +1446,14 @@ var versionArgs = function(input, common) { } else { args = concat(args, "--with-version-opt=" + common.build_id); } + var sourceDate + if (input.build_id_data && input.build_id_data.creationTime) { + sourceDate = Math.floor(Date.parse(input.build_id_data.creationTime)/1000); + } else { + sourceDate = "current"; + } + args = concat(args, "--with-source-date=" + sourceDate); + return args; } -- GitLab From 0f88fc180cd5abc60605a094efa3f3a54f67f7a0 Mon Sep 17 00:00:00 2001 From: Magnus Ihse Bursie Date: Tue, 8 Mar 2022 14:04:59 +0000 Subject: [PATCH 185/340] 8282769: BSD date cannot handle all ISO 8601 formats Reviewed-by: erikj --- make/autoconf/util.m4 | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/make/autoconf/util.m4 b/make/autoconf/util.m4 index 877165ab3a3..15f41abafda 100644 --- a/make/autoconf/util.m4 +++ b/make/autoconf/util.m4 @@ -1,5 +1,5 @@ # -# Copyright (c) 2011, 2021, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2011, 2022, 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 @@ -230,8 +230,6 @@ AC_DEFUN([UTIL_GET_MATCHING_VALUES], # Converts an ISO-8601 date/time string to a unix epoch timestamp. If no # suitable conversion method was found, an empty string is returned. # -# Sets the specified variable to the resulting list. -# # $1: result variable name # $2: input date/time string AC_DEFUN([UTIL_GET_EPOCH_TIMESTAMP], @@ -241,11 +239,11 @@ AC_DEFUN([UTIL_GET_EPOCH_TIMESTAMP], timestamp=$($DATE --utc --date=$2 +"%s" 2> /dev/null) else # BSD date - timestamp=$($DATE -u -j -f "%F %T" "$2" "+%s" 2> /dev/null) + timestamp=$($DATE -u -j -f "%FZ %TZ" "$2" "+%s" 2> /dev/null) if test "x$timestamp" = x; then - # Perhaps the time was missing - timestamp=$($DATE -u -j -f "%F %T" "$2 00:00:00" "+%s" 2> /dev/null) - # If this did not work, we give up and return the empty string + # BSD date cannot handle trailing milliseconds. + # Try again ignoring characters at end + timestamp=$($DATE -u -j -f "%Y-%m-%dT%H:%M:%S" "$2" "+%s" 2> /dev/null) fi fi $1=$timestamp -- GitLab From 0cbc4b85bf8ab2ccfb8762322098c4cc7996df7d Mon Sep 17 00:00:00 2001 From: Foivos Zakkak Date: Tue, 8 Mar 2022 15:35:55 +0000 Subject: [PATCH 186/340] 8281266: [JVMCI] MetaUtil.toInternalName() doesn't handle hidden classes correctly Reviewed-by: sgehwolf, dnsimon --- .../src/jdk/vm/ci/meta/MetaUtil.java | 52 ++++++++++++------- .../ci/runtime/test/TestResolvedJavaType.java | 15 +++--- 2 files changed, 41 insertions(+), 26 deletions(-) diff --git a/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/MetaUtil.java b/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/MetaUtil.java index 528bb34e059..54a55dc3122 100644 --- a/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/MetaUtil.java +++ b/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/MetaUtil.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2022, 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 @@ -27,6 +27,11 @@ package jdk.vm.ci.meta; */ public class MetaUtil { + public static final char PACKAGE_SEPARATOR_INTERNAL = '/'; + public static final char HIDDEN_SEPARATOR_INTERNAL = '.'; + public static final char PACKAGE_SEPARATOR_JAVA = HIDDEN_SEPARATOR_INTERNAL; + public static final char HIDDEN_SEPARATOR_JAVA = PACKAGE_SEPARATOR_INTERNAL; + /** * Extends the functionality of {@link Class#getSimpleName()} to include a non-empty string for * anonymous and local classes. @@ -87,25 +92,27 @@ public class MetaUtil { } /** - * Classes for lambdas can have {@code /} characters that are not package separators. These are - * distinguished by being followed by a character that is not a + * Hidden classes have {@code /} characters in their internal names and {@code .} characters in their names returned + * by {@link Class#getName()} that are not package separators. + * These are distinguished by being followed by a character that is not a * {@link Character#isJavaIdentifierStart(char)} (e.g., * "jdk.vm.ci.runtime.test.TypeUniverse$$Lambda$1/869601985"). + * + * @param name the name to perform the replacements on + * @param packageSeparator the {@link Character} used as the package separator, e.g. {@code /} in internal form + * @param hiddenSeparator the {@link Character} used as the hidden class separator, e.g. {@code .} in internal form */ - private static String replacePackageSeparatorsWithDot(String name) { + private static String replacePackageAndHiddenSeparators(String name, Character packageSeparator, Character hiddenSeparator) { + int index = name.indexOf(hiddenSeparator); // check if it's a hidden class int length = name.length(); - int i = 0; StringBuilder buf = new StringBuilder(length); - while (i < length - 1) { - char ch = name.charAt(i); - if (ch == '/' && Character.isJavaIdentifierStart(name.charAt(i + 1))) { - buf.append('.'); - } else { - buf.append(ch); - } - i++; + if (index < 0) { + buf.append(name.replace(packageSeparator, hiddenSeparator)); + } else { + buf.append(name.substring(0, index).replace(packageSeparator, hiddenSeparator)); + buf.append(packageSeparator); + buf.append(name.substring(index + 1)); } - buf.append(name.charAt(length - 1)); return buf.toString(); } @@ -122,9 +129,10 @@ public class MetaUtil { public static String internalNameToJava(String name, boolean qualified, boolean classForNameCompatible) { switch (name.charAt(0)) { case 'L': { - String result = replacePackageSeparatorsWithDot(name.substring(1, name.length() - 1)); + String type = name.substring(1, name.length() - 1); + String result = replacePackageAndHiddenSeparators(type, PACKAGE_SEPARATOR_INTERNAL, HIDDEN_SEPARATOR_INTERNAL); if (!qualified) { - final int lastDot = result.lastIndexOf('.'); + final int lastDot = result.lastIndexOf(HIDDEN_SEPARATOR_INTERNAL); if (lastDot != -1) { result = result.substring(lastDot + 1); } @@ -132,7 +140,11 @@ public class MetaUtil { return result; } case '[': - return classForNameCompatible ? replacePackageSeparatorsWithDot(name) : internalNameToJava(name.substring(1), qualified, classForNameCompatible) + "[]"; + if (classForNameCompatible) { + return replacePackageAndHiddenSeparators(name, PACKAGE_SEPARATOR_INTERNAL, HIDDEN_SEPARATOR_INTERNAL); + } else { + return internalNameToJava(name.substring(1), qualified, false) + "[]"; + } default: if (name.length() != 1) { throw new IllegalArgumentException("Illegal internal name: " + name); @@ -213,7 +225,7 @@ public class MetaUtil { public static String toInternalName(String className) { if (className.startsWith("[")) { /* Already in the correct array style. */ - return className.replace('.', '/'); + return replacePackageAndHiddenSeparators(className, PACKAGE_SEPARATOR_JAVA, HIDDEN_SEPARATOR_JAVA); } StringBuilder result = new StringBuilder(); @@ -252,7 +264,9 @@ public class MetaUtil { result.append("V"); break; default: - result.append("L").append(base.replace('.', '/')).append(";"); + result.append("L") + .append(replacePackageAndHiddenSeparators(base, PACKAGE_SEPARATOR_JAVA, HIDDEN_SEPARATOR_JAVA)) + .append(";"); break; } return result.toString(); diff --git a/test/hotspot/jtreg/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestResolvedJavaType.java b/test/hotspot/jtreg/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestResolvedJavaType.java index ec7a7b3bd70..d186e5ea710 100644 --- a/test/hotspot/jtreg/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestResolvedJavaType.java +++ b/test/hotspot/jtreg/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestResolvedJavaType.java @@ -42,6 +42,8 @@ import static java.lang.reflect.Modifier.isPrivate; import static java.lang.reflect.Modifier.isProtected; import static java.lang.reflect.Modifier.isPublic; import static java.lang.reflect.Modifier.isStatic; +import static jdk.vm.ci.meta.MetaUtil.internalNameToJava; +import static jdk.vm.ci.meta.MetaUtil.toInternalName; import static org.junit.Assert.assertArrayEquals; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; @@ -163,16 +165,15 @@ public class TestResolvedJavaType extends TypeUniverse { } @Test - public void internalNameTest() { - // Verify that the last slash in lambda types are not replaced with a '.' as they - // are part of the type name. + public void lambdaInternalNameTest() { + // Verify that the last dot in lambda types is properly handled when transitioning from internal name to java + // name and vice versa. Supplier lambda = () -> () -> System.out.println("run"); ResolvedJavaType lambdaType = metaAccess.lookupJavaType(lambda.getClass()); String typeName = lambdaType.getName(); - int typeNameLen = TestResolvedJavaType.class.getSimpleName().length(); - int index = typeName.indexOf(TestResolvedJavaType.class.getSimpleName()); - String suffix = typeName.substring(index + typeNameLen, typeName.length() - 1); - assertEquals(TestResolvedJavaType.class.getName() + suffix, lambdaType.toJavaName()); + String javaName = lambda.getClass().getName(); + assertEquals(typeName, toInternalName(javaName)); + assertEquals(javaName, internalNameToJava(typeName, true, true)); } @Test -- GitLab From 3e4dfc63e75db7e8ccbb21a831d8d86fb7c1ac4e Mon Sep 17 00:00:00 2001 From: Coleen Phillimore Date: Tue, 8 Mar 2022 16:10:26 +0000 Subject: [PATCH 187/340] 8282295: SymbolPropertyEntry::set_method_type fails with assert Reviewed-by: hseigel --- src/hotspot/share/memory/universe.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/hotspot/share/memory/universe.cpp b/src/hotspot/share/memory/universe.cpp index ca68e601cf4..ef244b66912 100644 --- a/src/hotspot/share/memory/universe.cpp +++ b/src/hotspot/share/memory/universe.cpp @@ -1248,6 +1248,7 @@ bool Universe::release_fullgc_alot_dummy() { if (_fullgc_alot_dummy_next >= fullgc_alot_dummy_array->length()) { // No more dummies to release, release entire array instead _fullgc_alot_dummy_array.release(Universe::vm_global()); + _fullgc_alot_dummy_array = OopHandle(); // NULL out OopStorage pointer. return false; } -- GitLab From 2549e5503806447733572643603af9a2bf4b52e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Jeli=C5=84ski?= Date: Tue, 8 Mar 2022 16:15:24 +0000 Subject: [PATCH 188/340] 8275640: (win) java.net.NetworkInterface issues with IPv6-only environments Reviewed-by: msheppar, dfuchs --- .../windows/native/libnet/NetworkInterface.c | 34 ++++++++------ .../native/libnet/NetworkInterface_winXP.c | 47 +++++++++++-------- 2 files changed, 48 insertions(+), 33 deletions(-) diff --git a/src/java.base/windows/native/libnet/NetworkInterface.c b/src/java.base/windows/native/libnet/NetworkInterface.c index c2f604b24de..2bad69e1655 100644 --- a/src/java.base/windows/native/libnet/NetworkInterface.c +++ b/src/java.base/windows/native/libnet/NetworkInterface.c @@ -176,6 +176,8 @@ int enumInterfaces(JNIEnv *env, netif **netifPP) DWORD i; int lo=0, eth=0, tr=0, fddi=0, ppp=0, sl=0, wlan=0, net=0, wlen=0; + *netifPP = NULL; + /* * Ask the IP Helper library to enumerate the adapters */ @@ -213,9 +215,7 @@ int enumInterfaces(JNIEnv *env, netif **netifPP) "IP Helper Library GetIfTable function failed"); break; } - // this different error code is to handle the case when we call - // GetIpAddrTable in pure IPv6 environment - return -2; + return -1; } /* @@ -373,6 +373,9 @@ int lookupIPAddrTable(JNIEnv *env, MIB_IPADDRTABLE **tablePP) MIB_IPADDRTABLE *tableP; ULONG size; DWORD ret; + + *tablePP = NULL; + /* * Use GetIpAddrTable to enumerate the IP Addresses */ @@ -434,12 +437,15 @@ int enumAddresses_win_ipaddrtable(JNIEnv *env, netif *netifP, netaddr **netaddrP int count = 0; unsigned long mask; + *netaddrPP = NULL; + /* * Iterate through the table to find the addresses with the * matching dwIndex. Ignore 0.0.0.0 addresses. */ - if (tableP == NULL) + if (tableP == NULL) { return 0; + } count = 0; netaddrP = NULL; @@ -452,7 +458,6 @@ int enumAddresses_win_ipaddrtable(JNIEnv *env, netif *netifP, netaddr **netaddrP if (curr == NULL) { JNU_ThrowOutOfMemoryError(env, "Native heap allocation failure"); free_netaddr(netaddrP); - free(tableP); return -1; } @@ -518,9 +523,12 @@ int enumAddresses_win_ipaddrtable(JNIEnv *env, netif *netifP, netaddr **netaddrP int enumAddresses_win(JNIEnv *env, netif *netifP, netaddr **netaddrPP) { MIB_IPADDRTABLE *tableP; int count; + + *netaddrPP = NULL; + int ret = lookupIPAddrTable(env, &tableP); if (ret < 0) { - return NULL; + return ret; } count = enumAddresses_win_ipaddrtable(env, netifP, netaddrPP, tableP); free(tableP); @@ -850,9 +858,7 @@ JNIEXPORT jboolean JNICALL Java_java_net_NetworkInterface_boundInetAddress0 break; } } - } - if (tableP != NULL) { - free(tableP); + free(tableP); } return found; } else { @@ -922,16 +928,16 @@ JNIEXPORT jobject JNICALL Java_java_net_NetworkInterface_getByInetAddress0 /* createNetworkInterface will free addrList */ netifObj = createNetworkInterface(env, curr, count, addrList); break; + } else { + free_netaddr(addrList); } /* on next interface */ curr = curr->next; } - } - - /* release the IP address table */ - if (tableP != NULL) + /* release the IP address table */ free(tableP); + } /* release the interface list */ free_netif(ifList); @@ -948,7 +954,7 @@ JNIEXPORT jobjectArray JNICALL Java_java_net_NetworkInterface_getAll (JNIEnv *env, jclass cls) { int count; - netif *ifList = NULL, *curr; + netif *ifList, *curr; jobjectArray netIFArr; jint arr_index; diff --git a/src/java.base/windows/native/libnet/NetworkInterface_winXP.c b/src/java.base/windows/native/libnet/NetworkInterface_winXP.c index 6483cd9eb80..08b6acf751a 100644 --- a/src/java.base/windows/native/libnet/NetworkInterface_winXP.c +++ b/src/java.base/windows/native/libnet/NetworkInterface_winXP.c @@ -79,6 +79,8 @@ int getAdapters (JNIEnv *env, int flags, IP_ADAPTER_ADDRESSES **adapters) { ULONG len; int try; + *adapters = NULL; + adapterInfo = (IP_ADAPTER_ADDRESSES *) malloc(BUFF_SIZE); if (adapterInfo == NULL) { JNU_ThrowByName(env, "java/lang/OutOfMemoryError", @@ -233,8 +235,6 @@ IP_ADAPTER_ADDRESSES *getAdapter (JNIEnv *env, jint index) { return ret; } -static int ipinflen = 2048; - /* */ int getAllInterfacesAndAddresses (JNIEnv *env, netif **netifPP) @@ -242,23 +242,18 @@ int getAllInterfacesAndAddresses (JNIEnv *env, netif **netifPP) int ret, flags; MIB_IPADDRTABLE *tableP; IP_ADAPTER_ADDRESSES *ptr, *adapters=NULL; - ULONG len=ipinflen, count=0; + ULONG count=0; netif *nif=NULL, *dup_nif, *last=NULL, *loopif=NULL, *curr; int tun=0, net=0; - *netifPP = NULL; /* * Get the IPv4 interfaces. This information is the same * as what previous JDK versions would return. */ ret = enumInterfaces(env, netifPP); - if (ret == -1) { + if (ret < 0) { return -1; - } else if( ret == -2){ - if ((*env)->ExceptionCheck(env)) { - (*env)->ExceptionClear(env); - } } else { count = ret; } @@ -274,20 +269,23 @@ int getAllInterfacesAndAddresses (JNIEnv *env, netif **netifPP) // Retrieve IPv4 addresses with the IP Helper API curr = *netifPP; ret = lookupIPAddrTable(env, &tableP); - if (ret < 0) { + if (ret == -1) { + free_netif(*netifPP); return -1; + } else if (ret == -2) { + // Clear the exception and continue. + if ((*env)->ExceptionCheck(env)) { + (*env)->ExceptionClear(env); + } + tableP = NULL; } while (curr != NULL) { netaddr *netaddrP; ret = enumAddresses_win_ipaddrtable(env, curr, &netaddrP, tableP); - if (ret == -1) { + if (ret < 0) { + free_netif(*netifPP); free(tableP); return -1; - } else if (ret == -2) { - if ((*env)->ExceptionCheck(env)) { - (*env)->ExceptionClear(env); - } - break; } else{ curr->addrs = netaddrP; curr->naddrs += ret; @@ -301,7 +299,8 @@ int getAllInterfacesAndAddresses (JNIEnv *env, netif **netifPP) flags |= GAA_FLAG_INCLUDE_PREFIX; ret = getAdapters (env, flags, &adapters); if (ret != ERROR_SUCCESS) { - goto err; + free_netif(*netifPP); + return -1; } /* Now get the IPv6 information. This includes: @@ -340,6 +339,9 @@ int getAllInterfacesAndAddresses (JNIEnv *env, netif **netifPP) */ nif->ipv6Index = ptr->Ipv6IfIndex; c = getAddrsFromAdapter(ptr, &nif->addrs); + if (c == -1) { + goto err; + } nif->naddrs += c; break; } @@ -378,6 +380,7 @@ int getAllInterfacesAndAddresses (JNIEnv *env, netif **netifPP) nif->name = malloc (strlen(newname)+1); nif->displayName = malloc (wcslen(ptr->FriendlyName)*2+2); if (nif->name == 0 || nif->displayName == 0) { + free(nif); goto err; } strcpy (nif->name, newname); @@ -390,7 +393,11 @@ int getAllInterfacesAndAddresses (JNIEnv *env, netif **netifPP) nif->ipv6Index = ptr->Ipv6IfIndex; nif->hasIpv6Address = TRUE; - last->next = nif; + if (last) { + last->next = nif; + } else { + *netifPP = nif; + } last = nif; count++; c = getAddrsFromAdapter(ptr, &nif->addrs); @@ -585,6 +592,8 @@ static jobject createNetworkInterfaceXP(JNIEnv *env, netif *ifs) if ((*env)->ExceptionCheck(env)) { (*env)->ExceptionClear(env); } + netaddrCount = 0; + netaddrPToFree = NULL; } netaddrP = netaddrPToFree; } @@ -826,7 +835,7 @@ JNIEXPORT jobjectArray JNICALL Java_java_net_NetworkInterface_getAll_XP (JNIEnv *env, jclass cls) { int count; - netif *ifList = NULL, *curr; + netif *ifList, *curr; jobjectArray netIFArr; jint arr_index; -- GitLab From 3fc009be8a49f9edb8059d8612ef6ed7f048f242 Mon Sep 17 00:00:00 2001 From: Ian Graves Date: Tue, 8 Mar 2022 16:32:18 +0000 Subject: [PATCH 189/340] 8281560: Matcher.hitEnd returns unexpected results in presence of CANON_EQ flag. Reviewed-by: rriggs, lancea --- .../classes/java/util/regex/Pattern.java | 3 ++- test/jdk/java/util/regex/RegExTest.java | 26 ++++++++++++++++++- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/src/java.base/share/classes/java/util/regex/Pattern.java b/src/java.base/share/classes/java/util/regex/Pattern.java index f5d4c965b25..5bb6ec76a7c 100644 --- a/src/java.base/share/classes/java/util/regex/Pattern.java +++ b/src/java.base/share/classes/java/util/regex/Pattern.java @@ -4005,8 +4005,9 @@ loop: for(int x=0, offset=0; x results1 = new ArrayList<>(); + ArrayList results2 = new ArrayList<>(); + + while (matcher1.find()) { + results1.add(matcher1.hitEnd()); + } + + while (matcher2.find()) { + results2.add(matcher2.hitEnd()); + } + + assertEquals(results1, results2); + } + //This test is for 8281315 @Test public static void iOOBForCIBackrefs(){ String line = "\ud83d\udc95\ud83d\udc95\ud83d\udc95"; var pattern2 = Pattern.compile("(?i)(.)\\1{2,}"); assertTrue(pattern2.matcher(line).find()); - } } + -- GitLab From 6b34884b34c4d84a1b5cfa3556a188415a42b1de Mon Sep 17 00:00:00 2001 From: Manukumar V S Date: Tue, 8 Mar 2022 17:01:03 +0000 Subject: [PATCH 190/340] 8282234: Create a regression test for JDK-4532513 Reviewed-by: aivanov --- .../DefaultCaretRequestsFocusTest.java | 193 ++++++++++++++++++ 1 file changed, 193 insertions(+) create mode 100644 test/jdk/javax/swing/JTextField/4532513/DefaultCaretRequestsFocusTest.java diff --git a/test/jdk/javax/swing/JTextField/4532513/DefaultCaretRequestsFocusTest.java b/test/jdk/javax/swing/JTextField/4532513/DefaultCaretRequestsFocusTest.java new file mode 100644 index 00000000000..b2fec6d9f94 --- /dev/null +++ b/test/jdk/javax/swing/JTextField/4532513/DefaultCaretRequestsFocusTest.java @@ -0,0 +1,193 @@ +/* + * Copyright (c) 2002, 2022, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.GridLayout; +import java.awt.Point; +import java.awt.Robot; +import java.awt.event.InputEvent; +import java.awt.event.KeyEvent; +import java.util.Arrays; +import java.util.List; +import java.util.concurrent.atomic.AtomicBoolean; +import java.util.concurrent.atomic.AtomicReference; +import java.util.stream.Collectors; +import javax.swing.InputVerifier; +import javax.swing.JComponent; +import javax.swing.JFrame; +import javax.swing.JPanel; +import javax.swing.JTextField; +import javax.swing.SwingUtilities; +import javax.swing.UIManager; +import javax.swing.UIManager.LookAndFeelInfo; +import javax.swing.UnsupportedLookAndFeelException; + +import static javax.swing.UIManager.getInstalledLookAndFeels; + +/* + * @test + * @key headful + * @bug 4532513 + * @summary Verifies that DefaultCaret doesn't requests focus in mouseClick and mousePressed + * causing the associated input verifier to fire twice. + * @run main DefaultCaretRequestsFocusTest + */ +public class DefaultCaretRequestsFocusTest { + + private static JTextField jTextField1; + private static JTextField jTextField2; + private static JTextField jTextField3; + private static JFrame frame; + private static Robot robot; + private static volatile int shouldYieldFocusCount; + + public static void main(String[] args) throws Exception { + runTest(); + } + + public static void runTest() throws Exception { + robot = new Robot(); + robot.setAutoWaitForIdle(true); + robot.setAutoDelay(200); + + List lafs = Arrays.stream(getInstalledLookAndFeels()) + .map(LookAndFeelInfo::getClassName) + .collect(Collectors.toList()); + for (final String laf : lafs) { + try { + AtomicBoolean lafSetSuccess = new AtomicBoolean(false); + SwingUtilities.invokeAndWait(() -> { + lafSetSuccess.set(setLookAndFeel(laf)); + if (lafSetSuccess.get()) { + createUI(); + } + }); + if (!lafSetSuccess.get()) { + continue; + } + robot.waitForIdle(); + + AtomicReference jTextField1LocRef = new AtomicReference<>(); + AtomicReference jTextField2LocRef = new AtomicReference<>(); + SwingUtilities.invokeAndWait(() -> { + jTextField1LocRef.set(jTextField1.getLocationOnScreen()); + jTextField2LocRef.set(jTextField2.getLocationOnScreen()); + }); + final Point jTextField1Loc = jTextField1LocRef.get(); + final Point jTextField2Loc = jTextField2LocRef.get(); + + shouldYieldFocusCount = 0; + + // Click on TextField2 + robot.mouseMove(jTextField2Loc.x + 5, jTextField2Loc.y + 5); + robot.mousePress(InputEvent.BUTTON1_DOWN_MASK); + robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); + + typeSomeText(); + + // Click on TextField1 + robot.mouseMove(jTextField1Loc.x + 5, jTextField1Loc.y + 5); + robot.mousePress(InputEvent.BUTTON1_DOWN_MASK); + robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); + + typeSomeText(); + + if (shouldYieldFocusCount == 1) { + System.out.println("Test passed for " + laf); + } else { + throw new RuntimeException("Test failed for " + laf + + " as InputVerifier.shouldYieldFocus() was called " + shouldYieldFocusCount + + " times on jTextField2, but it is expected to be called only once."); + } + + } finally { + SwingUtilities.invokeAndWait(DefaultCaretRequestsFocusTest::disposeFrame); + } + } + } + + private static void typeSomeText() { + robot.keyPress(KeyEvent.VK_T); + robot.keyRelease(KeyEvent.VK_T); + robot.keyPress(KeyEvent.VK_E); + robot.keyRelease(KeyEvent.VK_E); + robot.keyPress(KeyEvent.VK_X); + robot.keyRelease(KeyEvent.VK_X); + robot.keyPress(KeyEvent.VK_T); + robot.keyRelease(KeyEvent.VK_T); + } + + private static void createUI() { + frame = new JFrame(); + jTextField1 = new JTextField(6); + jTextField2 = new JTextField(6); + jTextField3 = new JTextField(6); + JPanel panel = new JPanel(); + panel.setLayout(new GridLayout(3, 1)); + panel.add(jTextField1); + panel.add(jTextField2); + panel.add(jTextField3); + + InputVerifier iv = new InputVerifier() { + public boolean verify(JComponent input) { + System.out.println("InputVerifier.verify() called"); + return false; + } + + public boolean shouldYieldFocus(JComponent input) { + ++shouldYieldFocusCount; + System.out.println("InputVerifier.shouldYieldFocus() called " + shouldYieldFocusCount); + return false; + } + }; + + jTextField2.setInputVerifier(iv); + + frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); + frame.add(panel); + frame.pack(); + frame.setAlwaysOnTop(true); + frame.setLocationRelativeTo(null); + frame.setVisible(true); + } + + private static boolean setLookAndFeel(String lafName) { + try { + UIManager.setLookAndFeel(lafName); + } catch (UnsupportedLookAndFeelException ignored) { + System.out.println("Ignoring Unsupported laf : " + lafName); + return false; + } catch (ClassNotFoundException | InstantiationException + | IllegalAccessException e) { + throw new RuntimeException(e); + } + return true; + } + + private static void disposeFrame() { + if (frame != null) { + frame.dispose(); + frame = null; + } + } + +} -- GitLab From 288d1afc5a2d5ac128b1b427bc877b7815925917 Mon Sep 17 00:00:00 2001 From: Xin Liu Date: Tue, 8 Mar 2022 17:33:15 +0000 Subject: [PATCH 191/340] 8282715: typo compileony in test Test8005033.java Reviewed-by: jiefu, dholmes, thartmann --- test/hotspot/jtreg/compiler/codegen/Test8005033.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/hotspot/jtreg/compiler/codegen/Test8005033.java b/test/hotspot/jtreg/compiler/codegen/Test8005033.java index 84630ad01da..d96983537d9 100644 --- a/test/hotspot/jtreg/compiler/codegen/Test8005033.java +++ b/test/hotspot/jtreg/compiler/codegen/Test8005033.java @@ -1,5 +1,6 @@ /* * Copyright (c) 2012 SAP SE. All rights reserved. + * Copyright Amazon.com Inc. 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 @@ -27,7 +28,7 @@ * @summary On sparcv9, C2's intrinsic for Integer.bitCount(OV) returns wrong result if OV is the result of an operation with int overflow. * * @run main/othervm -Xcomp - * -XX:CompileCommand=compileony,compiler.codegen.Test8005033::testBitCount + * -XX:CompileCommand=compileonly,compiler.codegen.Test8005033::testBitCount * compiler.codegen.Test8005033 * @author Richard Reingruber richard DOT reingruber AT sap DOT com */ -- GitLab From 72e987e3b49b81f2f66d125c18ab459d9ed572b6 Mon Sep 17 00:00:00 2001 From: Sean Mullan Date: Tue, 8 Mar 2022 18:18:57 +0000 Subject: [PATCH 192/340] 7192189: Support endpoint identification algorithm in RFC 6125 Reviewed-by: xuelei, rhalade --- .../sun/security/util/HostnameChecker.java | 41 ++---------------- .../NullHostnameCheck.java | 0 .../TestHostnameChecker.java | 31 ++++++++++--- .../cert1.crt | Bin .../cert2.crt | Bin .../cert3.crt | Bin .../cert4.crt | Bin .../cert5.crt | 0 8 files changed, 29 insertions(+), 43 deletions(-) rename test/jdk/sun/security/util/{HostnameMatcher => HostnameChecker}/NullHostnameCheck.java (100%) rename test/jdk/sun/security/util/{HostnameMatcher => HostnameChecker}/TestHostnameChecker.java (88%) rename test/jdk/sun/security/util/{HostnameMatcher => HostnameChecker}/cert1.crt (100%) rename test/jdk/sun/security/util/{HostnameMatcher => HostnameChecker}/cert2.crt (100%) rename test/jdk/sun/security/util/{HostnameMatcher => HostnameChecker}/cert3.crt (100%) rename test/jdk/sun/security/util/{HostnameMatcher => HostnameChecker}/cert4.crt (100%) rename test/jdk/sun/security/util/{HostnameMatcher => HostnameChecker}/cert5.crt (100%) diff --git a/src/java.base/share/classes/sun/security/util/HostnameChecker.java b/src/java.base/share/classes/sun/security/util/HostnameChecker.java index aacd94837c9..4c0bca36830 100644 --- a/src/java.base/share/classes/sun/security/util/HostnameChecker.java +++ b/src/java.base/share/classes/sun/security/util/HostnameChecker.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2022, 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 @@ -178,7 +178,7 @@ public class HostnameChecker { * Certification Authorities are encouraged to use the dNSName instead. * * Matching is performed using the matching rules specified by - * [RFC5280]. If more than one identity of a given type is present in + * [RFC6125]. If more than one identity of a given type is present in * the certificate (e.g., more than one dNSName name, a match in any one * of the set is considered acceptable.) */ @@ -262,7 +262,7 @@ public class HostnameChecker { /** * Returns true if name matches against template.

    * - * The matching is performed as per RFC 2818 rules for TLS and + * The matching is performed as per RFC 2818/6125 rules for TLS and * RFC 2830 rules for LDAP.

    * * The name parameter should represent a DNS name. The @@ -299,9 +299,7 @@ public class HostnameChecker { return false; } - if (checkType == TYPE_TLS) { - return matchAllWildcards(name, template); - } else if (checkType == TYPE_LDAP) { + if (checkType == TYPE_TLS || checkType == TYPE_LDAP) { return matchLeftmostWildcard(name, template); } else { return false; @@ -371,37 +369,6 @@ public class HostnameChecker { return false; } - /** - * Returns true if name matches against template.

    - * - * According to RFC 2818, section 3.1 - - * Names may contain the wildcard character * which is - * considered to match any single domain name component - * or component fragment. - * E.g., *.a.com matches foo.a.com but not - * bar.foo.a.com. f*.com matches foo.com but not bar.com. - */ - private static boolean matchAllWildcards(String name, - String template) { - name = name.toLowerCase(Locale.ENGLISH); - template = template.toLowerCase(Locale.ENGLISH); - StringTokenizer nameSt = new StringTokenizer(name, "."); - StringTokenizer templateSt = new StringTokenizer(template, "."); - - if (nameSt.countTokens() != templateSt.countTokens()) { - return false; - } - - while (nameSt.hasMoreTokens()) { - if (!matchWildCards(nameSt.nextToken(), - templateSt.nextToken())) { - return false; - } - } - return true; - } - - /** * Returns true if name matches against template.

    * diff --git a/test/jdk/sun/security/util/HostnameMatcher/NullHostnameCheck.java b/test/jdk/sun/security/util/HostnameChecker/NullHostnameCheck.java similarity index 100% rename from test/jdk/sun/security/util/HostnameMatcher/NullHostnameCheck.java rename to test/jdk/sun/security/util/HostnameChecker/NullHostnameCheck.java diff --git a/test/jdk/sun/security/util/HostnameMatcher/TestHostnameChecker.java b/test/jdk/sun/security/util/HostnameChecker/TestHostnameChecker.java similarity index 88% rename from test/jdk/sun/security/util/HostnameMatcher/TestHostnameChecker.java rename to test/jdk/sun/security/util/HostnameChecker/TestHostnameChecker.java index 8d50aa4c295..d5c0898d8e6 100644 --- a/test/jdk/sun/security/util/HostnameMatcher/TestHostnameChecker.java +++ b/test/jdk/sun/security/util/HostnameChecker/TestHostnameChecker.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2022, 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,16 +23,19 @@ /* * @test - * @bug 4514108 - * @summary Verify host name matching behaves as defined in RFC2818. + * @bug 4514108 7192189 + * @summary Verify host name matching behaves as defined in RFC2818 and RFC6125. * @library /test/lib - * @modules java.base/sun.security.util + * @modules java.base/sun.security.util java.base/sun.security.x509 */ import java.security.cert.*; +import java.util.Collection; +import java.util.List; import jdk.test.lib.security.CertUtils; import sun.security.util.*; +import sun.security.x509.X509CertImpl; /** * Certificate 1: @@ -193,10 +196,17 @@ public class TestHostnameChecker { check(checker, "altfoo2.com", cert3, true); check(checker, "5.6.7.8", cert3, true); check(checker, "foo.bar.com", cert4, true); - check(checker, "altfoo.bar.com", cert4, true); + check(checker, "altfoo.bar.com", cert4, false); check(checker, "2001:db8:3c4d:15::1a2f:1a2b", cert5, true); check(checker, "2001:0db8:3c4d:0015:0000:0000:1a2f:1a2b", cert5, true); check(checker, "2002:db8:3c4d:15::1a2f:1a2b", cert5, false); + check(checker, "foo.bar.example.net", mock("foo.*.example.net"), false); + check(checker, "baz1.example.net", mock("baz*.example.net"), true); + check(checker, "foobaz.example.net", mock("*baz.example.net"), true); + check(checker, "buzz.example.net", mock("b*z.example.net"), true); + check(checker, "公司.example.net", mock("xn--5*.example.net"), false); + check(checker, "公司.江利子.example.net", + mock("*.xn--kcry6tjko.example.net"), true); checker = HostnameChecker.getInstance( HostnameChecker.TYPE_LDAP); @@ -214,6 +224,15 @@ public class TestHostnameChecker { check(checker, "altfoo.bar.com", cert4, false); } + private static X509Certificate mock(String domain) { + return new X509CertImpl() { + @Override + public Collection> getSubjectAlternativeNames() { + return List.of(List.of(2, domain)); + } + }; + } + private static void check(HostnameChecker checker, String name, X509Certificate cert, boolean expectedResult) throws Exception { @@ -224,7 +243,7 @@ public class TestHostnameChecker { } } catch (CertificateException e) { if (expectedResult == true) { - throw e; + throw new Exception("Failed valid test: " + name, e); } } System.out.println("OK: " + name); diff --git a/test/jdk/sun/security/util/HostnameMatcher/cert1.crt b/test/jdk/sun/security/util/HostnameChecker/cert1.crt similarity index 100% rename from test/jdk/sun/security/util/HostnameMatcher/cert1.crt rename to test/jdk/sun/security/util/HostnameChecker/cert1.crt diff --git a/test/jdk/sun/security/util/HostnameMatcher/cert2.crt b/test/jdk/sun/security/util/HostnameChecker/cert2.crt similarity index 100% rename from test/jdk/sun/security/util/HostnameMatcher/cert2.crt rename to test/jdk/sun/security/util/HostnameChecker/cert2.crt diff --git a/test/jdk/sun/security/util/HostnameMatcher/cert3.crt b/test/jdk/sun/security/util/HostnameChecker/cert3.crt similarity index 100% rename from test/jdk/sun/security/util/HostnameMatcher/cert3.crt rename to test/jdk/sun/security/util/HostnameChecker/cert3.crt diff --git a/test/jdk/sun/security/util/HostnameMatcher/cert4.crt b/test/jdk/sun/security/util/HostnameChecker/cert4.crt similarity index 100% rename from test/jdk/sun/security/util/HostnameMatcher/cert4.crt rename to test/jdk/sun/security/util/HostnameChecker/cert4.crt diff --git a/test/jdk/sun/security/util/HostnameMatcher/cert5.crt b/test/jdk/sun/security/util/HostnameChecker/cert5.crt similarity index 100% rename from test/jdk/sun/security/util/HostnameMatcher/cert5.crt rename to test/jdk/sun/security/util/HostnameChecker/cert5.crt -- GitLab From ea19114e66326e4be7b4b9995888ad2ead3d37dc Mon Sep 17 00:00:00 2001 From: Rajan Halade Date: Tue, 8 Mar 2022 20:34:02 +0000 Subject: [PATCH 193/340] 8282832: Update file path for HostnameMatcher/cert5.crt in test sun/security/util/Pem/encoding.sh Reviewed-by: mullan --- test/jdk/sun/security/util/Pem/encoding.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/jdk/sun/security/util/Pem/encoding.sh b/test/jdk/sun/security/util/Pem/encoding.sh index 2bc39504218..7f8b142caf8 100644 --- a/test/jdk/sun/security/util/Pem/encoding.sh +++ b/test/jdk/sun/security/util/Pem/encoding.sh @@ -1,5 +1,5 @@ # -# Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2016, 2022, 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 @@ -32,4 +32,4 @@ $TESTJAVA/bin/java $TESTVMOPTS -cp $TESTCLASSES \ -Dfile.encoding=UTF-16 \ - PemEncoding $TESTSRC/../HostnameMatcher/cert5.crt + PemEncoding $TESTSRC/../HostnameChecker/cert5.crt -- GitLab From 49245131e98c1c72c447536e5527acecb3311add Mon Sep 17 00:00:00 2001 From: Hao Sun Date: Wed, 9 Mar 2022 00:52:01 +0000 Subject: [PATCH 194/340] 8265263: AArch64: Combine vneg with right shift count Reviewed-by: adinn, dlong --- src/hotspot/cpu/aarch64/aarch64.ad | 9 + src/hotspot/cpu/aarch64/aarch64_neon.ad | 611 ++++++++++++------ src/hotspot/cpu/aarch64/aarch64_neon_ad.m4 | 434 +++++++------ .../bench/vm/compiler/VectorShiftRight.java | 129 ++++ 4 files changed, 809 insertions(+), 374 deletions(-) create mode 100644 test/micro/org/openjdk/bench/vm/compiler/VectorShiftRight.java diff --git a/src/hotspot/cpu/aarch64/aarch64.ad b/src/hotspot/cpu/aarch64/aarch64.ad index f21835f9de3..96075ecd9d5 100644 --- a/src/hotspot/cpu/aarch64/aarch64.ad +++ b/src/hotspot/cpu/aarch64/aarch64.ad @@ -1311,6 +1311,9 @@ public: // predicate controlling translation of CompareAndSwapX bool needs_acquiring_load_exclusive(const Node *load); + // Assert that the given node is not a variable shift. + bool assert_not_var_shift(const Node* n); + // predicate controlling addressing modes bool size_fits_all_mem_uses(AddPNode* addp, int shift); %} @@ -1725,6 +1728,12 @@ bool needs_acquiring_load_exclusive(const Node *n) return true; } +// Assert that the given node is not a variable shift. +bool assert_not_var_shift(const Node* n) { + assert(!n->as_ShiftV()->is_var_shift(), "illegal variable shift"); + return true; +} + #define __ _masm. // advance declarations for helper functions to convert register diff --git a/src/hotspot/cpu/aarch64/aarch64_neon.ad b/src/hotspot/cpu/aarch64/aarch64_neon.ad index 7c84a93583b..feecd8ab90a 100644 --- a/src/hotspot/cpu/aarch64/aarch64_neon.ad +++ b/src/hotspot/cpu/aarch64/aarch64_neon.ad @@ -1,5 +1,5 @@ -// Copyright (c) 2020, 2021, Oracle and/or its affiliates. All rights reserved. -// Copyright (c) 2020, 2021, Arm Limited. All rights reserved. +// Copyright (c) 2020, 2022, Oracle and/or its affiliates. All rights reserved. +// Copyright (c) 2020, 2022, Arm Limited. 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 @@ -4400,11 +4400,17 @@ instruct vxor16B(vecX dst, vecX src1, vecX src2) // ------------------------------ Shift --------------------------------------- -instruct vshiftcnt8B(vecD dst, iRegIorL2I cnt) %{ +// Vector shift count +// Note-1: Low 8 bits of each element are used, so it doesn't matter if we +// treat it as ints or bytes here. +// Note-2: Shift value is negated for RShiftCntV additionally. See the comments +// on vsra8B rule for more details. + +instruct vslcnt8B(vecD dst, iRegIorL2I cnt) %{ predicate(UseSVE == 0 && (n->as_Vector()->length_in_bytes() == 4 || - n->as_Vector()->length_in_bytes() == 8)); + n->as_Vector()->length_in_bytes() == 8)); match(Set dst (LShiftCntV cnt)); - match(Set dst (RShiftCntV cnt)); + ins_cost(INSN_COST); format %{ "dup $dst, $cnt\t# shift count vector (8B)" %} ins_encode %{ __ dup(as_FloatRegister($dst$$reg), __ T8B, as_Register($cnt$$reg)); @@ -4412,10 +4418,10 @@ instruct vshiftcnt8B(vecD dst, iRegIorL2I cnt) %{ ins_pipe(vdup_reg_reg64); %} -instruct vshiftcnt16B(vecX dst, iRegIorL2I cnt) %{ - predicate(UseSVE == 0 && (n->as_Vector()->length_in_bytes() == 16)); +instruct vslcnt16B(vecX dst, iRegIorL2I cnt) %{ + predicate(UseSVE == 0 && n->as_Vector()->length_in_bytes() == 16); match(Set dst (LShiftCntV cnt)); - match(Set dst (RShiftCntV cnt)); + ins_cost(INSN_COST); format %{ "dup $dst, $cnt\t# shift count vector (16B)" %} ins_encode %{ __ dup(as_FloatRegister($dst$$reg), __ T16B, as_Register($cnt$$reg)); @@ -4423,9 +4429,35 @@ instruct vshiftcnt16B(vecX dst, iRegIorL2I cnt) %{ ins_pipe(vdup_reg_reg128); %} +instruct vsrcnt8B(vecD dst, iRegIorL2I cnt) %{ + predicate(UseSVE == 0 && (n->as_Vector()->length_in_bytes() == 4 || + n->as_Vector()->length_in_bytes() == 8)); + match(Set dst (RShiftCntV cnt)); + ins_cost(INSN_COST * 2); + format %{ "negw rscratch1, $cnt\t" + "dup $dst, rscratch1\t# shift count vector (8B)" %} + ins_encode %{ + __ negw(rscratch1, as_Register($cnt$$reg)); + __ dup(as_FloatRegister($dst$$reg), __ T8B, rscratch1); + %} + ins_pipe(vdup_reg_reg64); +%} + +instruct vsrcnt16B(vecX dst, iRegIorL2I cnt) %{ + predicate(UseSVE == 0 && n->as_Vector()->length_in_bytes() == 16); + match(Set dst (RShiftCntV cnt)); + ins_cost(INSN_COST * 2); + format %{ "negw rscratch1, $cnt\t" + "dup $dst, rscratch1\t# shift count vector (16B)" %} + ins_encode %{ + __ negw(rscratch1, as_Register($cnt$$reg)); + __ dup(as_FloatRegister($dst$$reg), __ T16B, rscratch1); + %} + ins_pipe(vdup_reg_reg128); +%} + instruct vsll8B(vecD dst, vecD src, vecD shift) %{ - predicate(n->as_Vector()->length() == 4 || - n->as_Vector()->length() == 8); + predicate(n->as_Vector()->length() == 4 || n->as_Vector()->length() == 8); match(Set dst (LShiftVB src shift)); ins_cost(INSN_COST); format %{ "sshl $dst,$src,$shift\t# vector (8B)" %} @@ -4459,8 +4491,6 @@ instruct vsll16B(vecX dst, vecX src, vecX shift) %{ // LoadVector RShiftCntV // | / // RShiftVI -// Note: In inner loop, multiple neg instructions are used, which can be -// moved to outer loop and merge into one neg instruction. // // Case 2: The vector shift count is from loading. // This case isn't supported by middle-end now. But it's supported by @@ -4470,83 +4500,145 @@ instruct vsll16B(vecX dst, vecX src, vecX shift) %{ // | / // RShiftVI // +// The negate is conducted in RShiftCntV rule for case 1, whereas it's done in +// RShiftV* rules for case 2. Because there exists an optimization opportunity +// for case 1, that is, multiple neg instructions in inner loop can be hoisted +// to outer loop and merged into one neg instruction. +// +// Note that ShiftVNode::is_var_shift() indicates whether the vector shift +// count is a variable vector(case 2) or not(a vector generated by RShiftCntV, +// i.e. case 1). -instruct vsra8B(vecD dst, vecD src, vecD shift, vecD tmp) %{ - predicate(n->as_Vector()->length() == 4 || - n->as_Vector()->length() == 8); +instruct vsra8B(vecD dst, vecD src, vecD shift) %{ + predicate((n->as_Vector()->length() == 4 || n->as_Vector()->length() == 8) && + !n->as_ShiftV()->is_var_shift()); match(Set dst (RShiftVB src shift)); ins_cost(INSN_COST); - effect(TEMP tmp); - format %{ "negr $tmp,$shift\t" - "sshl $dst,$src,$tmp\t# vector (8B)" %} + format %{ "sshl $dst,$src,$shift\t# vector (8B)" %} + ins_encode %{ + __ sshl(as_FloatRegister($dst$$reg), __ T8B, + as_FloatRegister($src$$reg), + as_FloatRegister($shift$$reg)); + %} + ins_pipe(vshift64); +%} + +instruct vsra8B_var(vecD dst, vecD src, vecD shift) %{ + predicate((n->as_Vector()->length() == 4 || n->as_Vector()->length() == 8) && + n->as_ShiftV()->is_var_shift()); + match(Set dst (RShiftVB src shift)); + ins_cost(INSN_COST * 2); + effect(TEMP_DEF dst); + format %{ "negr $dst,$shift\t" + "sshl $dst,$src,$dst\t# vector (8B)" %} ins_encode %{ - __ negr(as_FloatRegister($tmp$$reg), __ T8B, + __ negr(as_FloatRegister($dst$$reg), __ T8B, as_FloatRegister($shift$$reg)); __ sshl(as_FloatRegister($dst$$reg), __ T8B, as_FloatRegister($src$$reg), - as_FloatRegister($tmp$$reg)); + as_FloatRegister($dst$$reg)); %} ins_pipe(vshift64); %} -instruct vsra16B(vecX dst, vecX src, vecX shift, vecX tmp) %{ - predicate(n->as_Vector()->length() == 16); +instruct vsra16B(vecX dst, vecX src, vecX shift) %{ + predicate(n->as_Vector()->length() == 16 && !n->as_ShiftV()->is_var_shift()); match(Set dst (RShiftVB src shift)); ins_cost(INSN_COST); - effect(TEMP tmp); - format %{ "negr $tmp,$shift\t" - "sshl $dst,$src,$tmp\t# vector (16B)" %} + format %{ "sshl $dst,$src,$shift\t# vector (16B)" %} ins_encode %{ - __ negr(as_FloatRegister($tmp$$reg), __ T16B, + __ sshl(as_FloatRegister($dst$$reg), __ T16B, + as_FloatRegister($src$$reg), + as_FloatRegister($shift$$reg)); + %} + ins_pipe(vshift128); +%} + +instruct vsra16B_var(vecX dst, vecX src, vecX shift) %{ + predicate(n->as_Vector()->length() == 16 && n->as_ShiftV()->is_var_shift()); + match(Set dst (RShiftVB src shift)); + ins_cost(INSN_COST * 2); + effect(TEMP_DEF dst); + format %{ "negr $dst,$shift\t" + "sshl $dst,$src,$dst\t# vector (16B)" %} + ins_encode %{ + __ negr(as_FloatRegister($dst$$reg), __ T16B, as_FloatRegister($shift$$reg)); __ sshl(as_FloatRegister($dst$$reg), __ T16B, as_FloatRegister($src$$reg), - as_FloatRegister($tmp$$reg)); + as_FloatRegister($dst$$reg)); %} ins_pipe(vshift128); %} -instruct vsrl8B(vecD dst, vecD src, vecD shift, vecD tmp) %{ - predicate(n->as_Vector()->length() == 4 || - n->as_Vector()->length() == 8); +instruct vsrl8B(vecD dst, vecD src, vecD shift) %{ + predicate((n->as_Vector()->length() == 4 || n->as_Vector()->length() == 8) && + !n->as_ShiftV()->is_var_shift()); match(Set dst (URShiftVB src shift)); ins_cost(INSN_COST); - effect(TEMP tmp); - format %{ "negr $tmp,$shift\t" - "ushl $dst,$src,$tmp\t# vector (8B)" %} + format %{ "ushl $dst,$src,$shift\t# vector (8B)" %} ins_encode %{ - __ negr(as_FloatRegister($tmp$$reg), __ T8B, + __ ushl(as_FloatRegister($dst$$reg), __ T8B, + as_FloatRegister($src$$reg), + as_FloatRegister($shift$$reg)); + %} + ins_pipe(vshift64); +%} + +instruct vsrl8B_var(vecD dst, vecD src, vecD shift) %{ + predicate((n->as_Vector()->length() == 4 || n->as_Vector()->length() == 8) && + n->as_ShiftV()->is_var_shift()); + match(Set dst (URShiftVB src shift)); + ins_cost(INSN_COST * 2); + effect(TEMP_DEF dst); + format %{ "negr $dst,$shift\t" + "ushl $dst,$src,$dst\t# vector (8B)" %} + ins_encode %{ + __ negr(as_FloatRegister($dst$$reg), __ T8B, as_FloatRegister($shift$$reg)); __ ushl(as_FloatRegister($dst$$reg), __ T8B, as_FloatRegister($src$$reg), - as_FloatRegister($tmp$$reg)); + as_FloatRegister($dst$$reg)); %} ins_pipe(vshift64); %} -instruct vsrl16B(vecX dst, vecX src, vecX shift, vecX tmp) %{ - predicate(n->as_Vector()->length() == 16); +instruct vsrl16B(vecX dst, vecX src, vecX shift) %{ + predicate(n->as_Vector()->length() == 16 && !n->as_ShiftV()->is_var_shift()); match(Set dst (URShiftVB src shift)); ins_cost(INSN_COST); - effect(TEMP tmp); - format %{ "negr $tmp,$shift\t" - "ushl $dst,$src,$tmp\t# vector (16B)" %} + format %{ "ushl $dst,$src,$shift\t# vector (16B)" %} + ins_encode %{ + __ ushl(as_FloatRegister($dst$$reg), __ T16B, + as_FloatRegister($src$$reg), + as_FloatRegister($shift$$reg)); + %} + ins_pipe(vshift128); +%} + +instruct vsrl16B_var(vecX dst, vecX src, vecX shift) %{ + predicate(n->as_Vector()->length() == 16 && n->as_ShiftV()->is_var_shift()); + match(Set dst (URShiftVB src shift)); + ins_cost(INSN_COST * 2); + effect(TEMP_DEF dst); + format %{ "negr $dst,$shift\t" + "ushl $dst,$src,$dst\t# vector (16B)" %} ins_encode %{ - __ negr(as_FloatRegister($tmp$$reg), __ T16B, + __ negr(as_FloatRegister($dst$$reg), __ T16B, as_FloatRegister($shift$$reg)); __ ushl(as_FloatRegister($dst$$reg), __ T16B, as_FloatRegister($src$$reg), - as_FloatRegister($tmp$$reg)); + as_FloatRegister($dst$$reg)); %} ins_pipe(vshift128); %} instruct vsll8B_imm(vecD dst, vecD src, immI shift) %{ - predicate(n->as_Vector()->length() == 4 || - n->as_Vector()->length() == 8); + predicate((n->as_Vector()->length() == 4 || n->as_Vector()->length() == 8) && + assert_not_var_shift(n)); match(Set dst (LShiftVB src (LShiftCntV shift))); ins_cost(INSN_COST); - format %{ "shl $dst, $src, $shift\t# vector (8B)" %} + format %{ "shl $dst, $src, $shift\t# vector (8B)" %} ins_encode %{ int sh = (int)$shift$$constant; if (sh >= 8) { @@ -4562,10 +4654,10 @@ instruct vsll8B_imm(vecD dst, vecD src, immI shift) %{ %} instruct vsll16B_imm(vecX dst, vecX src, immI shift) %{ - predicate(n->as_Vector()->length() == 16); + predicate(n->as_Vector()->length() == 16 && assert_not_var_shift(n)); match(Set dst (LShiftVB src (LShiftCntV shift))); ins_cost(INSN_COST); - format %{ "shl $dst, $src, $shift\t# vector (16B)" %} + format %{ "shl $dst, $src, $shift\t# vector (16B)" %} ins_encode %{ int sh = (int)$shift$$constant; if (sh >= 8) { @@ -4581,40 +4673,40 @@ instruct vsll16B_imm(vecX dst, vecX src, immI shift) %{ %} instruct vsra8B_imm(vecD dst, vecD src, immI shift) %{ - predicate(n->as_Vector()->length() == 4 || - n->as_Vector()->length() == 8); + predicate((n->as_Vector()->length() == 4 || n->as_Vector()->length() == 8) && + assert_not_var_shift(n)); match(Set dst (RShiftVB src (RShiftCntV shift))); ins_cost(INSN_COST); - format %{ "sshr $dst, $src, $shift\t# vector (8B)" %} + format %{ "sshr $dst, $src, $shift\t# vector (8B)" %} ins_encode %{ int sh = (int)$shift$$constant; if (sh >= 8) sh = 7; __ sshr(as_FloatRegister($dst$$reg), __ T8B, - as_FloatRegister($src$$reg), sh); + as_FloatRegister($src$$reg), sh); %} ins_pipe(vshift64_imm); %} instruct vsra16B_imm(vecX dst, vecX src, immI shift) %{ - predicate(n->as_Vector()->length() == 16); + predicate(n->as_Vector()->length() == 16 && assert_not_var_shift(n)); match(Set dst (RShiftVB src (RShiftCntV shift))); ins_cost(INSN_COST); - format %{ "sshr $dst, $src, $shift\t# vector (16B)" %} + format %{ "sshr $dst, $src, $shift\t# vector (16B)" %} ins_encode %{ int sh = (int)$shift$$constant; if (sh >= 8) sh = 7; __ sshr(as_FloatRegister($dst$$reg), __ T16B, - as_FloatRegister($src$$reg), sh); + as_FloatRegister($src$$reg), sh); %} ins_pipe(vshift128_imm); %} instruct vsrl8B_imm(vecD dst, vecD src, immI shift) %{ - predicate(n->as_Vector()->length() == 4 || - n->as_Vector()->length() == 8); + predicate((n->as_Vector()->length() == 4 || n->as_Vector()->length() == 8) && + assert_not_var_shift(n)); match(Set dst (URShiftVB src (RShiftCntV shift))); ins_cost(INSN_COST); - format %{ "ushr $dst, $src, $shift\t# vector (8B)" %} + format %{ "ushr $dst, $src, $shift\t# vector (8B)" %} ins_encode %{ int sh = (int)$shift$$constant; if (sh >= 8) { @@ -4623,17 +4715,17 @@ instruct vsrl8B_imm(vecD dst, vecD src, immI shift) %{ as_FloatRegister($src$$reg)); } else { __ ushr(as_FloatRegister($dst$$reg), __ T8B, - as_FloatRegister($src$$reg), sh); + as_FloatRegister($src$$reg), sh); } %} ins_pipe(vshift64_imm); %} instruct vsrl16B_imm(vecX dst, vecX src, immI shift) %{ - predicate(n->as_Vector()->length() == 16); + predicate(n->as_Vector()->length() == 16 && assert_not_var_shift(n)); match(Set dst (URShiftVB src (RShiftCntV shift))); ins_cost(INSN_COST); - format %{ "ushr $dst, $src, $shift\t# vector (16B)" %} + format %{ "ushr $dst, $src, $shift\t# vector (16B)" %} ins_encode %{ int sh = (int)$shift$$constant; if (sh >= 8) { @@ -4642,15 +4734,14 @@ instruct vsrl16B_imm(vecX dst, vecX src, immI shift) %{ as_FloatRegister($src$$reg)); } else { __ ushr(as_FloatRegister($dst$$reg), __ T16B, - as_FloatRegister($src$$reg), sh); + as_FloatRegister($src$$reg), sh); } %} ins_pipe(vshift128_imm); %} instruct vsll4S(vecD dst, vecD src, vecD shift) %{ - predicate(n->as_Vector()->length() == 2 || - n->as_Vector()->length() == 4); + predicate(n->as_Vector()->length() == 2 || n->as_Vector()->length() == 4); match(Set dst (LShiftVS src shift)); ins_cost(INSN_COST); format %{ "sshl $dst,$src,$shift\t# vector (4H)" %} @@ -4675,82 +4766,136 @@ instruct vsll8S(vecX dst, vecX src, vecX shift) %{ ins_pipe(vshift128); %} -instruct vsra4S(vecD dst, vecD src, vecD shift, vecD tmp) %{ - predicate(n->as_Vector()->length() == 2 || - n->as_Vector()->length() == 4); +instruct vsra4S(vecD dst, vecD src, vecD shift) %{ + predicate((n->as_Vector()->length() == 2 || n->as_Vector()->length() == 4) && + !n->as_ShiftV()->is_var_shift()); match(Set dst (RShiftVS src shift)); ins_cost(INSN_COST); - effect(TEMP tmp); - format %{ "negr $tmp,$shift\t" - "sshl $dst,$src,$tmp\t# vector (4H)" %} + format %{ "sshl $dst,$src,$shift\t# vector (4H)" %} + ins_encode %{ + __ sshl(as_FloatRegister($dst$$reg), __ T4H, + as_FloatRegister($src$$reg), + as_FloatRegister($shift$$reg)); + %} + ins_pipe(vshift64); +%} + +instruct vsra4S_var(vecD dst, vecD src, vecD shift) %{ + predicate((n->as_Vector()->length() == 2 || n->as_Vector()->length() == 4) && + n->as_ShiftV()->is_var_shift()); + match(Set dst (RShiftVS src shift)); + ins_cost(INSN_COST * 2); + effect(TEMP_DEF dst); + format %{ "negr $dst,$shift\t" + "sshl $dst,$src,$dst\t# vector (4H)" %} ins_encode %{ - __ negr(as_FloatRegister($tmp$$reg), __ T8B, + __ negr(as_FloatRegister($dst$$reg), __ T8B, as_FloatRegister($shift$$reg)); __ sshl(as_FloatRegister($dst$$reg), __ T4H, as_FloatRegister($src$$reg), - as_FloatRegister($tmp$$reg)); + as_FloatRegister($dst$$reg)); %} ins_pipe(vshift64); %} -instruct vsra8S(vecX dst, vecX src, vecX shift, vecX tmp) %{ - predicate(n->as_Vector()->length() == 8); +instruct vsra8S(vecX dst, vecX src, vecX shift) %{ + predicate(n->as_Vector()->length() == 8 && !n->as_ShiftV()->is_var_shift()); match(Set dst (RShiftVS src shift)); ins_cost(INSN_COST); - effect(TEMP tmp); - format %{ "negr $tmp,$shift\t" - "sshl $dst,$src,$tmp\t# vector (8H)" %} + format %{ "sshl $dst,$src,$shift\t# vector (8H)" %} ins_encode %{ - __ negr(as_FloatRegister($tmp$$reg), __ T16B, + __ sshl(as_FloatRegister($dst$$reg), __ T8H, + as_FloatRegister($src$$reg), + as_FloatRegister($shift$$reg)); + %} + ins_pipe(vshift128); +%} + +instruct vsra8S_var(vecX dst, vecX src, vecX shift) %{ + predicate(n->as_Vector()->length() == 8 && n->as_ShiftV()->is_var_shift()); + match(Set dst (RShiftVS src shift)); + ins_cost(INSN_COST * 2); + effect(TEMP_DEF dst); + format %{ "negr $dst,$shift\t" + "sshl $dst,$src,$dst\t# vector (8H)" %} + ins_encode %{ + __ negr(as_FloatRegister($dst$$reg), __ T16B, as_FloatRegister($shift$$reg)); __ sshl(as_FloatRegister($dst$$reg), __ T8H, as_FloatRegister($src$$reg), - as_FloatRegister($tmp$$reg)); + as_FloatRegister($dst$$reg)); %} ins_pipe(vshift128); %} -instruct vsrl4S(vecD dst, vecD src, vecD shift, vecD tmp) %{ - predicate(n->as_Vector()->length() == 2 || - n->as_Vector()->length() == 4); +instruct vsrl4S(vecD dst, vecD src, vecD shift) %{ + predicate((n->as_Vector()->length() == 2 || n->as_Vector()->length() == 4) && + !n->as_ShiftV()->is_var_shift()); match(Set dst (URShiftVS src shift)); ins_cost(INSN_COST); - effect(TEMP tmp); - format %{ "negr $tmp,$shift\t" - "ushl $dst,$src,$tmp\t# vector (4H)" %} + format %{ "ushl $dst,$src,$shift\t# vector (4H)" %} + ins_encode %{ + __ ushl(as_FloatRegister($dst$$reg), __ T4H, + as_FloatRegister($src$$reg), + as_FloatRegister($shift$$reg)); + %} + ins_pipe(vshift64); +%} + +instruct vsrl4S_var(vecD dst, vecD src, vecD shift) %{ + predicate((n->as_Vector()->length() == 2 || n->as_Vector()->length() == 4) && + n->as_ShiftV()->is_var_shift()); + match(Set dst (URShiftVS src shift)); + ins_cost(INSN_COST * 2); + effect(TEMP_DEF dst); + format %{ "negr $dst,$shift\t" + "ushl $dst,$src,$dst\t# vector (4H)" %} ins_encode %{ - __ negr(as_FloatRegister($tmp$$reg), __ T8B, + __ negr(as_FloatRegister($dst$$reg), __ T8B, as_FloatRegister($shift$$reg)); __ ushl(as_FloatRegister($dst$$reg), __ T4H, as_FloatRegister($src$$reg), - as_FloatRegister($tmp$$reg)); + as_FloatRegister($dst$$reg)); %} ins_pipe(vshift64); %} -instruct vsrl8S(vecX dst, vecX src, vecX shift, vecX tmp) %{ - predicate(n->as_Vector()->length() == 8); +instruct vsrl8S(vecX dst, vecX src, vecX shift) %{ + predicate(n->as_Vector()->length() == 8 && !n->as_ShiftV()->is_var_shift()); match(Set dst (URShiftVS src shift)); ins_cost(INSN_COST); - effect(TEMP tmp); - format %{ "negr $tmp,$shift\t" - "ushl $dst,$src,$tmp\t# vector (8H)" %} + format %{ "ushl $dst,$src,$shift\t# vector (8H)" %} ins_encode %{ - __ negr(as_FloatRegister($tmp$$reg), __ T16B, + __ ushl(as_FloatRegister($dst$$reg), __ T8H, + as_FloatRegister($src$$reg), + as_FloatRegister($shift$$reg)); + %} + ins_pipe(vshift128); +%} + +instruct vsrl8S_var(vecX dst, vecX src, vecX shift) %{ + predicate(n->as_Vector()->length() == 8 && n->as_ShiftV()->is_var_shift()); + match(Set dst (URShiftVS src shift)); + ins_cost(INSN_COST * 2); + effect(TEMP_DEF dst); + format %{ "negr $dst,$shift\t" + "ushl $dst,$src,$dst\t# vector (8H)" %} + ins_encode %{ + __ negr(as_FloatRegister($dst$$reg), __ T16B, as_FloatRegister($shift$$reg)); __ ushl(as_FloatRegister($dst$$reg), __ T8H, as_FloatRegister($src$$reg), - as_FloatRegister($tmp$$reg)); + as_FloatRegister($dst$$reg)); %} ins_pipe(vshift128); %} instruct vsll4S_imm(vecD dst, vecD src, immI shift) %{ - predicate(n->as_Vector()->length() == 2 || - n->as_Vector()->length() == 4); + predicate((n->as_Vector()->length() == 2 || n->as_Vector()->length() == 4) && + assert_not_var_shift(n)); match(Set dst (LShiftVS src (LShiftCntV shift))); ins_cost(INSN_COST); - format %{ "shl $dst, $src, $shift\t# vector (4H)" %} + format %{ "shl $dst, $src, $shift\t# vector (4H)" %} ins_encode %{ int sh = (int)$shift$$constant; if (sh >= 16) { @@ -4766,10 +4911,10 @@ instruct vsll4S_imm(vecD dst, vecD src, immI shift) %{ %} instruct vsll8S_imm(vecX dst, vecX src, immI shift) %{ - predicate(n->as_Vector()->length() == 8); + predicate(n->as_Vector()->length() == 8 && assert_not_var_shift(n)); match(Set dst (LShiftVS src (LShiftCntV shift))); ins_cost(INSN_COST); - format %{ "shl $dst, $src, $shift\t# vector (8H)" %} + format %{ "shl $dst, $src, $shift\t# vector (8H)" %} ins_encode %{ int sh = (int)$shift$$constant; if (sh >= 16) { @@ -4785,40 +4930,40 @@ instruct vsll8S_imm(vecX dst, vecX src, immI shift) %{ %} instruct vsra4S_imm(vecD dst, vecD src, immI shift) %{ - predicate(n->as_Vector()->length() == 2 || - n->as_Vector()->length() == 4); + predicate((n->as_Vector()->length() == 2 || n->as_Vector()->length() == 4) && + assert_not_var_shift(n)); match(Set dst (RShiftVS src (RShiftCntV shift))); ins_cost(INSN_COST); - format %{ "sshr $dst, $src, $shift\t# vector (4H)" %} + format %{ "sshr $dst, $src, $shift\t# vector (4H)" %} ins_encode %{ int sh = (int)$shift$$constant; if (sh >= 16) sh = 15; __ sshr(as_FloatRegister($dst$$reg), __ T4H, - as_FloatRegister($src$$reg), sh); + as_FloatRegister($src$$reg), sh); %} ins_pipe(vshift64_imm); %} instruct vsra8S_imm(vecX dst, vecX src, immI shift) %{ - predicate(n->as_Vector()->length() == 8); + predicate(n->as_Vector()->length() == 8 && assert_not_var_shift(n)); match(Set dst (RShiftVS src (RShiftCntV shift))); ins_cost(INSN_COST); - format %{ "sshr $dst, $src, $shift\t# vector (8H)" %} + format %{ "sshr $dst, $src, $shift\t# vector (8H)" %} ins_encode %{ int sh = (int)$shift$$constant; if (sh >= 16) sh = 15; __ sshr(as_FloatRegister($dst$$reg), __ T8H, - as_FloatRegister($src$$reg), sh); + as_FloatRegister($src$$reg), sh); %} ins_pipe(vshift128_imm); %} instruct vsrl4S_imm(vecD dst, vecD src, immI shift) %{ - predicate(n->as_Vector()->length() == 2 || - n->as_Vector()->length() == 4); + predicate((n->as_Vector()->length() == 2 || n->as_Vector()->length() == 4) && + assert_not_var_shift(n)); match(Set dst (URShiftVS src (RShiftCntV shift))); ins_cost(INSN_COST); - format %{ "ushr $dst, $src, $shift\t# vector (4H)" %} + format %{ "ushr $dst, $src, $shift\t# vector (4H)" %} ins_encode %{ int sh = (int)$shift$$constant; if (sh >= 16) { @@ -4827,17 +4972,17 @@ instruct vsrl4S_imm(vecD dst, vecD src, immI shift) %{ as_FloatRegister($src$$reg)); } else { __ ushr(as_FloatRegister($dst$$reg), __ T4H, - as_FloatRegister($src$$reg), sh); + as_FloatRegister($src$$reg), sh); } %} ins_pipe(vshift64_imm); %} instruct vsrl8S_imm(vecX dst, vecX src, immI shift) %{ - predicate(n->as_Vector()->length() == 8); + predicate(n->as_Vector()->length() == 8 && assert_not_var_shift(n)); match(Set dst (URShiftVS src (RShiftCntV shift))); ins_cost(INSN_COST); - format %{ "ushr $dst, $src, $shift\t# vector (8H)" %} + format %{ "ushr $dst, $src, $shift\t# vector (8H)" %} ins_encode %{ int sh = (int)$shift$$constant; if (sh >= 16) { @@ -4846,7 +4991,7 @@ instruct vsrl8S_imm(vecX dst, vecX src, immI shift) %{ as_FloatRegister($src$$reg)); } else { __ ushr(as_FloatRegister($dst$$reg), __ T8H, - as_FloatRegister($src$$reg), sh); + as_FloatRegister($src$$reg), sh); } %} ins_pipe(vshift128_imm); @@ -4878,79 +5023,131 @@ instruct vsll4I(vecX dst, vecX src, vecX shift) %{ ins_pipe(vshift128); %} -instruct vsra2I(vecD dst, vecD src, vecD shift, vecD tmp) %{ - predicate(n->as_Vector()->length() == 2); +instruct vsra2I(vecD dst, vecD src, vecD shift) %{ + predicate(n->as_Vector()->length() == 2 && !n->as_ShiftV()->is_var_shift()); match(Set dst (RShiftVI src shift)); ins_cost(INSN_COST); - effect(TEMP tmp); - format %{ "negr $tmp,$shift\t" - "sshl $dst,$src,$tmp\t# vector (2S)" %} + format %{ "sshl $dst,$src,$shift\t# vector (2S)" %} + ins_encode %{ + __ sshl(as_FloatRegister($dst$$reg), __ T2S, + as_FloatRegister($src$$reg), + as_FloatRegister($shift$$reg)); + %} + ins_pipe(vshift64); +%} + +instruct vsra2I_var(vecD dst, vecD src, vecD shift) %{ + predicate(n->as_Vector()->length() == 2 && n->as_ShiftV()->is_var_shift()); + match(Set dst (RShiftVI src shift)); + ins_cost(INSN_COST * 2); + effect(TEMP_DEF dst); + format %{ "negr $dst,$shift\t" + "sshl $dst,$src,$dst\t# vector (2S)" %} ins_encode %{ - __ negr(as_FloatRegister($tmp$$reg), __ T8B, + __ negr(as_FloatRegister($dst$$reg), __ T8B, as_FloatRegister($shift$$reg)); __ sshl(as_FloatRegister($dst$$reg), __ T2S, as_FloatRegister($src$$reg), - as_FloatRegister($tmp$$reg)); + as_FloatRegister($dst$$reg)); %} ins_pipe(vshift64); %} -instruct vsra4I(vecX dst, vecX src, vecX shift, vecX tmp) %{ - predicate(n->as_Vector()->length() == 4); +instruct vsra4I(vecX dst, vecX src, vecX shift) %{ + predicate(n->as_Vector()->length() == 4 && !n->as_ShiftV()->is_var_shift()); match(Set dst (RShiftVI src shift)); ins_cost(INSN_COST); - effect(TEMP tmp); - format %{ "negr $tmp,$shift\t" - "sshl $dst,$src,$tmp\t# vector (4S)" %} + format %{ "sshl $dst,$src,$shift\t# vector (4S)" %} ins_encode %{ - __ negr(as_FloatRegister($tmp$$reg), __ T16B, + __ sshl(as_FloatRegister($dst$$reg), __ T4S, + as_FloatRegister($src$$reg), + as_FloatRegister($shift$$reg)); + %} + ins_pipe(vshift128); +%} + +instruct vsra4I_var(vecX dst, vecX src, vecX shift) %{ + predicate(n->as_Vector()->length() == 4 && n->as_ShiftV()->is_var_shift()); + match(Set dst (RShiftVI src shift)); + ins_cost(INSN_COST * 2); + effect(TEMP_DEF dst); + format %{ "negr $dst,$shift\t" + "sshl $dst,$src,$dst\t# vector (4S)" %} + ins_encode %{ + __ negr(as_FloatRegister($dst$$reg), __ T16B, as_FloatRegister($shift$$reg)); __ sshl(as_FloatRegister($dst$$reg), __ T4S, as_FloatRegister($src$$reg), - as_FloatRegister($tmp$$reg)); + as_FloatRegister($dst$$reg)); %} ins_pipe(vshift128); %} -instruct vsrl2I(vecD dst, vecD src, vecD shift, vecD tmp) %{ - predicate(n->as_Vector()->length() == 2); +instruct vsrl2I(vecD dst, vecD src, vecD shift) %{ + predicate(n->as_Vector()->length() == 2 && !n->as_ShiftV()->is_var_shift()); match(Set dst (URShiftVI src shift)); ins_cost(INSN_COST); - effect(TEMP tmp); - format %{ "negr $tmp,$shift\t" - "ushl $dst,$src,$tmp\t# vector (2S)" %} + format %{ "ushl $dst,$src,$shift\t# vector (2S)" %} + ins_encode %{ + __ ushl(as_FloatRegister($dst$$reg), __ T2S, + as_FloatRegister($src$$reg), + as_FloatRegister($shift$$reg)); + %} + ins_pipe(vshift64); +%} + +instruct vsrl2I_var(vecD dst, vecD src, vecD shift) %{ + predicate(n->as_Vector()->length() == 2 && n->as_ShiftV()->is_var_shift()); + match(Set dst (URShiftVI src shift)); + ins_cost(INSN_COST * 2); + effect(TEMP_DEF dst); + format %{ "negr $dst,$shift\t" + "ushl $dst,$src,$dst\t# vector (2S)" %} ins_encode %{ - __ negr(as_FloatRegister($tmp$$reg), __ T8B, + __ negr(as_FloatRegister($dst$$reg), __ T8B, as_FloatRegister($shift$$reg)); __ ushl(as_FloatRegister($dst$$reg), __ T2S, as_FloatRegister($src$$reg), - as_FloatRegister($tmp$$reg)); + as_FloatRegister($dst$$reg)); %} ins_pipe(vshift64); %} -instruct vsrl4I(vecX dst, vecX src, vecX shift, vecX tmp) %{ - predicate(n->as_Vector()->length() == 4); +instruct vsrl4I(vecX dst, vecX src, vecX shift) %{ + predicate(n->as_Vector()->length() == 4 && !n->as_ShiftV()->is_var_shift()); match(Set dst (URShiftVI src shift)); ins_cost(INSN_COST); - effect(TEMP tmp); - format %{ "negr $tmp,$shift\t" - "ushl $dst,$src,$tmp\t# vector (4S)" %} + format %{ "ushl $dst,$src,$shift\t# vector (4S)" %} ins_encode %{ - __ negr(as_FloatRegister($tmp$$reg), __ T16B, + __ ushl(as_FloatRegister($dst$$reg), __ T4S, + as_FloatRegister($src$$reg), + as_FloatRegister($shift$$reg)); + %} + ins_pipe(vshift128); +%} + +instruct vsrl4I_var(vecX dst, vecX src, vecX shift) %{ + predicate(n->as_Vector()->length() == 4 && n->as_ShiftV()->is_var_shift()); + match(Set dst (URShiftVI src shift)); + ins_cost(INSN_COST * 2); + effect(TEMP_DEF dst); + format %{ "negr $dst,$shift\t" + "ushl $dst,$src,$dst\t# vector (4S)" %} + ins_encode %{ + __ negr(as_FloatRegister($dst$$reg), __ T16B, as_FloatRegister($shift$$reg)); __ ushl(as_FloatRegister($dst$$reg), __ T4S, as_FloatRegister($src$$reg), - as_FloatRegister($tmp$$reg)); + as_FloatRegister($dst$$reg)); %} ins_pipe(vshift128); %} instruct vsll2I_imm(vecD dst, vecD src, immI shift) %{ - predicate(n->as_Vector()->length() == 2); + predicate(n->as_Vector()->length() == 2 && assert_not_var_shift(n)); match(Set dst (LShiftVI src (LShiftCntV shift))); ins_cost(INSN_COST); - format %{ "shl $dst, $src, $shift\t# vector (2S)" %} + format %{ "shl $dst, $src, $shift\t# vector (2S)" %} ins_encode %{ __ shl(as_FloatRegister($dst$$reg), __ T2S, as_FloatRegister($src$$reg), @@ -4960,10 +5157,10 @@ instruct vsll2I_imm(vecD dst, vecD src, immI shift) %{ %} instruct vsll4I_imm(vecX dst, vecX src, immI shift) %{ - predicate(n->as_Vector()->length() == 4); + predicate(n->as_Vector()->length() == 4 && assert_not_var_shift(n)); match(Set dst (LShiftVI src (LShiftCntV shift))); ins_cost(INSN_COST); - format %{ "shl $dst, $src, $shift\t# vector (4S)" %} + format %{ "shl $dst, $src, $shift\t# vector (4S)" %} ins_encode %{ __ shl(as_FloatRegister($dst$$reg), __ T4S, as_FloatRegister($src$$reg), @@ -4973,10 +5170,10 @@ instruct vsll4I_imm(vecX dst, vecX src, immI shift) %{ %} instruct vsra2I_imm(vecD dst, vecD src, immI shift) %{ - predicate(n->as_Vector()->length() == 2); + predicate(n->as_Vector()->length() == 2 && assert_not_var_shift(n)); match(Set dst (RShiftVI src (RShiftCntV shift))); ins_cost(INSN_COST); - format %{ "sshr $dst, $src, $shift\t# vector (2S)" %} + format %{ "sshr $dst, $src, $shift\t# vector (2S)" %} ins_encode %{ __ sshr(as_FloatRegister($dst$$reg), __ T2S, as_FloatRegister($src$$reg), @@ -4986,10 +5183,10 @@ instruct vsra2I_imm(vecD dst, vecD src, immI shift) %{ %} instruct vsra4I_imm(vecX dst, vecX src, immI shift) %{ - predicate(n->as_Vector()->length() == 4); + predicate(n->as_Vector()->length() == 4 && assert_not_var_shift(n)); match(Set dst (RShiftVI src (RShiftCntV shift))); ins_cost(INSN_COST); - format %{ "sshr $dst, $src, $shift\t# vector (4S)" %} + format %{ "sshr $dst, $src, $shift\t# vector (4S)" %} ins_encode %{ __ sshr(as_FloatRegister($dst$$reg), __ T4S, as_FloatRegister($src$$reg), @@ -4999,10 +5196,10 @@ instruct vsra4I_imm(vecX dst, vecX src, immI shift) %{ %} instruct vsrl2I_imm(vecD dst, vecD src, immI shift) %{ - predicate(n->as_Vector()->length() == 2); + predicate(n->as_Vector()->length() == 2 && assert_not_var_shift(n)); match(Set dst (URShiftVI src (RShiftCntV shift))); ins_cost(INSN_COST); - format %{ "ushr $dst, $src, $shift\t# vector (2S)" %} + format %{ "ushr $dst, $src, $shift\t# vector (2S)" %} ins_encode %{ __ ushr(as_FloatRegister($dst$$reg), __ T2S, as_FloatRegister($src$$reg), @@ -5012,10 +5209,10 @@ instruct vsrl2I_imm(vecD dst, vecD src, immI shift) %{ %} instruct vsrl4I_imm(vecX dst, vecX src, immI shift) %{ - predicate(n->as_Vector()->length() == 4); + predicate(n->as_Vector()->length() == 4 && assert_not_var_shift(n)); match(Set dst (URShiftVI src (RShiftCntV shift))); ins_cost(INSN_COST); - format %{ "ushr $dst, $src, $shift\t# vector (4S)" %} + format %{ "ushr $dst, $src, $shift\t# vector (4S)" %} ins_encode %{ __ ushr(as_FloatRegister($dst$$reg), __ T4S, as_FloatRegister($src$$reg), @@ -5037,45 +5234,71 @@ instruct vsll2L(vecX dst, vecX src, vecX shift) %{ ins_pipe(vshift128); %} -instruct vsra2L(vecX dst, vecX src, vecX shift, vecX tmp) %{ - predicate(n->as_Vector()->length() == 2); +instruct vsra2L(vecX dst, vecX src, vecX shift) %{ + predicate(n->as_Vector()->length() == 2 && !n->as_ShiftV()->is_var_shift()); match(Set dst (RShiftVL src shift)); ins_cost(INSN_COST); - effect(TEMP tmp); - format %{ "negr $tmp,$shift\t" - "sshl $dst,$src,$tmp\t# vector (2D)" %} + format %{ "sshl $dst,$src,$shift\t# vector (2D)" %} ins_encode %{ - __ negr(as_FloatRegister($tmp$$reg), __ T16B, + __ sshl(as_FloatRegister($dst$$reg), __ T2D, + as_FloatRegister($src$$reg), + as_FloatRegister($shift$$reg)); + %} + ins_pipe(vshift128); +%} + +instruct vsra2L_var(vecX dst, vecX src, vecX shift) %{ + predicate(n->as_Vector()->length() == 2 && n->as_ShiftV()->is_var_shift()); + match(Set dst (RShiftVL src shift)); + ins_cost(INSN_COST * 2); + effect(TEMP_DEF dst); + format %{ "negr $dst,$shift\t" + "sshl $dst,$src,$dst\t# vector (2D)" %} + ins_encode %{ + __ negr(as_FloatRegister($dst$$reg), __ T16B, as_FloatRegister($shift$$reg)); __ sshl(as_FloatRegister($dst$$reg), __ T2D, as_FloatRegister($src$$reg), - as_FloatRegister($tmp$$reg)); + as_FloatRegister($dst$$reg)); %} ins_pipe(vshift128); %} -instruct vsrl2L(vecX dst, vecX src, vecX shift, vecX tmp) %{ - predicate(n->as_Vector()->length() == 2); +instruct vsrl2L(vecX dst, vecX src, vecX shift) %{ + predicate(n->as_Vector()->length() == 2 && !n->as_ShiftV()->is_var_shift()); match(Set dst (URShiftVL src shift)); ins_cost(INSN_COST); - effect(TEMP tmp); - format %{ "negr $tmp,$shift\t" - "ushl $dst,$src,$tmp\t# vector (2D)" %} + format %{ "ushl $dst,$src,$shift\t# vector (2D)" %} + ins_encode %{ + __ ushl(as_FloatRegister($dst$$reg), __ T2D, + as_FloatRegister($src$$reg), + as_FloatRegister($shift$$reg)); + %} + ins_pipe(vshift128); +%} + +instruct vsrl2L_var(vecX dst, vecX src, vecX shift) %{ + predicate(n->as_Vector()->length() == 2 && n->as_ShiftV()->is_var_shift()); + match(Set dst (URShiftVL src shift)); + ins_cost(INSN_COST * 2); + effect(TEMP_DEF dst); + format %{ "negr $dst,$shift\t" + "ushl $dst,$src,$dst\t# vector (2D)" %} ins_encode %{ - __ negr(as_FloatRegister($tmp$$reg), __ T16B, + __ negr(as_FloatRegister($dst$$reg), __ T16B, as_FloatRegister($shift$$reg)); __ ushl(as_FloatRegister($dst$$reg), __ T2D, as_FloatRegister($src$$reg), - as_FloatRegister($tmp$$reg)); + as_FloatRegister($dst$$reg)); %} ins_pipe(vshift128); %} instruct vsll2L_imm(vecX dst, vecX src, immI shift) %{ - predicate(n->as_Vector()->length() == 2); + predicate(n->as_Vector()->length() == 2 && assert_not_var_shift(n)); match(Set dst (LShiftVL src (LShiftCntV shift))); ins_cost(INSN_COST); - format %{ "shl $dst, $src, $shift\t# vector (2D)" %} + format %{ "shl $dst, $src, $shift\t# vector (2D)" %} ins_encode %{ __ shl(as_FloatRegister($dst$$reg), __ T2D, as_FloatRegister($src$$reg), @@ -5085,10 +5308,10 @@ instruct vsll2L_imm(vecX dst, vecX src, immI shift) %{ %} instruct vsra2L_imm(vecX dst, vecX src, immI shift) %{ - predicate(n->as_Vector()->length() == 2); + predicate(n->as_Vector()->length() == 2 && assert_not_var_shift(n)); match(Set dst (RShiftVL src (RShiftCntV shift))); ins_cost(INSN_COST); - format %{ "sshr $dst, $src, $shift\t# vector (2D)" %} + format %{ "sshr $dst, $src, $shift\t# vector (2D)" %} ins_encode %{ __ sshr(as_FloatRegister($dst$$reg), __ T2D, as_FloatRegister($src$$reg), @@ -5098,10 +5321,10 @@ instruct vsra2L_imm(vecX dst, vecX src, immI shift) %{ %} instruct vsrl2L_imm(vecX dst, vecX src, immI shift) %{ - predicate(n->as_Vector()->length() == 2); + predicate(n->as_Vector()->length() == 2 && assert_not_var_shift(n)); match(Set dst (URShiftVL src (RShiftCntV shift))); ins_cost(INSN_COST); - format %{ "ushr $dst, $src, $shift\t# vector (2D)" %} + format %{ "ushr $dst, $src, $shift\t# vector (2D)" %} ins_encode %{ __ ushr(as_FloatRegister($dst$$reg), __ T2D, as_FloatRegister($src$$reg), @@ -5114,12 +5337,12 @@ instruct vsraa8B_imm(vecD dst, vecD src, immI shift) %{ predicate(n->as_Vector()->length() == 8); match(Set dst (AddVB dst (RShiftVB src (RShiftCntV shift)))); ins_cost(INSN_COST); - format %{ "ssra $dst, $src, $shift\t# vector (8B)" %} + format %{ "ssra $dst, $src, $shift\t# vector (8B)" %} ins_encode %{ int sh = (int)$shift$$constant; if (sh >= 8) sh = 7; __ ssra(as_FloatRegister($dst$$reg), __ T8B, - as_FloatRegister($src$$reg), sh); + as_FloatRegister($src$$reg), sh); %} ins_pipe(vshift64_imm); %} @@ -5128,12 +5351,12 @@ instruct vsraa16B_imm(vecX dst, vecX src, immI shift) %{ predicate(n->as_Vector()->length() == 16); match(Set dst (AddVB dst (RShiftVB src (RShiftCntV shift)))); ins_cost(INSN_COST); - format %{ "ssra $dst, $src, $shift\t# vector (16B)" %} + format %{ "ssra $dst, $src, $shift\t# vector (16B)" %} ins_encode %{ int sh = (int)$shift$$constant; if (sh >= 8) sh = 7; __ ssra(as_FloatRegister($dst$$reg), __ T16B, - as_FloatRegister($src$$reg), sh); + as_FloatRegister($src$$reg), sh); %} ins_pipe(vshift128_imm); %} @@ -5142,12 +5365,12 @@ instruct vsraa4S_imm(vecD dst, vecD src, immI shift) %{ predicate(n->as_Vector()->length() == 4); match(Set dst (AddVS dst (RShiftVS src (RShiftCntV shift)))); ins_cost(INSN_COST); - format %{ "ssra $dst, $src, $shift\t# vector (4H)" %} + format %{ "ssra $dst, $src, $shift\t# vector (4H)" %} ins_encode %{ int sh = (int)$shift$$constant; if (sh >= 16) sh = 15; __ ssra(as_FloatRegister($dst$$reg), __ T4H, - as_FloatRegister($src$$reg), sh); + as_FloatRegister($src$$reg), sh); %} ins_pipe(vshift64_imm); %} @@ -5156,12 +5379,12 @@ instruct vsraa8S_imm(vecX dst, vecX src, immI shift) %{ predicate(n->as_Vector()->length() == 8); match(Set dst (AddVS dst (RShiftVS src (RShiftCntV shift)))); ins_cost(INSN_COST); - format %{ "ssra $dst, $src, $shift\t# vector (8H)" %} + format %{ "ssra $dst, $src, $shift\t# vector (8H)" %} ins_encode %{ int sh = (int)$shift$$constant; if (sh >= 16) sh = 15; __ ssra(as_FloatRegister($dst$$reg), __ T8H, - as_FloatRegister($src$$reg), sh); + as_FloatRegister($src$$reg), sh); %} ins_pipe(vshift128_imm); %} @@ -5170,7 +5393,7 @@ instruct vsraa2I_imm(vecD dst, vecD src, immI shift) %{ predicate(n->as_Vector()->length() == 2); match(Set dst (AddVI dst (RShiftVI src (RShiftCntV shift)))); ins_cost(INSN_COST); - format %{ "ssra $dst, $src, $shift\t# vector (2S)" %} + format %{ "ssra $dst, $src, $shift\t# vector (2S)" %} ins_encode %{ __ ssra(as_FloatRegister($dst$$reg), __ T2S, as_FloatRegister($src$$reg), @@ -5183,7 +5406,7 @@ instruct vsraa4I_imm(vecX dst, vecX src, immI shift) %{ predicate(n->as_Vector()->length() == 4); match(Set dst (AddVI dst (RShiftVI src (RShiftCntV shift)))); ins_cost(INSN_COST); - format %{ "ssra $dst, $src, $shift\t# vector (4S)" %} + format %{ "ssra $dst, $src, $shift\t# vector (4S)" %} ins_encode %{ __ ssra(as_FloatRegister($dst$$reg), __ T4S, as_FloatRegister($src$$reg), @@ -5196,7 +5419,7 @@ instruct vsraa2L_imm(vecX dst, vecX src, immI shift) %{ predicate(n->as_Vector()->length() == 2); match(Set dst (AddVL dst (RShiftVL src (RShiftCntV shift)))); ins_cost(INSN_COST); - format %{ "ssra $dst, $src, $shift\t# vector (2D)" %} + format %{ "ssra $dst, $src, $shift\t# vector (2D)" %} ins_encode %{ __ ssra(as_FloatRegister($dst$$reg), __ T2D, as_FloatRegister($src$$reg), @@ -5209,12 +5432,12 @@ instruct vsrla8B_imm(vecD dst, vecD src, immI shift) %{ predicate(n->as_Vector()->length() == 8); match(Set dst (AddVB dst (URShiftVB src (RShiftCntV shift)))); ins_cost(INSN_COST); - format %{ "usra $dst, $src, $shift\t# vector (8B)" %} + format %{ "usra $dst, $src, $shift\t# vector (8B)" %} ins_encode %{ int sh = (int)$shift$$constant; if (sh < 8) { __ usra(as_FloatRegister($dst$$reg), __ T8B, - as_FloatRegister($src$$reg), sh); + as_FloatRegister($src$$reg), sh); } %} ins_pipe(vshift64_imm); @@ -5224,12 +5447,12 @@ instruct vsrla16B_imm(vecX dst, vecX src, immI shift) %{ predicate(n->as_Vector()->length() == 16); match(Set dst (AddVB dst (URShiftVB src (RShiftCntV shift)))); ins_cost(INSN_COST); - format %{ "usra $dst, $src, $shift\t# vector (16B)" %} + format %{ "usra $dst, $src, $shift\t# vector (16B)" %} ins_encode %{ int sh = (int)$shift$$constant; if (sh < 8) { __ usra(as_FloatRegister($dst$$reg), __ T16B, - as_FloatRegister($src$$reg), sh); + as_FloatRegister($src$$reg), sh); } %} ins_pipe(vshift128_imm); @@ -5239,12 +5462,12 @@ instruct vsrla4S_imm(vecD dst, vecD src, immI shift) %{ predicate(n->as_Vector()->length() == 4); match(Set dst (AddVS dst (URShiftVS src (RShiftCntV shift)))); ins_cost(INSN_COST); - format %{ "usra $dst, $src, $shift\t# vector (4H)" %} + format %{ "usra $dst, $src, $shift\t# vector (4H)" %} ins_encode %{ int sh = (int)$shift$$constant; if (sh < 16) { __ usra(as_FloatRegister($dst$$reg), __ T4H, - as_FloatRegister($src$$reg), sh); + as_FloatRegister($src$$reg), sh); } %} ins_pipe(vshift64_imm); @@ -5254,12 +5477,12 @@ instruct vsrla8S_imm(vecX dst, vecX src, immI shift) %{ predicate(n->as_Vector()->length() == 8); match(Set dst (AddVS dst (URShiftVS src (RShiftCntV shift)))); ins_cost(INSN_COST); - format %{ "usra $dst, $src, $shift\t# vector (8H)" %} + format %{ "usra $dst, $src, $shift\t# vector (8H)" %} ins_encode %{ int sh = (int)$shift$$constant; if (sh < 16) { __ usra(as_FloatRegister($dst$$reg), __ T8H, - as_FloatRegister($src$$reg), sh); + as_FloatRegister($src$$reg), sh); } %} ins_pipe(vshift128_imm); @@ -5269,7 +5492,7 @@ instruct vsrla2I_imm(vecD dst, vecD src, immI shift) %{ predicate(n->as_Vector()->length() == 2); match(Set dst (AddVI dst (URShiftVI src (RShiftCntV shift)))); ins_cost(INSN_COST); - format %{ "usra $dst, $src, $shift\t# vector (2S)" %} + format %{ "usra $dst, $src, $shift\t# vector (2S)" %} ins_encode %{ __ usra(as_FloatRegister($dst$$reg), __ T2S, as_FloatRegister($src$$reg), @@ -5282,7 +5505,7 @@ instruct vsrla4I_imm(vecX dst, vecX src, immI shift) %{ predicate(n->as_Vector()->length() == 4); match(Set dst (AddVI dst (URShiftVI src (RShiftCntV shift)))); ins_cost(INSN_COST); - format %{ "usra $dst, $src, $shift\t# vector (4S)" %} + format %{ "usra $dst, $src, $shift\t# vector (4S)" %} ins_encode %{ __ usra(as_FloatRegister($dst$$reg), __ T4S, as_FloatRegister($src$$reg), @@ -5295,7 +5518,7 @@ instruct vsrla2L_imm(vecX dst, vecX src, immI shift) %{ predicate(n->as_Vector()->length() == 2); match(Set dst (AddVL dst (URShiftVL src (RShiftCntV shift)))); ins_cost(INSN_COST); - format %{ "usra $dst, $src, $shift\t# vector (2D)" %} + format %{ "usra $dst, $src, $shift\t# vector (2D)" %} ins_encode %{ __ usra(as_FloatRegister($dst$$reg), __ T2D, as_FloatRegister($src$$reg), diff --git a/src/hotspot/cpu/aarch64/aarch64_neon_ad.m4 b/src/hotspot/cpu/aarch64/aarch64_neon_ad.m4 index ff94bb002fa..f98ddf4ee36 100644 --- a/src/hotspot/cpu/aarch64/aarch64_neon_ad.m4 +++ b/src/hotspot/cpu/aarch64/aarch64_neon_ad.m4 @@ -1,5 +1,5 @@ -// Copyright (c) 2020, 2021, Oracle and/or its affiliates. All rights reserved. -// Copyright (c) 2020, 2021, Arm Limited. All rights reserved. +// Copyright (c) 2020, 2022, Oracle and/or its affiliates. All rights reserved. +// Copyright (c) 2020, 2022, Arm Limited. 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 @@ -1972,223 +1972,277 @@ VLOGICAL(xor, eor, xor, Xor, 16, B, X) // ------------------------------ Shift --------------------------------------- dnl -define(`VSHIFTCNT', ` -instruct vshiftcnt$3$4`'(vec$5 dst, iRegIorL2I cnt) %{ - predicate(UseSVE == 0 && (ifelse($3, 8, n->as_Vector()->length_in_bytes() == 4 ||` - ')n->as_Vector()->length_in_bytes() == $3)); +define(`VSLCNT', ` +instruct vslcnt$1$2`'(vec$3 dst, iRegIorL2I cnt) %{ + predicate(UseSVE == 0 && ifelse($1, 8, + (n->as_Vector()->length_in_bytes() == 4 ||` + 'n->as_Vector()->length_in_bytes() == $1), + n->as_Vector()->length_in_bytes() == $1)); match(Set dst (LShiftCntV cnt)); - match(Set dst (RShiftCntV cnt)); - format %{ "$1 $dst, $cnt\t# shift count vector ($3$4)" %} + ins_cost(INSN_COST); + format %{ "dup $dst, $cnt\t# shift count vector ($1$2)" %} ins_encode %{ - __ $2(as_FloatRegister($dst$$reg), __ T$3$4, as_Register($cnt$$reg)); + __ dup(as_FloatRegister($dst$$reg), __ T$1$2, as_Register($cnt$$reg)); %} - ins_pipe(vdup_reg_reg`'ifelse($5, D, 64, 128)); + ins_pipe(vdup_reg_reg`'ifelse($3, D, 64, 128)); %}')dnl -dnl $1 $2 $3 $4 $5 -VSHIFTCNT(dup, dup, 8, B, D) -VSHIFTCNT(dup, dup, 16, B, X) +dnl +define(`VSRCNT', ` +instruct vsrcnt$1$2`'(vec$3 dst, iRegIorL2I cnt) %{ + predicate(UseSVE == 0 && ifelse($1, 8, + (n->as_Vector()->length_in_bytes() == 4 ||` + 'n->as_Vector()->length_in_bytes() == $1), + n->as_Vector()->length_in_bytes() == $1)); + match(Set dst (RShiftCntV cnt)); + ins_cost(INSN_COST * 2); + format %{ "negw rscratch1, $cnt\t" + "dup $dst, rscratch1\t# shift count vector ($1$2)" %} + ins_encode %{ + __ negw(rscratch1, as_Register($cnt$$reg)); + __ dup(as_FloatRegister($dst$$reg), __ T$1$2, rscratch1); + %} + ins_pipe(vdup_reg_reg`'ifelse($3, D, 64, 128)); +%}')dnl +dnl + +// Vector shift count +// Note-1: Low 8 bits of each element are used, so it doesn't matter if we +// treat it as ints or bytes here. +// Note-2: Shift value is negated for RShiftCntV additionally. See the comments +// on vsra8B rule for more details. +dnl $1 $2 $3 +VSLCNT(8, B, D) +VSLCNT(16, B, X) +VSRCNT(8, B, D) +VSRCNT(16, B, X) +dnl +define(`PREDICATE', +`ifelse($1, 8B, + ifelse($3, `', `predicate(n->as_Vector()->length() == 4 || n->as_Vector()->length() == 8);', + `predicate((n->as_Vector()->length() == 4 || n->as_Vector()->length() == 8) &&` + '$3);'), + $1, 4S, + ifelse($3, `', `predicate(n->as_Vector()->length() == 2 || n->as_Vector()->length() == 4);', + `predicate((n->as_Vector()->length() == 2 || n->as_Vector()->length() == 4) &&` + '$3);'), + ifelse($3, `', `predicate(n->as_Vector()->length() == $2);', + `predicate(n->as_Vector()->length() == $2 && $3);'))')dnl dnl define(`VSLL', ` -instruct vsll$3$4`'(vec$6 dst, vec$6 src, vec$6 shift) %{ - predicate(ifelse($3$4, 8B, n->as_Vector()->length() == 4 ||` - ', - $3$4, 4S, n->as_Vector()->length() == 2 ||` - ')n->as_Vector()->length() == $3); - match(Set dst (LShiftV$4 src shift)); +instruct vsll$1$2`'(vec$4 dst, vec$4 src, vec$4 shift) %{ + PREDICATE(`$1$2', $1, ) + match(Set dst (LShiftV$2 src shift)); ins_cost(INSN_COST); - format %{ "$1 $dst,$src,$shift\t# vector ($3$5)" %} + format %{ "sshl $dst,$src,$shift\t# vector ($1$3)" %} ins_encode %{ - __ $2(as_FloatRegister($dst$$reg), __ T$3$5, + __ sshl(as_FloatRegister($dst$$reg), __ T$1$3, as_FloatRegister($src$$reg), as_FloatRegister($shift$$reg)); %} - ins_pipe(vshift`'ifelse($6, D, 64, 128)); + ins_pipe(vshift`'ifelse($4, D, 64, 128)); %}')dnl dnl define(`VSRA', ` -instruct vsra$3$4`'(vec$6 dst, vec$6 src, vec$6 shift, vec$6 tmp) %{ - predicate(ifelse($3$4, 8B, n->as_Vector()->length() == 4 ||` - ', - $3$4, 4S, n->as_Vector()->length() == 2 ||` - ')n->as_Vector()->length() == $3); - match(Set dst (RShiftV$4 src shift)); +instruct vsra$1$2`'(vec$4 dst, vec$4 src, vec$4 shift) %{ + PREDICATE(`$1$2', $1, !n->as_ShiftV()->is_var_shift()) + match(Set dst (RShiftV$2 src shift)); ins_cost(INSN_COST); - effect(TEMP tmp); - format %{ "$1 $tmp,$shift\t" - "$2 $dst,$src,$tmp\t# vector ($3$5)" %} + format %{ "sshl $dst,$src,$shift\t# vector ($1$3)" %} ins_encode %{ - __ $1(as_FloatRegister($tmp$$reg), __ T`'ifelse($6, D, 8B, 16B), + __ sshl(as_FloatRegister($dst$$reg), __ T$1$3, + as_FloatRegister($src$$reg), as_FloatRegister($shift$$reg)); - __ $2(as_FloatRegister($dst$$reg), __ T$3$5, + %} + ins_pipe(vshift`'ifelse($4, D, 64, 128)); +%}')dnl +dnl +define(`VSRA_VAR', ` +instruct vsra$1$2_var`'(vec$4 dst, vec$4 src, vec$4 shift) %{ + PREDICATE(`$1$2', $1, n->as_ShiftV()->is_var_shift()) + match(Set dst (RShiftV$2 src shift)); + ins_cost(INSN_COST * 2); + effect(TEMP_DEF dst); + format %{ "negr $dst,$shift\t" + "sshl $dst,$src,$dst\t# vector ($1$3)" %} + ins_encode %{ + __ negr(as_FloatRegister($dst$$reg), __ T`'ifelse($4, D, 8B, 16B), + as_FloatRegister($shift$$reg)); + __ sshl(as_FloatRegister($dst$$reg), __ T$1$3, as_FloatRegister($src$$reg), - as_FloatRegister($tmp$$reg)); + as_FloatRegister($dst$$reg)); %} - ins_pipe(vshift`'ifelse($6, D, 64, 128)); + ins_pipe(vshift`'ifelse($4, D, 64, 128)); %}')dnl dnl define(`VSRL', ` -instruct vsrl$3$4`'(vec$6 dst, vec$6 src, vec$6 shift, vec$6 tmp) %{ - predicate(ifelse($3$4, 8B, n->as_Vector()->length() == 4 ||` - ', - $3$4, 4S, n->as_Vector()->length() == 2 ||` - ')n->as_Vector()->length() == $3); - match(Set dst (URShiftV$4 src shift)); +instruct vsrl$1$2`'(vec$4 dst, vec$4 src, vec$4 shift) %{ + PREDICATE(`$1$2', $1, !n->as_ShiftV()->is_var_shift()) + match(Set dst (URShiftV$2 src shift)); ins_cost(INSN_COST); - effect(TEMP tmp); - format %{ "$1 $tmp,$shift\t" - "$2 $dst,$src,$tmp\t# vector ($3$5)" %} + format %{ "ushl $dst,$src,$shift\t# vector ($1$3)" %} + ins_encode %{ + __ ushl(as_FloatRegister($dst$$reg), __ T$1$3, + as_FloatRegister($src$$reg), + as_FloatRegister($shift$$reg)); + %} + ins_pipe(vshift`'ifelse($4, D, 64, 128)); +%}')dnl +dnl +define(`VSRL_VAR', ` +instruct vsrl$1$2_var`'(vec$4 dst, vec$4 src, vec$4 shift) %{ + PREDICATE(`$1$2', $1, n->as_ShiftV()->is_var_shift()) + match(Set dst (URShiftV$2 src shift)); + ins_cost(INSN_COST * 2); + effect(TEMP_DEF dst); + format %{ "negr $dst,$shift\t" + "ushl $dst,$src,$dst\t# vector ($1$3)" %} ins_encode %{ - __ $1(as_FloatRegister($tmp$$reg), __ T`'ifelse($6, D, 8B, 16B), + __ negr(as_FloatRegister($dst$$reg), __ T`'ifelse($4, D, 8B, 16B), as_FloatRegister($shift$$reg)); - __ $2(as_FloatRegister($dst$$reg), __ T$3$5, + __ ushl(as_FloatRegister($dst$$reg), __ T$1$3, as_FloatRegister($src$$reg), - as_FloatRegister($tmp$$reg)); + as_FloatRegister($dst$$reg)); %} - ins_pipe(vshift`'ifelse($6, D, 64, 128)); + ins_pipe(vshift`'ifelse($4, D, 64, 128)); %}')dnl dnl define(`VSLL_IMM', ` -instruct vsll$3$4_imm`'(vec$6 dst, vec$6 src, immI shift) %{ - predicate(ifelse($3$4, 8B, n->as_Vector()->length() == 4 ||` - ', - $3$4, 4S, n->as_Vector()->length() == 2 ||` - ')n->as_Vector()->length() == $3); - match(Set dst (LShiftV$4 src (LShiftCntV shift))); - ins_cost(INSN_COST); - format %{ "$1 $dst, $src, $shift\t# vector ($3$5)" %} - ins_encode %{ifelse($4, B,` +instruct vsll$1$2_imm`'(vec$4 dst, vec$4 src, immI shift) %{ + PREDICATE(`$1$2', $1, assert_not_var_shift(n)) + match(Set dst (LShiftV$2 src (LShiftCntV shift))); + ins_cost(INSN_COST); + format %{ "shl $dst, $src, $shift\t# vector ($1$3)" %} + ins_encode %{ifelse($2, B,` int sh = (int)$shift$$constant; if (sh >= 8) { - __ eor(as_FloatRegister($dst$$reg), __ ifelse($6, D, T8B, T16B), + __ eor(as_FloatRegister($dst$$reg), __ ifelse($4, D, T8B, T16B), as_FloatRegister($src$$reg), as_FloatRegister($src$$reg)); } else { - __ $2(as_FloatRegister($dst$$reg), __ T$3$5, + __ shl(as_FloatRegister($dst$$reg), __ T$1$3, as_FloatRegister($src$$reg), sh); - }', $4, S,` + }', $2, S,` int sh = (int)$shift$$constant; if (sh >= 16) { - __ eor(as_FloatRegister($dst$$reg), __ ifelse($6, D, T8B, T16B), + __ eor(as_FloatRegister($dst$$reg), __ ifelse($4, D, T8B, T16B), as_FloatRegister($src$$reg), as_FloatRegister($src$$reg)); } else { - __ $2(as_FloatRegister($dst$$reg), __ T$3$5, + __ shl(as_FloatRegister($dst$$reg), __ T$1$3, as_FloatRegister($src$$reg), sh); }', ` - __ $2(as_FloatRegister($dst$$reg), __ T$3$5, + __ shl(as_FloatRegister($dst$$reg), __ T$1$3, as_FloatRegister($src$$reg), (int)$shift$$constant);') %} - ins_pipe(vshift`'ifelse($6, D, 64, 128)_imm); + ins_pipe(vshift`'ifelse($4, D, 64, 128)_imm); %}')dnl +dnl define(`VSRA_IMM', ` -instruct vsra$3$4_imm`'(vec$6 dst, vec$6 src, immI shift) %{ - predicate(ifelse($3$4, 8B, n->as_Vector()->length() == 4 ||` - ', - $3$4, 4S, n->as_Vector()->length() == 2 ||` - ')n->as_Vector()->length() == $3); - match(Set dst (RShiftV$4 src (RShiftCntV shift))); - ins_cost(INSN_COST); - format %{ "$1 $dst, $src, $shift\t# vector ($3$5)" %} - ins_encode %{ifelse($4, B,` +instruct vsra$1$2_imm`'(vec$4 dst, vec$4 src, immI shift) %{ + PREDICATE(`$1$2', $1, assert_not_var_shift(n)) + match(Set dst (RShiftV$2 src (RShiftCntV shift))); + ins_cost(INSN_COST); + format %{ "sshr $dst, $src, $shift\t# vector ($1$3)" %} + ins_encode %{ifelse($2, B,` int sh = (int)$shift$$constant; if (sh >= 8) sh = 7; - __ $2(as_FloatRegister($dst$$reg), __ T$3$5, - as_FloatRegister($src$$reg), sh);', $4, S,` + __ sshr(as_FloatRegister($dst$$reg), __ T$1$3, + as_FloatRegister($src$$reg), sh);', $2, S,` int sh = (int)$shift$$constant; if (sh >= 16) sh = 15; - __ $2(as_FloatRegister($dst$$reg), __ T$3$5, - as_FloatRegister($src$$reg), sh);', ` - __ $2(as_FloatRegister($dst$$reg), __ T$3$5, + __ sshr(as_FloatRegister($dst$$reg), __ T$1$3, + as_FloatRegister($src$$reg), sh);', ` + __ sshr(as_FloatRegister($dst$$reg), __ T$1$3, as_FloatRegister($src$$reg), (int)$shift$$constant);') %} - ins_pipe(vshift`'ifelse($6, D, 64, 128)_imm); + ins_pipe(vshift`'ifelse($4, D, 64, 128)_imm); %}')dnl dnl define(`VSRL_IMM', ` -instruct vsrl$3$4_imm`'(vec$6 dst, vec$6 src, immI shift) %{ - predicate(ifelse($3$4, 8B, n->as_Vector()->length() == 4 ||` - ', - $3$4, 4S, n->as_Vector()->length() == 2 ||` - ')n->as_Vector()->length() == $3); - match(Set dst (URShiftV$4 src (RShiftCntV shift))); - ins_cost(INSN_COST); - format %{ "$1 $dst, $src, $shift\t# vector ($3$5)" %} - ins_encode %{ifelse($4, B,` +instruct vsrl$1$2_imm`'(vec$4 dst, vec$4 src, immI shift) %{ + PREDICATE(`$1$2', $1, assert_not_var_shift(n)) + match(Set dst (URShiftV$2 src (RShiftCntV shift))); + ins_cost(INSN_COST); + format %{ "ushr $dst, $src, $shift\t# vector ($1$3)" %} + ins_encode %{ifelse($2, B,` int sh = (int)$shift$$constant; if (sh >= 8) { - __ eor(as_FloatRegister($dst$$reg), __ ifelse($6, D, T8B, T16B), + __ eor(as_FloatRegister($dst$$reg), __ ifelse($4, D, T8B, T16B), as_FloatRegister($src$$reg), as_FloatRegister($src$$reg)); } else { - __ $2(as_FloatRegister($dst$$reg), __ T$3$5, - as_FloatRegister($src$$reg), sh); - }', $4, S,` + __ ushr(as_FloatRegister($dst$$reg), __ T$1$3, + as_FloatRegister($src$$reg), sh); + }', $2, S,` int sh = (int)$shift$$constant; if (sh >= 16) { - __ eor(as_FloatRegister($dst$$reg), __ ifelse($6, D, T8B, T16B), + __ eor(as_FloatRegister($dst$$reg), __ ifelse($4, D, T8B, T16B), as_FloatRegister($src$$reg), as_FloatRegister($src$$reg)); } else { - __ $2(as_FloatRegister($dst$$reg), __ T$3$5, - as_FloatRegister($src$$reg), sh); + __ ushr(as_FloatRegister($dst$$reg), __ T$1$3, + as_FloatRegister($src$$reg), sh); }', ` - __ $2(as_FloatRegister($dst$$reg), __ T$3$5, + __ ushr(as_FloatRegister($dst$$reg), __ T$1$3, as_FloatRegister($src$$reg), (int)$shift$$constant);') %} - ins_pipe(vshift`'ifelse($6, D, 64, 128)_imm); + ins_pipe(vshift`'ifelse($4, D, 64, 128)_imm); %}')dnl dnl define(`VSRLA_IMM', ` -instruct vsrla$3$4_imm`'(vec$6 dst, vec$6 src, immI shift) %{ - predicate(n->as_Vector()->length() == $3); - match(Set dst (AddV$4 dst (URShiftV$4 src (RShiftCntV shift)))); +instruct vsrla$1$2_imm`'(vec$4 dst, vec$4 src, immI shift) %{ + predicate(n->as_Vector()->length() == $1); + match(Set dst (AddV$2 dst (URShiftV$2 src (RShiftCntV shift)))); ins_cost(INSN_COST); - format %{ "$1 $dst, $src, $shift\t# vector ($3$5)" %} - ins_encode %{ifelse($4, B,` + format %{ "usra $dst, $src, $shift\t# vector ($1$3)" %} + ins_encode %{ifelse($2, B,` int sh = (int)$shift$$constant; if (sh < 8) { - __ $2(as_FloatRegister($dst$$reg), __ T$3$5, - as_FloatRegister($src$$reg), sh); - }', $4, S,` + __ usra(as_FloatRegister($dst$$reg), __ T$1$3, + as_FloatRegister($src$$reg), sh); + }', $2, S,` int sh = (int)$shift$$constant; if (sh < 16) { - __ $2(as_FloatRegister($dst$$reg), __ T$3$5, - as_FloatRegister($src$$reg), sh); + __ usra(as_FloatRegister($dst$$reg), __ T$1$3, + as_FloatRegister($src$$reg), sh); }', ` - __ $2(as_FloatRegister($dst$$reg), __ T$3$5, + __ usra(as_FloatRegister($dst$$reg), __ T$1$3, as_FloatRegister($src$$reg), (int)$shift$$constant);') %} - ins_pipe(vshift`'ifelse($6, D, 64, 128)_imm); + ins_pipe(vshift`'ifelse($4, D, 64, 128)_imm); %}')dnl dnl define(`VSRAA_IMM', ` -instruct vsraa$3$4_imm`'(vec$6 dst, vec$6 src, immI shift) %{ - predicate(n->as_Vector()->length() == $3); - match(Set dst (AddV$4 dst (RShiftV$4 src (RShiftCntV shift)))); +instruct vsraa$1$2_imm`'(vec$4 dst, vec$4 src, immI shift) %{ + predicate(n->as_Vector()->length() == $1); + match(Set dst (AddV$2 dst (RShiftV$2 src (RShiftCntV shift)))); ins_cost(INSN_COST); - format %{ "$1 $dst, $src, $shift\t# vector ($3$5)" %} - ins_encode %{ifelse($4, B,` + format %{ "ssra $dst, $src, $shift\t# vector ($1$3)" %} + ins_encode %{ifelse($2, B,` int sh = (int)$shift$$constant; if (sh >= 8) sh = 7; - __ $2(as_FloatRegister($dst$$reg), __ T$3$5, - as_FloatRegister($src$$reg), sh);', $4, S,` + __ ssra(as_FloatRegister($dst$$reg), __ T$1$3, + as_FloatRegister($src$$reg), sh);', $2, S,` int sh = (int)$shift$$constant; if (sh >= 16) sh = 15; - __ $2(as_FloatRegister($dst$$reg), __ T$3$5, - as_FloatRegister($src$$reg), sh);', ` - __ $2(as_FloatRegister($dst$$reg), __ T$3$5, + __ ssra(as_FloatRegister($dst$$reg), __ T$1$3, + as_FloatRegister($src$$reg), sh);', ` + __ ssra(as_FloatRegister($dst$$reg), __ T$1$3, as_FloatRegister($src$$reg), (int)$shift$$constant);') %} - ins_pipe(vshift`'ifelse($6, D, 64, 128)_imm); + ins_pipe(vshift`'ifelse($4, D, 64, 128)_imm); %}')dnl -dnl $1 $2 $3 $4 $5 $6 -VSLL(sshl, sshl, 8, B, B, D) -VSLL(sshl, sshl, 16, B, B, X) +dnl +undefine(PREDICATE)dnl +dnl +dnl $1 $2 $3 $4 +VSLL(8, B, B, D) +VSLL(16, B, B, X) // Right shifts with vector shift count on aarch64 SIMD are implemented // as left shift by negative shift count. @@ -2199,8 +2253,6 @@ VSLL(sshl, sshl, 16, B, B, X) // LoadVector RShiftCntV // | / // RShiftVI -// Note: In inner loop, multiple neg instructions are used, which can be -// moved to outer loop and merge into one neg instruction. // // Case 2: The vector shift count is from loading. // This case isn't supported by middle-end now. But it's supported by @@ -2210,61 +2262,83 @@ VSLL(sshl, sshl, 16, B, B, X) // | / // RShiftVI // -dnl $1 $2 $3 $4 $5 $6 -VSRA(negr, sshl, 8, B, B, D) -VSRA(negr, sshl, 16, B, B, X) -VSRL(negr, ushl, 8, B, B, D) -VSRL(negr, ushl, 16, B, B, X) -VSLL_IMM(shl, shl, 8, B, B, D) -VSLL_IMM(shl, shl, 16, B, B, X) -VSRA_IMM(sshr, sshr, 8, B, B, D) -VSRA_IMM(sshr, sshr, 16, B, B, X) -VSRL_IMM(ushr, ushr, 8, B, B, D) -VSRL_IMM(ushr, ushr, 16, B, B, X) -VSLL(sshl, sshl, 4, S, H, D) -VSLL(sshl, sshl, 8, S, H, X) -VSRA(negr, sshl, 4, S, H, D) -VSRA(negr, sshl, 8, S, H, X) -VSRL(negr, ushl, 4, S, H, D) -VSRL(negr, ushl, 8, S, H, X) -VSLL_IMM(shl, shl, 4, S, H, D) -VSLL_IMM(shl, shl, 8, S, H, X) -VSRA_IMM(sshr, sshr, 4, S, H, D) -VSRA_IMM(sshr, sshr, 8, S, H, X) -VSRL_IMM(ushr, ushr, 4, S, H, D) -VSRL_IMM(ushr, ushr, 8, S, H, X) -VSLL(sshl, sshl, 2, I, S, D) -VSLL(sshl, sshl, 4, I, S, X) -VSRA(negr, sshl, 2, I, S, D) -VSRA(negr, sshl, 4, I, S, X) -VSRL(negr, ushl, 2, I, S, D) -VSRL(negr, ushl, 4, I, S, X) -VSLL_IMM(shl, shl, 2, I, S, D) -VSLL_IMM(shl, shl, 4, I, S, X) -VSRA_IMM(sshr, sshr, 2, I, S, D) -VSRA_IMM(sshr, sshr, 4, I, S, X) -VSRL_IMM(ushr, ushr, 2, I, S, D) -VSRL_IMM(ushr, ushr, 4, I, S, X) -VSLL(sshl, sshl, 2, L, D, X) -VSRA(negr, sshl, 2, L, D, X) -VSRL(negr, ushl, 2, L, D, X) -VSLL_IMM(shl, shl, 2, L, D, X) -VSRA_IMM(sshr, sshr, 2, L, D, X) -VSRL_IMM(ushr, ushr, 2, L, D, X) -VSRAA_IMM(ssra, ssra, 8, B, B, D) -VSRAA_IMM(ssra, ssra, 16, B, B, X) -VSRAA_IMM(ssra, ssra, 4, S, H, D) -VSRAA_IMM(ssra, ssra, 8, S, H, X) -VSRAA_IMM(ssra, ssra, 2, I, S, D) -VSRAA_IMM(ssra, ssra, 4, I, S, X) -VSRAA_IMM(ssra, ssra, 2, L, D, X) -VSRLA_IMM(usra, usra, 8, B, B, D) -VSRLA_IMM(usra, usra, 16, B, B, X) -VSRLA_IMM(usra, usra, 4, S, H, D) -VSRLA_IMM(usra, usra, 8, S, H, X) -VSRLA_IMM(usra, usra, 2, I, S, D) -VSRLA_IMM(usra, usra, 4, I, S, X) -VSRLA_IMM(usra, usra, 2, L, D, X) +// The negate is conducted in RShiftCntV rule for case 1, whereas it's done in +// RShiftV* rules for case 2. Because there exists an optimization opportunity +// for case 1, that is, multiple neg instructions in inner loop can be hoisted +// to outer loop and merged into one neg instruction. +// +// Note that ShiftVNode::is_var_shift() indicates whether the vector shift +// count is a variable vector(case 2) or not(a vector generated by RShiftCntV, +// i.e. case 1). +dnl $1 $2 $3 $4 +VSRA(8, B, B, D) +VSRA_VAR(8, B, B, D) +VSRA(16, B, B, X) +VSRA_VAR(16, B, B, X) +VSRL(8, B, B, D) +VSRL_VAR(8, B, B, D) +VSRL(16, B, B, X) +VSRL_VAR(16, B, B, X) +VSLL_IMM(8, B, B, D) +VSLL_IMM(16, B, B, X) +VSRA_IMM(8, B, B, D) +VSRA_IMM(16, B, B, X) +VSRL_IMM(8, B, B, D) +VSRL_IMM(16, B, B, X) +VSLL(4, S, H, D) +VSLL(8, S, H, X) +VSRA(4, S, H, D) +VSRA_VAR(4, S, H, D) +VSRA(8, S, H, X) +VSRA_VAR(8, S, H, X) +VSRL(4, S, H, D) +VSRL_VAR(4, S, H, D) +VSRL(8, S, H, X) +VSRL_VAR(8, S, H, X) +VSLL_IMM(4, S, H, D) +VSLL_IMM(8, S, H, X) +VSRA_IMM(4, S, H, D) +VSRA_IMM(8, S, H, X) +VSRL_IMM(4, S, H, D) +VSRL_IMM(8, S, H, X) +VSLL(2, I, S, D) +VSLL(4, I, S, X) +VSRA(2, I, S, D) +VSRA_VAR(2, I, S, D) +VSRA(4, I, S, X) +VSRA_VAR(4, I, S, X) +VSRL(2, I, S, D) +VSRL_VAR(2, I, S, D) +VSRL(4, I, S, X) +VSRL_VAR(4, I, S, X) +VSLL_IMM(2, I, S, D) +VSLL_IMM(4, I, S, X) +VSRA_IMM(2, I, S, D) +VSRA_IMM(4, I, S, X) +VSRL_IMM(2, I, S, D) +VSRL_IMM(4, I, S, X) +VSLL(2, L, D, X) +VSRA(2, L, D, X) +VSRA_VAR(2, L, D, X) +VSRL(2, L, D, X) +VSRL_VAR(2, L, D, X) +VSLL_IMM(2, L, D, X) +VSRA_IMM(2, L, D, X) +VSRL_IMM(2, L, D, X) +VSRAA_IMM(8, B, B, D) +VSRAA_IMM(16, B, B, X) +VSRAA_IMM(4, S, H, D) +VSRAA_IMM(8, S, H, X) +VSRAA_IMM(2, I, S, D) +VSRAA_IMM(4, I, S, X) +VSRAA_IMM(2, L, D, X) +VSRLA_IMM(8, B, B, D) +VSRLA_IMM(16, B, B, X) +VSRLA_IMM(4, S, H, D) +VSRLA_IMM(8, S, H, X) +VSRLA_IMM(2, I, S, D) +VSRLA_IMM(4, I, S, X) +VSRLA_IMM(2, L, D, X) dnl define(`VMINMAX', ` instruct v$1$3`'ifelse($5, S, F, D)`'(vec$6 dst, vec$6 src1, vec$6 src2) diff --git a/test/micro/org/openjdk/bench/vm/compiler/VectorShiftRight.java b/test/micro/org/openjdk/bench/vm/compiler/VectorShiftRight.java new file mode 100644 index 00000000000..068d1bd704d --- /dev/null +++ b/test/micro/org/openjdk/bench/vm/compiler/VectorShiftRight.java @@ -0,0 +1,129 @@ +/* + * Copyright (c) 2022, Arm Limited. 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 org.openjdk.bench.vm.compiler; + +import org.openjdk.jmh.annotations.*; +import org.openjdk.jmh.infra.*; + +import java.util.concurrent.TimeUnit; +import java.util.Random; + +@BenchmarkMode(Mode.AverageTime) +@OutputTimeUnit(TimeUnit.NANOSECONDS) +@State(Scope.Thread) +public class VectorShiftRight { + @Param({"1024"}) + public int SIZE; + + private byte[] bytesA, bytesB; + private short[] shortsA, shortsB; + private char[] charsA, charsB; + private int[] intsA, intsB; + private long[] longsA, longsB; + + @Param("0") + private int seed; + private Random r = new Random(seed); + + @Param("3") + private int shiftCount; + + @Setup + public void init() { + bytesA = new byte[SIZE]; + shortsA = new short[SIZE]; + charsA = new char[SIZE]; + intsA = new int[SIZE]; + longsA = new long[SIZE]; + + bytesB = new byte[SIZE]; + shortsB = new short[SIZE]; + charsB = new char[SIZE]; + intsB = new int[SIZE]; + longsB = new long[SIZE]; + + for (int i = 0; i < SIZE; i++) { + bytesA[i] = (byte) r.nextInt(); + shortsA[i] = (short) r.nextInt(); + charsA[i] = (char) r.nextInt(); + intsA[i] = r.nextInt(); + longsA[i] = r.nextLong(); + } + } + + @Benchmark + public void rShiftByte() { + for (int i = 0; i < SIZE; i++) { + bytesB[i] = (byte) (bytesA[i] >> shiftCount); + } + } + + @Benchmark + public void urShiftByte() { + for (int i = 0; i < SIZE; i++) { + bytesB[i] = (byte) (bytesA[i] >>> shiftCount); + } + } + + @Benchmark + public void rShiftShort() { + for (int i = 0; i < SIZE; i++) { + shortsB[i] = (short) (shortsA[i] >> shiftCount); + } + } + + @Benchmark + public void urShiftChar() { + for (int i = 0; i < SIZE; i++) { + charsB[i] = (char) (charsA[i] >>> shiftCount); + } + } + + @Benchmark + public void rShiftInt() { + for (int i = 0; i < SIZE; i++) { + intsB[i] = intsA[i] >> shiftCount; + } + } + + @Benchmark + public void urShiftInt() { + for (int i = 0; i < SIZE; i++) { + intsB[i] = intsA[i] >>> shiftCount; + } + } + + @Benchmark + public void rShiftLong() { + for (int i = 0; i < SIZE; i++) { + longsB[i] = longsA[i] >> shiftCount; + } + } + + @Benchmark + public void urShiftLong() { + for (int i = 0; i < SIZE; i++) { + longsB[i] = longsA[i] >>> shiftCount; + } + } +} -- GitLab From 12693a6cf3e00c38a635d888419406f689657813 Mon Sep 17 00:00:00 2001 From: Xiaohong Gong Date: Wed, 9 Mar 2022 01:02:25 +0000 Subject: [PATCH 195/340] 8282432: Optimize masked "test" Vector API with predicate feature Reviewed-by: psandoz --- .../jdk/incubator/vector/Byte128Vector.java | 8 +- .../jdk/incubator/vector/Byte256Vector.java | 8 +- .../jdk/incubator/vector/Byte512Vector.java | 8 +- .../jdk/incubator/vector/Byte64Vector.java | 8 +- .../jdk/incubator/vector/ByteMaxVector.java | 8 +- .../jdk/incubator/vector/ByteVector.java | 35 ++++++-- .../jdk/incubator/vector/Double128Vector.java | 8 +- .../jdk/incubator/vector/Double256Vector.java | 8 +- .../jdk/incubator/vector/Double512Vector.java | 8 +- .../jdk/incubator/vector/Double64Vector.java | 8 +- .../jdk/incubator/vector/DoubleMaxVector.java | 8 +- .../jdk/incubator/vector/DoubleVector.java | 49 +++++++++-- .../jdk/incubator/vector/Float128Vector.java | 8 +- .../jdk/incubator/vector/Float256Vector.java | 8 +- .../jdk/incubator/vector/Float512Vector.java | 8 +- .../jdk/incubator/vector/Float64Vector.java | 8 +- .../jdk/incubator/vector/FloatMaxVector.java | 8 +- .../jdk/incubator/vector/FloatVector.java | 49 +++++++++-- .../jdk/incubator/vector/Int128Vector.java | 8 +- .../jdk/incubator/vector/Int256Vector.java | 8 +- .../jdk/incubator/vector/Int512Vector.java | 8 +- .../jdk/incubator/vector/Int64Vector.java | 8 +- .../jdk/incubator/vector/IntMaxVector.java | 8 +- .../jdk/incubator/vector/IntVector.java | 35 ++++++-- .../jdk/incubator/vector/Long128Vector.java | 8 +- .../jdk/incubator/vector/Long256Vector.java | 8 +- .../jdk/incubator/vector/Long512Vector.java | 8 +- .../jdk/incubator/vector/Long64Vector.java | 8 +- .../jdk/incubator/vector/LongMaxVector.java | 8 +- .../jdk/incubator/vector/LongVector.java | 35 ++++++-- .../jdk/incubator/vector/Short128Vector.java | 8 +- .../jdk/incubator/vector/Short256Vector.java | 8 +- .../jdk/incubator/vector/Short512Vector.java | 8 +- .../jdk/incubator/vector/Short64Vector.java | 8 +- .../jdk/incubator/vector/ShortMaxVector.java | 8 +- .../jdk/incubator/vector/ShortVector.java | 35 ++++++-- .../incubator/vector/X-Vector.java.template | 61 ++++++++++++-- .../vector/X-VectorBits.java.template | 8 +- .../incubator/vector/Byte128VectorTests.java | 34 ++++---- .../incubator/vector/Byte256VectorTests.java | 34 ++++---- .../incubator/vector/Byte512VectorTests.java | 34 ++++---- .../incubator/vector/Byte64VectorTests.java | 34 ++++---- .../incubator/vector/ByteMaxVectorTests.java | 34 ++++---- .../vector/Double128VectorTests.java | 82 +++++++++++-------- .../vector/Double256VectorTests.java | 82 +++++++++++-------- .../vector/Double512VectorTests.java | 82 +++++++++++-------- .../incubator/vector/Double64VectorTests.java | 82 +++++++++++-------- .../vector/DoubleMaxVectorTests.java | 82 +++++++++++-------- .../incubator/vector/Float128VectorTests.java | 82 +++++++++++-------- .../incubator/vector/Float256VectorTests.java | 82 +++++++++++-------- .../incubator/vector/Float512VectorTests.java | 82 +++++++++++-------- .../incubator/vector/Float64VectorTests.java | 82 +++++++++++-------- .../incubator/vector/FloatMaxVectorTests.java | 82 +++++++++++-------- .../incubator/vector/Int128VectorTests.java | 34 ++++---- .../incubator/vector/Int256VectorTests.java | 34 ++++---- .../incubator/vector/Int512VectorTests.java | 34 ++++---- .../incubator/vector/Int64VectorTests.java | 34 ++++---- .../incubator/vector/IntMaxVectorTests.java | 34 ++++---- .../incubator/vector/Long128VectorTests.java | 34 ++++---- .../incubator/vector/Long256VectorTests.java | 34 ++++---- .../incubator/vector/Long512VectorTests.java | 34 ++++---- .../incubator/vector/Long64VectorTests.java | 34 ++++---- .../incubator/vector/LongMaxVectorTests.java | 34 ++++---- .../incubator/vector/Short128VectorTests.java | 34 ++++---- .../incubator/vector/Short256VectorTests.java | 34 ++++---- .../incubator/vector/Short512VectorTests.java | 34 ++++---- .../incubator/vector/Short64VectorTests.java | 34 ++++---- .../incubator/vector/ShortMaxVectorTests.java | 34 ++++---- .../vector/templates/Unit-Test.template | 16 ++-- .../vector/templates/Unit-header.template | 2 +- 70 files changed, 1314 insertions(+), 751 deletions(-) diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Byte128Vector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Byte128Vector.java index e4fae8e0acf..86627f9f33d 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Byte128Vector.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Byte128Vector.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2022, 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 @@ -370,6 +370,12 @@ final class Byte128Vector extends ByteVector { return super.testTemplate(Byte128Mask.class, op); // specialize } + @Override + @ForceInline + public final Byte128Mask test(Test op, VectorMask m) { + return super.testTemplate(Byte128Mask.class, op, (Byte128Mask) m); // specialize + } + // Specialized comparisons @Override diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Byte256Vector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Byte256Vector.java index 7c123c893b4..f5f9977db08 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Byte256Vector.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Byte256Vector.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2022, 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 @@ -370,6 +370,12 @@ final class Byte256Vector extends ByteVector { return super.testTemplate(Byte256Mask.class, op); // specialize } + @Override + @ForceInline + public final Byte256Mask test(Test op, VectorMask m) { + return super.testTemplate(Byte256Mask.class, op, (Byte256Mask) m); // specialize + } + // Specialized comparisons @Override diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Byte512Vector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Byte512Vector.java index 1b63838b14c..e72dbed51dc 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Byte512Vector.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Byte512Vector.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2022, 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 @@ -370,6 +370,12 @@ final class Byte512Vector extends ByteVector { return super.testTemplate(Byte512Mask.class, op); // specialize } + @Override + @ForceInline + public final Byte512Mask test(Test op, VectorMask m) { + return super.testTemplate(Byte512Mask.class, op, (Byte512Mask) m); // specialize + } + // Specialized comparisons @Override diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Byte64Vector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Byte64Vector.java index 16010b7de09..c5e060b8de9 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Byte64Vector.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Byte64Vector.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2022, 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 @@ -370,6 +370,12 @@ final class Byte64Vector extends ByteVector { return super.testTemplate(Byte64Mask.class, op); // specialize } + @Override + @ForceInline + public final Byte64Mask test(Test op, VectorMask m) { + return super.testTemplate(Byte64Mask.class, op, (Byte64Mask) m); // specialize + } + // Specialized comparisons @Override diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/ByteMaxVector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/ByteMaxVector.java index fb36dab860c..5239cd33ea0 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/ByteMaxVector.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/ByteMaxVector.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2022, 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 @@ -370,6 +370,12 @@ final class ByteMaxVector extends ByteVector { return super.testTemplate(ByteMaxMask.class, op); // specialize } + @Override + @ForceInline + public final ByteMaxMask test(Test op, VectorMask m) { + return super.testTemplate(ByteMaxMask.class, op, (ByteMaxMask) m); // specialize + } + // Specialized comparisons @Override diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/ByteVector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/ByteVector.java index d67f86f7985..5bd14c97601 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/ByteVector.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/ByteVector.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2022, 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 @@ -1855,12 +1855,11 @@ public abstract class ByteVector extends AbstractVector { M testTemplate(Class maskType, Test op) { ByteSpecies vsp = vspecies(); if (opKind(op, VO_SPECIAL)) { - ByteVector bits = this.viewAsIntegralLanes(); VectorMask m; if (op == IS_DEFAULT) { - m = bits.compare(EQ, (byte) 0); + m = compare(EQ, (byte) 0); } else if (op == IS_NEGATIVE) { - m = bits.compare(LT, (byte) 0); + m = compare(LT, (byte) 0); } else { throw new AssertionError(op); @@ -1875,11 +1874,31 @@ public abstract class ByteVector extends AbstractVector { * {@inheritDoc} */ @Override - @ForceInline - public final + public abstract VectorMask test(VectorOperators.Test op, - VectorMask m) { - return test(op).and(m); + VectorMask m); + + /*package-private*/ + @ForceInline + final + > + M testTemplate(Class maskType, Test op, M mask) { + ByteSpecies vsp = vspecies(); + mask.check(maskType, this); + if (opKind(op, VO_SPECIAL)) { + VectorMask m = mask; + if (op == IS_DEFAULT) { + m = compare(EQ, (byte) 0, m); + } else if (op == IS_NEGATIVE) { + m = compare(LT, (byte) 0, m); + } + else { + throw new AssertionError(op); + } + return maskType.cast(m); + } + int opc = opCode(op); + throw new AssertionError(op); } /** diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Double128Vector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Double128Vector.java index d4762fe7796..24c32c848c3 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Double128Vector.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Double128Vector.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2022, 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 @@ -357,6 +357,12 @@ final class Double128Vector extends DoubleVector { return super.testTemplate(Double128Mask.class, op); // specialize } + @Override + @ForceInline + public final Double128Mask test(Test op, VectorMask m) { + return super.testTemplate(Double128Mask.class, op, (Double128Mask) m); // specialize + } + // Specialized comparisons @Override diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Double256Vector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Double256Vector.java index 147d6b866d6..e265dc86288 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Double256Vector.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Double256Vector.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2022, 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 @@ -357,6 +357,12 @@ final class Double256Vector extends DoubleVector { return super.testTemplate(Double256Mask.class, op); // specialize } + @Override + @ForceInline + public final Double256Mask test(Test op, VectorMask m) { + return super.testTemplate(Double256Mask.class, op, (Double256Mask) m); // specialize + } + // Specialized comparisons @Override diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Double512Vector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Double512Vector.java index e091ca9b63f..77b52f511d6 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Double512Vector.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Double512Vector.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2022, 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 @@ -357,6 +357,12 @@ final class Double512Vector extends DoubleVector { return super.testTemplate(Double512Mask.class, op); // specialize } + @Override + @ForceInline + public final Double512Mask test(Test op, VectorMask m) { + return super.testTemplate(Double512Mask.class, op, (Double512Mask) m); // specialize + } + // Specialized comparisons @Override diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Double64Vector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Double64Vector.java index a90ff9c761c..dba680a6a3c 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Double64Vector.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Double64Vector.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2022, 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 @@ -357,6 +357,12 @@ final class Double64Vector extends DoubleVector { return super.testTemplate(Double64Mask.class, op); // specialize } + @Override + @ForceInline + public final Double64Mask test(Test op, VectorMask m) { + return super.testTemplate(Double64Mask.class, op, (Double64Mask) m); // specialize + } + // Specialized comparisons @Override diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/DoubleMaxVector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/DoubleMaxVector.java index bf4ce4e6422..8c454d3f872 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/DoubleMaxVector.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/DoubleMaxVector.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2022, 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 @@ -357,6 +357,12 @@ final class DoubleMaxVector extends DoubleVector { return super.testTemplate(DoubleMaxMask.class, op); // specialize } + @Override + @ForceInline + public final DoubleMaxMask test(Test op, VectorMask m) { + return super.testTemplate(DoubleMaxMask.class, op, (DoubleMaxMask) m); // specialize + } + // Specialized comparisons @Override diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/DoubleVector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/DoubleVector.java index 063a4bbb191..aec717394ed 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/DoubleVector.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/DoubleVector.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2022, 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 @@ -1715,7 +1715,7 @@ public abstract class DoubleVector extends AbstractVector { else { throw new AssertionError(op); } - return maskType.cast(m.cast(this.vspecies())); + return maskType.cast(m.cast(vsp)); } int opc = opCode(op); throw new AssertionError(op); @@ -1725,11 +1725,48 @@ public abstract class DoubleVector extends AbstractVector { * {@inheritDoc} */ @Override - @ForceInline - public final + public abstract VectorMask test(VectorOperators.Test op, - VectorMask m) { - return test(op).and(m); + VectorMask m); + + /*package-private*/ + @ForceInline + final + > + M testTemplate(Class maskType, Test op, M mask) { + DoubleSpecies vsp = vspecies(); + mask.check(maskType, this); + if (opKind(op, VO_SPECIAL)) { + LongVector bits = this.viewAsIntegralLanes(); + VectorMask m = mask.cast(LongVector.species(shape())); + if (op == IS_DEFAULT) { + m = bits.compare(EQ, (long) 0, m); + } else if (op == IS_NEGATIVE) { + m = bits.compare(LT, (long) 0, m); + } + else if (op == IS_FINITE || + op == IS_NAN || + op == IS_INFINITE) { + // first kill the sign: + bits = bits.and(Long.MAX_VALUE); + // next find the bit pattern for infinity: + long infbits = (long) toBits(Double.POSITIVE_INFINITY); + // now compare: + if (op == IS_FINITE) { + m = bits.compare(LT, infbits, m); + } else if (op == IS_NAN) { + m = bits.compare(GT, infbits, m); + } else { + m = bits.compare(EQ, infbits, m); + } + } + else { + throw new AssertionError(op); + } + return maskType.cast(m.cast(vsp)); + } + int opc = opCode(op); + throw new AssertionError(op); } /** diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Float128Vector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Float128Vector.java index 88f6d76d0cb..1d6195486ae 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Float128Vector.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Float128Vector.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2022, 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 @@ -357,6 +357,12 @@ final class Float128Vector extends FloatVector { return super.testTemplate(Float128Mask.class, op); // specialize } + @Override + @ForceInline + public final Float128Mask test(Test op, VectorMask m) { + return super.testTemplate(Float128Mask.class, op, (Float128Mask) m); // specialize + } + // Specialized comparisons @Override diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Float256Vector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Float256Vector.java index 4b039df7984..6a2a1003cf4 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Float256Vector.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Float256Vector.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2022, 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 @@ -357,6 +357,12 @@ final class Float256Vector extends FloatVector { return super.testTemplate(Float256Mask.class, op); // specialize } + @Override + @ForceInline + public final Float256Mask test(Test op, VectorMask m) { + return super.testTemplate(Float256Mask.class, op, (Float256Mask) m); // specialize + } + // Specialized comparisons @Override diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Float512Vector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Float512Vector.java index 7864af72205..5b29c2cca10 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Float512Vector.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Float512Vector.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2022, 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 @@ -357,6 +357,12 @@ final class Float512Vector extends FloatVector { return super.testTemplate(Float512Mask.class, op); // specialize } + @Override + @ForceInline + public final Float512Mask test(Test op, VectorMask m) { + return super.testTemplate(Float512Mask.class, op, (Float512Mask) m); // specialize + } + // Specialized comparisons @Override diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Float64Vector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Float64Vector.java index bbdbcee1c5f..0eea80c244f 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Float64Vector.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Float64Vector.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2022, 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 @@ -357,6 +357,12 @@ final class Float64Vector extends FloatVector { return super.testTemplate(Float64Mask.class, op); // specialize } + @Override + @ForceInline + public final Float64Mask test(Test op, VectorMask m) { + return super.testTemplate(Float64Mask.class, op, (Float64Mask) m); // specialize + } + // Specialized comparisons @Override diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/FloatMaxVector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/FloatMaxVector.java index bba093b3b76..0db9aab9c57 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/FloatMaxVector.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/FloatMaxVector.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2022, 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 @@ -357,6 +357,12 @@ final class FloatMaxVector extends FloatVector { return super.testTemplate(FloatMaxMask.class, op); // specialize } + @Override + @ForceInline + public final FloatMaxMask test(Test op, VectorMask m) { + return super.testTemplate(FloatMaxMask.class, op, (FloatMaxMask) m); // specialize + } + // Specialized comparisons @Override diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/FloatVector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/FloatVector.java index f78d9814514..c55df4b72bd 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/FloatVector.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/FloatVector.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2022, 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 @@ -1727,7 +1727,7 @@ public abstract class FloatVector extends AbstractVector { else { throw new AssertionError(op); } - return maskType.cast(m.cast(this.vspecies())); + return maskType.cast(m.cast(vsp)); } int opc = opCode(op); throw new AssertionError(op); @@ -1737,11 +1737,48 @@ public abstract class FloatVector extends AbstractVector { * {@inheritDoc} */ @Override - @ForceInline - public final + public abstract VectorMask test(VectorOperators.Test op, - VectorMask m) { - return test(op).and(m); + VectorMask m); + + /*package-private*/ + @ForceInline + final + > + M testTemplate(Class maskType, Test op, M mask) { + FloatSpecies vsp = vspecies(); + mask.check(maskType, this); + if (opKind(op, VO_SPECIAL)) { + IntVector bits = this.viewAsIntegralLanes(); + VectorMask m = mask.cast(IntVector.species(shape())); + if (op == IS_DEFAULT) { + m = bits.compare(EQ, (int) 0, m); + } else if (op == IS_NEGATIVE) { + m = bits.compare(LT, (int) 0, m); + } + else if (op == IS_FINITE || + op == IS_NAN || + op == IS_INFINITE) { + // first kill the sign: + bits = bits.and(Integer.MAX_VALUE); + // next find the bit pattern for infinity: + int infbits = (int) toBits(Float.POSITIVE_INFINITY); + // now compare: + if (op == IS_FINITE) { + m = bits.compare(LT, infbits, m); + } else if (op == IS_NAN) { + m = bits.compare(GT, infbits, m); + } else { + m = bits.compare(EQ, infbits, m); + } + } + else { + throw new AssertionError(op); + } + return maskType.cast(m.cast(vsp)); + } + int opc = opCode(op); + throw new AssertionError(op); } /** diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Int128Vector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Int128Vector.java index 3a88ba76e80..3baf712aa7c 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Int128Vector.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Int128Vector.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2022, 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 @@ -370,6 +370,12 @@ final class Int128Vector extends IntVector { return super.testTemplate(Int128Mask.class, op); // specialize } + @Override + @ForceInline + public final Int128Mask test(Test op, VectorMask m) { + return super.testTemplate(Int128Mask.class, op, (Int128Mask) m); // specialize + } + // Specialized comparisons @Override diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Int256Vector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Int256Vector.java index ffc560e5f52..a82f1cf1d07 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Int256Vector.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Int256Vector.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2022, 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 @@ -370,6 +370,12 @@ final class Int256Vector extends IntVector { return super.testTemplate(Int256Mask.class, op); // specialize } + @Override + @ForceInline + public final Int256Mask test(Test op, VectorMask m) { + return super.testTemplate(Int256Mask.class, op, (Int256Mask) m); // specialize + } + // Specialized comparisons @Override diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Int512Vector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Int512Vector.java index a2ff6d515e3..40b7246b63f 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Int512Vector.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Int512Vector.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2022, 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 @@ -370,6 +370,12 @@ final class Int512Vector extends IntVector { return super.testTemplate(Int512Mask.class, op); // specialize } + @Override + @ForceInline + public final Int512Mask test(Test op, VectorMask m) { + return super.testTemplate(Int512Mask.class, op, (Int512Mask) m); // specialize + } + // Specialized comparisons @Override diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Int64Vector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Int64Vector.java index 996f35ac15d..59c54a6007b 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Int64Vector.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Int64Vector.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2022, 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 @@ -370,6 +370,12 @@ final class Int64Vector extends IntVector { return super.testTemplate(Int64Mask.class, op); // specialize } + @Override + @ForceInline + public final Int64Mask test(Test op, VectorMask m) { + return super.testTemplate(Int64Mask.class, op, (Int64Mask) m); // specialize + } + // Specialized comparisons @Override diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/IntMaxVector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/IntMaxVector.java index cfc645fcd6b..58588448c06 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/IntMaxVector.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/IntMaxVector.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2022, 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 @@ -370,6 +370,12 @@ final class IntMaxVector extends IntVector { return super.testTemplate(IntMaxMask.class, op); // specialize } + @Override + @ForceInline + public final IntMaxMask test(Test op, VectorMask m) { + return super.testTemplate(IntMaxMask.class, op, (IntMaxMask) m); // specialize + } + // Specialized comparisons @Override diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/IntVector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/IntVector.java index c80b61cb7a2..312e1ad725a 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/IntVector.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/IntVector.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2022, 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 @@ -1854,12 +1854,11 @@ public abstract class IntVector extends AbstractVector { M testTemplate(Class maskType, Test op) { IntSpecies vsp = vspecies(); if (opKind(op, VO_SPECIAL)) { - IntVector bits = this.viewAsIntegralLanes(); VectorMask m; if (op == IS_DEFAULT) { - m = bits.compare(EQ, (int) 0); + m = compare(EQ, (int) 0); } else if (op == IS_NEGATIVE) { - m = bits.compare(LT, (int) 0); + m = compare(LT, (int) 0); } else { throw new AssertionError(op); @@ -1874,11 +1873,31 @@ public abstract class IntVector extends AbstractVector { * {@inheritDoc} */ @Override - @ForceInline - public final + public abstract VectorMask test(VectorOperators.Test op, - VectorMask m) { - return test(op).and(m); + VectorMask m); + + /*package-private*/ + @ForceInline + final + > + M testTemplate(Class maskType, Test op, M mask) { + IntSpecies vsp = vspecies(); + mask.check(maskType, this); + if (opKind(op, VO_SPECIAL)) { + VectorMask m = mask; + if (op == IS_DEFAULT) { + m = compare(EQ, (int) 0, m); + } else if (op == IS_NEGATIVE) { + m = compare(LT, (int) 0, m); + } + else { + throw new AssertionError(op); + } + return maskType.cast(m); + } + int opc = opCode(op); + throw new AssertionError(op); } /** diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Long128Vector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Long128Vector.java index aad676d8fce..7a11c0005a4 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Long128Vector.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Long128Vector.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2022, 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 @@ -365,6 +365,12 @@ final class Long128Vector extends LongVector { return super.testTemplate(Long128Mask.class, op); // specialize } + @Override + @ForceInline + public final Long128Mask test(Test op, VectorMask m) { + return super.testTemplate(Long128Mask.class, op, (Long128Mask) m); // specialize + } + // Specialized comparisons @Override diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Long256Vector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Long256Vector.java index 85f1e54f242..ad4057dc070 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Long256Vector.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Long256Vector.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2022, 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 @@ -365,6 +365,12 @@ final class Long256Vector extends LongVector { return super.testTemplate(Long256Mask.class, op); // specialize } + @Override + @ForceInline + public final Long256Mask test(Test op, VectorMask m) { + return super.testTemplate(Long256Mask.class, op, (Long256Mask) m); // specialize + } + // Specialized comparisons @Override diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Long512Vector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Long512Vector.java index 1642b885f34..6f7bee397a1 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Long512Vector.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Long512Vector.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2022, 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 @@ -365,6 +365,12 @@ final class Long512Vector extends LongVector { return super.testTemplate(Long512Mask.class, op); // specialize } + @Override + @ForceInline + public final Long512Mask test(Test op, VectorMask m) { + return super.testTemplate(Long512Mask.class, op, (Long512Mask) m); // specialize + } + // Specialized comparisons @Override diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Long64Vector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Long64Vector.java index 3e67506c392..e7ab1241f4e 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Long64Vector.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Long64Vector.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2022, 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 @@ -365,6 +365,12 @@ final class Long64Vector extends LongVector { return super.testTemplate(Long64Mask.class, op); // specialize } + @Override + @ForceInline + public final Long64Mask test(Test op, VectorMask m) { + return super.testTemplate(Long64Mask.class, op, (Long64Mask) m); // specialize + } + // Specialized comparisons @Override diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/LongMaxVector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/LongMaxVector.java index 2078dbec65b..56ce68f1fc3 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/LongMaxVector.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/LongMaxVector.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2022, 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 @@ -365,6 +365,12 @@ final class LongMaxVector extends LongVector { return super.testTemplate(LongMaxMask.class, op); // specialize } + @Override + @ForceInline + public final LongMaxMask test(Test op, VectorMask m) { + return super.testTemplate(LongMaxMask.class, op, (LongMaxMask) m); // specialize + } + // Specialized comparisons @Override diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/LongVector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/LongVector.java index 6934469b213..513178181f4 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/LongVector.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/LongVector.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2022, 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 @@ -1767,12 +1767,11 @@ public abstract class LongVector extends AbstractVector { M testTemplate(Class maskType, Test op) { LongSpecies vsp = vspecies(); if (opKind(op, VO_SPECIAL)) { - LongVector bits = this.viewAsIntegralLanes(); VectorMask m; if (op == IS_DEFAULT) { - m = bits.compare(EQ, (long) 0); + m = compare(EQ, (long) 0); } else if (op == IS_NEGATIVE) { - m = bits.compare(LT, (long) 0); + m = compare(LT, (long) 0); } else { throw new AssertionError(op); @@ -1787,11 +1786,31 @@ public abstract class LongVector extends AbstractVector { * {@inheritDoc} */ @Override - @ForceInline - public final + public abstract VectorMask test(VectorOperators.Test op, - VectorMask m) { - return test(op).and(m); + VectorMask m); + + /*package-private*/ + @ForceInline + final + > + M testTemplate(Class maskType, Test op, M mask) { + LongSpecies vsp = vspecies(); + mask.check(maskType, this); + if (opKind(op, VO_SPECIAL)) { + VectorMask m = mask; + if (op == IS_DEFAULT) { + m = compare(EQ, (long) 0, m); + } else if (op == IS_NEGATIVE) { + m = compare(LT, (long) 0, m); + } + else { + throw new AssertionError(op); + } + return maskType.cast(m); + } + int opc = opCode(op); + throw new AssertionError(op); } /** diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Short128Vector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Short128Vector.java index 93bf40153a7..ce7e3ca8c18 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Short128Vector.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Short128Vector.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2022, 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 @@ -370,6 +370,12 @@ final class Short128Vector extends ShortVector { return super.testTemplate(Short128Mask.class, op); // specialize } + @Override + @ForceInline + public final Short128Mask test(Test op, VectorMask m) { + return super.testTemplate(Short128Mask.class, op, (Short128Mask) m); // specialize + } + // Specialized comparisons @Override diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Short256Vector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Short256Vector.java index 805f89bcdd9..3d7b00ddcd0 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Short256Vector.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Short256Vector.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2022, 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 @@ -370,6 +370,12 @@ final class Short256Vector extends ShortVector { return super.testTemplate(Short256Mask.class, op); // specialize } + @Override + @ForceInline + public final Short256Mask test(Test op, VectorMask m) { + return super.testTemplate(Short256Mask.class, op, (Short256Mask) m); // specialize + } + // Specialized comparisons @Override diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Short512Vector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Short512Vector.java index 51d72852938..2d23dcae93f 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Short512Vector.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Short512Vector.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2022, 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 @@ -370,6 +370,12 @@ final class Short512Vector extends ShortVector { return super.testTemplate(Short512Mask.class, op); // specialize } + @Override + @ForceInline + public final Short512Mask test(Test op, VectorMask m) { + return super.testTemplate(Short512Mask.class, op, (Short512Mask) m); // specialize + } + // Specialized comparisons @Override diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Short64Vector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Short64Vector.java index 97ac8fe07cb..f7e0c0162d3 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Short64Vector.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Short64Vector.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2022, 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 @@ -370,6 +370,12 @@ final class Short64Vector extends ShortVector { return super.testTemplate(Short64Mask.class, op); // specialize } + @Override + @ForceInline + public final Short64Mask test(Test op, VectorMask m) { + return super.testTemplate(Short64Mask.class, op, (Short64Mask) m); // specialize + } + // Specialized comparisons @Override diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/ShortMaxVector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/ShortMaxVector.java index c0ec9ee8b4e..154096d9d6f 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/ShortMaxVector.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/ShortMaxVector.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2022, 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 @@ -370,6 +370,12 @@ final class ShortMaxVector extends ShortVector { return super.testTemplate(ShortMaxMask.class, op); // specialize } + @Override + @ForceInline + public final ShortMaxMask test(Test op, VectorMask m) { + return super.testTemplate(ShortMaxMask.class, op, (ShortMaxMask) m); // specialize + } + // Specialized comparisons @Override diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/ShortVector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/ShortVector.java index b3c89e87cc4..511e10a6563 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/ShortVector.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/ShortVector.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2022, 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 @@ -1855,12 +1855,11 @@ public abstract class ShortVector extends AbstractVector { M testTemplate(Class maskType, Test op) { ShortSpecies vsp = vspecies(); if (opKind(op, VO_SPECIAL)) { - ShortVector bits = this.viewAsIntegralLanes(); VectorMask m; if (op == IS_DEFAULT) { - m = bits.compare(EQ, (short) 0); + m = compare(EQ, (short) 0); } else if (op == IS_NEGATIVE) { - m = bits.compare(LT, (short) 0); + m = compare(LT, (short) 0); } else { throw new AssertionError(op); @@ -1875,11 +1874,31 @@ public abstract class ShortVector extends AbstractVector { * {@inheritDoc} */ @Override - @ForceInline - public final + public abstract VectorMask test(VectorOperators.Test op, - VectorMask m) { - return test(op).and(m); + VectorMask m); + + /*package-private*/ + @ForceInline + final + > + M testTemplate(Class maskType, Test op, M mask) { + ShortSpecies vsp = vspecies(); + mask.check(maskType, this); + if (opKind(op, VO_SPECIAL)) { + VectorMask m = mask; + if (op == IS_DEFAULT) { + m = compare(EQ, (short) 0, m); + } else if (op == IS_NEGATIVE) { + m = compare(LT, (short) 0, m); + } + else { + throw new AssertionError(op); + } + return maskType.cast(m); + } + int opc = opCode(op); + throw new AssertionError(op); } /** diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/X-Vector.java.template b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/X-Vector.java.template index 1cd50a11b8b..16d2dbea06e 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/X-Vector.java.template +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/X-Vector.java.template @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2022, 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 @@ -2128,12 +2128,14 @@ public abstract class $abstractvectortype$ extends AbstractVector<$Boxtype$> { M testTemplate(Class maskType, Test op) { $Type$Species vsp = vspecies(); if (opKind(op, VO_SPECIAL)) { +#if[FP] $Bitstype$Vector bits = this.viewAsIntegralLanes(); +#end[FP] VectorMask<$Boxbitstype$> m; if (op == IS_DEFAULT) { - m = bits.compare(EQ, ($bitstype$) 0); + m = {#if[FP]?bits.}compare(EQ, ($bitstype$) 0); } else if (op == IS_NEGATIVE) { - m = bits.compare(LT, ($bitstype$) 0); + m = {#if[FP]?bits.}compare(LT, ($bitstype$) 0); } #if[FP] else if (op == IS_FINITE || @@ -2156,7 +2158,7 @@ public abstract class $abstractvectortype$ extends AbstractVector<$Boxtype$> { else { throw new AssertionError(op); } - return maskType.cast(m{#if[FP]?.cast(this.vspecies())}); + return maskType.cast(m{#if[FP]?.cast(vsp)}); } int opc = opCode(op); throw new AssertionError(op); @@ -2166,11 +2168,54 @@ public abstract class $abstractvectortype$ extends AbstractVector<$Boxtype$> { * {@inheritDoc} */ @Override - @ForceInline - public final + public abstract VectorMask<$Boxtype$> test(VectorOperators.Test op, - VectorMask<$Boxtype$> m) { - return test(op).and(m); + VectorMask<$Boxtype$> m); + + /*package-private*/ + @ForceInline + final + > + M testTemplate(Class maskType, Test op, M mask) { + $Type$Species vsp = vspecies(); + mask.check(maskType, this); + if (opKind(op, VO_SPECIAL)) { +#if[FP] + $Bitstype$Vector bits = this.viewAsIntegralLanes(); + VectorMask<$Boxbitstype$> m = mask.cast($Bitstype$Vector.species(shape())); +#else[FP] + VectorMask<$Boxbitstype$> m = mask; +#end[FP] + if (op == IS_DEFAULT) { + m = {#if[FP]?bits.}compare(EQ, ($bitstype$) 0, m); + } else if (op == IS_NEGATIVE) { + m = {#if[FP]?bits.}compare(LT, ($bitstype$) 0, m); + } +#if[FP] + else if (op == IS_FINITE || + op == IS_NAN || + op == IS_INFINITE) { + // first kill the sign: + bits = bits.and($Boxbitstype$.MAX_VALUE); + // next find the bit pattern for infinity: + $bitstype$ infbits = ($bitstype$) toBits($Boxtype$.POSITIVE_INFINITY); + // now compare: + if (op == IS_FINITE) { + m = bits.compare(LT, infbits, m); + } else if (op == IS_NAN) { + m = bits.compare(GT, infbits, m); + } else { + m = bits.compare(EQ, infbits, m); + } + } +#end[FP] + else { + throw new AssertionError(op); + } + return maskType.cast(m{#if[FP]?.cast(vsp)}); + } + int opc = opCode(op); + throw new AssertionError(op); } /** diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/X-VectorBits.java.template b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/X-VectorBits.java.template index 2f1004f6450..ec6e714f218 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/X-VectorBits.java.template +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/X-VectorBits.java.template @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2022, 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 @@ -374,6 +374,12 @@ final class $vectortype$ extends $abstractvectortype$ { return super.testTemplate($masktype$.class, op); // specialize } + @Override + @ForceInline + public final $masktype$ test(Test op, VectorMask<$Boxtype$> m) { + return super.testTemplate($masktype$.class, op, ($masktype$) m); // specialize + } + // Specialized comparisons @Override diff --git a/test/jdk/jdk/incubator/vector/Byte128VectorTests.java b/test/jdk/jdk/incubator/vector/Byte128VectorTests.java index 22e07e05a06..e7e97452b16 100644 --- a/test/jdk/jdk/incubator/vector/Byte128VectorTests.java +++ b/test/jdk/jdk/incubator/vector/Byte128VectorTests.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2022, 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 @@ -3564,19 +3564,21 @@ public class Byte128VectorTests extends AbstractVectorTest { } @Test(dataProvider = "byteTestOpMaskProvider") - static void IS_DEFAULTMaskedByte128VectorTestsSmokeTest(IntFunction fa, + static void IS_DEFAULTMaskedByte128VectorTests(IntFunction fa, IntFunction fm) { byte[] a = fa.apply(SPECIES.length()); boolean[] mask = fm.apply(SPECIES.length()); VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0); - for (int i = 0; i < a.length; i += SPECIES.length()) { - ByteVector av = ByteVector.fromArray(SPECIES, a, i); - VectorMask mv = av.test(VectorOperators.IS_DEFAULT, vmask); + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + ByteVector av = ByteVector.fromArray(SPECIES, a, i); + VectorMask mv = av.test(VectorOperators.IS_DEFAULT, vmask); - // Check results as part of computation. - for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); + // Check results as part of computation. + for (int j = 0; j < SPECIES.length(); j++) { + Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); + } } } } @@ -3602,19 +3604,21 @@ public class Byte128VectorTests extends AbstractVectorTest { } @Test(dataProvider = "byteTestOpMaskProvider") - static void IS_NEGATIVEMaskedByte128VectorTestsSmokeTest(IntFunction fa, + static void IS_NEGATIVEMaskedByte128VectorTests(IntFunction fa, IntFunction fm) { byte[] a = fa.apply(SPECIES.length()); boolean[] mask = fm.apply(SPECIES.length()); VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0); - for (int i = 0; i < a.length; i += SPECIES.length()) { - ByteVector av = ByteVector.fromArray(SPECIES, a, i); - VectorMask mv = av.test(VectorOperators.IS_NEGATIVE, vmask); + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + ByteVector av = ByteVector.fromArray(SPECIES, a, i); + VectorMask mv = av.test(VectorOperators.IS_NEGATIVE, vmask); - // Check results as part of computation. - for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); + // Check results as part of computation. + for (int j = 0; j < SPECIES.length(); j++) { + Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); + } } } } diff --git a/test/jdk/jdk/incubator/vector/Byte256VectorTests.java b/test/jdk/jdk/incubator/vector/Byte256VectorTests.java index 9a631c47993..aa14ff55a6d 100644 --- a/test/jdk/jdk/incubator/vector/Byte256VectorTests.java +++ b/test/jdk/jdk/incubator/vector/Byte256VectorTests.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2022, 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 @@ -3564,19 +3564,21 @@ public class Byte256VectorTests extends AbstractVectorTest { } @Test(dataProvider = "byteTestOpMaskProvider") - static void IS_DEFAULTMaskedByte256VectorTestsSmokeTest(IntFunction fa, + static void IS_DEFAULTMaskedByte256VectorTests(IntFunction fa, IntFunction fm) { byte[] a = fa.apply(SPECIES.length()); boolean[] mask = fm.apply(SPECIES.length()); VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0); - for (int i = 0; i < a.length; i += SPECIES.length()) { - ByteVector av = ByteVector.fromArray(SPECIES, a, i); - VectorMask mv = av.test(VectorOperators.IS_DEFAULT, vmask); + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + ByteVector av = ByteVector.fromArray(SPECIES, a, i); + VectorMask mv = av.test(VectorOperators.IS_DEFAULT, vmask); - // Check results as part of computation. - for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); + // Check results as part of computation. + for (int j = 0; j < SPECIES.length(); j++) { + Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); + } } } } @@ -3602,19 +3604,21 @@ public class Byte256VectorTests extends AbstractVectorTest { } @Test(dataProvider = "byteTestOpMaskProvider") - static void IS_NEGATIVEMaskedByte256VectorTestsSmokeTest(IntFunction fa, + static void IS_NEGATIVEMaskedByte256VectorTests(IntFunction fa, IntFunction fm) { byte[] a = fa.apply(SPECIES.length()); boolean[] mask = fm.apply(SPECIES.length()); VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0); - for (int i = 0; i < a.length; i += SPECIES.length()) { - ByteVector av = ByteVector.fromArray(SPECIES, a, i); - VectorMask mv = av.test(VectorOperators.IS_NEGATIVE, vmask); + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + ByteVector av = ByteVector.fromArray(SPECIES, a, i); + VectorMask mv = av.test(VectorOperators.IS_NEGATIVE, vmask); - // Check results as part of computation. - for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); + // Check results as part of computation. + for (int j = 0; j < SPECIES.length(); j++) { + Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); + } } } } diff --git a/test/jdk/jdk/incubator/vector/Byte512VectorTests.java b/test/jdk/jdk/incubator/vector/Byte512VectorTests.java index 203f233e4e8..c16f5d7d296 100644 --- a/test/jdk/jdk/incubator/vector/Byte512VectorTests.java +++ b/test/jdk/jdk/incubator/vector/Byte512VectorTests.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2022, 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 @@ -3564,19 +3564,21 @@ public class Byte512VectorTests extends AbstractVectorTest { } @Test(dataProvider = "byteTestOpMaskProvider") - static void IS_DEFAULTMaskedByte512VectorTestsSmokeTest(IntFunction fa, + static void IS_DEFAULTMaskedByte512VectorTests(IntFunction fa, IntFunction fm) { byte[] a = fa.apply(SPECIES.length()); boolean[] mask = fm.apply(SPECIES.length()); VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0); - for (int i = 0; i < a.length; i += SPECIES.length()) { - ByteVector av = ByteVector.fromArray(SPECIES, a, i); - VectorMask mv = av.test(VectorOperators.IS_DEFAULT, vmask); + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + ByteVector av = ByteVector.fromArray(SPECIES, a, i); + VectorMask mv = av.test(VectorOperators.IS_DEFAULT, vmask); - // Check results as part of computation. - for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); + // Check results as part of computation. + for (int j = 0; j < SPECIES.length(); j++) { + Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); + } } } } @@ -3602,19 +3604,21 @@ public class Byte512VectorTests extends AbstractVectorTest { } @Test(dataProvider = "byteTestOpMaskProvider") - static void IS_NEGATIVEMaskedByte512VectorTestsSmokeTest(IntFunction fa, + static void IS_NEGATIVEMaskedByte512VectorTests(IntFunction fa, IntFunction fm) { byte[] a = fa.apply(SPECIES.length()); boolean[] mask = fm.apply(SPECIES.length()); VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0); - for (int i = 0; i < a.length; i += SPECIES.length()) { - ByteVector av = ByteVector.fromArray(SPECIES, a, i); - VectorMask mv = av.test(VectorOperators.IS_NEGATIVE, vmask); + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + ByteVector av = ByteVector.fromArray(SPECIES, a, i); + VectorMask mv = av.test(VectorOperators.IS_NEGATIVE, vmask); - // Check results as part of computation. - for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); + // Check results as part of computation. + for (int j = 0; j < SPECIES.length(); j++) { + Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); + } } } } diff --git a/test/jdk/jdk/incubator/vector/Byte64VectorTests.java b/test/jdk/jdk/incubator/vector/Byte64VectorTests.java index 110e741ea43..b47c7be7ed7 100644 --- a/test/jdk/jdk/incubator/vector/Byte64VectorTests.java +++ b/test/jdk/jdk/incubator/vector/Byte64VectorTests.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2022, 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 @@ -3564,19 +3564,21 @@ public class Byte64VectorTests extends AbstractVectorTest { } @Test(dataProvider = "byteTestOpMaskProvider") - static void IS_DEFAULTMaskedByte64VectorTestsSmokeTest(IntFunction fa, + static void IS_DEFAULTMaskedByte64VectorTests(IntFunction fa, IntFunction fm) { byte[] a = fa.apply(SPECIES.length()); boolean[] mask = fm.apply(SPECIES.length()); VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0); - for (int i = 0; i < a.length; i += SPECIES.length()) { - ByteVector av = ByteVector.fromArray(SPECIES, a, i); - VectorMask mv = av.test(VectorOperators.IS_DEFAULT, vmask); + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + ByteVector av = ByteVector.fromArray(SPECIES, a, i); + VectorMask mv = av.test(VectorOperators.IS_DEFAULT, vmask); - // Check results as part of computation. - for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); + // Check results as part of computation. + for (int j = 0; j < SPECIES.length(); j++) { + Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); + } } } } @@ -3602,19 +3604,21 @@ public class Byte64VectorTests extends AbstractVectorTest { } @Test(dataProvider = "byteTestOpMaskProvider") - static void IS_NEGATIVEMaskedByte64VectorTestsSmokeTest(IntFunction fa, + static void IS_NEGATIVEMaskedByte64VectorTests(IntFunction fa, IntFunction fm) { byte[] a = fa.apply(SPECIES.length()); boolean[] mask = fm.apply(SPECIES.length()); VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0); - for (int i = 0; i < a.length; i += SPECIES.length()) { - ByteVector av = ByteVector.fromArray(SPECIES, a, i); - VectorMask mv = av.test(VectorOperators.IS_NEGATIVE, vmask); + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + ByteVector av = ByteVector.fromArray(SPECIES, a, i); + VectorMask mv = av.test(VectorOperators.IS_NEGATIVE, vmask); - // Check results as part of computation. - for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); + // Check results as part of computation. + for (int j = 0; j < SPECIES.length(); j++) { + Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); + } } } } diff --git a/test/jdk/jdk/incubator/vector/ByteMaxVectorTests.java b/test/jdk/jdk/incubator/vector/ByteMaxVectorTests.java index e4a9ebf19f5..7499c29fd50 100644 --- a/test/jdk/jdk/incubator/vector/ByteMaxVectorTests.java +++ b/test/jdk/jdk/incubator/vector/ByteMaxVectorTests.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2022, 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 @@ -3569,19 +3569,21 @@ public class ByteMaxVectorTests extends AbstractVectorTest { } @Test(dataProvider = "byteTestOpMaskProvider") - static void IS_DEFAULTMaskedByteMaxVectorTestsSmokeTest(IntFunction fa, + static void IS_DEFAULTMaskedByteMaxVectorTests(IntFunction fa, IntFunction fm) { byte[] a = fa.apply(SPECIES.length()); boolean[] mask = fm.apply(SPECIES.length()); VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0); - for (int i = 0; i < a.length; i += SPECIES.length()) { - ByteVector av = ByteVector.fromArray(SPECIES, a, i); - VectorMask mv = av.test(VectorOperators.IS_DEFAULT, vmask); + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + ByteVector av = ByteVector.fromArray(SPECIES, a, i); + VectorMask mv = av.test(VectorOperators.IS_DEFAULT, vmask); - // Check results as part of computation. - for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); + // Check results as part of computation. + for (int j = 0; j < SPECIES.length(); j++) { + Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); + } } } } @@ -3607,19 +3609,21 @@ public class ByteMaxVectorTests extends AbstractVectorTest { } @Test(dataProvider = "byteTestOpMaskProvider") - static void IS_NEGATIVEMaskedByteMaxVectorTestsSmokeTest(IntFunction fa, + static void IS_NEGATIVEMaskedByteMaxVectorTests(IntFunction fa, IntFunction fm) { byte[] a = fa.apply(SPECIES.length()); boolean[] mask = fm.apply(SPECIES.length()); VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0); - for (int i = 0; i < a.length; i += SPECIES.length()) { - ByteVector av = ByteVector.fromArray(SPECIES, a, i); - VectorMask mv = av.test(VectorOperators.IS_NEGATIVE, vmask); + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + ByteVector av = ByteVector.fromArray(SPECIES, a, i); + VectorMask mv = av.test(VectorOperators.IS_NEGATIVE, vmask); - // Check results as part of computation. - for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); + // Check results as part of computation. + for (int j = 0; j < SPECIES.length(); j++) { + Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); + } } } } diff --git a/test/jdk/jdk/incubator/vector/Double128VectorTests.java b/test/jdk/jdk/incubator/vector/Double128VectorTests.java index c79b1e2f4ef..15a55af00c0 100644 --- a/test/jdk/jdk/incubator/vector/Double128VectorTests.java +++ b/test/jdk/jdk/incubator/vector/Double128VectorTests.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2022, 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 @@ -2577,19 +2577,21 @@ public class Double128VectorTests extends AbstractVectorTest { } @Test(dataProvider = "doubleTestOpMaskProvider") - static void IS_DEFAULTMaskedDouble128VectorTestsSmokeTest(IntFunction fa, + static void IS_DEFAULTMaskedDouble128VectorTests(IntFunction fa, IntFunction fm) { double[] a = fa.apply(SPECIES.length()); boolean[] mask = fm.apply(SPECIES.length()); VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0); - for (int i = 0; i < a.length; i += SPECIES.length()) { - DoubleVector av = DoubleVector.fromArray(SPECIES, a, i); - VectorMask mv = av.test(VectorOperators.IS_DEFAULT, vmask); + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + DoubleVector av = DoubleVector.fromArray(SPECIES, a, i); + VectorMask mv = av.test(VectorOperators.IS_DEFAULT, vmask); - // Check results as part of computation. - for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); + // Check results as part of computation. + for (int j = 0; j < SPECIES.length(); j++) { + Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); + } } } } @@ -2615,19 +2617,21 @@ public class Double128VectorTests extends AbstractVectorTest { } @Test(dataProvider = "doubleTestOpMaskProvider") - static void IS_NEGATIVEMaskedDouble128VectorTestsSmokeTest(IntFunction fa, + static void IS_NEGATIVEMaskedDouble128VectorTests(IntFunction fa, IntFunction fm) { double[] a = fa.apply(SPECIES.length()); boolean[] mask = fm.apply(SPECIES.length()); VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0); - for (int i = 0; i < a.length; i += SPECIES.length()) { - DoubleVector av = DoubleVector.fromArray(SPECIES, a, i); - VectorMask mv = av.test(VectorOperators.IS_NEGATIVE, vmask); + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + DoubleVector av = DoubleVector.fromArray(SPECIES, a, i); + VectorMask mv = av.test(VectorOperators.IS_NEGATIVE, vmask); - // Check results as part of computation. - for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); + // Check results as part of computation. + for (int j = 0; j < SPECIES.length(); j++) { + Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); + } } } } @@ -2654,19 +2658,21 @@ public class Double128VectorTests extends AbstractVectorTest { } @Test(dataProvider = "doubleTestOpMaskProvider") - static void IS_FINITEMaskedDouble128VectorTestsSmokeTest(IntFunction fa, + static void IS_FINITEMaskedDouble128VectorTests(IntFunction fa, IntFunction fm) { double[] a = fa.apply(SPECIES.length()); boolean[] mask = fm.apply(SPECIES.length()); VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0); - for (int i = 0; i < a.length; i += SPECIES.length()) { - DoubleVector av = DoubleVector.fromArray(SPECIES, a, i); - VectorMask mv = av.test(VectorOperators.IS_FINITE, vmask); + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + DoubleVector av = DoubleVector.fromArray(SPECIES, a, i); + VectorMask mv = av.test(VectorOperators.IS_FINITE, vmask); - // Check results as part of computation. - for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_FINITE(a[i + j])); + // Check results as part of computation. + for (int j = 0; j < SPECIES.length(); j++) { + Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_FINITE(a[i + j])); + } } } } @@ -2694,19 +2700,21 @@ public class Double128VectorTests extends AbstractVectorTest { } @Test(dataProvider = "doubleTestOpMaskProvider") - static void IS_NANMaskedDouble128VectorTestsSmokeTest(IntFunction fa, + static void IS_NANMaskedDouble128VectorTests(IntFunction fa, IntFunction fm) { double[] a = fa.apply(SPECIES.length()); boolean[] mask = fm.apply(SPECIES.length()); VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0); - for (int i = 0; i < a.length; i += SPECIES.length()) { - DoubleVector av = DoubleVector.fromArray(SPECIES, a, i); - VectorMask mv = av.test(VectorOperators.IS_NAN, vmask); + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + DoubleVector av = DoubleVector.fromArray(SPECIES, a, i); + VectorMask mv = av.test(VectorOperators.IS_NAN, vmask); - // Check results as part of computation. - for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NAN(a[i + j])); + // Check results as part of computation. + for (int j = 0; j < SPECIES.length(); j++) { + Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NAN(a[i + j])); + } } } } @@ -2734,19 +2742,21 @@ public class Double128VectorTests extends AbstractVectorTest { } @Test(dataProvider = "doubleTestOpMaskProvider") - static void IS_INFINITEMaskedDouble128VectorTestsSmokeTest(IntFunction fa, + static void IS_INFINITEMaskedDouble128VectorTests(IntFunction fa, IntFunction fm) { double[] a = fa.apply(SPECIES.length()); boolean[] mask = fm.apply(SPECIES.length()); VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0); - for (int i = 0; i < a.length; i += SPECIES.length()) { - DoubleVector av = DoubleVector.fromArray(SPECIES, a, i); - VectorMask mv = av.test(VectorOperators.IS_INFINITE, vmask); + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + DoubleVector av = DoubleVector.fromArray(SPECIES, a, i); + VectorMask mv = av.test(VectorOperators.IS_INFINITE, vmask); - // Check results as part of computation. - for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_INFINITE(a[i + j])); + // Check results as part of computation. + for (int j = 0; j < SPECIES.length(); j++) { + Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_INFINITE(a[i + j])); + } } } } diff --git a/test/jdk/jdk/incubator/vector/Double256VectorTests.java b/test/jdk/jdk/incubator/vector/Double256VectorTests.java index 6d459901d13..6a9e85129c2 100644 --- a/test/jdk/jdk/incubator/vector/Double256VectorTests.java +++ b/test/jdk/jdk/incubator/vector/Double256VectorTests.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2022, 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 @@ -2577,19 +2577,21 @@ public class Double256VectorTests extends AbstractVectorTest { } @Test(dataProvider = "doubleTestOpMaskProvider") - static void IS_DEFAULTMaskedDouble256VectorTestsSmokeTest(IntFunction fa, + static void IS_DEFAULTMaskedDouble256VectorTests(IntFunction fa, IntFunction fm) { double[] a = fa.apply(SPECIES.length()); boolean[] mask = fm.apply(SPECIES.length()); VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0); - for (int i = 0; i < a.length; i += SPECIES.length()) { - DoubleVector av = DoubleVector.fromArray(SPECIES, a, i); - VectorMask mv = av.test(VectorOperators.IS_DEFAULT, vmask); + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + DoubleVector av = DoubleVector.fromArray(SPECIES, a, i); + VectorMask mv = av.test(VectorOperators.IS_DEFAULT, vmask); - // Check results as part of computation. - for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); + // Check results as part of computation. + for (int j = 0; j < SPECIES.length(); j++) { + Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); + } } } } @@ -2615,19 +2617,21 @@ public class Double256VectorTests extends AbstractVectorTest { } @Test(dataProvider = "doubleTestOpMaskProvider") - static void IS_NEGATIVEMaskedDouble256VectorTestsSmokeTest(IntFunction fa, + static void IS_NEGATIVEMaskedDouble256VectorTests(IntFunction fa, IntFunction fm) { double[] a = fa.apply(SPECIES.length()); boolean[] mask = fm.apply(SPECIES.length()); VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0); - for (int i = 0; i < a.length; i += SPECIES.length()) { - DoubleVector av = DoubleVector.fromArray(SPECIES, a, i); - VectorMask mv = av.test(VectorOperators.IS_NEGATIVE, vmask); + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + DoubleVector av = DoubleVector.fromArray(SPECIES, a, i); + VectorMask mv = av.test(VectorOperators.IS_NEGATIVE, vmask); - // Check results as part of computation. - for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); + // Check results as part of computation. + for (int j = 0; j < SPECIES.length(); j++) { + Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); + } } } } @@ -2654,19 +2658,21 @@ public class Double256VectorTests extends AbstractVectorTest { } @Test(dataProvider = "doubleTestOpMaskProvider") - static void IS_FINITEMaskedDouble256VectorTestsSmokeTest(IntFunction fa, + static void IS_FINITEMaskedDouble256VectorTests(IntFunction fa, IntFunction fm) { double[] a = fa.apply(SPECIES.length()); boolean[] mask = fm.apply(SPECIES.length()); VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0); - for (int i = 0; i < a.length; i += SPECIES.length()) { - DoubleVector av = DoubleVector.fromArray(SPECIES, a, i); - VectorMask mv = av.test(VectorOperators.IS_FINITE, vmask); + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + DoubleVector av = DoubleVector.fromArray(SPECIES, a, i); + VectorMask mv = av.test(VectorOperators.IS_FINITE, vmask); - // Check results as part of computation. - for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_FINITE(a[i + j])); + // Check results as part of computation. + for (int j = 0; j < SPECIES.length(); j++) { + Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_FINITE(a[i + j])); + } } } } @@ -2694,19 +2700,21 @@ public class Double256VectorTests extends AbstractVectorTest { } @Test(dataProvider = "doubleTestOpMaskProvider") - static void IS_NANMaskedDouble256VectorTestsSmokeTest(IntFunction fa, + static void IS_NANMaskedDouble256VectorTests(IntFunction fa, IntFunction fm) { double[] a = fa.apply(SPECIES.length()); boolean[] mask = fm.apply(SPECIES.length()); VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0); - for (int i = 0; i < a.length; i += SPECIES.length()) { - DoubleVector av = DoubleVector.fromArray(SPECIES, a, i); - VectorMask mv = av.test(VectorOperators.IS_NAN, vmask); + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + DoubleVector av = DoubleVector.fromArray(SPECIES, a, i); + VectorMask mv = av.test(VectorOperators.IS_NAN, vmask); - // Check results as part of computation. - for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NAN(a[i + j])); + // Check results as part of computation. + for (int j = 0; j < SPECIES.length(); j++) { + Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NAN(a[i + j])); + } } } } @@ -2734,19 +2742,21 @@ public class Double256VectorTests extends AbstractVectorTest { } @Test(dataProvider = "doubleTestOpMaskProvider") - static void IS_INFINITEMaskedDouble256VectorTestsSmokeTest(IntFunction fa, + static void IS_INFINITEMaskedDouble256VectorTests(IntFunction fa, IntFunction fm) { double[] a = fa.apply(SPECIES.length()); boolean[] mask = fm.apply(SPECIES.length()); VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0); - for (int i = 0; i < a.length; i += SPECIES.length()) { - DoubleVector av = DoubleVector.fromArray(SPECIES, a, i); - VectorMask mv = av.test(VectorOperators.IS_INFINITE, vmask); + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + DoubleVector av = DoubleVector.fromArray(SPECIES, a, i); + VectorMask mv = av.test(VectorOperators.IS_INFINITE, vmask); - // Check results as part of computation. - for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_INFINITE(a[i + j])); + // Check results as part of computation. + for (int j = 0; j < SPECIES.length(); j++) { + Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_INFINITE(a[i + j])); + } } } } diff --git a/test/jdk/jdk/incubator/vector/Double512VectorTests.java b/test/jdk/jdk/incubator/vector/Double512VectorTests.java index 82299753e65..7d6d280d744 100644 --- a/test/jdk/jdk/incubator/vector/Double512VectorTests.java +++ b/test/jdk/jdk/incubator/vector/Double512VectorTests.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2022, 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 @@ -2577,19 +2577,21 @@ public class Double512VectorTests extends AbstractVectorTest { } @Test(dataProvider = "doubleTestOpMaskProvider") - static void IS_DEFAULTMaskedDouble512VectorTestsSmokeTest(IntFunction fa, + static void IS_DEFAULTMaskedDouble512VectorTests(IntFunction fa, IntFunction fm) { double[] a = fa.apply(SPECIES.length()); boolean[] mask = fm.apply(SPECIES.length()); VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0); - for (int i = 0; i < a.length; i += SPECIES.length()) { - DoubleVector av = DoubleVector.fromArray(SPECIES, a, i); - VectorMask mv = av.test(VectorOperators.IS_DEFAULT, vmask); + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + DoubleVector av = DoubleVector.fromArray(SPECIES, a, i); + VectorMask mv = av.test(VectorOperators.IS_DEFAULT, vmask); - // Check results as part of computation. - for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); + // Check results as part of computation. + for (int j = 0; j < SPECIES.length(); j++) { + Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); + } } } } @@ -2615,19 +2617,21 @@ public class Double512VectorTests extends AbstractVectorTest { } @Test(dataProvider = "doubleTestOpMaskProvider") - static void IS_NEGATIVEMaskedDouble512VectorTestsSmokeTest(IntFunction fa, + static void IS_NEGATIVEMaskedDouble512VectorTests(IntFunction fa, IntFunction fm) { double[] a = fa.apply(SPECIES.length()); boolean[] mask = fm.apply(SPECIES.length()); VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0); - for (int i = 0; i < a.length; i += SPECIES.length()) { - DoubleVector av = DoubleVector.fromArray(SPECIES, a, i); - VectorMask mv = av.test(VectorOperators.IS_NEGATIVE, vmask); + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + DoubleVector av = DoubleVector.fromArray(SPECIES, a, i); + VectorMask mv = av.test(VectorOperators.IS_NEGATIVE, vmask); - // Check results as part of computation. - for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); + // Check results as part of computation. + for (int j = 0; j < SPECIES.length(); j++) { + Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); + } } } } @@ -2654,19 +2658,21 @@ public class Double512VectorTests extends AbstractVectorTest { } @Test(dataProvider = "doubleTestOpMaskProvider") - static void IS_FINITEMaskedDouble512VectorTestsSmokeTest(IntFunction fa, + static void IS_FINITEMaskedDouble512VectorTests(IntFunction fa, IntFunction fm) { double[] a = fa.apply(SPECIES.length()); boolean[] mask = fm.apply(SPECIES.length()); VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0); - for (int i = 0; i < a.length; i += SPECIES.length()) { - DoubleVector av = DoubleVector.fromArray(SPECIES, a, i); - VectorMask mv = av.test(VectorOperators.IS_FINITE, vmask); + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + DoubleVector av = DoubleVector.fromArray(SPECIES, a, i); + VectorMask mv = av.test(VectorOperators.IS_FINITE, vmask); - // Check results as part of computation. - for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_FINITE(a[i + j])); + // Check results as part of computation. + for (int j = 0; j < SPECIES.length(); j++) { + Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_FINITE(a[i + j])); + } } } } @@ -2694,19 +2700,21 @@ public class Double512VectorTests extends AbstractVectorTest { } @Test(dataProvider = "doubleTestOpMaskProvider") - static void IS_NANMaskedDouble512VectorTestsSmokeTest(IntFunction fa, + static void IS_NANMaskedDouble512VectorTests(IntFunction fa, IntFunction fm) { double[] a = fa.apply(SPECIES.length()); boolean[] mask = fm.apply(SPECIES.length()); VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0); - for (int i = 0; i < a.length; i += SPECIES.length()) { - DoubleVector av = DoubleVector.fromArray(SPECIES, a, i); - VectorMask mv = av.test(VectorOperators.IS_NAN, vmask); + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + DoubleVector av = DoubleVector.fromArray(SPECIES, a, i); + VectorMask mv = av.test(VectorOperators.IS_NAN, vmask); - // Check results as part of computation. - for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NAN(a[i + j])); + // Check results as part of computation. + for (int j = 0; j < SPECIES.length(); j++) { + Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NAN(a[i + j])); + } } } } @@ -2734,19 +2742,21 @@ public class Double512VectorTests extends AbstractVectorTest { } @Test(dataProvider = "doubleTestOpMaskProvider") - static void IS_INFINITEMaskedDouble512VectorTestsSmokeTest(IntFunction fa, + static void IS_INFINITEMaskedDouble512VectorTests(IntFunction fa, IntFunction fm) { double[] a = fa.apply(SPECIES.length()); boolean[] mask = fm.apply(SPECIES.length()); VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0); - for (int i = 0; i < a.length; i += SPECIES.length()) { - DoubleVector av = DoubleVector.fromArray(SPECIES, a, i); - VectorMask mv = av.test(VectorOperators.IS_INFINITE, vmask); + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + DoubleVector av = DoubleVector.fromArray(SPECIES, a, i); + VectorMask mv = av.test(VectorOperators.IS_INFINITE, vmask); - // Check results as part of computation. - for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_INFINITE(a[i + j])); + // Check results as part of computation. + for (int j = 0; j < SPECIES.length(); j++) { + Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_INFINITE(a[i + j])); + } } } } diff --git a/test/jdk/jdk/incubator/vector/Double64VectorTests.java b/test/jdk/jdk/incubator/vector/Double64VectorTests.java index 82fd826ffcb..35bf2ec0465 100644 --- a/test/jdk/jdk/incubator/vector/Double64VectorTests.java +++ b/test/jdk/jdk/incubator/vector/Double64VectorTests.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2022, 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 @@ -2577,19 +2577,21 @@ public class Double64VectorTests extends AbstractVectorTest { } @Test(dataProvider = "doubleTestOpMaskProvider") - static void IS_DEFAULTMaskedDouble64VectorTestsSmokeTest(IntFunction fa, + static void IS_DEFAULTMaskedDouble64VectorTests(IntFunction fa, IntFunction fm) { double[] a = fa.apply(SPECIES.length()); boolean[] mask = fm.apply(SPECIES.length()); VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0); - for (int i = 0; i < a.length; i += SPECIES.length()) { - DoubleVector av = DoubleVector.fromArray(SPECIES, a, i); - VectorMask mv = av.test(VectorOperators.IS_DEFAULT, vmask); + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + DoubleVector av = DoubleVector.fromArray(SPECIES, a, i); + VectorMask mv = av.test(VectorOperators.IS_DEFAULT, vmask); - // Check results as part of computation. - for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); + // Check results as part of computation. + for (int j = 0; j < SPECIES.length(); j++) { + Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); + } } } } @@ -2615,19 +2617,21 @@ public class Double64VectorTests extends AbstractVectorTest { } @Test(dataProvider = "doubleTestOpMaskProvider") - static void IS_NEGATIVEMaskedDouble64VectorTestsSmokeTest(IntFunction fa, + static void IS_NEGATIVEMaskedDouble64VectorTests(IntFunction fa, IntFunction fm) { double[] a = fa.apply(SPECIES.length()); boolean[] mask = fm.apply(SPECIES.length()); VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0); - for (int i = 0; i < a.length; i += SPECIES.length()) { - DoubleVector av = DoubleVector.fromArray(SPECIES, a, i); - VectorMask mv = av.test(VectorOperators.IS_NEGATIVE, vmask); + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + DoubleVector av = DoubleVector.fromArray(SPECIES, a, i); + VectorMask mv = av.test(VectorOperators.IS_NEGATIVE, vmask); - // Check results as part of computation. - for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); + // Check results as part of computation. + for (int j = 0; j < SPECIES.length(); j++) { + Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); + } } } } @@ -2654,19 +2658,21 @@ public class Double64VectorTests extends AbstractVectorTest { } @Test(dataProvider = "doubleTestOpMaskProvider") - static void IS_FINITEMaskedDouble64VectorTestsSmokeTest(IntFunction fa, + static void IS_FINITEMaskedDouble64VectorTests(IntFunction fa, IntFunction fm) { double[] a = fa.apply(SPECIES.length()); boolean[] mask = fm.apply(SPECIES.length()); VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0); - for (int i = 0; i < a.length; i += SPECIES.length()) { - DoubleVector av = DoubleVector.fromArray(SPECIES, a, i); - VectorMask mv = av.test(VectorOperators.IS_FINITE, vmask); + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + DoubleVector av = DoubleVector.fromArray(SPECIES, a, i); + VectorMask mv = av.test(VectorOperators.IS_FINITE, vmask); - // Check results as part of computation. - for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_FINITE(a[i + j])); + // Check results as part of computation. + for (int j = 0; j < SPECIES.length(); j++) { + Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_FINITE(a[i + j])); + } } } } @@ -2694,19 +2700,21 @@ public class Double64VectorTests extends AbstractVectorTest { } @Test(dataProvider = "doubleTestOpMaskProvider") - static void IS_NANMaskedDouble64VectorTestsSmokeTest(IntFunction fa, + static void IS_NANMaskedDouble64VectorTests(IntFunction fa, IntFunction fm) { double[] a = fa.apply(SPECIES.length()); boolean[] mask = fm.apply(SPECIES.length()); VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0); - for (int i = 0; i < a.length; i += SPECIES.length()) { - DoubleVector av = DoubleVector.fromArray(SPECIES, a, i); - VectorMask mv = av.test(VectorOperators.IS_NAN, vmask); + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + DoubleVector av = DoubleVector.fromArray(SPECIES, a, i); + VectorMask mv = av.test(VectorOperators.IS_NAN, vmask); - // Check results as part of computation. - for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NAN(a[i + j])); + // Check results as part of computation. + for (int j = 0; j < SPECIES.length(); j++) { + Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NAN(a[i + j])); + } } } } @@ -2734,19 +2742,21 @@ public class Double64VectorTests extends AbstractVectorTest { } @Test(dataProvider = "doubleTestOpMaskProvider") - static void IS_INFINITEMaskedDouble64VectorTestsSmokeTest(IntFunction fa, + static void IS_INFINITEMaskedDouble64VectorTests(IntFunction fa, IntFunction fm) { double[] a = fa.apply(SPECIES.length()); boolean[] mask = fm.apply(SPECIES.length()); VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0); - for (int i = 0; i < a.length; i += SPECIES.length()) { - DoubleVector av = DoubleVector.fromArray(SPECIES, a, i); - VectorMask mv = av.test(VectorOperators.IS_INFINITE, vmask); + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + DoubleVector av = DoubleVector.fromArray(SPECIES, a, i); + VectorMask mv = av.test(VectorOperators.IS_INFINITE, vmask); - // Check results as part of computation. - for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_INFINITE(a[i + j])); + // Check results as part of computation. + for (int j = 0; j < SPECIES.length(); j++) { + Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_INFINITE(a[i + j])); + } } } } diff --git a/test/jdk/jdk/incubator/vector/DoubleMaxVectorTests.java b/test/jdk/jdk/incubator/vector/DoubleMaxVectorTests.java index af9054efbb0..102749b7ca0 100644 --- a/test/jdk/jdk/incubator/vector/DoubleMaxVectorTests.java +++ b/test/jdk/jdk/incubator/vector/DoubleMaxVectorTests.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2022, 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 @@ -2582,19 +2582,21 @@ public class DoubleMaxVectorTests extends AbstractVectorTest { } @Test(dataProvider = "doubleTestOpMaskProvider") - static void IS_DEFAULTMaskedDoubleMaxVectorTestsSmokeTest(IntFunction fa, + static void IS_DEFAULTMaskedDoubleMaxVectorTests(IntFunction fa, IntFunction fm) { double[] a = fa.apply(SPECIES.length()); boolean[] mask = fm.apply(SPECIES.length()); VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0); - for (int i = 0; i < a.length; i += SPECIES.length()) { - DoubleVector av = DoubleVector.fromArray(SPECIES, a, i); - VectorMask mv = av.test(VectorOperators.IS_DEFAULT, vmask); + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + DoubleVector av = DoubleVector.fromArray(SPECIES, a, i); + VectorMask mv = av.test(VectorOperators.IS_DEFAULT, vmask); - // Check results as part of computation. - for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); + // Check results as part of computation. + for (int j = 0; j < SPECIES.length(); j++) { + Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); + } } } } @@ -2620,19 +2622,21 @@ public class DoubleMaxVectorTests extends AbstractVectorTest { } @Test(dataProvider = "doubleTestOpMaskProvider") - static void IS_NEGATIVEMaskedDoubleMaxVectorTestsSmokeTest(IntFunction fa, + static void IS_NEGATIVEMaskedDoubleMaxVectorTests(IntFunction fa, IntFunction fm) { double[] a = fa.apply(SPECIES.length()); boolean[] mask = fm.apply(SPECIES.length()); VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0); - for (int i = 0; i < a.length; i += SPECIES.length()) { - DoubleVector av = DoubleVector.fromArray(SPECIES, a, i); - VectorMask mv = av.test(VectorOperators.IS_NEGATIVE, vmask); + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + DoubleVector av = DoubleVector.fromArray(SPECIES, a, i); + VectorMask mv = av.test(VectorOperators.IS_NEGATIVE, vmask); - // Check results as part of computation. - for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); + // Check results as part of computation. + for (int j = 0; j < SPECIES.length(); j++) { + Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); + } } } } @@ -2659,19 +2663,21 @@ public class DoubleMaxVectorTests extends AbstractVectorTest { } @Test(dataProvider = "doubleTestOpMaskProvider") - static void IS_FINITEMaskedDoubleMaxVectorTestsSmokeTest(IntFunction fa, + static void IS_FINITEMaskedDoubleMaxVectorTests(IntFunction fa, IntFunction fm) { double[] a = fa.apply(SPECIES.length()); boolean[] mask = fm.apply(SPECIES.length()); VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0); - for (int i = 0; i < a.length; i += SPECIES.length()) { - DoubleVector av = DoubleVector.fromArray(SPECIES, a, i); - VectorMask mv = av.test(VectorOperators.IS_FINITE, vmask); + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + DoubleVector av = DoubleVector.fromArray(SPECIES, a, i); + VectorMask mv = av.test(VectorOperators.IS_FINITE, vmask); - // Check results as part of computation. - for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_FINITE(a[i + j])); + // Check results as part of computation. + for (int j = 0; j < SPECIES.length(); j++) { + Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_FINITE(a[i + j])); + } } } } @@ -2699,19 +2705,21 @@ public class DoubleMaxVectorTests extends AbstractVectorTest { } @Test(dataProvider = "doubleTestOpMaskProvider") - static void IS_NANMaskedDoubleMaxVectorTestsSmokeTest(IntFunction fa, + static void IS_NANMaskedDoubleMaxVectorTests(IntFunction fa, IntFunction fm) { double[] a = fa.apply(SPECIES.length()); boolean[] mask = fm.apply(SPECIES.length()); VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0); - for (int i = 0; i < a.length; i += SPECIES.length()) { - DoubleVector av = DoubleVector.fromArray(SPECIES, a, i); - VectorMask mv = av.test(VectorOperators.IS_NAN, vmask); + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + DoubleVector av = DoubleVector.fromArray(SPECIES, a, i); + VectorMask mv = av.test(VectorOperators.IS_NAN, vmask); - // Check results as part of computation. - for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NAN(a[i + j])); + // Check results as part of computation. + for (int j = 0; j < SPECIES.length(); j++) { + Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NAN(a[i + j])); + } } } } @@ -2739,19 +2747,21 @@ public class DoubleMaxVectorTests extends AbstractVectorTest { } @Test(dataProvider = "doubleTestOpMaskProvider") - static void IS_INFINITEMaskedDoubleMaxVectorTestsSmokeTest(IntFunction fa, + static void IS_INFINITEMaskedDoubleMaxVectorTests(IntFunction fa, IntFunction fm) { double[] a = fa.apply(SPECIES.length()); boolean[] mask = fm.apply(SPECIES.length()); VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0); - for (int i = 0; i < a.length; i += SPECIES.length()) { - DoubleVector av = DoubleVector.fromArray(SPECIES, a, i); - VectorMask mv = av.test(VectorOperators.IS_INFINITE, vmask); + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + DoubleVector av = DoubleVector.fromArray(SPECIES, a, i); + VectorMask mv = av.test(VectorOperators.IS_INFINITE, vmask); - // Check results as part of computation. - for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_INFINITE(a[i + j])); + // Check results as part of computation. + for (int j = 0; j < SPECIES.length(); j++) { + Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_INFINITE(a[i + j])); + } } } } diff --git a/test/jdk/jdk/incubator/vector/Float128VectorTests.java b/test/jdk/jdk/incubator/vector/Float128VectorTests.java index c793515b6c6..114ac299f3e 100644 --- a/test/jdk/jdk/incubator/vector/Float128VectorTests.java +++ b/test/jdk/jdk/incubator/vector/Float128VectorTests.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2022, 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 @@ -2587,19 +2587,21 @@ public class Float128VectorTests extends AbstractVectorTest { } @Test(dataProvider = "floatTestOpMaskProvider") - static void IS_DEFAULTMaskedFloat128VectorTestsSmokeTest(IntFunction fa, + static void IS_DEFAULTMaskedFloat128VectorTests(IntFunction fa, IntFunction fm) { float[] a = fa.apply(SPECIES.length()); boolean[] mask = fm.apply(SPECIES.length()); VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0); - for (int i = 0; i < a.length; i += SPECIES.length()) { - FloatVector av = FloatVector.fromArray(SPECIES, a, i); - VectorMask mv = av.test(VectorOperators.IS_DEFAULT, vmask); + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + FloatVector av = FloatVector.fromArray(SPECIES, a, i); + VectorMask mv = av.test(VectorOperators.IS_DEFAULT, vmask); - // Check results as part of computation. - for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); + // Check results as part of computation. + for (int j = 0; j < SPECIES.length(); j++) { + Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); + } } } } @@ -2625,19 +2627,21 @@ public class Float128VectorTests extends AbstractVectorTest { } @Test(dataProvider = "floatTestOpMaskProvider") - static void IS_NEGATIVEMaskedFloat128VectorTestsSmokeTest(IntFunction fa, + static void IS_NEGATIVEMaskedFloat128VectorTests(IntFunction fa, IntFunction fm) { float[] a = fa.apply(SPECIES.length()); boolean[] mask = fm.apply(SPECIES.length()); VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0); - for (int i = 0; i < a.length; i += SPECIES.length()) { - FloatVector av = FloatVector.fromArray(SPECIES, a, i); - VectorMask mv = av.test(VectorOperators.IS_NEGATIVE, vmask); + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + FloatVector av = FloatVector.fromArray(SPECIES, a, i); + VectorMask mv = av.test(VectorOperators.IS_NEGATIVE, vmask); - // Check results as part of computation. - for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); + // Check results as part of computation. + for (int j = 0; j < SPECIES.length(); j++) { + Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); + } } } } @@ -2664,19 +2668,21 @@ public class Float128VectorTests extends AbstractVectorTest { } @Test(dataProvider = "floatTestOpMaskProvider") - static void IS_FINITEMaskedFloat128VectorTestsSmokeTest(IntFunction fa, + static void IS_FINITEMaskedFloat128VectorTests(IntFunction fa, IntFunction fm) { float[] a = fa.apply(SPECIES.length()); boolean[] mask = fm.apply(SPECIES.length()); VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0); - for (int i = 0; i < a.length; i += SPECIES.length()) { - FloatVector av = FloatVector.fromArray(SPECIES, a, i); - VectorMask mv = av.test(VectorOperators.IS_FINITE, vmask); + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + FloatVector av = FloatVector.fromArray(SPECIES, a, i); + VectorMask mv = av.test(VectorOperators.IS_FINITE, vmask); - // Check results as part of computation. - for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_FINITE(a[i + j])); + // Check results as part of computation. + for (int j = 0; j < SPECIES.length(); j++) { + Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_FINITE(a[i + j])); + } } } } @@ -2704,19 +2710,21 @@ public class Float128VectorTests extends AbstractVectorTest { } @Test(dataProvider = "floatTestOpMaskProvider") - static void IS_NANMaskedFloat128VectorTestsSmokeTest(IntFunction fa, + static void IS_NANMaskedFloat128VectorTests(IntFunction fa, IntFunction fm) { float[] a = fa.apply(SPECIES.length()); boolean[] mask = fm.apply(SPECIES.length()); VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0); - for (int i = 0; i < a.length; i += SPECIES.length()) { - FloatVector av = FloatVector.fromArray(SPECIES, a, i); - VectorMask mv = av.test(VectorOperators.IS_NAN, vmask); + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + FloatVector av = FloatVector.fromArray(SPECIES, a, i); + VectorMask mv = av.test(VectorOperators.IS_NAN, vmask); - // Check results as part of computation. - for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NAN(a[i + j])); + // Check results as part of computation. + for (int j = 0; j < SPECIES.length(); j++) { + Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NAN(a[i + j])); + } } } } @@ -2744,19 +2752,21 @@ public class Float128VectorTests extends AbstractVectorTest { } @Test(dataProvider = "floatTestOpMaskProvider") - static void IS_INFINITEMaskedFloat128VectorTestsSmokeTest(IntFunction fa, + static void IS_INFINITEMaskedFloat128VectorTests(IntFunction fa, IntFunction fm) { float[] a = fa.apply(SPECIES.length()); boolean[] mask = fm.apply(SPECIES.length()); VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0); - for (int i = 0; i < a.length; i += SPECIES.length()) { - FloatVector av = FloatVector.fromArray(SPECIES, a, i); - VectorMask mv = av.test(VectorOperators.IS_INFINITE, vmask); + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + FloatVector av = FloatVector.fromArray(SPECIES, a, i); + VectorMask mv = av.test(VectorOperators.IS_INFINITE, vmask); - // Check results as part of computation. - for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_INFINITE(a[i + j])); + // Check results as part of computation. + for (int j = 0; j < SPECIES.length(); j++) { + Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_INFINITE(a[i + j])); + } } } } diff --git a/test/jdk/jdk/incubator/vector/Float256VectorTests.java b/test/jdk/jdk/incubator/vector/Float256VectorTests.java index 61593a8c23a..8011f3a6869 100644 --- a/test/jdk/jdk/incubator/vector/Float256VectorTests.java +++ b/test/jdk/jdk/incubator/vector/Float256VectorTests.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2022, 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 @@ -2587,19 +2587,21 @@ public class Float256VectorTests extends AbstractVectorTest { } @Test(dataProvider = "floatTestOpMaskProvider") - static void IS_DEFAULTMaskedFloat256VectorTestsSmokeTest(IntFunction fa, + static void IS_DEFAULTMaskedFloat256VectorTests(IntFunction fa, IntFunction fm) { float[] a = fa.apply(SPECIES.length()); boolean[] mask = fm.apply(SPECIES.length()); VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0); - for (int i = 0; i < a.length; i += SPECIES.length()) { - FloatVector av = FloatVector.fromArray(SPECIES, a, i); - VectorMask mv = av.test(VectorOperators.IS_DEFAULT, vmask); + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + FloatVector av = FloatVector.fromArray(SPECIES, a, i); + VectorMask mv = av.test(VectorOperators.IS_DEFAULT, vmask); - // Check results as part of computation. - for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); + // Check results as part of computation. + for (int j = 0; j < SPECIES.length(); j++) { + Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); + } } } } @@ -2625,19 +2627,21 @@ public class Float256VectorTests extends AbstractVectorTest { } @Test(dataProvider = "floatTestOpMaskProvider") - static void IS_NEGATIVEMaskedFloat256VectorTestsSmokeTest(IntFunction fa, + static void IS_NEGATIVEMaskedFloat256VectorTests(IntFunction fa, IntFunction fm) { float[] a = fa.apply(SPECIES.length()); boolean[] mask = fm.apply(SPECIES.length()); VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0); - for (int i = 0; i < a.length; i += SPECIES.length()) { - FloatVector av = FloatVector.fromArray(SPECIES, a, i); - VectorMask mv = av.test(VectorOperators.IS_NEGATIVE, vmask); + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + FloatVector av = FloatVector.fromArray(SPECIES, a, i); + VectorMask mv = av.test(VectorOperators.IS_NEGATIVE, vmask); - // Check results as part of computation. - for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); + // Check results as part of computation. + for (int j = 0; j < SPECIES.length(); j++) { + Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); + } } } } @@ -2664,19 +2668,21 @@ public class Float256VectorTests extends AbstractVectorTest { } @Test(dataProvider = "floatTestOpMaskProvider") - static void IS_FINITEMaskedFloat256VectorTestsSmokeTest(IntFunction fa, + static void IS_FINITEMaskedFloat256VectorTests(IntFunction fa, IntFunction fm) { float[] a = fa.apply(SPECIES.length()); boolean[] mask = fm.apply(SPECIES.length()); VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0); - for (int i = 0; i < a.length; i += SPECIES.length()) { - FloatVector av = FloatVector.fromArray(SPECIES, a, i); - VectorMask mv = av.test(VectorOperators.IS_FINITE, vmask); + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + FloatVector av = FloatVector.fromArray(SPECIES, a, i); + VectorMask mv = av.test(VectorOperators.IS_FINITE, vmask); - // Check results as part of computation. - for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_FINITE(a[i + j])); + // Check results as part of computation. + for (int j = 0; j < SPECIES.length(); j++) { + Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_FINITE(a[i + j])); + } } } } @@ -2704,19 +2710,21 @@ public class Float256VectorTests extends AbstractVectorTest { } @Test(dataProvider = "floatTestOpMaskProvider") - static void IS_NANMaskedFloat256VectorTestsSmokeTest(IntFunction fa, + static void IS_NANMaskedFloat256VectorTests(IntFunction fa, IntFunction fm) { float[] a = fa.apply(SPECIES.length()); boolean[] mask = fm.apply(SPECIES.length()); VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0); - for (int i = 0; i < a.length; i += SPECIES.length()) { - FloatVector av = FloatVector.fromArray(SPECIES, a, i); - VectorMask mv = av.test(VectorOperators.IS_NAN, vmask); + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + FloatVector av = FloatVector.fromArray(SPECIES, a, i); + VectorMask mv = av.test(VectorOperators.IS_NAN, vmask); - // Check results as part of computation. - for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NAN(a[i + j])); + // Check results as part of computation. + for (int j = 0; j < SPECIES.length(); j++) { + Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NAN(a[i + j])); + } } } } @@ -2744,19 +2752,21 @@ public class Float256VectorTests extends AbstractVectorTest { } @Test(dataProvider = "floatTestOpMaskProvider") - static void IS_INFINITEMaskedFloat256VectorTestsSmokeTest(IntFunction fa, + static void IS_INFINITEMaskedFloat256VectorTests(IntFunction fa, IntFunction fm) { float[] a = fa.apply(SPECIES.length()); boolean[] mask = fm.apply(SPECIES.length()); VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0); - for (int i = 0; i < a.length; i += SPECIES.length()) { - FloatVector av = FloatVector.fromArray(SPECIES, a, i); - VectorMask mv = av.test(VectorOperators.IS_INFINITE, vmask); + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + FloatVector av = FloatVector.fromArray(SPECIES, a, i); + VectorMask mv = av.test(VectorOperators.IS_INFINITE, vmask); - // Check results as part of computation. - for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_INFINITE(a[i + j])); + // Check results as part of computation. + for (int j = 0; j < SPECIES.length(); j++) { + Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_INFINITE(a[i + j])); + } } } } diff --git a/test/jdk/jdk/incubator/vector/Float512VectorTests.java b/test/jdk/jdk/incubator/vector/Float512VectorTests.java index 421338f053c..f6fa6ecc6f0 100644 --- a/test/jdk/jdk/incubator/vector/Float512VectorTests.java +++ b/test/jdk/jdk/incubator/vector/Float512VectorTests.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2022, 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 @@ -2587,19 +2587,21 @@ public class Float512VectorTests extends AbstractVectorTest { } @Test(dataProvider = "floatTestOpMaskProvider") - static void IS_DEFAULTMaskedFloat512VectorTestsSmokeTest(IntFunction fa, + static void IS_DEFAULTMaskedFloat512VectorTests(IntFunction fa, IntFunction fm) { float[] a = fa.apply(SPECIES.length()); boolean[] mask = fm.apply(SPECIES.length()); VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0); - for (int i = 0; i < a.length; i += SPECIES.length()) { - FloatVector av = FloatVector.fromArray(SPECIES, a, i); - VectorMask mv = av.test(VectorOperators.IS_DEFAULT, vmask); + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + FloatVector av = FloatVector.fromArray(SPECIES, a, i); + VectorMask mv = av.test(VectorOperators.IS_DEFAULT, vmask); - // Check results as part of computation. - for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); + // Check results as part of computation. + for (int j = 0; j < SPECIES.length(); j++) { + Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); + } } } } @@ -2625,19 +2627,21 @@ public class Float512VectorTests extends AbstractVectorTest { } @Test(dataProvider = "floatTestOpMaskProvider") - static void IS_NEGATIVEMaskedFloat512VectorTestsSmokeTest(IntFunction fa, + static void IS_NEGATIVEMaskedFloat512VectorTests(IntFunction fa, IntFunction fm) { float[] a = fa.apply(SPECIES.length()); boolean[] mask = fm.apply(SPECIES.length()); VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0); - for (int i = 0; i < a.length; i += SPECIES.length()) { - FloatVector av = FloatVector.fromArray(SPECIES, a, i); - VectorMask mv = av.test(VectorOperators.IS_NEGATIVE, vmask); + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + FloatVector av = FloatVector.fromArray(SPECIES, a, i); + VectorMask mv = av.test(VectorOperators.IS_NEGATIVE, vmask); - // Check results as part of computation. - for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); + // Check results as part of computation. + for (int j = 0; j < SPECIES.length(); j++) { + Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); + } } } } @@ -2664,19 +2668,21 @@ public class Float512VectorTests extends AbstractVectorTest { } @Test(dataProvider = "floatTestOpMaskProvider") - static void IS_FINITEMaskedFloat512VectorTestsSmokeTest(IntFunction fa, + static void IS_FINITEMaskedFloat512VectorTests(IntFunction fa, IntFunction fm) { float[] a = fa.apply(SPECIES.length()); boolean[] mask = fm.apply(SPECIES.length()); VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0); - for (int i = 0; i < a.length; i += SPECIES.length()) { - FloatVector av = FloatVector.fromArray(SPECIES, a, i); - VectorMask mv = av.test(VectorOperators.IS_FINITE, vmask); + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + FloatVector av = FloatVector.fromArray(SPECIES, a, i); + VectorMask mv = av.test(VectorOperators.IS_FINITE, vmask); - // Check results as part of computation. - for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_FINITE(a[i + j])); + // Check results as part of computation. + for (int j = 0; j < SPECIES.length(); j++) { + Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_FINITE(a[i + j])); + } } } } @@ -2704,19 +2710,21 @@ public class Float512VectorTests extends AbstractVectorTest { } @Test(dataProvider = "floatTestOpMaskProvider") - static void IS_NANMaskedFloat512VectorTestsSmokeTest(IntFunction fa, + static void IS_NANMaskedFloat512VectorTests(IntFunction fa, IntFunction fm) { float[] a = fa.apply(SPECIES.length()); boolean[] mask = fm.apply(SPECIES.length()); VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0); - for (int i = 0; i < a.length; i += SPECIES.length()) { - FloatVector av = FloatVector.fromArray(SPECIES, a, i); - VectorMask mv = av.test(VectorOperators.IS_NAN, vmask); + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + FloatVector av = FloatVector.fromArray(SPECIES, a, i); + VectorMask mv = av.test(VectorOperators.IS_NAN, vmask); - // Check results as part of computation. - for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NAN(a[i + j])); + // Check results as part of computation. + for (int j = 0; j < SPECIES.length(); j++) { + Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NAN(a[i + j])); + } } } } @@ -2744,19 +2752,21 @@ public class Float512VectorTests extends AbstractVectorTest { } @Test(dataProvider = "floatTestOpMaskProvider") - static void IS_INFINITEMaskedFloat512VectorTestsSmokeTest(IntFunction fa, + static void IS_INFINITEMaskedFloat512VectorTests(IntFunction fa, IntFunction fm) { float[] a = fa.apply(SPECIES.length()); boolean[] mask = fm.apply(SPECIES.length()); VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0); - for (int i = 0; i < a.length; i += SPECIES.length()) { - FloatVector av = FloatVector.fromArray(SPECIES, a, i); - VectorMask mv = av.test(VectorOperators.IS_INFINITE, vmask); + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + FloatVector av = FloatVector.fromArray(SPECIES, a, i); + VectorMask mv = av.test(VectorOperators.IS_INFINITE, vmask); - // Check results as part of computation. - for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_INFINITE(a[i + j])); + // Check results as part of computation. + for (int j = 0; j < SPECIES.length(); j++) { + Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_INFINITE(a[i + j])); + } } } } diff --git a/test/jdk/jdk/incubator/vector/Float64VectorTests.java b/test/jdk/jdk/incubator/vector/Float64VectorTests.java index cbe82a7e22d..d0edf33f340 100644 --- a/test/jdk/jdk/incubator/vector/Float64VectorTests.java +++ b/test/jdk/jdk/incubator/vector/Float64VectorTests.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2022, 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 @@ -2587,19 +2587,21 @@ public class Float64VectorTests extends AbstractVectorTest { } @Test(dataProvider = "floatTestOpMaskProvider") - static void IS_DEFAULTMaskedFloat64VectorTestsSmokeTest(IntFunction fa, + static void IS_DEFAULTMaskedFloat64VectorTests(IntFunction fa, IntFunction fm) { float[] a = fa.apply(SPECIES.length()); boolean[] mask = fm.apply(SPECIES.length()); VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0); - for (int i = 0; i < a.length; i += SPECIES.length()) { - FloatVector av = FloatVector.fromArray(SPECIES, a, i); - VectorMask mv = av.test(VectorOperators.IS_DEFAULT, vmask); + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + FloatVector av = FloatVector.fromArray(SPECIES, a, i); + VectorMask mv = av.test(VectorOperators.IS_DEFAULT, vmask); - // Check results as part of computation. - for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); + // Check results as part of computation. + for (int j = 0; j < SPECIES.length(); j++) { + Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); + } } } } @@ -2625,19 +2627,21 @@ public class Float64VectorTests extends AbstractVectorTest { } @Test(dataProvider = "floatTestOpMaskProvider") - static void IS_NEGATIVEMaskedFloat64VectorTestsSmokeTest(IntFunction fa, + static void IS_NEGATIVEMaskedFloat64VectorTests(IntFunction fa, IntFunction fm) { float[] a = fa.apply(SPECIES.length()); boolean[] mask = fm.apply(SPECIES.length()); VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0); - for (int i = 0; i < a.length; i += SPECIES.length()) { - FloatVector av = FloatVector.fromArray(SPECIES, a, i); - VectorMask mv = av.test(VectorOperators.IS_NEGATIVE, vmask); + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + FloatVector av = FloatVector.fromArray(SPECIES, a, i); + VectorMask mv = av.test(VectorOperators.IS_NEGATIVE, vmask); - // Check results as part of computation. - for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); + // Check results as part of computation. + for (int j = 0; j < SPECIES.length(); j++) { + Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); + } } } } @@ -2664,19 +2668,21 @@ public class Float64VectorTests extends AbstractVectorTest { } @Test(dataProvider = "floatTestOpMaskProvider") - static void IS_FINITEMaskedFloat64VectorTestsSmokeTest(IntFunction fa, + static void IS_FINITEMaskedFloat64VectorTests(IntFunction fa, IntFunction fm) { float[] a = fa.apply(SPECIES.length()); boolean[] mask = fm.apply(SPECIES.length()); VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0); - for (int i = 0; i < a.length; i += SPECIES.length()) { - FloatVector av = FloatVector.fromArray(SPECIES, a, i); - VectorMask mv = av.test(VectorOperators.IS_FINITE, vmask); + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + FloatVector av = FloatVector.fromArray(SPECIES, a, i); + VectorMask mv = av.test(VectorOperators.IS_FINITE, vmask); - // Check results as part of computation. - for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_FINITE(a[i + j])); + // Check results as part of computation. + for (int j = 0; j < SPECIES.length(); j++) { + Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_FINITE(a[i + j])); + } } } } @@ -2704,19 +2710,21 @@ public class Float64VectorTests extends AbstractVectorTest { } @Test(dataProvider = "floatTestOpMaskProvider") - static void IS_NANMaskedFloat64VectorTestsSmokeTest(IntFunction fa, + static void IS_NANMaskedFloat64VectorTests(IntFunction fa, IntFunction fm) { float[] a = fa.apply(SPECIES.length()); boolean[] mask = fm.apply(SPECIES.length()); VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0); - for (int i = 0; i < a.length; i += SPECIES.length()) { - FloatVector av = FloatVector.fromArray(SPECIES, a, i); - VectorMask mv = av.test(VectorOperators.IS_NAN, vmask); + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + FloatVector av = FloatVector.fromArray(SPECIES, a, i); + VectorMask mv = av.test(VectorOperators.IS_NAN, vmask); - // Check results as part of computation. - for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NAN(a[i + j])); + // Check results as part of computation. + for (int j = 0; j < SPECIES.length(); j++) { + Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NAN(a[i + j])); + } } } } @@ -2744,19 +2752,21 @@ public class Float64VectorTests extends AbstractVectorTest { } @Test(dataProvider = "floatTestOpMaskProvider") - static void IS_INFINITEMaskedFloat64VectorTestsSmokeTest(IntFunction fa, + static void IS_INFINITEMaskedFloat64VectorTests(IntFunction fa, IntFunction fm) { float[] a = fa.apply(SPECIES.length()); boolean[] mask = fm.apply(SPECIES.length()); VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0); - for (int i = 0; i < a.length; i += SPECIES.length()) { - FloatVector av = FloatVector.fromArray(SPECIES, a, i); - VectorMask mv = av.test(VectorOperators.IS_INFINITE, vmask); + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + FloatVector av = FloatVector.fromArray(SPECIES, a, i); + VectorMask mv = av.test(VectorOperators.IS_INFINITE, vmask); - // Check results as part of computation. - for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_INFINITE(a[i + j])); + // Check results as part of computation. + for (int j = 0; j < SPECIES.length(); j++) { + Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_INFINITE(a[i + j])); + } } } } diff --git a/test/jdk/jdk/incubator/vector/FloatMaxVectorTests.java b/test/jdk/jdk/incubator/vector/FloatMaxVectorTests.java index e8680eb1d94..4f8711e8b1c 100644 --- a/test/jdk/jdk/incubator/vector/FloatMaxVectorTests.java +++ b/test/jdk/jdk/incubator/vector/FloatMaxVectorTests.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2022, 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 @@ -2592,19 +2592,21 @@ public class FloatMaxVectorTests extends AbstractVectorTest { } @Test(dataProvider = "floatTestOpMaskProvider") - static void IS_DEFAULTMaskedFloatMaxVectorTestsSmokeTest(IntFunction fa, + static void IS_DEFAULTMaskedFloatMaxVectorTests(IntFunction fa, IntFunction fm) { float[] a = fa.apply(SPECIES.length()); boolean[] mask = fm.apply(SPECIES.length()); VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0); - for (int i = 0; i < a.length; i += SPECIES.length()) { - FloatVector av = FloatVector.fromArray(SPECIES, a, i); - VectorMask mv = av.test(VectorOperators.IS_DEFAULT, vmask); + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + FloatVector av = FloatVector.fromArray(SPECIES, a, i); + VectorMask mv = av.test(VectorOperators.IS_DEFAULT, vmask); - // Check results as part of computation. - for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); + // Check results as part of computation. + for (int j = 0; j < SPECIES.length(); j++) { + Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); + } } } } @@ -2630,19 +2632,21 @@ public class FloatMaxVectorTests extends AbstractVectorTest { } @Test(dataProvider = "floatTestOpMaskProvider") - static void IS_NEGATIVEMaskedFloatMaxVectorTestsSmokeTest(IntFunction fa, + static void IS_NEGATIVEMaskedFloatMaxVectorTests(IntFunction fa, IntFunction fm) { float[] a = fa.apply(SPECIES.length()); boolean[] mask = fm.apply(SPECIES.length()); VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0); - for (int i = 0; i < a.length; i += SPECIES.length()) { - FloatVector av = FloatVector.fromArray(SPECIES, a, i); - VectorMask mv = av.test(VectorOperators.IS_NEGATIVE, vmask); + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + FloatVector av = FloatVector.fromArray(SPECIES, a, i); + VectorMask mv = av.test(VectorOperators.IS_NEGATIVE, vmask); - // Check results as part of computation. - for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); + // Check results as part of computation. + for (int j = 0; j < SPECIES.length(); j++) { + Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); + } } } } @@ -2669,19 +2673,21 @@ public class FloatMaxVectorTests extends AbstractVectorTest { } @Test(dataProvider = "floatTestOpMaskProvider") - static void IS_FINITEMaskedFloatMaxVectorTestsSmokeTest(IntFunction fa, + static void IS_FINITEMaskedFloatMaxVectorTests(IntFunction fa, IntFunction fm) { float[] a = fa.apply(SPECIES.length()); boolean[] mask = fm.apply(SPECIES.length()); VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0); - for (int i = 0; i < a.length; i += SPECIES.length()) { - FloatVector av = FloatVector.fromArray(SPECIES, a, i); - VectorMask mv = av.test(VectorOperators.IS_FINITE, vmask); + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + FloatVector av = FloatVector.fromArray(SPECIES, a, i); + VectorMask mv = av.test(VectorOperators.IS_FINITE, vmask); - // Check results as part of computation. - for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_FINITE(a[i + j])); + // Check results as part of computation. + for (int j = 0; j < SPECIES.length(); j++) { + Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_FINITE(a[i + j])); + } } } } @@ -2709,19 +2715,21 @@ public class FloatMaxVectorTests extends AbstractVectorTest { } @Test(dataProvider = "floatTestOpMaskProvider") - static void IS_NANMaskedFloatMaxVectorTestsSmokeTest(IntFunction fa, + static void IS_NANMaskedFloatMaxVectorTests(IntFunction fa, IntFunction fm) { float[] a = fa.apply(SPECIES.length()); boolean[] mask = fm.apply(SPECIES.length()); VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0); - for (int i = 0; i < a.length; i += SPECIES.length()) { - FloatVector av = FloatVector.fromArray(SPECIES, a, i); - VectorMask mv = av.test(VectorOperators.IS_NAN, vmask); + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + FloatVector av = FloatVector.fromArray(SPECIES, a, i); + VectorMask mv = av.test(VectorOperators.IS_NAN, vmask); - // Check results as part of computation. - for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NAN(a[i + j])); + // Check results as part of computation. + for (int j = 0; j < SPECIES.length(); j++) { + Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NAN(a[i + j])); + } } } } @@ -2749,19 +2757,21 @@ public class FloatMaxVectorTests extends AbstractVectorTest { } @Test(dataProvider = "floatTestOpMaskProvider") - static void IS_INFINITEMaskedFloatMaxVectorTestsSmokeTest(IntFunction fa, + static void IS_INFINITEMaskedFloatMaxVectorTests(IntFunction fa, IntFunction fm) { float[] a = fa.apply(SPECIES.length()); boolean[] mask = fm.apply(SPECIES.length()); VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0); - for (int i = 0; i < a.length; i += SPECIES.length()) { - FloatVector av = FloatVector.fromArray(SPECIES, a, i); - VectorMask mv = av.test(VectorOperators.IS_INFINITE, vmask); + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + FloatVector av = FloatVector.fromArray(SPECIES, a, i); + VectorMask mv = av.test(VectorOperators.IS_INFINITE, vmask); - // Check results as part of computation. - for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_INFINITE(a[i + j])); + // Check results as part of computation. + for (int j = 0; j < SPECIES.length(); j++) { + Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_INFINITE(a[i + j])); + } } } } diff --git a/test/jdk/jdk/incubator/vector/Int128VectorTests.java b/test/jdk/jdk/incubator/vector/Int128VectorTests.java index 99bc02b8239..4de0a1b3044 100644 --- a/test/jdk/jdk/incubator/vector/Int128VectorTests.java +++ b/test/jdk/jdk/incubator/vector/Int128VectorTests.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2022, 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 @@ -3529,19 +3529,21 @@ public class Int128VectorTests extends AbstractVectorTest { } @Test(dataProvider = "intTestOpMaskProvider") - static void IS_DEFAULTMaskedInt128VectorTestsSmokeTest(IntFunction fa, + static void IS_DEFAULTMaskedInt128VectorTests(IntFunction fa, IntFunction fm) { int[] a = fa.apply(SPECIES.length()); boolean[] mask = fm.apply(SPECIES.length()); VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0); - for (int i = 0; i < a.length; i += SPECIES.length()) { - IntVector av = IntVector.fromArray(SPECIES, a, i); - VectorMask mv = av.test(VectorOperators.IS_DEFAULT, vmask); + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + IntVector av = IntVector.fromArray(SPECIES, a, i); + VectorMask mv = av.test(VectorOperators.IS_DEFAULT, vmask); - // Check results as part of computation. - for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); + // Check results as part of computation. + for (int j = 0; j < SPECIES.length(); j++) { + Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); + } } } } @@ -3567,19 +3569,21 @@ public class Int128VectorTests extends AbstractVectorTest { } @Test(dataProvider = "intTestOpMaskProvider") - static void IS_NEGATIVEMaskedInt128VectorTestsSmokeTest(IntFunction fa, + static void IS_NEGATIVEMaskedInt128VectorTests(IntFunction fa, IntFunction fm) { int[] a = fa.apply(SPECIES.length()); boolean[] mask = fm.apply(SPECIES.length()); VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0); - for (int i = 0; i < a.length; i += SPECIES.length()) { - IntVector av = IntVector.fromArray(SPECIES, a, i); - VectorMask mv = av.test(VectorOperators.IS_NEGATIVE, vmask); + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + IntVector av = IntVector.fromArray(SPECIES, a, i); + VectorMask mv = av.test(VectorOperators.IS_NEGATIVE, vmask); - // Check results as part of computation. - for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); + // Check results as part of computation. + for (int j = 0; j < SPECIES.length(); j++) { + Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); + } } } } diff --git a/test/jdk/jdk/incubator/vector/Int256VectorTests.java b/test/jdk/jdk/incubator/vector/Int256VectorTests.java index e4b3f491e31..597d5c6fdbb 100644 --- a/test/jdk/jdk/incubator/vector/Int256VectorTests.java +++ b/test/jdk/jdk/incubator/vector/Int256VectorTests.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2022, 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 @@ -3529,19 +3529,21 @@ public class Int256VectorTests extends AbstractVectorTest { } @Test(dataProvider = "intTestOpMaskProvider") - static void IS_DEFAULTMaskedInt256VectorTestsSmokeTest(IntFunction fa, + static void IS_DEFAULTMaskedInt256VectorTests(IntFunction fa, IntFunction fm) { int[] a = fa.apply(SPECIES.length()); boolean[] mask = fm.apply(SPECIES.length()); VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0); - for (int i = 0; i < a.length; i += SPECIES.length()) { - IntVector av = IntVector.fromArray(SPECIES, a, i); - VectorMask mv = av.test(VectorOperators.IS_DEFAULT, vmask); + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + IntVector av = IntVector.fromArray(SPECIES, a, i); + VectorMask mv = av.test(VectorOperators.IS_DEFAULT, vmask); - // Check results as part of computation. - for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); + // Check results as part of computation. + for (int j = 0; j < SPECIES.length(); j++) { + Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); + } } } } @@ -3567,19 +3569,21 @@ public class Int256VectorTests extends AbstractVectorTest { } @Test(dataProvider = "intTestOpMaskProvider") - static void IS_NEGATIVEMaskedInt256VectorTestsSmokeTest(IntFunction fa, + static void IS_NEGATIVEMaskedInt256VectorTests(IntFunction fa, IntFunction fm) { int[] a = fa.apply(SPECIES.length()); boolean[] mask = fm.apply(SPECIES.length()); VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0); - for (int i = 0; i < a.length; i += SPECIES.length()) { - IntVector av = IntVector.fromArray(SPECIES, a, i); - VectorMask mv = av.test(VectorOperators.IS_NEGATIVE, vmask); + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + IntVector av = IntVector.fromArray(SPECIES, a, i); + VectorMask mv = av.test(VectorOperators.IS_NEGATIVE, vmask); - // Check results as part of computation. - for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); + // Check results as part of computation. + for (int j = 0; j < SPECIES.length(); j++) { + Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); + } } } } diff --git a/test/jdk/jdk/incubator/vector/Int512VectorTests.java b/test/jdk/jdk/incubator/vector/Int512VectorTests.java index 503d24ab05c..075450c6adb 100644 --- a/test/jdk/jdk/incubator/vector/Int512VectorTests.java +++ b/test/jdk/jdk/incubator/vector/Int512VectorTests.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2022, 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 @@ -3529,19 +3529,21 @@ public class Int512VectorTests extends AbstractVectorTest { } @Test(dataProvider = "intTestOpMaskProvider") - static void IS_DEFAULTMaskedInt512VectorTestsSmokeTest(IntFunction fa, + static void IS_DEFAULTMaskedInt512VectorTests(IntFunction fa, IntFunction fm) { int[] a = fa.apply(SPECIES.length()); boolean[] mask = fm.apply(SPECIES.length()); VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0); - for (int i = 0; i < a.length; i += SPECIES.length()) { - IntVector av = IntVector.fromArray(SPECIES, a, i); - VectorMask mv = av.test(VectorOperators.IS_DEFAULT, vmask); + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + IntVector av = IntVector.fromArray(SPECIES, a, i); + VectorMask mv = av.test(VectorOperators.IS_DEFAULT, vmask); - // Check results as part of computation. - for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); + // Check results as part of computation. + for (int j = 0; j < SPECIES.length(); j++) { + Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); + } } } } @@ -3567,19 +3569,21 @@ public class Int512VectorTests extends AbstractVectorTest { } @Test(dataProvider = "intTestOpMaskProvider") - static void IS_NEGATIVEMaskedInt512VectorTestsSmokeTest(IntFunction fa, + static void IS_NEGATIVEMaskedInt512VectorTests(IntFunction fa, IntFunction fm) { int[] a = fa.apply(SPECIES.length()); boolean[] mask = fm.apply(SPECIES.length()); VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0); - for (int i = 0; i < a.length; i += SPECIES.length()) { - IntVector av = IntVector.fromArray(SPECIES, a, i); - VectorMask mv = av.test(VectorOperators.IS_NEGATIVE, vmask); + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + IntVector av = IntVector.fromArray(SPECIES, a, i); + VectorMask mv = av.test(VectorOperators.IS_NEGATIVE, vmask); - // Check results as part of computation. - for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); + // Check results as part of computation. + for (int j = 0; j < SPECIES.length(); j++) { + Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); + } } } } diff --git a/test/jdk/jdk/incubator/vector/Int64VectorTests.java b/test/jdk/jdk/incubator/vector/Int64VectorTests.java index 2bebc06d0e2..0d2346215d1 100644 --- a/test/jdk/jdk/incubator/vector/Int64VectorTests.java +++ b/test/jdk/jdk/incubator/vector/Int64VectorTests.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2022, 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 @@ -3529,19 +3529,21 @@ public class Int64VectorTests extends AbstractVectorTest { } @Test(dataProvider = "intTestOpMaskProvider") - static void IS_DEFAULTMaskedInt64VectorTestsSmokeTest(IntFunction fa, + static void IS_DEFAULTMaskedInt64VectorTests(IntFunction fa, IntFunction fm) { int[] a = fa.apply(SPECIES.length()); boolean[] mask = fm.apply(SPECIES.length()); VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0); - for (int i = 0; i < a.length; i += SPECIES.length()) { - IntVector av = IntVector.fromArray(SPECIES, a, i); - VectorMask mv = av.test(VectorOperators.IS_DEFAULT, vmask); + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + IntVector av = IntVector.fromArray(SPECIES, a, i); + VectorMask mv = av.test(VectorOperators.IS_DEFAULT, vmask); - // Check results as part of computation. - for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); + // Check results as part of computation. + for (int j = 0; j < SPECIES.length(); j++) { + Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); + } } } } @@ -3567,19 +3569,21 @@ public class Int64VectorTests extends AbstractVectorTest { } @Test(dataProvider = "intTestOpMaskProvider") - static void IS_NEGATIVEMaskedInt64VectorTestsSmokeTest(IntFunction fa, + static void IS_NEGATIVEMaskedInt64VectorTests(IntFunction fa, IntFunction fm) { int[] a = fa.apply(SPECIES.length()); boolean[] mask = fm.apply(SPECIES.length()); VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0); - for (int i = 0; i < a.length; i += SPECIES.length()) { - IntVector av = IntVector.fromArray(SPECIES, a, i); - VectorMask mv = av.test(VectorOperators.IS_NEGATIVE, vmask); + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + IntVector av = IntVector.fromArray(SPECIES, a, i); + VectorMask mv = av.test(VectorOperators.IS_NEGATIVE, vmask); - // Check results as part of computation. - for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); + // Check results as part of computation. + for (int j = 0; j < SPECIES.length(); j++) { + Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); + } } } } diff --git a/test/jdk/jdk/incubator/vector/IntMaxVectorTests.java b/test/jdk/jdk/incubator/vector/IntMaxVectorTests.java index faf232e2985..eb735c101e7 100644 --- a/test/jdk/jdk/incubator/vector/IntMaxVectorTests.java +++ b/test/jdk/jdk/incubator/vector/IntMaxVectorTests.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2022, 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 @@ -3534,19 +3534,21 @@ public class IntMaxVectorTests extends AbstractVectorTest { } @Test(dataProvider = "intTestOpMaskProvider") - static void IS_DEFAULTMaskedIntMaxVectorTestsSmokeTest(IntFunction fa, + static void IS_DEFAULTMaskedIntMaxVectorTests(IntFunction fa, IntFunction fm) { int[] a = fa.apply(SPECIES.length()); boolean[] mask = fm.apply(SPECIES.length()); VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0); - for (int i = 0; i < a.length; i += SPECIES.length()) { - IntVector av = IntVector.fromArray(SPECIES, a, i); - VectorMask mv = av.test(VectorOperators.IS_DEFAULT, vmask); + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + IntVector av = IntVector.fromArray(SPECIES, a, i); + VectorMask mv = av.test(VectorOperators.IS_DEFAULT, vmask); - // Check results as part of computation. - for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); + // Check results as part of computation. + for (int j = 0; j < SPECIES.length(); j++) { + Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); + } } } } @@ -3572,19 +3574,21 @@ public class IntMaxVectorTests extends AbstractVectorTest { } @Test(dataProvider = "intTestOpMaskProvider") - static void IS_NEGATIVEMaskedIntMaxVectorTestsSmokeTest(IntFunction fa, + static void IS_NEGATIVEMaskedIntMaxVectorTests(IntFunction fa, IntFunction fm) { int[] a = fa.apply(SPECIES.length()); boolean[] mask = fm.apply(SPECIES.length()); VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0); - for (int i = 0; i < a.length; i += SPECIES.length()) { - IntVector av = IntVector.fromArray(SPECIES, a, i); - VectorMask mv = av.test(VectorOperators.IS_NEGATIVE, vmask); + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + IntVector av = IntVector.fromArray(SPECIES, a, i); + VectorMask mv = av.test(VectorOperators.IS_NEGATIVE, vmask); - // Check results as part of computation. - for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); + // Check results as part of computation. + for (int j = 0; j < SPECIES.length(); j++) { + Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); + } } } } diff --git a/test/jdk/jdk/incubator/vector/Long128VectorTests.java b/test/jdk/jdk/incubator/vector/Long128VectorTests.java index 74d251476b2..da8c3fc8022 100644 --- a/test/jdk/jdk/incubator/vector/Long128VectorTests.java +++ b/test/jdk/jdk/incubator/vector/Long128VectorTests.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2022, 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 @@ -3551,19 +3551,21 @@ public class Long128VectorTests extends AbstractVectorTest { } @Test(dataProvider = "longTestOpMaskProvider") - static void IS_DEFAULTMaskedLong128VectorTestsSmokeTest(IntFunction fa, + static void IS_DEFAULTMaskedLong128VectorTests(IntFunction fa, IntFunction fm) { long[] a = fa.apply(SPECIES.length()); boolean[] mask = fm.apply(SPECIES.length()); VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0); - for (int i = 0; i < a.length; i += SPECIES.length()) { - LongVector av = LongVector.fromArray(SPECIES, a, i); - VectorMask mv = av.test(VectorOperators.IS_DEFAULT, vmask); + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + LongVector av = LongVector.fromArray(SPECIES, a, i); + VectorMask mv = av.test(VectorOperators.IS_DEFAULT, vmask); - // Check results as part of computation. - for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); + // Check results as part of computation. + for (int j = 0; j < SPECIES.length(); j++) { + Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); + } } } } @@ -3589,19 +3591,21 @@ public class Long128VectorTests extends AbstractVectorTest { } @Test(dataProvider = "longTestOpMaskProvider") - static void IS_NEGATIVEMaskedLong128VectorTestsSmokeTest(IntFunction fa, + static void IS_NEGATIVEMaskedLong128VectorTests(IntFunction fa, IntFunction fm) { long[] a = fa.apply(SPECIES.length()); boolean[] mask = fm.apply(SPECIES.length()); VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0); - for (int i = 0; i < a.length; i += SPECIES.length()) { - LongVector av = LongVector.fromArray(SPECIES, a, i); - VectorMask mv = av.test(VectorOperators.IS_NEGATIVE, vmask); + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + LongVector av = LongVector.fromArray(SPECIES, a, i); + VectorMask mv = av.test(VectorOperators.IS_NEGATIVE, vmask); - // Check results as part of computation. - for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); + // Check results as part of computation. + for (int j = 0; j < SPECIES.length(); j++) { + Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); + } } } } diff --git a/test/jdk/jdk/incubator/vector/Long256VectorTests.java b/test/jdk/jdk/incubator/vector/Long256VectorTests.java index 4d2acbddd86..6e291fc3c10 100644 --- a/test/jdk/jdk/incubator/vector/Long256VectorTests.java +++ b/test/jdk/jdk/incubator/vector/Long256VectorTests.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2022, 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 @@ -3551,19 +3551,21 @@ public class Long256VectorTests extends AbstractVectorTest { } @Test(dataProvider = "longTestOpMaskProvider") - static void IS_DEFAULTMaskedLong256VectorTestsSmokeTest(IntFunction fa, + static void IS_DEFAULTMaskedLong256VectorTests(IntFunction fa, IntFunction fm) { long[] a = fa.apply(SPECIES.length()); boolean[] mask = fm.apply(SPECIES.length()); VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0); - for (int i = 0; i < a.length; i += SPECIES.length()) { - LongVector av = LongVector.fromArray(SPECIES, a, i); - VectorMask mv = av.test(VectorOperators.IS_DEFAULT, vmask); + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + LongVector av = LongVector.fromArray(SPECIES, a, i); + VectorMask mv = av.test(VectorOperators.IS_DEFAULT, vmask); - // Check results as part of computation. - for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); + // Check results as part of computation. + for (int j = 0; j < SPECIES.length(); j++) { + Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); + } } } } @@ -3589,19 +3591,21 @@ public class Long256VectorTests extends AbstractVectorTest { } @Test(dataProvider = "longTestOpMaskProvider") - static void IS_NEGATIVEMaskedLong256VectorTestsSmokeTest(IntFunction fa, + static void IS_NEGATIVEMaskedLong256VectorTests(IntFunction fa, IntFunction fm) { long[] a = fa.apply(SPECIES.length()); boolean[] mask = fm.apply(SPECIES.length()); VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0); - for (int i = 0; i < a.length; i += SPECIES.length()) { - LongVector av = LongVector.fromArray(SPECIES, a, i); - VectorMask mv = av.test(VectorOperators.IS_NEGATIVE, vmask); + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + LongVector av = LongVector.fromArray(SPECIES, a, i); + VectorMask mv = av.test(VectorOperators.IS_NEGATIVE, vmask); - // Check results as part of computation. - for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); + // Check results as part of computation. + for (int j = 0; j < SPECIES.length(); j++) { + Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); + } } } } diff --git a/test/jdk/jdk/incubator/vector/Long512VectorTests.java b/test/jdk/jdk/incubator/vector/Long512VectorTests.java index 9bb6f568fca..8b0e64d5ae4 100644 --- a/test/jdk/jdk/incubator/vector/Long512VectorTests.java +++ b/test/jdk/jdk/incubator/vector/Long512VectorTests.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2022, 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 @@ -3551,19 +3551,21 @@ public class Long512VectorTests extends AbstractVectorTest { } @Test(dataProvider = "longTestOpMaskProvider") - static void IS_DEFAULTMaskedLong512VectorTestsSmokeTest(IntFunction fa, + static void IS_DEFAULTMaskedLong512VectorTests(IntFunction fa, IntFunction fm) { long[] a = fa.apply(SPECIES.length()); boolean[] mask = fm.apply(SPECIES.length()); VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0); - for (int i = 0; i < a.length; i += SPECIES.length()) { - LongVector av = LongVector.fromArray(SPECIES, a, i); - VectorMask mv = av.test(VectorOperators.IS_DEFAULT, vmask); + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + LongVector av = LongVector.fromArray(SPECIES, a, i); + VectorMask mv = av.test(VectorOperators.IS_DEFAULT, vmask); - // Check results as part of computation. - for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); + // Check results as part of computation. + for (int j = 0; j < SPECIES.length(); j++) { + Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); + } } } } @@ -3589,19 +3591,21 @@ public class Long512VectorTests extends AbstractVectorTest { } @Test(dataProvider = "longTestOpMaskProvider") - static void IS_NEGATIVEMaskedLong512VectorTestsSmokeTest(IntFunction fa, + static void IS_NEGATIVEMaskedLong512VectorTests(IntFunction fa, IntFunction fm) { long[] a = fa.apply(SPECIES.length()); boolean[] mask = fm.apply(SPECIES.length()); VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0); - for (int i = 0; i < a.length; i += SPECIES.length()) { - LongVector av = LongVector.fromArray(SPECIES, a, i); - VectorMask mv = av.test(VectorOperators.IS_NEGATIVE, vmask); + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + LongVector av = LongVector.fromArray(SPECIES, a, i); + VectorMask mv = av.test(VectorOperators.IS_NEGATIVE, vmask); - // Check results as part of computation. - for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); + // Check results as part of computation. + for (int j = 0; j < SPECIES.length(); j++) { + Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); + } } } } diff --git a/test/jdk/jdk/incubator/vector/Long64VectorTests.java b/test/jdk/jdk/incubator/vector/Long64VectorTests.java index 50976531dac..f3134e72b21 100644 --- a/test/jdk/jdk/incubator/vector/Long64VectorTests.java +++ b/test/jdk/jdk/incubator/vector/Long64VectorTests.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2022, 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 @@ -3551,19 +3551,21 @@ public class Long64VectorTests extends AbstractVectorTest { } @Test(dataProvider = "longTestOpMaskProvider") - static void IS_DEFAULTMaskedLong64VectorTestsSmokeTest(IntFunction fa, + static void IS_DEFAULTMaskedLong64VectorTests(IntFunction fa, IntFunction fm) { long[] a = fa.apply(SPECIES.length()); boolean[] mask = fm.apply(SPECIES.length()); VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0); - for (int i = 0; i < a.length; i += SPECIES.length()) { - LongVector av = LongVector.fromArray(SPECIES, a, i); - VectorMask mv = av.test(VectorOperators.IS_DEFAULT, vmask); + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + LongVector av = LongVector.fromArray(SPECIES, a, i); + VectorMask mv = av.test(VectorOperators.IS_DEFAULT, vmask); - // Check results as part of computation. - for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); + // Check results as part of computation. + for (int j = 0; j < SPECIES.length(); j++) { + Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); + } } } } @@ -3589,19 +3591,21 @@ public class Long64VectorTests extends AbstractVectorTest { } @Test(dataProvider = "longTestOpMaskProvider") - static void IS_NEGATIVEMaskedLong64VectorTestsSmokeTest(IntFunction fa, + static void IS_NEGATIVEMaskedLong64VectorTests(IntFunction fa, IntFunction fm) { long[] a = fa.apply(SPECIES.length()); boolean[] mask = fm.apply(SPECIES.length()); VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0); - for (int i = 0; i < a.length; i += SPECIES.length()) { - LongVector av = LongVector.fromArray(SPECIES, a, i); - VectorMask mv = av.test(VectorOperators.IS_NEGATIVE, vmask); + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + LongVector av = LongVector.fromArray(SPECIES, a, i); + VectorMask mv = av.test(VectorOperators.IS_NEGATIVE, vmask); - // Check results as part of computation. - for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); + // Check results as part of computation. + for (int j = 0; j < SPECIES.length(); j++) { + Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); + } } } } diff --git a/test/jdk/jdk/incubator/vector/LongMaxVectorTests.java b/test/jdk/jdk/incubator/vector/LongMaxVectorTests.java index eb16136a0d6..749ec641d3d 100644 --- a/test/jdk/jdk/incubator/vector/LongMaxVectorTests.java +++ b/test/jdk/jdk/incubator/vector/LongMaxVectorTests.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2022, 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 @@ -3556,19 +3556,21 @@ public class LongMaxVectorTests extends AbstractVectorTest { } @Test(dataProvider = "longTestOpMaskProvider") - static void IS_DEFAULTMaskedLongMaxVectorTestsSmokeTest(IntFunction fa, + static void IS_DEFAULTMaskedLongMaxVectorTests(IntFunction fa, IntFunction fm) { long[] a = fa.apply(SPECIES.length()); boolean[] mask = fm.apply(SPECIES.length()); VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0); - for (int i = 0; i < a.length; i += SPECIES.length()) { - LongVector av = LongVector.fromArray(SPECIES, a, i); - VectorMask mv = av.test(VectorOperators.IS_DEFAULT, vmask); + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + LongVector av = LongVector.fromArray(SPECIES, a, i); + VectorMask mv = av.test(VectorOperators.IS_DEFAULT, vmask); - // Check results as part of computation. - for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); + // Check results as part of computation. + for (int j = 0; j < SPECIES.length(); j++) { + Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); + } } } } @@ -3594,19 +3596,21 @@ public class LongMaxVectorTests extends AbstractVectorTest { } @Test(dataProvider = "longTestOpMaskProvider") - static void IS_NEGATIVEMaskedLongMaxVectorTestsSmokeTest(IntFunction fa, + static void IS_NEGATIVEMaskedLongMaxVectorTests(IntFunction fa, IntFunction fm) { long[] a = fa.apply(SPECIES.length()); boolean[] mask = fm.apply(SPECIES.length()); VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0); - for (int i = 0; i < a.length; i += SPECIES.length()) { - LongVector av = LongVector.fromArray(SPECIES, a, i); - VectorMask mv = av.test(VectorOperators.IS_NEGATIVE, vmask); + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + LongVector av = LongVector.fromArray(SPECIES, a, i); + VectorMask mv = av.test(VectorOperators.IS_NEGATIVE, vmask); - // Check results as part of computation. - for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); + // Check results as part of computation. + for (int j = 0; j < SPECIES.length(); j++) { + Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); + } } } } diff --git a/test/jdk/jdk/incubator/vector/Short128VectorTests.java b/test/jdk/jdk/incubator/vector/Short128VectorTests.java index 2a060c354cd..e933c0eaac5 100644 --- a/test/jdk/jdk/incubator/vector/Short128VectorTests.java +++ b/test/jdk/jdk/incubator/vector/Short128VectorTests.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2022, 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 @@ -3554,19 +3554,21 @@ public class Short128VectorTests extends AbstractVectorTest { } @Test(dataProvider = "shortTestOpMaskProvider") - static void IS_DEFAULTMaskedShort128VectorTestsSmokeTest(IntFunction fa, + static void IS_DEFAULTMaskedShort128VectorTests(IntFunction fa, IntFunction fm) { short[] a = fa.apply(SPECIES.length()); boolean[] mask = fm.apply(SPECIES.length()); VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0); - for (int i = 0; i < a.length; i += SPECIES.length()) { - ShortVector av = ShortVector.fromArray(SPECIES, a, i); - VectorMask mv = av.test(VectorOperators.IS_DEFAULT, vmask); + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + ShortVector av = ShortVector.fromArray(SPECIES, a, i); + VectorMask mv = av.test(VectorOperators.IS_DEFAULT, vmask); - // Check results as part of computation. - for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); + // Check results as part of computation. + for (int j = 0; j < SPECIES.length(); j++) { + Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); + } } } } @@ -3592,19 +3594,21 @@ public class Short128VectorTests extends AbstractVectorTest { } @Test(dataProvider = "shortTestOpMaskProvider") - static void IS_NEGATIVEMaskedShort128VectorTestsSmokeTest(IntFunction fa, + static void IS_NEGATIVEMaskedShort128VectorTests(IntFunction fa, IntFunction fm) { short[] a = fa.apply(SPECIES.length()); boolean[] mask = fm.apply(SPECIES.length()); VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0); - for (int i = 0; i < a.length; i += SPECIES.length()) { - ShortVector av = ShortVector.fromArray(SPECIES, a, i); - VectorMask mv = av.test(VectorOperators.IS_NEGATIVE, vmask); + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + ShortVector av = ShortVector.fromArray(SPECIES, a, i); + VectorMask mv = av.test(VectorOperators.IS_NEGATIVE, vmask); - // Check results as part of computation. - for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); + // Check results as part of computation. + for (int j = 0; j < SPECIES.length(); j++) { + Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); + } } } } diff --git a/test/jdk/jdk/incubator/vector/Short256VectorTests.java b/test/jdk/jdk/incubator/vector/Short256VectorTests.java index 46626d63aaf..75f7129e14b 100644 --- a/test/jdk/jdk/incubator/vector/Short256VectorTests.java +++ b/test/jdk/jdk/incubator/vector/Short256VectorTests.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2022, 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 @@ -3554,19 +3554,21 @@ public class Short256VectorTests extends AbstractVectorTest { } @Test(dataProvider = "shortTestOpMaskProvider") - static void IS_DEFAULTMaskedShort256VectorTestsSmokeTest(IntFunction fa, + static void IS_DEFAULTMaskedShort256VectorTests(IntFunction fa, IntFunction fm) { short[] a = fa.apply(SPECIES.length()); boolean[] mask = fm.apply(SPECIES.length()); VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0); - for (int i = 0; i < a.length; i += SPECIES.length()) { - ShortVector av = ShortVector.fromArray(SPECIES, a, i); - VectorMask mv = av.test(VectorOperators.IS_DEFAULT, vmask); + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + ShortVector av = ShortVector.fromArray(SPECIES, a, i); + VectorMask mv = av.test(VectorOperators.IS_DEFAULT, vmask); - // Check results as part of computation. - for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); + // Check results as part of computation. + for (int j = 0; j < SPECIES.length(); j++) { + Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); + } } } } @@ -3592,19 +3594,21 @@ public class Short256VectorTests extends AbstractVectorTest { } @Test(dataProvider = "shortTestOpMaskProvider") - static void IS_NEGATIVEMaskedShort256VectorTestsSmokeTest(IntFunction fa, + static void IS_NEGATIVEMaskedShort256VectorTests(IntFunction fa, IntFunction fm) { short[] a = fa.apply(SPECIES.length()); boolean[] mask = fm.apply(SPECIES.length()); VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0); - for (int i = 0; i < a.length; i += SPECIES.length()) { - ShortVector av = ShortVector.fromArray(SPECIES, a, i); - VectorMask mv = av.test(VectorOperators.IS_NEGATIVE, vmask); + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + ShortVector av = ShortVector.fromArray(SPECIES, a, i); + VectorMask mv = av.test(VectorOperators.IS_NEGATIVE, vmask); - // Check results as part of computation. - for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); + // Check results as part of computation. + for (int j = 0; j < SPECIES.length(); j++) { + Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); + } } } } diff --git a/test/jdk/jdk/incubator/vector/Short512VectorTests.java b/test/jdk/jdk/incubator/vector/Short512VectorTests.java index 2cff4a4802a..af7eea3b2c8 100644 --- a/test/jdk/jdk/incubator/vector/Short512VectorTests.java +++ b/test/jdk/jdk/incubator/vector/Short512VectorTests.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2022, 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 @@ -3554,19 +3554,21 @@ public class Short512VectorTests extends AbstractVectorTest { } @Test(dataProvider = "shortTestOpMaskProvider") - static void IS_DEFAULTMaskedShort512VectorTestsSmokeTest(IntFunction fa, + static void IS_DEFAULTMaskedShort512VectorTests(IntFunction fa, IntFunction fm) { short[] a = fa.apply(SPECIES.length()); boolean[] mask = fm.apply(SPECIES.length()); VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0); - for (int i = 0; i < a.length; i += SPECIES.length()) { - ShortVector av = ShortVector.fromArray(SPECIES, a, i); - VectorMask mv = av.test(VectorOperators.IS_DEFAULT, vmask); + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + ShortVector av = ShortVector.fromArray(SPECIES, a, i); + VectorMask mv = av.test(VectorOperators.IS_DEFAULT, vmask); - // Check results as part of computation. - for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); + // Check results as part of computation. + for (int j = 0; j < SPECIES.length(); j++) { + Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); + } } } } @@ -3592,19 +3594,21 @@ public class Short512VectorTests extends AbstractVectorTest { } @Test(dataProvider = "shortTestOpMaskProvider") - static void IS_NEGATIVEMaskedShort512VectorTestsSmokeTest(IntFunction fa, + static void IS_NEGATIVEMaskedShort512VectorTests(IntFunction fa, IntFunction fm) { short[] a = fa.apply(SPECIES.length()); boolean[] mask = fm.apply(SPECIES.length()); VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0); - for (int i = 0; i < a.length; i += SPECIES.length()) { - ShortVector av = ShortVector.fromArray(SPECIES, a, i); - VectorMask mv = av.test(VectorOperators.IS_NEGATIVE, vmask); + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + ShortVector av = ShortVector.fromArray(SPECIES, a, i); + VectorMask mv = av.test(VectorOperators.IS_NEGATIVE, vmask); - // Check results as part of computation. - for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); + // Check results as part of computation. + for (int j = 0; j < SPECIES.length(); j++) { + Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); + } } } } diff --git a/test/jdk/jdk/incubator/vector/Short64VectorTests.java b/test/jdk/jdk/incubator/vector/Short64VectorTests.java index 481081b75da..100bc4e3243 100644 --- a/test/jdk/jdk/incubator/vector/Short64VectorTests.java +++ b/test/jdk/jdk/incubator/vector/Short64VectorTests.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2022, 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 @@ -3554,19 +3554,21 @@ public class Short64VectorTests extends AbstractVectorTest { } @Test(dataProvider = "shortTestOpMaskProvider") - static void IS_DEFAULTMaskedShort64VectorTestsSmokeTest(IntFunction fa, + static void IS_DEFAULTMaskedShort64VectorTests(IntFunction fa, IntFunction fm) { short[] a = fa.apply(SPECIES.length()); boolean[] mask = fm.apply(SPECIES.length()); VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0); - for (int i = 0; i < a.length; i += SPECIES.length()) { - ShortVector av = ShortVector.fromArray(SPECIES, a, i); - VectorMask mv = av.test(VectorOperators.IS_DEFAULT, vmask); + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + ShortVector av = ShortVector.fromArray(SPECIES, a, i); + VectorMask mv = av.test(VectorOperators.IS_DEFAULT, vmask); - // Check results as part of computation. - for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); + // Check results as part of computation. + for (int j = 0; j < SPECIES.length(); j++) { + Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); + } } } } @@ -3592,19 +3594,21 @@ public class Short64VectorTests extends AbstractVectorTest { } @Test(dataProvider = "shortTestOpMaskProvider") - static void IS_NEGATIVEMaskedShort64VectorTestsSmokeTest(IntFunction fa, + static void IS_NEGATIVEMaskedShort64VectorTests(IntFunction fa, IntFunction fm) { short[] a = fa.apply(SPECIES.length()); boolean[] mask = fm.apply(SPECIES.length()); VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0); - for (int i = 0; i < a.length; i += SPECIES.length()) { - ShortVector av = ShortVector.fromArray(SPECIES, a, i); - VectorMask mv = av.test(VectorOperators.IS_NEGATIVE, vmask); + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + ShortVector av = ShortVector.fromArray(SPECIES, a, i); + VectorMask mv = av.test(VectorOperators.IS_NEGATIVE, vmask); - // Check results as part of computation. - for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); + // Check results as part of computation. + for (int j = 0; j < SPECIES.length(); j++) { + Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); + } } } } diff --git a/test/jdk/jdk/incubator/vector/ShortMaxVectorTests.java b/test/jdk/jdk/incubator/vector/ShortMaxVectorTests.java index 00d99484a13..bd71da2ab8e 100644 --- a/test/jdk/jdk/incubator/vector/ShortMaxVectorTests.java +++ b/test/jdk/jdk/incubator/vector/ShortMaxVectorTests.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2022, 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 @@ -3559,19 +3559,21 @@ public class ShortMaxVectorTests extends AbstractVectorTest { } @Test(dataProvider = "shortTestOpMaskProvider") - static void IS_DEFAULTMaskedShortMaxVectorTestsSmokeTest(IntFunction fa, + static void IS_DEFAULTMaskedShortMaxVectorTests(IntFunction fa, IntFunction fm) { short[] a = fa.apply(SPECIES.length()); boolean[] mask = fm.apply(SPECIES.length()); VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0); - for (int i = 0; i < a.length; i += SPECIES.length()) { - ShortVector av = ShortVector.fromArray(SPECIES, a, i); - VectorMask mv = av.test(VectorOperators.IS_DEFAULT, vmask); + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + ShortVector av = ShortVector.fromArray(SPECIES, a, i); + VectorMask mv = av.test(VectorOperators.IS_DEFAULT, vmask); - // Check results as part of computation. - for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); + // Check results as part of computation. + for (int j = 0; j < SPECIES.length(); j++) { + Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); + } } } } @@ -3597,19 +3599,21 @@ public class ShortMaxVectorTests extends AbstractVectorTest { } @Test(dataProvider = "shortTestOpMaskProvider") - static void IS_NEGATIVEMaskedShortMaxVectorTestsSmokeTest(IntFunction fa, + static void IS_NEGATIVEMaskedShortMaxVectorTests(IntFunction fa, IntFunction fm) { short[] a = fa.apply(SPECIES.length()); boolean[] mask = fm.apply(SPECIES.length()); VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0); - for (int i = 0; i < a.length; i += SPECIES.length()) { - ShortVector av = ShortVector.fromArray(SPECIES, a, i); - VectorMask mv = av.test(VectorOperators.IS_NEGATIVE, vmask); + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + ShortVector av = ShortVector.fromArray(SPECIES, a, i); + VectorMask mv = av.test(VectorOperators.IS_NEGATIVE, vmask); - // Check results as part of computation. - for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); + // Check results as part of computation. + for (int j = 0; j < SPECIES.length(); j++) { + Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); + } } } } diff --git a/test/jdk/jdk/incubator/vector/templates/Unit-Test.template b/test/jdk/jdk/incubator/vector/templates/Unit-Test.template index 03cb5a48733..c91be6191d2 100644 --- a/test/jdk/jdk/incubator/vector/templates/Unit-Test.template +++ b/test/jdk/jdk/incubator/vector/templates/Unit-Test.template @@ -20,19 +20,21 @@ } @Test(dataProvider = "$type$TestOpMaskProvider") - static void [[TEST]]Masked$vectorteststype$SmokeTest(IntFunction<$type$[]> fa, + static void [[TEST]]Masked$vectorteststype$(IntFunction<$type$[]> fa, IntFunction fm) { $type$[] a = fa.apply(SPECIES.length()); boolean[] mask = fm.apply(SPECIES.length()); VectorMask<$Wideboxtype$> vmask = VectorMask.fromArray(SPECIES, mask, 0); - for (int i = 0; i < a.length; i += SPECIES.length()) { - $abstractvectortype$ av = $abstractvectortype$.fromArray(SPECIES, a, i); - VectorMask<$Wideboxtype$> mv = av.test(VectorOperators.[[TEST]], vmask); + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + $abstractvectortype$ av = $abstractvectortype$.fromArray(SPECIES, a, i); + VectorMask<$Wideboxtype$> mv = av.test(VectorOperators.[[TEST]], vmask); - // Check results as part of computation. - for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && test[[TEST]](a[i + j])); + // Check results as part of computation. + for (int j = 0; j < SPECIES.length(); j++) { + Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && test[[TEST]](a[i + j])); + } } } } diff --git a/test/jdk/jdk/incubator/vector/templates/Unit-header.template b/test/jdk/jdk/incubator/vector/templates/Unit-header.template index 239596bf433..e010bb7268b 100644 --- a/test/jdk/jdk/incubator/vector/templates/Unit-header.template +++ b/test/jdk/jdk/incubator/vector/templates/Unit-header.template @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2022, 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 -- GitLab From 31ad80a229e3f67823ff8f1fc914c5503f184b57 Mon Sep 17 00:00:00 2001 From: Tim Prinzing Date: Wed, 9 Mar 2022 04:02:17 +0000 Subject: [PATCH 196/340] 8280902: ResourceBundle::getBundle may throw NPE when invoked by JNI code with no caller frame Reviewed-by: naoto, mchung, ihse --- make/test/JtregNativeJdk.gmk | 2 + .../classes/java/util/ResourceBundle.java | 39 +++++-- .../NullCallerResourceBundle.java | 83 ++++++++++++++ .../exeNullCallerResourceBundle.c | 102 ++++++++++++++++++ 4 files changed, 215 insertions(+), 11 deletions(-) create mode 100644 test/jdk/java/util/ResourceBundle/exeNullCallerResourceBundle/NullCallerResourceBundle.java create mode 100644 test/jdk/java/util/ResourceBundle/exeNullCallerResourceBundle/exeNullCallerResourceBundle.c diff --git a/make/test/JtregNativeJdk.gmk b/make/test/JtregNativeJdk.gmk index 6797952bc05..89cc94f90bf 100644 --- a/make/test/JtregNativeJdk.gmk +++ b/make/test/JtregNativeJdk.gmk @@ -64,6 +64,7 @@ ifeq ($(call isTargetOs, windows), true) BUILD_JDK_JTREG_EXECUTABLES_LIBS_exeCallerAccessTest := jvm.lib BUILD_JDK_JTREG_EXECUTABLES_LIBS_exeNullCallerClassLoaderTest := jvm.lib BUILD_JDK_JTREG_EXECUTABLES_LIBS_exeNullCallerLookupTest := jvm.lib + BUILD_JDK_JTREG_EXECUTABLES_LIBS_exeNullCallerResourceBundle := jvm.lib BUILD_JDK_JTREG_EXECUTABLES_LIBS_exerevokeall := advapi32.lib BUILD_JDK_JTREG_LIBRARIES_CFLAGS_libAsyncStackWalk := /EHsc BUILD_JDK_JTREG_LIBRARIES_CFLAGS_libAsyncInvokers := /EHsc @@ -84,6 +85,7 @@ else BUILD_JDK_JTREG_EXECUTABLES_LIBS_exeCallerAccessTest := -ljvm BUILD_JDK_JTREG_EXECUTABLES_LIBS_exeNullCallerClassLoaderTest := -ljvm BUILD_JDK_JTREG_EXECUTABLES_LIBS_exeNullCallerLookupTest := -ljvm + BUILD_JDK_JTREG_EXECUTABLES_LIBS_exeNullCallerResourceBundle := -ljvm endif ifeq ($(call isTargetOs, macosx), true) diff --git a/src/java.base/share/classes/java/util/ResourceBundle.java b/src/java.base/share/classes/java/util/ResourceBundle.java index 052de0555c7..2e6ecf46582 100644 --- a/src/java.base/share/classes/java/util/ResourceBundle.java +++ b/src/java.base/share/classes/java/util/ResourceBundle.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2022, 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 @@ -256,6 +256,12 @@ import static sun.security.util.SecurityConstants.GET_CLASSLOADER_PERMISSION; * resource bundle provider, it does not fall back to the * class loader search. * + *

    + * In cases where the {@code getBundle} factory method is called from a context + * where there is no caller frame on the stack (e.g. when called directly from + * a JNI attached thread), the caller module is default to the unnamed module for the + * {@linkplain ClassLoader#getSystemClassLoader system class loader}. + * *

    Resource bundles in automatic modules

    * * A common format of resource bundles is in {@linkplain PropertyResourceBundle @@ -1505,7 +1511,8 @@ public abstract class ResourceBundle { } private static Control getDefaultControl(Class caller, String baseName) { - return getDefaultControl(caller.getModule(), baseName); + Module callerModule = getCallerModule(caller); + return getDefaultControl(callerModule, baseName); } private static Control getDefaultControl(Module targetModule, String baseName) { @@ -1536,7 +1543,8 @@ public abstract class ResourceBundle { } private static void checkNamedModule(Class caller) { - if (caller.getModule().isNamed()) { + Module callerModule = getCallerModule(caller); + if (callerModule.isNamed()) { throw new UnsupportedOperationException( "ResourceBundle.Control not supported in named modules"); } @@ -1546,7 +1554,19 @@ public abstract class ResourceBundle { Locale locale, Class caller, Control control) { - return getBundleImpl(baseName, locale, caller, caller.getClassLoader(), control); + ClassLoader loader = getLoader(getCallerModule(caller)); + return getBundleImpl(baseName, locale, caller, loader, control); + } + + /* + * Determine the module to be used for the caller. If + * Reflection::getCallerClass is called from JNI with an empty + * stack frame the caller will be null, so the system class loader unnamed + * module will be used. + */ + private static Module getCallerModule(Class caller) { + return (caller != null) ? caller.getModule() + : ClassLoader.getSystemClassLoader().getUnnamedModule(); } /** @@ -1565,10 +1585,7 @@ public abstract class ResourceBundle { Class caller, ClassLoader loader, Control control) { - if (caller == null) { - throw new InternalError("null caller"); - } - Module callerModule = caller.getModule(); + Module callerModule = getCallerModule(caller); // get resource bundles for a named module only if loader is the module's class loader if (callerModule.isNamed() && loader == getLoader(callerModule)) { @@ -1592,7 +1609,7 @@ public abstract class ResourceBundle { Locale locale, Control control) { Objects.requireNonNull(module); - Module callerModule = caller.getModule(); + Module callerModule = getCallerModule(caller); if (callerModule != module) { @SuppressWarnings("removal") SecurityManager sm = System.getSecurityManager(); @@ -2228,9 +2245,9 @@ public abstract class ResourceBundle { */ @CallerSensitive public static final void clearCache() { - Class caller = Reflection.getCallerClass(); + Module callerModule = getCallerModule(Reflection.getCallerClass()); cacheList.keySet().removeIf( - key -> key.getCallerModule() == caller.getModule() + key -> key.getCallerModule() == callerModule ); } diff --git a/test/jdk/java/util/ResourceBundle/exeNullCallerResourceBundle/NullCallerResourceBundle.java b/test/jdk/java/util/ResourceBundle/exeNullCallerResourceBundle/NullCallerResourceBundle.java new file mode 100644 index 00000000000..edbcf3ba316 --- /dev/null +++ b/test/jdk/java/util/ResourceBundle/exeNullCallerResourceBundle/NullCallerResourceBundle.java @@ -0,0 +1,83 @@ +/* + * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + * + */ + +/** + * @test + * @bug 8280902 + * @summary Test uses custom launcher that starts VM using JNI that verifies + * ResourceBundle::getBundle with null caller class functions properly + * using the system class loader unnamed module. The custom launcher + * creates a properties file and passes the VM option to the JNI + * functionality for the resource lookup. + * @library /test/lib + * @requires os.family != "aix" + * @run main/native NullCallerResourceBundle + */ + +// Test disabled on AIX since we cannot invoke the JVM on the primordial thread. + +import java.io.File; +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.Properties; +import jdk.test.lib.Platform; +import jdk.test.lib.process.OutputAnalyzer; + +public class NullCallerResourceBundle { + public static void main(String[] args) throws IOException { + + // build a properties file for the native test + var propPath = Path.of(System.getProperty("test.classes"), "NullCallerResource.properties"); + try (var stream = Files.newOutputStream(propPath)) { + var props = new Properties(); + props.put("message", "Hello!"); + props.save(stream, "Test property list"); + } + + var launcher = Path.of(System.getProperty("test.nativepath"), "NullCallerResourceBundle"); + var classpathAppend = "-Djava.class.path=" + System.getProperty("test.classes"); + var pb = new ProcessBuilder(launcher.toString(), classpathAppend); + var env = pb.environment(); + + var libDir = Platform.libDir().toString(); + var vmDir = Platform.jvmLibDir().toString(); + + // set up shared library path + var sharedLibraryPathEnvName = Platform.sharedLibraryPathVariableName(); + env.compute(sharedLibraryPathEnvName, + (k, v) -> (v == null) ? libDir : v + File.pathSeparator + libDir); + env.compute(sharedLibraryPathEnvName, + (k, v) -> (v == null) ? vmDir : v + File.pathSeparator + vmDir); + + System.out.println("Launching: " + launcher + " shared library path: " + + env.get(sharedLibraryPathEnvName)); + new OutputAnalyzer(pb.start()) + .outputTo(System.out) + .errorTo(System.err) + .shouldHaveExitValue(0); + } + +} + diff --git a/test/jdk/java/util/ResourceBundle/exeNullCallerResourceBundle/exeNullCallerResourceBundle.c b/test/jdk/java/util/ResourceBundle/exeNullCallerResourceBundle/exeNullCallerResourceBundle.c new file mode 100644 index 00000000000..309873df795 --- /dev/null +++ b/test/jdk/java/util/ResourceBundle/exeNullCallerResourceBundle/exeNullCallerResourceBundle.c @@ -0,0 +1,102 @@ +/* + * Copyright (c) 2022, 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. + */ + +#include +#include + +#include "jni.h" +#undef NDEBUG +#include "assert.h" +#include "string.h" + + +/* + * The java test running this native test passes in an argument to provide as + * an option for the configuration of the JVM. The system classpath has the + * classpath of the java test appended so it can pick up the resource that + * was created by the java part of the test. + */ +int main(int argc, char** args) { + JavaVM *jvm; + JNIEnv *env; + JavaVMInitArgs vm_args; + JavaVMOption options[1]; + jint rc; + + assert(argc == 2); + options[0].optionString = args[1]; + + vm_args.version = JNI_VERSION_1_2; + vm_args.nOptions = 1; + vm_args.options = options; + + if ((rc = JNI_CreateJavaVM(&jvm, (void**)&env, &vm_args)) != JNI_OK) { + printf("ERROR: cannot create VM.\n"); + exit(-1); + } + + // b = ResourceBundle.getBundle("NullCallerResource"); + jclass class_ResourceBundle = (*env)->FindClass(env, "java/util/ResourceBundle"); + assert(class_ResourceBundle != NULL); + jmethodID mid_ResourceBundle_getBundle = (*env)->GetStaticMethodID(env, class_ResourceBundle, "getBundle", "(Ljava/lang/String;)Ljava/util/ResourceBundle;" ); + assert(mid_ResourceBundle_getBundle != NULL); + jobject resourceName = (*env)->NewStringUTF(env, "NullCallerResource"); + assert(resourceName != NULL); + jobject b = (*env)->CallStaticObjectMethod(env, class_ResourceBundle, mid_ResourceBundle_getBundle, resourceName); + if ((*env)->ExceptionOccurred(env) != NULL) { + printf("ERROR: Exception was thrown calling ResourceBundle::getBundle.\n"); + (*env)->ExceptionDescribe(env); + exit(-1); + } + + // msg = b.getString("message"); + jmethodID mid_ResourceBundle_getString = (*env)->GetMethodID(env, class_ResourceBundle, "getString", "(Ljava/lang/String;)Ljava/lang/String;" ); + assert(mid_ResourceBundle_getString != NULL); + jobject key = (*env)->NewStringUTF(env, "message"); + jobject msg =(*env)->CallObjectMethod(env, b, mid_ResourceBundle_getString, key); + if ((*env)->ExceptionOccurred(env) != NULL) { + printf("ERROR: Exception was thrown calling ResourceBundle::getString.\n"); + (*env)->ExceptionDescribe(env); + exit(-1); + } + assert(msg != NULL); + + // check the message + const char* cstr = (*env)->GetStringUTFChars(env, msg, NULL); + assert(cstr != NULL); + assert(strcmp(cstr,"Hello!") == 0); + + // ResourceBundle.clearCache() + jmethodID mid_ResourceBundle_clearCache = (*env)->GetStaticMethodID(env, class_ResourceBundle, "clearCache", "()V" ); + assert(mid_ResourceBundle_clearCache != NULL); + (*env)->CallStaticVoidMethod(env, class_ResourceBundle, mid_ResourceBundle_clearCache); + if ((*env)->ExceptionOccurred(env) != NULL) { + printf("ERROR: Exception was thrown calling ResourceBundle::clearCache.\n"); + (*env)->ExceptionDescribe(env); + exit(-1); + } + + (*jvm)->DestroyJavaVM(jvm); + return 0; +} + -- GitLab From d07f7c76c5df1473bffa41f10a89ca1e21e001ef Mon Sep 17 00:00:00 2001 From: Emanuel Peter Date: Wed, 9 Mar 2022 08:59:37 +0000 Subject: [PATCH 197/340] 8282665: [REDO] ByteBufferTest.java: replace endless recursion with RuntimeException in void ck(double x, double y) Reviewed-by: psandoz, thartmann --- .../intrinsics/unsafe/ByteBufferTest.java | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/test/hotspot/jtreg/compiler/intrinsics/unsafe/ByteBufferTest.java b/test/hotspot/jtreg/compiler/intrinsics/unsafe/ByteBufferTest.java index 6294e90a8a9..194ce17af7a 100644 --- a/test/hotspot/jtreg/compiler/intrinsics/unsafe/ByteBufferTest.java +++ b/test/hotspot/jtreg/compiler/intrinsics/unsafe/ByteBufferTest.java @@ -211,13 +211,22 @@ class MyByteBuffer { void ck(long x, long y) { if (x != y) { - throw new RuntimeException(" x = " + Long.toHexString(x) + ", y = " + Long.toHexString(y)); + throw new RuntimeException("expect x == y: x = " + Long.toHexString(x) + ", y = " + Long.toHexString(y)); } } void ck(double x, double y) { - if (x == x && y == y && x != y) { - ck(x, y); + // Check if x and y have identical values. + // Remember: NaN == x is false for ANY x, including if x is NaN (IEEE standard). + // Therefore, if x and y are NaN, x != y would return true, which is not what we want. + // We do not want an Exception if both are NaN. + // Double.compare takes care of these special cases + // including NaNs, and comparing -0.0 to 0.0 + if (Double.compare(x,y) != 0) { + throw new RuntimeException("expect x == y:" + + " x = " + Double.toString(x) + ", y = " + Double.toString(y) + + " (x = " + Long.toHexString(Double.doubleToRawLongBits(x)) + + ", y = " + Long.toHexString(Double.doubleToRawLongBits(y)) + ")"); } } -- GitLab From 5df2a057707eb65148f96710bd57d8dd8d85d1ed Mon Sep 17 00:00:00 2001 From: Zhengyu Gu Date: Wed, 9 Mar 2022 13:27:11 +0000 Subject: [PATCH 198/340] 8282628: Potential memory leak in sun.font.FontConfigManager.getFontConfig() Reviewed-by: stuefe, dholmes, aivanov --- src/java.desktop/unix/native/common/awt/fontpath.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/java.desktop/unix/native/common/awt/fontpath.c b/src/java.desktop/unix/native/common/awt/fontpath.c index c4b2fcb73c0..051c9de88fa 100644 --- a/src/java.desktop/unix/native/common/awt/fontpath.c +++ b/src/java.desktop/unix/native/common/awt/fontpath.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2022, 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 @@ -935,8 +935,10 @@ Java_sun_font_FontConfigManager_getFontConfig if (cacheDirs != NULL) { while ((cnt < max) && (cacheDir = (*FcStrListNext)(cacheDirs))) { jstr = (*env)->NewStringUTF(env, (const char*)cacheDir); - JNU_CHECK_EXCEPTION(env); - + if (IS_NULL(jstr)) { + (*FcStrListDone)(cacheDirs); + return; + } (*env)->SetObjectArrayElement(env, cacheDirArray, cnt++, jstr); (*env)->DeleteLocalRef(env, jstr); } -- GitLab From 6d8d156c97b90a9ab4776c6b42563a962d959741 Mon Sep 17 00:00:00 2001 From: Xue-Lei Andrew Fan Date: Wed, 9 Mar 2022 16:11:07 +0000 Subject: [PATCH 199/340] 8280494: (D)TLS signature schemes Reviewed-by: mullan --- .../classes/javax/net/ssl/SSLParameters.java | 148 ++++++++++++++++-- .../sun/security/ssl/SSLConfiguration.java | 70 +++++---- .../sun/security/ssl/SignatureScheme.java | 54 +++++-- .../classes/sun/security/ssl/Utilities.java | 12 +- .../net/ssl/DTLS/DTLSSignatureSchemes.java | 137 ++++++++++++++++ .../ssl/SSLParameters/SignatureSchemes.java | 147 +++++++++++++++++ 6 files changed, 509 insertions(+), 59 deletions(-) create mode 100644 test/jdk/javax/net/ssl/DTLS/DTLSSignatureSchemes.java create mode 100644 test/jdk/javax/net/ssl/SSLParameters/SignatureSchemes.java diff --git a/src/java.base/share/classes/javax/net/ssl/SSLParameters.java b/src/java.base/share/classes/javax/net/ssl/SSLParameters.java index 5926c48aed0..b4fbdf9a437 100644 --- a/src/java.base/share/classes/javax/net/ssl/SSLParameters.java +++ b/src/java.base/share/classes/javax/net/ssl/SSLParameters.java @@ -33,18 +33,20 @@ import java.util.*; * are the list of ciphersuites to be accepted in an SSL/TLS/DTLS handshake, * the list of protocols to be allowed, the endpoint identification * algorithm during SSL/TLS/DTLS handshaking, the Server Name Indication (SNI), - * the maximum network packet size, the algorithm constraints and whether - * SSL/TLS/DTLS servers should request or require client authentication, etc. + * the maximum network packet size, the algorithm constraints, the signature + * schemes and whether SSL/TLS/DTLS servers should request or require client + * authentication, etc. *

    - * SSLParameters can be created via the constructors in this class. - * Objects can also be obtained using the {@code getSSLParameters()} - * methods in + * {@code SSLParameter} objects can be created via the constructors in this + * class, and can be described as pre-populated objects. {@code SSLParameter} + * objects can also be obtained using the {@code getSSLParameters()} methods in * {@link SSLSocket#getSSLParameters SSLSocket} and * {@link SSLServerSocket#getSSLParameters SSLServerSocket} and * {@link SSLEngine#getSSLParameters SSLEngine} or the * {@link SSLContext#getDefaultSSLParameters getDefaultSSLParameters()} and * {@link SSLContext#getSupportedSSLParameters getSupportedSSLParameters()} - * methods in {@code SSLContext}. + * methods in {@code SSLContext}, and can be described as connection populated + * objects. *

    * SSLParameters can be applied to a connection via the methods * {@link SSLSocket#setSSLParameters SSLSocket.setSSLParameters()} and @@ -82,16 +84,17 @@ public class SSLParameters { private boolean enableRetransmissions = true; private int maximumPacketSize = 0; private String[] applicationProtocols = new String[0]; + private String[] signatureSchemes = null; /** * Constructs SSLParameters. *

    * The values of cipherSuites, protocols, cryptographic algorithm - * constraints, endpoint identification algorithm, server names and - * server name matchers are set to {@code null}; useCipherSuitesOrder, - * wantClientAuth and needClientAuth are set to {@code false}; - * enableRetransmissions is set to {@code true}; maximum network packet - * size is set to {@code 0}. + * constraints, endpoint identification algorithm, signature schemes, + * server names and server name matchers are set to {@code null}; + * useCipherSuitesOrder, wantClientAuth and needClientAuth are set + * to {@code false}; enableRetransmissions is set to {@code true}; + * maximum network packet size is set to {@code 0}. */ public SSLParameters() { // empty @@ -367,7 +370,7 @@ public class SSLParameters { *

    * It is recommended that providers initialize default Server Name * Indications when creating {@code SSLSocket}/{@code SSLEngine}s. - * In the following examples, the server name could be represented by an + * In the following examples, the server name may be represented by an * instance of {@link SNIHostName} which has been initialized with the * hostname "www.example.com" and type * {@link StandardConstants#SNI_HOST_NAME}. @@ -686,4 +689,125 @@ public class SSLParameters { } applicationProtocols = tempProtocols; } + + /** + * Returns a prioritized array of signature scheme names that can be used + * over the SSL/TLS/DTLS protocols. + *

    + * Note that the standard list of signature scheme names are defined in + * the + * Signature Schemes section of the Java Security Standard Algorithm + * Names Specification. Providers may support signature schemes not defined + * in this list or may not use the recommended name for a certain + * signature scheme. + *

    + * The set of signature schemes that will be used over the SSL/TLS/DTLS + * connections is determined by the returned array of this method and the + * underlying provider-specific default signature schemes. + *

    + * If the returned array is {@code null}, then the underlying + * provider-specific default signature schemes will be used over the + * SSL/TLS/DTLS connections. + *

    + * If the returned array is empty (zero-length), then the signature scheme + * negotiation mechanism is turned off for SSL/TLS/DTLS protocols, and + * the connections may not be able to be established if the negotiation + * mechanism is required by a certain SSL/TLS/DTLS protocol. This + * parameter will override the underlying provider-specific default + * signature schemes. + *

    + * If the returned array is not {@code null} or empty (zero-length), + * then the signature schemes in the returned array will be used over + * the SSL/TLS/DTLS connections. This parameter will override the + * underlying provider-specific default signature schemes. + *

    + * This method returns the most recent value passed to + * {@link #setSignatureSchemes} if that method has been called and + * otherwise returns the default signature schemes for connection + * populated objects, or {@code null} for pre-populated objects. + * + * @apiNote + * Note that a provider may not have been updated to support this method + * and in that case may return {@code null} instead of the default + * signature schemes for connection populated objects. + * + * @implNote + * The SunJSSE provider supports this method. + * + * @implNote + * Note that applications may use the + * {@systemProperty jdk.tls.client.SignatureSchemes} and/or + * {@systemProperty jdk.tls.server.SignatureSchemes} system properties + * with the SunJSSE provider to override the provider-specific default + * signature schemes. + * + * @return an array of signature scheme {@code Strings} or {@code null} if + * none have been set. For non-null returns, this method will + * return a new array each time it is invoked. The array is + * ordered based on signature scheme preference, with the first + * entry being the most preferred. Providers should ignore unknown + * signature scheme names while establishing the SSL/TLS/DTLS + * connections. + * @see #setSignatureSchemes + * + * @since 19 + */ + public String[] getSignatureSchemes() { + return clone(signatureSchemes); + } + + /** + * Sets the prioritized array of signature scheme names that + * can be used over the SSL/TLS/DTLS protocols. + *

    + * Note that the standard list of signature scheme names are defined in + * the + * Signature Schemes section of the Java Security Standard Algorithm + * Names Specification. Providers may support signature schemes not + * defined in this list or may not use the recommended name for a certain + * signature scheme. + *

    + * The set of signature schemes that will be used over the SSL/TLS/DTLS + * connections is determined by the input parameter {@code signatureSchemes} + * array and the underlying provider-specific default signature schemes. + * See {@link #getSignatureSchemes} for specific details on how the + * parameters are used in SSL/TLS/DTLS connections. + * + * @apiNote + * Note that a provider may not have been updated to support this method + * and in that case may ignore the schemes that are set. + * + * @implNote + * The SunJSSE provider supports this method. + * + * @param signatureSchemes an ordered array of signature scheme names with + * the first entry being the most preferred, or {@code null}. This + * method will make a copy of this array. Providers should ignore + * unknown signature scheme names while establishing the + * SSL/TLS/DTLS connections. + * @throws IllegalArgumentException if any element in the + * {@code signatureSchemes} array is {@code null} or + * {@linkplain String#isBlank() blank}. + * + * @see #getSignatureSchemes + * + * @since 19 + */ + public void setSignatureSchemes(String[] signatureSchemes) { + String[] tempSchemes = null; + + if (signatureSchemes != null) { + tempSchemes = signatureSchemes.clone(); + for (String scheme : tempSchemes) { + if (scheme == null || scheme.isBlank()) { + throw new IllegalArgumentException( + "An element of signatureSchemes is null or blank"); + } + } + } + + this.signatureSchemes = tempSchemes; + } } diff --git a/src/java.base/share/classes/sun/security/ssl/SSLConfiguration.java b/src/java.base/share/classes/sun/security/ssl/SSLConfiguration.java index d267c2e6b46..056f00a5a3c 100644 --- a/src/java.base/share/classes/sun/security/ssl/SSLConfiguration.java +++ b/src/java.base/share/classes/sun/security/ssl/SSLConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -29,11 +29,7 @@ import java.security.AccessControlContext; import java.security.AccessController; import java.security.AlgorithmConstraints; import java.security.NoSuchAlgorithmException; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; +import java.util.*; import java.util.function.BiFunction; import javax.crypto.KeyGenerator; import javax.net.ssl.HandshakeCompletedListener; @@ -66,7 +62,7 @@ final class SSLConfiguration implements Cloneable { // The configured signature schemes for "signature_algorithms" and // "signature_algorithms_cert" extensions - List signatureSchemes; + String[] signatureSchemes; // the maximum protocol version of enabled protocols ProtocolVersion maximumProtocolVersion; @@ -204,6 +200,7 @@ final class SSLConfiguration implements Cloneable { params.setUseCipherSuitesOrder(this.preferLocalCipherSuites); params.setEnableRetransmissions(this.enableRetransmissions); params.setMaximumPacketSize(this.maximumPacketSize); + params.setSignatureSchemes(this.signatureSchemes); return params; } @@ -261,6 +258,13 @@ final class SSLConfiguration implements Cloneable { this.applicationProtocols = sa; } // otherwise, use the default values + String[] ss = params.getSignatureSchemes(); + if (ss != null) { + // Note if 'ss' is empty, then no signature schemes should be + // specified over the connections. + this.signatureSchemes = ss; + } // Otherwise, use the default values + this.preferLocalCipherSuites = params.getUseCipherSuitesOrder(); this.enableRetransmissions = params.getEnableRetransmissions(); this.maximumPacketSize = params.getMaximumPacketSize(); @@ -403,10 +407,15 @@ final class SSLConfiguration implements Cloneable { void toggleClientMode() { this.isClientMode ^= true; - // reset the signature schemes - this.signatureSchemes = isClientMode ? - CustomizedClientSignatureSchemes.signatureSchemes : - CustomizedServerSignatureSchemes.signatureSchemes; + // Reset the signature schemes, if it was configured with SSLParameters. + if (Arrays.equals(signatureSchemes, + CustomizedClientSignatureSchemes.signatureSchemes) || + Arrays.equals(signatureSchemes, + CustomizedServerSignatureSchemes.signatureSchemes)) { + this.signatureSchemes = isClientMode ? + CustomizedClientSignatureSchemes.signatureSchemes : + CustomizedServerSignatureSchemes.signatureSchemes; + } } @Override @@ -434,7 +443,7 @@ final class SSLConfiguration implements Cloneable { // // See Effective Java Second Edition: Item 71. private static final class CustomizedClientSignatureSchemes { - private static final List signatureSchemes = + private static final String[] signatureSchemes = getCustomizedSignatureScheme("jdk.tls.client.SignatureSchemes"); } @@ -442,7 +451,7 @@ final class SSLConfiguration implements Cloneable { // // See Effective Java Second Edition: Item 71. private static final class CustomizedServerSignatureSchemes { - private static final List signatureSchemes = + private static final String[] signatureSchemes = getCustomizedSignatureScheme("jdk.tls.server.SignatureSchemes"); } @@ -450,14 +459,12 @@ final class SSLConfiguration implements Cloneable { * Get the customized signature schemes specified by the given * system property. */ - private static List getCustomizedSignatureScheme( - String propertyName) { - + private static String[] getCustomizedSignatureScheme(String propertyName) { String property = GetPropertyAction.privilegedGetProperty(propertyName); if (SSLLogger.isOn && SSLLogger.isOn("ssl,sslctx")) { SSLLogger.fine( "System property " + propertyName + " is set to '" + - property + "'"); + property + "'"); } if (property != null && !property.isEmpty()) { // remove double quote marks from beginning/end of the property @@ -469,31 +476,34 @@ final class SSLConfiguration implements Cloneable { if (property != null && !property.isEmpty()) { String[] signatureSchemeNames = property.split(","); - List signatureSchemes = - new ArrayList<>(signatureSchemeNames.length); - for (int i = 0; i < signatureSchemeNames.length; i++) { - signatureSchemeNames[i] = signatureSchemeNames[i].trim(); - if (signatureSchemeNames[i].isEmpty()) { + List signatureSchemes = + new ArrayList<>(signatureSchemeNames.length); + for (String schemeName : signatureSchemeNames) { + schemeName = schemeName.trim(); + if (schemeName.isEmpty()) { continue; } - SignatureScheme scheme = - SignatureScheme.nameOf(signatureSchemeNames[i]); + // Check the availability + SignatureScheme scheme = SignatureScheme.nameOf(schemeName); if (scheme != null && scheme.isAvailable) { - signatureSchemes.add(scheme); + signatureSchemes.add(schemeName); } else { if (SSLLogger.isOn && SSLLogger.isOn("ssl,sslctx")) { SSLLogger.fine( - "The current installed providers do not " + - "support signature scheme: " + - signatureSchemeNames[i]); + "The current installed providers do not " + + "support signature scheme: " + schemeName); } } } - return signatureSchemes; + if (!signatureSchemes.isEmpty()) { + return signatureSchemes.toArray(new String[0]); + } } - return Collections.emptyList(); + // Note that if the System Property value is not defined (JDK + // default value) or empty, the provider-specific default is used. + return null; } } diff --git a/src/java.base/share/classes/sun/security/ssl/SignatureScheme.java b/src/java.base/share/classes/sun/security/ssl/SignatureScheme.java index 706cb4371d3..87feda0e83b 100644 --- a/src/java.base/share/classes/sun/security/ssl/SignatureScheme.java +++ b/src/java.base/share/classes/sun/security/ssl/SignatureScheme.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -181,7 +181,7 @@ enum SignatureScheme { "anonymous", "rsa", "dsa", "ecdsa", }; - static enum SigAlgParamSpec { // support RSASSA-PSS only now + enum SigAlgParamSpec { // support RSASSA-PSS only now RSA_PSS_SHA256 ("SHA-256", 32), RSA_PSS_SHA384 ("SHA-384", 48), RSA_PSS_SHA512 ("SHA-512", 64); @@ -224,13 +224,13 @@ enum SignatureScheme { Collections.unmodifiableSet(EnumSet.of(CryptoPrimitive.SIGNATURE)); - private SignatureScheme(int id, String name, + SignatureScheme(int id, String name, String algorithm, String keyAlgorithm, ProtocolVersion[] supportedProtocols) { this(id, name, algorithm, keyAlgorithm, -1, supportedProtocols); } - private SignatureScheme(int id, String name, + SignatureScheme(int id, String name, String algorithm, String keyAlgorithm, int minimalKeySize, ProtocolVersion[] supportedProtocols) { @@ -238,7 +238,7 @@ enum SignatureScheme { null, minimalKeySize, supportedProtocols); } - private SignatureScheme(int id, String name, + SignatureScheme(int id, String name, String algorithm, String keyAlgorithm, SigAlgParamSpec signAlgParamSpec, int minimalKeySize, ProtocolVersion[] supportedProtocols) { @@ -247,7 +247,7 @@ enum SignatureScheme { supportedProtocols, supportedProtocols); } - private SignatureScheme(int id, String name, + SignatureScheme(int id, String name, String algorithm, String keyAlgorithm, NamedGroup namedGroup, ProtocolVersion[] supportedProtocols) { @@ -256,7 +256,7 @@ enum SignatureScheme { supportedProtocols, supportedProtocols); } - private SignatureScheme(int id, String name, + SignatureScheme(int id, String name, String algorithm, String keyAlgorithm, SigAlgParamSpec signAlgParams, NamedGroup namedGroup, int minimalKeySize, @@ -376,15 +376,10 @@ enum SignatureScheme { List activeProtocols) { List supported = new LinkedList<>(); - // If config.signatureSchemes is non-empty then it means that - // it was defined by a System property. Per - // SSLConfiguration.getCustomizedSignatureScheme() the list will - // only contain schemes that are in the enum. - // Otherwise, use the enum constants (converted to a List). List schemesToCheck = - config.signatureSchemes.isEmpty() ? + config.signatureSchemes == null ? Arrays.asList(SignatureScheme.values()) : - config.signatureSchemes; + namesOfAvailable(config.signatureSchemes); for (SignatureScheme ss: schemesToCheck) { if (!ss.isAvailable) { @@ -437,8 +432,8 @@ enum SignatureScheme { } } else if (ss.isAvailable && ss.supportedProtocols.contains(protocolVersion) && - (config.signatureSchemes.isEmpty() || - config.signatureSchemes.contains(ss)) && + (config.signatureSchemes == null || + Utilities.contains(config.signatureSchemes, ss.name)) && ss.isPermitted(constraints)) { supported.add(ss); } else { @@ -563,6 +558,33 @@ enum SignatureScheme { return new String[0]; } + private static List namesOfAvailable( + String[] signatureSchemes) { + + if (signatureSchemes == null || signatureSchemes.length == 0) { + return Collections.emptyList(); + } + + List sss = new ArrayList<>(signatureSchemes.length); + for (String ss : signatureSchemes) { + SignatureScheme scheme = SignatureScheme.nameOf(ss); + if (scheme == null || !scheme.isAvailable) { + if (SSLLogger.isOn && + SSLLogger.isOn("ssl,handshake,verbose")) { + SSLLogger.finest( + "Ignore the signature algorithm (" + ss + + "), unsupported or unavailable"); + } + + continue; + } + + sss.add(scheme); + } + + return sss; + } + // This method is used to get the signature instance of this signature // scheme for the specific public key. Unlike getSigner(), the exception // is bubbled up. If the public key does not support this signature diff --git a/src/java.base/share/classes/sun/security/ssl/Utilities.java b/src/java.base/share/classes/sun/security/ssl/Utilities.java index 8317d9ae3cb..441f978c84f 100644 --- a/src/java.base/share/classes/sun/security/ssl/Utilities.java +++ b/src/java.base/share/classes/sun/security/ssl/Utilities.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2022, 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 @@ -229,6 +229,16 @@ final class Utilities { } } + static boolean contains(T[] array, T item) { + for (T t : array) { + if (item.equals(t)) { + return true; + } + } + + return false; + } + private static void swap(byte[] arr, int i, int j) { byte tmp = arr[i]; arr[i] = arr[j]; diff --git a/test/jdk/javax/net/ssl/DTLS/DTLSSignatureSchemes.java b/test/jdk/javax/net/ssl/DTLS/DTLSSignatureSchemes.java new file mode 100644 index 00000000000..5dd897b1bd7 --- /dev/null +++ b/test/jdk/javax/net/ssl/DTLS/DTLSSignatureSchemes.java @@ -0,0 +1,137 @@ +/* + * Copyright (C) 2022 THL A29 Limited, a Tencent company. 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. + */ + +// SunJSSE does not support dynamic system properties, no way to re-use +// system properties in samevm/agentvm mode. + +/* + * @test + * @bug 8280494 + * @summary (D)TLS signature schemes + * @modules java.base/sun.security.util + * @library /test/lib + * @build DTLSOverDatagram + * @run main/othervm DTLSSignatureSchemes + */ + +import javax.net.ssl.SSLEngine; +import javax.net.ssl.SSLParameters; +import java.security.Security; + +/** + * Test DTLS client authentication. + */ +public class DTLSSignatureSchemes extends DTLSOverDatagram { + private final String[] serverSignatureSchemes; + private final String[] clientSignatureSchemes; + + public DTLSSignatureSchemes(String[] serverSignatureSchemes, + String[] clientSignatureSchemes) { + this.serverSignatureSchemes = serverSignatureSchemes; + this.clientSignatureSchemes = clientSignatureSchemes; + } + + @Override + SSLEngine createSSLEngine(boolean isClient) throws Exception { + SSLEngine engine = super.createSSLEngine(isClient); + + SSLParameters sslParameters = engine.getSSLParameters(); + if (isClient) { + sslParameters.setSignatureSchemes(clientSignatureSchemes); + } else { + sslParameters.setSignatureSchemes(serverSignatureSchemes); + } + engine.setSSLParameters(sslParameters); + + return engine; + } + + public static void main(String[] args) throws Exception { + Security.setProperty("jdk.tls.disabledAlgorithms", ""); + + runTest(new String[] { + "ecdsa_secp256r1_sha256", + "ed25519" + }, + new String[] { + "ecdsa_secp256r1_sha256", + "ed25519" + }, + false); + runTest(new String[] { + "ecdsa_secp256r1_sha256" + }, + new String[] { + "ecdsa_secp256r1_sha256" + }, + false); + runTest(null, + new String[] { + "ecdsa_secp256r1_sha256" + }, + false); + runTest(new String[] { + "ecdsa_secp256r1_sha256" + }, + null, + false); + runTest(new String[0], + new String[] { + "ecdsa_secp256r1_sha256" + }, + true); + runTest(new String[] { + "ecdsa_secp256r1_sha256" + }, + new String[0], + true); + runTest(new String[] { + "ecdsa_secp256r1_shaNA" + }, + new String[] { + "ecdsa_secp256r1_sha256" + }, + true); + } + + private static void runTest(String[] serverSignatureSchemes, + String[] clientSignatureSchemes, + boolean exceptionExpected) throws Exception { + DTLSSignatureSchemes testCase = new DTLSSignatureSchemes( + serverSignatureSchemes, clientSignatureSchemes); + try { + testCase.runTest(testCase); + } catch (Exception e) { + if (!exceptionExpected) { + throw e; + } else { // Otherwise, swallow the expected exception and return. + return; + } + } + + if (exceptionExpected) { + throw new RuntimeException("Unexpected success!"); + } + } +} + diff --git a/test/jdk/javax/net/ssl/SSLParameters/SignatureSchemes.java b/test/jdk/javax/net/ssl/SSLParameters/SignatureSchemes.java new file mode 100644 index 00000000000..7dadeff5703 --- /dev/null +++ b/test/jdk/javax/net/ssl/SSLParameters/SignatureSchemes.java @@ -0,0 +1,147 @@ +/* + * Copyright (C) 2022 THL A29 Limited, a Tencent company. 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. + */ + +// SunJSSE does not support dynamic system properties, no way to re-use +// system properties in samevm/agentvm mode. + +/* + * @test + * @bug 8280494 + * @summary (D)TLS signature schemes + * @library /javax/net/ssl/templates + * @run main/othervm SignatureSchemes + */ + +import javax.net.ssl.SSLParameters; +import javax.net.ssl.SSLServerSocket; +import javax.net.ssl.SSLSocket; +import java.security.Security; + +public class SignatureSchemes extends SSLSocketTemplate { + private final String[] serverSignatureSchemes; + private final String[] clientSignatureSchemes; + private final boolean exceptionExpected; + + public SignatureSchemes(String[] serverSignatureSchemes, + String[] clientSignatureSchemes, + boolean exceptionExpected) { + this.serverSignatureSchemes = serverSignatureSchemes; + this.clientSignatureSchemes = clientSignatureSchemes; + this.exceptionExpected = exceptionExpected; + } + + @Override + protected void configureServerSocket(SSLServerSocket sslServerSocket) { + SSLParameters sslParameters = sslServerSocket.getSSLParameters(); + sslParameters.setSignatureSchemes(serverSignatureSchemes); + sslServerSocket.setSSLParameters(sslParameters); + } + + @Override + protected void configureClientSocket(SSLSocket socket) { + SSLParameters sslParameters = socket.getSSLParameters(); + sslParameters.setSignatureSchemes(clientSignatureSchemes); + socket.setSSLParameters(sslParameters); + } + + @Override + protected void runServerApplication(SSLSocket socket) throws Exception { + try { + super.runServerApplication(socket); + } catch (Exception ex) { + // Just ignore, let the client handle the failure information. + } + } + + @Override + protected void runClientApplication(SSLSocket sslSocket) throws Exception { + try { + super.runClientApplication(sslSocket); + } catch (Exception ex) { + if (!exceptionExpected) { + throw ex; + } else { // Otherwise, swallow the exception and return. + return; + } + } + + if (exceptionExpected) { + throw new RuntimeException("Unexpected success!"); + } + } + + public static void main(String[] args) throws Exception { + Security.setProperty("jdk.tls.disabledAlgorithms", ""); + + runTest(new String[] { + "ecdsa_secp256r1_sha256", + "ed25519" + }, + new String[] { + "ecdsa_secp256r1_sha256", + "ed25519" + }, + false); + runTest(new String[] { + "ecdsa_secp256r1_sha256" + }, + new String[] { + "ecdsa_secp256r1_sha256" + }, + false); + runTest(null, + new String[] { + "ecdsa_secp256r1_sha256" + }, + false); + runTest(new String[] { + "ecdsa_secp256r1_sha256" + }, + null, + false); + runTest(new String[0], + new String[] { + "ecdsa_secp256r1_sha256" + }, + true); + runTest(new String[] { + "ecdsa_secp256r1_sha256" + }, + new String[0], + true); + runTest(new String[] { + "ecdsa_secp256r1_shaNA" + }, + new String[] { + "ecdsa_secp256r1_sha256" + }, + true); + } + + private static void runTest(String[] serverSignatureSchemes, + String[] clientSignatureSchemes, + boolean exceptionExpected) throws Exception { + new SignatureSchemes(serverSignatureSchemes, + clientSignatureSchemes, exceptionExpected).run(); + } +} -- GitLab From 70318e1d17072198be5674ebe7118fb5f9373144 Mon Sep 17 00:00:00 2001 From: Weijun Wang Date: Wed, 9 Mar 2022 16:47:03 +0000 Subject: [PATCH 200/340] 8282884: Provide OID aliases for MD2, MD5, and OAEP Reviewed-by: xuelei --- .../share/classes/com/sun/crypto/provider/SunJCE.java | 6 +++--- .../share/classes/sun/security/provider/SunEntries.java | 8 +++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/java.base/share/classes/com/sun/crypto/provider/SunJCE.java b/src/java.base/share/classes/com/sun/crypto/provider/SunJCE.java index a020e1c15d8..38836d2701e 100644 --- a/src/java.base/share/classes/com/sun/crypto/provider/SunJCE.java +++ b/src/java.base/share/classes/com/sun/crypto/provider/SunJCE.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2022, 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 @@ -525,8 +525,8 @@ public final class SunJCE extends Provider { ps("AlgorithmParameters", "RC2", "com.sun.crypto.provider.RC2Parameters"); - ps("AlgorithmParameters", "OAEP", - "com.sun.crypto.provider.OAEPParameters"); + psA("AlgorithmParameters", "OAEP", + "com.sun.crypto.provider.OAEPParameters", null); psA("AlgorithmParameters", "ChaCha20-Poly1305", "com.sun.crypto.provider.ChaCha20Poly1305Parameters", null); diff --git a/src/java.base/share/classes/sun/security/provider/SunEntries.java b/src/java.base/share/classes/sun/security/provider/SunEntries.java index 912cad59714..c7fdd230830 100644 --- a/src/java.base/share/classes/sun/security/provider/SunEntries.java +++ b/src/java.base/share/classes/sun/security/provider/SunEntries.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2022, 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 @@ -210,8 +210,10 @@ public final class SunEntries { /* * Digest engines */ - add(p, "MessageDigest", "MD2", "sun.security.provider.MD2", attrs); - add(p, "MessageDigest", "MD5", "sun.security.provider.MD5", attrs); + addWithAlias(p, "MessageDigest", "MD2", "sun.security.provider.MD2", + attrs); + addWithAlias(p, "MessageDigest", "MD5", "sun.security.provider.MD5", + attrs); addWithAlias(p, "MessageDigest", "SHA-1", "sun.security.provider.SHA", attrs); -- GitLab From ff76620487c307514c435443bbaebc9a6c473f5d Mon Sep 17 00:00:00 2001 From: Chris Plummer Date: Wed, 9 Mar 2022 19:42:47 +0000 Subject: [PATCH 201/340] 8282641: Make jdb "threadgroup" command with no args reset the current threadgroup back to the default Reviewed-by: kevinw, amenkov --- .../sun/tools/example/debug/tty/Commands.java | 4 ++-- .../tools/example/debug/tty/TTYResources.java | 8 +++---- .../example/debug/tty/TTYResources_ja.java | 3 +-- .../example/debug/tty/TTYResources_zh_CN.java | 3 +-- .../threadgroup002/threadgroup002.java | 22 +++++++++++++++---- 5 files changed, 26 insertions(+), 14 deletions(-) diff --git a/src/jdk.jdi/share/classes/com/sun/tools/example/debug/tty/Commands.java b/src/jdk.jdi/share/classes/com/sun/tools/example/debug/tty/Commands.java index 15091d310d5..121038a6d72 100644 --- a/src/jdk.jdi/share/classes/com/sun/tools/example/debug/tty/Commands.java +++ b/src/jdk.jdi/share/classes/com/sun/tools/example/debug/tty/Commands.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2022, 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 @@ -501,7 +501,7 @@ class Commands { void commandThreadGroup(StringTokenizer t) { if (!t.hasMoreTokens()) { - MessageOutput.println("Threadgroup name not specified."); + ThreadInfo.setThreadGroup(null); // reset to default (top level ThreadGroup) return; } String name = t.nextToken(); diff --git a/src/jdk.jdi/share/classes/com/sun/tools/example/debug/tty/TTYResources.java b/src/jdk.jdi/share/classes/com/sun/tools/example/debug/tty/TTYResources.java index 8ba3c42c83a..adec7aa98cf 100644 --- a/src/jdk.jdi/share/classes/com/sun/tools/example/debug/tty/TTYResources.java +++ b/src/jdk.jdi/share/classes/com/sun/tools/example/debug/tty/TTYResources.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2022, 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 @@ -312,7 +312,6 @@ public class TTYResources extends java.util.ListResourceBundle { {"Thread has been resumed", "Thread has been resumed"}, {"Thread not suspended", "Thread not suspended"}, {"thread group number description name", "{0,number,integer}. {1} {2}"}, - {"Threadgroup name not specified.", "Threadgroup name not specified."}, {" option not valid until the VM is started with the run command", " option not valid until the VM is started with the run command"}, {"Threads must be suspended", "Threads must be suspended"}, @@ -354,7 +353,7 @@ public class TTYResources extends java.util.ListResourceBundle { "\n" + "run [class [args]] -- start execution of application's main class\n" + "\n" + - "threads [threadgroup] -- list threads\n" + + "threads [threadgroup] -- list threads in threadgroup. Use current threadgroup if none specified.\n" + "thread -- set default thread\n" + "suspend [thread id(s)] -- suspend threads (default: all)\n" + "resume [thread id(s)] -- resume threads (default: all)\n" + @@ -377,7 +376,8 @@ public class TTYResources extends java.util.ListResourceBundle { "fields -- list a class's fields\n" + "\n" + "threadgroups -- list threadgroups\n" + - "threadgroup -- set current threadgroup\n" + + "threadgroup -- set current threadgroup to \n" + + "threadgroup -- set current threadgroup back to the top level threadgroup\n" + "\n" + "stop [go|thread] [] \n" + " -- set a breakpoint\n" + diff --git a/src/jdk.jdi/share/classes/com/sun/tools/example/debug/tty/TTYResources_ja.java b/src/jdk.jdi/share/classes/com/sun/tools/example/debug/tty/TTYResources_ja.java index 1f0dd4a3e22..330fc33a820 100644 --- a/src/jdk.jdi/share/classes/com/sun/tools/example/debug/tty/TTYResources_ja.java +++ b/src/jdk.jdi/share/classes/com/sun/tools/example/debug/tty/TTYResources_ja.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2022, 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 @@ -302,7 +302,6 @@ public class TTYResources_ja extends java.util.ListResourceBundle { {"Thread has been resumed", "\u30B9\u30EC\u30C3\u30C9\u304C\u518D\u958B\u3057\u307E\u3057\u305F"}, {"Thread not suspended", "\u30B9\u30EC\u30C3\u30C9\u306F\u4E2D\u65AD\u3057\u3066\u3044\u307E\u305B\u3093"}, {"thread group number description name", "{0,number,integer}. {1} {2}"}, - {"Threadgroup name not specified.", "\u30B9\u30EC\u30C3\u30C9\u30B0\u30EB\u30FC\u30D7\u540D\u304C\u6307\u5B9A\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002"}, {" option not valid until the VM is started with the run command", "\u30AA\u30D7\u30B7\u30E7\u30F3\u306F\u3001VM\u304Crun\u30B3\u30DE\u30F3\u30C9\u3067\u958B\u59CB\u3055\u308C\u308B\u307E\u3067\u7121\u52B9\u3067\u3059"}, {"Threads must be suspended", "\u30B9\u30EC\u30C3\u30C9\u3092\u4E2D\u65AD\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059"}, diff --git a/src/jdk.jdi/share/classes/com/sun/tools/example/debug/tty/TTYResources_zh_CN.java b/src/jdk.jdi/share/classes/com/sun/tools/example/debug/tty/TTYResources_zh_CN.java index 88c1cd3e878..6c4be977705 100644 --- a/src/jdk.jdi/share/classes/com/sun/tools/example/debug/tty/TTYResources_zh_CN.java +++ b/src/jdk.jdi/share/classes/com/sun/tools/example/debug/tty/TTYResources_zh_CN.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2022, 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 @@ -302,7 +302,6 @@ public class TTYResources_zh_CN extends java.util.ListResourceBundle { {"Thread has been resumed", "\u5DF2\u6062\u590D\u7EBF\u7A0B"}, {"Thread not suspended", "\u672A\u6302\u8D77\u7EBF\u7A0B"}, {"thread group number description name", "{0,number,integer}\u3002{1} {2}"}, - {"Threadgroup name not specified.", "\u672A\u6307\u5B9A\u7EBF\u7A0B\u7EC4\u540D\u3002"}, {" option not valid until the VM is started with the run command", "\u5728\u4F7F\u7528 run \u547D\u4EE4\u542F\u52A8 VM \u524D\uFF0C \u9009\u9879\u65E0\u6548"}, {"Threads must be suspended", "\u5FC5\u987B\u6302\u8D77\u7EBF\u7A0B"}, diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdb/threadgroup/threadgroup002/threadgroup002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdb/threadgroup/threadgroup002/threadgroup002.java index cb8004643d3..72bbf358474 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdb/threadgroup/threadgroup002/threadgroup002.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdb/threadgroup/threadgroup002/threadgroup002.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -29,11 +29,15 @@ * VM Testbase keywords: [jpda, jdb] * VM Testbase readme: * DECSRIPTION - * This is a test for jdb 'threadgroup ' command. + * This is a test for jdb 'threadgroup ' command and + * also for the 'threadgroup' command with no argument. * The main thread creates 3 threadgroups of 5 threads each. * All threads are locked in their 'run' method on a lock that the main - * thread holds. The test passes if jdb correctly switches between - * three user-defined threadgroups using 'threadgroup' command. + * thread holds. The test then makes sure jdb correctly switches between + * the three user-defined threadgroups using 'threadgroup' command. It then + * resets the current threadgroup back to the default top level threadgroup + * by using the 'threadgroup' command with no argument. It then tests that + * all 3 created threadgroups can be found in the 'threads' output. * COMMENTS * This test functionally equals to nsk/jdb/threadgroup/threadgroup001 * test and replaces it. @@ -45,6 +49,7 @@ * nsk.jdb.threadgroup.threadgroup002.threadgroup002 * -arch=${os.family}-${os.simpleArch} * -waittime=5 + * -verbose * -debugee.vmkind=java * -transport.address=dynamic * -jdb=${test.jdk}/bin/jdb @@ -100,6 +105,15 @@ public class threadgroup002 extends JdbTest { } } + // Test switching back to the default top level group. + reply = jdb.receiveReplyFor(JdbCommand.threadgroup); + reply = jdb.receiveReplyFor(JdbCommand.threads); + grep = new Paragrep(reply); + count = grep.find(threadgroup002a.THREADGROUP_NAME); + if (count != threadgroup002a.numThreadGroups) { + failure("jdb cannot switch to default top level threadgroup"); + } + jdb.contToExit(1); } } -- GitLab From 8aba4de98477a3bcfcde8db71e0d797965f774c7 Mon Sep 17 00:00:00 2001 From: Rajat Mahajan Date: Thu, 10 Mar 2022 05:09:29 +0000 Subject: [PATCH 202/340] 8249592: Robot.mouseMove moves cursor to incorrect location when display scale varies and Java runs in DPI Unaware mode Reviewed-by: serb, aivanov --- .../native/libawt/windows/awt_Robot.cpp | 29 ++++++++++++++----- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/src/java.desktop/windows/native/libawt/windows/awt_Robot.cpp b/src/java.desktop/windows/native/libawt/windows/awt_Robot.cpp index 33457ebef32..0afce8727e0 100644 --- a/src/java.desktop/windows/native/libawt/windows/awt_Robot.cpp +++ b/src/java.desktop/windows/native/libawt/windows/awt_Robot.cpp @@ -28,20 +28,33 @@ #include "awt_Component.h" #include -static int signum(int i) { - // special version of signum which returns 1 when value is 0 - return i >= 0 ? 1 : -1; -} - static void MouseMove(jint x, jint y) { INPUT mouseInput = {0}; mouseInput.type = INPUT_MOUSE; mouseInput.mi.time = 0; - mouseInput.mi.dwFlags = MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_MOVE; - mouseInput.mi.dx = (x * 65536 /::GetSystemMetrics(SM_CXSCREEN)) + signum(x); - mouseInput.mi.dy = (y * 65536 /::GetSystemMetrics(SM_CYSCREEN)) + signum(y); + + // The following calculations take into account a multi-monitor setup using + // a virtual screen for all monitors combined. + // More details from Microsoft are here -- + // https://docs.microsoft.com/en-us/windows/win32/gdi/the-virtual-screen + + x -= ::GetSystemMetrics(SM_XVIRTUALSCREEN); + y -= ::GetSystemMetrics(SM_YVIRTUALSCREEN); + + mouseInput.mi.dwFlags = MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_MOVE | + MOUSEEVENTF_VIRTUALDESK; + + int scW = ::GetSystemMetrics(SM_CXVIRTUALSCREEN); + int scH = ::GetSystemMetrics(SM_CYVIRTUALSCREEN); + + // The following calculation to deduce mouse coordinates is based on + // empirical data + mouseInput.mi.dx = (x * 65536 + scW - 1) / scW; + mouseInput.mi.dy = (y * 65536 + scH - 1) / scH; + ::SendInput(1, &mouseInput, sizeof(mouseInput)); + } static void MousePress(jint buttonMask) -- GitLab From 5b78a82e9d4b73e5bf3c6e099564206ecbda889b Mon Sep 17 00:00:00 2001 From: Prasanta Sadhukhan Date: Thu, 10 Mar 2022 09:22:21 +0000 Subject: [PATCH 203/340] 7017094: ParsedSynthStyle: parameter name "direction" should be changed to "tabIndex" Reviewed-by: jdv, aivanov, prr --- .../classes/javax/swing/plaf/synth/ParsedSynthStyle.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/java.desktop/share/classes/javax/swing/plaf/synth/ParsedSynthStyle.java b/src/java.desktop/share/classes/javax/swing/plaf/synth/ParsedSynthStyle.java index 3173b40ab6a..ff559ee1d4f 100644 --- a/src/java.desktop/share/classes/javax/swing/plaf/synth/ParsedSynthStyle.java +++ b/src/java.desktop/share/classes/javax/swing/plaf/synth/ParsedSynthStyle.java @@ -1935,9 +1935,9 @@ class ParsedSynthStyle extends DefaultSynthStyle { } public void paintTabbedPaneTabBackground(SynthContext context, - Graphics g, int x, int y, int w, int h, int direction) { + Graphics g, int x, int y, int w, int h, int tabIndex) { getPainter(context, "tabbedpanetabbackground", -1). - paintTabbedPaneTabBackground(context, g, x, y, w, h, direction); + paintTabbedPaneTabBackground(context, g, x, y, w, h, tabIndex); } public void paintTabbedPaneTabBackground(SynthContext context, -- GitLab From 6a3a7b94a4c342ce12ad553f1ba2818ca3a77f36 Mon Sep 17 00:00:00 2001 From: Prasanta Sadhukhan Date: Thu, 10 Mar 2022 09:26:36 +0000 Subject: [PATCH 204/340] 6218162: DefaultTableColumnModel.getColumn() method should mention ArrayIndexOutOfBoundsException Reviewed-by: aivanov, prr --- .../classes/javax/swing/table/DefaultTableColumnModel.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/java.desktop/share/classes/javax/swing/table/DefaultTableColumnModel.java b/src/java.desktop/share/classes/javax/swing/table/DefaultTableColumnModel.java index 71c39b7e8bb..ab5ff974eb9 100644 --- a/src/java.desktop/share/classes/javax/swing/table/DefaultTableColumnModel.java +++ b/src/java.desktop/share/classes/javax/swing/table/DefaultTableColumnModel.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2022, 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 @@ -290,6 +290,9 @@ public class DefaultTableColumnModel implements TableColumnModel, * @param columnIndex the index of the column desired * @return the TableColumn object for the column * at columnIndex + * @throws ArrayIndexOutOfBoundsException if columnIndex + * is out of range: + * (columnIndex < 0 || columnIndex >= getColumnCount()) */ public TableColumn getColumn(int columnIndex) { return tableColumns.elementAt(columnIndex); -- GitLab From 83d771869046c2a2bf251ee5aebaceba60555e65 Mon Sep 17 00:00:00 2001 From: Thomas Schatzl Date: Thu, 10 Mar 2022 11:28:29 +0000 Subject: [PATCH 205/340] 8282893: Remove MacroAssembler::push/pop_callee_saved_registers Reviewed-by: redestad --- src/hotspot/cpu/x86/macroAssembler_x86.cpp | 15 --------------- src/hotspot/cpu/x86/macroAssembler_x86.hpp | 4 ---- 2 files changed, 19 deletions(-) diff --git a/src/hotspot/cpu/x86/macroAssembler_x86.cpp b/src/hotspot/cpu/x86/macroAssembler_x86.cpp index 10a1cb4b6a1..7659598fcb7 100644 --- a/src/hotspot/cpu/x86/macroAssembler_x86.cpp +++ b/src/hotspot/cpu/x86/macroAssembler_x86.cpp @@ -332,21 +332,6 @@ void MacroAssembler::movptr(Address dst, intptr_t src) { movl(dst, src); } - -void MacroAssembler::pop_callee_saved_registers() { - pop(rcx); - pop(rdx); - pop(rdi); - pop(rsi); -} - -void MacroAssembler::push_callee_saved_registers() { - push(rsi); - push(rdi); - push(rdx); - push(rcx); -} - void MacroAssembler::pushoop(jobject obj) { push_literal32((int32_t)obj, oop_Relocation::spec_for_immediate()); } diff --git a/src/hotspot/cpu/x86/macroAssembler_x86.hpp b/src/hotspot/cpu/x86/macroAssembler_x86.hpp index 3593874866c..3bffad9940b 100644 --- a/src/hotspot/cpu/x86/macroAssembler_x86.hpp +++ b/src/hotspot/cpu/x86/macroAssembler_x86.hpp @@ -521,10 +521,6 @@ class MacroAssembler: public Assembler { // Round up to a power of two void round_to(Register reg, int modulus); - // Callee saved registers handling - void push_callee_saved_registers(); - void pop_callee_saved_registers(); - // allocation void eden_allocate( Register thread, // Current thread -- GitLab From 9c88c5bb63fb67f301e843d1bd5700d7e5e95204 Mon Sep 17 00:00:00 2001 From: Magnus Ihse Bursie Date: Thu, 10 Mar 2022 13:50:05 +0000 Subject: [PATCH 206/340] 8282948: JDK-8274980 missed correct handling of MACOSX_BUNDLE_BUILD_VERSION Reviewed-by: erikj --- make/autoconf/jdk-version.m4 | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/make/autoconf/jdk-version.m4 b/make/autoconf/jdk-version.m4 index 5e64ce9a064..b18e8a504ab 100644 --- a/make/autoconf/jdk-version.m4 +++ b/make/autoconf/jdk-version.m4 @@ -549,7 +549,12 @@ AC_DEFUN_ONCE([JDKVER_SETUP_JDK_VERSION_NUMBERS], elif test "x$with_macosx_bundle_build_version" != x; then MACOSX_BUNDLE_BUILD_VERSION="$with_macosx_bundle_build_version" else - MACOSX_BUNDLE_BUILD_VERSION="$VERSION_BUILD" + if test "x$VERSION_BUILD" != x; then + MACOSX_BUNDLE_BUILD_VERSION="$VERSION_BUILD" + else + MACOSX_BUNDLE_BUILD_VERSION=0 + fi + # If VERSION_OPT consists of only numbers and periods, add it. if [ [[ $VERSION_OPT =~ ^[0-9\.]+$ ]] ]; then MACOSX_BUNDLE_BUILD_VERSION="$MACOSX_BUNDLE_BUILD_VERSION.$VERSION_OPT" -- GitLab From 7c8ea9f05b35069e2b5b43e1a0e46f7dbe374e4c Mon Sep 17 00:00:00 2001 From: Tyler Steele Date: Thu, 10 Mar 2022 15:09:19 +0000 Subject: [PATCH 207/340] 8282509: [exploded image] ResolvedClassTest fails with similar output Reviewed-by: mdoerr, dlong --- test/hotspot/jtreg/compiler/inlining/ResolvedClassTest.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/hotspot/jtreg/compiler/inlining/ResolvedClassTest.java b/test/hotspot/jtreg/compiler/inlining/ResolvedClassTest.java index 44b21cb6815..92263bf10cf 100644 --- a/test/hotspot/jtreg/compiler/inlining/ResolvedClassTest.java +++ b/test/hotspot/jtreg/compiler/inlining/ResolvedClassTest.java @@ -125,9 +125,9 @@ public class ResolvedClassTest { analyzer.shouldHaveExitValue(0); - analyzer.shouldNotContain("java.lang.invoke.Invokers$Holder::linkToTargetMethod (9 bytes) not inlineable"); + analyzer.shouldNotMatch("java\\.lang\\.invoke\\..+::linkToTargetMethod \\(9 bytes\\) not inlineable"); - analyzer.shouldContain("java.lang.invoke.Invokers$Holder::linkToTargetMethod (9 bytes) force inline by annotation"); + analyzer.shouldMatch("java\\.lang\\.invoke\\..+::linkToTargetMethod \\(9 bytes\\) force inline by annotation"); analyzer.shouldContain("java/lang/invoke/MethodHandle::invokeBasic (not loaded) not inlineable"); } -- GitLab From 26747990053ab8f378d7f64cd7e565e530af88fc Mon Sep 17 00:00:00 2001 From: Alex Blewitt Date: Thu, 10 Mar 2022 15:27:29 +0000 Subject: [PATCH 208/340] 8282878: Removed _JavaThread from PhaseTraceTime Reviewed-by: shade, thartmann --- src/hotspot/share/c1/c1_Compilation.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/hotspot/share/c1/c1_Compilation.cpp b/src/hotspot/share/c1/c1_Compilation.cpp index ac415edb1f5..baabbbd147b 100644 --- a/src/hotspot/share/c1/c1_Compilation.cpp +++ b/src/hotspot/share/c1/c1_Compilation.cpp @@ -77,7 +77,6 @@ static int totalInstructionNodes = 0; class PhaseTraceTime: public TraceTime { private: - JavaThread* _thread; CompileLog* _log; TimerName _timer; -- GitLab From 1668c02ee83cc4f7bd7b2fe5bb7ef59b5dbda081 Mon Sep 17 00:00:00 2001 From: Anton Litvinov Date: Thu, 10 Mar 2022 16:37:55 +0000 Subject: [PATCH 209/340] 8277922: Unable to click JCheckBox in JTable through Java Access Bridge Reviewed-by: aivanov, serb --- .../share/classes/javax/swing/JTable.java | 21 +- ...ooleanRendererHasAccessibleActionTest.java | 192 ++++++++++++++++++ 2 files changed, 212 insertions(+), 1 deletion(-) create mode 100644 test/jdk/javax/accessibility/JTable/BooleanRendererHasAccessibleActionTest.java diff --git a/src/java.desktop/share/classes/javax/swing/JTable.java b/src/java.desktop/share/classes/javax/swing/JTable.java index 9af6a1ba616..c70ec2f935e 100644 --- a/src/java.desktop/share/classes/javax/swing/JTable.java +++ b/src/java.desktop/share/classes/javax/swing/JTable.java @@ -5481,6 +5481,21 @@ public class JTable extends JComponent implements TableModelListener, Scrollable return this; } + + @Override + public AccessibleContext getAccessibleContext() { + if (accessibleContext == null) { + accessibleContext = new AccessibleBooleanRenderer(); + } + return accessibleContext; + } + + class AccessibleBooleanRenderer extends JCheckBox.AccessibleJCheckBox { + @Override + public AccessibleAction getAccessibleAction() { + return null; + } + } } /** @@ -8396,7 +8411,11 @@ public class JTable extends JComponent implements TableModelListener, Scrollable * @return the AccessibleAction, or null */ public AccessibleAction getAccessibleAction() { - return getCurrentAccessibleContext().getAccessibleAction(); + AccessibleContext ac = getCurrentAccessibleContext(); + if (ac != null) { + return ac.getAccessibleAction(); + } + return null; } /** diff --git a/test/jdk/javax/accessibility/JTable/BooleanRendererHasAccessibleActionTest.java b/test/jdk/javax/accessibility/JTable/BooleanRendererHasAccessibleActionTest.java new file mode 100644 index 00000000000..79f16e3c366 --- /dev/null +++ b/test/jdk/javax/accessibility/JTable/BooleanRendererHasAccessibleActionTest.java @@ -0,0 +1,192 @@ +/* + * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* @test + @bug 8277922 + @key headful + @summary TableCellRenderer of JTable cell with Boolean data should not + support any AccessibleAction. + */ + +import java.awt.AWTException; +import java.awt.BorderLayout; +import java.awt.Container; +import java.awt.Dimension; +import java.awt.Robot; +import java.lang.reflect.InvocationTargetException; +import javax.accessibility.Accessible; +import javax.accessibility.AccessibleAction; +import javax.accessibility.AccessibleContext; +import javax.accessibility.AccessibleTable; +import javax.swing.JFrame; +import javax.swing.JScrollPane; +import javax.swing.JTable; +import javax.swing.SwingUtilities; +import javax.swing.table.DefaultTableModel; +import javax.swing.table.TableCellRenderer; + +public class BooleanRendererHasAccessibleActionTest { + private volatile JFrame frame; + private volatile JTable table; + + public static void main(String[] args) throws InterruptedException, + InvocationTargetException, AWTException { + final BooleanRendererHasAccessibleActionTest test = + new BooleanRendererHasAccessibleActionTest(); + + try { + SwingUtilities.invokeAndWait(new Runnable() { + @Override + public void run() { + test.createGUI(); + } + }); + Robot robot = new Robot(); + robot.waitForIdle(); + + SwingUtilities.invokeAndWait(new Runnable() { + @Override + public void run() { + test.runTest(); + } + }); + } finally { + SwingUtilities.invokeAndWait(new Runnable() { + @Override + public void run() { + test.dispose(); + } + }); + } + } + + private void createGUI() { + frame = new JFrame("BooleanRendererHasAccessibleActionTest"); + frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); + Container content = frame.getContentPane(); + content.setLayout(new BorderLayout()); + + String[] tblColNames = {"Column 1", "Column 2", "Column 3"}; + Object[][] tblData = { + {Boolean.TRUE, "Text 1", Boolean.FALSE}, + {Boolean.FALSE, "Text 2", Boolean.TRUE} + }; + final DefaultTableModel tblModel = new DefaultTableModel( + tblData, tblColNames) { + @Override + public Class getColumnClass(int column) { + return getValueAt(0, column).getClass(); + } + }; + table = new JTable(tblModel); + table.setPreferredScrollableViewportSize(new Dimension(400, 100)); + + JScrollPane tblScroller = new JScrollPane(table); + tblScroller.setHorizontalScrollBarPolicy( + JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); + tblScroller.setVerticalScrollBarPolicy( + JScrollPane.VERTICAL_SCROLLBAR_ALWAYS + ); + content.add(tblScroller, BorderLayout.CENTER); + + frame.pack(); + frame.setVisible(true); + } + + private void dispose() { + if (frame != null) { + frame.dispose(); + frame = null; + } + } + + private void runTest() { + if (table == null) { + throw new RuntimeException("'table' should not be null"); + } + + testAccessibleActionInCellRenderer(0, 0, true); + testAccessibleActionInCellRenderer(1, 0, true); + testAccessibleActionInCellRenderer(0, 2, true); + testAccessibleActionInCellRenderer(1, 2, true); + + testAccessibleActionInCell(0, 0, true); + testAccessibleActionInCell(1, 0, true); + testAccessibleActionInCell(0, 2, true); + testAccessibleActionInCell(1, 2, true); + + System.out.println("Test passed."); + } + + private void testAccessibleActionInCellRenderer(int row, int column, + boolean shouldBeNull) { + System.out.println(String.format( + "testAccessibleActionInCellRenderer():" + + " row='%d', column='%d', shouldBeNull='%b'", + row, column, shouldBeNull)); + + TableCellRenderer cellRenderer = table.getCellRenderer(row, column); + if (!(cellRenderer instanceof Accessible)) { + throw new RuntimeException("'cellRenderer' is not Accessible"); + } + + AccessibleContext cellRendererAc = + ((Accessible) cellRenderer).getAccessibleContext(); + if (cellRendererAc == null) { + throw new RuntimeException("'cellRendererAc' should not be null"); + } + + AccessibleAction cellRendererAa = cellRendererAc.getAccessibleAction(); + if ((shouldBeNull && (cellRendererAa != null)) || + (!shouldBeNull && (cellRendererAa == null))) { + throw new RuntimeException( + "Test failed. 'cellRendererAa' is not as should be"); + } + } + + private void testAccessibleActionInCell(int row, int column, + boolean shouldBeNull) { + System.out.println(String.format("testAccessibleActionInCell():" + + " row='%d', column='%d', shouldBeNull='%b'", + row, column, shouldBeNull)); + + AccessibleContext tblAc = table.getAccessibleContext(); + AccessibleTable accessibleTbl = tblAc.getAccessibleTable(); + if (accessibleTbl == null) { + throw new RuntimeException("'accessibleTbl' should not be null"); + } + + Accessible cellAccessible = accessibleTbl.getAccessibleAt(row, column); + AccessibleContext cellAc = cellAccessible.getAccessibleContext(); + if (cellAc == null) { + throw new RuntimeException("'cellAc' should not be null"); + } + + AccessibleAction cellAa = cellAc.getAccessibleAction(); + if ((shouldBeNull && (cellAa != null)) || + (!shouldBeNull && (cellAa == null))) { + throw new RuntimeException( + "Test failed. 'cellAa' is not as should be"); + } + } +} -- GitLab From e8a1ce00b2981a698b4ba3e09a8b2d49d0051ccb Mon Sep 17 00:00:00 2001 From: Brian Burkhalter Date: Thu, 10 Mar 2022 16:38:44 +0000 Subject: [PATCH 210/340] 8280881: (fs) UnixNativeDispatcher.close0 may throw UnixException Reviewed-by: alanb --- .../sun/nio/fs/LinuxDosFileAttributeView.java | 6 ++--- .../classes/sun/nio/fs/LinuxWatchService.java | 10 +++---- .../unix/classes/sun/nio/fs/UnixCopyFile.java | 10 +++---- .../sun/nio/fs/UnixDirectoryStream.java | 4 +-- .../sun/nio/fs/UnixFileAttributeViews.java | 4 +-- .../classes/sun/nio/fs/UnixFileStore.java | 4 +-- .../sun/nio/fs/UnixFileSystemProvider.java | 13 +++++----- .../sun/nio/fs/UnixNativeDispatcher.java | 26 ++++++++++++++++--- .../sun/nio/fs/UnixSecureDirectoryStream.java | 21 ++++++++------- .../fs/UnixUserDefinedFileAttributeView.java | 14 +++++----- 10 files changed, 67 insertions(+), 45 deletions(-) diff --git a/src/java.base/linux/classes/sun/nio/fs/LinuxDosFileAttributeView.java b/src/java.base/linux/classes/sun/nio/fs/LinuxDosFileAttributeView.java index a60f2ad45f9..70d701c1ef7 100644 --- a/src/java.base/linux/classes/sun/nio/fs/LinuxDosFileAttributeView.java +++ b/src/java.base/linux/classes/sun/nio/fs/LinuxDosFileAttributeView.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2022, 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 @@ -182,7 +182,7 @@ class LinuxDosFileAttributeView x.rethrowAsIOException(file); return null; // keep compiler happy } finally { - close(fd); + close(fd, e -> null); } } @@ -277,7 +277,7 @@ class LinuxDosFileAttributeView } catch (UnixException x) { x.rethrowAsIOException(file); } finally { - close(fd); + close(fd, e -> null); } } } diff --git a/src/java.base/linux/classes/sun/nio/fs/LinuxWatchService.java b/src/java.base/linux/classes/sun/nio/fs/LinuxWatchService.java index 3e53b59ff90..43719e0d5be 100644 --- a/src/java.base/linux/classes/sun/nio/fs/LinuxWatchService.java +++ b/src/java.base/linux/classes/sun/nio/fs/LinuxWatchService.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2022, 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 @@ -70,7 +70,7 @@ class LinuxWatchService socketpair(sp); configureBlocking(sp[0], false); } catch (UnixException x) { - UnixNativeDispatcher.close(ifd); + UnixNativeDispatcher.close(ifd, e -> null); throw new IOException(x.errorString()); } @@ -296,9 +296,9 @@ class LinuxWatchService // free resources unsafe.freeMemory(address); - UnixNativeDispatcher.close(socketpair[0]); - UnixNativeDispatcher.close(socketpair[1]); - UnixNativeDispatcher.close(ifd); + UnixNativeDispatcher.close(socketpair[0], e -> null); + UnixNativeDispatcher.close(socketpair[1], e -> null); + UnixNativeDispatcher.close(ifd, e -> null); } /** diff --git a/src/java.base/unix/classes/sun/nio/fs/UnixCopyFile.java b/src/java.base/unix/classes/sun/nio/fs/UnixCopyFile.java index 3f98c81b3bf..5412748b06c 100644 --- a/src/java.base/unix/classes/sun/nio/fs/UnixCopyFile.java +++ b/src/java.base/unix/classes/sun/nio/fs/UnixCopyFile.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2022, 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 @@ -186,7 +186,7 @@ class UnixCopyFile { } if (sfd >= 0) { source.getFileSystem().copyNonPosixAttributes(sfd, dfd); - close(sfd); + close(sfd, e -> null); } } // copy time stamps last @@ -210,7 +210,7 @@ class UnixCopyFile { done = true; } finally { if (dfd >= 0) - close(dfd); + close(dfd, e -> null); if (!done) { // rollback try { rmdir(target); } catch (UnixException ignore) { } @@ -288,7 +288,7 @@ class UnixCopyFile { } complete = true; } finally { - close(fo); + close(fo, e -> null); // copy of file or attributes failed so rollback if (!complete) { @@ -298,7 +298,7 @@ class UnixCopyFile { } } } finally { - close(fi); + close(fi, e -> null); } } diff --git a/src/java.base/unix/classes/sun/nio/fs/UnixDirectoryStream.java b/src/java.base/unix/classes/sun/nio/fs/UnixDirectoryStream.java index 44b1c70abbb..3bab00b9782 100644 --- a/src/java.base/unix/classes/sun/nio/fs/UnixDirectoryStream.java +++ b/src/java.base/unix/classes/sun/nio/fs/UnixDirectoryStream.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2022, 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 @@ -67,7 +67,7 @@ class UnixDirectoryStream this.filter = filter; } - protected final UnixPath directory() { + final UnixPath directory() { return dir; } diff --git a/src/java.base/unix/classes/sun/nio/fs/UnixFileAttributeViews.java b/src/java.base/unix/classes/sun/nio/fs/UnixFileAttributeViews.java index 0744be1296d..2ffb3099dbc 100644 --- a/src/java.base/unix/classes/sun/nio/fs/UnixFileAttributeViews.java +++ b/src/java.base/unix/classes/sun/nio/fs/UnixFileAttributeViews.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2022, 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 @@ -160,7 +160,7 @@ class UnixFileAttributeViews { } } } finally { - close(fd); + close(fd, e -> null); } } } diff --git a/src/java.base/unix/classes/sun/nio/fs/UnixFileStore.java b/src/java.base/unix/classes/sun/nio/fs/UnixFileStore.java index 7947c416a65..0d793dc69bb 100644 --- a/src/java.base/unix/classes/sun/nio/fs/UnixFileStore.java +++ b/src/java.base/unix/classes/sun/nio/fs/UnixFileStore.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2022, 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 @@ -197,7 +197,7 @@ abstract class UnixFileStore if (e.errno() == UnixConstants.XATTR_NOT_FOUND) return true; } finally { - UnixNativeDispatcher.close(fd); + UnixNativeDispatcher.close(fd, e -> null); } return false; } diff --git a/src/java.base/unix/classes/sun/nio/fs/UnixFileSystemProvider.java b/src/java.base/unix/classes/sun/nio/fs/UnixFileSystemProvider.java index 44a61827137..99703d94755 100644 --- a/src/java.base/unix/classes/sun/nio/fs/UnixFileSystemProvider.java +++ b/src/java.base/unix/classes/sun/nio/fs/UnixFileSystemProvider.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2022, 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 @@ -431,13 +431,14 @@ public abstract class UnixFileSystemProvider dfd2 = dup(dfd1); dp = fdopendir(dfd1); } catch (UnixException x) { + IOException ioe = x.errno() == UnixConstants.ENOTDIR ? + new NotDirectoryException(dir.getPathForExceptionMessage()) : + x.asIOException(dir); if (dfd1 != -1) - UnixNativeDispatcher.close(dfd1); + UnixNativeDispatcher.close(dfd1, e -> null); if (dfd2 != -1) - UnixNativeDispatcher.close(dfd2); - if (x.errno() == UnixConstants.ENOTDIR) - throw new NotDirectoryException(dir.getPathForExceptionMessage()); - x.rethrowAsIOException(dir); + UnixNativeDispatcher.close(dfd2, e -> null); + throw ioe; } return new UnixSecureDirectoryStream(dir, dp, dfd2, filter); } diff --git a/src/java.base/unix/classes/sun/nio/fs/UnixNativeDispatcher.java b/src/java.base/unix/classes/sun/nio/fs/UnixNativeDispatcher.java index 90be5cefae3..4080c08c32e 100644 --- a/src/java.base/unix/classes/sun/nio/fs/UnixNativeDispatcher.java +++ b/src/java.base/unix/classes/sun/nio/fs/UnixNativeDispatcher.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2022, 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 @@ -25,6 +25,8 @@ package sun.nio.fs; +import java.util.function.Function; + /** * Unix system and library calls. */ @@ -90,12 +92,30 @@ class UnixNativeDispatcher { /** * close(int filedes). If fd is -1 this is a no-op. */ - static void close(int fd) { + static void close(int fd) throws UnixException { if (fd != -1) { close0(fd); } } - private static native void close0(int fd); + private static native void close0(int fd) throws UnixException; + + /** + * close(fd). If close fails then the given exception supplier function is + * invoked to produce an exception to throw. If the function returns null + * then no exception is thrown. If close fails and the exception supplier + * function is null, then no exception is thrown. + */ + static + void close(int fd, Function mapper) throws X { + try { + close(fd); + } catch (UnixException e) { + if (mapper != null) { + X ex = mapper.apply(e); + if (ex != null) throw ex; + } + } + } /** * void rewind(FILE* stream); diff --git a/src/java.base/unix/classes/sun/nio/fs/UnixSecureDirectoryStream.java b/src/java.base/unix/classes/sun/nio/fs/UnixSecureDirectoryStream.java index 226effad3ef..bedf847c6e7 100644 --- a/src/java.base/unix/classes/sun/nio/fs/UnixSecureDirectoryStream.java +++ b/src/java.base/unix/classes/sun/nio/fs/UnixSecureDirectoryStream.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2022, 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 @@ -61,7 +61,7 @@ class UnixSecureDirectoryStream ds.writeLock().lock(); try { if (ds.closeImpl()) { - UnixNativeDispatcher.close(dfd); + UnixNativeDispatcher.close(dfd, e -> e.asIOException(ds.directory())); } } finally { ds.writeLock().unlock(); @@ -117,13 +117,14 @@ class UnixSecureDirectoryStream newdfd2 = dup(newdfd1); ptr = fdopendir(newdfd1); } catch (UnixException x) { + IOException ioe = x.errno() == UnixConstants.ENOTDIR ? + new NotDirectoryException(file.toString()) : + x.asIOException(file); if (newdfd1 != -1) - UnixNativeDispatcher.close(newdfd1); + UnixNativeDispatcher.close(newdfd1, e -> null); if (newdfd2 != -1) - UnixNativeDispatcher.close(newdfd2); - if (x.errno() == UnixConstants.ENOTDIR) - throw new NotDirectoryException(file.toString()); - x.rethrowAsIOException(file); + UnixNativeDispatcher.close(newdfd1, e -> null); + throw ioe; } return new UnixSecureDirectoryStream(child, ptr, newdfd2, null); } finally { @@ -422,7 +423,7 @@ class UnixSecureDirectoryStream } } finally { if (file != null) - UnixNativeDispatcher.close(fd); + UnixNativeDispatcher.close(fd, e-> null); } } finally { ds.readLock().unlock(); @@ -504,7 +505,7 @@ class UnixSecureDirectoryStream x.rethrowAsIOException(file); } finally { if (file != null && fd >= 0) - UnixNativeDispatcher.close(fd); + UnixNativeDispatcher.close(fd, e-> null); } } finally { ds.readLock().unlock(); @@ -527,7 +528,7 @@ class UnixSecureDirectoryStream x.rethrowAsIOException(file); } finally { if (file != null && fd >= 0) - UnixNativeDispatcher.close(fd); + UnixNativeDispatcher.close(fd, e-> null); } } finally { ds.readLock().unlock(); diff --git a/src/java.base/unix/classes/sun/nio/fs/UnixUserDefinedFileAttributeView.java b/src/java.base/unix/classes/sun/nio/fs/UnixUserDefinedFileAttributeView.java index 2b62d18cb6f..f568517a2bd 100644 --- a/src/java.base/unix/classes/sun/nio/fs/UnixUserDefinedFileAttributeView.java +++ b/src/java.base/unix/classes/sun/nio/fs/UnixUserDefinedFileAttributeView.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2022, 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 @@ -133,7 +133,7 @@ abstract class UnixUserDefinedFileAttributeView null, "Unable to get list of extended attributes: " + x.getMessage()); } finally { - close(fd); + close(fd, e -> null); } } @@ -157,7 +157,7 @@ abstract class UnixUserDefinedFileAttributeView null, "Unable to get size of extended attribute '" + name + "': " + x.getMessage()); } finally { - close(fd); + close(fd, e -> null); } } @@ -221,7 +221,7 @@ abstract class UnixUserDefinedFileAttributeView throw new FileSystemException(file.getPathForExceptionMessage(), null, "Error reading extended attribute '" + name + "': " + msg); } finally { - close(fd); + close(fd, e -> null); } } @@ -283,7 +283,7 @@ abstract class UnixUserDefinedFileAttributeView null, "Error writing extended attribute '" + name + "': " + x.getMessage()); } finally { - close(fd); + close(fd, e -> null); } } @@ -305,7 +305,7 @@ abstract class UnixUserDefinedFileAttributeView throw new FileSystemException(file.getPathForExceptionMessage(), null, "Unable to delete extended attribute '" + name + "': " + x.getMessage()); } finally { - close(fd); + close(fd, e -> null); } } @@ -346,4 +346,4 @@ abstract class UnixUserDefinedFileAttributeView buffer.release(); } } -} \ No newline at end of file +} -- GitLab From fdce97df5f03d9aa37d85f271d08971ec47db01d Mon Sep 17 00:00:00 2001 From: Brian Burkhalter Date: Thu, 10 Mar 2022 17:36:51 +0000 Subject: [PATCH 211/340] 8267820: (fs) Files.copy should attempt to copy POSIX attributes when target file in custom file system Reviewed-by: lancea, alanb --- .../classes/java/nio/file/CopyMoveHelper.java | 48 ++++++++++++++----- test/jdk/java/nio/file/Files/CopyAndMove.java | 19 ++++---- test/jdk/jdk/nio/zipfs/TestPosix.java | 12 +++-- test/jdk/jdk/nio/zipfs/test.policy | 1 + test/jdk/jdk/nio/zipfs/test.policy.posix | 1 + 5 files changed, 54 insertions(+), 27 deletions(-) diff --git a/src/java.base/share/classes/java/nio/file/CopyMoveHelper.java b/src/java.base/share/classes/java/nio/file/CopyMoveHelper.java index ab9281807fd..e5ca66fa631 100644 --- a/src/java.base/share/classes/java/nio/file/CopyMoveHelper.java +++ b/src/java.base/share/classes/java/nio/file/CopyMoveHelper.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2022, 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 @@ -105,11 +105,20 @@ class CopyMoveHelper { LinkOption[] linkOptions = (opts.followLinks) ? new LinkOption[0] : new LinkOption[] { LinkOption.NOFOLLOW_LINKS }; + // retrieve source posix view, null if unsupported + final PosixFileAttributeView sourcePosixView = + Files.getFileAttributeView(source, PosixFileAttributeView.class); + // attributes of source file - BasicFileAttributes attrs = Files.readAttributes(source, - BasicFileAttributes.class, - linkOptions); - if (attrs.isSymbolicLink()) + BasicFileAttributes sourceAttrs = sourcePosixView != null ? + Files.readAttributes(source, + PosixFileAttributes.class, + linkOptions) : + Files.readAttributes(source, + BasicFileAttributes.class, + linkOptions); + + if (sourceAttrs.isSymbolicLink()) throw new IOException("Copying of symbolic links not supported"); // delete target if it exists and REPLACE_EXISTING is specified @@ -119,7 +128,7 @@ class CopyMoveHelper { throw new FileAlreadyExistsException(target.toString()); // create directory or copy file - if (attrs.isDirectory()) { + if (sourceAttrs.isDirectory()) { Files.createDirectory(target); } else { try (InputStream in = Files.newInputStream(source)) { @@ -127,14 +136,29 @@ class CopyMoveHelper { } } - // copy basic attributes to target + // copy basic and, if supported, POSIX attributes to target if (opts.copyAttributes) { - BasicFileAttributeView view = - Files.getFileAttributeView(target, BasicFileAttributeView.class); + BasicFileAttributeView targetView = null; + if (sourcePosixView != null) { + targetView = Files.getFileAttributeView(target, + PosixFileAttributeView.class); + } + + // target might not support posix even if source does + if (targetView == null) { + targetView = Files.getFileAttributeView(target, + BasicFileAttributeView.class); + } + try { - view.setTimes(attrs.lastModifiedTime(), - attrs.lastAccessTime(), - attrs.creationTime()); + targetView.setTimes(sourceAttrs.lastModifiedTime(), + sourceAttrs.lastAccessTime(), + sourceAttrs.creationTime()); + + if (sourceAttrs instanceof PosixFileAttributes sourcePosixAttrs && + targetView instanceof PosixFileAttributeView targetPosixView) { + targetPosixView.setPermissions(sourcePosixAttrs.permissions()); + } } catch (Throwable x) { // rollback try { diff --git a/test/jdk/java/nio/file/Files/CopyAndMove.java b/test/jdk/java/nio/file/Files/CopyAndMove.java index 981fb332fc0..e91f3e3713b 100644 --- a/test/jdk/java/nio/file/Files/CopyAndMove.java +++ b/test/jdk/java/nio/file/Files/CopyAndMove.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2022, 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 @@ -22,7 +22,7 @@ */ /* @test - * @bug 4313887 6838333 6917021 7006126 6950237 8006645 8201407 + * @bug 4313887 6838333 6917021 7006126 6950237 8006645 8201407 8267820 * @summary Unit test for java.nio.file.Files copy and move methods (use -Dseed=X to set PRNG seed) * @library .. /test/lib * @build jdk.test.lib.Platform jdk.test.lib.RandomFactory @@ -672,16 +672,15 @@ public class CopyAndMove { checkBasicAttributes(basicAttributes, readAttributes(source, BasicFileAttributes.class, linkOptions)); + // check POSIX attributes are copied + if (!Platform.isWindows() && testPosixAttributes) { + checkPosixAttributes( + readAttributes(source, PosixFileAttributes.class, linkOptions), + readAttributes(target, PosixFileAttributes.class, linkOptions)); + } + // verify other attributes when same provider if (source.getFileSystem().provider() == target.getFileSystem().provider()) { - - // check POSIX attributes are copied - if (!Platform.isWindows() && testPosixAttributes) { - checkPosixAttributes( - readAttributes(source, PosixFileAttributes.class, linkOptions), - readAttributes(target, PosixFileAttributes.class, linkOptions)); - } - // check DOS attributes are copied if (Platform.isWindows()) { checkDosAttributes( diff --git a/test/jdk/jdk/nio/zipfs/TestPosix.java b/test/jdk/jdk/nio/zipfs/TestPosix.java index 2be70758fbc..f629dfef222 100644 --- a/test/jdk/jdk/nio/zipfs/TestPosix.java +++ b/test/jdk/jdk/nio/zipfs/TestPosix.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2021, SAP SE. All rights reserved. + * Copyright (c) 2019, 2022, SAP SE. 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 @@ -69,11 +69,11 @@ import static org.testng.Assert.fail; /** * @test * @bug 8213031 8273935 + * @summary Test POSIX ZIP file operations. * @modules jdk.zipfs * jdk.jartool * @run testng TestPosix * @run testng/othervm/java.security.policy=test.policy.posix TestPosix - * @summary Test POSIX zip file operations. */ public class TestPosix { private static final ToolProvider JAR_TOOL = ToolProvider.findFirst("jar") @@ -528,9 +528,11 @@ public class TestPosix { } // check entries on copied zipfs - no permission data should exist - try (FileSystem zip = FileSystems.newFileSystem(ZIP_FILE_COPY, ENV_DEFAULT)) { - checkEntries(zip, checkExpects.noPermDataInZip); - } + if (System.getProperty("os.name").toLowerCase().contains("windows")) + try (FileSystem zip = FileSystems.newFileSystem(ZIP_FILE_COPY, + ENV_DEFAULT)) { + checkEntries(zip, checkExpects.noPermDataInZip); + } } /** diff --git a/test/jdk/jdk/nio/zipfs/test.policy b/test/jdk/jdk/nio/zipfs/test.policy index 1e91f1f8dcf..d0492d0fc7a 100644 --- a/test/jdk/jdk/nio/zipfs/test.policy +++ b/test/jdk/jdk/nio/zipfs/test.policy @@ -3,4 +3,5 @@ grant { permission java.util.PropertyPermission "test.jdk","read"; permission java.util.PropertyPermission "test.src","read"; permission java.util.PropertyPermission "user.dir","read"; + permission java.lang.RuntimePermission "accessUserInformation"; }; diff --git a/test/jdk/jdk/nio/zipfs/test.policy.posix b/test/jdk/jdk/nio/zipfs/test.policy.posix index 601ef439ab4..77415b0f4ba 100644 --- a/test/jdk/jdk/nio/zipfs/test.policy.posix +++ b/test/jdk/jdk/nio/zipfs/test.policy.posix @@ -5,4 +5,5 @@ grant { permission java.util.PropertyPermission "test.src","read"; permission java.util.PropertyPermission "user.dir","read"; permission java.lang.RuntimePermission "accessClassInPackage.jdk.internal.module"; + permission java.lang.RuntimePermission "accessUserInformation"; }; -- GitLab From 879b6445e33ad3a07461d01ea8f28a09979a4313 Mon Sep 17 00:00:00 2001 From: Zhengyu Gu Date: Thu, 10 Mar 2022 18:23:41 +0000 Subject: [PATCH 212/340] 8282897: Fix call parameter to GetStringChars() in HostLocaleProviderAdapter_md.c Reviewed-by: shade, naoto --- .../libjava/HostLocaleProviderAdapter_md.c | 38 +++++++++---------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/src/java.base/windows/native/libjava/HostLocaleProviderAdapter_md.c b/src/java.base/windows/native/libjava/HostLocaleProviderAdapter_md.c index b7c2bcc28db..5d5f3ab476e 100644 --- a/src/java.base/windows/native/libjava/HostLocaleProviderAdapter_md.c +++ b/src/java.base/windows/native/libjava/HostLocaleProviderAdapter_md.c @@ -243,7 +243,7 @@ JNIEXPORT jstring JNICALL Java_sun_util_locale_provider_HostLocaleProviderAdapte JNIEXPORT jstring JNICALL Java_sun_util_locale_provider_HostLocaleProviderAdapterImpl_getDateTimePattern (JNIEnv *env, jclass cls, jint dateStyle, jint timeStyle, jstring jlangtag) { WCHAR pattern[BUFLEN]; - const jchar *langtag = (*env)->GetStringChars(env, jlangtag, JNI_FALSE); + const jchar *langtag = (*env)->GetStringChars(env, jlangtag, NULL); CHECK_NULL_RETURN(langtag, NULL); pattern[0] = L'\0'; @@ -274,7 +274,7 @@ JNIEXPORT jint JNICALL Java_sun_util_locale_provider_HostLocaleProviderAdapterIm (JNIEnv *env, jclass cls, jstring jlangtag) { const jchar *langtag; jint ret; - langtag = (*env)->GetStringChars(env, jlangtag, JNI_FALSE); + langtag = (*env)->GetStringChars(env, jlangtag, NULL); CHECK_NULL_RETURN(langtag, 0); ret = getCalendarID(langtag); (*env)->ReleaseStringChars(env, jlangtag, langtag); @@ -362,7 +362,7 @@ JNIEXPORT jstring JNICALL Java_sun_util_locale_provider_HostLocaleProviderAdapte jstring ret; WCHAR * pattern; - langtag = (*env)->GetStringChars(env, jlangtag, JNI_FALSE); + langtag = (*env)->GetStringChars(env, jlangtag, NULL); CHECK_NULL_RETURN(langtag, NULL); pattern = getNumberPattern(langtag, numberStyle); CHECK_NULL_RETURN(pattern, NULL); @@ -383,7 +383,7 @@ JNIEXPORT jboolean JNICALL Java_sun_util_locale_provider_HostLocaleProviderAdapt (JNIEnv *env, jclass cls, jstring jlangtag) { DWORD num; int got; - const jchar *langtag = (*env)->GetStringChars(env, jlangtag, JNI_FALSE); + const jchar *langtag = (*env)->GetStringChars(env, jlangtag, NULL); CHECK_NULL_RETURN(langtag, JNI_FALSE); got = getLocaleInfoWrapper(langtag, LOCALE_IDIGITSUBSTITUTION | LOCALE_RETURN_NUMBER, @@ -402,7 +402,7 @@ JNIEXPORT jstring JNICALL Java_sun_util_locale_provider_HostLocaleProviderAdapte (JNIEnv *env, jclass cls, jstring jlangtag, jstring currencySymbol) { WCHAR buf[BUFLEN]; int got; - const jchar *langtag = (*env)->GetStringChars(env, jlangtag, JNI_FALSE); + const jchar *langtag = (*env)->GetStringChars(env, jlangtag, NULL); CHECK_NULL_RETURN(langtag, currencySymbol); got = getLocaleInfoWrapper(langtag, LOCALE_SCURRENCY, buf, BUFLEN); (*env)->ReleaseStringChars(env, jlangtag, langtag); @@ -423,7 +423,7 @@ JNIEXPORT jchar JNICALL Java_sun_util_locale_provider_HostLocaleProviderAdapterI (JNIEnv *env, jclass cls, jstring jlangtag, jchar decimalSeparator) { WCHAR buf[BUFLEN]; int got; - const jchar *langtag = (*env)->GetStringChars(env, jlangtag, JNI_FALSE); + const jchar *langtag = (*env)->GetStringChars(env, jlangtag, NULL); CHECK_NULL_RETURN(langtag, decimalSeparator); got = getLocaleInfoWrapper(langtag, LOCALE_SDECIMAL, buf, BUFLEN); (*env)->ReleaseStringChars(env, jlangtag, langtag); @@ -444,7 +444,7 @@ JNIEXPORT jchar JNICALL Java_sun_util_locale_provider_HostLocaleProviderAdapterI (JNIEnv *env, jclass cls, jstring jlangtag, jchar groupingSeparator) { WCHAR buf[BUFLEN]; int got; - const jchar *langtag = (*env)->GetStringChars(env, jlangtag, JNI_FALSE); + const jchar *langtag = (*env)->GetStringChars(env, jlangtag, NULL); CHECK_NULL_RETURN(langtag, groupingSeparator); got = getLocaleInfoWrapper(langtag, LOCALE_STHOUSAND, buf, BUFLEN); (*env)->ReleaseStringChars(env, jlangtag, langtag); @@ -465,7 +465,7 @@ JNIEXPORT jstring JNICALL Java_sun_util_locale_provider_HostLocaleProviderAdapte (JNIEnv *env, jclass cls, jstring jlangtag, jstring infinity) { WCHAR buf[BUFLEN]; int got; - const jchar *langtag = (*env)->GetStringChars(env, jlangtag, JNI_FALSE); + const jchar *langtag = (*env)->GetStringChars(env, jlangtag, NULL); CHECK_NULL_RETURN(langtag, infinity); got = getLocaleInfoWrapper(langtag, LOCALE_SPOSINFINITY, buf, BUFLEN); (*env)->ReleaseStringChars(env, jlangtag, langtag); @@ -486,7 +486,7 @@ JNIEXPORT jstring JNICALL Java_sun_util_locale_provider_HostLocaleProviderAdapte (JNIEnv *env, jclass cls, jstring jlangtag, jstring internationalCurrencySymbol) { WCHAR buf[BUFLEN]; int got; - const jchar *langtag = (*env)->GetStringChars(env, jlangtag, JNI_FALSE); + const jchar *langtag = (*env)->GetStringChars(env, jlangtag, NULL); CHECK_NULL_RETURN(langtag, internationalCurrencySymbol); got = getLocaleInfoWrapper(langtag, LOCALE_SINTLSYMBOL, buf, BUFLEN); (*env)->ReleaseStringChars(env, jlangtag, langtag); @@ -507,7 +507,7 @@ JNIEXPORT jchar JNICALL Java_sun_util_locale_provider_HostLocaleProviderAdapterI (JNIEnv *env, jclass cls, jstring jlangtag, jchar minusSign) { WCHAR buf[BUFLEN]; int got; - const jchar *langtag = (*env)->GetStringChars(env, jlangtag, JNI_FALSE); + const jchar *langtag = (*env)->GetStringChars(env, jlangtag, NULL); CHECK_NULL_RETURN(langtag, minusSign); got = getLocaleInfoWrapper(langtag, LOCALE_SNEGATIVESIGN, buf, BUFLEN); (*env)->ReleaseStringChars(env, jlangtag, langtag); @@ -528,7 +528,7 @@ JNIEXPORT jchar JNICALL Java_sun_util_locale_provider_HostLocaleProviderAdapterI (JNIEnv *env, jclass cls, jstring jlangtag, jchar monetaryDecimalSeparator) { WCHAR buf[BUFLEN]; int got; - const jchar *langtag = (*env)->GetStringChars(env, jlangtag, JNI_FALSE); + const jchar *langtag = (*env)->GetStringChars(env, jlangtag, NULL); CHECK_NULL_RETURN(langtag, monetaryDecimalSeparator); got = getLocaleInfoWrapper(langtag, LOCALE_SMONDECIMALSEP, buf, BUFLEN); (*env)->ReleaseStringChars(env, jlangtag, langtag); @@ -549,7 +549,7 @@ JNIEXPORT jstring JNICALL Java_sun_util_locale_provider_HostLocaleProviderAdapte (JNIEnv *env, jclass cls, jstring jlangtag, jstring nan) { WCHAR buf[BUFLEN]; int got; - const jchar *langtag = (*env)->GetStringChars(env, jlangtag, JNI_FALSE); + const jchar *langtag = (*env)->GetStringChars(env, jlangtag, NULL); CHECK_NULL_RETURN(langtag, nan); got = getLocaleInfoWrapper(langtag, LOCALE_SNAN, buf, BUFLEN); (*env)->ReleaseStringChars(env, jlangtag, langtag); @@ -570,7 +570,7 @@ JNIEXPORT jchar JNICALL Java_sun_util_locale_provider_HostLocaleProviderAdapterI (JNIEnv *env, jclass cls, jstring jlangtag, jchar percent) { WCHAR buf[BUFLEN]; int got; - const jchar *langtag = (*env)->GetStringChars(env, jlangtag, JNI_FALSE); + const jchar *langtag = (*env)->GetStringChars(env, jlangtag, NULL); CHECK_NULL_RETURN(langtag, percent); got = getLocaleInfoWrapper(langtag, LOCALE_SPERCENT, buf, BUFLEN); (*env)->ReleaseStringChars(env, jlangtag, langtag); @@ -592,7 +592,7 @@ JNIEXPORT jchar JNICALL Java_sun_util_locale_provider_HostLocaleProviderAdapterI WCHAR buf[BUFLEN]; const jchar *langtag; int got; - langtag = (*env)->GetStringChars(env, jlangtag, JNI_FALSE); + langtag = (*env)->GetStringChars(env, jlangtag, NULL); CHECK_NULL_RETURN(langtag, perMill); got = getLocaleInfoWrapper(langtag, LOCALE_SPERMILLE, buf, BUFLEN); @@ -615,7 +615,7 @@ JNIEXPORT jchar JNICALL Java_sun_util_locale_provider_HostLocaleProviderAdapterI WCHAR buf[BUFLEN]; const jchar *langtag; int got; - langtag = (*env)->GetStringChars(env, jlangtag, JNI_FALSE); + langtag = (*env)->GetStringChars(env, jlangtag, NULL); CHECK_NULL_RETURN(langtag, zeroDigit); got = getLocaleInfoWrapper(langtag, LOCALE_SNATIVEDIGITS, buf, BUFLEN); @@ -639,7 +639,7 @@ JNIEXPORT jint JNICALL Java_sun_util_locale_provider_HostLocaleProviderAdapterIm const jchar *langtag; int got = 0; - langtag = (*env)->GetStringChars(env, jlangtag, JNI_FALSE); + langtag = (*env)->GetStringChars(env, jlangtag, NULL); CHECK_NULL_RETURN(langtag, -1); switch (type) { case sun_util_locale_provider_HostLocaleProviderAdapterImpl_CD_FIRSTDAYOFWEEK: @@ -756,7 +756,7 @@ JNIEXPORT jstring JNICALL Java_sun_util_locale_provider_HostLocaleProviderAdapte return NULL; } - pjChar = (*env)->GetStringChars(env, jStr, JNI_FALSE); + pjChar = (*env)->GetStringChars(env, jStr, NULL); CHECK_NULL_RETURN(pjChar, NULL); got = getLocaleInfoWrapper(pjChar, lcType, buf, BUFLEN); (*env)->ReleaseStringChars(env, jStr, pjChar); @@ -833,7 +833,7 @@ jint getCalendarID(const jchar *langtag) { void replaceCalendarArrayElems(JNIEnv *env, jstring jlangtag, jint calid, jobjectArray jarray, DWORD* pTypes, int offset, int length, int style, BOOL bCal) { WCHAR name[BUFLEN]; - const jchar *langtag = (*env)->GetStringChars(env, jlangtag, JNI_FALSE); + const jchar *langtag = (*env)->GetStringChars(env, jlangtag, NULL); jstring tmp_string; CALTYPE isGenitive = 0; @@ -1023,7 +1023,7 @@ BOOL CALLBACK EnumCalendarInfoProc(LPWSTR lpCalInfoStr, CALID calid, LPWSTR lpRe } jobjectArray getErasImpl(JNIEnv *env, jstring jlangtag, jint calid, jint style, jobjectArray eras) { - const jchar * langtag = (*env)->GetStringChars(env, jlangtag, JNI_FALSE); + const jchar * langtag = (*env)->GetStringChars(env, jlangtag, NULL); WCHAR buf[BUFLEN]; jobjectArray ret = eras; CALTYPE type; -- GitLab From 1f295239b97cccfff24df259215d34c712065867 Mon Sep 17 00:00:00 2001 From: John Jiang Date: Thu, 10 Mar 2022 18:25:06 +0000 Subject: [PATCH 213/340] 8282932: a space is needed for the unsupported protocol exception message in ProtocolVersion Reviewed-by: xuelei, mullan --- .../share/classes/sun/security/ssl/ProtocolVersion.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/java.base/share/classes/sun/security/ssl/ProtocolVersion.java b/src/java.base/share/classes/sun/security/ssl/ProtocolVersion.java index e4cb5637c60..32c112a4991 100644 --- a/src/java.base/share/classes/sun/security/ssl/ProtocolVersion.java +++ b/src/java.base/share/classes/sun/security/ssl/ProtocolVersion.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2022, 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 @@ -290,7 +290,7 @@ enum ProtocolVersion { ProtocolVersion pv = ProtocolVersion.nameOf(pn); if (pv == null) { throw new IllegalArgumentException( - "Unsupported protocol" + pn); + "Unsupported protocol: " + pn); } pvs.add(pv); -- GitLab From b13cacc575f58c206c928f2756698b027ee07b6f Mon Sep 17 00:00:00 2001 From: Brian Burkhalter Date: Thu, 10 Mar 2022 18:25:53 +0000 Subject: [PATCH 214/340] 8254574: PrintWriter handling of InterruptedIOException should be removed Reviewed-by: alanb --- .../share/classes/java/io/PrintStream.java | 21 +++++-------------- .../share/classes/java/io/PrintWriter.java | 10 ++++----- 2 files changed, 10 insertions(+), 21 deletions(-) diff --git a/src/java.base/share/classes/java/io/PrintStream.java b/src/java.base/share/classes/java/io/PrintStream.java index 0281ed66ca8..d18afa97d54 100644 --- a/src/java.base/share/classes/java/io/PrintStream.java +++ b/src/java.base/share/classes/java/io/PrintStream.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2022, 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 @@ -464,22 +464,11 @@ public class PrintStream extends FilterOutputStream } /** - * Flushes the stream and checks its error state. The internal error state - * is set to {@code true} when the underlying output stream throws an - * {@code IOException} other than {@code InterruptedIOException}, - * and when the {@code setError} method is invoked. If an operation - * on the underlying output stream throws an - * {@code InterruptedIOException}, then the {@code PrintStream} - * converts the exception back into an interrupt by doing: - *

    {@code
    -     *     Thread.currentThread().interrupt();
    -     * }
    - * or the equivalent. + * Flushes the stream if it's not closed and checks its error state. * * @return {@code true} if and only if this stream has encountered an - * {@code IOException} other than - * {@code InterruptedIOException}, or the - * {@code setError} method has been invoked + * {@code IOException}, or the {@code setError} method has been + * invoked */ public boolean checkError() { if (out != null) @@ -504,7 +493,7 @@ public class PrintStream extends FilterOutputStream } /** - * Clears the internal error state of this stream. + * Clears the error state of this stream. * *

    This method will cause subsequent invocations of {@link * #checkError()} to return {@code false} until another write diff --git a/src/java.base/share/classes/java/io/PrintWriter.java b/src/java.base/share/classes/java/io/PrintWriter.java index 874a03cce3b..249efc4d99a 100644 --- a/src/java.base/share/classes/java/io/PrintWriter.java +++ b/src/java.base/share/classes/java/io/PrintWriter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2022, 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 @@ -428,9 +428,9 @@ public class PrintWriter extends Writer { /** * Flushes the stream if it's not closed and checks its error state. * - * @return {@code true} if the print stream has encountered an error, - * either on the underlying output stream or during a format - * conversion. + * @return {@code true} if and only if this stream has encountered an + * {@code IOException}, or the {@code setError} method has been + * invoked */ public boolean checkError() { if (out != null) { @@ -445,7 +445,7 @@ public class PrintWriter extends Writer { } /** - * Indicates that an error has occurred. + * Sets the error state of the stream to {@code true}. * *

    This method will cause subsequent invocations of {@link * #checkError()} to return {@code true} until {@link -- GitLab From 7b91bbba82e871edaf133343415e254972c6ddc7 Mon Sep 17 00:00:00 2001 From: Aleksey Shipilev Date: Thu, 10 Mar 2022 18:53:59 +0000 Subject: [PATCH 215/340] 8282170: JVMTI SetBreakpoint metaspace allocation test Reviewed-by: cjplummer, lmesnik --- .../SetBreakpoint/TestManyBreakpoints.java | 82 +++++++++++++ .../SetBreakpoint/libTestManyBreakpoints.cpp | 111 ++++++++++++++++++ 2 files changed, 193 insertions(+) create mode 100644 test/hotspot/jtreg/serviceability/jvmti/SetBreakpoint/TestManyBreakpoints.java create mode 100644 test/hotspot/jtreg/serviceability/jvmti/SetBreakpoint/libTestManyBreakpoints.cpp diff --git a/test/hotspot/jtreg/serviceability/jvmti/SetBreakpoint/TestManyBreakpoints.java b/test/hotspot/jtreg/serviceability/jvmti/SetBreakpoint/TestManyBreakpoints.java new file mode 100644 index 00000000000..bc935ea99d1 --- /dev/null +++ b/test/hotspot/jtreg/serviceability/jvmti/SetBreakpoint/TestManyBreakpoints.java @@ -0,0 +1,82 @@ +/* + * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 8144992 + * @requires vm.jvmti + * @modules java.base/jdk.internal.org.objectweb.asm + * @run main/othervm/native -agentlib:TestManyBreakpoints + * -Xlog:gc+metaspace + * -Xint + * -XX:MetaspaceSize=16K -XX:MaxMetaspaceSize=64M + * TestManyBreakpoints + */ + +import jdk.internal.org.objectweb.asm.ClassWriter; +import jdk.internal.org.objectweb.asm.Label; +import jdk.internal.org.objectweb.asm.MethodVisitor; +import jdk.internal.org.objectweb.asm.Opcodes; + +public class TestManyBreakpoints { + + static final int BATCHES = 50; + static final int METHODS = 1000; + + public static void main(String[] args) throws Exception { + for (int c = 0; c < BATCHES; c++) { + System.out.println("Batch " + c); + TestClassLoader loader = new TestClassLoader(); + Class.forName("Target", true, loader); + } + } + + private static class TestClassLoader extends ClassLoader implements Opcodes { + static byte[] TARGET_BYTES = generateTarget(); + + private static byte[] generateTarget() { + ClassWriter cw = new ClassWriter(0); + + cw.visit(52, ACC_SUPER | ACC_PUBLIC, "Target", null, "java/lang/Object", null); + for (int m = 0; m < METHODS; m++) { + MethodVisitor mv = cw.visitMethod(ACC_PUBLIC | ACC_STATIC, "m" + m, "()V", null, null); + mv.visitCode(); + mv.visitInsn(RETURN); + mv.visitMaxs(0, 0); + mv.visitEnd(); + } + cw.visitEnd(); + return cw.toByteArray(); + } + + @Override + protected Class findClass(String name) throws ClassNotFoundException { + if (name.equals("Target")) { + return defineClass(name, TARGET_BYTES, 0, TARGET_BYTES.length); + } else { + return super.findClass(name); + } + } + } + +} diff --git a/test/hotspot/jtreg/serviceability/jvmti/SetBreakpoint/libTestManyBreakpoints.cpp b/test/hotspot/jtreg/serviceability/jvmti/SetBreakpoint/libTestManyBreakpoints.cpp new file mode 100644 index 00000000000..dcb8f87ddd7 --- /dev/null +++ b/test/hotspot/jtreg/serviceability/jvmti/SetBreakpoint/libTestManyBreakpoints.cpp @@ -0,0 +1,111 @@ +/* + * Copyright (c) 2022, 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. + */ + +#include +#include + +#include "jvmti.h" + +#define TARGET_CLASS_NAME "LTarget;" + +static jvmtiEnv *jvmti = NULL; + +static void +check_jvmti_status(JNIEnv* jni, jvmtiError err, const char* msg) { + if (err != JVMTI_ERROR_NONE) { + printf("check_jvmti_status: %s, JVMTI function returned error: %d\n", msg, err); + jni->FatalError(msg); + } +} + +void JNICALL classprepare(jvmtiEnv* jvmti_env, JNIEnv* jni_env, jthread thread, jclass klass) { + char* buf; + jvmtiError err; + + err = jvmti->GetClassSignature(klass, &buf, NULL); + check_jvmti_status(jni_env, err, "classprepare: GetClassSignature error"); + + if (strncmp(buf, TARGET_CLASS_NAME, strlen(TARGET_CLASS_NAME)) == 0) { + jint nMethods; + jmethodID* methods; + int i; + + err = jvmti->GetClassMethods(klass, &nMethods, &methods); + check_jvmti_status(jni_env, err, "classprepare: GetClassMethods error"); + printf("Setting breakpoints in %s\n", buf); + fflush(stdout); + for (i = 0; i < nMethods; i++) { + err = jvmti->SetBreakpoint(methods[i], 0); + check_jvmti_status(jni_env, err, "classprepare: SetBreakpoint error"); + } + } +} + + +void JNICALL breakpoint(jvmtiEnv* jvmti_env, JNIEnv* jni_env, jthread thread, jmethodID method, jlocation location) { + // Do nothing +} + +JNIEXPORT jint JNICALL Agent_OnLoad(JavaVM* vm, char* options, void* reserved) { + jvmtiCapabilities capa; + jvmtiEventCallbacks cbs; + jint err; + + err = vm->GetEnv((void**)&jvmti, JVMTI_VERSION_1_0); + if (err != JNI_OK) { + printf("Agent_OnLoad: GetEnv error\n"); + return JNI_ERR; + } + + memset(&capa, 0, sizeof(capa)); + capa.can_generate_breakpoint_events = 1; + capa.can_generate_single_step_events = 1; + err = jvmti->AddCapabilities(&capa); + if (err != JNI_OK) { + printf("Agent_OnLoad: AddCapabilities error\n"); + return JNI_ERR; + } + + memset(&cbs, 0, sizeof(cbs)); + cbs.ClassPrepare = classprepare; + cbs.Breakpoint = breakpoint; + err = jvmti->SetEventCallbacks(&cbs, sizeof(cbs)); + if (err != JNI_OK) { + printf("Agent_OnLoad: SetEventCallbacks error\n"); + return JNI_ERR; + } + + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_PREPARE, NULL); + if (err != JNI_OK) { + printf("Agent_OnLoad: SetEventNotificationMode CLASS_PREPARE error\n"); + return JNI_ERR; + } + + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_BREAKPOINT, NULL); + if (err != JNI_OK) { + printf("Agent_OnLoad: SetEventNotificationMode BREAKPOINT error\n"); + return JNI_ERR; + } + + return JNI_OK; +} -- GitLab From f5217b475e2bfcbc649dd1e067222bf500429663 Mon Sep 17 00:00:00 2001 From: Chris Plummer Date: Thu, 10 Mar 2022 19:08:10 +0000 Subject: [PATCH 216/340] 8282852: Debug agent asserts in classTrack_addPreparedClass() Reviewed-by: amenkov, lmesnik --- .../share/native/libjdwp/classTrack.c | 21 ++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/src/jdk.jdwp.agent/share/native/libjdwp/classTrack.c b/src/jdk.jdwp.agent/share/native/libjdwp/classTrack.c index de9918780bf..613b02c8d1e 100644 --- a/src/jdk.jdwp.agent/share/native/libjdwp/classTrack.c +++ b/src/jdk.jdwp.agent/share/native/libjdwp/classTrack.c @@ -110,21 +110,28 @@ classTrack_addPreparedClass(JNIEnv *env_unused, jclass klass) jvmtiError error; jvmtiEnv* env = trackingEnv; + char* signature; + error = classSignature(klass, &signature, NULL); + if (error != JVMTI_ERROR_NONE) { + EXIT_ERROR(error,"signature"); + } + if (gdata && gdata->assertOn) { - // Check this is not already tagged. + // Check if already tagged. jlong tag; error = JVMTI_FUNC_PTR(trackingEnv, GetTag)(env, klass, &tag); if (error != JVMTI_ERROR_NONE) { EXIT_ERROR(error, "Unable to GetTag with class trackingEnv"); } - JDI_ASSERT(tag == NOT_TAGGED); + if (tag != NOT_TAGGED) { + // If tagged, the old tag better be the same as the new. + char* oldSignature = (char*)jlong_to_ptr(tag); + JDI_ASSERT(strcmp(signature, oldSignature) == 0); + jvmtiDeallocate(signature); + return; + } } - char* signature; - error = classSignature(klass, &signature, NULL); - if (error != JVMTI_ERROR_NONE) { - EXIT_ERROR(error,"signature"); - } error = JVMTI_FUNC_PTR(trackingEnv, SetTag)(env, klass, ptr_to_jlong(signature)); if (error != JVMTI_ERROR_NONE) { jvmtiDeallocate(signature); -- GitLab From bb7ee5a04ae21a9f9dc6c59a990f7e571e832f0d Mon Sep 17 00:00:00 2001 From: "Daniel D. Daugherty" Date: Thu, 10 Mar 2022 19:13:55 +0000 Subject: [PATCH 217/340] 8282314: nsk/jvmti/SuspendThread/suspendthrd003 may leak memory Reviewed-by: dholmes, cjplummer, amenkov, lmesnik, mseledtsov --- .../nsk/jvmti/SuspendThread/suspendthrd003.java | 5 ++++- test/hotspot/jtreg/vmTestbase/nsk/share/Log.java | 9 ++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SuspendThread/suspendthrd003.java b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SuspendThread/suspendthrd003.java index fd98b382d2a..e2a48a948e9 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SuspendThread/suspendthrd003.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SuspendThread/suspendthrd003.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2022, 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 @@ -88,6 +88,9 @@ public class suspendthrd003 extends DebugeeClass { int res = -1; long start_time = System.currentTimeMillis(); while (System.currentTimeMillis() < start_time + (timeMax * 1000)) { + // Start each loop with a clear log buffer so we only + // track the run that can potentially fail: + log.clearLogBuffer(); count++; // Original suspendthrd001 test block starts here: diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/Log.java b/test/hotspot/jtreg/vmTestbase/nsk/share/Log.java index 109c3ddd8f7..e171f6daa82 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/share/Log.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/Log.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2022, 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 @@ -477,6 +477,13 @@ public class Log extends FinalizableObject { ///////////////////////////////////////////////////////////////// + /** + * Clear all messages from log buffer. + */ + public synchronized void clearLogBuffer() { + logBuffer.clear(); + } + /** * Print all messages from log buffer which were hidden because * of non-verbose mode, -- GitLab From a5a1a32db65b98f0d7bae20cf054be2fbbf2cf3a Mon Sep 17 00:00:00 2001 From: Yi Yang Date: Fri, 11 Mar 2022 02:27:01 +0000 Subject: [PATCH 218/340] 8282883: Use JVM_LEAF to avoid ThreadStateTransition for some simple JVM entries Reviewed-by: dholmes, shade --- src/hotspot/share/prims/jvm.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/hotspot/share/prims/jvm.cpp b/src/hotspot/share/prims/jvm.cpp index d8a5a025b9d..f18fe51616c 100644 --- a/src/hotspot/share/prims/jvm.cpp +++ b/src/hotspot/share/prims/jvm.cpp @@ -487,7 +487,7 @@ JVM_ENTRY_NO_ENV(jint, JVM_ActiveProcessorCount(void)) return os::active_processor_count(); JVM_END -JVM_ENTRY_NO_ENV(jboolean, JVM_IsUseContainerSupport(void)) +JVM_LEAF(jboolean, JVM_IsUseContainerSupport(void)) #ifdef LINUX if (UseContainerSupport) { return JNI_TRUE; @@ -690,7 +690,7 @@ JVM_ENTRY(void, JVM_ReportFinalizationComplete(JNIEnv * env, jobject finalizee)) MANAGEMENT_ONLY(FinalizerService::on_complete(JNIHandles::resolve_non_null(finalizee), THREAD);) JVM_END -JVM_ENTRY(jboolean, JVM_IsFinalizationEnabled(JNIEnv * env)) +JVM_LEAF(jboolean, JVM_IsFinalizationEnabled(JNIEnv * env)) return InstanceKlass::is_finalization_enabled(); JVM_END @@ -3035,7 +3035,7 @@ JVM_ENTRY(void, JVM_SetThreadPriority(JNIEnv* env, jobject jthread, jint prio)) JVM_END -JVM_ENTRY(void, JVM_Yield(JNIEnv *env, jclass threadClass)) +JVM_LEAF(void, JVM_Yield(JNIEnv *env, jclass threadClass)) if (os::dont_yield()) return; HOTSPOT_THREAD_YIELD(); os::naked_yield(); @@ -3643,11 +3643,11 @@ JVM_ENTRY(jclass, JVM_LookupLambdaProxyClassFromArchive(JNIEnv* env, #endif // INCLUDE_CDS JVM_END -JVM_ENTRY(jboolean, JVM_IsCDSDumpingEnabled(JNIEnv* env)) +JVM_LEAF(jboolean, JVM_IsCDSDumpingEnabled(JNIEnv* env)) return Arguments::is_dumping_archive(); JVM_END -JVM_ENTRY(jboolean, JVM_IsSharingEnabled(JNIEnv* env)) +JVM_LEAF(jboolean, JVM_IsSharingEnabled(JNIEnv* env)) return UseSharedSpaces; JVM_END @@ -3673,7 +3673,7 @@ JVM_ENTRY_NO_ENV(jlong, JVM_GetRandomSeedForDumping()) } JVM_END -JVM_ENTRY(jboolean, JVM_IsDumpingClassList(JNIEnv *env)) +JVM_LEAF(jboolean, JVM_IsDumpingClassList(JNIEnv *env)) #if INCLUDE_CDS return ClassListWriter::is_enabled() || DynamicDumpSharedSpaces; #else @@ -3782,7 +3782,7 @@ JVM_ENTRY(jobjectArray, JVM_DumpThreads(JNIEnv *env, jclass threadClass, jobject JVM_END // JVM monitoring and management support -JVM_ENTRY_NO_ENV(void*, JVM_GetManagement(jint version)) +JVM_LEAF(void*, JVM_GetManagement(jint version)) return Management::get_jmm_interface(version); JVM_END @@ -3871,7 +3871,7 @@ JVM_ENTRY(jobjectArray, JVM_GetVmArguments(JNIEnv *env)) return (jobjectArray) JNIHandles::make_local(THREAD, result_h()); JVM_END -JVM_ENTRY_NO_ENV(jint, JVM_FindSignal(const char *name)) +JVM_LEAF(jint, JVM_FindSignal(const char *name)) return os::get_signal_number(name); JVM_END -- GitLab From 88f0938c943bfacf748ddb0588a301c2cf7e941e Mon Sep 17 00:00:00 2001 From: Yi Yang Date: Fri, 11 Mar 2022 02:28:07 +0000 Subject: [PATCH 219/340] 8272493: Suboptimal code generation around Preconditions.checkIndex intrinsic with AVX2 Reviewed-by: redestad, thartmann --- src/hotspot/share/opto/library_call.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/hotspot/share/opto/library_call.cpp b/src/hotspot/share/opto/library_call.cpp index 31d56fcd70e..f5c19d8123c 100644 --- a/src/hotspot/share/opto/library_call.cpp +++ b/src/hotspot/share/opto/library_call.cpp @@ -1092,7 +1092,6 @@ bool LibraryCallKit::inline_preconditions_checkIndex(BasicType bt) { result = _gvn.transform(result); set_result(result); replace_in_map(index, result); - clear_upper_avx(); return true; } -- GitLab From 1a5a496aee0f4c33cb67b0853bbf23313fd6ec7d Mon Sep 17 00:00:00 2001 From: Ivan Walulya Date: Fri, 11 Mar 2022 08:43:04 +0000 Subject: [PATCH 220/340] 8282763: G1: G1CardSetContainer remove intrusive-list details. Reviewed-by: tschatzl, kbarrett, ayang --- .../share/gc/g1/g1CardSetContainers.hpp | 29 ++----------------- .../gc/g1/g1CardSetContainers.inline.hpp | 1 + 2 files changed, 4 insertions(+), 26 deletions(-) diff --git a/src/hotspot/share/gc/g1/g1CardSetContainers.hpp b/src/hotspot/share/gc/g1/g1CardSetContainers.hpp index 4f861baf4eb..6736a18ab02 100644 --- a/src/hotspot/share/gc/g1/g1CardSetContainers.hpp +++ b/src/hotspot/share/gc/g1/g1CardSetContainers.hpp @@ -30,11 +30,6 @@ #include "runtime/atomic.hpp" #include "utilities/bitMap.hpp" #include "utilities/globalDefinitions.hpp" -#include "utilities/spinYield.hpp" - -#include "logging/log.hpp" - -#include "runtime/thread.inline.hpp" // A helper class to encode a few card indexes within a CardSetPtr. // @@ -143,18 +138,12 @@ public: // To maintain these constraints, live objects should have ((_ref_count & 0x1) == 1), // which requires that we increment the reference counts by 2 starting at _ref_count = 3. // -// When such an object is on a free list, we reuse the same field for linking -// together those free objects. -// // All but inline pointers are of this kind. For those, card entries are stored // directly in the CardSetPtr of the ConcurrentHashTable node. class G1CardSetContainer { -private: - union { - G1CardSetContainer* _next; - uintptr_t _ref_count; - }; - + uintptr_t _ref_count; +protected: + ~G1CardSetContainer() = default; public: G1CardSetContainer() : _ref_count(3) { } @@ -166,18 +155,6 @@ public: // to check the value after attempting to decrement. uintptr_t decrement_refcount(); - G1CardSetContainer* next() { - return _next; - } - - G1CardSetContainer** next_addr() { - return &_next; - } - - void set_next(G1CardSetContainer* next) { - _next = next; - } - // Log of largest card index that can be stored in any G1CardSetContainer static uint LogCardsPerRegionLimit; }; diff --git a/src/hotspot/share/gc/g1/g1CardSetContainers.inline.hpp b/src/hotspot/share/gc/g1/g1CardSetContainers.inline.hpp index 13e70302b02..73d84fbf934 100644 --- a/src/hotspot/share/gc/g1/g1CardSetContainers.inline.hpp +++ b/src/hotspot/share/gc/g1/g1CardSetContainers.inline.hpp @@ -29,6 +29,7 @@ #include "gc/g1/g1GCPhaseTimes.hpp" #include "utilities/bitMap.inline.hpp" #include "utilities/globalDefinitions.hpp" +#include "utilities/spinYield.hpp" inline G1CardSetInlinePtr::CardSetPtr G1CardSetInlinePtr::merge(CardSetPtr orig_value, uint card_in_region, uint idx, uint bits_per_card) { assert((idx & (SizeFieldMask >> SizeFieldPos)) == idx, "Index %u too large to fit into size field", idx); -- GitLab From cab9def1c1ab28b0b1a8cf268d0853f6e2bfa77f Mon Sep 17 00:00:00 2001 From: Julian Waters Date: Fri, 11 Mar 2022 09:12:19 +0000 Subject: [PATCH 221/340] 8282700: Properly handle several --without options during configure Reviewed-by: ihse --- make/autoconf/jdk-version.m4 | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/make/autoconf/jdk-version.m4 b/make/autoconf/jdk-version.m4 index b18e8a504ab..41f4b1fb121 100644 --- a/make/autoconf/jdk-version.m4 +++ b/make/autoconf/jdk-version.m4 @@ -72,7 +72,9 @@ AC_DEFUN_ONCE([JDKVER_SETUP_JDK_VERSION_NUMBERS], # Setup username (for use in adhoc version strings etc) AC_ARG_WITH([build-user], [AS_HELP_STRING([--with-build-user], [build username to use in version strings])]) - if test "x$with_build_user" != x; then + if test "x$with_build_user" = xyes || test "x$with_build_user" = xno; then + AC_MSG_ERROR([--with-build-user must have a value]) + elif test "x$with_build_user" != x; then USERNAME="$with_build_user" else # Outer [ ] to quote m4. @@ -84,7 +86,7 @@ AC_DEFUN_ONCE([JDKVER_SETUP_JDK_VERSION_NUMBERS], AC_ARG_WITH(jdk-rc-name, [AS_HELP_STRING([--with-jdk-rc-name], [Set JDK RC name. This is used for FileDescription and ProductName properties of MS Windows binaries. @<:@not specified@:>@])]) - if test "x$with_jdk_rc_name" = xyes; then + if test "x$with_jdk_rc_name" = xyes || test "x$with_jdk_rc_name" = xno; then AC_MSG_ERROR([--with-jdk-rc-name must have a value]) elif [ ! [[ $with_jdk_rc_name =~ ^[[:print:]]*$ ]] ]; then AC_MSG_ERROR([--with-jdk-rc-name contains non-printing characters: $with_jdk_rc_name]) @@ -101,7 +103,7 @@ AC_DEFUN_ONCE([JDKVER_SETUP_JDK_VERSION_NUMBERS], AC_ARG_WITH(vendor-name, [AS_HELP_STRING([--with-vendor-name], [Set vendor name. Among others, used to set the 'java.vendor' and 'java.vm.vendor' system properties. @<:@not specified@:>@])]) - if test "x$with_vendor_name" = xyes; then + if test "x$with_vendor_name" = xyes || test "x$with_vendor_name" = xno; then AC_MSG_ERROR([--with-vendor-name must have a value]) elif [ ! [[ $with_vendor_name =~ ^[[:print:]]*$ ]] ]; then AC_MSG_ERROR([--with-vendor-name contains non-printing characters: $with_vendor_name]) @@ -115,7 +117,7 @@ AC_DEFUN_ONCE([JDKVER_SETUP_JDK_VERSION_NUMBERS], # The vendor URL, if any AC_ARG_WITH(vendor-url, [AS_HELP_STRING([--with-vendor-url], [Set the 'java.vendor.url' system property @<:@not specified@:>@])]) - if test "x$with_vendor_url" = xyes; then + if test "x$with_vendor_url" = xyes || test "x$with_vendor_url" = xno; then AC_MSG_ERROR([--with-vendor-url must have a value]) elif [ ! [[ $with_vendor_url =~ ^[[:print:]]*$ ]] ]; then AC_MSG_ERROR([--with-vendor-url contains non-printing characters: $with_vendor_url]) @@ -129,7 +131,7 @@ AC_DEFUN_ONCE([JDKVER_SETUP_JDK_VERSION_NUMBERS], # The vendor bug URL, if any AC_ARG_WITH(vendor-bug-url, [AS_HELP_STRING([--with-vendor-bug-url], [Set the 'java.vendor.url.bug' system property @<:@not specified@:>@])]) - if test "x$with_vendor_bug_url" = xyes; then + if test "x$with_vendor_bug_url" = xyes || test "x$with_vendor_bug_url" = xno; then AC_MSG_ERROR([--with-vendor-bug-url must have a value]) elif [ ! [[ $with_vendor_bug_url =~ ^[[:print:]]*$ ]] ]; then AC_MSG_ERROR([--with-vendor-bug-url contains non-printing characters: $with_vendor_bug_url]) @@ -143,7 +145,7 @@ AC_DEFUN_ONCE([JDKVER_SETUP_JDK_VERSION_NUMBERS], # The vendor VM bug URL, if any AC_ARG_WITH(vendor-vm-bug-url, [AS_HELP_STRING([--with-vendor-vm-bug-url], [Sets the bug URL which will be displayed when the VM crashes @<:@not specified@:>@])]) - if test "x$with_vendor_vm_bug_url" = xyes; then + if test "x$with_vendor_vm_bug_url" = xyes || test "x$with_vendor_vm_bug_url" = xno; then AC_MSG_ERROR([--with-vendor-vm-bug-url must have a value]) elif [ ! [[ $with_vendor_vm_bug_url =~ ^[[:print:]]*$ ]] ]; then AC_MSG_ERROR([--with-vendor-vm-bug-url contains non-printing characters: $with_vendor_vm_bug_url]) @@ -160,7 +162,7 @@ AC_DEFUN_ONCE([JDKVER_SETUP_JDK_VERSION_NUMBERS], # override parts with more specific flags, since these are processed later. AC_ARG_WITH(version-string, [AS_HELP_STRING([--with-version-string], [Set version string @<:@calculated@:>@])]) - if test "x$with_version_string" = xyes; then + if test "x$with_version_string" = xyes || test "x$with_version_string" = xno; then AC_MSG_ERROR([--with-version-string must have a value]) elif test "x$with_version_string" != x; then # Additional [] needed to keep m4 from mangling shell constructs. @@ -293,7 +295,7 @@ AC_DEFUN_ONCE([JDKVER_SETUP_JDK_VERSION_NUMBERS], [with_version_feature_present=true], [with_version_feature_present=false]) if test "x$with_version_feature_present" = xtrue; then - if test "x$with_version_feature" = xyes; then + if test "x$with_version_feature" = xyes || test "x$with_version_feature" = xno; then AC_MSG_ERROR([--with-version-feature must have a value]) else JDKVER_CHECK_AND_SET_NUMBER(VERSION_FEATURE, $with_version_feature) @@ -480,7 +482,7 @@ AC_DEFUN_ONCE([JDKVER_SETUP_JDK_VERSION_NUMBERS], # The version date AC_ARG_WITH(version-date, [AS_HELP_STRING([--with-version-date], [Set version date @<:@current source value@:>@])]) - if test "x$with_version_date" = xyes; then + if test "x$with_version_date" = xyes || test "x$with_version_date" = xno; then AC_MSG_ERROR([--with-version-date must have a value]) elif test "x$with_version_date" != x; then if [ ! [[ $with_version_date =~ ^[0-9]{4}-[0-9]{2}-[0-9]{2}$ ]] ]; then @@ -499,7 +501,10 @@ AC_DEFUN_ONCE([JDKVER_SETUP_JDK_VERSION_NUMBERS], AC_MSG_ERROR([--with-vendor-version-string must have a value]) elif [ ! [[ $with_vendor_version_string =~ ^[[:graph:]]*$ ]] ]; then AC_MSG_ERROR([--with--vendor-version-string contains non-graphical characters: $with_vendor_version_string]) - else + elif test "x$with_vendor_version_string" != xno; then + # Set vendor version string if --without is not passed + # Check not required if an empty value is passed, since VENDOR_VERSION_STRING + # would then be set to "" VENDOR_VERSION_STRING="$with_vendor_version_string" fi @@ -507,7 +512,7 @@ AC_DEFUN_ONCE([JDKVER_SETUP_JDK_VERSION_NUMBERS], AC_ARG_WITH(macosx-bundle-name-base, [AS_HELP_STRING([--with-macosx-bundle-name-base], [Set the MacOSX Bundle Name base. This is the base name for calculating MacOSX Bundle Names. @<:@not specified@:>@])]) - if test "x$with_macosx_bundle_name_base" = xyes; then + if test "x$with_macosx_bundle_name_base" = xyes || test "x$with_macosx_bundle_name_base" = xno; then AC_MSG_ERROR([--with-macosx-bundle-name-base must have a value]) elif [ ! [[ $with_macosx_bundle_name_base =~ ^[[:print:]]*$ ]] ]; then AC_MSG_ERROR([--with-macosx-bundle-name-base contains non-printing characters: $with_macosx_bundle_name_base]) @@ -521,7 +526,7 @@ AC_DEFUN_ONCE([JDKVER_SETUP_JDK_VERSION_NUMBERS], AC_ARG_WITH(macosx-bundle-id-base, [AS_HELP_STRING([--with-macosx-bundle-id-base], [Set the MacOSX Bundle ID base. This is the base ID for calculating MacOSX Bundle IDs. @<:@not specified@:>@])]) - if test "x$with_macosx_bundle_id_base" = xyes; then + if test "x$with_macosx_bundle_id_base" = xyes || test "x$with_macosx_bundle_id_base" = xno; then AC_MSG_ERROR([--with-macosx-bundle-id-base must have a value]) elif [ ! [[ $with_macosx_bundle_id_base =~ ^[[:print:]]*$ ]] ]; then AC_MSG_ERROR([--with-macosx-bundle-id-base contains non-printing characters: $with_macosx_bundle_id_base]) @@ -542,7 +547,7 @@ AC_DEFUN_ONCE([JDKVER_SETUP_JDK_VERSION_NUMBERS], [Set the MacOSX Bundle CFBundleVersion field. This key is a machine-readable string composed of one to three period-separated integers and should represent the build version. Defaults to the build number.])]) - if test "x$with_macosx_bundle_build_version" = xyes; then + if test "x$with_macosx_bundle_build_version" = xyes || test "x$with_macosx_bundle_build_version" = xno; then AC_MSG_ERROR([--with-macosx-bundle-build-version must have a value]) elif [ ! [[ $with_macosx_bundle_build_version =~ ^[0-9\.]*$ ]] ]; then AC_MSG_ERROR([--with-macosx-bundle-build-version contains non numbers and periods: $with_macosx_bundle_build_version]) -- GitLab From f99193ae3fe8b7bcba34a451890da37cab5ebffb Mon Sep 17 00:00:00 2001 From: Christian Stein Date: Fri, 11 Mar 2022 09:58:22 +0000 Subject: [PATCH 222/340] 8282811: Typo in IAE details message of `RecordedObject.getValueDescriptor` Reviewed-by: egahlin --- src/jdk.jfr/share/classes/jdk/jfr/consumer/RecordedObject.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/jdk.jfr/share/classes/jdk/jfr/consumer/RecordedObject.java b/src/jdk.jfr/share/classes/jdk/jfr/consumer/RecordedObject.java index 9b24844734e..14d5ce4985f 100644 --- a/src/jdk.jfr/share/classes/jdk/jfr/consumer/RecordedObject.java +++ b/src/jdk.jfr/share/classes/jdk/jfr/consumer/RecordedObject.java @@ -329,7 +329,7 @@ public class RecordedObject { return v; } } - throw new IllegalArgumentException("\"Attempt to get unknown field \"" + name + "\""); + throw new IllegalArgumentException("Attempt to get unknown field \"" + name + "\""); } // Gets a value, but checks that type and name is correct first -- GitLab From 95ca94436d12974d98b1b999f9cc8408d64cbe3c Mon Sep 17 00:00:00 2001 From: Mahendra Chhipa Date: Fri, 11 Mar 2022 10:48:57 +0000 Subject: [PATCH 223/340] 8282354: Remove dependancy of TestHttpServer, HttpTransaction, HttpCallback from open/test/jdk/ tests Reviewed-by: dfuchs --- .../net/ProxySelector/LoopbackAddresses.java | 62 +- .../jdk/java/net/ProxySelector/ProxyTest.java | 61 +- test/jdk/java/net/URL/PerConnectionProxy.java | 68 +- test/jdk/java/net/URLConnection/B5052093.java | 67 +- test/jdk/sun/net/www/AuthHeaderTest.java | 134 +-- .../net/www/http/KeepAliveCache/B5045306.java | 80 +- .../net/www/httptest/AbstractCallback.java | 82 -- .../net/www/httptest/ClosedChannelList.java | 77 -- .../sun/net/www/httptest/HttpCallback.java | 39 - .../sun/net/www/httptest/HttpTransaction.java | 330 -------- .../sun/net/www/httptest/TestHttpServer.java | 797 ------------------ .../ssl/InputRecord/ClientHelloRead.java | 20 +- 12 files changed, 306 insertions(+), 1511 deletions(-) delete mode 100644 test/jdk/sun/net/www/httptest/AbstractCallback.java delete mode 100644 test/jdk/sun/net/www/httptest/ClosedChannelList.java delete mode 100644 test/jdk/sun/net/www/httptest/HttpCallback.java delete mode 100644 test/jdk/sun/net/www/httptest/HttpTransaction.java delete mode 100644 test/jdk/sun/net/www/httptest/TestHttpServer.java diff --git a/test/jdk/java/net/ProxySelector/LoopbackAddresses.java b/test/jdk/java/net/ProxySelector/LoopbackAddresses.java index cd5eb919b97..8e27185d518 100644 --- a/test/jdk/java/net/ProxySelector/LoopbackAddresses.java +++ b/test/jdk/java/net/ProxySelector/LoopbackAddresses.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2022, 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 @@ -27,15 +27,25 @@ * @summary PIT: Can no launch jnlp application via 127.0.0.1 address on the web server. * This test might fail intermittently as it needs a server that * binds to the wildcard address. - * @modules java.base/sun.net.www - * @library ../../../sun/net/www/httptest/ /test/lib - * @build ClosedChannelList TestHttpServer HttpTransaction HttpCallback + * @library /test/lib * @compile LoopbackAddresses.java * @run main/othervm LoopbackAddresses */ -import java.net.*; -import java.io.*; +import java.io.IOException; +import java.io.PrintWriter; +import java.net.HttpURLConnection; +import java.net.InetAddress; +import java.net.InetSocketAddress; +import java.net.ServerSocket; +import java.net.Socket; +import java.net.URL; +import java.nio.charset.Charset; +import java.util.concurrent.Executors; + +import com.sun.net.httpserver.HttpExchange; +import com.sun.net.httpserver.HttpHandler; +import com.sun.net.httpserver.HttpServer; import jdk.test.lib.net.URIBuilder; /** @@ -43,17 +53,8 @@ import jdk.test.lib.net.URIBuilder; * addresses when selecting proxies. This is the existing behaviour. */ -public class LoopbackAddresses implements HttpCallback { - static TestHttpServer server; - - public void request (HttpTransaction req) { - req.setResponseEntityBody ("Hello ."); - try { - req.sendResponse (200, "Ok"); - req.orderlyClose(); - } catch (IOException e) { - } - } +public class LoopbackAddresses { + static HttpServer server; public static void main(String[] args) { try { @@ -63,15 +64,17 @@ public class LoopbackAddresses implements HttpCallback { // to answer both for the loopback and "localhost". // Though "localhost" usually point to the loopback there is no // hard guarantee. - server = new TestHttpServer (new LoopbackAddresses(), 1, 10, 0); - ProxyServer pserver = new ProxyServer(InetAddress.getByName("localhost"), server.getLocalPort()); + server = HttpServer.create(new InetSocketAddress(loopback, 0), 10, "/", new LoopbackAddressesHandler()); + server.setExecutor(Executors.newSingleThreadExecutor()); + server.start(); + ProxyServer pserver = new ProxyServer(InetAddress.getByName("localhost"), server.getAddress().getPort()); // start proxy server new Thread(pserver).start(); System.setProperty("http.proxyHost", loopback.getHostAddress()); System.setProperty("http.proxyPort", pserver.getPort()+""); - URL url = new URL("http://localhost:"+server.getLocalPort()); + URL url = new URL("http://localhost:"+server.getAddress().getPort()); try { HttpURLConnection urlc = (HttpURLConnection)url.openConnection (); @@ -85,7 +88,7 @@ public class LoopbackAddresses implements HttpCallback { url = URIBuilder.newBuilder() .scheme("http") .host(loopback.getHostAddress()) - .port(server.getLocalPort()) + .port(server.getAddress().getPort()) .toURL(); HttpURLConnection urlc = (HttpURLConnection)url.openConnection (); int respCode = urlc.getResponseCode(); @@ -97,7 +100,7 @@ public class LoopbackAddresses implements HttpCallback { throw new RuntimeException(e); } finally { if (server != null) { - server.terminate(); + server.stop(1); } } @@ -151,3 +154,18 @@ public class LoopbackAddresses implements HttpCallback { } } } + +class LoopbackAddressesHandler implements HttpHandler { + + @Override + public void handle(HttpExchange exchange) throws IOException { + try { + exchange.sendResponseHeaders(200, 0); + } catch (IOException e) { + e.printStackTrace(); + } + try(PrintWriter pw = new PrintWriter(exchange.getResponseBody(), false, Charset.forName("UTF-8"))) { + pw.print("Hello ."); + } + } +} diff --git a/test/jdk/java/net/ProxySelector/ProxyTest.java b/test/jdk/java/net/ProxySelector/ProxyTest.java index 8debe931469..179cc886c00 100644 --- a/test/jdk/java/net/ProxySelector/ProxyTest.java +++ b/test/jdk/java/net/ProxySelector/ProxyTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2022, 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 @@ -25,33 +25,37 @@ * @test * @bug 4696512 * @summary HTTP client: Improve proxy server configuration and selection - * @modules java.base/sun.net.www - * @library ../../../sun/net/www/httptest/ /test/lib - * @build ClosedChannelList TestHttpServer HttpTransaction HttpCallback + * @library /test/lib * @compile ProxyTest.java * @run main/othervm -Dhttp.proxyHost=inexistant -Dhttp.proxyPort=8080 ProxyTest */ -import java.net.*; -import java.io.*; +import java.io.IOException; +import java.io.InputStream; +import java.io.PrintWriter; +import java.net.HttpURLConnection; +import java.net.InetAddress; +import java.net.InetSocketAddress; +import java.net.Proxy; +import java.net.ProxySelector; +import java.net.SocketAddress; +import java.net.URI; +import java.net.URL; +import java.nio.charset.Charset; import java.util.List; +import java.util.concurrent.Executors; + +import com.sun.net.httpserver.HttpExchange; +import com.sun.net.httpserver.HttpHandler; +import com.sun.net.httpserver.HttpServer; import jdk.test.lib.net.URIBuilder; -public class ProxyTest implements HttpCallback { - static TestHttpServer server; +public class ProxyTest { + static HttpServer server; public ProxyTest() { } - public void request(HttpTransaction req) { - req.setResponseEntityBody("Hello ."); - try { - req.sendResponse(200, "Ok"); - req.orderlyClose(); - } catch (IOException e) { - } - } - static public class MyProxySelector extends ProxySelector { private static volatile URI lastURI; private final static List NO_PROXY = List.of(Proxy.NO_PROXY); @@ -75,11 +79,13 @@ public class ProxyTest implements HttpCallback { ProxySelector.setDefault(new MyProxySelector()); try { InetAddress loopback = InetAddress.getLoopbackAddress(); - server = new TestHttpServer(new ProxyTest(), 1, 10, loopback, 0); + server = HttpServer.create(new InetSocketAddress(loopback, 0), 10, "/", new ProxyTestHandler()); + server.setExecutor(Executors.newSingleThreadExecutor()); + server.start(); URL url = URIBuilder.newBuilder() .scheme("http") .loopback() - .port(server.getLocalPort()) + .port(server.getAddress().getPort()) .toURL(); System.out.println("client opening connection to: " + url); HttpURLConnection urlc = (HttpURLConnection)url.openConnection(); @@ -93,8 +99,23 @@ public class ProxyTest implements HttpCallback { throw new RuntimeException(e); } finally { if (server != null) { - server.terminate(); + server.stop(1); } } } } + +class ProxyTestHandler implements HttpHandler { + + @Override + public void handle(HttpExchange exchange) throws IOException { + try { + exchange.sendResponseHeaders(200, 0); + } catch (IOException e) { + e.printStackTrace(); + } + try(PrintWriter pw = new PrintWriter(exchange.getResponseBody(), false, Charset.forName("UTF-8"))) { + pw.print("Hello ."); + } + } +} diff --git a/test/jdk/java/net/URL/PerConnectionProxy.java b/test/jdk/java/net/URL/PerConnectionProxy.java index 6ce25b9a50e..1877e7cef28 100644 --- a/test/jdk/java/net/URL/PerConnectionProxy.java +++ b/test/jdk/java/net/URL/PerConnectionProxy.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,42 +24,47 @@ /* @test * @bug 4920526 * @summary Needs per connection proxy support for URLs - * @modules java.base/sun.net.www - * @library ../../../sun/net/www/httptest/ /test/lib - * @build ClosedChannelList TestHttpServer HttpTransaction HttpCallback + * @library /test/lib * @compile PerConnectionProxy.java * @run main/othervm -Dhttp.proxyHost=inexistant -Dhttp.proxyPort=8080 PerConnectionProxy */ -import java.net.*; -import java.io.*; - +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.io.PrintWriter; +import java.net.HttpURLConnection; +import java.net.InetAddress; +import java.net.InetSocketAddress; +import java.net.Proxy; +import java.net.ServerSocket; +import java.net.Socket; +import java.net.URL; +import java.nio.charset.Charset; +import java.util.concurrent.Executors; + +import com.sun.net.httpserver.HttpExchange; +import com.sun.net.httpserver.HttpHandler; +import com.sun.net.httpserver.HttpServer; import jdk.test.lib.net.URIBuilder; -public class PerConnectionProxy implements HttpCallback { - static TestHttpServer server; - - public void request (HttpTransaction req) { - req.setResponseEntityBody ("Hello ."); - try { - req.sendResponse (200, "Ok"); - req.orderlyClose(); - } catch (IOException e) { - } - } +public class PerConnectionProxy { + static HttpServer server; public static void main(String[] args) { try { InetAddress loopbackAddress = InetAddress.getLoopbackAddress(); - server = new TestHttpServer(new PerConnectionProxy(), 1, 10, loopbackAddress, 0); - ProxyServer pserver = new ProxyServer(loopbackAddress, server.getLocalPort()); + server = HttpServer.create(new InetSocketAddress(loopbackAddress, 0), 10, "/", new PerConnectionProxyHandler()); + server.setExecutor(Executors.newSingleThreadExecutor()); + server.start(); + ProxyServer pserver = new ProxyServer(loopbackAddress, server.getAddress().getPort()); // start proxy server new Thread(pserver).start(); URL url = URIBuilder.newBuilder() .scheme("http") .loopback() - .port(server.getLocalPort()) + .port(server.getAddress().getPort()) .toURLUnchecked(); // for non existing proxy expect an IOException @@ -73,7 +78,6 @@ public class PerConnectionProxy implements HttpCallback { } catch (IOException ioex) { // expected } - // for NO_PROXY, expect direct connection try { HttpURLConnection urlc = (HttpURLConnection)url.openConnection (Proxy.NO_PROXY); @@ -82,7 +86,6 @@ public class PerConnectionProxy implements HttpCallback { } catch (IOException ioex) { throw new RuntimeException("direct connection should succeed :"+ioex.getMessage()); } - // for a normal proxy setting expect to see connection // goes through that proxy try { @@ -101,10 +104,9 @@ public class PerConnectionProxy implements HttpCallback { throw new RuntimeException(e); } finally { if (server != null) { - server.terminate(); + server.stop(1); } } - } static class ProxyServer extends Thread { @@ -145,7 +147,6 @@ public class PerConnectionProxy implements HttpCallback { private void processRequests() throws Exception { // connection set to the tunneling mode - Socket serverSocket = new Socket(serverInetAddr, serverPort); ProxyTunnel clientToServer = new ProxyTunnel( clientSocket, serverSocket); @@ -161,7 +162,6 @@ public class PerConnectionProxy implements HttpCallback { clientToServer.close(); serverToClient.close(); - } /** @@ -221,6 +221,20 @@ public class PerConnectionProxy implements HttpCallback { } catch (IOException ignored) { } } } + } +} +class PerConnectionProxyHandler implements HttpHandler { + + @Override + public void handle(HttpExchange exchange) throws IOException { + try { + exchange.sendResponseHeaders(200, 0); + } catch (IOException e) { + } + try(PrintWriter pw = new PrintWriter(exchange.getResponseBody(), false, Charset.forName("UTF-8"))) { + pw.print("Hello ."); + } } } + diff --git a/test/jdk/java/net/URLConnection/B5052093.java b/test/jdk/java/net/URLConnection/B5052093.java index f5434f9528b..c93098f2de8 100644 --- a/test/jdk/java/net/URLConnection/B5052093.java +++ b/test/jdk/java/net/URLConnection/B5052093.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2022, 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,21 +23,31 @@ /* * @test + * @modules java.base/sun.net.www.protocol.file * @bug 5052093 - * @modules java.base/sun.net.www java.base/sun.net.www.protocol.file - * @library ../../../sun/net/www/httptest/ - * @build HttpCallback TestHttpServer ClosedChannelList HttpTransaction - * @run main B5052093 + * @library /test/lib + * @run main/othervm B5052093 * @summary URLConnection doesn't support large files */ -import java.net.*; -import java.io.*; -import sun.net.www.protocol.file.FileURLConnection; + +import java.io.File; +import java.io.IOException; +import java.net.InetAddress; +import java.net.InetSocketAddress; +import java.net.URL; +import java.net.URLConnection; +import java.util.concurrent.Executors; + +import com.sun.net.httpserver.HttpExchange; +import com.sun.net.httpserver.HttpHandler; +import com.sun.net.httpserver.HttpServer; import static java.net.Proxy.NO_PROXY; +import jdk.test.lib.net.URIBuilder; +import sun.net.www.protocol.file.FileURLConnection; -public class B5052093 implements HttpCallback { - private static TestHttpServer server; - private static long testSize = ((long) (Integer.MAX_VALUE)) + 2; +public class B5052093 { + private static HttpServer server; + static long testSize = ((long) (Integer.MAX_VALUE)) + 2; public static class LargeFile extends File { public LargeFile() { @@ -55,20 +65,18 @@ public class B5052093 implements HttpCallback { } } - public void request(HttpTransaction req) { - try { - req.setResponseHeader("content-length", Long.toString(testSize)); - req.sendResponse(200, "OK"); - } catch (IOException e) { - e.printStackTrace(); - } - } - public static void main(String[] args) throws Exception { InetAddress loopback = InetAddress.getLoopbackAddress(); - server = new TestHttpServer(new B5052093(), 1, 10, loopback, 0); + server = HttpServer.create(new InetSocketAddress(loopback, 0), 10, "/", new B5052093Handler()); + server.setExecutor(Executors.newSingleThreadExecutor()); + server.start(); try { - URL url = new URL("http://" + server.getAuthority() + "/foo"); + URL url = URIBuilder.newBuilder() + .scheme("http") + .loopback() + .port(server.getAddress().getPort()) + .path("/foo") + .build().toURL(); URLConnection conn = url.openConnection(NO_PROXY); int i = conn.getContentLength(); long l = conn.getContentLengthLong(); @@ -89,7 +97,20 @@ public class B5052093 implements HttpCallback { throw new RuntimeException("Wrong content-length from file"); } } finally { - server.terminate(); + server.stop(1); + } + } +} + +class B5052093Handler implements HttpHandler { + @Override + public void handle(HttpExchange exchange) throws IOException { + try { + exchange.getResponseHeaders().set("content-length", Long.toString(B5052093.testSize)); + exchange.sendResponseHeaders(200, 0); + exchange.close(); + } catch (IOException e) { + e.printStackTrace(); } } } diff --git a/test/jdk/sun/net/www/AuthHeaderTest.java b/test/jdk/sun/net/www/AuthHeaderTest.java index 53852aab8f1..ba1729cb7e6 100644 --- a/test/jdk/sun/net/www/AuthHeaderTest.java +++ b/test/jdk/sun/net/www/AuthHeaderTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,53 +24,31 @@ /** * @test * @bug 4804309 - * @modules java.base/sun.net.www - * @library ../../../sun/net/www/httptest/ - * @build HttpCallback TestHttpServer ClosedChannelList HttpTransaction - * @run main AuthHeaderTest + * @library /test/lib + * @run main/othervm AuthHeaderTest * @summary AuthHeaderTest bug */ -import java.io.*; -import java.net.*; - -public class AuthHeaderTest implements HttpCallback { - - static int count = 0; - static String authstring; - - void errorReply (HttpTransaction req, String reply) throws IOException { - req.addResponseHeader ("Connection", "close"); - req.addResponseHeader ("Www-authenticate", reply); - req.sendResponse (401, "Unauthorized"); - req.orderlyClose(); - } - - void okReply (HttpTransaction req) throws IOException { - req.setResponseEntityBody ("Hello ."); - req.sendResponse (200, "Ok"); - req.orderlyClose(); - } - - public void request (HttpTransaction req) { - try { - authstring = req.getRequestHeader ("Authorization"); - System.out.println (authstring); - switch (count) { - case 0: - errorReply (req, "Basic realm=\"wallyworld\""); - break; - case 1: - /* client stores a username/pw for wallyworld - */ - okReply (req); - break; - } - count ++; - } catch (IOException e) { - e.printStackTrace(); - } - } +import java.io.IOException; +import java.io.InputStream; +import java.io.PrintWriter; +import java.net.Authenticator; +import java.net.InetAddress; +import java.net.InetSocketAddress; +import java.net.PasswordAuthentication; +import java.net.Proxy; +import java.net.URL; +import java.net.URLConnection; +import java.nio.charset.Charset; +import java.util.concurrent.Executors; + +import com.sun.net.httpserver.HttpExchange; +import com.sun.net.httpserver.HttpHandler; +import com.sun.net.httpserver.HttpServer; +import jdk.test.lib.net.URIBuilder; + +public class AuthHeaderTest { + static HttpServer server; static void read (InputStream is) throws IOException { int c; @@ -91,19 +69,27 @@ public class AuthHeaderTest implements HttpCallback { is.close(); } - static TestHttpServer server; - public static void main (String[] args) throws Exception { MyAuthenticator auth = new MyAuthenticator (); Authenticator.setDefault (auth); InetAddress loopback = InetAddress.getLoopbackAddress(); try { - server = new TestHttpServer (new AuthHeaderTest(), 1, 10, loopback, 0); - System.out.println ("Server: listening on port: " + server.getAuthority()); - client ("http://" + server.getAuthority() + "/d1/foo.html"); + server = HttpServer.create(new InetSocketAddress(loopback, 0), 10, "/", new AuthHeaderTestHandler()); + server.setExecutor(Executors.newSingleThreadExecutor()); + server.start(); + System.out.println ("Server: listening on port: " + server.getAddress().getPort()); + + String serverURL = URIBuilder.newBuilder() + .scheme("http") + .loopback() + .port(server.getAddress().getPort()) + .path("/") + .build() + .toString(); + client (serverURL + "d1/foo.html"); } catch (Exception e) { if (server != null) { - server.terminate(); + server.stop(1); } throw e; } @@ -111,11 +97,11 @@ public class AuthHeaderTest implements HttpCallback { if (f != 1) { except ("Authenticator was called "+f+" times. Should be 1"); } - server.terminate(); + server.stop(1); } public static void except (String s) { - server.terminate(); + server.stop(1); throw new RuntimeException (s); } @@ -138,3 +124,45 @@ public class AuthHeaderTest implements HttpCallback { } } } + +class AuthHeaderTestHandler implements HttpHandler { + static int count = 0; + static String authstring; + + void errorReply (HttpExchange req, String reply) throws IOException { + req.getResponseHeaders().set("Connection", "close"); + req.getResponseHeaders().set("Www-authenticate", reply); + req.sendResponseHeaders(401, -1); + } + + void okReply (HttpExchange req) throws IOException { + req.sendResponseHeaders (200, 0); + try(PrintWriter pw = new PrintWriter(req.getResponseBody(), false, Charset.forName("UTF-8"))) { + pw.print("Hello ."); + } + } + + @Override + public void handle(HttpExchange exchange) throws IOException { + try { + if(exchange.getRequestHeaders().get("Authorization") != null) { + authstring = exchange.getRequestHeaders().get("Authorization").get(0); + System.out.println (authstring); + } + + switch (count) { + case 0: + errorReply (exchange, "Basic realm=\"wallyworld\""); + break; + case 1: + /* client stores a username/pw for wallyworld + */ + okReply (exchange); + break; + } + count ++; + } catch (IOException e) { + e.printStackTrace(); + } + } +} \ No newline at end of file diff --git a/test/jdk/sun/net/www/http/KeepAliveCache/B5045306.java b/test/jdk/sun/net/www/http/KeepAliveCache/B5045306.java index d624741bc2c..ebfb550b826 100644 --- a/test/jdk/sun/net/www/http/KeepAliveCache/B5045306.java +++ b/test/jdk/sun/net/www/http/KeepAliveCache/B5045306.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,19 +24,30 @@ /* * @test * @bug 5045306 6356004 6993490 8255124 - * @modules java.base/sun.net.www - * java.management - * @library ../../httptest/ - * @build HttpCallback TestHttpServer HttpTransaction + * @library /test/lib * @run main/othervm B5045306 * @summary Http keep-alive implementation is not efficient */ -import java.net.*; -import java.io.*; -import java.lang.management.*; +import java.io.IOException; +import java.io.InputStream; +import java.io.PrintWriter; +import java.lang.management.ManagementFactory; +import java.lang.management.ThreadInfo; +import java.lang.management.ThreadMXBean; +import java.net.HttpURLConnection; +import java.net.InetAddress; +import java.net.InetSocketAddress; +import java.net.Proxy; +import java.net.URL; +import java.nio.charset.Charset; import java.util.ArrayList; import java.util.List; +import java.util.concurrent.Executors; + +import com.sun.net.httpserver.HttpExchange; +import com.sun.net.httpserver.HttpHandler; +import com.sun.net.httpserver.HttpServer; /* Part 1: * The http client makes a connection to a URL whos content contains a lot of @@ -51,20 +62,19 @@ import java.util.List; * Content-length header. */ -public class B5045306 -{ - static SimpleHttpTransaction httpTrans; - static TestHttpServer server; +public class B5045306 { + static HttpServer server; - public static void main(String[] args) throws Exception { + public static void main(String[] args) { startHttpServer(); clientHttpCalls(); } public static void startHttpServer() { try { - httpTrans = new SimpleHttpTransaction(); - server = new TestHttpServer(httpTrans, 1, 10, InetAddress.getLocalHost(), 0); + server = HttpServer.create(new InetSocketAddress(InetAddress.getLocalHost(), 0), 10, "/", new SimpleHttpTransactionHandler()); + server.setExecutor(Executors.newSingleThreadExecutor()); + server.start(); } catch (IOException e) { e.printStackTrace(); } @@ -76,10 +86,10 @@ public class B5045306 uncaught.add(ex); }); try { - System.out.println("http server listen on: " + server.getLocalPort()); + System.out.println("http server listen on: " + server.getAddress().getPort()); String hostAddr = InetAddress.getLocalHost().getHostAddress(); if (hostAddr.indexOf(':') > -1) hostAddr = "[" + hostAddr + "]"; - String baseURLStr = "http://" + hostAddr + ":" + server.getLocalPort() + "/"; + String baseURLStr = "http://" + hostAddr + ":" + server.getAddress().getPort() + "/"; URL bigDataURL = new URL (baseURLStr + "firstCall"); URL smallDataURL = new URL (baseURLStr + "secondCall"); @@ -98,7 +108,7 @@ public class B5045306 uc = (HttpURLConnection)smallDataURL.openConnection(Proxy.NO_PROXY); uc.getResponseCode(); - if (SimpleHttpTransaction.failed) + if (SimpleHttpTransactionHandler.failed) throw new RuntimeException("Failed: Initial Keep Alive Connection is not being reused"); // Part 2 @@ -137,7 +147,7 @@ public class B5045306 } catch (IOException e) { e.printStackTrace(); } finally { - server.terminate(); + server.stop(1); } if (!uncaught.isEmpty()) { throw new RuntimeException("Unhandled exception:", uncaught.get(0)); @@ -145,9 +155,9 @@ public class B5045306 } } -class SimpleHttpTransaction implements HttpCallback +class SimpleHttpTransactionHandler implements HttpHandler { - static boolean failed = false; + static volatile boolean failed = false; // Need to have enough data here that is too large for the socket buffer to hold. // Also http.KeepAlive.remainingData must be greater than this value, default is 256K. @@ -155,48 +165,46 @@ class SimpleHttpTransaction implements HttpCallback int port1; - public void request(HttpTransaction trans) { + public void handle(HttpExchange trans) { try { String path = trans.getRequestURI().getPath(); if (path.equals("/firstCall")) { - port1 = trans.channel().socket().getPort(); + port1 = trans.getLocalAddress().getPort(); System.out.println("First connection on client port = " + port1); byte[] responseBody = new byte[RESPONSE_DATA_LENGTH]; for (int i=0; i - * The incoming request fields can be examined via the {@link HttpTransaction} - * object, and a response can also be generated and sent via the request object. - */ -public interface HttpCallback { - /** - * handle the given request and generate an appropriate response. - * @param msg the transaction containing the request from the - * client and used to send the response - */ - void request (HttpTransaction msg); -} diff --git a/test/jdk/sun/net/www/httptest/HttpTransaction.java b/test/jdk/sun/net/www/httptest/HttpTransaction.java deleted file mode 100644 index 781aacaff5b..00000000000 --- a/test/jdk/sun/net/www/httptest/HttpTransaction.java +++ /dev/null @@ -1,330 +0,0 @@ -/* - * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -import java.io.*; -import java.nio.*; -import java.nio.channels.*; -import java.net.*; -import sun.net.www.MessageHeader; - -/** - * This class encapsulates a HTTP request received and a response to be - * generated in one transaction. It provides methods for examaining the - * request from the client, and for building and sending a reply. - */ - -public class HttpTransaction { - - String command; - URI requesturi; - TestHttpServer.Server server; - MessageHeader reqheaders, reqtrailers; - String reqbody; - byte[] rspbody; - MessageHeader rspheaders, rsptrailers; - SelectionKey key; - int rspbodylen; - boolean rspchunked; - - HttpTransaction (TestHttpServer.Server server, String command, - URI requesturi, MessageHeader headers, - String body, MessageHeader trailers, SelectionKey key) { - this.command = command; - this.requesturi = requesturi; - this.reqheaders = headers; - this.reqbody = body; - this.reqtrailers = trailers; - this.key = key; - this.server = server; - } - - /** - * Get the value of a request header whose name is specified by the - * String argument. - * - * @param key the name of the request header - * @return the value of the header or null if it does not exist - */ - public String getRequestHeader (String key) { - return reqheaders.findValue (key); - } - - /** - * Get the value of a response header whose name is specified by the - * String argument. - * - * @param key the name of the response header - * @return the value of the header or null if it does not exist - */ - public String getResponseHeader (String key) { - return rspheaders.findValue (key); - } - - /** - * Get the request URI - * - * @return the request URI - */ - public URI getRequestURI () { - return requesturi; - } - - public String toString () { - StringBuffer buf = new StringBuffer(); - buf.append ("Request from: ").append (key.channel().toString()).append("\r\n"); - buf.append ("Command: ").append (command).append("\r\n"); - buf.append ("Request URI: ").append (requesturi).append("\r\n"); - buf.append ("Headers: ").append("\r\n"); - buf.append (reqheaders.toString()).append("\r\n"); - buf.append ("Body: ").append (reqbody).append("\r\n"); - buf.append ("---------Response-------\r\n"); - buf.append ("Headers: ").append("\r\n"); - if (rspheaders != null) { - buf.append (rspheaders.toString()).append("\r\n"); - } - String rbody = rspbody == null? "": new String (rspbody); - buf.append ("Body: ").append (rbody).append("\r\n"); - return new String (buf); - } - - /** - * Get the value of a request trailer whose name is specified by - * the String argument. - * - * @param key the name of the request trailer - * @return the value of the trailer or null if it does not exist - */ - public String getRequestTrailer (String key) { - return reqtrailers.findValue (key); - } - - /** - * Add a response header to the response. Multiple calls with the same - * key value result in multiple header lines with the same key identifier - * @param key the name of the request header to add - * @param val the value of the header - */ - public void addResponseHeader (String key, String val) { - if (rspheaders == null) - rspheaders = new MessageHeader (); - rspheaders.add (key, val); - } - - /** - * Set a response header. Searches for first header with named key - * and replaces its value with val - * @param key the name of the request header to add - * @param val the value of the header - */ - public void setResponseHeader (String key, String val) { - if (rspheaders == null) - rspheaders = new MessageHeader (); - rspheaders.set (key, val); - } - - /** - * Add a response trailer to the response. Multiple calls with the same - * key value result in multiple trailer lines with the same key identifier - * @param key the name of the request trailer to add - * @param val the value of the trailer - */ - public void addResponseTrailer (String key, String val) { - if (rsptrailers == null) - rsptrailers = new MessageHeader (); - rsptrailers.add (key, val); - } - - /** - * Get the request method - * - * @return the request method - */ - public String getRequestMethod (){ - return command; - } - - /** - * Perform an orderly close of the TCP connection associated with this - * request. This method guarantees that any response already sent will - * not be reset (by this end). The implementation does a shutdownOutput() - * of the TCP connection and for a period of time consumes and discards - * data received on the reading side of the connection. This happens - * in the background. After the period has expired the - * connection is completely closed. - */ - - public void orderlyClose () { - try { - server.orderlyCloseChannel (key); - } catch (IOException e) { - System.out.println (e); - } - } - - /** - * Do an immediate abortive close of the TCP connection associated - * with this request. - */ - public void abortiveClose () { - try { - server.abortiveCloseChannel(key); - } catch (IOException e) { - System.out.println (e); - } - } - - /** - * Get the SocketChannel associated with this request - * - * @return the socket channel - */ - public SocketChannel channel() { - return (SocketChannel) key.channel(); - } - - /** - * Get the request entity body associated with this request - * as a single String. - * - * @return the entity body in one String - */ - public String getRequestEntityBody (){ - return reqbody; - } - - /** - * Set the entity response body with the given string - * The content length is set to the length of the string - * @param body the string to send in the response - */ - public void setResponseEntityBody (String body){ - rspbody = body.getBytes(); - rspbodylen = body.length(); - rspchunked = false; - addResponseHeader ("Content-length", Integer.toString (rspbodylen)); - } - /** - * Set the entity response body with the given byte[] - * The content length is set to the gven length - * @param body the string to send in the response - */ - public void setResponseEntityBody (byte[] body, int len){ - rspbody = body; - rspbodylen = len; - rspchunked = false; - addResponseHeader ("Content-length", Integer.toString (rspbodylen)); - } - - - /** - * Set the entity response body by reading the given inputstream - * - * @param is the inputstream from which to read the body - */ - public void setResponseEntityBody (InputStream is) throws IOException { - byte[] buf = new byte [2048]; - byte[] total = new byte [2048]; - int total_len = 2048; - int c, len=0; - while ((c=is.read (buf)) != -1) { - if (len+c > total_len) { - byte[] total1 = new byte [total_len * 2]; - System.arraycopy (total, 0, total1, 0, len); - total = total1; - total_len = total_len * 2; - } - System.arraycopy (buf, 0, total, len, c); - len += c; - } - setResponseEntityBody (total, len); - } - - /* chunked */ - - /** - * Set the entity response body with the given array of strings - * The content encoding is set to "chunked" and each array element - * is sent as one chunk. - * @param body the array of string chunks to send in the response - */ - public void setResponseEntityBody (String[] body) { - StringBuffer buf = new StringBuffer (); - int len = 0; - for (int i=0; i - * It must be instantiated with a {@link HttpCallback} object to which - * requests are given and must be handled. - *

    - * Simple synchronization between the client(s) and server can be done - * using the {@link #waitForCondition(String)}, {@link #setCondition(String)} and - * {@link #rendezvous(String,int)} methods. - * - * NOTE NOTE NOTE NOTE NOTE NOTE NOTE - * - * If changes are made here, please sure they are propagated to - * the HTTPS equivalent in the JSSE regression test suite. - * - * NOTE NOTE NOTE NOTE NOTE NOTE NOTE - */ - -public class TestHttpServer { - - ServerSocketChannel schan; - int threads; - int cperthread; - HttpCallback cb; - Server[] servers; - - /** - * Create a TestHttpServer instance with the specified callback object - * for handling requests. One thread is created to handle requests, - * and up to ten TCP connections will be handled simultaneously. - * @param cb the callback object which is invoked to handle each - * incoming request - */ - - public TestHttpServer (HttpCallback cb) throws IOException { - this (cb, 1, 10, 0); - } - - /** - * Create a TestHttpServer instance with the specified callback object - * for handling requests. One thread is created to handle requests, - * and up to ten TCP connections will be handled simultaneously. - * @param cb the callback object which is invoked to handle each - * incoming request - * @param address the address to bind the server to. Null - * means bind to the wildcard address. - * @param port the port number to bind the server to. Zero - * means choose any free port. - */ - - public TestHttpServer (HttpCallback cb, InetAddress address, int port) throws IOException { - this (cb, 1, 10, address, 0); - } - - /** - * Create a TestHttpServer instance with the specified number of - * threads and maximum number of connections per thread. This functions - * the same as the 4 arg constructor, where the port argument is set to zero. - * @param cb the callback object which is invoked to handle each - * incoming request - * @param threads the number of threads to create to handle requests - * in parallel - * @param cperthread the number of simultaneous TCP connections to - * handle per thread - */ - - public TestHttpServer (HttpCallback cb, int threads, int cperthread) - throws IOException { - this (cb, threads, cperthread, 0); - } - - /** - * Create a TestHttpServer instance with the specified number - * of threads and maximum number of connections per thread and running on - * the specified port. The specified number of threads are created to - * handle incoming requests, and each thread is allowed - * to handle a number of simultaneous TCP connections. - * @param cb the callback object which is invoked to handle - * each incoming request - * @param threads the number of threads to create to handle - * requests in parallel - * @param cperthread the number of simultaneous TCP connections - * to handle per thread - * @param port the port number to bind the server to. Zero - * means choose any free port. - */ - - public TestHttpServer (HttpCallback cb, int threads, int cperthread, int port) - throws IOException { - this(cb, threads, cperthread, null, port); - } - - /** - * Create a TestHttpServer instance with the specified number - * of threads and maximum number of connections per thread and running on - * the specified port. The specified number of threads are created to - * handle incoming requests, and each thread is allowed - * to handle a number of simultaneous TCP connections. - * @param cb the callback object which is invoked to handle - * each incoming request - * @param threads the number of threads to create to handle - * requests in parallel - * @param cperthread the number of simultaneous TCP connections - * to handle per thread - * @param address the address to bind the server to. Null - * means bind to the wildcard address. - * @param port the port number to bind the server to. Zero - * means choose any free port. - */ - - public TestHttpServer (HttpCallback cb, int threads, int cperthread, - InetAddress address, int port) - throws IOException { - schan = ServerSocketChannel.open (); - InetSocketAddress addr = new InetSocketAddress (address, port); - schan.socket().bind (addr); - this.threads = threads; - this.cb = cb; - this.cperthread = cperthread; - servers = new Server [threads]; - for (int i=0; i -1) hostaddr = "[" + hostaddr + "]"; - return hostaddr + ":" + getLocalPort(); - } - - static class Server extends Thread { - - ServerSocketChannel schan; - Selector selector; - SelectionKey listenerKey; - SelectionKey key; /* the current key being processed */ - HttpCallback cb; - ByteBuffer consumeBuffer; - int maxconn; - int nconn; - ClosedChannelList clist; - volatile boolean shutdown; - - Server (HttpCallback cb, ServerSocketChannel schan, int maxconn) { - this.schan = schan; - this.maxconn = maxconn; - this.cb = cb; - nconn = 0; - consumeBuffer = ByteBuffer.allocate (512); - clist = new ClosedChannelList (); - try { - selector = Selector.open (); - schan.configureBlocking (false); - listenerKey = schan.register (selector, SelectionKey.OP_ACCEPT); - } catch (IOException e) { - System.err.println ("Server could not start: " + e); - throw new RuntimeException("Server could not start: " + e, e); - } - } - - /* Stop the thread as soon as possible */ - public void terminate () { - shutdown = true; - } - - public void run () { - try { - while (true) { - selector.select(1000); - Set selected = selector.selectedKeys(); - Iterator iter = selected.iterator(); - while (iter.hasNext()) { - key = iter.next(); - if (key.equals (listenerKey)) { - SocketChannel sock = schan.accept (); - if (sock == null) { - /* false notification */ - iter.remove(); - continue; - } - sock.configureBlocking (false); - sock.register (selector, SelectionKey.OP_READ); - nconn ++; - System.out.println("SERVER: new connection. chan[" + sock + "]"); - if (nconn == maxconn) { - /* deregister */ - listenerKey.cancel (); - listenerKey = null; - } - } else { - if (key.isReadable()) { - boolean closed; - SocketChannel chan = (SocketChannel) key.channel(); - System.out.println("SERVER: connection readable. chan[" + chan + "]"); - if (key.attachment() != null) { - System.out.println("Server: consume"); - closed = consume (chan); - } else { - closed = read (chan, key); - } - if (closed) { - chan.close (); - key.cancel (); - if (nconn == maxconn) { - listenerKey = schan.register (selector, SelectionKey.OP_ACCEPT); - } - nconn --; - } - } - } - iter.remove(); - } - clist.check(); - if (shutdown) { - System.out.println("Force to Shutdown"); - SelectionKey sKey = schan.keyFor(selector); - if (sKey != null) { - sKey.cancel(); - } - - clist.terminate (); - selector.close(); - schan.socket().close(); - schan.close(); - return; - } - } - } catch (IOException e) { - System.out.println ("Server exception: " + e); - // TODO finish - } - } - - /* read all the data off the channel without looking at it - * return true if connection closed - */ - boolean consume (SocketChannel chan) { - try { - consumeBuffer.clear (); - int c = chan.read (consumeBuffer); - if (c == -1) - return true; - } catch (IOException e) { - return true; - } - return false; - } - - /* return true if the connection is closed, false otherwise */ - - private boolean read (SocketChannel chan, SelectionKey key) { - HttpTransaction msg; - boolean res; - try { - InputStream is = new BufferedInputStream (new NioInputStream (chan)); - String requestline = readLine (is); - MessageHeader mhead = new MessageHeader (is); - String clen = mhead.findValue ("Content-Length"); - String trferenc = mhead.findValue ("Transfer-Encoding"); - String data = null; - if (trferenc != null && trferenc.equals ("chunked")) - data = new String (readChunkedData (is)); - else if (clen != null) - data = new String (readNormalData (is, Integer.parseInt (clen))); - String[] req = requestline.split (" "); - if (req.length < 2) { - /* invalid request line */ - return false; - } - String cmd = req[0]; - URI uri = null; - try { - uri = new URI (req[1]); - msg = new HttpTransaction (this, cmd, uri, mhead, data, null, key); - cb.request (msg); - } catch (URISyntaxException e) { - System.err.println ("Invalid URI: " + e); - msg = new HttpTransaction (this, cmd, null, null, null, null, key); - msg.sendResponse (501, "Whatever"); - } - res = false; - } catch (IOException e) { - res = true; - } - return res; - } - - byte[] readNormalData (InputStream is, int len) throws IOException { - byte [] buf = new byte [len]; - int c, off=0, remain=len; - while (remain > 0 && ((c=is.read (buf, off, remain))>0)) { - remain -= c; - off += c; - } - return buf; - } - - private void readCRLF(InputStream is) throws IOException { - int cr = is.read(); - int lf = is.read(); - - if (((cr & 0xff) != 0x0d) || - ((lf & 0xff) != 0x0a)) { - throw new IOException( - "Expected : got '" + cr + "/" + lf + "'"); - } - } - - byte[] readChunkedData (InputStream is) throws IOException { - LinkedList l = new LinkedList (); - int total = 0; - for (int len=readChunkLen(is); len!=0; len=readChunkLen(is)) { - l.add (readNormalData(is, len)); - total += len; - readCRLF(is); // CRLF at end of chunk - } - readCRLF(is); // CRLF at end of Chunked Stream. - byte[] buf = new byte [total]; - Iterator i = l.iterator(); - int x = 0; - while (i.hasNext()) { - byte[] b = (byte[])i.next(); - System.arraycopy (b, 0, buf, x, b.length); - x += b.length; - } - return buf; - } - - private int readChunkLen (InputStream is) throws IOException { - int c, len=0; - boolean done=false, readCR=false; - while (!done) { - c = is.read (); - if (c == '\n' && readCR) { - done = true; - } else { - if (c == '\r' && !readCR) { - readCR = true; - } else { - int x=0; - if (c >= 'a' && c <= 'f') { - x = c - 'a' + 10; - } else if (c >= 'A' && c <= 'F') { - x = c - 'A' + 10; - } else if (c >= '0' && c <= '9') { - x = c - '0'; - } - len = len * 16 + x; - } - } - } - return len; - } - - private String readLine (InputStream is) throws IOException { - boolean done=false, readCR=false; - byte[] b = new byte [512]; - int c, l = 0; - - while (!done) { - c = is.read (); - if (c == '\n' && readCR) { - done = true; - } else { - if (c == '\r' && !readCR) { - readCR = true; - } else { - b[l++] = (byte)c; - } - } - } - return new String (b); - } - - /** close the channel associated with the current key by: - * 1. shutdownOutput (send a FIN) - * 2. mark the key so that incoming data is to be consumed and discarded - * 3. After a period, close the socket - */ - - synchronized void orderlyCloseChannel (SelectionKey key) throws IOException { - SocketChannel ch = (SocketChannel)key.channel (); - System.out.println("SERVER: orderlyCloseChannel chan[" + ch + "]"); - ch.socket().shutdownOutput(); - key.attach (this); - clist.add (key); - } - - synchronized void abortiveCloseChannel (SelectionKey key) throws IOException { - SocketChannel ch = (SocketChannel)key.channel (); - System.out.println("SERVER: abortiveCloseChannel chan[" + ch + "]"); - - Socket s = ch.socket (); - s.setSoLinger (true, 0); - ch.close(); - } - } - - - /** - * Implements blocking reading semantics on top of a non-blocking channel - */ - - static class NioInputStream extends InputStream { - SocketChannel channel; - Selector selector; - ByteBuffer chanbuf; - SelectionKey key; - int available; - byte[] one; - boolean closed; - ByteBuffer markBuf; /* reads may be satisifed from this buffer */ - boolean marked; - boolean reset; - int readlimit; - - public NioInputStream (SocketChannel chan) throws IOException { - this.channel = chan; - selector = Selector.open(); - chanbuf = ByteBuffer.allocate (1024); - key = chan.register (selector, SelectionKey.OP_READ); - available = 0; - one = new byte[1]; - closed = marked = reset = false; - } - - public synchronized int read (byte[] b) throws IOException { - return read (b, 0, b.length); - } - - public synchronized int read () throws IOException { - return read (one, 0, 1); - } - - public synchronized int read (byte[] b, int off, int srclen) throws IOException { - - int canreturn, willreturn; - - if (closed) - return -1; - - if (reset) { /* satisfy from markBuf */ - canreturn = markBuf.remaining (); - willreturn = canreturn>srclen ? srclen : canreturn; - markBuf.get(b, off, willreturn); - if (canreturn == willreturn) { - reset = false; - } - } else { /* satisfy from channel */ - canreturn = available(); - if (canreturn == 0) { - block (); - canreturn = available(); - } - willreturn = canreturn>srclen ? srclen : canreturn; - chanbuf.get(b, off, willreturn); - available -= willreturn; - - if (marked) { /* copy into markBuf */ - try { - markBuf.put (b, off, willreturn); - } catch (BufferOverflowException e) { - marked = false; - } - } - } - return willreturn; - } - - public synchronized int available () throws IOException { - if (closed) - throw new IOException ("Stream is closed"); - - if (reset) - return markBuf.remaining(); - - if (available > 0) - return available; - - chanbuf.clear (); - available = channel.read (chanbuf); - if (available > 0) - chanbuf.flip(); - else if (available == -1) - throw new IOException ("Stream is closed"); - return available; - } - - /** - * block() only called when available==0 and buf is empty - */ - private synchronized void block () throws IOException { - //assert available == 0; - int n = selector.select (); - //assert n == 1; - selector.selectedKeys().clear(); - available (); - } - - public void close () throws IOException { - if (closed) - return; - channel.close (); - closed = true; - } - - public synchronized void mark (int readlimit) { - if (closed) - return; - this.readlimit = readlimit; - markBuf = ByteBuffer.allocate (readlimit); - marked = true; - reset = false; - } - - public synchronized void reset () throws IOException { - if (closed ) - return; - if (!marked) - throw new IOException ("Stream not marked"); - marked = false; - reset = true; - markBuf.flip (); - } - } - - static class NioOutputStream extends OutputStream { - SocketChannel channel; - ByteBuffer buf; - SelectionKey key; - Selector selector; - boolean closed; - byte[] one; - - public NioOutputStream (SocketChannel channel) throws IOException { - this.channel = channel; - selector = Selector.open (); - key = channel.register (selector, SelectionKey.OP_WRITE); - closed = false; - one = new byte [1]; - } - - public synchronized void write (int b) throws IOException { - one[0] = (byte)b; - write (one, 0, 1); - } - - public synchronized void write (byte[] b) throws IOException { - write (b, 0, b.length); - } - - public synchronized void write (byte[] b, int off, int len) throws IOException { - if (closed) - throw new IOException ("stream is closed"); - - buf = ByteBuffer.allocate (len); - buf.put (b, off, len); - buf.flip (); - int n; - while ((n = channel.write (buf)) < len) { - len -= n; - if (len == 0) - return; - selector.select (); - selector.selectedKeys().clear (); - } - } - - public void close () throws IOException { - if (closed) - return; - channel.close (); - closed = true; - } - } - - /** - * Utilities for synchronization. A condition is - * identified by a string name, and is initialized - * upon first use (ie. setCondition() or waitForCondition()). Threads - * are blocked until some thread calls (or has called) setCondition() for the same - * condition. - *

    - * A rendezvous built on a condition is also provided for synchronizing - * N threads. - */ - - private static HashMap conditions = new HashMap(); - - /* - * Modifiable boolean object - */ - private static class BValue { - boolean v; - } - - /* - * Modifiable int object - */ - private static class IValue { - int v; - IValue (int i) { - v =i; - } - } - - - private static BValue getCond (String condition) { - synchronized (conditions) { - BValue cond = (BValue) conditions.get (condition); - if (cond == null) { - cond = new BValue(); - conditions.put (condition, cond); - } - return cond; - } - } - - /** - * Set the condition to true. Any threads that are currently blocked - * waiting on the condition, will be unblocked and allowed to continue. - * Threads that subsequently call waitForCondition() will not block. - * If the named condition did not exist prior to the call, then it is created - * first. - */ - - public static void setCondition (String condition) { - BValue cond = getCond (condition); - synchronized (cond) { - if (cond.v) { - return; - } - cond.v = true; - cond.notifyAll(); - } - } - - /** - * If the named condition does not exist, then it is created and initialized - * to false. If the condition exists or has just been created and its value - * is false, then the thread blocks until another thread sets the condition. - * If the condition exists and is already set to true, then this call returns - * immediately without blocking. - */ - - public static void waitForCondition (String condition) { - BValue cond = getCond (condition); - synchronized (cond) { - if (!cond.v) { - try { - cond.wait(); - } catch (InterruptedException e) {} - } - } - } - - /* conditions must be locked when accessing this */ - static HashMap rv = new HashMap(); - - /** - * Force N threads to rendezvous (ie. wait for each other) before proceeding. - * The first thread(s) to call are blocked until the last - * thread makes the call. Then all threads continue. - *

    - * All threads that call with the same condition name, must use the same value - * for N (or the results may be not be as expected). - *

    - * Obviously, if fewer than N threads make the rendezvous then the result - * will be a hang. - */ - - public static void rendezvous (String condition, int N) { - BValue cond; - IValue iv; - String name = "RV_"+condition; - - /* get the condition */ - - synchronized (conditions) { - cond = (BValue)conditions.get (name); - if (cond == null) { - /* we are first caller */ - if (N < 2) { - throw new RuntimeException ("rendezvous must be called with N >= 2"); - } - cond = new BValue (); - conditions.put (name, cond); - iv = new IValue (N-1); - rv.put (name, iv); - } else { - /* already initialised, just decrement the counter */ - iv = (IValue) rv.get (name); - iv.v --; - } - } - - if (iv.v > 0) { - waitForCondition (name); - } else { - setCondition (name); - synchronized (conditions) { - clearCondition (name); - rv.remove (name); - } - } - } - - /** - * If the named condition exists and is set then remove it, so it can - * be re-initialized and used again. If the condition does not exist, or - * exists but is not set, then the call returns without doing anything. - * Note, some higher level synchronization - * may be needed between clear and the other operations. - */ - - public static void clearCondition(String condition) { - BValue cond; - synchronized (conditions) { - cond = (BValue) conditions.get (condition); - if (cond == null) { - return; - } - synchronized (cond) { - if (cond.v) { - conditions.remove (condition); - } - } - } - } -} diff --git a/test/jdk/sun/security/ssl/InputRecord/ClientHelloRead.java b/test/jdk/sun/security/ssl/InputRecord/ClientHelloRead.java index e08230f325d..06cba109139 100644 --- a/test/jdk/sun/security/ssl/InputRecord/ClientHelloRead.java +++ b/test/jdk/sun/security/ssl/InputRecord/ClientHelloRead.java @@ -32,12 +32,22 @@ * system properties in samevm/agentvm mode. */ -import java.io.*; -import java.net.*; +import java.io.BufferedReader; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStreamReader; +import java.net.ServerSocket; +import java.net.URL; import java.security.KeyStore; -import javax.net.*; -import javax.net.ssl.*; -import java.security.cert.*; + +import javax.net.ServerSocketFactory; +import javax.net.ssl.HostnameVerifier; +import javax.net.ssl.HttpsURLConnection; +import javax.net.ssl.KeyManagerFactory; +import javax.net.ssl.SSLContext; +import javax.net.ssl.SSLException; +import javax.net.ssl.SSLServerSocketFactory; +import javax.net.ssl.SSLSession; /* * ClientHelloRead.java -- includes a simple server that can serve -- GitLab From 0fd09d383b9921f26d2d609ab330630a4520325a Mon Sep 17 00:00:00 2001 From: Zhengyu Gu Date: Fri, 11 Mar 2022 13:25:09 +0000 Subject: [PATCH 224/340] 8282978: Wrong parameter passed to GetStringXXXChars in various places Reviewed-by: alanb, dfuchs --- src/java.base/unix/native/libnet/Inet4AddressImpl.c | 4 ++-- src/java.base/unix/native/libnet/Inet6AddressImpl.c | 4 ++-- src/java.base/windows/native/libnet/Inet4AddressImpl.c | 4 ++-- src/java.base/windows/native/libnet/Inet6AddressImpl.c | 4 ++-- src/java.desktop/unix/native/libawt_xawt/xawt/XlibWrapper.c | 4 ++-- .../windows/native/libawt/windows/awt_Button.cpp | 6 +++--- .../windows/native/libawt/windows/awt_Checkbox.cpp | 6 +++--- .../windows/native/libawt/windows/awt_Desktop.cpp | 6 +++--- .../windows/native/libawt/windows/awt_Win32GraphicsEnv.cpp | 6 +++--- 9 files changed, 22 insertions(+), 22 deletions(-) diff --git a/src/java.base/unix/native/libnet/Inet4AddressImpl.c b/src/java.base/unix/native/libnet/Inet4AddressImpl.c index bc6c859b841..0edebdbb3ba 100644 --- a/src/java.base/unix/native/libnet/Inet4AddressImpl.c +++ b/src/java.base/unix/native/libnet/Inet4AddressImpl.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2022, 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 @@ -100,7 +100,7 @@ Java_java_net_Inet4AddressImpl_lookupAllHostAddr(JNIEnv *env, jobject this, JNU_ThrowNullPointerException(env, "host argument is null"); return NULL; } - hostname = JNU_GetStringPlatformChars(env, host, JNI_FALSE); + hostname = JNU_GetStringPlatformChars(env, host, NULL); CHECK_NULL_RETURN(hostname, NULL); // try once, with our static buffer diff --git a/src/java.base/unix/native/libnet/Inet6AddressImpl.c b/src/java.base/unix/native/libnet/Inet6AddressImpl.c index ed0ddbb562c..331151faeb5 100644 --- a/src/java.base/unix/native/libnet/Inet6AddressImpl.c +++ b/src/java.base/unix/native/libnet/Inet6AddressImpl.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2022, 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 @@ -220,7 +220,7 @@ Java_java_net_Inet6AddressImpl_lookupAllHostAddr(JNIEnv *env, jobject this, JNU_ThrowNullPointerException(env, "host argument is null"); return NULL; } - hostname = JNU_GetStringPlatformChars(env, host, JNI_FALSE); + hostname = JNU_GetStringPlatformChars(env, host, NULL); CHECK_NULL_RETURN(hostname, NULL); // try once, with our static buffer diff --git a/src/java.base/windows/native/libnet/Inet4AddressImpl.c b/src/java.base/windows/native/libnet/Inet4AddressImpl.c index 75dfb57eb2f..33f379024c0 100644 --- a/src/java.base/windows/native/libnet/Inet4AddressImpl.c +++ b/src/java.base/windows/native/libnet/Inet4AddressImpl.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2022, 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 @@ -76,7 +76,7 @@ Java_java_net_Inet4AddressImpl_lookupAllHostAddr(JNIEnv *env, jobject this, JNU_ThrowNullPointerException(env, "host argument is null"); return NULL; } - hostname = JNU_GetStringPlatformChars(env, host, JNI_FALSE); + hostname = JNU_GetStringPlatformChars(env, host, NULL); CHECK_NULL_RETURN(hostname, NULL); // try once, with our static buffer diff --git a/src/java.base/windows/native/libnet/Inet6AddressImpl.c b/src/java.base/windows/native/libnet/Inet6AddressImpl.c index 87908775e99..a011b2fe5fa 100644 --- a/src/java.base/windows/native/libnet/Inet6AddressImpl.c +++ b/src/java.base/windows/native/libnet/Inet6AddressImpl.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2022, 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 @@ -71,7 +71,7 @@ Java_java_net_Inet6AddressImpl_lookupAllHostAddr(JNIEnv *env, jobject this, JNU_ThrowNullPointerException(env, "host argument is null"); return NULL; } - hostname = JNU_GetStringPlatformChars(env, host, JNI_FALSE); + hostname = JNU_GetStringPlatformChars(env, host, NULL); CHECK_NULL_RETURN(hostname, NULL); // try once, with our static buffer diff --git a/src/java.desktop/unix/native/libawt_xawt/xawt/XlibWrapper.c b/src/java.desktop/unix/native/libawt_xawt/xawt/XlibWrapper.c index 19173eb6052..851071db3e0 100644 --- a/src/java.desktop/unix/native/libawt_xawt/xawt/XlibWrapper.c +++ b/src/java.desktop/unix/native/libawt_xawt/xawt/XlibWrapper.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2022, 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 @@ -825,7 +825,7 @@ JNIEXPORT void JNICALL Java_sun_awt_X11_XlibWrapper_SetProperty */ if (!JNU_IsNull(env, jstr)) { #ifdef X_HAVE_UTF8_STRING - cname = (char *) (*env)->GetStringUTFChars(env, jstr, JNI_FALSE); + cname = (char *) (*env)->GetStringUTFChars(env, jstr, NULL); #else cname = (char *) JNU_GetStringPlatformChars(env, jstr, NULL); #endif diff --git a/src/java.desktop/windows/native/libawt/windows/awt_Button.cpp b/src/java.desktop/windows/native/libawt/windows/awt_Button.cpp index 1a7a89fdef4..3f019b0c278 100644 --- a/src/java.desktop/windows/native/libawt/windows/awt_Button.cpp +++ b/src/java.desktop/windows/native/libawt/windows/awt_Button.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2022, 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 @@ -105,7 +105,7 @@ AwtButton* AwtButton::Create(jobject self, jobject parent) if (label == NULL) { labelStr = L""; } else { - labelStr = JNU_GetStringPlatformChars(env, label, JNI_FALSE); + labelStr = JNU_GetStringPlatformChars(env, label, NULL); } style = 0; @@ -311,7 +311,7 @@ void AwtButton::_SetLabel(void *param) if (label == NULL) { labelStr = TEXT(""); } else { - labelStr = JNU_GetStringPlatformChars(env, label, JNI_FALSE); + labelStr = JNU_GetStringPlatformChars(env, label, NULL); } if (labelStr == NULL) { diff --git a/src/java.desktop/windows/native/libawt/windows/awt_Checkbox.cpp b/src/java.desktop/windows/native/libawt/windows/awt_Checkbox.cpp index d77ebb74a3e..5b004da95f2 100644 --- a/src/java.desktop/windows/native/libawt/windows/awt_Checkbox.cpp +++ b/src/java.desktop/windows/native/libawt/windows/awt_Checkbox.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2022, 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 @@ -106,7 +106,7 @@ AwtCheckbox* AwtCheckbox::Create(jobject peer, jobject parent) label = (jstring)env->GetObjectField(target, AwtCheckbox::labelID); if (label != NULL) { - labelStr = JNU_GetStringPlatformChars(env, label, 0); + labelStr = JNU_GetStringPlatformChars(env, label, NULL); } if (labelStr != 0) { jint x = env->GetIntField(target, AwtComponent::xID); @@ -375,7 +375,7 @@ void AwtCheckbox::_SetLabel(void *param) } else { - labelStr = JNU_GetStringPlatformChars(env, label, JNI_FALSE); + labelStr = JNU_GetStringPlatformChars(env, label, NULL); } if (labelStr == NULL) diff --git a/src/java.desktop/windows/native/libawt/windows/awt_Desktop.cpp b/src/java.desktop/windows/native/libawt/windows/awt_Desktop.cpp index 73b3c51c796..9cf2cea6fab 100644 --- a/src/java.desktop/windows/native/libawt/windows/awt_Desktop.cpp +++ b/src/java.desktop/windows/native/libawt/windows/awt_Desktop.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2022, 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 @@ -75,9 +75,9 @@ JNIEXPORT void JNICALL Java_sun_awt_windows_WDesktopPeer_init JNIEXPORT jstring JNICALL Java_sun_awt_windows_WDesktopPeer_ShellExecute (JNIEnv *env, jclass cls, jstring fileOrUri_j, jstring verb_j) { - LPCWSTR fileOrUri_c = JNU_GetStringPlatformChars(env, fileOrUri_j, JNI_FALSE); + LPCWSTR fileOrUri_c = JNU_GetStringPlatformChars(env, fileOrUri_j, NULL); CHECK_NULL_RETURN(fileOrUri_c, NULL); - LPCWSTR verb_c = JNU_GetStringPlatformChars(env, verb_j, JNI_FALSE); + LPCWSTR verb_c = JNU_GetStringPlatformChars(env, verb_j, NULL); if (verb_c == NULL) { JNU_ReleaseStringPlatformChars(env, fileOrUri_j, fileOrUri_c); return NULL; diff --git a/src/java.desktop/windows/native/libawt/windows/awt_Win32GraphicsEnv.cpp b/src/java.desktop/windows/native/libawt/windows/awt_Win32GraphicsEnv.cpp index 434050215a3..ab8ad1ddf9e 100644 --- a/src/java.desktop/windows/native/libawt/windows/awt_Win32GraphicsEnv.cpp +++ b/src/java.desktop/windows/native/libawt/windows/awt_Win32GraphicsEnv.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2022, 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 @@ -183,7 +183,7 @@ Java_sun_awt_Win32FontManager_registerFontWithPlatform(JNIEnv *env, jclass cl, jstring fontName) { - LPTSTR file = (LPTSTR)JNU_GetStringPlatformChars(env, fontName, JNI_FALSE); + LPTSTR file = (LPTSTR)JNU_GetStringPlatformChars(env, fontName, NULL); if (file) { ::AddFontResourceEx(file, FR_PRIVATE, NULL); JNU_ReleaseStringPlatformChars(env, fontName, file); @@ -203,7 +203,7 @@ Java_sun_awt_Win32FontManager_deRegisterFontWithPlatform(JNIEnv *env, jclass cl, jstring fontName) { - LPTSTR file = (LPTSTR)JNU_GetStringPlatformChars(env, fontName, JNI_FALSE); + LPTSTR file = (LPTSTR)JNU_GetStringPlatformChars(env, fontName, NULL); if (file) { ::RemoveFontResourceEx(file, FR_PRIVATE, NULL); JNU_ReleaseStringPlatformChars(env, fontName, file); -- GitLab From 374193b6d2465a356941f9588a0ccf6d97cb76f6 Mon Sep 17 00:00:00 2001 From: Pavel Rappo Date: Fri, 11 Mar 2022 22:41:47 +0000 Subject: [PATCH 225/340] 8283041: [javadoc] Crashes using {@return} with @param Reviewed-by: jjg --- .../jdk/javadoc/internal/doclint/Checker.java | 6 +++--- .../doclet/testReturnTag/TestReturnTag.java | 20 ++++++++++++++++--- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclint/Checker.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclint/Checker.java index 446757513a1..6b167aa3933 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclint/Checker.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclint/Checker.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2022, 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 @@ -985,8 +985,8 @@ public class Checker extends DocTreePathScanner { } if (tree.isInline()) { DocCommentTree dct = getCurrentPath().getDocComment(); - if (tree != dct.getFirstSentence().get(0)) { - env.messages.warning(REFERENCE, tree, "dc.return.not.first"); + if (dct.getFirstSentence().isEmpty() || tree != dct.getFirstSentence().get(0)) { + env.messages.warning(SYNTAX, tree, "dc.return.not.first"); } } diff --git a/test/langtools/jdk/javadoc/doclet/testReturnTag/TestReturnTag.java b/test/langtools/jdk/javadoc/doclet/testReturnTag/TestReturnTag.java index 00d5c92c630..4974f4e586e 100644 --- a/test/langtools/jdk/javadoc/doclet/testReturnTag/TestReturnTag.java +++ b/test/langtools/jdk/javadoc/doclet/testReturnTag/TestReturnTag.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2022, 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 - * @bug 4490068 8075778 + * @bug 4490068 8075778 8283041 * @summary General tests for inline or block at-return tag * @library /tools/lib ../../lib * @modules jdk.javadoc/jdk.javadoc.internal.tool @@ -265,16 +265,30 @@ public class TestReturnTag extends JavadocTester { */ public int m() { return 0; } } + """, + """ + /** Comment. */ + public class X { + /** + * @author Jim + * {@return the result} + */ + public int m() { return 0; } + } """); javadoc("-d", base.resolve("out").toString(), "-sourcepath", src.toString(), - src.resolve("C.java").toString()); + src.resolve("C.java").toString(), + src.resolve("X.java").toString()); checkExit(Exit.OK); checkOutput(Output.OUT, true, "C.java:4: warning: {@return} not at beginning of description"); + checkOutput(Output.OUT, true, + "X.java:5: warning: {@return} not at beginning of description"); + checkOutput("C.html", true, """

    Some text. Returns the result. More text.
    -- GitLab From 5c408c1410e15087f735a815b7edc716d514b1b3 Mon Sep 17 00:00:00 2001 From: Joshua Zhu Date: Sat, 12 Mar 2022 04:04:28 +0000 Subject: [PATCH 226/340] 8282874: Bad performance on gather/scatter API caused by different IntSpecies of indexMap Reviewed-by: psandoz --- .../classes/jdk/incubator/vector/ByteVector.java | 12 ++++++------ .../classes/jdk/incubator/vector/DoubleVector.java | 12 ++++++------ .../classes/jdk/incubator/vector/FloatVector.java | 12 ++++++------ .../classes/jdk/incubator/vector/IntVector.java | 12 ++++++------ .../classes/jdk/incubator/vector/LongVector.java | 12 ++++++------ .../classes/jdk/incubator/vector/ShortVector.java | 12 ++++++------ .../jdk/incubator/vector/X-Vector.java.template | 12 ++++++------ 7 files changed, 42 insertions(+), 42 deletions(-) diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/ByteVector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/ByteVector.java index 5bd14c97601..c21fde386b9 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/ByteVector.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/ByteVector.java @@ -4336,12 +4336,12 @@ public abstract class ByteVector extends AbstractVector { */ static ByteSpecies species(VectorShape s) { Objects.requireNonNull(s); - switch (s) { - case S_64_BIT: return (ByteSpecies) SPECIES_64; - case S_128_BIT: return (ByteSpecies) SPECIES_128; - case S_256_BIT: return (ByteSpecies) SPECIES_256; - case S_512_BIT: return (ByteSpecies) SPECIES_512; - case S_Max_BIT: return (ByteSpecies) SPECIES_MAX; + switch (s.switchKey) { + case VectorShape.SK_64_BIT: return (ByteSpecies) SPECIES_64; + case VectorShape.SK_128_BIT: return (ByteSpecies) SPECIES_128; + case VectorShape.SK_256_BIT: return (ByteSpecies) SPECIES_256; + case VectorShape.SK_512_BIT: return (ByteSpecies) SPECIES_512; + case VectorShape.SK_Max_BIT: return (ByteSpecies) SPECIES_MAX; default: throw new IllegalArgumentException("Bad shape: " + s); } } diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/DoubleVector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/DoubleVector.java index aec717394ed..4d62284bb6e 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/DoubleVector.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/DoubleVector.java @@ -3963,12 +3963,12 @@ public abstract class DoubleVector extends AbstractVector { */ static DoubleSpecies species(VectorShape s) { Objects.requireNonNull(s); - switch (s) { - case S_64_BIT: return (DoubleSpecies) SPECIES_64; - case S_128_BIT: return (DoubleSpecies) SPECIES_128; - case S_256_BIT: return (DoubleSpecies) SPECIES_256; - case S_512_BIT: return (DoubleSpecies) SPECIES_512; - case S_Max_BIT: return (DoubleSpecies) SPECIES_MAX; + switch (s.switchKey) { + case VectorShape.SK_64_BIT: return (DoubleSpecies) SPECIES_64; + case VectorShape.SK_128_BIT: return (DoubleSpecies) SPECIES_128; + case VectorShape.SK_256_BIT: return (DoubleSpecies) SPECIES_256; + case VectorShape.SK_512_BIT: return (DoubleSpecies) SPECIES_512; + case VectorShape.SK_Max_BIT: return (DoubleSpecies) SPECIES_MAX; default: throw new IllegalArgumentException("Bad shape: " + s); } } diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/FloatVector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/FloatVector.java index c55df4b72bd..60da7eb57fc 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/FloatVector.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/FloatVector.java @@ -3913,12 +3913,12 @@ public abstract class FloatVector extends AbstractVector { */ static FloatSpecies species(VectorShape s) { Objects.requireNonNull(s); - switch (s) { - case S_64_BIT: return (FloatSpecies) SPECIES_64; - case S_128_BIT: return (FloatSpecies) SPECIES_128; - case S_256_BIT: return (FloatSpecies) SPECIES_256; - case S_512_BIT: return (FloatSpecies) SPECIES_512; - case S_Max_BIT: return (FloatSpecies) SPECIES_MAX; + switch (s.switchKey) { + case VectorShape.SK_64_BIT: return (FloatSpecies) SPECIES_64; + case VectorShape.SK_128_BIT: return (FloatSpecies) SPECIES_128; + case VectorShape.SK_256_BIT: return (FloatSpecies) SPECIES_256; + case VectorShape.SK_512_BIT: return (FloatSpecies) SPECIES_512; + case VectorShape.SK_Max_BIT: return (FloatSpecies) SPECIES_MAX; default: throw new IllegalArgumentException("Bad shape: " + s); } } diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/IntVector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/IntVector.java index 312e1ad725a..e5033ac5366 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/IntVector.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/IntVector.java @@ -4061,12 +4061,12 @@ public abstract class IntVector extends AbstractVector { */ static IntSpecies species(VectorShape s) { Objects.requireNonNull(s); - switch (s) { - case S_64_BIT: return (IntSpecies) SPECIES_64; - case S_128_BIT: return (IntSpecies) SPECIES_128; - case S_256_BIT: return (IntSpecies) SPECIES_256; - case S_512_BIT: return (IntSpecies) SPECIES_512; - case S_Max_BIT: return (IntSpecies) SPECIES_MAX; + switch (s.switchKey) { + case VectorShape.SK_64_BIT: return (IntSpecies) SPECIES_64; + case VectorShape.SK_128_BIT: return (IntSpecies) SPECIES_128; + case VectorShape.SK_256_BIT: return (IntSpecies) SPECIES_256; + case VectorShape.SK_512_BIT: return (IntSpecies) SPECIES_512; + case VectorShape.SK_Max_BIT: return (IntSpecies) SPECIES_MAX; default: throw new IllegalArgumentException("Bad shape: " + s); } } diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/LongVector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/LongVector.java index 513178181f4..37ba7189679 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/LongVector.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/LongVector.java @@ -3987,12 +3987,12 @@ public abstract class LongVector extends AbstractVector { */ static LongSpecies species(VectorShape s) { Objects.requireNonNull(s); - switch (s) { - case S_64_BIT: return (LongSpecies) SPECIES_64; - case S_128_BIT: return (LongSpecies) SPECIES_128; - case S_256_BIT: return (LongSpecies) SPECIES_256; - case S_512_BIT: return (LongSpecies) SPECIES_512; - case S_Max_BIT: return (LongSpecies) SPECIES_MAX; + switch (s.switchKey) { + case VectorShape.SK_64_BIT: return (LongSpecies) SPECIES_64; + case VectorShape.SK_128_BIT: return (LongSpecies) SPECIES_128; + case VectorShape.SK_256_BIT: return (LongSpecies) SPECIES_256; + case VectorShape.SK_512_BIT: return (LongSpecies) SPECIES_512; + case VectorShape.SK_Max_BIT: return (LongSpecies) SPECIES_MAX; default: throw new IllegalArgumentException("Bad shape: " + s); } } diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/ShortVector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/ShortVector.java index 511e10a6563..8c6dd4718f7 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/ShortVector.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/ShortVector.java @@ -4330,12 +4330,12 @@ public abstract class ShortVector extends AbstractVector { */ static ShortSpecies species(VectorShape s) { Objects.requireNonNull(s); - switch (s) { - case S_64_BIT: return (ShortSpecies) SPECIES_64; - case S_128_BIT: return (ShortSpecies) SPECIES_128; - case S_256_BIT: return (ShortSpecies) SPECIES_256; - case S_512_BIT: return (ShortSpecies) SPECIES_512; - case S_Max_BIT: return (ShortSpecies) SPECIES_MAX; + switch (s.switchKey) { + case VectorShape.SK_64_BIT: return (ShortSpecies) SPECIES_64; + case VectorShape.SK_128_BIT: return (ShortSpecies) SPECIES_128; + case VectorShape.SK_256_BIT: return (ShortSpecies) SPECIES_256; + case VectorShape.SK_512_BIT: return (ShortSpecies) SPECIES_512; + case VectorShape.SK_Max_BIT: return (ShortSpecies) SPECIES_MAX; default: throw new IllegalArgumentException("Bad shape: " + s); } } diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/X-Vector.java.template b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/X-Vector.java.template index 16d2dbea06e..6c5ed6b9c13 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/X-Vector.java.template +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/X-Vector.java.template @@ -5543,12 +5543,12 @@ public abstract class $abstractvectortype$ extends AbstractVector<$Boxtype$> { */ static $Type$Species species(VectorShape s) { Objects.requireNonNull(s); - switch (s) { - case S_64_BIT: return ($Type$Species) SPECIES_64; - case S_128_BIT: return ($Type$Species) SPECIES_128; - case S_256_BIT: return ($Type$Species) SPECIES_256; - case S_512_BIT: return ($Type$Species) SPECIES_512; - case S_Max_BIT: return ($Type$Species) SPECIES_MAX; + switch (s.switchKey) { + case VectorShape.SK_64_BIT: return ($Type$Species) SPECIES_64; + case VectorShape.SK_128_BIT: return ($Type$Species) SPECIES_128; + case VectorShape.SK_256_BIT: return ($Type$Species) SPECIES_256; + case VectorShape.SK_512_BIT: return ($Type$Species) SPECIES_512; + case VectorShape.SK_Max_BIT: return ($Type$Species) SPECIES_MAX; default: throw new IllegalArgumentException("Bad shape: " + s); } } -- GitLab From 3cf83a671eaedd78d87197dffa76dcc3fededb78 Mon Sep 17 00:00:00 2001 From: Jaikiran Pai Date: Mon, 14 Mar 2022 03:17:57 +0000 Subject: [PATCH 227/340] 8282572: EnumSet should be a sealed class Reviewed-by: sundar --- src/java.base/share/classes/java/util/EnumSet.java | 6 +++--- src/java.base/share/classes/java/util/JumboEnumSet.java | 4 ++-- src/java.base/share/classes/java/util/RegularEnumSet.java | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/java.base/share/classes/java/util/EnumSet.java b/src/java.base/share/classes/java/util/EnumSet.java index ee475ba338a..3776cedd5bb 100644 --- a/src/java.base/share/classes/java/util/EnumSet.java +++ b/src/java.base/share/classes/java/util/EnumSet.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2022, 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 @@ -76,8 +76,8 @@ import jdk.internal.access.SharedSecrets; * @since 1.5 * @see EnumMap */ -public abstract class EnumSet> extends AbstractSet - implements Cloneable, java.io.Serializable +public abstract sealed class EnumSet> extends AbstractSet + implements Cloneable, java.io.Serializable permits JumboEnumSet, RegularEnumSet { // declare EnumSet.class serialization compatibility with JDK 8 @java.io.Serial diff --git a/src/java.base/share/classes/java/util/JumboEnumSet.java b/src/java.base/share/classes/java/util/JumboEnumSet.java index f80e5056803..126fc077b6c 100644 --- a/src/java.base/share/classes/java/util/JumboEnumSet.java +++ b/src/java.base/share/classes/java/util/JumboEnumSet.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2022, 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 @@ -33,7 +33,7 @@ package java.util; * @since 1.5 * @serial exclude */ -class JumboEnumSet> extends EnumSet { +final class JumboEnumSet> extends EnumSet { @java.io.Serial private static final long serialVersionUID = 334349849919042784L; diff --git a/src/java.base/share/classes/java/util/RegularEnumSet.java b/src/java.base/share/classes/java/util/RegularEnumSet.java index 1deda8a2935..f06adcbf692 100644 --- a/src/java.base/share/classes/java/util/RegularEnumSet.java +++ b/src/java.base/share/classes/java/util/RegularEnumSet.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2022, 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 @@ -33,7 +33,7 @@ package java.util; * @since 1.5 * @serial exclude */ -class RegularEnumSet> extends EnumSet { +final class RegularEnumSet> extends EnumSet { @java.io.Serial private static final long serialVersionUID = 3411599620347842686L; /** -- GitLab From fde31498963d76630ada31bd0e0cf3035f87445b Mon Sep 17 00:00:00 2001 From: Jatin Bhateja Date: Mon, 14 Mar 2022 07:11:23 +0000 Subject: [PATCH 228/340] 8281375: Accelerate bitCount operation for AVX2 and AVX512 target. Reviewed-by: sviswanathan, thartmann --- src/hotspot/cpu/aarch64/matcher_aarch64.hpp | 6 ++ src/hotspot/cpu/arm/matcher_arm.hpp | 5 ++ src/hotspot/cpu/ppc/matcher_ppc.hpp | 6 ++ src/hotspot/cpu/s390/matcher_s390.hpp | 5 ++ src/hotspot/cpu/x86/assembler_x86.cpp | 22 ++++- src/hotspot/cpu/x86/assembler_x86.hpp | 7 ++ src/hotspot/cpu/x86/c2_MacroAssembler_x86.cpp | 88 +++++++++++++++++++ src/hotspot/cpu/x86/c2_MacroAssembler_x86.hpp | 8 ++ src/hotspot/cpu/x86/matcher_x86.hpp | 9 ++ src/hotspot/cpu/x86/stubGenerator_x86_32.cpp | 29 ++++++ src/hotspot/cpu/x86/stubGenerator_x86_64.cpp | 20 +++++ src/hotspot/cpu/x86/stubRoutines_x86.cpp | 1 + src/hotspot/cpu/x86/stubRoutines_x86.hpp | 4 + src/hotspot/cpu/x86/x86.ad | 60 +++++++++++-- src/hotspot/share/opto/loopTransform.cpp | 7 ++ .../vectorization/TestPopCountVectorLong.java | 3 +- 16 files changed, 268 insertions(+), 12 deletions(-) diff --git a/src/hotspot/cpu/aarch64/matcher_aarch64.hpp b/src/hotspot/cpu/aarch64/matcher_aarch64.hpp index aca82240a57..c2f801f408a 100644 --- a/src/hotspot/cpu/aarch64/matcher_aarch64.hpp +++ b/src/hotspot/cpu/aarch64/matcher_aarch64.hpp @@ -163,4 +163,10 @@ // Implements a variant of EncodeISOArrayNode that encode ASCII only static const bool supports_encode_ascii_array = true; + // Returns pre-selection estimated size of a vector operation. + static int vector_op_pre_select_sz_estimate(int vopc, BasicType ety, int vlen) { + return 0; + } + + #endif // CPU_AARCH64_MATCHER_AARCH64_HPP diff --git a/src/hotspot/cpu/arm/matcher_arm.hpp b/src/hotspot/cpu/arm/matcher_arm.hpp index 7552b014c06..496ea27c086 100644 --- a/src/hotspot/cpu/arm/matcher_arm.hpp +++ b/src/hotspot/cpu/arm/matcher_arm.hpp @@ -155,4 +155,9 @@ // Implements a variant of EncodeISOArrayNode that encode ASCII only static const bool supports_encode_ascii_array = false; + // Returns pre-selection estimated cost of a vector operation. + static int vector_op_pre_select_sz_estimate(int vopc, BasicType ety, int vlen) { + return 0; + } + #endif // CPU_ARM_MATCHER_ARM_HPP diff --git a/src/hotspot/cpu/ppc/matcher_ppc.hpp b/src/hotspot/cpu/ppc/matcher_ppc.hpp index df2074dee24..069c40485fe 100644 --- a/src/hotspot/cpu/ppc/matcher_ppc.hpp +++ b/src/hotspot/cpu/ppc/matcher_ppc.hpp @@ -164,4 +164,10 @@ // Implements a variant of EncodeISOArrayNode that encode ASCII only static const bool supports_encode_ascii_array = true; + // Returns pre-selection estimated cost of a vector operation. + static int vector_op_pre_select_sz_estimate(int vopc, BasicType ety, int vlen) { + return 0; + } + + #endif // CPU_PPC_MATCHER_PPC_HPP diff --git a/src/hotspot/cpu/s390/matcher_s390.hpp b/src/hotspot/cpu/s390/matcher_s390.hpp index ac55bd84dff..5c56ec5373b 100644 --- a/src/hotspot/cpu/s390/matcher_s390.hpp +++ b/src/hotspot/cpu/s390/matcher_s390.hpp @@ -153,4 +153,9 @@ // Implements a variant of EncodeISOArrayNode that encode ASCII only static const bool supports_encode_ascii_array = true; + // Returns pre-selection estimated cost of a vector operation. + static int vector_op_pre_select_sz_estimate(int vopc, BasicType ety, int vlen) { + return 0; + } + #endif // CPU_S390_MATCHER_S390_HPP diff --git a/src/hotspot/cpu/x86/assembler_x86.cpp b/src/hotspot/cpu/x86/assembler_x86.cpp index be8c18b0710..03229421305 100644 --- a/src/hotspot/cpu/x86/assembler_x86.cpp +++ b/src/hotspot/cpu/x86/assembler_x86.cpp @@ -8317,8 +8317,28 @@ void Assembler::vpbroadcastw(XMMRegister dst, Address src, int vector_len) { emit_operand(dst, src); } -// xmm/mem sourced byte/word/dword/qword replicate +void Assembler::vpsadbw(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len) { + assert(UseAVX > 0, "requires some form of AVX"); + InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ _legacy_mode_bw, /* no_mask_reg */ true, /* uses_vl */ true); + int encode = vex_prefix_and_encode(dst->encoding(), nds->encoding(), src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes); + emit_int16((unsigned char)0xF6, (0xC0 | encode)); +} + +void Assembler::vpunpckhdq(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len) { + assert(UseAVX > 0, "requires some form of AVX"); + InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); + int encode = vex_prefix_and_encode(dst->encoding(), nds->encoding(), src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes); + emit_int16(0x6A, (0xC0 | encode)); +} +void Assembler::vpunpckldq(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len) { + assert(UseAVX > 0, "requires some form of AVX"); + InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); + int encode = vex_prefix_and_encode(dst->encoding(), nds->encoding(), src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes); + emit_int16(0x62, (0xC0 | encode)); +} + +// xmm/mem sourced byte/word/dword/qword replicate void Assembler::evpaddb(XMMRegister dst, KRegister mask, XMMRegister nds, XMMRegister src, bool merge, int vector_len) { assert(VM_Version::supports_avx512bw() && (vector_len == AVX_512bit || VM_Version::supports_avx512vl()), ""); InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false,/* uses_vl */ true); diff --git a/src/hotspot/cpu/x86/assembler_x86.hpp b/src/hotspot/cpu/x86/assembler_x86.hpp index f21dd901c5d..3256b990cf7 100644 --- a/src/hotspot/cpu/x86/assembler_x86.hpp +++ b/src/hotspot/cpu/x86/assembler_x86.hpp @@ -1933,10 +1933,17 @@ private: // Interleave Low Doublewords void punpckldq(XMMRegister dst, XMMRegister src); void punpckldq(XMMRegister dst, Address src); + void vpunpckldq(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len); + + // Interleave High Doublewords + void vpunpckhdq(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len); // Interleave Low Quadwords void punpcklqdq(XMMRegister dst, XMMRegister src); + // Vector sum of absolute difference. + void vpsadbw(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len); + #ifndef _LP64 // no 32bit push/pop on amd64 void pushl(Address src); #endif diff --git a/src/hotspot/cpu/x86/c2_MacroAssembler_x86.cpp b/src/hotspot/cpu/x86/c2_MacroAssembler_x86.cpp index 400bcec45e2..f3f684b1b25 100644 --- a/src/hotspot/cpu/x86/c2_MacroAssembler_x86.cpp +++ b/src/hotspot/cpu/x86/c2_MacroAssembler_x86.cpp @@ -4321,6 +4321,94 @@ void C2_MacroAssembler::vector_maskall_operation(KRegister dst, Register src, in } } + +// +// Following is lookup table based popcount computation algorithm:- +// Index Bit set count +// [ 0000 -> 0, +// 0001 -> 1, +// 0010 -> 1, +// 0011 -> 2, +// 0100 -> 1, +// 0101 -> 2, +// 0110 -> 2, +// 0111 -> 3, +// 1000 -> 1, +// 1001 -> 2, +// 1010 -> 3, +// 1011 -> 3, +// 1100 -> 2, +// 1101 -> 3, +// 1111 -> 4 ] +// a. Count the number of 1s in 4 LSB bits of each byte. These bits are used as +// shuffle indices for lookup table access. +// b. Right shift each byte of vector lane by 4 positions. +// c. Count the number of 1s in 4 MSB bits each byte. These bits are used as +// shuffle indices for lookup table access. +// d. Add the bitset count of upper and lower 4 bits of each byte. +// e. Unpack double words to quad words and compute sum of absolute difference of bitset +// count of all the bytes of a quadword. +// f. Perform step e. for upper 128bit vector lane. +// g. Pack the bitset count of quadwords back to double word. +// h. Unpacking and packing operations are not needed for 64bit vector lane. +void C2_MacroAssembler::vector_popcount_int(XMMRegister dst, XMMRegister src, XMMRegister xtmp1, + XMMRegister xtmp2, XMMRegister xtmp3, Register rtmp, + int vec_enc) { + if (VM_Version::supports_avx512_vpopcntdq()) { + vpopcntd(dst, src, vec_enc); + } else { + assert((vec_enc == Assembler::AVX_512bit && VM_Version::supports_avx512bw()) || VM_Version::supports_avx2(), ""); + movl(rtmp, 0x0F0F0F0F); + movdl(xtmp1, rtmp); + vpbroadcastd(xtmp1, xtmp1, vec_enc); + if (Assembler::AVX_512bit == vec_enc) { + evmovdqul(xtmp2, k0, ExternalAddress(StubRoutines::x86::vector_popcount_lut()), false, vec_enc, rtmp); + } else { + vmovdqu(xtmp2, ExternalAddress(StubRoutines::x86::vector_popcount_lut()), rtmp); + } + vpand(xtmp3, src, xtmp1, vec_enc); + vpshufb(xtmp3, xtmp2, xtmp3, vec_enc); + vpsrlw(dst, src, 4, vec_enc); + vpand(dst, dst, xtmp1, vec_enc); + vpshufb(dst, xtmp2, dst, vec_enc); + vpaddb(xtmp3, dst, xtmp3, vec_enc); + vpxor(xtmp1, xtmp1, xtmp1, vec_enc); + vpunpckhdq(dst, xtmp3, xtmp1, vec_enc); + vpsadbw(dst, dst, xtmp1, vec_enc); + vpunpckldq(xtmp2, xtmp3, xtmp1, vec_enc); + vpsadbw(xtmp2, xtmp2, xtmp1, vec_enc); + vpackuswb(dst, xtmp2, dst, vec_enc); + } +} + +void C2_MacroAssembler::vector_popcount_long(XMMRegister dst, XMMRegister src, XMMRegister xtmp1, + XMMRegister xtmp2, XMMRegister xtmp3, Register rtmp, + int vec_enc) { + if (VM_Version::supports_avx512_vpopcntdq()) { + vpopcntq(dst, src, vec_enc); + } else if (vec_enc == Assembler::AVX_512bit) { + assert(VM_Version::supports_avx512bw(), ""); + movl(rtmp, 0x0F0F0F0F); + movdl(xtmp1, rtmp); + vpbroadcastd(xtmp1, xtmp1, vec_enc); + evmovdqul(xtmp2, k0, ExternalAddress(StubRoutines::x86::vector_popcount_lut()), true, vec_enc, rtmp); + vpandq(xtmp3, src, xtmp1, vec_enc); + vpshufb(xtmp3, xtmp2, xtmp3, vec_enc); + vpsrlw(dst, src, 4, vec_enc); + vpandq(dst, dst, xtmp1, vec_enc); + vpshufb(dst, xtmp2, dst, vec_enc); + vpaddb(xtmp3, dst, xtmp3, vec_enc); + vpxorq(xtmp1, xtmp1, xtmp1, vec_enc); + vpsadbw(dst, xtmp3, xtmp1, vec_enc); + } else { + // We do not see any performance benefit of running + // above instruction sequence on 256 bit vector which + // can operate over maximum 4 long elements. + ShouldNotReachHere(); + } + evpmovqd(dst, dst, vec_enc); +} + #ifndef _LP64 void C2_MacroAssembler::vector_maskall_operation32(KRegister dst, Register src, KRegister tmp, int mask_len) { assert(VM_Version::supports_avx512bw(), ""); diff --git a/src/hotspot/cpu/x86/c2_MacroAssembler_x86.hpp b/src/hotspot/cpu/x86/c2_MacroAssembler_x86.hpp index 0e6a381430f..0464d755ed4 100644 --- a/src/hotspot/cpu/x86/c2_MacroAssembler_x86.hpp +++ b/src/hotspot/cpu/x86/c2_MacroAssembler_x86.hpp @@ -317,4 +317,12 @@ public: void evpternlog(XMMRegister dst, int func, KRegister mask, XMMRegister src2, Address src3, bool merge, BasicType bt, int vlen_enc); + void vector_popcount_int(XMMRegister dst, XMMRegister src, XMMRegister xtmp1, + XMMRegister xtmp2, XMMRegister xtmp3, Register rtmp, + int vec_enc); + + void vector_popcount_long(XMMRegister dst, XMMRegister src, XMMRegister xtmp1, + XMMRegister xtmp2, XMMRegister xtmp3, Register rtmp, + int vec_enc); + #endif // CPU_X86_C2_MACROASSEMBLER_X86_HPP diff --git a/src/hotspot/cpu/x86/matcher_x86.hpp b/src/hotspot/cpu/x86/matcher_x86.hpp index 61af24cf31c..9711bc8c2c4 100644 --- a/src/hotspot/cpu/x86/matcher_x86.hpp +++ b/src/hotspot/cpu/x86/matcher_x86.hpp @@ -183,4 +183,13 @@ // Implements a variant of EncodeISOArrayNode that encode ASCII only static const bool supports_encode_ascii_array = true; + // Returns pre-selection estimated cost of a vector operation. + static int vector_op_pre_select_sz_estimate(int vopc, BasicType ety, int vlen) { + switch(vopc) { + default: return 0; + case Op_PopCountVI: return VM_Version::supports_avx512_vpopcntdq() ? 0 : 50; + case Op_PopCountVL: return VM_Version::supports_avx512_vpopcntdq() ? 0 : 40; + } + } + #endif // CPU_X86_MATCHER_X86_HPP diff --git a/src/hotspot/cpu/x86/stubGenerator_x86_32.cpp b/src/hotspot/cpu/x86/stubGenerator_x86_32.cpp index 1525d10e5b5..24cfc237b23 100644 --- a/src/hotspot/cpu/x86/stubGenerator_x86_32.cpp +++ b/src/hotspot/cpu/x86/stubGenerator_x86_32.cpp @@ -588,6 +588,30 @@ class StubGenerator: public StubCodeGenerator { return start; } + address generate_popcount_avx_lut(const char *stub_name) { + __ align64(); + StubCodeMark mark(this, "StubRoutines", stub_name); + address start = __ pc(); + __ emit_data(0x02010100, relocInfo::none, 0); + __ emit_data(0x03020201, relocInfo::none, 0); + __ emit_data(0x03020201, relocInfo::none, 0); + __ emit_data(0x04030302, relocInfo::none, 0); + __ emit_data(0x02010100, relocInfo::none, 0); + __ emit_data(0x03020201, relocInfo::none, 0); + __ emit_data(0x03020201, relocInfo::none, 0); + __ emit_data(0x04030302, relocInfo::none, 0); + __ emit_data(0x02010100, relocInfo::none, 0); + __ emit_data(0x03020201, relocInfo::none, 0); + __ emit_data(0x03020201, relocInfo::none, 0); + __ emit_data(0x04030302, relocInfo::none, 0); + __ emit_data(0x02010100, relocInfo::none, 0); + __ emit_data(0x03020201, relocInfo::none, 0); + __ emit_data(0x03020201, relocInfo::none, 0); + __ emit_data(0x04030302, relocInfo::none, 0); + return start; + } + + address generate_iota_indices(const char *stub_name) { __ align(CodeEntryAlignment); StubCodeMark mark(this, "StubRoutines", stub_name); @@ -4004,6 +4028,11 @@ class StubGenerator: public StubCodeGenerator { StubRoutines::x86::_vector_int_mask_cmp_bits = generate_vector_mask("vector_int_mask_cmp_bits", 0x00000001); StubRoutines::x86::_vector_iota_indices = generate_iota_indices("iota_indices"); + if (UsePopCountInstruction && VM_Version::supports_avx2() && !VM_Version::supports_avx512_vpopcntdq()) { + // lut implementation influenced by counting 1s algorithm from section 5-1 of Hackers' Delight. + StubRoutines::x86::_vector_popcount_lut = generate_popcount_avx_lut("popcount_lut"); + } + // support for verify_oop (must happen after universe_init) StubRoutines::_verify_oop_subroutine_entry = generate_verify_oop(); diff --git a/src/hotspot/cpu/x86/stubGenerator_x86_64.cpp b/src/hotspot/cpu/x86/stubGenerator_x86_64.cpp index 8b7188ca42c..6bdff24bddd 100644 --- a/src/hotspot/cpu/x86/stubGenerator_x86_64.cpp +++ b/src/hotspot/cpu/x86/stubGenerator_x86_64.cpp @@ -795,6 +795,21 @@ class StubGenerator: public StubCodeGenerator { return start; } + address generate_popcount_avx_lut(const char *stub_name) { + __ align64(); + StubCodeMark mark(this, "StubRoutines", stub_name); + address start = __ pc(); + __ emit_data64(0x0302020102010100, relocInfo::none); + __ emit_data64(0x0403030203020201, relocInfo::none); + __ emit_data64(0x0302020102010100, relocInfo::none); + __ emit_data64(0x0403030203020201, relocInfo::none); + __ emit_data64(0x0302020102010100, relocInfo::none); + __ emit_data64(0x0403030203020201, relocInfo::none); + __ emit_data64(0x0302020102010100, relocInfo::none); + __ emit_data64(0x0403030203020201, relocInfo::none); + return start; + } + address generate_iota_indices(const char *stub_name) { __ align(CodeEntryAlignment); StubCodeMark mark(this, "StubRoutines", stub_name); @@ -7713,6 +7728,11 @@ address generate_avx_ghash_processBlocks() { StubRoutines::x86::_vector_long_sign_mask = generate_vector_mask("vector_long_sign_mask", 0x8000000000000000); StubRoutines::x86::_vector_iota_indices = generate_iota_indices("iota_indices"); + if (UsePopCountInstruction && VM_Version::supports_avx2() && !VM_Version::supports_avx512_vpopcntdq()) { + // lut implementation influenced by counting 1s algorithm from section 5-1 of Hackers' Delight. + StubRoutines::x86::_vector_popcount_lut = generate_popcount_avx_lut("popcount_lut"); + } + // support for verify_oop (must happen after universe_init) if (VerifyOops) { StubRoutines::_verify_oop_subroutine_entry = generate_verify_oop(); diff --git a/src/hotspot/cpu/x86/stubRoutines_x86.cpp b/src/hotspot/cpu/x86/stubRoutines_x86.cpp index 81362c76bd6..f5a0eb623d0 100644 --- a/src/hotspot/cpu/x86/stubRoutines_x86.cpp +++ b/src/hotspot/cpu/x86/stubRoutines_x86.cpp @@ -59,6 +59,7 @@ address StubRoutines::x86::_vector_double_sign_flip = NULL; address StubRoutines::x86::_vector_byte_perm_mask = NULL; address StubRoutines::x86::_vector_long_sign_mask = NULL; address StubRoutines::x86::_vector_iota_indices = NULL; +address StubRoutines::x86::_vector_popcount_lut = NULL; address StubRoutines::x86::_vector_32_bit_mask = NULL; address StubRoutines::x86::_vector_64_bit_mask = NULL; #ifdef _LP64 diff --git a/src/hotspot/cpu/x86/stubRoutines_x86.hpp b/src/hotspot/cpu/x86/stubRoutines_x86.hpp index e4dd9550ce2..5119dde4fd5 100644 --- a/src/hotspot/cpu/x86/stubRoutines_x86.hpp +++ b/src/hotspot/cpu/x86/stubRoutines_x86.hpp @@ -177,6 +177,7 @@ class x86 { static address _vector_short_shuffle_mask; static address _vector_long_shuffle_mask; static address _vector_iota_indices; + static address _vector_popcount_lut; #ifdef _LP64 static juint _k256_W[]; static address _k256_W_adr; @@ -340,6 +341,9 @@ class x86 { return _vector_iota_indices; } + static address vector_popcount_lut() { + return _vector_popcount_lut; + } #ifdef _LP64 static address k256_W_addr() { return _k256_W_adr; } static address k512_W_addr() { return _k512_W_addr; } diff --git a/src/hotspot/cpu/x86/x86.ad b/src/hotspot/cpu/x86/x86.ad index 7ff67e9a085..ab28ebd5ca5 100644 --- a/src/hotspot/cpu/x86/x86.ad +++ b/src/hotspot/cpu/x86/x86.ad @@ -1405,8 +1405,12 @@ const bool Matcher::match_rule_supported(int opcode) { } break; case Op_PopCountVI: + if (!UsePopCountInstruction || (UseAVX < 2)) { + return false; + } + break; case Op_PopCountVL: - if (!UsePopCountInstruction || !VM_Version::supports_avx512_vpopcntdq()) { + if (!UsePopCountInstruction || (UseAVX <= 2)) { return false; } break; @@ -1861,6 +1865,18 @@ const bool Matcher::match_rule_supported_vector(int opcode, int vlen, BasicType return false; } break; + case Op_PopCountVI: + if (!VM_Version::supports_avx512_vpopcntdq() && + (vlen == 16) && !VM_Version::supports_avx512bw()) { + return false; + } + break; + case Op_PopCountVL: + if (!VM_Version::supports_avx512_vpopcntdq() && + ((vlen <= 4) || ((vlen == 8) && !VM_Version::supports_avx512bw()))) { + return false; + } + break; } return true; // Per default match rules are supported. } @@ -8571,28 +8587,54 @@ instruct vmuladdaddS2I_reg(vec dst, vec src1, vec src2) %{ // --------------------------------- PopCount -------------------------------------- -instruct vpopcountI(vec dst, vec src) %{ +instruct vpopcountI_popcntd(vec dst, vec src) %{ + predicate(VM_Version::supports_avx512_vpopcntdq()); match(Set dst (PopCountVI src)); - format %{ "vpopcntd $dst,$src\t! vector popcount packedI" %} + format %{ "vector_popcount_int $dst, $src\t! vector popcount packedI" %} ins_encode %{ assert(UsePopCountInstruction, "not enabled"); + int vlen_enc = vector_length_encoding(this); + __ vector_popcount_int($dst$$XMMRegister, $src$$XMMRegister, xnoreg, xnoreg, xnoreg, noreg, vlen_enc); + %} + ins_pipe( pipe_slow ); +%} +instruct vpopcountI(vec dst, vec src, vec xtmp1, vec xtmp2, vec xtmp3, rRegP rtmp, rFlagsReg cc) %{ + predicate(!VM_Version::supports_avx512_vpopcntdq()); + match(Set dst (PopCountVI src)); + effect(TEMP dst, TEMP xtmp1, TEMP xtmp2, TEMP xtmp3, TEMP rtmp, KILL cc); + format %{ "vector_popcount_int $dst, $src\t! using $xtmp1, $xtmp2, $xtmp3, and $rtmp as TEMP" %} + ins_encode %{ + assert(UsePopCountInstruction, "not enabled"); int vlen_enc = vector_length_encoding(this); - __ vpopcntd($dst$$XMMRegister, $src$$XMMRegister, vlen_enc); + __ vector_popcount_int($dst$$XMMRegister, $src$$XMMRegister, $xtmp1$$XMMRegister, $xtmp2$$XMMRegister, + $xtmp3$$XMMRegister, $rtmp$$Register, vlen_enc); %} ins_pipe( pipe_slow ); %} -instruct vpopcountL(vec dst, vec src) %{ +instruct vpopcountL_popcntd(vec dst, vec src) %{ + predicate(VM_Version::supports_avx512_vpopcntdq()); match(Set dst (PopCountVL src)); - format %{ "vpopcntq $dst,$src\t! vector popcount packedL" %} + format %{ "vector_popcount_long $dst, $src\t! vector popcount packedL" %} ins_encode %{ assert(UsePopCountInstruction, "not enabled"); - int vlen_enc = vector_length_encoding(this, $src); - __ vpopcntq($dst$$XMMRegister, $src$$XMMRegister, vlen_enc); - __ evpmovqd($dst$$XMMRegister, $dst$$XMMRegister, vlen_enc); + __ vector_popcount_long($dst$$XMMRegister, $src$$XMMRegister, xnoreg, xnoreg, xnoreg, noreg, vlen_enc); + %} + ins_pipe( pipe_slow ); +%} +instruct vpopcountL(vec dst, vec src, vec xtmp1, vec xtmp2, vec xtmp3, rRegP rtmp, rFlagsReg cc) %{ + predicate(!VM_Version::supports_avx512_vpopcntdq()); + match(Set dst (PopCountVL src)); + effect(TEMP dst, TEMP xtmp1, TEMP xtmp2, TEMP xtmp3, TEMP rtmp, KILL cc); + format %{ "vector_popcount_long $dst, $src\t! using $xtmp1, $xtmp2, $xtmp3, and $rtmp as TEMP" %} + ins_encode %{ + assert(UsePopCountInstruction, "not enabled"); + int vlen_enc = vector_length_encoding(this, $src); + __ vector_popcount_long($dst$$XMMRegister, $src$$XMMRegister, $xtmp1$$XMMRegister, $xtmp2$$XMMRegister, + $xtmp3$$XMMRegister, $rtmp$$Register, vlen_enc); %} ins_pipe( pipe_slow ); %} diff --git a/src/hotspot/share/opto/loopTransform.cpp b/src/hotspot/share/opto/loopTransform.cpp index a997439f43f..dccf75c0022 100644 --- a/src/hotspot/share/opto/loopTransform.cpp +++ b/src/hotspot/share/opto/loopTransform.cpp @@ -956,6 +956,8 @@ bool IdealLoopTree::policy_unroll(PhaseIdealLoop *phase) { (stride_con < 0 && ((max_jint + stride_con) < limit_type->_lo))) return false; // overflow + // Rudimentary cost model to estimate loop unrolling + // factor. // Adjust body_size to determine if we unroll or not uint body_size = _body.size(); // Key test to unroll loop in CRC32 java code @@ -968,6 +970,11 @@ bool IdealLoopTree::policy_unroll(PhaseIdealLoop *phase) { case Op_ModL: body_size += 30; break; case Op_DivL: body_size += 30; break; case Op_MulL: body_size += 10; break; + case Op_PopCountVI: + case Op_PopCountVL: { + const TypeVect* vt = n->bottom_type()->is_vect(); + body_size += Matcher::vector_op_pre_select_sz_estimate(n->Opcode(), vt->element_basic_type(), vt->length()); + } break; case Op_StrComp: case Op_StrEquals: case Op_StrIndexOf: diff --git a/test/hotspot/jtreg/compiler/vectorization/TestPopCountVectorLong.java b/test/hotspot/jtreg/compiler/vectorization/TestPopCountVectorLong.java index e80c7cfac95..49e3a428c30 100644 --- a/test/hotspot/jtreg/compiler/vectorization/TestPopCountVectorLong.java +++ b/test/hotspot/jtreg/compiler/vectorization/TestPopCountVectorLong.java @@ -24,9 +24,8 @@ /** * @test * @summary Test vectorization of popcount for Long -* @requires vm.cpu.features ~= ".*avx512dq.*" -* @requires vm.cpu.features ~= ".*vpopcntdq.*" * @requires vm.compiler2.enabled +* @requires vm.cpu.features ~= ".*avx512bw.*" * @requires os.arch=="x86" | os.arch=="i386" | os.arch=="amd64" | os.arch=="x86_64" * @library /test/lib / * @run driver compiler.vectorization.TestPopCountVectorLong -- GitLab From c0e3d107f67a1a333dbe58ae745200d85764c74e Mon Sep 17 00:00:00 2001 From: Thomas Schatzl Date: Mon, 14 Mar 2022 09:02:12 +0000 Subject: [PATCH 229/340] 8283008: KRegister documentation out of date Reviewed-by: dlong, sviswanathan, jiefu, jbhateja --- src/hotspot/cpu/x86/register_x86.hpp | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/hotspot/cpu/x86/register_x86.hpp b/src/hotspot/cpu/x86/register_x86.hpp index b9ac2890240..38ca95c0126 100644 --- a/src/hotspot/cpu/x86/register_x86.hpp +++ b/src/hotspot/cpu/x86/register_x86.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2022, 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 @@ -135,7 +135,7 @@ inline XMMRegister as_XMMRegister(int encoding) { } -// The implementation of XMM registers for the IA32 architecture +// The implementation of XMM registers. class XMMRegisterImpl: public AbstractRegisterImpl { public: enum { @@ -201,11 +201,7 @@ CONSTANT_REGISTER_DECLARATION(XMMRegister, xmm30, (30)); CONSTANT_REGISTER_DECLARATION(XMMRegister, xmm31, (31)); #endif // AMD64 -// Only used by the 32bit stubGenerator. These can't be described by vmreg and hence -// can't be described in oopMaps and therefore can't be used by the compilers (at least -// were deopt might wan't to see them). - -// Use XMMRegister as shortcut +// Use KRegister as shortcut class KRegisterImpl; typedef KRegisterImpl* KRegister; @@ -213,7 +209,7 @@ inline KRegister as_KRegister(int encoding) { return (KRegister)(intptr_t)encoding; } -// The implementation of XMM registers for the IA32 architecture +// The implementation of AVX-3 (AVX-512) opmask registers. class KRegisterImpl : public AbstractRegisterImpl { public: enum { -- GitLab From 01570ca92d234481df2d540027e320b91af415a0 Mon Sep 17 00:00:00 2001 From: Aleksey Shipilev Date: Mon, 14 Mar 2022 09:03:05 +0000 Subject: [PATCH 230/340] 8283017: GHA: Workflows break with update release versions Reviewed-by: erikj, ihse --- .github/workflows/submit.yml | 40 ++++++++++++++++++++++++++---------- 1 file changed, 29 insertions(+), 11 deletions(-) diff --git a/.github/workflows/submit.yml b/.github/workflows/submit.yml index b7018a5fc95..93dd4e4b9f0 100644 --- a/.github/workflows/submit.yml +++ b/.github/workflows/submit.yml @@ -23,6 +23,7 @@ jobs: outputs: should_run: ${{ steps.check_submit.outputs.should_run }} bundle_id: ${{ steps.check_bundle_id.outputs.bundle_id }} + jdk_version: ${{ steps.check_jdk_versions.outputs.jdk_version }} platform_linux_additional: ${{ steps.check_platforms.outputs.platform_linux_additional }} platform_linux_x64: ${{ steps.check_platforms.outputs.platform_linux_x64 }} platform_linux_x86: ${{ steps.check_platforms.outputs.platform_linux_x86 }} @@ -70,6 +71,23 @@ jobs: run: "echo '${{ steps.check_deps.outputs.dependencies }}'" if: steps.check_submit.outputs.should_run != 'false' + - name: Determine full JDK versions + id: check_jdk_versions + shell: bash + run: | + FEATURE=${{ fromJson(steps.check_deps.outputs.dependencies).DEFAULT_VERSION_FEATURE }} + INTERIM=${{ fromJson(steps.check_deps.outputs.dependencies).DEFAULT_VERSION_INTERIM }} + UPDATE=${{ fromJson(steps.check_deps.outputs.dependencies).DEFAULT_VERSION_UPDATE }} + if [ "x${UPDATE}" != "x0" ]; then + V=${FEATURE}.${INTERIM}.${UPDATE} + elif [ "x${INTERIM}" != "x0" ]; then + V={FEATURE}.${INTERIM} + else + V=${FEATURE} + fi + echo "::set-output name=jdk_version::${V}" + if: steps.check_submit.outputs.should_run != 'false' + - name: Determine the jtreg ref to checkout run: "echo JTREG_REF=jtreg-${{ fromJson(steps.check_deps.outputs.dependencies).JTREG_VERSION }}+${{ fromJson(steps.check_deps.outputs.dependencies).JTREG_BUILD }} >> $GITHUB_ENV" if: steps.check_submit.outputs.should_run != 'false' @@ -125,7 +143,7 @@ jobs: artifact: -debug env: - JDK_VERSION: "${{ fromJson(needs.prerequisites.outputs.dependencies).DEFAULT_VERSION_FEATURE }}" + JDK_VERSION: "${{ needs.prerequisites.outputs.jdk_version }}" BOOT_JDK_VERSION: "${{ fromJson(needs.prerequisites.outputs.dependencies).BOOT_JDK_VERSION }}" BOOT_JDK_FILENAME: "${{ fromJson(needs.prerequisites.outputs.dependencies).LINUX_X64_BOOT_JDK_FILENAME }}" BOOT_JDK_URL: "${{ fromJson(needs.prerequisites.outputs.dependencies).LINUX_X64_BOOT_JDK_URL }}" @@ -253,7 +271,7 @@ jobs: artifact: -debug env: - JDK_VERSION: "${{ fromJson(needs.prerequisites.outputs.dependencies).DEFAULT_VERSION_FEATURE }}" + JDK_VERSION: "${{ needs.prerequisites.outputs.jdk_version }}" BOOT_JDK_VERSION: "${{ fromJson(needs.prerequisites.outputs.dependencies).BOOT_JDK_VERSION }}" BOOT_JDK_FILENAME: "${{ fromJson(needs.prerequisites.outputs.dependencies).LINUX_X64_BOOT_JDK_FILENAME }}" BOOT_JDK_URL: "${{ fromJson(needs.prerequisites.outputs.dependencies).LINUX_X64_BOOT_JDK_URL }}" @@ -435,7 +453,7 @@ jobs: gnu-arch: powerpc64le env: - JDK_VERSION: "${{ fromJson(needs.prerequisites.outputs.dependencies).DEFAULT_VERSION_FEATURE }}" + JDK_VERSION: "${{ needs.prerequisites.outputs.jdk_version }}" BOOT_JDK_VERSION: "${{ fromJson(needs.prerequisites.outputs.dependencies).BOOT_JDK_VERSION }}" BOOT_JDK_FILENAME: "${{ fromJson(needs.prerequisites.outputs.dependencies).LINUX_X64_BOOT_JDK_FILENAME }}" BOOT_JDK_URL: "${{ fromJson(needs.prerequisites.outputs.dependencies).LINUX_X64_BOOT_JDK_URL }}" @@ -582,7 +600,7 @@ jobs: # Reduced 32-bit build uses the same boot JDK as 64-bit build env: - JDK_VERSION: "${{ fromJson(needs.prerequisites.outputs.dependencies).DEFAULT_VERSION_FEATURE }}" + JDK_VERSION: "${{ needs.prerequisites.outputs.jdk_version }}" BOOT_JDK_VERSION: "${{ fromJson(needs.prerequisites.outputs.dependencies).BOOT_JDK_VERSION }}" BOOT_JDK_FILENAME: "${{ fromJson(needs.prerequisites.outputs.dependencies).LINUX_X64_BOOT_JDK_FILENAME }}" BOOT_JDK_URL: "${{ fromJson(needs.prerequisites.outputs.dependencies).LINUX_X64_BOOT_JDK_URL }}" @@ -718,7 +736,7 @@ jobs: # Reduced 32-bit build uses the same boot JDK as 64-bit build env: - JDK_VERSION: "${{ fromJson(needs.prerequisites.outputs.dependencies).DEFAULT_VERSION_FEATURE }}" + JDK_VERSION: "${{ needs.prerequisites.outputs.jdk_version }}" BOOT_JDK_VERSION: "${{ fromJson(needs.prerequisites.outputs.dependencies).BOOT_JDK_VERSION }}" BOOT_JDK_FILENAME: "${{ fromJson(needs.prerequisites.outputs.dependencies).LINUX_X64_BOOT_JDK_FILENAME }}" BOOT_JDK_URL: "${{ fromJson(needs.prerequisites.outputs.dependencies).LINUX_X64_BOOT_JDK_URL }}" @@ -869,7 +887,7 @@ jobs: artifact: -debug env: - JDK_VERSION: "${{ fromJson(needs.prerequisites.outputs.dependencies).DEFAULT_VERSION_FEATURE }}" + JDK_VERSION: "${{ needs.prerequisites.outputs.jdk_version }}" BOOT_JDK_VERSION: "${{ fromJson(needs.prerequisites.outputs.dependencies).BOOT_JDK_VERSION }}" BOOT_JDK_FILENAME: "${{ fromJson(needs.prerequisites.outputs.dependencies).WINDOWS_X64_BOOT_JDK_FILENAME }}" BOOT_JDK_URL: "${{ fromJson(needs.prerequisites.outputs.dependencies).WINDOWS_X64_BOOT_JDK_URL }}" @@ -957,7 +975,7 @@ jobs: artifact: -debug env: - JDK_VERSION: "${{ fromJson(needs.prerequisites.outputs.dependencies).DEFAULT_VERSION_FEATURE }}" + JDK_VERSION: "${{ needs.prerequisites.outputs.jdk_version }}" BOOT_JDK_VERSION: "${{ fromJson(needs.prerequisites.outputs.dependencies).BOOT_JDK_VERSION }}" BOOT_JDK_FILENAME: "${{ fromJson(needs.prerequisites.outputs.dependencies).WINDOWS_X64_BOOT_JDK_FILENAME }}" BOOT_JDK_URL: "${{ fromJson(needs.prerequisites.outputs.dependencies).WINDOWS_X64_BOOT_JDK_URL }}" @@ -1108,7 +1126,7 @@ jobs: artifact: -debug env: - JDK_VERSION: "${{ fromJson(needs.prerequisites.outputs.dependencies).DEFAULT_VERSION_FEATURE }}" + JDK_VERSION: "${{ needs.prerequisites.outputs.jdk_version }}" BOOT_JDK_VERSION: "${{ fromJson(needs.prerequisites.outputs.dependencies).BOOT_JDK_VERSION }}" BOOT_JDK_FILENAME: "${{ fromJson(needs.prerequisites.outputs.dependencies).WINDOWS_X64_BOOT_JDK_FILENAME }}" BOOT_JDK_URL: "${{ fromJson(needs.prerequisites.outputs.dependencies).WINDOWS_X64_BOOT_JDK_URL }}" @@ -1283,7 +1301,7 @@ jobs: artifact: -debug env: - JDK_VERSION: "${{ fromJson(needs.prerequisites.outputs.dependencies).DEFAULT_VERSION_FEATURE }}" + JDK_VERSION: "${{ needs.prerequisites.outputs.jdk_version }}" BOOT_JDK_VERSION: "${{ fromJson(needs.prerequisites.outputs.dependencies).BOOT_JDK_VERSION }}" BOOT_JDK_FILENAME: "${{ fromJson(needs.prerequisites.outputs.dependencies).MACOS_X64_BOOT_JDK_FILENAME }}" BOOT_JDK_URL: "${{ fromJson(needs.prerequisites.outputs.dependencies).MACOS_X64_BOOT_JDK_URL }}" @@ -1384,7 +1402,7 @@ jobs: artifact: -debug env: - JDK_VERSION: "${{ fromJson(needs.prerequisites.outputs.dependencies).DEFAULT_VERSION_FEATURE }}" + JDK_VERSION: "${{ needs.prerequisites.outputs.jdk_version }}" BOOT_JDK_VERSION: "${{ fromJson(needs.prerequisites.outputs.dependencies).BOOT_JDK_VERSION }}" BOOT_JDK_FILENAME: "${{ fromJson(needs.prerequisites.outputs.dependencies).MACOS_X64_BOOT_JDK_FILENAME }}" BOOT_JDK_URL: "${{ fromJson(needs.prerequisites.outputs.dependencies).MACOS_X64_BOOT_JDK_URL }}" @@ -1514,7 +1532,7 @@ jobs: artifact: -debug env: - JDK_VERSION: "${{ fromJson(needs.prerequisites.outputs.dependencies).DEFAULT_VERSION_FEATURE }}" + JDK_VERSION: "${{ needs.prerequisites.outputs.jdk_version }}" BOOT_JDK_VERSION: "${{ fromJson(needs.prerequisites.outputs.dependencies).BOOT_JDK_VERSION }}" BOOT_JDK_FILENAME: "${{ fromJson(needs.prerequisites.outputs.dependencies).MACOS_X64_BOOT_JDK_FILENAME }}" BOOT_JDK_URL: "${{ fromJson(needs.prerequisites.outputs.dependencies).MACOS_X64_BOOT_JDK_URL }}" -- GitLab From 5f3d4032f3a8854f7afde28698e66a7b6684aed7 Mon Sep 17 00:00:00 2001 From: Ahmed Muhsin Date: Mon, 14 Mar 2022 09:05:53 +0000 Subject: [PATCH 231/340] 8272735: Add missing SubL node transformations Reviewed-by: thartmann, chagedorn --- src/hotspot/share/opto/subnode.cpp | 6 +- .../c2/irTests/SubINodeIdealizationTests.java | 8 +- .../c2/irTests/SubLNodeIdealizationTests.java | 85 ++++++++++++------- 3 files changed, 64 insertions(+), 35 deletions(-) diff --git a/src/hotspot/share/opto/subnode.cpp b/src/hotspot/share/opto/subnode.cpp index 67b60f74c60..7897a2e99d3 100644 --- a/src/hotspot/share/opto/subnode.cpp +++ b/src/hotspot/share/opto/subnode.cpp @@ -61,7 +61,7 @@ Node* SubNode::Identity(PhaseGVN* phase) { } // Convert "(X+Y) - Y" into X and "(X+Y) - X" into Y - if (in(1)->Opcode() == Op_AddI) { + if (in(1)->Opcode() == Op_AddI || in(1)->Opcode() == Op_AddL) { if (in(1)->in(2) == in(2)) { return in(1)->in(1); } @@ -417,6 +417,10 @@ Node *SubLNode::Ideal(PhaseGVN *phase, bool can_reshape) { if (op2 == Op_AddL && in1 == in2->in(1)) { return new SubLNode(phase->makecon(TypeLong::ZERO), in2->in(2)); } + // Convert "(x-y) - x" into "-y" + if (op1 == Op_SubL && in1->in(1) == in2) { + return new SubLNode(phase->makecon(TypeLong::ZERO), in1->in(2)); + } // Convert "x - (y+x)" into "-y" if (op2 == Op_AddL && in1 == in2->in(2)) { return new SubLNode(phase->makecon(TypeLong::ZERO), in2->in(1)); diff --git a/test/hotspot/jtreg/compiler/c2/irTests/SubINodeIdealizationTests.java b/test/hotspot/jtreg/compiler/c2/irTests/SubINodeIdealizationTests.java index a71710a9664..04a122000e5 100644 --- a/test/hotspot/jtreg/compiler/c2/irTests/SubINodeIdealizationTests.java +++ b/test/hotspot/jtreg/compiler/c2/irTests/SubINodeIdealizationTests.java @@ -112,14 +112,14 @@ public class SubINodeIdealizationTests { @Test @IR(failOn = {IRNode.ADD}) @IR(counts = {IRNode.SUB, "1"}) - // Checks x - (x + y) => -y + // Checks x - (x + y) => 0 - y public int test4(int x, int y) { return x - (x + y); } @Test @IR(counts = {IRNode.SUB, "1"}) - // Checks (x - y) - x => -y + // Checks (x - y) - x => 0 - y public int test5(int x, int y) { return (x - y) - x; } @@ -127,7 +127,7 @@ public class SubINodeIdealizationTests { @Test @IR(failOn = {IRNode.ADD}) @IR(counts = {IRNode.SUB, "1"}) - // Checks x - (y + x) => -y + // Checks x - (y + x) => 0 - y public int test6(int x, int y) { return x - (y + x); } @@ -206,7 +206,7 @@ public class SubINodeIdealizationTests { @Test @IR(failOn = {IRNode.SUB, IRNode.ADD}) - // Checks (x + y) - y => y + // Checks (x + y) - y => x public int test16(int x, int y) { return (x + y) - y; } diff --git a/test/hotspot/jtreg/compiler/c2/irTests/SubLNodeIdealizationTests.java b/test/hotspot/jtreg/compiler/c2/irTests/SubLNodeIdealizationTests.java index bf60147e142..f03a07d84d0 100644 --- a/test/hotspot/jtreg/compiler/c2/irTests/SubLNodeIdealizationTests.java +++ b/test/hotspot/jtreg/compiler/c2/irTests/SubLNodeIdealizationTests.java @@ -27,7 +27,7 @@ import compiler.lib.ir_framework.*; /* * @test - * @bug 8267265 + * @bug 8267265 8272735 * @summary Test that Ideal transformations of SubLNode* are being performed as expected. * @library /test/lib / * @run driver compiler.c2.irTests.SubLNodeIdealizationTests @@ -42,7 +42,8 @@ public class SubLNodeIdealizationTests { "test7", "test8", "test9", "test10", "test11", "test12", "test13", "test14", "test15", - "test16", "test17", "test18"}) + "test16", "test17", "test18", + "test19", "test20", "test21"}) public void runMethod() { long a = RunInfo.getRandom().nextLong(); long b = RunInfo.getRandom().nextLong(); @@ -63,20 +64,23 @@ public class SubLNodeIdealizationTests { Asserts.assertEQ((a + 1) - b , test2(a, b)); Asserts.assertEQ(a - (b + 2021) , test3(a, b)); Asserts.assertEQ(a - (a + b) , test4(a, b)); - Asserts.assertEQ(a - (b + a) , test5(a, b)); - Asserts.assertEQ(0 - (a - b) , test6(a, b)); - Asserts.assertEQ(0 - (a + 2021) , test7(a, b)); - Asserts.assertEQ((a + b) - (a + c), test8(a, b, c)); - Asserts.assertEQ((b + a) - (c + a), test9(a, b, c)); - Asserts.assertEQ((b + a) - (a + c), test10(a, b, c)); - Asserts.assertEQ((a + b) - (c + a), test11(a, b, c)); - Asserts.assertEQ(a - (b - c) , test12(a, b, c)); - Asserts.assertEQ(0 - (a >> 63) , test13(a)); - Asserts.assertEQ(0 - (0 - a) , test14(a)); - Asserts.assertEQ(a*b - a*c , test15(a, b, c)); - Asserts.assertEQ(a*b - b*c , test16(a, b, c)); - Asserts.assertEQ(a*c - b*c , test17(a, b, c)); - Asserts.assertEQ(a*b - c*a , test18(a, b, c)); + Asserts.assertEQ((a - b) - a , test5(a, b)); + Asserts.assertEQ(a - (b + a) , test6(a, b)); + Asserts.assertEQ(0 - (a - b) , test7(a, b)); + Asserts.assertEQ(0 - (a + 2021) , test8(a, b)); + Asserts.assertEQ((a + b) - (a + c), test9(a, b, c)); + Asserts.assertEQ((b + a) - (c + a), test10(a, b, c)); + Asserts.assertEQ((b + a) - (a + c), test11(a, b, c)); + Asserts.assertEQ((a + b) - (c + a), test12(a, b, c)); + Asserts.assertEQ(a - (b - c) , test13(a, b, c)); + Asserts.assertEQ(0 - (a >> 63) , test14(a)); + Asserts.assertEQ(0 - (0 - a) , test15(a)); + Asserts.assertEQ((a + b) - b , test16(a, b)); + Asserts.assertEQ((a + b) - a , test17(a, b)); + Asserts.assertEQ(a*b - a*c , test18(a, b, c)); + Asserts.assertEQ(a*b - b*c , test19(a, b, c)); + Asserts.assertEQ(a*c - b*c , test20(a, b, c)); + Asserts.assertEQ(a*b - c*a , test21(a, b, c)); } @Test @@ -113,18 +117,25 @@ public class SubLNodeIdealizationTests { return x - (x + y); } + @Test + @IR(counts = {IRNode.SUB, "1"}) + // Checks (x - y) - x => 0 - y + public long test5(long x, long y) { + return (x - y) - x; + } + @Test @IR(failOn = {IRNode.ADD}) @IR(counts = {IRNode.SUB, "1"}) // Checks x - (y + x) => 0 - y - public long test5(long x, long y) { + public long test6(long x, long y) { return x - (y + x); } @Test @IR(counts = {IRNode.SUB, "1"}) // Checks 0 - (x - y) => y - x - public long test6(long x, long y) { + public long test7(long x, long y) { return 0 - (x - y); } @@ -132,7 +143,7 @@ public class SubLNodeIdealizationTests { @IR(failOn = {IRNode.ADD}) @IR(counts = {IRNode.SUB, "1"}) // Checks 0 - (x + 2021) => -2021 - x - public long test7(long x, long y) { + public long test8(long x, long y) { return 0 - (x + 2021); } @@ -140,7 +151,7 @@ public class SubLNodeIdealizationTests { @IR(failOn = {IRNode.ADD}) @IR(counts = {IRNode.SUB, "1"}) // Checks (x + a) - (x + b) => a - b; - public long test8(long x, long a, long b) { + public long test9(long x, long a, long b) { return (x + a) - (x + b); } @@ -148,7 +159,7 @@ public class SubLNodeIdealizationTests { @IR(failOn = {IRNode.ADD}) @IR(counts = {IRNode.SUB, "1"}) // Checks (a + x) - (b + x) => a - b - public long test9(long x, long a, long b) { + public long test10(long x, long a, long b) { return (a + x) - (b + x); } @@ -156,7 +167,7 @@ public class SubLNodeIdealizationTests { @IR(failOn = {IRNode.ADD}) @IR(counts = {IRNode.SUB, "1"}) // Checks (a + x) - (x + b) => a - b - public long test10(long x, long a, long b) { + public long test11(long x, long a, long b) { return (a + x) - (x + b); } @@ -164,7 +175,7 @@ public class SubLNodeIdealizationTests { @IR(failOn = {IRNode.ADD}) @IR(counts = {IRNode.SUB, "1"}) // Checks (x + a) - (b + x) => a - b - public long test11(long x, long a, long b) { + public long test12(long x, long a, long b) { return (x + a) - (b + x); } @@ -173,7 +184,7 @@ public class SubLNodeIdealizationTests { IRNode.ADD, "1" }) // Checks a - (b - c) => (a + c) - b - public long test12(long a, long b, long c) { + public long test13(long a, long b, long c) { return a - (b - c); } @@ -182,22 +193,36 @@ public class SubLNodeIdealizationTests { @IR(counts = {IRNode.URSHIFT_L, "1"}) // Checks 0 - (a >> 63) => a >>> 63 // signed ^^ ^^^ unsigned - public long test13(long a) { + public long test14(long a) { return 0 - (a >> 63); } @Test @IR(failOn = {IRNode.SUB}) // Checks 0 - (0 - x) => x - public long test14(long x) { + public long test15(long x) { return 0 - (0 - x); } + @Test + @IR(failOn = {IRNode.SUB, IRNode.ADD}) + // Checks (x + y) - y => x + public long test16(long x, long y) { + return (x + y) - y; + } + + @Test + @IR(failOn = {IRNode.SUB, IRNode.ADD}) + // Checks (x + y) - x => y + public long test17(long x, long y) { + return (x + y) - x; + } + @Test @IR(counts = {IRNode.MUL, "1", IRNode.SUB, "1"}) // Checks "a*b-a*c => a*(b-c) - public long test15(long a, long b, long c) { + public long test18(long a, long b, long c) { return a*b - a*c; } @@ -205,7 +230,7 @@ public class SubLNodeIdealizationTests { @IR(counts = {IRNode.MUL, "1", IRNode.SUB, "1"}) // Checks a*b-b*c => b*(a-c) - public long test16(long a, long b, long c) { + public long test19(long a, long b, long c) { return a*b - b*c; } @@ -213,7 +238,7 @@ public class SubLNodeIdealizationTests { @IR(counts = {IRNode.MUL, "1", IRNode.SUB, "1"}) // Checks a*c-b*c => (a-b)*c - public long test17(long a, long b, long c) { + public long test20(long a, long b, long c) { return a*c - b*c; } @@ -221,7 +246,7 @@ public class SubLNodeIdealizationTests { @IR(counts = {IRNode.MUL, "1", IRNode.SUB, "1"}) // Checks a*b-c*a => a*(b-c) - public long test18(long a, long b, long c) { + public long test21(long a, long b, long c) { return a*b - c*a; } } -- GitLab From ea9eeea8ffea6ed32a270051c6986f4f059943c0 Mon Sep 17 00:00:00 2001 From: Roland Westrelin Date: Mon, 14 Mar 2022 13:59:13 +0000 Subject: [PATCH 232/340] 8281322: C2: always construct strip mined loop initially (even if strip mining is disabled) Reviewed-by: chagedorn, thartmann --- src/hotspot/share/opto/loopnode.cpp | 406 ++++++++++-------- src/hotspot/share/opto/loopnode.hpp | 15 +- .../c2/irTests/TestCountedLoopSafepoint.java | 61 +++ .../c2/irTests/TestLongRangeChecks.java | 4 +- 4 files changed, 296 insertions(+), 190 deletions(-) create mode 100644 test/hotspot/jtreg/compiler/c2/irTests/TestCountedLoopSafepoint.java diff --git a/src/hotspot/share/opto/loopnode.cpp b/src/hotspot/share/opto/loopnode.cpp index 6732c6dee01..39c6ad49563 100644 --- a/src/hotspot/share/opto/loopnode.cpp +++ b/src/hotspot/share/opto/loopnode.cpp @@ -852,7 +852,10 @@ bool PhaseIdealLoop::create_loop_nest(IdealLoopTree* loop, Node_List &old_new) { SafePointNode* safepoint; if (bt == T_INT && head->as_CountedLoop()->is_strip_mined()) { // Loop is strip mined: use the safepoint of the outer strip mined loop - strip_mined_nest_back_to_counted_loop(loop, head, back_control, exit_test, safepoint); + OuterStripMinedLoopNode* outer_loop = head->as_CountedLoop()->outer_loop(); + safepoint = outer_loop->outer_safepoint(); + outer_loop->transform_to_counted_loop(&_igvn, this); + exit_test = head->loopexit(); } else { safepoint = find_safepoint(back_control, x, loop); } @@ -1058,68 +1061,6 @@ bool PhaseIdealLoop::create_loop_nest(IdealLoopTree* loop, Node_List &old_new) { return true; } -// Convert the strip mined loop nest back to a single loop with the safepoint right before the loop exit test -void PhaseIdealLoop::strip_mined_nest_back_to_counted_loop(IdealLoopTree* loop, const BaseCountedLoopNode* head, - Node* back_control, IfNode*& exit_test, - SafePointNode*& safepoint) { - CountedLoopNode* cl = head->as_CountedLoop(); - cl->verify_strip_mined(1); - safepoint = cl->outer_safepoint(); - CountedLoopEndNode* cle = cl->loopexit(); - OuterStripMinedLoopNode* outer_head = cl->outer_loop(); - OuterStripMinedLoopEndNode* outer_end = cl->outer_loop_end(); - - cl->clear_strip_mined(); - - _igvn.replace_input_of(cl, LoopNode::EntryControl, outer_head->in(LoopNode::EntryControl)); - _igvn.replace_input_of(outer_head, LoopNode::EntryControl, C->top()); - set_idom(cl, cl->in(LoopNode::EntryControl), dom_depth(cl)); - - Node* exit_bol = cle->in(1); - Node *zero = _igvn.intcon(0); - set_ctrl(zero, C->root()); - _igvn.replace_input_of(cle, 1, zero); - - _igvn.replace_input_of(outer_end, 1, exit_bol); - - assert(outer_head->in(LoopNode::LoopBackControl)->in(0) == outer_end, ""); - _igvn.replace_input_of(outer_head->in(LoopNode::LoopBackControl), 0, C->top()); - _igvn.replace_input_of(back_control, 0, outer_end); - set_idom(back_control, outer_end, dom_depth(outer_end) + 1); - - Unique_Node_List wq; - wq.push(safepoint); - - IdealLoopTree* outer_loop_ilt = get_loop(outer_head); - - for (uint i = 0; i < wq.size(); i++) { - Node* n = wq.at(i); - for (uint j = 0; j < n->req(); ++j) { - Node* in = n->in(j); - if (in == NULL || in->is_CFG()) { - continue; - } - if (get_loop(get_ctrl(in)) != outer_loop_ilt) { - continue; - } - assert(!loop->_body.contains(in), ""); - loop->_body.push(in); - wq.push(in); - } - } - - set_loop(outer_end, loop); - loop->_body.push(outer_end); - set_loop(safepoint, loop); - loop->_body.push(safepoint); - set_loop(safepoint->in(0), loop); - loop->_body.push(safepoint->in(0)); - - exit_test = outer_end; - - outer_loop_ilt->_tail = C->top(); -} - int PhaseIdealLoop::extract_long_range_checks(const IdealLoopTree* loop, jlong stride_con, int iters_limit, PhiNode* phi, Node_List& range_checks) { const jlong min_iters = 2; @@ -2054,7 +1995,6 @@ bool PhaseIdealLoop::is_counted_loop(Node* x, IdealLoopTree*&loop, BasicType iv_ Node* entry_control = init_control; bool strip_mine_loop = iv_bt == T_INT && - LoopStripMiningIter > 1 && loop->_child == NULL && sfpt != NULL && !loop->_has_call; @@ -2082,7 +2022,7 @@ bool PhaseIdealLoop::is_counted_loop(Node* x, IdealLoopTree*&loop, BasicType iv_ if (iv_bt == T_INT && (LoopStripMiningIter == 0 || strip_mine_loop)) { // Check for immediately preceding SafePoint and remove - if (sfpt != NULL && (LoopStripMiningIter != 0 || is_deleteable_safept(sfpt))) { + if (sfpt != NULL && (strip_mine_loop || is_deleteable_safept(sfpt))) { if (strip_mine_loop) { Node* outer_le = outer_ilt->_tail->in(0); Node* sfpt_clone = sfpt->clone(); @@ -2624,6 +2564,123 @@ BaseCountedLoopNode* BaseCountedLoopNode::make(Node* entry, Node* backedge, Basi return new LongCountedLoopNode(entry, backedge); } +void OuterStripMinedLoopNode::fix_sunk_stores(CountedLoopEndNode* inner_cle, LoopNode* inner_cl, PhaseIterGVN* igvn, + PhaseIdealLoop* iloop) { + Node* cle_out = inner_cle->proj_out(false); + Node* cle_tail = inner_cle->proj_out(true); + if (cle_out->outcnt() > 1) { + // Look for chains of stores that were sunk + // out of the inner loop and are in the outer loop + for (DUIterator_Fast imax, i = cle_out->fast_outs(imax); i < imax; i++) { + Node* u = cle_out->fast_out(i); + if (u->is_Store()) { + int alias_idx = igvn->C->get_alias_index(u->adr_type()); + Node* first = u; + for (;;) { + Node* next = first->in(MemNode::Memory); + if (!next->is_Store() || next->in(0) != cle_out) { + break; + } + assert(igvn->C->get_alias_index(next->adr_type()) == alias_idx, ""); + first = next; + } + Node* last = u; + for (;;) { + Node* next = NULL; + for (DUIterator_Fast jmax, j = last->fast_outs(jmax); j < jmax; j++) { + Node* uu = last->fast_out(j); + if (uu->is_Store() && uu->in(0) == cle_out) { + assert(next == NULL, "only one in the outer loop"); + next = uu; + assert(igvn->C->get_alias_index(next->adr_type()) == alias_idx, ""); + } + } + if (next == NULL) { + break; + } + last = next; + } + Node* phi = NULL; + for (DUIterator_Fast jmax, j = inner_cl->fast_outs(jmax); j < jmax; j++) { + Node* uu = inner_cl->fast_out(j); + if (uu->is_Phi()) { + Node* be = uu->in(LoopNode::LoopBackControl); + if (be->is_Store() && be->in(0) == inner_cl->in(LoopNode::LoopBackControl)) { + assert(igvn->C->get_alias_index(uu->adr_type()) != alias_idx && igvn->C->get_alias_index(uu->adr_type()) != Compile::AliasIdxBot, "unexpected store"); + } + if (be == last || be == first->in(MemNode::Memory)) { + assert(igvn->C->get_alias_index(uu->adr_type()) == alias_idx || igvn->C->get_alias_index(uu->adr_type()) == Compile::AliasIdxBot, "unexpected alias"); + assert(phi == NULL, "only one phi"); + phi = uu; + } + } + } +#ifdef ASSERT + for (DUIterator_Fast jmax, j = inner_cl->fast_outs(jmax); j < jmax; j++) { + Node* uu = inner_cl->fast_out(j); + if (uu->is_Phi() && uu->bottom_type() == Type::MEMORY) { + if (uu->adr_type() == igvn->C->get_adr_type(igvn->C->get_alias_index(u->adr_type()))) { + assert(phi == uu, "what's that phi?"); + } else if (uu->adr_type() == TypePtr::BOTTOM) { + Node* n = uu->in(LoopNode::LoopBackControl); + uint limit = igvn->C->live_nodes(); + uint i = 0; + while (n != uu) { + i++; + assert(i < limit, "infinite loop"); + if (n->is_Proj()) { + n = n->in(0); + } else if (n->is_SafePoint() || n->is_MemBar()) { + n = n->in(TypeFunc::Memory); + } else if (n->is_Phi()) { + n = n->in(1); + } else if (n->is_MergeMem()) { + n = n->as_MergeMem()->memory_at(igvn->C->get_alias_index(u->adr_type())); + } else if (n->is_Store() || n->is_LoadStore() || n->is_ClearArray()) { + n = n->in(MemNode::Memory); + } else { + n->dump(); + ShouldNotReachHere(); + } + } + } + } + } +#endif + if (phi == NULL) { + // If an entire chains was sunk, the + // inner loop has no phi for that memory + // slice, create one for the outer loop + phi = PhiNode::make(inner_cl, first->in(MemNode::Memory), Type::MEMORY, + igvn->C->get_adr_type(igvn->C->get_alias_index(u->adr_type()))); + phi->set_req(LoopNode::LoopBackControl, last); + phi = register_new_node(phi, inner_cl, igvn, iloop); + igvn->replace_input_of(first, MemNode::Memory, phi); + } else { + // Or fix the outer loop fix to include + // that chain of stores. + Node* be = phi->in(LoopNode::LoopBackControl); + assert(!(be->is_Store() && be->in(0) == inner_cl->in(LoopNode::LoopBackControl)), "store on the backedge + sunk stores: unsupported"); + if (be == first->in(MemNode::Memory)) { + if (be == phi->in(LoopNode::LoopBackControl)) { + igvn->replace_input_of(phi, LoopNode::LoopBackControl, last); + } else { + igvn->replace_input_of(be, MemNode::Memory, last); + } + } else { +#ifdef ASSERT + if (be == phi->in(LoopNode::LoopBackControl)) { + assert(phi->in(LoopNode::LoopBackControl) == last, ""); + } else { + assert(be->in(MemNode::Memory) == last, ""); + } +#endif + } + } + } + } + } +} void OuterStripMinedLoopNode::adjust_strip_mined_loop(PhaseIterGVN* igvn) { // Look for the outer & inner strip mined loop, reduce number of @@ -2631,6 +2688,14 @@ void OuterStripMinedLoopNode::adjust_strip_mined_loop(PhaseIterGVN* igvn) { // construct required phi nodes for outer loop. CountedLoopNode* inner_cl = unique_ctrl_out()->as_CountedLoop(); assert(inner_cl->is_strip_mined(), "inner loop should be strip mined"); + if (LoopStripMiningIter == 0) { + remove_outer_loop_and_safepoint(igvn); + return; + } + if (LoopStripMiningIter == 1) { + transform_to_counted_loop(igvn, NULL); + return; + } Node* inner_iv_phi = inner_cl->phi(); if (inner_iv_phi == NULL) { IfNode* outer_le = outer_loop_end(); @@ -2650,11 +2715,7 @@ void OuterStripMinedLoopNode::adjust_strip_mined_loop(PhaseIterGVN* igvn) { assert(iter_estimate > 0, "broken"); if ((jlong)scaled_iters != scaled_iters_long || iter_estimate <= short_scaled_iters) { // Remove outer loop and safepoint (too few iterations) - Node* outer_sfpt = outer_safepoint(); - Node* outer_out = outer_loop_exit(); - igvn->replace_node(outer_out, outer_sfpt->in(0)); - igvn->replace_input_of(outer_sfpt, 0, igvn->C->top()); - inner_cl->clear_strip_mined(); + remove_outer_loop_and_safepoint(igvn); return; } if (iter_estimate <= scaled_iters_long) { @@ -2735,121 +2796,6 @@ void OuterStripMinedLoopNode::adjust_strip_mined_loop(PhaseIterGVN* igvn) { } } } - Node* cle_out = inner_cle->proj_out(false); - if (cle_out->outcnt() > 1) { - // Look for chains of stores that were sunk - // out of the inner loop and are in the outer loop - for (DUIterator_Fast imax, i = cle_out->fast_outs(imax); i < imax; i++) { - Node* u = cle_out->fast_out(i); - if (u->is_Store()) { - Node* first = u; - for(;;) { - Node* next = first->in(MemNode::Memory); - if (!next->is_Store() || next->in(0) != cle_out) { - break; - } - first = next; - } - Node* last = u; - for(;;) { - Node* next = NULL; - for (DUIterator_Fast jmax, j = last->fast_outs(jmax); j < jmax; j++) { - Node* uu = last->fast_out(j); - if (uu->is_Store() && uu->in(0) == cle_out) { - assert(next == NULL, "only one in the outer loop"); - next = uu; - } - } - if (next == NULL) { - break; - } - last = next; - } - Node* phi = NULL; - for (DUIterator_Fast jmax, j = fast_outs(jmax); j < jmax; j++) { - Node* uu = fast_out(j); - if (uu->is_Phi()) { - Node* be = uu->in(LoopNode::LoopBackControl); - if (be->is_Store() && old_new[be->_idx] != NULL) { - assert(false, "store on the backedge + sunk stores: unsupported"); - // drop outer loop - IfNode* outer_le = outer_loop_end(); - Node* iff = igvn->transform(new IfNode(outer_le->in(0), outer_le->in(1), outer_le->_prob, outer_le->_fcnt)); - igvn->replace_node(outer_le, iff); - inner_cl->clear_strip_mined(); - return; - } - if (be == last || be == first->in(MemNode::Memory)) { - assert(phi == NULL, "only one phi"); - phi = uu; - } - } - } -#ifdef ASSERT - for (DUIterator_Fast jmax, j = fast_outs(jmax); j < jmax; j++) { - Node* uu = fast_out(j); - if (uu->is_Phi() && uu->bottom_type() == Type::MEMORY) { - if (uu->adr_type() == igvn->C->get_adr_type(igvn->C->get_alias_index(u->adr_type()))) { - assert(phi == uu, "what's that phi?"); - } else if (uu->adr_type() == TypePtr::BOTTOM) { - Node* n = uu->in(LoopNode::LoopBackControl); - uint limit = igvn->C->live_nodes(); - uint i = 0; - while (n != uu) { - i++; - assert(i < limit, "infinite loop"); - if (n->is_Proj()) { - n = n->in(0); - } else if (n->is_SafePoint() || n->is_MemBar()) { - n = n->in(TypeFunc::Memory); - } else if (n->is_Phi()) { - n = n->in(1); - } else if (n->is_MergeMem()) { - n = n->as_MergeMem()->memory_at(igvn->C->get_alias_index(u->adr_type())); - } else if (n->is_Store() || n->is_LoadStore() || n->is_ClearArray()) { - n = n->in(MemNode::Memory); - } else { - n->dump(); - ShouldNotReachHere(); - } - } - } - } - } -#endif - if (phi == NULL) { - // If the an entire chains was sunk, the - // inner loop has no phi for that memory - // slice, create one for the outer loop - phi = PhiNode::make(this, first->in(MemNode::Memory), Type::MEMORY, - igvn->C->get_adr_type(igvn->C->get_alias_index(u->adr_type()))); - phi->set_req(LoopNode::LoopBackControl, last); - phi = igvn->transform(phi); - igvn->replace_input_of(first, MemNode::Memory, phi); - } else { - // Or fix the outer loop fix to include - // that chain of stores. - Node* be = phi->in(LoopNode::LoopBackControl); - assert(!(be->is_Store() && old_new[be->_idx] != NULL), "store on the backedge + sunk stores: unsupported"); - if (be == first->in(MemNode::Memory)) { - if (be == phi->in(LoopNode::LoopBackControl)) { - igvn->replace_input_of(phi, LoopNode::LoopBackControl, last); - } else { - igvn->replace_input_of(be, MemNode::Memory, last); - } - } else { -#ifdef ASSERT - if (be == phi->in(LoopNode::LoopBackControl)) { - assert(phi->in(LoopNode::LoopBackControl) == last, ""); - } else { - assert(be->in(MemNode::Memory) == last, ""); - } -#endif - } - } - } - } - } if (iv_phi != NULL) { // Now adjust the inner loop's exit condition @@ -2898,6 +2844,96 @@ void OuterStripMinedLoopNode::adjust_strip_mined_loop(PhaseIterGVN* igvn) { } } +void OuterStripMinedLoopNode::transform_to_counted_loop(PhaseIterGVN* igvn, PhaseIdealLoop* iloop) { + CountedLoopNode* inner_cl = unique_ctrl_out()->as_CountedLoop(); + CountedLoopEndNode* cle = inner_cl->loopexit(); + Node* inner_test = cle->in(1); + IfNode* outer_le = outer_loop_end(); + CountedLoopEndNode* inner_cle = inner_cl->loopexit(); + Node* safepoint = outer_safepoint(); + + fix_sunk_stores(inner_cle, inner_cl, igvn, iloop); + + // make counted loop exit test always fail + ConINode* zero = igvn->intcon(0); + if (iloop != NULL) { + iloop->set_ctrl(zero, igvn->C->root()); + } + igvn->replace_input_of(cle, 1, zero); + // replace outer loop end with CountedLoopEndNode with formers' CLE's exit test + Node* new_end = new CountedLoopEndNode(outer_le->in(0), inner_test, cle->_prob, cle->_fcnt); + register_control(new_end, inner_cl, outer_le->in(0), igvn, iloop); + if (iloop == NULL) { + igvn->replace_node(outer_le, new_end); + } else { + iloop->lazy_replace(outer_le, new_end); + } + // the backedge of the inner loop must be rewired to the new loop end + Node* backedge = cle->proj_out(true); + igvn->replace_input_of(backedge, 0, new_end); + if (iloop != NULL) { + iloop->set_idom(backedge, new_end, iloop->dom_depth(new_end) + 1); + } + // make the outer loop go away + igvn->replace_input_of(in(LoopBackControl), 0, igvn->C->top()); + igvn->replace_input_of(this, LoopBackControl, igvn->C->top()); + inner_cl->clear_strip_mined(); + if (iloop != NULL) { + Unique_Node_List wq; + wq.push(safepoint); + + IdealLoopTree* outer_loop_ilt = iloop->get_loop(this); + IdealLoopTree* loop = iloop->get_loop(inner_cl); + + for (uint i = 0; i < wq.size(); i++) { + Node* n = wq.at(i); + for (uint j = 0; j < n->req(); ++j) { + Node* in = n->in(j); + if (in == NULL || in->is_CFG()) { + continue; + } + if (iloop->get_loop(iloop->get_ctrl(in)) != outer_loop_ilt) { + continue; + } + assert(!loop->_body.contains(in), ""); + loop->_body.push(in); + wq.push(in); + } + } + iloop->set_loop(safepoint, loop); + loop->_body.push(safepoint); + iloop->set_loop(safepoint->in(0), loop); + loop->_body.push(safepoint->in(0)); + outer_loop_ilt->_tail = igvn->C->top(); + } +} + +void OuterStripMinedLoopNode::remove_outer_loop_and_safepoint(PhaseIterGVN* igvn) const { + CountedLoopNode* inner_cl = unique_ctrl_out()->as_CountedLoop(); + Node* outer_sfpt = outer_safepoint(); + Node* outer_out = outer_loop_exit(); + igvn->replace_node(outer_out, outer_sfpt->in(0)); + igvn->replace_input_of(outer_sfpt, 0, igvn->C->top()); + inner_cl->clear_strip_mined(); +} + +Node* OuterStripMinedLoopNode::register_new_node(Node* node, LoopNode* ctrl, PhaseIterGVN* igvn, PhaseIdealLoop* iloop) { + if (iloop == NULL) { + return igvn->transform(node); + } + iloop->register_new_node(node, ctrl); + return node; +} + +Node* OuterStripMinedLoopNode::register_control(Node* node, Node* loop, Node* idom, PhaseIterGVN* igvn, + PhaseIdealLoop* iloop) { + if (iloop == NULL) { + return igvn->transform(node); + } + iloop->register_control(node, iloop->get_loop(loop), idom); + return node; +} + const Type* OuterStripMinedLoopEndNode::Value(PhaseGVN* phase) const { if (!in(0)) return Type::TOP; if (phase->type(in(0)) == Type::TOP) diff --git a/src/hotspot/share/opto/loopnode.hpp b/src/hotspot/share/opto/loopnode.hpp index 606d9c46331..c81180fa7b8 100644 --- a/src/hotspot/share/opto/loopnode.hpp +++ b/src/hotspot/share/opto/loopnode.hpp @@ -546,7 +546,8 @@ class LoopLimitNode : public Node { // Support for strip mining class OuterStripMinedLoopNode : public LoopNode { private: - CountedLoopNode* inner_loop() const; + static void fix_sunk_stores(CountedLoopEndNode* inner_cle, LoopNode* inner_cl, PhaseIterGVN* igvn, PhaseIdealLoop* iloop); + public: OuterStripMinedLoopNode(Compile* C, Node *entry, Node *backedge) : LoopNode(entry, backedge) { @@ -562,6 +563,15 @@ public: virtual IfFalseNode* outer_loop_exit() const; virtual SafePointNode* outer_safepoint() const; void adjust_strip_mined_loop(PhaseIterGVN* igvn); + + void remove_outer_loop_and_safepoint(PhaseIterGVN* igvn) const; + + void transform_to_counted_loop(PhaseIterGVN* igvn, PhaseIdealLoop* iloop); + + static Node* register_new_node(Node* node, LoopNode* ctrl, PhaseIterGVN* igvn, PhaseIdealLoop* iloop); + + Node* register_control(Node* node, Node* loop, Node* idom, PhaseIterGVN* igvn, + PhaseIdealLoop* iloop); }; class OuterStripMinedLoopEndNode : public IfNode { @@ -1662,9 +1672,6 @@ public: bool safe_for_if_replacement(const Node* dom) const; - void strip_mined_nest_back_to_counted_loop(IdealLoopTree* loop, const BaseCountedLoopNode* head, Node* back_control, - IfNode*&exit_test, SafePointNode*&safepoint); - void push_pinned_nodes_thru_region(IfNode* dom_if, Node* region); bool try_merge_identical_ifs(Node* n); diff --git a/test/hotspot/jtreg/compiler/c2/irTests/TestCountedLoopSafepoint.java b/test/hotspot/jtreg/compiler/c2/irTests/TestCountedLoopSafepoint.java new file mode 100644 index 00000000000..a56fd1592fd --- /dev/null +++ b/test/hotspot/jtreg/compiler/c2/irTests/TestCountedLoopSafepoint.java @@ -0,0 +1,61 @@ +/* + * Copyright (c) 2022, Red Hat, Inc. 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 compiler.c2.irTests; + +import compiler.lib.ir_framework.*; + +/* + * @test + * bug 8281322 + * @summary check counted loop is properly constructed with/without safepoint + * @library /test/lib / + * @run driver compiler.c2.irTests.TestCountedLoopSafepoint + */ + +public class TestCountedLoopSafepoint { + public static void main(String[] args) { + TestFramework.runWithFlags("-XX:LoopMaxUnroll=1", "-XX:-UseCountedLoopSafepoints"); + TestFramework.runWithFlags("-XX:LoopMaxUnroll=1", "-XX:+UseCountedLoopSafepoints", "-XX:LoopStripMiningIter=1"); + TestFramework.runWithFlags("-XX:LoopMaxUnroll=1", "-XX:+UseCountedLoopSafepoints", "-XX:LoopStripMiningIter=1000"); + } + + @Test + @IR(counts = { IRNode.COUNTEDLOOP, "1" }) + @IR(applyIf = { "LoopStripMiningIter", "0" }, failOn = { IRNode.SAFEPOINT, IRNode.OUTERSTRIPMINEDLOOP }) + @IR(applyIf = { "LoopStripMiningIter", "1" }, counts = { IRNode.SAFEPOINT, "1" }, failOn = { IRNode.OUTERSTRIPMINEDLOOP }) + @IR(applyIf = { "LoopStripMiningIter", "> 1" }, counts = { IRNode.SAFEPOINT, "1", IRNode.OUTERSTRIPMINEDLOOP, "1" }) + public static float test(int start, int stop) { + float v = 1; + for (int i = start; i < stop; i++) { + v *= 2; + } + return v; + } + + @Run(test = "test") + private void testRunner() { + test(0, 100); + } + +} diff --git a/test/hotspot/jtreg/compiler/c2/irTests/TestLongRangeChecks.java b/test/hotspot/jtreg/compiler/c2/irTests/TestLongRangeChecks.java index e84f3062f14..87bfd943888 100644 --- a/test/hotspot/jtreg/compiler/c2/irTests/TestLongRangeChecks.java +++ b/test/hotspot/jtreg/compiler/c2/irTests/TestLongRangeChecks.java @@ -36,7 +36,9 @@ import java.util.Objects; public class TestLongRangeChecks { public static void main(String[] args) { - TestFramework.run(); + TestFramework.runWithFlags("-XX:-UseCountedLoopSafepoints"); + TestFramework.runWithFlags("-XX:+UseCountedLoopSafepoints", "-XX:LoopStripMiningIter=1"); + TestFramework.runWithFlags("-XX:+UseCountedLoopSafepoints", "-XX:LoopStripMiningIter=1000"); } -- GitLab From 08573cc3b2370a697a7bd4ad0665ee20ae148d39 Mon Sep 17 00:00:00 2001 From: Zdenek Zambersky Date: Mon, 14 Mar 2022 14:21:58 +0000 Subject: [PATCH 233/340] 8282529: Fix API Note in javadoc for javax.net.ssl.SSLSocket Reviewed-by: wetmore, xuelei --- .../classes/javax/net/ssl/SSLSocket.java | 24 ++++++++++--------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/src/java.base/share/classes/javax/net/ssl/SSLSocket.java b/src/java.base/share/classes/javax/net/ssl/SSLSocket.java index b2c912c3b65..e5cdd3741b9 100644 --- a/src/java.base/share/classes/javax/net/ssl/SSLSocket.java +++ b/src/java.base/share/classes/javax/net/ssl/SSLSocket.java @@ -174,17 +174,19 @@ import java.util.function.BiFunction; * @apiNote * When the connection is no longer needed, the client and server * applications should each close both sides of their respective connection. - * For {@code SSLSocket} objects, for example, an application can call - * {@link Socket#shutdownOutput()} or {@link java.io.OutputStream#close()} - * for output stream close and call {@link Socket#shutdownInput()} or - * {@link java.io.InputStream#close()} for input stream close. Note that - * in some cases, closing the input stream may depend on the peer's output - * stream being closed first. If the connection is not closed in an orderly - * manner (for example {@link Socket#shutdownInput()} is called before the - * peer's write closure notification has been received), exceptions may - * be raised to indicate that an error has occurred. Once an - * {@code SSLSocket} is closed, it is not reusable: a new {@code SSLSocket} - * must be created. + * This can be done either in one shot by calling {@link Socket#close()}, + * or by closing each side individually using + * {@link Socket#shutdownOutput()} / {@link Socket#shutdownInput()} which is + * useful for protocol versions that can support half-closed connections. + * + *

    Note that in some cases, closing the input stream may depend on the + * peer's output stream being closed first. If the connection is not closed + * in an orderly manner (for example {@link Socket#shutdownInput()} is called + * before the peer's write closure notification has been received), exceptions + * may be raised to indicate that an error has occurred. + * + *

    Once an {@code SSLSocket} is closed, it is not reusable: a new + * {@code SSLSocket} must be created. * * @see java.net.Socket * @see SSLServerSocket -- GitLab From 13cebffe618255ae29310c95fd1b91576e576751 Mon Sep 17 00:00:00 2001 From: Brian Burkhalter Date: Mon, 14 Mar 2022 16:10:15 +0000 Subject: [PATCH 234/340] 8058924: FileReader(String) documentation is insufficient Reviewed-by: naoto, lancea --- src/java.base/share/classes/java/io/package-info.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/java.base/share/classes/java/io/package-info.java b/src/java.base/share/classes/java/io/package-info.java index 1c41f9835e6..81f61412eed 100644 --- a/src/java.base/share/classes/java/io/package-info.java +++ b/src/java.base/share/classes/java/io/package-info.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2022, 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 @@ -27,10 +27,14 @@ * Provides for system input and output through data streams, * serialization and the file system. * - * Unless otherwise noted, passing a null argument to a constructor or + * Unless otherwise noted, passing a {@code null} argument to a constructor or * method in any class or interface in this package will cause a * {@code NullPointerException} to be thrown. * + * A pathname string passed as a {@code String} argument to a + * constructor or method in any class or interface in this package will be + * interpreted as described in the class specification of {@link File}. + * *

    Object Serialization

    *

    Warning: Deserialization of untrusted data is inherently dangerous * and should be avoided. Untrusted data should be carefully validated according to the -- GitLab From c96085eaab1f6b21e084b94fcc619d090f0afc97 Mon Sep 17 00:00:00 2001 From: Naoto Sato Date: Mon, 14 Mar 2022 16:28:15 +0000 Subject: [PATCH 235/340] 8282929: Localized monetary symbols are not reflected in `toLocalizedPattern` return value Reviewed-by: joehw, lancea --- .../classes/java/text/DecimalFormat.java | 12 ++-- .../DecimalFormat/ToLocalizedPatternTest.java | 61 +++++++++++++++++++ 2 files changed, 68 insertions(+), 5 deletions(-) create mode 100644 test/jdk/java/text/Format/DecimalFormat/ToLocalizedPatternTest.java diff --git a/src/java.base/share/classes/java/text/DecimalFormat.java b/src/java.base/share/classes/java/text/DecimalFormat.java index ea125b7d14b..094a5258b09 100644 --- a/src/java.base/share/classes/java/text/DecimalFormat.java +++ b/src/java.base/share/classes/java/text/DecimalFormat.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2022, 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 @@ -3210,16 +3210,18 @@ public class DecimalFormat extends NumberFormat { for (i = digitCount; i > 0; --i) { if (i != digitCount && isGroupingUsed() && groupingSize != 0 && i % groupingSize == 0) { - result.append(localized ? symbols.getGroupingSeparator() : - PATTERN_GROUPING_SEPARATOR); + result.append(localized ? + (isCurrencyFormat ? symbols.getMonetaryGroupingSeparator() : symbols.getGroupingSeparator()) : + PATTERN_GROUPING_SEPARATOR); } result.append(i <= getMinimumIntegerDigits() ? (localized ? symbols.getZeroDigit() : PATTERN_ZERO_DIGIT) : (localized ? symbols.getDigit() : PATTERN_DIGIT)); } if (getMaximumFractionDigits() > 0 || decimalSeparatorAlwaysShown) - result.append(localized ? symbols.getDecimalSeparator() : - PATTERN_DECIMAL_SEPARATOR); + result.append(localized ? + (isCurrencyFormat ? symbols.getMonetaryDecimalSeparator() : symbols.getDecimalSeparator()) : + PATTERN_DECIMAL_SEPARATOR); for (i = 0; i < getMaximumFractionDigits(); ++i) { if (i < getMinimumFractionDigits()) { result.append(localized ? symbols.getZeroDigit() : diff --git a/test/jdk/java/text/Format/DecimalFormat/ToLocalizedPatternTest.java b/test/jdk/java/text/Format/DecimalFormat/ToLocalizedPatternTest.java new file mode 100644 index 00000000000..6d8ab9c9a0c --- /dev/null +++ b/test/jdk/java/text/Format/DecimalFormat/ToLocalizedPatternTest.java @@ -0,0 +1,61 @@ +/* + * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 8282929 + * @summary Verifies that toLocalizedPattern() method correctly returns + * monetary symbols in a currency formatter + * @run testng ToLocalizedPatternTest + */ + +import static org.testng.Assert.assertEquals; +import org.testng.annotations.Test; + +import java.text.DecimalFormat; +import java.text.DecimalFormatSymbols; +import java.util.Locale; + +@Test +public class ToLocalizedPatternTest { + private static final char MONETARY_GROUPING = 'g'; + private static final char MONETARY_DECIMAL = 'd'; + + public void testToLocalizedPattern() { + var dfs = new DecimalFormatSymbols(Locale.US); + + // Customize the decimal format symbols + dfs.setMonetaryGroupingSeparator(MONETARY_GROUPING); + dfs.setMonetaryDecimalSeparator(MONETARY_DECIMAL); + + // create a currency formatter + var cf = (DecimalFormat)DecimalFormat.getCurrencyInstance(Locale.US); + cf.setDecimalFormatSymbols(dfs); + + // check + assertEquals(cf.toLocalizedPattern(), + cf.toPattern() + .replace(',', MONETARY_GROUPING) + .replace('.', MONETARY_DECIMAL)); + } +} -- GitLab From 7833667f0e2151fc56c7c1533015f004f02f7ab2 Mon Sep 17 00:00:00 2001 From: Emanuel Peter Date: Mon, 14 Mar 2022 17:35:09 +0000 Subject: [PATCH 236/340] 8282881: Print exception message in VM crash with -XX:AbortVMOnException Reviewed-by: dholmes, hseigel --- src/hotspot/share/utilities/exceptions.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/hotspot/share/utilities/exceptions.cpp b/src/hotspot/share/utilities/exceptions.cpp index 4ddc8e18ae6..1b56009a27d 100644 --- a/src/hotspot/share/utilities/exceptions.cpp +++ b/src/hotspot/share/utilities/exceptions.cpp @@ -538,7 +538,11 @@ void Exceptions::debug_check_abort(const char *value_string, const char* message strstr(value_string, AbortVMOnException)) { if (AbortVMOnExceptionMessage == NULL || (message != NULL && strstr(message, AbortVMOnExceptionMessage))) { - fatal("Saw %s, aborting", value_string); + if (message == NULL) { + fatal("Saw %s, aborting", value_string); + } else { + fatal("Saw %s: %s, aborting", value_string, message); + } } } } -- GitLab From 70bd57ed3544cdb41029d425507ba4b9b35c8cdb Mon Sep 17 00:00:00 2001 From: Carter Kozak Date: Mon, 14 Mar 2022 17:54:19 +0000 Subject: [PATCH 237/340] 8283049: Fix non-singleton LoggerFinder error message: s/on/one Reviewed-by: dfuchs --- .../classes/jdk/internal/logger/LoggerFinderLoader.java | 4 ++-- .../LoggerFinderLoaderTest/LoggerFinderLoaderTest.java | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/java.base/share/classes/jdk/internal/logger/LoggerFinderLoader.java b/src/java.base/share/classes/jdk/internal/logger/LoggerFinderLoader.java index dbf4ccca128..4f009973e27 100644 --- a/src/java.base/share/classes/jdk/internal/logger/LoggerFinderLoader.java +++ b/src/java.base/share/classes/jdk/internal/logger/LoggerFinderLoader.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2022, 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 @@ -129,7 +129,7 @@ public final class LoggerFinderLoader { result = iterator.next(); if (iterator.hasNext() && ensureSingletonProvider()) { throw new ServiceConfigurationError( - "More than on LoggerFinder implementation"); + "More than one LoggerFinder implementation"); } } else { result = loadDefaultImplementation(); diff --git a/test/jdk/java/lang/System/LoggerFinder/internal/LoggerFinderLoaderTest/LoggerFinderLoaderTest.java b/test/jdk/java/lang/System/LoggerFinder/internal/LoggerFinderLoaderTest/LoggerFinderLoaderTest.java index 8f1ce47fb07..d7ac2286678 100644 --- a/test/jdk/java/lang/System/LoggerFinder/internal/LoggerFinderLoaderTest/LoggerFinderLoaderTest.java +++ b/test/jdk/java/lang/System/LoggerFinder/internal/LoggerFinderLoaderTest/LoggerFinderLoaderTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2022, 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 @@ -53,7 +53,7 @@ import java.util.concurrent.atomic.AtomicReference; /** * @test - * @bug 8140364 8189291 + * @bug 8140364 8189291 8283049 * @summary JDK implementation specific unit test for LoggerFinderLoader. * Tests the behavior of LoggerFinderLoader with respect to the * value of the internal diagnosability switches. Also test the @@ -230,7 +230,7 @@ public class LoggerFinderLoaderTest { throw new RuntimeException("Expected message not found. Error stream contained: " + warning); } } else if (singleton) { - if (!warning.contains("java.util.ServiceConfigurationError: More than on LoggerFinder implementation")) { + if (!warning.contains("java.util.ServiceConfigurationError: More than one LoggerFinder implementation")) { throw new RuntimeException("Expected message not found. Error stream contained: " + warning); } } -- GitLab From f66070b00d4311c6e3a6fbf38956fa2d5da5fada Mon Sep 17 00:00:00 2001 From: Phil Race Date: Mon, 14 Mar 2022 18:05:38 +0000 Subject: [PATCH 238/340] 8282577: ICC_Profile.setData(int, byte[]) invalidates the profile Reviewed-by: serb --- src/java.desktop/share/native/liblcms/LCMS.c | 27 ++++--- .../ICC_ColorSpace/SetTagDataValidation.java | 75 +++++++++++++++++++ .../java/awt/color/ICC_Profile/MTGetData.java | 2 + 3 files changed, 95 insertions(+), 9 deletions(-) create mode 100644 test/jdk/java/awt/color/ICC_ColorSpace/SetTagDataValidation.java diff --git a/src/java.desktop/share/native/liblcms/LCMS.c b/src/java.desktop/share/native/liblcms/LCMS.c index 27c23c6d92f..06a7eb26140 100644 --- a/src/java.desktop/share/native/liblcms/LCMS.c +++ b/src/java.desktop/share/native/liblcms/LCMS.c @@ -734,34 +734,43 @@ static cmsHPROFILE _writeCookedTag(const cmsHPROFILE pfTarget, // now we have all tags moved to the new profile. // do some sanity checks: write it to a memory buffer and read again. + void* buf = NULL; if (cmsSaveProfileToMem(p, NULL, &pfSize)) { - void* buf = malloc(pfSize); + buf = malloc(pfSize); if (buf != NULL) { // load raw profile data into the buffer if (cmsSaveProfileToMem(p, buf, &pfSize)) { pfSanity = cmsOpenProfileFromMem(buf, pfSize); } - free(buf); } } + cmsCloseProfile(p); // No longer needed. + if (pfSanity == NULL) { // for some reason, we failed to save and read the updated profile // It likely indicates that the profile is not correct, so we report // a failure here. - cmsCloseProfile(p); - p = NULL; + free(buf); + return NULL; } else { // do final check whether we can read and handle the target tag. const void* pTag = cmsReadTag(pfSanity, sig); if (pTag == NULL) { // the tag can not be cooked - cmsCloseProfile(p); - p = NULL; + free(buf); + cmsCloseProfile(pfSanity); + return NULL; } + // The profile we used for sanity checking needs to be returned + // since the one we updated is raw - not cooked. + // Except we want to re-open it since the call to cmsReadTag() + // means we may not get back the same bytes as we set. + // Whilst this may change later anyway, we can at least prevent + // it from happening immediately. cmsCloseProfile(pfSanity); - pfSanity = NULL; + pfSanity = cmsOpenProfileFromMem(buf, pfSize); + free(buf); + return pfSanity; } - - return p; } diff --git a/test/jdk/java/awt/color/ICC_ColorSpace/SetTagDataValidation.java b/test/jdk/java/awt/color/ICC_ColorSpace/SetTagDataValidation.java new file mode 100644 index 00000000000..92faced75ba --- /dev/null +++ b/test/jdk/java/awt/color/ICC_ColorSpace/SetTagDataValidation.java @@ -0,0 +1,75 @@ +/* + * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/** + * @test + * @bug 8282577 + * @summary Verify setting data for a tag doesn't invalidate the profile. + */ + +import java.awt.color.ColorSpace; +import java.awt.color.ICC_ColorSpace; +import java.awt.color.ICC_Profile; + +public final class SetTagDataValidation { + + public static void main(String[] args) throws Exception { + + ICC_Profile srgb = ICC_Profile.getInstance(ColorSpace.CS_sRGB); + // Create a new profile, using the srgb data but private to us. + ICC_Profile icc = ICC_Profile.getInstance(srgb.getData()); + + // Get data for some tag, which one isn't important so long as it exists + int tag = ICC_Profile.icSigBlueColorantTag; + byte[] tagData = icc.getData(tag); + if (tagData == null) { + throw new RuntimeException("No data for tag"); + } + // Set the data to be the SAME data which ought to be a harmless no-op + icc.setData(tag, tagData); + + // Perform a color conversion - from rgb to rgb but it doesn't matter + // we just need to verify the op is applied and results are sane. + + ColorSpace cs = new ICC_ColorSpace(icc); + float[] in = new float[3]; + in[0] = 0.4f; + in[1] = 0.5f; + in[2] = 0.6f; + + // the toRGB op previously threw an exception - or crashed + float[] out = cs.toRGB(in); + // If we get this far let's validate the results. + if (out == null || out.length !=3) { + throw new RuntimeException("out array invalid"); + } + for (int i=0;i 0.01)) { + throw new RuntimeException("Inaccurate no-op conversion"); + } + } + } +} diff --git a/test/jdk/java/awt/color/ICC_Profile/MTGetData.java b/test/jdk/java/awt/color/ICC_Profile/MTGetData.java index 5b2572e14f1..7d634cb0f4a 100644 --- a/test/jdk/java/awt/color/ICC_Profile/MTGetData.java +++ b/test/jdk/java/awt/color/ICC_Profile/MTGetData.java @@ -23,6 +23,7 @@ import java.awt.color.ColorSpace; import java.awt.color.ICC_Profile; +import java.awt.color.CMMException; import java.lang.reflect.Field; import java.lang.reflect.Modifier; import java.util.ArrayList; @@ -103,6 +104,7 @@ public final class MTGetData { icc.setData(tag, data2); } } catch (IllegalArgumentException ignored) { + System.err.println("Ignoring " + ignored); } catch (Throwable throwable) { throwable.printStackTrace(); failed = true; -- GitLab From 5bf6a7f7d78506118ded0f0bf6383b0825366619 Mon Sep 17 00:00:00 2001 From: Chris Plummer Date: Mon, 14 Mar 2022 18:15:40 +0000 Subject: [PATCH 239/340] 8282691: add jdb "-R" option for passing any argument to the launched debuggee process Reviewed-by: alanb, kevinw --- .../com/sun/tools/example/debug/tty/TTY.java | 4 +++- .../tools/example/debug/tty/TTYResources.java | 3 ++- src/jdk.jdi/share/man/jdb.1 | 16 +++++++++++++--- test/jdk/com/sun/jdi/JdbOptions.java | 18 +++++++++++++++++- 4 files changed, 35 insertions(+), 6 deletions(-) diff --git a/src/jdk.jdi/share/classes/com/sun/tools/example/debug/tty/TTY.java b/src/jdk.jdi/share/classes/com/sun/tools/example/debug/tty/TTY.java index 6e1ddcb1b84..9373bc9e0e0 100644 --- a/src/jdk.jdi/share/classes/com/sun/tools/example/debug/tty/TTY.java +++ b/src/jdk.jdi/share/classes/com/sun/tools/example/debug/tty/TTY.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2022, 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 @@ -993,6 +993,8 @@ public class TTY implements EventNotifier { token.startsWith("-ss") || token.startsWith("-oss") ) { javaArgs = addArgument(javaArgs, token); + } else if (token.startsWith("-R")) { + javaArgs = addArgument(javaArgs, token.substring(2)); } else if (token.equals("-tclassic")) { usageError("Classic VM no longer supported."); return; diff --git a/src/jdk.jdi/share/classes/com/sun/tools/example/debug/tty/TTYResources.java b/src/jdk.jdi/share/classes/com/sun/tools/example/debug/tty/TTYResources.java index adec7aa98cf..e7090c8c8c8 100644 --- a/src/jdk.jdi/share/classes/com/sun/tools/example/debug/tty/TTYResources.java +++ b/src/jdk.jdi/share/classes/com/sun/tools/example/debug/tty/TTYResources.java @@ -477,8 +477,9 @@ public class TTYResources extends java.util.ListResourceBundle { " -dbgtrace [flags] print info for debugging {0}\n" + " -tclient run the application in the HotSpot(TM) Client Compiler\n" + " -tserver run the application in the HotSpot(TM) Server Compiler\n" + + " -R

    ",2===Ut.childNodes.length),S.parseHTML=function(e,t,n){return"string"!=typeof e?[]:("boolean"==typeof t&&(n=t,t=!1),t||(y.createHTMLDocument?((r=(t=E.implementation.createHTMLDocument("")).createElement("base")).href=E.location.href,t.head.appendChild(r)):t=E),o=!n&&[],(i=N.exec(e))?[t.createElement(i[1])]:(i=xe([e],t,o),o&&o.length&&S(o).remove(),S.merge([],i.childNodes)));var r,i,o},S.fn.load=function(e,t,n){var r,i,o,a=this,s=e.indexOf(" ");return-1").append(S.parseHTML(e)).find(r):e)}).always(n&&function(e,t){a.each(function(){n.apply(this,o||[e.responseText,t,e])})}),this},S.expr.pseudos.animated=function(t){return S.grep(S.timers,function(e){return t===e.elem}).length},S.offset={setOffset:function(e,t,n){var r,i,o,a,s,u,l=S.css(e,"position"),c=S(e),f={};"static"===l&&(e.style.position="relative"),s=c.offset(),o=S.css(e,"top"),u=S.css(e,"left"),("absolute"===l||"fixed"===l)&&-1<(o+u).indexOf("auto")?(a=(r=c.position()).top,i=r.left):(a=parseFloat(o)||0,i=parseFloat(u)||0),m(t)&&(t=t.call(e,n,S.extend({},s))),null!=t.top&&(f.top=t.top-s.top+a),null!=t.left&&(f.left=t.left-s.left+i),"using"in t?t.using.call(e,f):("number"==typeof f.top&&(f.top+="px"),"number"==typeof f.left&&(f.left+="px"),c.css(f))}},S.fn.extend({offset:function(t){if(arguments.length)return void 0===t?this:this.each(function(e){S.offset.setOffset(this,t,e)});var e,n,r=this[0];return r?r.getClientRects().length?(e=r.getBoundingClientRect(),n=r.ownerDocument.defaultView,{top:e.top+n.pageYOffset,left:e.left+n.pageXOffset}):{top:0,left:0}:void 0},position:function(){if(this[0]){var e,t,n,r=this[0],i={top:0,left:0};if("fixed"===S.css(r,"position"))t=r.getBoundingClientRect();else{t=this.offset(),n=r.ownerDocument,e=r.offsetParent||n.documentElement;while(e&&(e===n.body||e===n.documentElement)&&"static"===S.css(e,"position"))e=e.parentNode;e&&e!==r&&1===e.nodeType&&((i=S(e).offset()).top+=S.css(e,"borderTopWidth",!0),i.left+=S.css(e,"borderLeftWidth",!0))}return{top:t.top-i.top-S.css(r,"marginTop",!0),left:t.left-i.left-S.css(r,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var e=this.offsetParent;while(e&&"static"===S.css(e,"position"))e=e.offsetParent;return e||re})}}),S.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(t,i){var o="pageYOffset"===i;S.fn[t]=function(e){return $(this,function(e,t,n){var r;if(x(e)?r=e:9===e.nodeType&&(r=e.defaultView),void 0===n)return r?r[i]:e[t];r?r.scrollTo(o?r.pageXOffset:n,o?n:r.pageYOffset):e[t]=n},t,e,arguments.length)}}),S.each(["top","left"],function(e,n){S.cssHooks[n]=$e(y.pixelPosition,function(e,t){if(t)return t=Be(e,n),Me.test(t)?S(e).position()[n]+"px":t})}),S.each({Height:"height",Width:"width"},function(a,s){S.each({padding:"inner"+a,content:s,"":"outer"+a},function(r,o){S.fn[o]=function(e,t){var n=arguments.length&&(r||"boolean"!=typeof e),i=r||(!0===e||!0===t?"margin":"border");return $(this,function(e,t,n){var r;return x(e)?0===o.indexOf("outer")?e["inner"+a]:e.document.documentElement["client"+a]:9===e.nodeType?(r=e.documentElement,Math.max(e.body["scroll"+a],r["scroll"+a],e.body["offset"+a],r["offset"+a],r["client"+a])):void 0===n?S.css(e,t,i):S.style(e,t,n,i)},s,n?e:void 0,n)}})}),S.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){S.fn[t]=function(e){return this.on(t,e)}}),S.fn.extend({bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return 1===arguments.length?this.off(e,"**"):this.off(t,e||"**",n)},hover:function(e,t){return this.mouseenter(e).mouseleave(t||e)}}),S.each("blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu".split(" "),function(e,n){S.fn[n]=function(e,t){return 0 elements - // (i.e., `typeof document.createElement( "object" ) === "function"`). - // We don't want to classify *any* DOM node as a function. - return typeof obj === "function" && typeof obj.nodeType !== "number"; - }; + // Support: Chrome <=57, Firefox <=52 + // In some browsers, typeof returns "function" for HTML elements + // (i.e., `typeof document.createElement( "object" ) === "function"`). + // We don't want to classify *any* DOM node as a function. + // Support: QtWeb <=3.8.5, WebKit <=534.34, wkhtmltopdf tool <=0.12.5 + // Plus for old WebKit, typeof returns "function" for HTML collections + // (e.g., `typeof document.getElementsByTagName("div") === "function"`). (gh-4756) + return typeof obj === "function" && typeof obj.nodeType !== "number" && + typeof obj.item !== "function"; + }; var isWindow = function isWindow( obj ) { @@ -147,7 +151,7 @@ function toType( obj ) { var - version = "3.5.1", + version = "3.6.0", // Define a local copy of jQuery jQuery = function( selector, context ) { @@ -401,7 +405,7 @@ jQuery.extend( { if ( isArrayLike( Object( arr ) ) ) { jQuery.merge( ret, typeof arr === "string" ? - [ arr ] : arr + [ arr ] : arr ); } else { push.call( ret, arr ); @@ -496,9 +500,9 @@ if ( typeof Symbol === "function" ) { // Populate the class2type map jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ), -function( _i, name ) { - class2type[ "[object " + name + "]" ] = name.toLowerCase(); -} ); + function( _i, name ) { + class2type[ "[object " + name + "]" ] = name.toLowerCase(); + } ); function isArrayLike( obj ) { @@ -518,14 +522,14 @@ function isArrayLike( obj ) { } var Sizzle = /*! - * Sizzle CSS Selector Engine v2.3.5 + * Sizzle CSS Selector Engine v2.3.6 * https://sizzlejs.com/ * * Copyright JS Foundation and other contributors * Released under the MIT license * https://js.foundation/ * - * Date: 2020-03-14 + * Date: 2021-02-16 */ ( function( window ) { var i, @@ -1108,8 +1112,8 @@ support = Sizzle.support = {}; * @returns {Boolean} True iff elem is a non-HTML XML node */ isXML = Sizzle.isXML = function( elem ) { - var namespace = elem.namespaceURI, - docElem = ( elem.ownerDocument || elem ).documentElement; + var namespace = elem && elem.namespaceURI, + docElem = elem && ( elem.ownerDocument || elem ).documentElement; // Support: IE <=8 // Assume HTML when documentElement doesn't yet exist, such as inside loading iframes @@ -3024,9 +3028,9 @@ var rneedsContext = jQuery.expr.match.needsContext; function nodeName( elem, name ) { - return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase(); + return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase(); -}; +} var rsingleTag = ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i ); @@ -3997,8 +4001,8 @@ jQuery.extend( { resolveContexts = Array( i ), resolveValues = slice.call( arguments ), - // the master Deferred - master = jQuery.Deferred(), + // the primary Deferred + primary = jQuery.Deferred(), // subordinate callback factory updateFunc = function( i ) { @@ -4006,30 +4010,30 @@ jQuery.extend( { resolveContexts[ i ] = this; resolveValues[ i ] = arguments.length > 1 ? slice.call( arguments ) : value; if ( !( --remaining ) ) { - master.resolveWith( resolveContexts, resolveValues ); + primary.resolveWith( resolveContexts, resolveValues ); } }; }; // Single- and empty arguments are adopted like Promise.resolve if ( remaining <= 1 ) { - adoptValue( singleValue, master.done( updateFunc( i ) ).resolve, master.reject, + adoptValue( singleValue, primary.done( updateFunc( i ) ).resolve, primary.reject, !remaining ); // Use .then() to unwrap secondary thenables (cf. gh-3000) - if ( master.state() === "pending" || + if ( primary.state() === "pending" || isFunction( resolveValues[ i ] && resolveValues[ i ].then ) ) { - return master.then(); + return primary.then(); } } // Multiple arguments are aggregated like Promise.all array elements while ( i-- ) { - adoptValue( resolveValues[ i ], updateFunc( i ), master.reject ); + adoptValue( resolveValues[ i ], updateFunc( i ), primary.reject ); } - return master.promise(); + return primary.promise(); } } ); @@ -4180,8 +4184,8 @@ var access = function( elems, fn, key, value, chainable, emptyGet, raw ) { for ( ; i < len; i++ ) { fn( elems[ i ], key, raw ? - value : - value.call( elems[ i ], i, fn( elems[ i ], key ) ) + value : + value.call( elems[ i ], i, fn( elems[ i ], key ) ) ); } } @@ -5089,10 +5093,7 @@ function buildFragment( elems, context, scripts, selection, ignored ) { } -var - rkeyEvent = /^key/, - rmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/, - rtypenamespace = /^([^.]*)(?:\.(.+)|)/; +var rtypenamespace = /^([^.]*)(?:\.(.+)|)/; function returnTrue() { return true; @@ -5387,8 +5388,8 @@ jQuery.event = { event = jQuery.event.fix( nativeEvent ), handlers = ( - dataPriv.get( this, "events" ) || Object.create( null ) - )[ event.type ] || [], + dataPriv.get( this, "events" ) || Object.create( null ) + )[ event.type ] || [], special = jQuery.event.special[ event.type ] || {}; // Use the fix-ed jQuery.Event rather than the (read-only) native event @@ -5512,12 +5513,12 @@ jQuery.event = { get: isFunction( hook ) ? function() { if ( this.originalEvent ) { - return hook( this.originalEvent ); + return hook( this.originalEvent ); } } : function() { if ( this.originalEvent ) { - return this.originalEvent[ name ]; + return this.originalEvent[ name ]; } }, @@ -5656,7 +5657,13 @@ function leverageNative( el, type, expectSync ) { // Cancel the outer synthetic event event.stopImmediatePropagation(); event.preventDefault(); - return result.value; + + // Support: Chrome 86+ + // In Chrome, if an element having a focusout handler is blurred by + // clicking outside of it, it invokes the handler synchronously. If + // that handler calls `.remove()` on the element, the data is cleared, + // leaving `result` undefined. We need to guard against this. + return result && result.value; } // If this is an inner synthetic event for an event with a bubbling surrogate @@ -5821,34 +5828,7 @@ jQuery.each( { targetTouches: true, toElement: true, touches: true, - - which: function( event ) { - var button = event.button; - - // Add which for key events - if ( event.which == null && rkeyEvent.test( event.type ) ) { - return event.charCode != null ? event.charCode : event.keyCode; - } - - // Add which for click: 1 === left; 2 === middle; 3 === right - if ( !event.which && button !== undefined && rmouseEvent.test( event.type ) ) { - if ( button & 1 ) { - return 1; - } - - if ( button & 2 ) { - return 3; - } - - if ( button & 4 ) { - return 2; - } - - return 0; - } - - return event.which; - } + which: true }, jQuery.event.addProp ); jQuery.each( { focus: "focusin", blur: "focusout" }, function( type, delegateType ) { @@ -5874,6 +5854,12 @@ jQuery.each( { focus: "focusin", blur: "focusout" }, function( type, delegateTyp return true; }, + // Suppress native focus or blur as it's already being fired + // in leverageNative. + _default: function() { + return true; + }, + delegateType: delegateType }; } ); @@ -6541,6 +6527,10 @@ var rboxStyle = new RegExp( cssExpand.join( "|" ), "i" ); // set in CSS while `offset*` properties report correct values. // Behavior in IE 9 is more subtle than in newer versions & it passes // some versions of this test; make sure not to make it pass there! + // + // Support: Firefox 70+ + // Only Firefox includes border widths + // in computed dimensions. (gh-4529) reliableTrDimensions: function() { var table, tr, trChild, trStyle; if ( reliableTrDimensionsVal == null ) { @@ -6548,17 +6538,32 @@ var rboxStyle = new RegExp( cssExpand.join( "|" ), "i" ); tr = document.createElement( "tr" ); trChild = document.createElement( "div" ); - table.style.cssText = "position:absolute;left:-11111px"; + table.style.cssText = "position:absolute;left:-11111px;border-collapse:separate"; + tr.style.cssText = "border:1px solid"; + + // Support: Chrome 86+ + // Height set through cssText does not get applied. + // Computed height then comes back as 0. tr.style.height = "1px"; trChild.style.height = "9px"; + // Support: Android 8 Chrome 86+ + // In our bodyBackground.html iframe, + // display for all div elements is set to "inline", + // which causes a problem only in Android 8 Chrome 86. + // Ensuring the div is display: block + // gets around this issue. + trChild.style.display = "block"; + documentElement .appendChild( table ) .appendChild( tr ) .appendChild( trChild ); trStyle = window.getComputedStyle( tr ); - reliableTrDimensionsVal = parseInt( trStyle.height ) > 3; + reliableTrDimensionsVal = ( parseInt( trStyle.height, 10 ) + + parseInt( trStyle.borderTopWidth, 10 ) + + parseInt( trStyle.borderBottomWidth, 10 ) ) === tr.offsetHeight; documentElement.removeChild( table ); } @@ -7022,10 +7027,10 @@ jQuery.each( [ "height", "width" ], function( _i, dimension ) { // Running getBoundingClientRect on a disconnected node // in IE throws an error. ( !elem.getClientRects().length || !elem.getBoundingClientRect().width ) ? - swap( elem, cssShow, function() { - return getWidthOrHeight( elem, dimension, extra ); - } ) : - getWidthOrHeight( elem, dimension, extra ); + swap( elem, cssShow, function() { + return getWidthOrHeight( elem, dimension, extra ); + } ) : + getWidthOrHeight( elem, dimension, extra ); } }, @@ -7084,7 +7089,7 @@ jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft, swap( elem, { marginLeft: 0 }, function() { return elem.getBoundingClientRect().left; } ) - ) + "px"; + ) + "px"; } } ); @@ -7223,7 +7228,7 @@ Tween.propHooks = { if ( jQuery.fx.step[ tween.prop ] ) { jQuery.fx.step[ tween.prop ]( tween ); } else if ( tween.elem.nodeType === 1 && ( - jQuery.cssHooks[ tween.prop ] || + jQuery.cssHooks[ tween.prop ] || tween.elem.style[ finalPropName( tween.prop ) ] != null ) ) { jQuery.style( tween.elem, tween.prop, tween.now + tween.unit ); } else { @@ -7468,7 +7473,7 @@ function defaultPrefilter( elem, props, opts ) { anim.done( function() { - /* eslint-enable no-loop-func */ + /* eslint-enable no-loop-func */ // The final step of a "hide" animation is actually hiding the element if ( !hidden ) { @@ -7588,7 +7593,7 @@ function Animation( elem, properties, options ) { tweens: [], createTween: function( prop, end ) { var tween = jQuery.Tween( elem, animation.opts, prop, end, - animation.opts.specialEasing[ prop ] || animation.opts.easing ); + animation.opts.specialEasing[ prop ] || animation.opts.easing ); animation.tweens.push( tween ); return tween; }, @@ -7761,7 +7766,8 @@ jQuery.fn.extend( { anim.stop( true ); } }; - doAnimation.finish = doAnimation; + + doAnimation.finish = doAnimation; return empty || optall.queue === false ? this.each( doAnimation ) : @@ -8401,8 +8407,8 @@ jQuery.fn.extend( { if ( this.setAttribute ) { this.setAttribute( "class", className || value === false ? - "" : - dataPriv.get( this, "__className__" ) || "" + "" : + dataPriv.get( this, "__className__" ) || "" ); } } @@ -8417,7 +8423,7 @@ jQuery.fn.extend( { while ( ( elem = this[ i++ ] ) ) { if ( elem.nodeType === 1 && ( " " + stripAndCollapse( getClass( elem ) ) + " " ).indexOf( className ) > -1 ) { - return true; + return true; } } @@ -8707,9 +8713,7 @@ jQuery.extend( jQuery.event, { special.bindType || type; // jQuery handler - handle = ( - dataPriv.get( cur, "events" ) || Object.create( null ) - )[ event.type ] && + handle = ( dataPriv.get( cur, "events" ) || Object.create( null ) )[ event.type ] && dataPriv.get( cur, "handle" ); if ( handle ) { handle.apply( cur, data ); @@ -8856,7 +8860,7 @@ var rquery = ( /\?/ ); // Cross-browser xml parsing jQuery.parseXML = function( data ) { - var xml; + var xml, parserErrorElem; if ( !data || typeof data !== "string" ) { return null; } @@ -8865,12 +8869,17 @@ jQuery.parseXML = function( data ) { // IE throws on parseFromString with invalid input. try { xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" ); - } catch ( e ) { - xml = undefined; - } + } catch ( e ) {} - if ( !xml || xml.getElementsByTagName( "parsererror" ).length ) { - jQuery.error( "Invalid XML: " + data ); + parserErrorElem = xml && xml.getElementsByTagName( "parsererror" )[ 0 ]; + if ( !xml || parserErrorElem ) { + jQuery.error( "Invalid XML: " + ( + parserErrorElem ? + jQuery.map( parserErrorElem.childNodes, function( el ) { + return el.textContent; + } ).join( "\n" ) : + data + ) ); } return xml; }; @@ -8971,16 +8980,14 @@ jQuery.fn.extend( { // Can add propHook for "elements" to filter or add form elements var elements = jQuery.prop( this, "elements" ); return elements ? jQuery.makeArray( elements ) : this; - } ) - .filter( function() { + } ).filter( function() { var type = this.type; // Use .is( ":disabled" ) so that fieldset[disabled] works return this.name && !jQuery( this ).is( ":disabled" ) && rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) && ( this.checked || !rcheckableType.test( type ) ); - } ) - .map( function( _i, elem ) { + } ).map( function( _i, elem ) { var val = jQuery( this ).val(); if ( val == null ) { @@ -9033,7 +9040,8 @@ var // Anchor tag for parsing the document origin originAnchor = document.createElement( "a" ); - originAnchor.href = location.href; + +originAnchor.href = location.href; // Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport function addToPrefiltersOrTransports( structure ) { @@ -9414,8 +9422,8 @@ jQuery.extend( { // Context for global events is callbackContext if it is a DOM node or jQuery collection globalEventContext = s.context && ( callbackContext.nodeType || callbackContext.jquery ) ? - jQuery( callbackContext ) : - jQuery.event, + jQuery( callbackContext ) : + jQuery.event, // Deferreds deferred = jQuery.Deferred(), @@ -9727,8 +9735,10 @@ jQuery.extend( { response = ajaxHandleResponses( s, jqXHR, responses ); } - // Use a noop converter for missing script - if ( !isSuccess && jQuery.inArray( "script", s.dataTypes ) > -1 ) { + // Use a noop converter for missing script but not if jsonp + if ( !isSuccess && + jQuery.inArray( "script", s.dataTypes ) > -1 && + jQuery.inArray( "json", s.dataTypes ) < 0 ) { s.converters[ "text script" ] = function() {}; } @@ -10466,12 +10476,6 @@ jQuery.offset = { options.using.call( elem, props ); } else { - if ( typeof props.top === "number" ) { - props.top += "px"; - } - if ( typeof props.left === "number" ) { - props.left += "px"; - } curElem.css( props ); } } @@ -10640,8 +10644,11 @@ jQuery.each( [ "top", "left" ], function( _i, prop ) { // Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods jQuery.each( { Height: "height", Width: "width" }, function( name, type ) { - jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name }, - function( defaultExtra, funcName ) { + jQuery.each( { + padding: "inner" + name, + content: type, + "": "outer" + name + }, function( defaultExtra, funcName ) { // Margin is only for outerHeight, outerWidth jQuery.fn[ funcName ] = function( margin, value ) { @@ -10726,7 +10733,8 @@ jQuery.fn.extend( { } } ); -jQuery.each( ( "blur focus focusin focusout resize scroll click dblclick " + +jQuery.each( + ( "blur focus focusin focusout resize scroll click dblclick " + "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " + "change select submit keydown keypress keyup contextmenu" ).split( " " ), function( _i, name ) { @@ -10737,7 +10745,8 @@ jQuery.each( ( "blur focus focusin focusout resize scroll click dblclick " + this.on( name, null, data, fn ) : this.trigger( name ); }; - } ); + } +); diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/script-dir/jquery-3.6.0.min.js b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/script-dir/jquery-3.6.0.min.js new file mode 100644 index 00000000000..c4c6022f298 --- /dev/null +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/script-dir/jquery-3.6.0.min.js @@ -0,0 +1,2 @@ +/*! jQuery v3.6.0 | (c) OpenJS Foundation and other contributors | jquery.org/license */ +!function(e,t){"use strict";"object"==typeof module&&"object"==typeof module.exports?module.exports=e.document?t(e,!0):function(e){if(!e.document)throw new Error("jQuery requires a window with a document");return t(e)}:t(e)}("undefined"!=typeof window?window:this,function(C,e){"use strict";var t=[],r=Object.getPrototypeOf,s=t.slice,g=t.flat?function(e){return t.flat.call(e)}:function(e){return t.concat.apply([],e)},u=t.push,i=t.indexOf,n={},o=n.toString,v=n.hasOwnProperty,a=v.toString,l=a.call(Object),y={},m=function(e){return"function"==typeof e&&"number"!=typeof e.nodeType&&"function"!=typeof e.item},x=function(e){return null!=e&&e===e.window},E=C.document,c={type:!0,src:!0,nonce:!0,noModule:!0};function b(e,t,n){var r,i,o=(n=n||E).createElement("script");if(o.text=e,t)for(r in c)(i=t[r]||t.getAttribute&&t.getAttribute(r))&&o.setAttribute(r,i);n.head.appendChild(o).parentNode.removeChild(o)}function w(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?n[o.call(e)]||"object":typeof e}var f="3.6.0",S=function(e,t){return new S.fn.init(e,t)};function p(e){var t=!!e&&"length"in e&&e.length,n=w(e);return!m(e)&&!x(e)&&("array"===n||0===t||"number"==typeof t&&0+~]|"+M+")"+M+"*"),U=new RegExp(M+"|>"),X=new RegExp(F),V=new RegExp("^"+I+"$"),G={ID:new RegExp("^#("+I+")"),CLASS:new RegExp("^\\.("+I+")"),TAG:new RegExp("^("+I+"|[*])"),ATTR:new RegExp("^"+W),PSEUDO:new RegExp("^"+F),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+M+"*(even|odd|(([+-]|)(\\d*)n|)"+M+"*(?:([+-]|)"+M+"*(\\d+)|))"+M+"*\\)|)","i"),bool:new RegExp("^(?:"+R+")$","i"),needsContext:new RegExp("^"+M+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+M+"*((?:-\\d)?\\d*)"+M+"*\\)|)(?=[^-]|$)","i")},Y=/HTML$/i,Q=/^(?:input|select|textarea|button)$/i,J=/^h\d$/i,K=/^[^{]+\{\s*\[native \w/,Z=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,ee=/[+~]/,te=new RegExp("\\\\[\\da-fA-F]{1,6}"+M+"?|\\\\([^\\r\\n\\f])","g"),ne=function(e,t){var n="0x"+e.slice(1)-65536;return t||(n<0?String.fromCharCode(n+65536):String.fromCharCode(n>>10|55296,1023&n|56320))},re=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,ie=function(e,t){return t?"\0"===e?"\ufffd":e.slice(0,-1)+"\\"+e.charCodeAt(e.length-1).toString(16)+" ":"\\"+e},oe=function(){T()},ae=be(function(e){return!0===e.disabled&&"fieldset"===e.nodeName.toLowerCase()},{dir:"parentNode",next:"legend"});try{H.apply(t=O.call(p.childNodes),p.childNodes),t[p.childNodes.length].nodeType}catch(e){H={apply:t.length?function(e,t){L.apply(e,O.call(t))}:function(e,t){var n=e.length,r=0;while(e[n++]=t[r++]);e.length=n-1}}}function se(t,e,n,r){var i,o,a,s,u,l,c,f=e&&e.ownerDocument,p=e?e.nodeType:9;if(n=n||[],"string"!=typeof t||!t||1!==p&&9!==p&&11!==p)return n;if(!r&&(T(e),e=e||C,E)){if(11!==p&&(u=Z.exec(t)))if(i=u[1]){if(9===p){if(!(a=e.getElementById(i)))return n;if(a.id===i)return n.push(a),n}else if(f&&(a=f.getElementById(i))&&y(e,a)&&a.id===i)return n.push(a),n}else{if(u[2])return H.apply(n,e.getElementsByTagName(t)),n;if((i=u[3])&&d.getElementsByClassName&&e.getElementsByClassName)return H.apply(n,e.getElementsByClassName(i)),n}if(d.qsa&&!N[t+" "]&&(!v||!v.test(t))&&(1!==p||"object"!==e.nodeName.toLowerCase())){if(c=t,f=e,1===p&&(U.test(t)||z.test(t))){(f=ee.test(t)&&ye(e.parentNode)||e)===e&&d.scope||((s=e.getAttribute("id"))?s=s.replace(re,ie):e.setAttribute("id",s=S)),o=(l=h(t)).length;while(o--)l[o]=(s?"#"+s:":scope")+" "+xe(l[o]);c=l.join(",")}try{return H.apply(n,f.querySelectorAll(c)),n}catch(e){N(t,!0)}finally{s===S&&e.removeAttribute("id")}}}return g(t.replace($,"$1"),e,n,r)}function ue(){var r=[];return function e(t,n){return r.push(t+" ")>b.cacheLength&&delete e[r.shift()],e[t+" "]=n}}function le(e){return e[S]=!0,e}function ce(e){var t=C.createElement("fieldset");try{return!!e(t)}catch(e){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function fe(e,t){var n=e.split("|"),r=n.length;while(r--)b.attrHandle[n[r]]=t}function pe(e,t){var n=t&&e,r=n&&1===e.nodeType&&1===t.nodeType&&e.sourceIndex-t.sourceIndex;if(r)return r;if(n)while(n=n.nextSibling)if(n===t)return-1;return e?1:-1}function de(t){return function(e){return"input"===e.nodeName.toLowerCase()&&e.type===t}}function he(n){return function(e){var t=e.nodeName.toLowerCase();return("input"===t||"button"===t)&&e.type===n}}function ge(t){return function(e){return"form"in e?e.parentNode&&!1===e.disabled?"label"in e?"label"in e.parentNode?e.parentNode.disabled===t:e.disabled===t:e.isDisabled===t||e.isDisabled!==!t&&ae(e)===t:e.disabled===t:"label"in e&&e.disabled===t}}function ve(a){return le(function(o){return o=+o,le(function(e,t){var n,r=a([],e.length,o),i=r.length;while(i--)e[n=r[i]]&&(e[n]=!(t[n]=e[n]))})})}function ye(e){return e&&"undefined"!=typeof e.getElementsByTagName&&e}for(e in d=se.support={},i=se.isXML=function(e){var t=e&&e.namespaceURI,n=e&&(e.ownerDocument||e).documentElement;return!Y.test(t||n&&n.nodeName||"HTML")},T=se.setDocument=function(e){var t,n,r=e?e.ownerDocument||e:p;return r!=C&&9===r.nodeType&&r.documentElement&&(a=(C=r).documentElement,E=!i(C),p!=C&&(n=C.defaultView)&&n.top!==n&&(n.addEventListener?n.addEventListener("unload",oe,!1):n.attachEvent&&n.attachEvent("onunload",oe)),d.scope=ce(function(e){return a.appendChild(e).appendChild(C.createElement("div")),"undefined"!=typeof e.querySelectorAll&&!e.querySelectorAll(":scope fieldset div").length}),d.attributes=ce(function(e){return e.className="i",!e.getAttribute("className")}),d.getElementsByTagName=ce(function(e){return e.appendChild(C.createComment("")),!e.getElementsByTagName("*").length}),d.getElementsByClassName=K.test(C.getElementsByClassName),d.getById=ce(function(e){return a.appendChild(e).id=S,!C.getElementsByName||!C.getElementsByName(S).length}),d.getById?(b.filter.ID=function(e){var t=e.replace(te,ne);return function(e){return e.getAttribute("id")===t}},b.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&E){var n=t.getElementById(e);return n?[n]:[]}}):(b.filter.ID=function(e){var n=e.replace(te,ne);return function(e){var t="undefined"!=typeof e.getAttributeNode&&e.getAttributeNode("id");return t&&t.value===n}},b.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&E){var n,r,i,o=t.getElementById(e);if(o){if((n=o.getAttributeNode("id"))&&n.value===e)return[o];i=t.getElementsByName(e),r=0;while(o=i[r++])if((n=o.getAttributeNode("id"))&&n.value===e)return[o]}return[]}}),b.find.TAG=d.getElementsByTagName?function(e,t){return"undefined"!=typeof t.getElementsByTagName?t.getElementsByTagName(e):d.qsa?t.querySelectorAll(e):void 0}:function(e,t){var n,r=[],i=0,o=t.getElementsByTagName(e);if("*"===e){while(n=o[i++])1===n.nodeType&&r.push(n);return r}return o},b.find.CLASS=d.getElementsByClassName&&function(e,t){if("undefined"!=typeof t.getElementsByClassName&&E)return t.getElementsByClassName(e)},s=[],v=[],(d.qsa=K.test(C.querySelectorAll))&&(ce(function(e){var t;a.appendChild(e).innerHTML="",e.querySelectorAll("[msallowcapture^='']").length&&v.push("[*^$]="+M+"*(?:''|\"\")"),e.querySelectorAll("[selected]").length||v.push("\\["+M+"*(?:value|"+R+")"),e.querySelectorAll("[id~="+S+"-]").length||v.push("~="),(t=C.createElement("input")).setAttribute("name",""),e.appendChild(t),e.querySelectorAll("[name='']").length||v.push("\\["+M+"*name"+M+"*="+M+"*(?:''|\"\")"),e.querySelectorAll(":checked").length||v.push(":checked"),e.querySelectorAll("a#"+S+"+*").length||v.push(".#.+[+~]"),e.querySelectorAll("\\\f"),v.push("[\\r\\n\\f]")}),ce(function(e){e.innerHTML="";var t=C.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),e.querySelectorAll("[name=d]").length&&v.push("name"+M+"*[*^$|!~]?="),2!==e.querySelectorAll(":enabled").length&&v.push(":enabled",":disabled"),a.appendChild(e).disabled=!0,2!==e.querySelectorAll(":disabled").length&&v.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),v.push(",.*:")})),(d.matchesSelector=K.test(c=a.matches||a.webkitMatchesSelector||a.mozMatchesSelector||a.oMatchesSelector||a.msMatchesSelector))&&ce(function(e){d.disconnectedMatch=c.call(e,"*"),c.call(e,"[s!='']:x"),s.push("!=",F)}),v=v.length&&new RegExp(v.join("|")),s=s.length&&new RegExp(s.join("|")),t=K.test(a.compareDocumentPosition),y=t||K.test(a.contains)?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t)while(t=t.parentNode)if(t===e)return!0;return!1},j=t?function(e,t){if(e===t)return l=!0,0;var n=!e.compareDocumentPosition-!t.compareDocumentPosition;return n||(1&(n=(e.ownerDocument||e)==(t.ownerDocument||t)?e.compareDocumentPosition(t):1)||!d.sortDetached&&t.compareDocumentPosition(e)===n?e==C||e.ownerDocument==p&&y(p,e)?-1:t==C||t.ownerDocument==p&&y(p,t)?1:u?P(u,e)-P(u,t):0:4&n?-1:1)}:function(e,t){if(e===t)return l=!0,0;var n,r=0,i=e.parentNode,o=t.parentNode,a=[e],s=[t];if(!i||!o)return e==C?-1:t==C?1:i?-1:o?1:u?P(u,e)-P(u,t):0;if(i===o)return pe(e,t);n=e;while(n=n.parentNode)a.unshift(n);n=t;while(n=n.parentNode)s.unshift(n);while(a[r]===s[r])r++;return r?pe(a[r],s[r]):a[r]==p?-1:s[r]==p?1:0}),C},se.matches=function(e,t){return se(e,null,null,t)},se.matchesSelector=function(e,t){if(T(e),d.matchesSelector&&E&&!N[t+" "]&&(!s||!s.test(t))&&(!v||!v.test(t)))try{var n=c.call(e,t);if(n||d.disconnectedMatch||e.document&&11!==e.document.nodeType)return n}catch(e){N(t,!0)}return 0":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(te,ne),e[3]=(e[3]||e[4]||e[5]||"").replace(te,ne),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||se.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&se.error(e[0]),e},PSEUDO:function(e){var t,n=!e[6]&&e[2];return G.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":n&&X.test(n)&&(t=h(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(te,ne).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=m[e+" "];return t||(t=new RegExp("(^|"+M+")"+e+"("+M+"|$)"))&&m(e,function(e){return t.test("string"==typeof e.className&&e.className||"undefined"!=typeof e.getAttribute&&e.getAttribute("class")||"")})},ATTR:function(n,r,i){return function(e){var t=se.attr(e,n);return null==t?"!="===r:!r||(t+="","="===r?t===i:"!="===r?t!==i:"^="===r?i&&0===t.indexOf(i):"*="===r?i&&-1:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;function j(e,n,r){return m(n)?S.grep(e,function(e,t){return!!n.call(e,t,e)!==r}):n.nodeType?S.grep(e,function(e){return e===n!==r}):"string"!=typeof n?S.grep(e,function(e){return-1)[^>]*|#([\w-]+))$/;(S.fn.init=function(e,t,n){var r,i;if(!e)return this;if(n=n||D,"string"==typeof e){if(!(r="<"===e[0]&&">"===e[e.length-1]&&3<=e.length?[null,e,null]:q.exec(e))||!r[1]&&t)return!t||t.jquery?(t||n).find(e):this.constructor(t).find(e);if(r[1]){if(t=t instanceof S?t[0]:t,S.merge(this,S.parseHTML(r[1],t&&t.nodeType?t.ownerDocument||t:E,!0)),N.test(r[1])&&S.isPlainObject(t))for(r in t)m(this[r])?this[r](t[r]):this.attr(r,t[r]);return this}return(i=E.getElementById(r[2]))&&(this[0]=i,this.length=1),this}return e.nodeType?(this[0]=e,this.length=1,this):m(e)?void 0!==n.ready?n.ready(e):e(S):S.makeArray(e,this)}).prototype=S.fn,D=S(E);var L=/^(?:parents|prev(?:Until|All))/,H={children:!0,contents:!0,next:!0,prev:!0};function O(e,t){while((e=e[t])&&1!==e.nodeType);return e}S.fn.extend({has:function(e){var t=S(e,this),n=t.length;return this.filter(function(){for(var e=0;e\x20\t\r\n\f]*)/i,he=/^$|^module$|\/(?:java|ecma)script/i;ce=E.createDocumentFragment().appendChild(E.createElement("div")),(fe=E.createElement("input")).setAttribute("type","radio"),fe.setAttribute("checked","checked"),fe.setAttribute("name","t"),ce.appendChild(fe),y.checkClone=ce.cloneNode(!0).cloneNode(!0).lastChild.checked,ce.innerHTML="",y.noCloneChecked=!!ce.cloneNode(!0).lastChild.defaultValue,ce.innerHTML="",y.option=!!ce.lastChild;var ge={thead:[1,"","
    "],col:[2,"","
    "],tr:[2,"","
    "],td:[3,"","
    "],_default:[0,"",""]};function ve(e,t){var n;return n="undefined"!=typeof e.getElementsByTagName?e.getElementsByTagName(t||"*"):"undefined"!=typeof e.querySelectorAll?e.querySelectorAll(t||"*"):[],void 0===t||t&&A(e,t)?S.merge([e],n):n}function ye(e,t){for(var n=0,r=e.length;n",""]);var me=/<|&#?\w+;/;function xe(e,t,n,r,i){for(var o,a,s,u,l,c,f=t.createDocumentFragment(),p=[],d=0,h=e.length;d\s*$/g;function je(e,t){return A(e,"table")&&A(11!==t.nodeType?t:t.firstChild,"tr")&&S(e).children("tbody")[0]||e}function De(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function qe(e){return"true/"===(e.type||"").slice(0,5)?e.type=e.type.slice(5):e.removeAttribute("type"),e}function Le(e,t){var n,r,i,o,a,s;if(1===t.nodeType){if(Y.hasData(e)&&(s=Y.get(e).events))for(i in Y.remove(t,"handle events"),s)for(n=0,r=s[i].length;n").attr(n.scriptAttrs||{}).prop({charset:n.scriptCharset,src:n.url}).on("load error",i=function(e){r.remove(),i=null,e&&t("error"===e.type?404:200,e.type)}),E.head.appendChild(r[0])},abort:function(){i&&i()}}});var _t,zt=[],Ut=/(=)\?(?=&|$)|\?\?/;S.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=zt.pop()||S.expando+"_"+wt.guid++;return this[e]=!0,e}}),S.ajaxPrefilter("json jsonp",function(e,t,n){var r,i,o,a=!1!==e.jsonp&&(Ut.test(e.url)?"url":"string"==typeof e.data&&0===(e.contentType||"").indexOf("application/x-www-form-urlencoded")&&Ut.test(e.data)&&"data");if(a||"jsonp"===e.dataTypes[0])return r=e.jsonpCallback=m(e.jsonpCallback)?e.jsonpCallback():e.jsonpCallback,a?e[a]=e[a].replace(Ut,"$1"+r):!1!==e.jsonp&&(e.url+=(Tt.test(e.url)?"&":"?")+e.jsonp+"="+r),e.converters["script json"]=function(){return o||S.error(r+" was not called"),o[0]},e.dataTypes[0]="json",i=C[r],C[r]=function(){o=arguments},n.always(function(){void 0===i?S(C).removeProp(r):C[r]=i,e[r]&&(e.jsonpCallback=t.jsonpCallback,zt.push(r)),o&&m(i)&&i(o[0]),o=i=void 0}),"script"}),y.createHTMLDocument=((_t=E.implementation.createHTMLDocument("").body).innerHTML="
    ",2===_t.childNodes.length),S.parseHTML=function(e,t,n){return"string"!=typeof e?[]:("boolean"==typeof t&&(n=t,t=!1),t||(y.createHTMLDocument?((r=(t=E.implementation.createHTMLDocument("")).createElement("base")).href=E.location.href,t.head.appendChild(r)):t=E),o=!n&&[],(i=N.exec(e))?[t.createElement(i[1])]:(i=xe([e],t,o),o&&o.length&&S(o).remove(),S.merge([],i.childNodes)));var r,i,o},S.fn.load=function(e,t,n){var r,i,o,a=this,s=e.indexOf(" ");return-1").append(S.parseHTML(e)).find(r):e)}).always(n&&function(e,t){a.each(function(){n.apply(this,o||[e.responseText,t,e])})}),this},S.expr.pseudos.animated=function(t){return S.grep(S.timers,function(e){return t===e.elem}).length},S.offset={setOffset:function(e,t,n){var r,i,o,a,s,u,l=S.css(e,"position"),c=S(e),f={};"static"===l&&(e.style.position="relative"),s=c.offset(),o=S.css(e,"top"),u=S.css(e,"left"),("absolute"===l||"fixed"===l)&&-1<(o+u).indexOf("auto")?(a=(r=c.position()).top,i=r.left):(a=parseFloat(o)||0,i=parseFloat(u)||0),m(t)&&(t=t.call(e,n,S.extend({},s))),null!=t.top&&(f.top=t.top-s.top+a),null!=t.left&&(f.left=t.left-s.left+i),"using"in t?t.using.call(e,f):c.css(f)}},S.fn.extend({offset:function(t){if(arguments.length)return void 0===t?this:this.each(function(e){S.offset.setOffset(this,t,e)});var e,n,r=this[0];return r?r.getClientRects().length?(e=r.getBoundingClientRect(),n=r.ownerDocument.defaultView,{top:e.top+n.pageYOffset,left:e.left+n.pageXOffset}):{top:0,left:0}:void 0},position:function(){if(this[0]){var e,t,n,r=this[0],i={top:0,left:0};if("fixed"===S.css(r,"position"))t=r.getBoundingClientRect();else{t=this.offset(),n=r.ownerDocument,e=r.offsetParent||n.documentElement;while(e&&(e===n.body||e===n.documentElement)&&"static"===S.css(e,"position"))e=e.parentNode;e&&e!==r&&1===e.nodeType&&((i=S(e).offset()).top+=S.css(e,"borderTopWidth",!0),i.left+=S.css(e,"borderLeftWidth",!0))}return{top:t.top-i.top-S.css(r,"marginTop",!0),left:t.left-i.left-S.css(r,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var e=this.offsetParent;while(e&&"static"===S.css(e,"position"))e=e.offsetParent;return e||re})}}),S.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(t,i){var o="pageYOffset"===i;S.fn[t]=function(e){return $(this,function(e,t,n){var r;if(x(e)?r=e:9===e.nodeType&&(r=e.defaultView),void 0===n)return r?r[i]:e[t];r?r.scrollTo(o?r.pageXOffset:n,o?n:r.pageYOffset):e[t]=n},t,e,arguments.length)}}),S.each(["top","left"],function(e,n){S.cssHooks[n]=Fe(y.pixelPosition,function(e,t){if(t)return t=We(e,n),Pe.test(t)?S(e).position()[n]+"px":t})}),S.each({Height:"height",Width:"width"},function(a,s){S.each({padding:"inner"+a,content:s,"":"outer"+a},function(r,o){S.fn[o]=function(e,t){var n=arguments.length&&(r||"boolean"!=typeof e),i=r||(!0===e||!0===t?"margin":"border");return $(this,function(e,t,n){var r;return x(e)?0===o.indexOf("outer")?e["inner"+a]:e.document.documentElement["client"+a]:9===e.nodeType?(r=e.documentElement,Math.max(e.body["scroll"+a],r["scroll"+a],e.body["offset"+a],r["offset"+a],r["client"+a])):void 0===n?S.css(e,t,i):S.style(e,t,n,i)},s,n?e:void 0,n)}})}),S.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){S.fn[t]=function(e){return this.on(t,e)}}),S.fn.extend({bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return 1===arguments.length?this.off(e,"**"):this.off(t,e||"**",n)},hover:function(e,t){return this.mouseenter(e).mouseleave(t||e)}}),S.each("blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu".split(" "),function(e,n){S.fn[n]=function(e,t){return 0 """, """ - + """, """ """, @@ -684,7 +684,7 @@ public class TestSearch extends JavadocTester { checkFiles(expectedOutput, "search.js", "jquery-ui.overrides.css", - "script-dir/jquery-3.5.1.min.js", + "script-dir/jquery-3.6.0.min.js", "script-dir/jquery-ui.min.js", "script-dir/jquery-ui.min.css", "script-dir/jquery-ui.structure.min.css", diff --git a/test/langtools/jdk/javadoc/tool/api/basic/APITest.java b/test/langtools/jdk/javadoc/tool/api/basic/APITest.java index a0d68d85403..3a5ddda8261 100644 --- a/test/langtools/jdk/javadoc/tool/api/basic/APITest.java +++ b/test/langtools/jdk/javadoc/tool/api/basic/APITest.java @@ -201,7 +201,7 @@ class APITest { "help-doc.html", "index-all.html", "index.html", - "script-dir/jquery-3.5.1.min.js", + "script-dir/jquery-3.6.0.min.js", "script-dir/jquery-ui.min.js", "script-dir/jquery-ui.min.css", "script-dir/jquery-ui.structure.min.css", -- GitLab From 6013d09e82693a1c07cf0bf6daffd95114b3cbfa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hannes=20Walln=C3=B6fer?= Date: Mon, 14 Mar 2022 20:29:15 +0000 Subject: [PATCH 242/340] 8268866: Javascript when used in an iframe cannot display search results Reviewed-by: jjg --- .../doclets/formats/html/resources/search.js.template | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/search.js.template b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/search.js.template index b5c92aefeb3..27ad08ad580 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/search.js.template +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/search.js.template @@ -359,11 +359,7 @@ $(function() { } else if (ui.item.category === catSearchTags) { url += ui.item.u; } - if (top !== window) { - parent.classFrame.location = pathtoroot + url; - } else { - window.location.href = pathtoroot + url; - } + window.location.href = pathtoroot + url; $("#search-input").focus(); } } -- GitLab From 34d4ffcea5d71560c549655967de863342b48984 Mon Sep 17 00:00:00 2001 From: Dean Long Date: Tue, 15 Mar 2022 07:24:50 +0000 Subject: [PATCH 243/340] 8279317: compiler/jvmci/compilerToVM/DisassembleCodeBlobTest.java assumes immutable code Reviewed-by: dnsimon, iveresov --- .../compilerToVM/DisassembleCodeBlobTest.java | 43 +++++++++++++------ 1 file changed, 31 insertions(+), 12 deletions(-) diff --git a/test/hotspot/jtreg/compiler/jvmci/compilerToVM/DisassembleCodeBlobTest.java b/test/hotspot/jtreg/compiler/jvmci/compilerToVM/DisassembleCodeBlobTest.java index 9d26ed16eb6..ec5b9337b49 100644 --- a/test/hotspot/jtreg/compiler/jvmci/compilerToVM/DisassembleCodeBlobTest.java +++ b/test/hotspot/jtreg/compiler/jvmci/compilerToVM/DisassembleCodeBlobTest.java @@ -83,6 +83,11 @@ public class DisassembleCodeBlobTest { + " : non-null return value for invalid installCode"); } + private void checkLineStart(CompileCodeTestCase testCase, String line, String match) { + Asserts.assertTrue(line.startsWith(match), + testCase + " : line \"" + line + "\" does not start with: \"" + match +"\""); + } + private void check(CompileCodeTestCase testCase) { System.out.println(testCase); // to have a clean state @@ -98,19 +103,33 @@ public class DisassembleCodeBlobTest { } // The very first call to the disassembler contains a string specifying the // architecture: [Disassembling for mach='i386:x86-64'] - // Therefore compare strings 2 and 3. + // so discard it and try again. String str2 = CompilerToVMHelper.disassembleCodeBlob(installedCode); - String str3 = CompilerToVMHelper.disassembleCodeBlob(installedCode); - String[] str2Lines = str2.split(System.lineSeparator()); - String[] str3Lines = str3.split(System.lineSeparator()); - // skip the first two lines since it contains a timestamp that may vary from different invocations - // - // Compiled method (c2) 309 463 4 compiler.jvmci.compilerToVM.CompileCodeTestCase$Dummy::staticMethod (1 bytes) - // - // Compiled method (c2) 310 463 4 compiler.jvmci.compilerToVM.CompileCodeTestCase$Dummy::staticMethod (1 bytes) - for (int i = 2; i < str2Lines.length; i++) { - Asserts.assertEQ(str2Lines[i], str3Lines[i], - testCase + " : 3nd invocation returned different value from 2nd"); + String[] strLines = str2.split("\\R"); + // Check some basic layout + int MIN_LINES = 5; + Asserts.assertTrue(strLines.length > 2, + testCase + " : read " + strLines.length + " lines, " + MIN_LINES + " expected"); + int l = 1; + checkLineStart(testCase, strLines[l++], "Compiled method "); // 2 + checkLineStart(testCase, strLines[l++], " total in heap "); // 3 + int foundDisassemblyLine = -1; + int foundEntryPointLine = -1; + for (; l < strLines.length; ++l) { + String line = strLines[l]; + if (line.equals("[Disassembly]") || line.equals("[MachCode]")) { + Asserts.assertTrue(foundDisassemblyLine == -1, + testCase + " : Duplicate disassembly section markers found at lines " + foundDisassemblyLine + " and " + l); + foundDisassemblyLine = l; + } + if (line.equals("[Entry Point]") || line.equals("[Verified Entry Point]")) { + Asserts.assertTrue(foundDisassemblyLine != -1, + testCase + " : entry point found but [Disassembly] section missing "); + foundEntryPointLine = l; + break; + } } + Asserts.assertTrue(foundDisassemblyLine != -1, testCase + " : no disassembly section found"); + Asserts.assertTrue(foundEntryPointLine != -1, testCase + " : no entry point found"); } } -- GitLab From 710653ce1856d13161ae1786d7c5f71997536e78 Mon Sep 17 00:00:00 2001 From: Daniel Fuchs Date: Tue, 15 Mar 2022 12:59:54 +0000 Subject: [PATCH 244/340] 8254786: java/net/httpclient/CancelRequestTest.java failing intermittently Reviewed-by: jpai, michaelm --- .../jdk/internal/net/http/Exchange.java | 53 ++++++++++++++----- .../internal/net/http/Http2ClientImpl.java | 12 +++-- .../internal/net/http/Http2Connection.java | 6 ++- .../net/httpclient/CancelRequestTest.java | 4 +- 4 files changed, 56 insertions(+), 19 deletions(-) diff --git a/src/java.net.http/share/classes/jdk/internal/net/http/Exchange.java b/src/java.net.http/share/classes/jdk/internal/net/http/Exchange.java index 36af3005032..8c9282c0579 100644 --- a/src/java.net.http/share/classes/jdk/internal/net/http/Exchange.java +++ b/src/java.net.http/share/classes/jdk/internal/net/http/Exchange.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2022, 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 @@ -144,14 +144,45 @@ final class Exchange { private volatile boolean closeRequested; void connection(HttpConnection connection) { - this.connection = connection; - if (closeRequested) closeConnection(); + boolean closeRequested; + synchronized (this) { + // check whether this new connection should be + // closed + closeRequested = this.closeRequested; + if (!closeRequested) { + this.connection = connection; + } else { + // assert this.connection == null + this.closeRequested = false; + } + } + if (closeRequested) closeConnection(connection); } void closeConnection() { - closeRequested = true; - HttpConnection connection = this.connection; - this.connection = null; + HttpConnection connection; + synchronized (this) { + connection = this.connection; + if (connection == null) { + closeRequested = true; + } else { + this.connection = null; + } + } + closeConnection(connection); + } + + HttpConnection disable() { + HttpConnection connection; + synchronized (this) { + connection = this.connection; + this.connection = null; + this.closeRequested = false; + } + return connection; + } + + private static void closeConnection(HttpConnection connection) { if (connection != null) { try { connection.close(); @@ -160,11 +191,6 @@ final class Exchange { } } } - - void disable() { - connection = null; - closeRequested = false; - } } // Called for 204 response - when no body is permitted @@ -524,8 +550,11 @@ final class Exchange { client.client2(), this, e::drainLeftOverBytes) .thenCompose((Http2Connection c) -> { + HttpConnection connection = connectionAborter.disable(); boolean cached = c.offerConnection(); - if (cached) connectionAborter.disable(); + if (!cached && connection != null) { + connectionAborter.connection(connection); + } Stream s = c.getStream(1); if (s == null) { diff --git a/src/java.net.http/share/classes/jdk/internal/net/http/Http2ClientImpl.java b/src/java.net.http/share/classes/jdk/internal/net/http/Http2ClientImpl.java index 4101133a025..c3861b2ad9f 100644 --- a/src/java.net.http/share/classes/jdk/internal/net/http/Http2ClientImpl.java +++ b/src/java.net.http/share/classes/jdk/internal/net/http/Http2ClientImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2022, 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 @@ -28,7 +28,6 @@ package jdk.internal.net.http; import java.io.EOFException; import java.io.IOException; import java.io.UncheckedIOException; -import java.net.ConnectException; import java.net.InetSocketAddress; import java.net.URI; import java.util.Base64; @@ -101,7 +100,7 @@ class Http2ClientImpl { Http2Connection connection = connections.get(key); if (connection != null) { try { - if (connection.closed || !connection.reserveStream(true)) { + if (!connection.isOpen() || !connection.reserveStream(true)) { if (debug.on()) debug.log("removing found closed or closing connection: %s", connection); deleteConnection(connection); @@ -153,7 +152,7 @@ class Http2ClientImpl { */ boolean offerConnection(Http2Connection c) { if (debug.on()) debug.log("offering to the connection pool: %s", c); - if (c.closed || c.finalStream()) { + if (!c.isOpen() || c.finalStream()) { if (debug.on()) debug.log("skipping offered closed or closing connection: %s", c); return false; @@ -161,6 +160,11 @@ class Http2ClientImpl { String key = c.key(); synchronized(this) { + if (!c.isOpen()) { + if (debug.on()) + debug.log("skipping offered closed or closing connection: %s", c); + return false; + } Http2Connection c1 = connections.putIfAbsent(key, c); if (c1 != null) { c.setFinalStream(); diff --git a/src/java.net.http/share/classes/jdk/internal/net/http/Http2Connection.java b/src/java.net.http/share/classes/jdk/internal/net/http/Http2Connection.java index 6a07d755e69..8cd9db1210a 100644 --- a/src/java.net.http/share/classes/jdk/internal/net/http/Http2Connection.java +++ b/src/java.net.http/share/classes/jdk/internal/net/http/Http2Connection.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2022, 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 @@ -880,6 +880,10 @@ class Http2Connection { } } + boolean isOpen() { + return !closed && connection.channel().isOpen(); + } + void resetStream(int streamid, int code) { try { if (connection.channel().isOpen()) { diff --git a/test/jdk/java/net/httpclient/CancelRequestTest.java b/test/jdk/java/net/httpclient/CancelRequestTest.java index de48316a25b..95d56fdbcce 100644 --- a/test/jdk/java/net/httpclient/CancelRequestTest.java +++ b/test/jdk/java/net/httpclient/CancelRequestTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2022, 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 - * @bug 8245462 8229822 + * @bug 8245462 8229822 8254786 * @summary Tests cancelling the request. * @library /test/lib http2/server * @key randomness -- GitLab From 2cddf3f5391518ea40796e6c4759047d51b7b312 Mon Sep 17 00:00:00 2001 From: Zhengyu Gu Date: Tue, 15 Mar 2022 14:16:35 +0000 Subject: [PATCH 245/340] 8282887: Potential memory leak in sun.util.locale.provider.HostLocaleProviderAdapterImpl.getNumberPattern() on Windows Reviewed-by: naoto, alanb --- .../native/libjava/HostLocaleProviderAdapter_md.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/java.base/windows/native/libjava/HostLocaleProviderAdapter_md.c b/src/java.base/windows/native/libjava/HostLocaleProviderAdapter_md.c index 5d5f3ab476e..ebbad326146 100644 --- a/src/java.base/windows/native/libjava/HostLocaleProviderAdapter_md.c +++ b/src/java.base/windows/native/libjava/HostLocaleProviderAdapter_md.c @@ -359,18 +359,17 @@ JNIEXPORT jobjectArray JNICALL Java_sun_util_locale_provider_HostLocaleProviderA JNIEXPORT jstring JNICALL Java_sun_util_locale_provider_HostLocaleProviderAdapterImpl_getNumberPattern (JNIEnv *env, jclass cls, jint numberStyle, jstring jlangtag) { const jchar *langtag; - jstring ret; + jstring ret = NULL; WCHAR * pattern; langtag = (*env)->GetStringChars(env, jlangtag, NULL); CHECK_NULL_RETURN(langtag, NULL); pattern = getNumberPattern(langtag, numberStyle); - CHECK_NULL_RETURN(pattern, NULL); - + if (!IS_NULL(pattern)) { + ret = (*env)->NewString(env, pattern, (jsize)wcslen(pattern)); + free(pattern); + } (*env)->ReleaseStringChars(env, jlangtag, langtag); - ret = (*env)->NewString(env, pattern, (jsize)wcslen(pattern)); - free(pattern); - return ret; } -- GitLab From 4de72014d3a33469399fec6f428f35c47c4cfbe0 Mon Sep 17 00:00:00 2001 From: Tyler Steele Date: Tue, 15 Mar 2022 14:52:27 +0000 Subject: [PATCH 246/340] 8283122: [AIX, s390] UnsafeCopyMemory 'Mismatched' Tests Fail on Big Endian Systems Reviewed-by: thartmann, stuefe --- .../jtreg/compiler/unsafe/UnsafeCopyMemory.java | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/test/hotspot/jtreg/compiler/unsafe/UnsafeCopyMemory.java b/test/hotspot/jtreg/compiler/unsafe/UnsafeCopyMemory.java index 51cbb5e8c2f..eb6f065305e 100644 --- a/test/hotspot/jtreg/compiler/unsafe/UnsafeCopyMemory.java +++ b/test/hotspot/jtreg/compiler/unsafe/UnsafeCopyMemory.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2022 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 @@ -36,11 +36,14 @@ package compiler.unsafe; import jdk.internal.misc.Unsafe; +import java.nio.ByteOrder; import static jdk.test.lib.Asserts.assertEQ; public class UnsafeCopyMemory { static private Unsafe UNSAFE = Unsafe.getUnsafe(); + static final boolean IS_BIG_ENDIAN = ByteOrder.nativeOrder() == ByteOrder.BIG_ENDIAN; + // On-heap arrays static int[] srcArr = new int[1]; static int[] dstArr = new int[1]; @@ -104,8 +107,12 @@ public class UnsafeCopyMemory { srcArr [readIdx] = v1; dstArrL[writeIdx] = v2; + // On LE systems, low-order bytes of long and int overlap, but + // on BE systems, they differ by the size of an int. + long mismatchedOffset = Unsafe.ARRAY_LONG_BASE_OFFSET + (IS_BIG_ENDIAN ? 4 : 0); + UNSAFE.copyMemory(srcArr, Unsafe.ARRAY_INT_BASE_OFFSET, - dstArrL, Unsafe.ARRAY_LONG_BASE_OFFSET, 4); // mismatched + dstArrL, mismatchedOffset, 4); // mismatched long r = resArrL[0]; // snapshot srcArr[readIdx] = v3; @@ -156,6 +163,7 @@ public class UnsafeCopyMemory { Object srcArrLocal = (flag ? srcArrIntLocal : srcArrLongLocal); long srcOffset = (flag ? Unsafe.ARRAY_INT_BASE_OFFSET : Unsafe.ARRAY_LONG_BASE_OFFSET); + srcOffset += (!flag && IS_BIG_ENDIAN ? 4 : 0); srcArrIntLocal[0] = v1; srcArrLongLocal[0] = v1; @@ -179,6 +187,7 @@ public class UnsafeCopyMemory { Object dstArrLocal = (flag ? dstArrIntLocal : dstArrLongLocal); long dstOffset = (flag ? Unsafe.ARRAY_INT_BASE_OFFSET : Unsafe.ARRAY_LONG_BASE_OFFSET); + dstOffset += (!flag && IS_BIG_ENDIAN ? 4 : 0); srcArr[readIdx] = v1; dstArrIntLocal[0] = v2; -- GitLab From f43ffe211f8ff287697092c39e4c25a16b40a383 Mon Sep 17 00:00:00 2001 From: Hai-May Chao Date: Tue, 15 Mar 2022 15:54:47 +0000 Subject: [PATCH 247/340] 8282633: jarsigner output does not explain why an EC key is disabled if its curve has been disabled Reviewed-by: weijun --- .../sun/security/tools/keytool/Main.java | 30 ++---- .../classes/sun/security/util/KeyUtil.java | 24 ++++- .../sun/security/tools/jarsigner/Main.java | 35 ++++-- .../security/tools/jarsigner/Resources.java | 2 + .../tools/jarsigner/DisableCurveTest.java | 100 ++++++++++++++++++ 5 files changed, 160 insertions(+), 31 deletions(-) create mode 100644 test/jdk/sun/security/tools/jarsigner/DisableCurveTest.java diff --git a/src/java.base/share/classes/sun/security/tools/keytool/Main.java b/src/java.base/share/classes/sun/security/tools/keytool/Main.java index 032fcd768ea..462606c7f84 100644 --- a/src/java.base/share/classes/sun/security/tools/keytool/Main.java +++ b/src/java.base/share/classes/sun/security/tools/keytool/Main.java @@ -42,8 +42,6 @@ import java.security.cert.TrustAnchor; import java.security.cert.URICertStoreParameters; -import java.security.interfaces.ECKey; -import java.security.interfaces.EdECKey; import java.security.spec.ECParameterSpec; import java.text.Collator; import java.text.MessageFormat; @@ -2018,7 +2016,7 @@ public final class Main { ("Generating.keysize.bit.keyAlgName.key.pair.and.a.certificate.sigAlgName.issued.by.signerAlias.with.a.validity.of.validality.days.for")); Object[] source = { groupName == null ? keysize : KeyUtil.getKeySize(privKey), - fullDisplayAlgName(privKey), + KeyUtil.fullDisplayAlgName(privKey), newCert.getSigAlgName(), signerAlias, validity, @@ -2029,7 +2027,7 @@ public final class Main { ("Generating.keysize.bit.keyAlgName.key.pair.and.self.signed.certificate.sigAlgName.with.a.validity.of.validality.days.for")); Object[] source = { groupName == null ? keysize : KeyUtil.getKeySize(privKey), - fullDisplayAlgName(privKey), + KeyUtil.fullDisplayAlgName(privKey), newCert.getSigAlgName(), validity, x500Name}; @@ -3560,24 +3558,10 @@ public final class Main { } } - private String fullDisplayAlgName(Key key) { - String result = key.getAlgorithm(); - if (key instanceof ECKey) { - ECParameterSpec paramSpec = ((ECKey) key).getParams(); - if (paramSpec instanceof NamedCurve) { - NamedCurve nc = (NamedCurve)paramSpec; - result += " (" + nc.getNameAndAliases()[0] + ")"; - } - } else if (key instanceof EdECKey) { - result = ((EdECKey) key).getParams().getName(); - } - return result; - } - private String withWeakConstraint(Key key, CertPathConstraintsParameters cpcp) { int kLen = KeyUtil.getKeySize(key); - String displayAlg = fullDisplayAlgName(key); + String displayAlg = KeyUtil.fullDisplayAlgName(key); try { DISABLED_CHECK.permits(key.getAlgorithm(), cpcp, true); } catch (CertPathValidatorException e) { @@ -4946,13 +4930,13 @@ public final class Main { weakWarnings.add(String.format( rb.getString("whose.key.weak"), label, String.format(rb.getString("key.bit"), - KeyUtil.getKeySize(key), fullDisplayAlgName(key)))); + KeyUtil.getKeySize(key), KeyUtil.fullDisplayAlgName(key)))); } } catch (CertPathValidatorException e) { weakWarnings.add(String.format( rb.getString("whose.key.disabled"), label, String.format(rb.getString("key.bit"), - KeyUtil.getKeySize(key), fullDisplayAlgName(key)))); + KeyUtil.getKeySize(key), KeyUtil.fullDisplayAlgName(key)))); } } } @@ -4973,12 +4957,12 @@ public final class Main { weakWarnings.add(String.format( rb.getString("whose.key.disabled"), label, String.format(rb.getString("key.bit"), - KeyUtil.getKeySize(key), fullDisplayAlgName(key)))); + KeyUtil.getKeySize(key), KeyUtil.fullDisplayAlgName(key)))); } else if (!LEGACY_CHECK.permits(SIG_PRIMITIVE_SET, key)) { weakWarnings.add(String.format( rb.getString("whose.key.weak"), label, String.format(rb.getString("key.bit"), - KeyUtil.getKeySize(key), fullDisplayAlgName(key)))); + KeyUtil.getKeySize(key), KeyUtil.fullDisplayAlgName(key)))); } } } diff --git a/src/java.base/share/classes/sun/security/util/KeyUtil.java b/src/java.base/share/classes/sun/security/util/KeyUtil.java index a20ebffa5ff..3648447e10e 100644 --- a/src/java.base/share/classes/sun/security/util/KeyUtil.java +++ b/src/java.base/share/classes/sun/security/util/KeyUtil.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2022, 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 @@ -190,6 +190,28 @@ public final class KeyUtil { return -1; } + /** + * Returns the algorithm name of the given key object. If an EC key is + * specified, returns the algorithm name and its named curve. + * + * @param key the key object, cannot be null + * @return the algorithm name of the given key object, or return in the + * form of "EC (named curve)" if the given key object is an EC key + */ + public static final String fullDisplayAlgName(Key key) { + String result = key.getAlgorithm(); + if (key instanceof ECKey) { + ECParameterSpec paramSpec = ((ECKey) key).getParams(); + if (paramSpec instanceof NamedCurve) { + NamedCurve nc = (NamedCurve)paramSpec; + result += " (" + nc.getNameAndAliases()[0] + ")"; + } + } else if (key instanceof EdECKey) { + result = ((EdECKey) key).getParams().getName(); + } + return result; + } + /** * Returns whether the key is valid or not. *

    diff --git a/src/jdk.jartool/share/classes/sun/security/tools/jarsigner/Main.java b/src/jdk.jartool/share/classes/sun/security/tools/jarsigner/Main.java index 750b125f10d..1b9e23f0fde 100644 --- a/src/jdk.jartool/share/classes/sun/security/tools/jarsigner/Main.java +++ b/src/jdk.jartool/share/classes/sun/security/tools/jarsigner/Main.java @@ -30,6 +30,7 @@ import java.net.UnknownHostException; import java.net.URLClassLoader; import java.security.cert.CertPathValidatorException; import java.security.cert.PKIXBuilderParameters; +import java.security.interfaces.ECKey; import java.util.*; import java.util.stream.Collectors; import java.util.zip.*; @@ -1244,13 +1245,13 @@ public class Main { if ((legacyAlg & 8) == 8) { warnings.add(String.format( rb.getString("The.1.signing.key.has.a.keysize.of.2.which.is.considered.a.security.risk..This.key.size.will.be.disabled.in.a.future.update."), - privateKey.getAlgorithm(), KeyUtil.getKeySize(privateKey))); + KeyUtil.fullDisplayAlgName(privateKey), KeyUtil.getKeySize(privateKey))); } if ((disabledAlg & 8) == 8) { errors.add(String.format( rb.getString("The.1.signing.key.has.a.keysize.of.2.which.is.considered.a.security.risk.and.is.disabled."), - privateKey.getAlgorithm(), KeyUtil.getKeySize(privateKey))); + KeyUtil.fullDisplayAlgName(privateKey), KeyUtil.getKeySize(privateKey))); } } else { if ((legacyAlg & 1) != 0) { @@ -1274,7 +1275,7 @@ public class Main { if ((legacyAlg & 8) == 8) { warnings.add(String.format( rb.getString("The.1.signing.key.has.a.keysize.of.2.which.is.considered.a.security.risk..This.key.size.will.be.disabled.in.a.future.update."), - weakPublicKey.getAlgorithm(), KeyUtil.getKeySize(weakPublicKey))); + KeyUtil.fullDisplayAlgName(weakPublicKey), KeyUtil.getKeySize(weakPublicKey))); } } @@ -1451,7 +1452,12 @@ public class Main { JAR_DISABLED_CHECK.permits(key.getAlgorithm(), jcp, true); } catch (CertPathValidatorException e) { disabledAlgFound = true; - return String.format(rb.getString("key.bit.disabled"), kLen); + if (key instanceof ECKey) { + return String.format(rb.getString("key.bit.eccurve.disabled"), kLen, + KeyUtil.fullDisplayAlgName(key)); + } else { + return String.format(rb.getString("key.bit.disabled"), kLen); + } } try { LEGACY_CHECK.permits(key.getAlgorithm(), jcp, true); @@ -1463,7 +1469,12 @@ public class Main { } catch (CertPathValidatorException e) { weakPublicKey = key; legacyAlg |= 8; - return String.format(rb.getString("key.bit.weak"), kLen); + if (key instanceof ECKey) { + return String.format(rb.getString("key.bit.eccurve.weak"), kLen, + KeyUtil.fullDisplayAlgName(key)); + } else { + return String.format(rb.getString("key.bit.weak"), kLen); + } } } @@ -1516,7 +1527,12 @@ public class Main { try { CERTPATH_DISABLED_CHECK.permits(key.getAlgorithm(), cpcp, true); } catch (CertPathValidatorException e) { - return String.format(rb.getString("key.bit.disabled"), kLen); + if (key instanceof ECKey) { + return String.format(rb.getString("key.bit.eccurve.disabled"), kLen, + KeyUtil.fullDisplayAlgName(key)); + } else { + return String.format(rb.getString("key.bit.disabled"), kLen); + } } try { LEGACY_CHECK.permits(key.getAlgorithm(), cpcp, true); @@ -1526,7 +1542,12 @@ public class Main { return rb.getString("unknown.size"); } } catch (CertPathValidatorException e) { - return String.format(rb.getString("key.bit.weak"), kLen); + if (key instanceof ECKey) { + return String.format(rb.getString("key.bit.eccurve.weak"), kLen, + KeyUtil.fullDisplayAlgName(key)); + } else { + return String.format(rb.getString("key.bit.weak"), kLen); + } } } diff --git a/src/jdk.jartool/share/classes/sun/security/tools/jarsigner/Resources.java b/src/jdk.jartool/share/classes/sun/security/tools/jarsigner/Resources.java index f5a1bb2e3cb..37a1f24f90d 100644 --- a/src/jdk.jartool/share/classes/sun/security/tools/jarsigner/Resources.java +++ b/src/jdk.jartool/share/classes/sun/security/tools/jarsigner/Resources.java @@ -181,7 +181,9 @@ public class Resources extends java.util.ListResourceBundle { {"with.algparams.disabled", "%1$s using %2$s (disabled)"}, {"key.bit", "%d-bit key"}, {"key.bit.weak", "%d-bit key (weak)"}, + {"key.bit.eccurve.weak", "%1$d-bit %2$s key (weak)"}, {"key.bit.disabled", "%d-bit key (disabled)"}, + {"key.bit.eccurve.disabled", "%1$d-bit %2$s key (disabled)"}, {"unknown.size", "unknown size"}, {"extra.attributes.detected", "POSIX file permission and/or symlink attributes detected. These attributes are ignored when signing and are not protected by the signature."}, diff --git a/test/jdk/sun/security/tools/jarsigner/DisableCurveTest.java b/test/jdk/sun/security/tools/jarsigner/DisableCurveTest.java new file mode 100644 index 00000000000..9270899182c --- /dev/null +++ b/test/jdk/sun/security/tools/jarsigner/DisableCurveTest.java @@ -0,0 +1,100 @@ +/* + * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 8282633 + * @summary jarsigner should display the named curve to better explain why + * an EC key is disabled or will be disabled. + * @library /test/lib + */ + +import jdk.test.lib.SecurityTools; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.util.JarUtils; + +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; + +public class DisableCurveTest { + private static final String JAVA_SECURITY_FILE = "java.security"; + + public static void main(String[] args) throws Exception{ + SecurityTools.keytool("-keystore ks -storepass changeit " + + "-genkeypair -keyalg EC -alias ca -dname CN=CA " + + "-ext bc:c") + .shouldHaveExitValue(0); + + JarUtils.createJarFile(Path.of("a.jar"), Path.of("."), Path.of("ks")); + + Files.writeString(Files.createFile(Paths.get(JAVA_SECURITY_FILE)), + "jdk.jar.disabledAlgorithms=secp256r1\n" + + "jdk.certpath.disabledAlgorithms=secp256r1\n"); + + SecurityTools.jarsigner("-keystore ks -storepass changeit " + + "-signedjar signeda.jar -verbose " + + "-J-Djava.security.properties=" + + JAVA_SECURITY_FILE + + " a.jar ca") + .shouldContain(">>> Signer") + .shouldContain("Signature algorithm: SHA256withECDSA, 256-bit EC (secp256r1) key (disabled)") + .shouldContain("Warning:") + .shouldContain("The EC (secp256r1) signing key has a keysize of 256 which is considered a security risk and is disabled") + .shouldHaveExitValue(0); + + SecurityTools.jarsigner("-verify signeda.jar " + + "-J-Djava.security.properties=" + + JAVA_SECURITY_FILE + + " -keystore ks -storepass changeit -verbose -debug") + .shouldContain("- Signed by") + .shouldContain("Signature algorithm: SHA256withECDSA, 256-bit EC (secp256r1) key (disabled)") + .shouldContain("WARNING: The jar will be treated as unsigned") + .shouldHaveExitValue(0); + + Files.deleteIfExists(Paths.get(JAVA_SECURITY_FILE)); + Files.writeString(Files.createFile(Paths.get(JAVA_SECURITY_FILE)), + "jdk.security.legacyAlgorithms=secp256r1\n"); + + SecurityTools.jarsigner("-keystore ks -storepass changeit " + + "-signedjar signeda.jar -verbose " + + "-J-Djava.security.properties=" + + JAVA_SECURITY_FILE + + " a.jar ca") + .shouldContain(">>> Signer") + .shouldContain("Signature algorithm: SHA256withECDSA, 256-bit EC (secp256r1) key (weak)") + .shouldContain("Warning:") + .shouldContain("The EC (secp256r1) signing key has a keysize of 256 which is considered a security risk. This key size will be disabled in a future update") + .shouldHaveExitValue(0); + + SecurityTools.jarsigner("-verify signeda.jar " + + "-J-Djava.security.properties=" + + JAVA_SECURITY_FILE + + " -keystore ks -storepass changeit -verbose -debug") + .shouldContain("- Signed by") + .shouldContain("Signature algorithm: SHA256withECDSA, 256-bit EC (secp256r1) key (weak)") + .shouldContain("jar verified") + .shouldContain("The EC (secp256r1) signing key has a keysize of 256 which is considered a security risk. This key size will be disabled in a future update") + .shouldHaveExitValue(0); + } +} -- GitLab From 671b6efd6126384c0630d1cd84f53f52995e68d8 Mon Sep 17 00:00:00 2001 From: Joe Darcy Date: Tue, 15 Mar 2022 16:05:37 +0000 Subject: [PATCH 248/340] 8283143: Use minimal-length literals to initialize PI and E constants Reviewed-by: smarks --- src/java.base/share/classes/java/lang/Math.java | 6 +++--- src/java.base/share/classes/java/lang/StrictMath.java | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/java.base/share/classes/java/lang/Math.java b/src/java.base/share/classes/java/lang/Math.java index 7341aa56a6a..649a85cfc52 100644 --- a/src/java.base/share/classes/java/lang/Math.java +++ b/src/java.base/share/classes/java/lang/Math.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1994, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1994, 2022, 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 @@ -131,14 +131,14 @@ public final class Math { * The {@code double} value that is closer than any other to * e, the base of the natural logarithms. */ - public static final double E = 2.7182818284590452354; + public static final double E = 2.718281828459045; /** * The {@code double} value that is closer than any other to * pi, the ratio of the circumference of a circle to its * diameter. */ - public static final double PI = 3.14159265358979323846; + public static final double PI = 3.141592653589793; /** * Constant by which to multiply an angular value in degrees to obtain an diff --git a/src/java.base/share/classes/java/lang/StrictMath.java b/src/java.base/share/classes/java/lang/StrictMath.java index 53b25fedebb..b212ab592cb 100644 --- a/src/java.base/share/classes/java/lang/StrictMath.java +++ b/src/java.base/share/classes/java/lang/StrictMath.java @@ -92,14 +92,14 @@ public final class StrictMath { * The {@code double} value that is closer than any other to * e, the base of the natural logarithms. */ - public static final double E = 2.7182818284590452354; + public static final double E = 2.718281828459045; /** * The {@code double} value that is closer than any other to * pi, the ratio of the circumference of a circle to its * diameter. */ - public static final double PI = 3.14159265358979323846; + public static final double PI = 3.141592653589793; /** * Returns the trigonometric sine of an angle. Special cases: -- GitLab From 05a83e03ca35b4885b48bb0e7d188baf8f7d9d7f Mon Sep 17 00:00:00 2001 From: Joe Darcy Date: Tue, 15 Mar 2022 16:22:11 +0000 Subject: [PATCH 249/340] 8283124: Add constant for tau to Math and StrictMath Reviewed-by: bpb, iris --- src/java.base/share/classes/java/lang/Math.java | 17 +++++++++++++++-- .../share/classes/java/lang/StrictMath.java | 15 ++++++++++++++- 2 files changed, 29 insertions(+), 3 deletions(-) diff --git a/src/java.base/share/classes/java/lang/Math.java b/src/java.base/share/classes/java/lang/Math.java index 649a85cfc52..6d8fa48c976 100644 --- a/src/java.base/share/classes/java/lang/Math.java +++ b/src/java.base/share/classes/java/lang/Math.java @@ -135,11 +135,24 @@ public final class Math { /** * The {@code double} value that is closer than any other to - * pi, the ratio of the circumference of a circle to its - * diameter. + * pi (π), the ratio of the circumference of a circle to + * its diameter. */ public static final double PI = 3.141592653589793; + /** + * The {@code double} value that is closer than any other to + * tau (τ), the ratio of the circumference of a circle + * to its radius. + * + * @apiNote + * The value of pi is one half that of tau; in other + * words, tau is double pi . + * + * @since 19 + */ + public static final double TAU = 2.0 * PI; + /** * Constant by which to multiply an angular value in degrees to obtain an * angular value in radians. diff --git a/src/java.base/share/classes/java/lang/StrictMath.java b/src/java.base/share/classes/java/lang/StrictMath.java index b212ab592cb..b551288a38f 100644 --- a/src/java.base/share/classes/java/lang/StrictMath.java +++ b/src/java.base/share/classes/java/lang/StrictMath.java @@ -96,11 +96,24 @@ public final class StrictMath { /** * The {@code double} value that is closer than any other to - * pi, the ratio of the circumference of a circle to its + * pi (π), the ratio of the circumference of a circle to its * diameter. */ public static final double PI = 3.141592653589793; + /** + * The {@code double} value that is closer than any other to + * tau (τ), the ratio of the circumference of a circle + * to its radius. + * + * @apiNote + * The value of pi is one half that of tau; in other + * words, tau is double pi . + * + * @since 19 + */ + public static final double TAU = 2.0 * PI; + /** * Returns the trigonometric sine of an angle. Special cases: *

    • If the argument is NaN or an infinity, then the -- GitLab From 12dca36c73583d0ed2e1f684b056100dc1f2ef55 Mon Sep 17 00:00:00 2001 From: Tobias Hartmann Date: Tue, 15 Mar 2022 16:28:54 +0000 Subject: [PATCH 250/340] 8283189: Bad copyright header in UnsafeCopyMemory.java Reviewed-by: chagedorn, dcubed --- test/hotspot/jtreg/compiler/unsafe/UnsafeCopyMemory.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/hotspot/jtreg/compiler/unsafe/UnsafeCopyMemory.java b/test/hotspot/jtreg/compiler/unsafe/UnsafeCopyMemory.java index eb6f065305e..950fef40ec0 100644 --- a/test/hotspot/jtreg/compiler/unsafe/UnsafeCopyMemory.java +++ b/test/hotspot/jtreg/compiler/unsafe/UnsafeCopyMemory.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2022, 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 -- GitLab From 32f8437d85a003914d5ca35bdddebdc732ab222d Mon Sep 17 00:00:00 2001 From: Joe Darcy Date: Tue, 15 Mar 2022 17:33:45 +0000 Subject: [PATCH 251/340] 8283075: Bad IllegalArgumentException message for out of range rank from ClassDesc.arrayType(int) Reviewed-by: vromero, alanb --- .../classes/java/lang/constant/ClassDesc.java | 26 ++++++++++++++----- .../jdk/java/lang/constant/ClassDescTest.java | 16 +++++++++++- 2 files changed, 35 insertions(+), 7 deletions(-) diff --git a/src/java.base/share/classes/java/lang/constant/ClassDesc.java b/src/java.base/share/classes/java/lang/constant/ClassDesc.java index 14923594c0e..c992bfb4380 100644 --- a/src/java.base/share/classes/java/lang/constant/ClassDesc.java +++ b/src/java.base/share/classes/java/lang/constant/ClassDesc.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2022, 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 @@ -148,7 +148,8 @@ public sealed interface ClassDesc * is described by this {@linkplain ClassDesc}. * * @return a {@linkplain ClassDesc} describing the array type - * @throws IllegalStateException if the resulting {@linkplain ClassDesc} would have an array rank of greater than 255 + * @throws IllegalStateException if the resulting {@linkplain + * ClassDesc} would have an array rank of greater than 255 * @jvms 4.4.1 The CONSTANT_Class_info Structure */ default ClassDesc arrayType() { @@ -167,14 +168,27 @@ public sealed interface ClassDesc * * @param rank the rank of the array * @return a {@linkplain ClassDesc} describing the array type - * @throws IllegalArgumentException if the rank is less than or equal to zero or if the rank of the resulting array type is + * @throws IllegalArgumentException if the rank is less than or + * equal to zero or if the rank of the resulting array type is * greater than 255 * @jvms 4.4.1 The CONSTANT_Class_info Structure */ default ClassDesc arrayType(int rank) { - int currentDepth = ConstantUtils.arrayDepth(descriptorString()); - if (rank <= 0 || currentDepth + rank > ConstantUtils.MAX_ARRAY_TYPE_DESC_DIMENSIONS) - throw new IllegalArgumentException("rank: " + currentDepth + rank); + int netRank; + if (rank <= 0) { + throw new IllegalArgumentException("rank " + rank + " is not a positive value"); + } + try { + int currentDepth = ConstantUtils.arrayDepth(descriptorString()); + netRank = Math.addExact(currentDepth, rank); + if (netRank > ConstantUtils.MAX_ARRAY_TYPE_DESC_DIMENSIONS) { + throw new IllegalArgumentException("rank: " + netRank + + " exceeds maximum supported dimension of " + + ConstantUtils.MAX_ARRAY_TYPE_DESC_DIMENSIONS); + } + } catch (ArithmeticException ae) { + throw new IllegalArgumentException("Integer overflow in rank computation"); + } return ClassDesc.ofDescriptor("[".repeat(rank) + descriptorString()); } diff --git a/test/jdk/java/lang/constant/ClassDescTest.java b/test/jdk/java/lang/constant/ClassDescTest.java index 32cf19b4fb4..81104e92c49 100644 --- a/test/jdk/java/lang/constant/ClassDescTest.java +++ b/test/jdk/java/lang/constant/ClassDescTest.java @@ -42,7 +42,7 @@ import static org.testng.Assert.fail; /** * @test - * @bug 8215510 + * @bug 8215510 8283075 * @compile ClassDescTest.java * @run testng ClassDescTest * @summary unit tests for java.lang.constant.ClassDesc @@ -184,6 +184,19 @@ public class ClassDescTest extends SymbolicDescTest { } } + private void testArrayRankOverflow() { + ClassDesc TwoDArrayDesc = + String.class.describeConstable().get().arrayType().arrayType(); + + try { + TwoDArrayDesc.arrayType(Integer.MAX_VALUE); + fail(""); + } catch (IllegalArgumentException iae) { + // Expected + } + } + + public void testArrayClassDesc() throws ReflectiveOperationException { for (String d : basicDescs) { ClassDesc a0 = ClassDesc.ofDescriptor(d); @@ -218,6 +231,7 @@ public class ClassDescTest extends SymbolicDescTest { testBadArrayRank(ConstantDescs.CD_int); testBadArrayRank(ConstantDescs.CD_String); testBadArrayRank(ClassDesc.of("Bar")); + testArrayRankOverflow(); } } -- GitLab From ac06bdb1239a97b7ea2fee8280da8ebc9728dc30 Mon Sep 17 00:00:00 2001 From: Man Cao Date: Tue, 15 Mar 2022 20:05:33 +0000 Subject: [PATCH 252/340] 8282507: Add a separate license file for hsdis Reviewed-by: ihse --- src/utils/hsdis/hsdis-license.txt | 35 +++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 src/utils/hsdis/hsdis-license.txt diff --git a/src/utils/hsdis/hsdis-license.txt b/src/utils/hsdis/hsdis-license.txt new file mode 100644 index 00000000000..3c0b0823265 --- /dev/null +++ b/src/utils/hsdis/hsdis-license.txt @@ -0,0 +1,35 @@ +The Universal Permissive License (UPL), Version 1.0 + +Subject to the condition set forth below, permission is hereby granted to +any person obtaining a copy of this software, associated documentation +and/or data (collectively the "Software"), free of charge and under any +and all copyright rights in the Software, and any and all patent rights +owned or freely licensable by each licensor hereunder covering either (i) +the unmodified Software as contributed to or provided by such licensor, +or (ii) the Larger Works (as defined below), to deal in both + +(a) the Software, and + +(b) any piece of software and/or hardware listed in the lrgrwrks.txt file +if one is included with the Software (each a "Larger Work" to which the +Software is contributed by such licensors), + +without restriction, including without limitation the rights to copy, +create derivative works of, display, perform, and distribute the Software +and make, use, sell, offer for sale, import, export, have made, and have +sold the Software and the Larger Work(s), and to sublicense the foregoing +rights on either these or other terms. + +This license is subject to the following condition: + +The above copyright notice and either this complete permission notice or +at a minimum a reference to the UPL must be included in all copies or +substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +USE OR OTHER DEALINGS IN THE SOFTWARE. -- GitLab From 1465ea98b7736b5960a8b546ccc366c3e3260bdd Mon Sep 17 00:00:00 2001 From: Dean Long Date: Tue, 15 Mar 2022 20:17:36 +0000 Subject: [PATCH 253/340] 8282355: compiler/arguments/TestCodeEntryAlignment.java failed "guarantee(sect->end() <= tend) failed: sanity" Reviewed-by: jiefu, thartmann, shade --- src/hotspot/share/runtime/stubRoutines.cpp | 12 +++++++++--- .../compiler/arguments/TestCodeEntryAlignment.java | 8 ++++++++ 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/src/hotspot/share/runtime/stubRoutines.cpp b/src/hotspot/share/runtime/stubRoutines.cpp index 591950fa213..c378ab09dc8 100644 --- a/src/hotspot/share/runtime/stubRoutines.cpp +++ b/src/hotspot/share/runtime/stubRoutines.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2022, 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 @@ -215,7 +215,10 @@ void StubRoutines::initialize1() { if (_code1 == NULL) { ResourceMark rm; TraceTime timer("StubRoutines generation 1", TRACETIME_LOG(Info, startuptime)); - _code1 = BufferBlob::create("StubRoutines (1)", code_size1); + // Add extra space for large CodeEntryAlignment + int max_aligned_stubs = 10; + int size = code_size1 + CodeEntryAlignment * max_aligned_stubs; + _code1 = BufferBlob::create("StubRoutines (1)", size); if (_code1 == NULL) { vm_exit_out_of_memory(code_size1, OOM_MALLOC_ERROR, "CodeCache: no room for StubRoutines (1)"); } @@ -269,7 +272,10 @@ void StubRoutines::initialize2() { if (_code2 == NULL) { ResourceMark rm; TraceTime timer("StubRoutines generation 2", TRACETIME_LOG(Info, startuptime)); - _code2 = BufferBlob::create("StubRoutines (2)", code_size2); + // Add extra space for large CodeEntryAlignment + int max_aligned_stubs = 100; + int size = code_size2 + CodeEntryAlignment * max_aligned_stubs; + _code2 = BufferBlob::create("StubRoutines (2)", size); if (_code2 == NULL) { vm_exit_out_of_memory(code_size2, OOM_MALLOC_ERROR, "CodeCache: no room for StubRoutines (2)"); } diff --git a/test/hotspot/jtreg/compiler/arguments/TestCodeEntryAlignment.java b/test/hotspot/jtreg/compiler/arguments/TestCodeEntryAlignment.java index fd6c8ca50bf..15a60382245 100644 --- a/test/hotspot/jtreg/compiler/arguments/TestCodeEntryAlignment.java +++ b/test/hotspot/jtreg/compiler/arguments/TestCodeEntryAlignment.java @@ -1,5 +1,6 @@ /* * Copyright (c) 2022, Red Hat, Inc. All rights reserved. + * Copyright (c) 2022, 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,6 +73,13 @@ public class TestCodeEntryAlignment { "-XX:CodeEntryAlignment=" + align ); } + for (int align = 256; align <= 1024; align *= 2) { + shouldPass( + "-XX:+UnlockExperimentalVMOptions", + "-XX:CodeCacheSegmentSize=" + align, + "-XX:CodeEntryAlignment=" + align + ); + } } } -- GitLab From bacfaa3ee16882563200ef3b3df4441b33664451 Mon Sep 17 00:00:00 2001 From: Quan Anh Mai Date: Wed, 16 Mar 2022 01:10:22 +0000 Subject: [PATCH 254/340] 8282414: x86: Enhance the assembler to generate more compact instructions Reviewed-by: thartmann, sviswanathan --- src/hotspot/cpu/x86/assembler_x86.cpp | 96 ++++++++++++++++++++++----- src/hotspot/cpu/x86/assembler_x86.hpp | 6 +- src/hotspot/cpu/x86/x86_64.ad | 2 +- 3 files changed, 81 insertions(+), 23 deletions(-) diff --git a/src/hotspot/cpu/x86/assembler_x86.cpp b/src/hotspot/cpu/x86/assembler_x86.cpp index 03229421305..e287512b93c 100644 --- a/src/hotspot/cpu/x86/assembler_x86.cpp +++ b/src/hotspot/cpu/x86/assembler_x86.cpp @@ -300,12 +300,24 @@ void Assembler::emit_arith_b(int op1, int op2, Register dst, int imm8) { void Assembler::emit_arith(int op1, int op2, Register dst, int32_t imm32) { assert(isByte(op1) && isByte(op2), "wrong opcode"); - assert((op1 & 0x01) == 1, "should be 32bit operation"); - assert((op1 & 0x02) == 0, "sign-extension bit should not be set"); + assert(op1 == 0x81, "Unexpected opcode"); if (is8bit(imm32)) { emit_int24(op1 | 0x02, // set sign bit op2 | encode(dst), imm32 & 0xFF); + } else if (dst == rax) { + switch (op2) { + case 0xD0: emit_int8(0x15); break; // adc + case 0xC0: emit_int8(0x05); break; // add + case 0xE0: emit_int8(0x25); break; // and + case 0xF8: emit_int8(0x3D); break; // cmp + case 0xC8: emit_int8(0x0D); break; // or + case 0xD8: emit_int8(0x1D); break; // sbb + case 0xE8: emit_int8(0x2D); break; // sub + case 0xF0: emit_int8(0x35); break; // xor + default: ShouldNotReachHere(); + } + emit_int32(imm32); } else { emit_int16(op1, (op2 | encode(dst))); emit_int32(imm32); @@ -929,6 +941,16 @@ address Assembler::locate_operand(address inst, WhichOperand which) { tail_size = 1; break; + case 0x15: // adc rax, #32 + case 0x05: // add rax, #32 + case 0x25: // and rax, #32 + case 0x3D: // cmp rax, #32 + case 0x0D: // or rax, #32 + case 0x1D: // sbb rax, #32 + case 0x2D: // sub rax, #32 + case 0x35: // xor rax, #32 + return which == end_pc_operand ? ip + 4 : ip; + case 0x9B: switch (0xFF & *ip++) { case 0xD9: // fnstcw a @@ -954,6 +976,11 @@ address Assembler::locate_operand(address inst, WhichOperand which) { debug_only(has_disp32 = true); // has both kinds of operands! break; + case 0xA8: // testb rax, #8 + return which == end_pc_operand ? ip + 1 : ip; + case 0xA9: // testl/testq rax, #32 + return which == end_pc_operand ? ip + 4 : ip; + case 0xC1: // sal a, #8; sar a, #8; shl a, #8; shr a, #8 case 0xC6: // movb a, #8 case 0x80: // cmpb a, #8 @@ -1683,12 +1710,6 @@ void Assembler::cmpl(Address dst, int32_t imm32) { emit_int32(imm32); } -void Assembler::cmp(Register dst, int32_t imm32) { - prefix(dst); - emit_int8((unsigned char)0x3D); - emit_int32(imm32); -} - void Assembler::cmpl(Register dst, int32_t imm32) { prefix(dst); emit_arith(0x81, 0xF8, dst, imm32); @@ -5775,8 +5796,13 @@ void Assembler::subss(XMMRegister dst, Address src) { void Assembler::testb(Register dst, int imm8) { NOT_LP64(assert(dst->has_byte_register(), "must have byte register")); - (void) prefix_and_encode(dst->encoding(), true); - emit_arith_b(0xF6, 0xC0, dst, imm8); + if (dst == rax) { + emit_int8((unsigned char)0xA8); + emit_int8(imm8); + } else { + (void) prefix_and_encode(dst->encoding(), true); + emit_arith_b(0xF6, 0xC0, dst, imm8); + } } void Assembler::testb(Address dst, int imm8) { @@ -5787,14 +5813,34 @@ void Assembler::testb(Address dst, int imm8) { emit_int8(imm8); } +void Assembler::testl(Address dst, int32_t imm32) { + if (imm32 >= 0 && is8bit(imm32)) { + testb(dst, imm32); + return; + } + InstructionMark im(this); + emit_int8((unsigned char)0xF7); + emit_operand(as_Register(0), dst); + emit_int32(imm32); +} + void Assembler::testl(Register dst, int32_t imm32) { + if (imm32 >= 0 && is8bit(imm32) && dst->has_byte_register()) { + testb(dst, imm32); + return; + } // not using emit_arith because test // doesn't support sign-extension of // 8bit operands - int encode = dst->encoding(); - encode = prefix_and_encode(encode); - emit_int16((unsigned char)0xF7, (0xC0 | encode)); - emit_int32(imm32); + if (dst == rax) { + emit_int8((unsigned char)0xA9); + emit_int32(imm32); + } else { + int encode = dst->encoding(); + encode = prefix_and_encode(encode); + emit_int16((unsigned char)0xF7, (0xC0 | encode)); + emit_int32(imm32); + } } void Assembler::testl(Register dst, Register src) { @@ -13013,6 +13059,10 @@ void Assembler::subq(Register dst, Register src) { } void Assembler::testq(Address dst, int32_t imm32) { + if (imm32 >= 0) { + testl(dst, imm32); + return; + } InstructionMark im(this); emit_int16(get_prefixq(dst), (unsigned char)0xF7); emit_operand(as_Register(0), dst); @@ -13020,13 +13070,23 @@ void Assembler::testq(Address dst, int32_t imm32) { } void Assembler::testq(Register dst, int32_t imm32) { + if (imm32 >= 0) { + testl(dst, imm32); + return; + } // not using emit_arith because test // doesn't support sign-extension of // 8bit operands - int encode = dst->encoding(); - encode = prefixq_and_encode(encode); - emit_int16((unsigned char)0xF7, (0xC0 | encode)); - emit_int32(imm32); + if (dst == rax) { + prefix(REX_W); + emit_int8((unsigned char)0xA9); + emit_int32(imm32); + } else { + int encode = dst->encoding(); + encode = prefixq_and_encode(encode); + emit_int16((unsigned char)0xF7, (0xC0 | encode)); + emit_int32(imm32); + } } void Assembler::testq(Register dst, Register src) { diff --git a/src/hotspot/cpu/x86/assembler_x86.hpp b/src/hotspot/cpu/x86/assembler_x86.hpp index 3256b990cf7..7141e4b96c4 100644 --- a/src/hotspot/cpu/x86/assembler_x86.hpp +++ b/src/hotspot/cpu/x86/assembler_x86.hpp @@ -1081,15 +1081,12 @@ private: void cmpb(Address dst, int imm8); void cmpl(Address dst, int32_t imm32); - - void cmp(Register dst, int32_t imm32); void cmpl(Register dst, int32_t imm32); void cmpl(Register dst, Register src); void cmpl(Register dst, Address src); void cmpq(Address dst, int32_t imm32); void cmpq(Address dst, Register src); - void cmpq(Register dst, int32_t imm32); void cmpq(Register dst, Register src); void cmpq(Register dst, Address src); @@ -2099,9 +2096,10 @@ private: void subss(XMMRegister dst, Address src); void subss(XMMRegister dst, XMMRegister src); - void testb(Register dst, int imm8); void testb(Address dst, int imm8); + void testb(Register dst, int imm8); + void testl(Address dst, int32_t imm32); void testl(Register dst, int32_t imm32); void testl(Register dst, Register src); void testl(Register dst, Address src); diff --git a/src/hotspot/cpu/x86/x86_64.ad b/src/hotspot/cpu/x86/x86_64.ad index fbf71300dcd..bc04106f3f2 100644 --- a/src/hotspot/cpu/x86/x86_64.ad +++ b/src/hotspot/cpu/x86/x86_64.ad @@ -1926,7 +1926,7 @@ encode %{ Label done; // cmp $0x80000000,%eax - __ cmp(as_Register(RAX_enc), 0x80000000); + __ cmpl(as_Register(RAX_enc), 0x80000000); // jne e __ jccb(Assembler::notEqual, normal); -- GitLab From 27fe3d7f8db4ede6441a7cc325d9f29eb4a1d10d Mon Sep 17 00:00:00 2001 From: Toshio Nakamura Date: Wed, 16 Mar 2022 01:11:40 +0000 Subject: [PATCH 255/340] 8240756: [macos] SwingSet2:TableDemo:Printed Japanese characters were garbled Reviewed-by: prr, serb --- .../classes/sun/lwawt/macosx/CTextPipe.java | 80 ++++++++++- .../font/GlyphVector/MultiSlotFontTest.java | 136 ++++++++++++++++++ 2 files changed, 212 insertions(+), 4 deletions(-) create mode 100644 test/jdk/java/awt/font/GlyphVector/MultiSlotFontTest.java diff --git a/src/java.desktop/macosx/classes/sun/lwawt/macosx/CTextPipe.java b/src/java.desktop/macosx/classes/sun/lwawt/macosx/CTextPipe.java index f4dcc7ec675..6aa36453ac0 100644 --- a/src/java.desktop/macosx/classes/sun/lwawt/macosx/CTextPipe.java +++ b/src/java.desktop/macosx/classes/sun/lwawt/macosx/CTextPipe.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2022, 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 @@ -81,10 +81,57 @@ public class CTextPipe implements TextPipe { } } - public void drawGlyphVector(final SunGraphics2D sg2d, final GlyphVector gV, final float x, final float y) { - final Font prevFont = sg2d.getFont(); - sg2d.setFont(gV.getFont()); + private boolean hasSlotData(GlyphVector gv) { + final int length = gv.getNumGlyphs(); + for (int i = 0; i < length; i++) { + if ((gv.getGlyphCode(i) & CompositeGlyphMapper.SLOTMASK) != 0) { + return true; + } + } + return false; + } + + private Font getSlotFont(Font font, int slot) { + Font2D f2d = FontUtilities.getFont2D(font); + if (f2d instanceof CFont) { + CompositeFont cf = ((CFont)f2d).getCompositeFont2D(); + PhysicalFont pf = cf.getSlotFont(slot); + Font f = new Font(pf.getFontName(null), + font.getStyle(), font.getSize()); + return f; + } + return null; + } + + private GlyphVector getGlyphVectorWithRange(final Font font, final GlyphVector gV, int start, int count) { + int[] glyphs = new int[count]; + for (int i = 0; i < count; i++) { + glyphs[i] = gV.getGlyphCode(start+i) & CompositeGlyphMapper.GLYPHMASK; + } + // Positions should be null to recalculate by native methods, + // if GV was segmented. + StandardGlyphVector sgv = new StandardGlyphVector(font, + gV.getFontRenderContext(), + glyphs, + null, // positions + null, // indices + gV.getLayoutFlags()); + return sgv; + } + + private int getLengthOfSameSlot(final GlyphVector gV, final int targetSlot, final int start, final int length) { + int count = 1; + for (; start + count < length; count++) { + int slot = (gV.getGlyphCode(start + count) & + CompositeGlyphMapper.SLOTMASK) >> 24; + if (targetSlot != slot) { + break; + } + } + return count; + } + private void drawGlyphVectorImpl(final SunGraphics2D sg2d, final GlyphVector gV, final float x, final float y) { final long nativeStrikePtr = getNativeStrikePtr(sg2d); if (OSXSurfaceData.IsSimpleColor(sg2d.paint) && nativeStrikePtr != 0) { final OSXSurfaceData surfaceData = (OSXSurfaceData)sg2d.getSurfaceData(); @@ -92,6 +139,31 @@ public class CTextPipe implements TextPipe { } else { drawGlyphVectorAsShape(sg2d, gV, x, y); } + } + + public void drawGlyphVector(final SunGraphics2D sg2d, final GlyphVector gV, final float x, final float y) { + final Font prevFont = sg2d.getFont(); + sg2d.setFont(gV.getFont()); + + if (hasSlotData(gV)) { + final int length = gV.getNumGlyphs(); + float[] positions = gV.getGlyphPositions(0, length, null); + int start = 0; + while (start < length) { + int slot = (gV.getGlyphCode(start) & + CompositeGlyphMapper.SLOTMASK) >> 24; + sg2d.setFont(getSlotFont(gV.getFont(), slot)); + int count = getLengthOfSameSlot(gV, slot, start, length); + GlyphVector rangeGV = getGlyphVectorWithRange(sg2d.getFont(), + gV, start, count); + drawGlyphVectorImpl(sg2d, rangeGV, + x + positions[start * 2], + y + positions[start * 2 + 1]); + start += count; + } + } else { + drawGlyphVectorImpl(sg2d, gV, x, y); + } sg2d.setFont(prevFont); } diff --git a/test/jdk/java/awt/font/GlyphVector/MultiSlotFontTest.java b/test/jdk/java/awt/font/GlyphVector/MultiSlotFontTest.java new file mode 100644 index 00000000000..65acd420345 --- /dev/null +++ b/test/jdk/java/awt/font/GlyphVector/MultiSlotFontTest.java @@ -0,0 +1,136 @@ +/* + * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/** + * @test + * @bug 8240756 + * @summary Non-English characters are printed with wrong glyphs on MacOS + * @modules java.desktop/sun.java2d java.desktop/sun.java2d.loops java.desktop/sun.font + * @requires os.family == "mac" + * @run main MultiSlotFontTest + */ + +import java.awt.Color; +import java.awt.Dimension; +import java.awt.Font; +import java.awt.Graphics; +import java.awt.Image; +import java.awt.RenderingHints; +import java.awt.font.FontRenderContext; +import java.awt.font.GlyphVector; +import java.awt.image.BufferedImage; +import sun.font.StandardGlyphVector; +import sun.java2d.OSXOffScreenSurfaceData; +import sun.java2d.SunGraphics2D; +import sun.java2d.SurfaceData; +import sun.java2d.loops.SurfaceType; + +public class MultiSlotFontTest { + + private static final int WIDTH = 100; + private static final int HEIGHT = 60; + + private static final String TEST_STR = "\u3042\u3044\u3046\u3048\u304Aabc"; + private static final int EXPECTED_HEIGHT = 10; + private static final int EXPECTED_WIDTH = 77; + private static final int LIMIT_DIFF_HEIGHT = 3; + private static final int LIMIT_DIFF_WIDTH = 15; + + public static void main(String[] args) throws Exception { + MultiSlotFontTest test = new MultiSlotFontTest(); + } + + public MultiSlotFontTest() { + BufferedImage img = createImage(); + + SurfaceData sd = OSXOffScreenSurfaceData.createDataIC(img, + SurfaceType.IntRgb); + SunGraphics2D g2d = new SunGraphics2D(sd, + Color.BLACK, Color.WHITE, null); + Font font = g2d.getFont(); + + if (font.canDisplayUpTo(TEST_STR) != -1) { + System.out.println("There is no capable font. Skipping the test."); + System.out.println("Font: " + font); + return; + } + + FontRenderContext frc = new FontRenderContext(null, false, false); + StandardGlyphVector gv = new StandardGlyphVector(font, TEST_STR, frc); + g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, + RenderingHints.VALUE_ANTIALIAS_OFF); + g2d.drawGlyphVector(gv, 0.0f, (float)(HEIGHT - 5)); + g2d.dispose(); + + Dimension d = getBounds(img); + + if (Math.abs(d.height - EXPECTED_HEIGHT) > LIMIT_DIFF_HEIGHT || + Math.abs(d.width - EXPECTED_WIDTH) > LIMIT_DIFF_WIDTH) { + debugOut(img); + throw new RuntimeException( + "Incorrect GlyphVector shape " + d + "," + gv); + } + } + + private static BufferedImage createImage() { + BufferedImage image = new BufferedImage(WIDTH, HEIGHT, + BufferedImage.TYPE_INT_RGB); + Graphics g = image.createGraphics(); + g.setColor(Color.WHITE); + g.fillRect(0, 0, WIDTH, HEIGHT); + g.dispose(); + return image; + } + + private Dimension getBounds(BufferedImage img) { + int top = HEIGHT; + int left = WIDTH; + int right = 0; + int bottom = 0; + for (int y = 0; y < HEIGHT; y++) { + for (int x = 0; x < WIDTH; x++) { + if ((img.getRGB(x, y) & 0xFFFFFF) == 0) { + if (top > y) top = y; + if (bottom < y) bottom = y; + if (left > x) left = x; + if (right < x) right = x; + } + } + } + return new Dimension(right - left, bottom - top); + } + + private void debugOut(BufferedImage img) { + for (int y = 0; y < HEIGHT; y++) { + for (int x = 0; x < WIDTH; x++) { + int c = img.getRGB(x, y) & 0xFFFFFF; + if (c == 0) { + System.out.print("*"); + } else { + System.out.print(" "); + } + } + System.out.println(); + } + } +} -- GitLab From 4df24c5df38eeacc73097f71383916e9a0933839 Mon Sep 17 00:00:00 2001 From: Joe Darcy Date: Wed, 16 Mar 2022 02:02:10 +0000 Subject: [PATCH 256/340] 8283230: Improve @jls usage in ElementType Reviewed-by: jjg, iris --- .../share/classes/java/lang/annotation/ElementType.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/java.base/share/classes/java/lang/annotation/ElementType.java b/src/java.base/share/classes/java/lang/annotation/ElementType.java index c046272b12c..97275fb97ec 100644 --- a/src/java.base/share/classes/java/lang/annotation/ElementType.java +++ b/src/java.base/share/classes/java/lang/annotation/ElementType.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2022, 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 @@ -40,14 +40,14 @@ package java.lang.annotation; *

      The constants {@link #ANNOTATION_TYPE}, {@link #CONSTRUCTOR}, {@link * #FIELD}, {@link #LOCAL_VARIABLE}, {@link #METHOD}, {@link #PACKAGE}, {@link * #MODULE}, {@link #PARAMETER}, {@link #TYPE}, and {@link #TYPE_PARAMETER} - * correspond to the declaration contexts in JLS 9.6.4.1. + * correspond to the declaration contexts in JLS {@jls 9.6.4.1}. * *

      For example, an annotation whose interface is meta-annotated with * {@code @Target(ElementType.FIELD)} may only be written as a modifier for a * field declaration. * *

      The constant {@link #TYPE_USE} corresponds to the type contexts in JLS - * 4.11, as well as to two declaration contexts: class and interface + * {@jls 4.11}, as well as to two declaration contexts: class and interface * declarations (including annotation declarations) and type parameter * declarations. * -- GitLab From de4f04cb71a26ce03b96460cb8d1c1e28cd1ed38 Mon Sep 17 00:00:00 2001 From: Ioi Lam Date: Wed, 16 Mar 2022 03:12:48 +0000 Subject: [PATCH 257/340] 8253495: CDS generates non-deterministic output Reviewed-by: erikj, kbarrett, ccheung, ihse --- make/scripts/compare.sh | 4 ++-- src/hotspot/share/cds/archiveBuilder.cpp | 5 +++-- src/hotspot/share/cds/archiveUtils.hpp | 5 +++-- src/hotspot/share/cds/dumpTimeClassInfo.hpp | 5 +++-- src/hotspot/share/cds/heapShared.cpp | 8 ++++---- src/hotspot/share/cds/heapShared.hpp | 8 ++------ src/hotspot/share/gc/shared/collectedHeap.cpp | 18 +++++++++++++---- src/hotspot/share/gc/shared/collectedHeap.hpp | 1 + src/hotspot/share/prims/jvm.cpp | 20 +++++++++++++++++++ src/hotspot/share/runtime/os.cpp | 10 ++++++++-- test/hotspot/jtreg/ProblemList.txt | 1 - .../jtreg/runtime/cds/DeterministicDump.java | 10 +++++++++- .../cds/appcds/javaldr/LockDuringDump.java | 4 ++-- .../appcds/javaldr/LockDuringDumpAgent.java | 16 +++++++++++++-- test/lib/jdk/test/lib/cds/CDSOptions.java | 7 ++++++- 15 files changed, 91 insertions(+), 31 deletions(-) diff --git a/make/scripts/compare.sh b/make/scripts/compare.sh index cc05476c997..a0006fa4cee 100644 --- a/make/scripts/compare.sh +++ b/make/scripts/compare.sh @@ -1,6 +1,6 @@ #!/bin/bash # -# Copyright (c) 2012, 2021, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2012, 2022, 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 @@ -324,7 +324,7 @@ compare_general_files() { ! -name "*.cpl" ! -name "*.pdb" ! -name "*.exp" ! -name "*.ilk" \ ! -name "*.lib" ! -name "*.jmod" ! -name "*.exe" \ ! -name "*.obj" ! -name "*.o" ! -name "jspawnhelper" ! -name "*.a" \ - ! -name "*.tar.gz" ! -name "*.jsa" ! -name "gtestLauncher" \ + ! -name "*.tar.gz" ! -name "classes_nocoops.jsa" ! -name "gtestLauncher" \ ! -name "*.map" \ | $GREP -v "./bin/" | $SORT | $FILTER) diff --git a/src/hotspot/share/cds/archiveBuilder.cpp b/src/hotspot/share/cds/archiveBuilder.cpp index cb5c0aeb8c7..89529b2cf59 100644 --- a/src/hotspot/share/cds/archiveBuilder.cpp +++ b/src/hotspot/share/cds/archiveBuilder.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2022, 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 @@ -522,7 +522,8 @@ ArchiveBuilder::FollowMode ArchiveBuilder::get_follow_mode(MetaspaceClosure::Ref if (MetaspaceShared::is_in_shared_metaspace(obj)) { // Don't dump existing shared metadata again. return point_to_it; - } else if (ref->msotype() == MetaspaceObj::MethodDataType) { + } else if (ref->msotype() == MetaspaceObj::MethodDataType || + ref->msotype() == MetaspaceObj::MethodCountersType) { return set_to_null; } else { if (ref->msotype() == MetaspaceObj::ClassType) { diff --git a/src/hotspot/share/cds/archiveUtils.hpp b/src/hotspot/share/cds/archiveUtils.hpp index 588ad1b6da9..be8d8a0e84e 100644 --- a/src/hotspot/share/cds/archiveUtils.hpp +++ b/src/hotspot/share/cds/archiveUtils.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -30,6 +30,7 @@ #include "memory/virtualspace.hpp" #include "utilities/bitMap.hpp" #include "utilities/exceptions.hpp" +#include "utilities/macros.hpp" class BootstrapInfo; class ReservedSpace; @@ -147,7 +148,7 @@ public: char* expand_top_to(char* newtop); char* allocate(size_t num_bytes); - void append_intptr_t(intptr_t n, bool need_to_mark = false); + void append_intptr_t(intptr_t n, bool need_to_mark = false) NOT_CDS_RETURN; char* base() const { return _base; } char* top() const { return _top; } diff --git a/src/hotspot/share/cds/dumpTimeClassInfo.hpp b/src/hotspot/share/cds/dumpTimeClassInfo.hpp index 80f6d81442c..5b4f5cd9b9b 100644 --- a/src/hotspot/share/cds/dumpTimeClassInfo.hpp +++ b/src/hotspot/share/cds/dumpTimeClassInfo.hpp @@ -167,7 +167,8 @@ public: size_t runtime_info_bytesize() const; }; -inline unsigned DumpTimeSharedClassTable_hash(InstanceKlass* const& k) { +template +inline unsigned DumpTimeSharedClassTable_hash(T* const& k) { if (DumpSharedSpaces) { // Deterministic archive contents uintx delta = k->name() - MetaspaceShared::symbol_rs_base(); @@ -175,7 +176,7 @@ inline unsigned DumpTimeSharedClassTable_hash(InstanceKlass* const& k) { } else { // Deterministic archive is not possible because classes can be loaded // in multiple threads. - return primitive_hash(k); + return primitive_hash(k); } } diff --git a/src/hotspot/share/cds/heapShared.cpp b/src/hotspot/share/cds/heapShared.cpp index 26a852b0158..14bca5d74b6 100644 --- a/src/hotspot/share/cds/heapShared.cpp +++ b/src/hotspot/share/cds/heapShared.cpp @@ -574,7 +574,7 @@ KlassSubGraphInfo* HeapShared::init_subgraph_info(Klass* k, bool is_full_module_ bool created; Klass* relocated_k = ArchiveBuilder::get_relocated_klass(k); KlassSubGraphInfo* info = - _dump_time_subgraph_info_table->put_if_absent(relocated_k, KlassSubGraphInfo(relocated_k, is_full_module_graph), + _dump_time_subgraph_info_table->put_if_absent(k, KlassSubGraphInfo(relocated_k, is_full_module_graph), &created); assert(created, "must not initialize twice"); return info; @@ -582,8 +582,7 @@ KlassSubGraphInfo* HeapShared::init_subgraph_info(Klass* k, bool is_full_module_ KlassSubGraphInfo* HeapShared::get_subgraph_info(Klass* k) { assert(DumpSharedSpaces, "dump time only"); - Klass* relocated_k = ArchiveBuilder::get_relocated_klass(k); - KlassSubGraphInfo* info = _dump_time_subgraph_info_table->get(relocated_k); + KlassSubGraphInfo* info = _dump_time_subgraph_info_table->get(k); assert(info != NULL, "must have been initialized"); return info; } @@ -744,7 +743,8 @@ struct CopyKlassSubGraphInfoToArchive : StackObj { (ArchivedKlassSubGraphInfoRecord*)ArchiveBuilder::ro_region_alloc(sizeof(ArchivedKlassSubGraphInfoRecord)); record->init(&info); - unsigned int hash = SystemDictionaryShared::hash_for_shared_dictionary((address)klass); + Klass* relocated_k = ArchiveBuilder::get_relocated_klass(klass); + unsigned int hash = SystemDictionaryShared::hash_for_shared_dictionary((address)relocated_k); u4 delta = ArchiveBuilder::current()->any_to_offset_u4(record); _writer->add(hash, delta); } diff --git a/src/hotspot/share/cds/heapShared.hpp b/src/hotspot/share/cds/heapShared.hpp index 74d1f1b6e7e..d8fc71fc76e 100644 --- a/src/hotspot/share/cds/heapShared.hpp +++ b/src/hotspot/share/cds/heapShared.hpp @@ -25,6 +25,7 @@ #ifndef SHARE_CDS_HEAPSHARED_HPP #define SHARE_CDS_HEAPSHARED_HPP +#include "cds/dumpTimeClassInfo.hpp" #include "cds/metaspaceShared.hpp" #include "classfile/compactHashtable.hpp" #include "classfile/javaClasses.hpp" @@ -252,17 +253,12 @@ private: HeapShared::oop_hash> ArchivedObjectCache; static ArchivedObjectCache* _archived_object_cache; - static unsigned klass_hash(Klass* const& klass) { - // Generate deterministic hashcode even if SharedBaseAddress is changed due to ASLR. - return primitive_hash

      (address(klass) - SharedBaseAddress); - } - class DumpTimeKlassSubGraphInfoTable : public ResourceHashtable { + DumpTimeSharedClassTable_hash> { public: int _count; }; diff --git a/src/hotspot/share/gc/shared/collectedHeap.cpp b/src/hotspot/share/gc/shared/collectedHeap.cpp index f9ad0759b42..eb3213d12df 100644 --- a/src/hotspot/share/gc/shared/collectedHeap.cpp +++ b/src/hotspot/share/gc/shared/collectedHeap.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2022, 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 @@ -417,6 +417,11 @@ size_t CollectedHeap::filler_array_min_size() { return align_object_size(filler_array_hdr_size()); // align to MinObjAlignment } +void CollectedHeap::zap_filler_array_with(HeapWord* start, size_t words, juint value) { + Copy::fill_to_words(start + filler_array_hdr_size(), + words - filler_array_hdr_size(), value); +} + #ifdef ASSERT void CollectedHeap::fill_args_check(HeapWord* start, size_t words) { @@ -427,8 +432,7 @@ void CollectedHeap::fill_args_check(HeapWord* start, size_t words) void CollectedHeap::zap_filler_array(HeapWord* start, size_t words, bool zap) { if (ZapFillerObjects && zap) { - Copy::fill_to_words(start + filler_array_hdr_size(), - words - filler_array_hdr_size(), 0XDEAFBABE); + zap_filler_array_with(start, words, 0XDEAFBABE); } } #endif // ASSERT @@ -445,7 +449,13 @@ CollectedHeap::fill_with_array(HeapWord* start, size_t words, bool zap) ObjArrayAllocator allocator(Universe::intArrayKlassObj(), words, (int)len, /* do_zero */ false); allocator.initialize(start); - DEBUG_ONLY(zap_filler_array(start, words, zap);) + if (DumpSharedSpaces) { + // This array is written into the CDS archive. Make sure it + // has deterministic contents. + zap_filler_array_with(start, words, 0); + } else { + DEBUG_ONLY(zap_filler_array(start, words, zap);) + } } void diff --git a/src/hotspot/share/gc/shared/collectedHeap.hpp b/src/hotspot/share/gc/shared/collectedHeap.hpp index 89cca6777d6..fd6427fee60 100644 --- a/src/hotspot/share/gc/shared/collectedHeap.hpp +++ b/src/hotspot/share/gc/shared/collectedHeap.hpp @@ -157,6 +157,7 @@ class CollectedHeap : public CHeapObj { static inline size_t filler_array_hdr_size(); static inline size_t filler_array_min_size(); + static inline void zap_filler_array_with(HeapWord* start, size_t words, juint value); DEBUG_ONLY(static void fill_args_check(HeapWord* start, size_t words);) DEBUG_ONLY(static void zap_filler_array(HeapWord* start, size_t words, bool zap = true);) diff --git a/src/hotspot/share/prims/jvm.cpp b/src/hotspot/share/prims/jvm.cpp index f18fe51616c..c574cb3ecc8 100644 --- a/src/hotspot/share/prims/jvm.cpp +++ b/src/hotspot/share/prims/jvm.cpp @@ -2865,6 +2865,26 @@ static void thread_entry(JavaThread* thread, TRAPS) { JVM_ENTRY(void, JVM_StartThread(JNIEnv* env, jobject jthread)) +#if INCLUDE_CDS + if (DumpSharedSpaces) { + // During java -Xshare:dump, if we allow multiple Java threads to + // execute in parallel, symbols and classes may be loaded in + // random orders which will make the resulting CDS archive + // non-deterministic. + // + // Lucikly, during java -Xshare:dump, it's important to run only + // the code in the main Java thread (which is NOT started here) that + // creates the module graph, etc. It's safe to not start the other + // threads which are launched by class static initializers + // (ReferenceHandler, FinalizerThread and CleanerImpl). + if (log_is_enabled(Info, cds)) { + ResourceMark rm; + oop t = JNIHandles::resolve_non_null(jthread); + log_info(cds)("JVM_StartThread() ignored: %s", t->klass()->external_name()); + } + return; + } +#endif JavaThread *native_thread = NULL; // We cannot hold the Threads_lock when we throw an exception, diff --git a/src/hotspot/share/runtime/os.cpp b/src/hotspot/share/runtime/os.cpp index e8165fe7ff3..6e2ee7654ea 100644 --- a/src/hotspot/share/runtime/os.cpp +++ b/src/hotspot/share/runtime/os.cpp @@ -634,6 +634,8 @@ void* os::malloc(size_t size, MEMFLAGS memflags, const NativeCallStack& stack) { // Special handling for NMT preinit phase before arguments are parsed void* rc = NULL; if (NMTPreInit::handle_malloc(&rc, size)) { + // No need to fill with 0 because DumpSharedSpaces doesn't use these + // early allocations. return rc; } @@ -658,9 +660,13 @@ void* os::malloc(size_t size, MEMFLAGS memflags, const NativeCallStack& stack) { void* const inner_ptr = MemTracker::record_malloc((address)outer_ptr, size, memflags, stack); - DEBUG_ONLY(::memset(inner_ptr, uninitBlockPad, size);) + if (DumpSharedSpaces) { + // Need to deterministically fill all the alignment gaps in C++ structures. + ::memset(inner_ptr, 0, size); + } else { + DEBUG_ONLY(::memset(inner_ptr, uninitBlockPad, size);) + } DEBUG_ONLY(break_if_ptr_caught(inner_ptr);) - return inner_ptr; } diff --git a/test/hotspot/jtreg/ProblemList.txt b/test/hotspot/jtreg/ProblemList.txt index 518238d9c0a..870f1d3c596 100644 --- a/test/hotspot/jtreg/ProblemList.txt +++ b/test/hotspot/jtreg/ProblemList.txt @@ -94,7 +94,6 @@ gc/metaspace/CompressedClassSpaceSizeInJmapHeap.java 8241293 macosx-x64 # :hotspot_runtime runtime/cds/appcds/jigsaw/modulepath/ModulePathAndCP_JFR.java 8253437 windows-x64 -runtime/cds/DeterministicDump.java 8253495 generic-all runtime/jni/terminatedThread/TestTerminatedThread.java 8219652 aix-ppc64 runtime/os/TestTracePageSizes.java#no-options 8267460 linux-aarch64 runtime/os/TestTracePageSizes.java#explicit-large-page-size 8267460 linux-aarch64 diff --git a/test/hotspot/jtreg/runtime/cds/DeterministicDump.java b/test/hotspot/jtreg/runtime/cds/DeterministicDump.java index 9cdba1fa922..6e8ccffce27 100644 --- a/test/hotspot/jtreg/runtime/cds/DeterministicDump.java +++ b/test/hotspot/jtreg/runtime/cds/DeterministicDump.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2022, 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 @@ -54,6 +54,11 @@ public class DeterministicDump { baseArgs.add("-Xmx128M"); if (Platform.is64bit()) { + if (!compressed) { + System.out.println("CDS archives with uncompressed oops are still non-deterministic"); + System.out.println("See https://bugs.openjdk.java.net/browse/JDK-8282828"); + return; + } // These options are available only on 64-bit. String sign = (compressed) ? "+" : "-"; baseArgs.add("-XX:" + sign + "UseCompressedOops"); @@ -78,9 +83,12 @@ public class DeterministicDump { static String dump(ArrayList args, String... more) throws Exception { String logName = "SharedArchiveFile" + (id++); String archiveName = logName + ".jsa"; + String mapName = logName + ".map"; CDSOptions opts = (new CDSOptions()) .addPrefix("-Xlog:cds=debug") + .addPrefix("-Xlog:cds+map=trace:file=" + mapName + ":none:filesize=0") .setArchiveName(archiveName) + .addSuffix(args) .addSuffix(more); CDSTestUtils.createArchiveAndCheck(opts); diff --git a/test/hotspot/jtreg/runtime/cds/appcds/javaldr/LockDuringDump.java b/test/hotspot/jtreg/runtime/cds/appcds/javaldr/LockDuringDump.java index 04652d2eb78..391596160d6 100644 --- a/test/hotspot/jtreg/runtime/cds/appcds/javaldr/LockDuringDump.java +++ b/test/hotspot/jtreg/runtime/cds/appcds/javaldr/LockDuringDump.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2022, 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 @@ -68,7 +68,7 @@ public class LockDuringDump { TestCommon.testDump(appJar, TestCommon.list(LockDuringDumpApp.class.getName()), "-XX:+UnlockDiagnosticVMOptions", agentArg, agentArg2); - if (i != 0) { + if (i != 0 && !out.getStdout().contains("LockDuringDumpAgent timeout")) { out.shouldContain("Let's hold the lock on the literal string"); } diff --git a/test/hotspot/jtreg/runtime/cds/appcds/javaldr/LockDuringDumpAgent.java b/test/hotspot/jtreg/runtime/cds/appcds/javaldr/LockDuringDumpAgent.java index 5e053d83efc..57db61e9335 100644 --- a/test/hotspot/jtreg/runtime/cds/appcds/javaldr/LockDuringDumpAgent.java +++ b/test/hotspot/jtreg/runtime/cds/appcds/javaldr/LockDuringDumpAgent.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2022, 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 @@ -51,9 +51,21 @@ public class LockDuringDumpAgent implements Runnable { static void waitForThreadStart() { try { + long started = System.currentTimeMillis(); + long timeout = 10000; + synchronized (LITERAL) { + Thread.sleep(1); + } synchronized (lock) { while (!threadStarted) { - lock.wait(); + lock.wait(timeout); + long elapsed = System.currentTimeMillis() - started; + if (elapsed >= timeout) { + System.out.println("This JVM may decide to not launch any Java threads during -Xshare:dump."); + System.out.println("This is OK because no string objects could be in a locked state during heap dump."); + System.out.println("LockDuringDumpAgent timeout after " + elapsed + " ms"); + return; + } } System.out.println("Thread has started"); } diff --git a/test/lib/jdk/test/lib/cds/CDSOptions.java b/test/lib/jdk/test/lib/cds/CDSOptions.java index cbc11db777b..a60afb90aed 100644 --- a/test/lib/jdk/test/lib/cds/CDSOptions.java +++ b/test/lib/jdk/test/lib/cds/CDSOptions.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2022, 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 @@ -56,6 +56,11 @@ public class CDSOptions { return this; } + public CDSOptions addSuffix(ArrayList suffix) { + for (String s : suffix) this.suffix.add(s); + return this; + } + public CDSOptions addSuffix(String... suffix) { for (String s : suffix) this.suffix.add(s); return this; -- GitLab From 08cadb4754da0d5e68ee2df45f4098d203d14115 Mon Sep 17 00:00:00 2001 From: Swati Sharma Date: Wed, 16 Mar 2022 09:48:09 +0000 Subject: [PATCH 258/340] 8271195: Use largest available large page size smaller than LargePageSizeInBytes when available Co-authored-by: Jatin Bhateja Reviewed-by: ayang, tschatzl --- src/hotspot/os/linux/os_linux.cpp | 21 ++----- src/hotspot/share/memory/virtualspace.cpp | 34 +++++++--- .../openjdk/bench/vm/gc/MicroLargePages.java | 62 +++++++++++++++++++ 3 files changed, 95 insertions(+), 22 deletions(-) create mode 100644 test/micro/org/openjdk/bench/vm/gc/MicroLargePages.java diff --git a/src/hotspot/os/linux/os_linux.cpp b/src/hotspot/os/linux/os_linux.cpp index 33acc06df53..f2ecca92c82 100644 --- a/src/hotspot/os/linux/os_linux.cpp +++ b/src/hotspot/os/linux/os_linux.cpp @@ -3972,23 +3972,14 @@ char* os::Linux::reserve_memory_special_shm(size_t bytes, size_t alignment, return addr; } -static void warn_on_commit_special_failure(char* req_addr, size_t bytes, +static void log_on_commit_special_failure(char* req_addr, size_t bytes, size_t page_size, int error) { assert(error == ENOMEM, "Only expect to fail if no memory is available"); - bool warn_on_failure = UseLargePages && - (!FLAG_IS_DEFAULT(UseLargePages) || - !FLAG_IS_DEFAULT(UseHugeTLBFS) || - !FLAG_IS_DEFAULT(LargePageSizeInBytes)); - - if (warn_on_failure) { - char msg[128]; - jio_snprintf(msg, sizeof(msg), "Failed to reserve and commit memory. req_addr: " - PTR_FORMAT " bytes: " SIZE_FORMAT " page size: " - SIZE_FORMAT " (errno = %d).", - req_addr, bytes, page_size, error); - warning("%s", msg); - } + log_info(pagesize)("Failed to reserve and commit memory with given page size. req_addr: " PTR_FORMAT + " size: " SIZE_FORMAT "%s, page size: " SIZE_FORMAT "%s, (errno = %d)", + p2i(req_addr), byte_size_in_exact_unit(bytes), exact_unit_for_byte_size(bytes), + byte_size_in_exact_unit(page_size), exact_unit_for_byte_size(page_size), error); } bool os::Linux::commit_memory_special(size_t bytes, @@ -4010,7 +4001,7 @@ bool os::Linux::commit_memory_special(size_t bytes, char* addr = (char*)::mmap(req_addr, bytes, prot, flags, -1, 0); if (addr == MAP_FAILED) { - warn_on_commit_special_failure(req_addr, bytes, page_size, errno); + log_on_commit_special_failure(req_addr, bytes, page_size, errno); return false; } diff --git a/src/hotspot/share/memory/virtualspace.cpp b/src/hotspot/share/memory/virtualspace.cpp index ad918dea29b..b02d723baab 100644 --- a/src/hotspot/share/memory/virtualspace.cpp +++ b/src/hotspot/share/memory/virtualspace.cpp @@ -139,6 +139,19 @@ static bool large_pages_requested() { (!FLAG_IS_DEFAULT(UseLargePages) || !FLAG_IS_DEFAULT(LargePageSizeInBytes)); } +static void log_on_large_pages_failure(char* req_addr, size_t bytes) { + if (large_pages_requested()) { + // Compressed oops logging. + log_debug(gc, heap, coops)("Reserve regular memory without large pages"); + // JVM style warning that we did not succeed in using large pages. + char msg[128]; + jio_snprintf(msg, sizeof(msg), "Failed to reserve and commit memory using large pages. " + "req_addr: " PTR_FORMAT " bytes: " SIZE_FORMAT, + req_addr, bytes); + warning("%s", msg); + } +} + static char* reserve_memory(char* requested_address, const size_t size, const size_t alignment, int fd, bool exec) { char* base; @@ -183,10 +196,6 @@ static char* reserve_memory_special(char* requested_address, const size_t size, "reserve_memory_special() returned an unaligned address, base: " PTR_FORMAT " alignment: " SIZE_FORMAT_HEX, p2i(base), alignment); - } else { - if (large_pages_requested()) { - log_debug(gc, heap, coops)("Reserve regular memory without large pages"); - } } return base; } @@ -235,14 +244,25 @@ void ReservedSpace::reserve(size_t size, // the caller requested large pages. To satisfy this request we use // explicit large pages and these have to be committed up front to ensure // no reservations are lost. + size_t used_page_size = page_size; + char* base = NULL; + + do { + base = reserve_memory_special(requested_address, size, alignment, used_page_size, executable); + if (base != NULL) { + break; + } + used_page_size = os::page_sizes().next_smaller(used_page_size); + } while (used_page_size > (size_t) os::vm_page_size()); - char* base = reserve_memory_special(requested_address, size, alignment, page_size, executable); if (base != NULL) { // Successful reservation using large pages. - initialize_members(base, size, alignment, page_size, true, executable); + initialize_members(base, size, alignment, used_page_size, true, executable); return; } - // Failed to reserve explicit large pages, fall back to normal reservation. + // Failed to reserve explicit large pages, do proper logging. + log_on_large_pages_failure(requested_address, size); + // Now fall back to normal reservation. page_size = os::vm_page_size(); } diff --git a/test/micro/org/openjdk/bench/vm/gc/MicroLargePages.java b/test/micro/org/openjdk/bench/vm/gc/MicroLargePages.java new file mode 100644 index 00000000000..67702cfe607 --- /dev/null +++ b/test/micro/org/openjdk/bench/vm/gc/MicroLargePages.java @@ -0,0 +1,62 @@ +// +// Copyright (c) 2022, 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 org.openjdk.bench.vm.gc; + +import java.util.Arrays; +import java.util.concurrent.TimeUnit; +import org.openjdk.jmh.annotations.*; + +@OutputTimeUnit(TimeUnit.MINUTES) +@State(Scope.Thread) +@Fork(jvmArgsAppend = {"-Xmx256m", "-XX:+UseLargePages", "-XX:LargePageSizeInBytes=1g", "-Xlog:pagesize"}, value = 5) + +public class MicroLargePages { + + @Param({"2097152"}) + public int ARRAYSIZE; + + @Param({"1", "2", "4"}) + public int NUM; + + public long[][] INP; + public long[][] OUT; + + @Setup(Level.Trial) + public void BmSetup() { + INP = new long[NUM][ARRAYSIZE]; + OUT = new long[NUM][ARRAYSIZE]; + for (int i = 0; i < NUM; i++) { + Arrays.fill(INP[i], 10); + } + } + + @Benchmark + public void micro_HOP_DIST_4KB() { + for (int i = 0; i < NUM; i += 1) { + for (int j = 0; j < ARRAYSIZE; j += 512) { + OUT[i][j] = INP[i][j]; + } + } + } +} -- GitLab From 9b8afce3791080d664c5051a86592706f5b0ade0 Mon Sep 17 00:00:00 2001 From: Magnus Ihse Bursie Date: Wed, 16 Mar 2022 16:07:32 +0000 Subject: [PATCH 259/340] 8283260: gcc is not supported on mac Reviewed-by: erikj --- make/autoconf/flags-ldflags.m4 | 13 +++++-------- make/autoconf/toolchain.m4 | 6 +++--- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/make/autoconf/flags-ldflags.m4 b/make/autoconf/flags-ldflags.m4 index e9d4557f866..8f77734c93c 100644 --- a/make/autoconf/flags-ldflags.m4 +++ b/make/autoconf/flags-ldflags.m4 @@ -1,5 +1,5 @@ # -# Copyright (c) 2011, 2021, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2011, 2022, 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 @@ -95,13 +95,10 @@ AC_DEFUN([FLAGS_SETUP_LDFLAGS_HELPER], fi # Setup OS-dependent LDFLAGS - if test "x$TOOLCHAIN_TYPE" = xclang || test "x$TOOLCHAIN_TYPE" = xgcc; then - if test "x$OPENJDK_TARGET_OS" = xmacosx; then - # Assume clang or gcc. - # FIXME: We should really generalize SET_SHARED_LIBRARY_ORIGIN instead. - OS_LDFLAGS_JVM_ONLY="-Wl,-rpath,@loader_path/. -Wl,-rpath,@loader_path/.." - OS_LDFLAGS="-mmacosx-version-min=$MACOSX_VERSION_MIN" - fi + if test "x$OPENJDK_TARGET_OS" = xmacosx && test "x$TOOLCHAIN_TYPE" = xclang; then + # FIXME: We should really generalize SET_SHARED_LIBRARY_ORIGIN instead. + OS_LDFLAGS_JVM_ONLY="-Wl,-rpath,@loader_path/. -Wl,-rpath,@loader_path/.." + OS_LDFLAGS="-mmacosx-version-min=$MACOSX_VERSION_MIN" fi # Setup debug level-dependent LDFLAGS diff --git a/make/autoconf/toolchain.m4 b/make/autoconf/toolchain.m4 index 2288dda7ed6..b79d161331d 100644 --- a/make/autoconf/toolchain.m4 +++ b/make/autoconf/toolchain.m4 @@ -39,7 +39,7 @@ VALID_TOOLCHAINS_all="gcc clang xlc microsoft" # These toolchains are valid on different platforms VALID_TOOLCHAINS_linux="gcc clang" -VALID_TOOLCHAINS_macosx="gcc clang" +VALID_TOOLCHAINS_macosx="clang" VALID_TOOLCHAINS_aix="xlc" VALID_TOOLCHAINS_windows="microsoft" @@ -901,8 +901,8 @@ AC_DEFUN_ONCE([TOOLCHAIN_SETUP_BUILD_COMPILERS], BUILD_LDCXX="$BUILD_LD" else if test "x$OPENJDK_BUILD_OS" = xmacosx; then - UTIL_REQUIRE_PROGS(BUILD_CC, clang cc gcc) - UTIL_REQUIRE_PROGS(BUILD_CXX, clang++ CC g++) + UTIL_REQUIRE_PROGS(BUILD_CC, clang) + UTIL_REQUIRE_PROGS(BUILD_CXX, clang++) else UTIL_REQUIRE_PROGS(BUILD_CC, cc gcc) UTIL_REQUIRE_PROGS(BUILD_CXX, CC g++) -- GitLab From 0cf291bc31acf69c767c5d39d21b1195e6d761b2 Mon Sep 17 00:00:00 2001 From: Joe Darcy Date: Wed, 16 Mar 2022 16:17:50 +0000 Subject: [PATCH 260/340] 8283234: Improve @jls usage in java.base Reviewed-by: iris --- .../classes/java/lang/StringConcatHelper.java | 4 ++-- .../classes/java/lang/invoke/MethodHandle.java | 8 ++++---- .../classes/java/lang/invoke/MethodHandles.java | 10 +++++----- .../java/lang/invoke/StringConcatFactory.java | 14 +++++++------- .../classes/java/lang/reflect/TypeVariable.java | 6 +++--- 5 files changed, 21 insertions(+), 21 deletions(-) diff --git a/src/java.base/share/classes/java/lang/StringConcatHelper.java b/src/java.base/share/classes/java/lang/StringConcatHelper.java index f267fd9e1d6..3867c10e8d6 100644 --- a/src/java.base/share/classes/java/lang/StringConcatHelper.java +++ b/src/java.base/share/classes/java/lang/StringConcatHelper.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2022, 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 @@ -430,7 +430,7 @@ final class StringConcatHelper { * Produce a String from a concatenation of single argument, which we * end up using for trivial concatenations like {@code "" + arg}. * - * This will always create a new Object to comply with JLS 15.18.1: + * This will always create a new Object to comply with JLS {@jls 15.18.1}: * "The String object is newly created unless the expression is a * compile-time constant expression". * diff --git a/src/java.base/share/classes/java/lang/invoke/MethodHandle.java b/src/java.base/share/classes/java/lang/invoke/MethodHandle.java index ec910dbf8fe..fb7ef0afbac 100644 --- a/src/java.base/share/classes/java/lang/invoke/MethodHandle.java +++ b/src/java.base/share/classes/java/lang/invoke/MethodHandle.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2022, 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 @@ -807,15 +807,15 @@ public abstract class MethodHandle implements Constable { * (The types do not need to be related in any particular way. * This is because a dynamic value of null can convert to any reference type.) *
    • If T0 and T1 are primitives, then a Java method invocation - * conversion (JLS 5.3) is applied, if one exists. + * conversion (JLS {@jls 5.3}) is applied, if one exists. * (Specifically, T0 must convert to T1 by a widening primitive conversion.) *
    • If T0 is a primitive and T1 a reference, - * a Java casting conversion (JLS 5.5) is applied if one exists. + * a Java casting conversion (JLS {@jls 5.5}) is applied if one exists. * (Specifically, the value is boxed from T0 to its wrapper class, * which is then widened as needed to T1.) *
    • If T0 is a reference and T1 a primitive, an unboxing * conversion will be applied at runtime, possibly followed - * by a Java method invocation conversion (JLS 5.3) + * by a Java method invocation conversion (JLS {@jls 5.3}) * on the primitive value. (These are the primitive widening conversions.) * T0 must be a wrapper class or a supertype of one. * (In the case where T0 is Object, these are the conversions diff --git a/src/java.base/share/classes/java/lang/invoke/MethodHandles.java b/src/java.base/share/classes/java/lang/invoke/MethodHandles.java index bdc26750992..dd8b01c73bc 100644 --- a/src/java.base/share/classes/java/lang/invoke/MethodHandles.java +++ b/src/java.base/share/classes/java/lang/invoke/MethodHandles.java @@ -1884,7 +1884,7 @@ public class MethodHandles { * as a normal class or interface has with its own defining loader. * This means that the hidden class may be unloaded if and only if * its defining loader is not reachable and thus may be reclaimed - * by a garbage collector (JLS 12.7). + * by a garbage collector (JLS {@jls 12.7}). * *

      By default, a hidden class or interface may be unloaded * even if the class loader that is marked as its defining loader is @@ -2024,7 +2024,7 @@ public class MethodHandles { * that {@linkplain Class#getClassLoader() defined it}. * This means that a class created by a class loader may be unloaded if and * only if its defining loader is not reachable and thus may be reclaimed - * by a garbage collector (JLS 12.7). + * by a garbage collector (JLS {@jls 12.7}). * * By default, however, a hidden class or interface may be unloaded even if * the class loader that is marked as its defining loader is @@ -4757,15 +4757,15 @@ return invoker; * the boolean is converted to a byte value, 1 for true, 0 for false. * (This treatment follows the usage of the bytecode verifier.) *

    • If T1 is boolean and T0 is another primitive, - * T0 is converted to byte via Java casting conversion (JLS 5.5), + * T0 is converted to byte via Java casting conversion (JLS {@jls 5.5}), * and the low order bit of the result is tested, as if by {@code (x & 1) != 0}. *
    • If T0 and T1 are primitives other than boolean, - * then a Java casting conversion (JLS 5.5) is applied. + * then a Java casting conversion (JLS {@jls 5.5}) is applied. * (Specifically, T0 will convert to T1 by * widening and/or narrowing.) *
    • If T0 is a reference and T1 a primitive, an unboxing * conversion will be applied at runtime, possibly followed - * by a Java casting conversion (JLS 5.5) on the primitive value, + * by a Java casting conversion (JLS {@jls 5.5}) on the primitive value, * possibly followed by a conversion from byte to boolean by testing * the low-order bit. *
    • If T0 is a reference and T1 a primitive, diff --git a/src/java.base/share/classes/java/lang/invoke/StringConcatFactory.java b/src/java.base/share/classes/java/lang/invoke/StringConcatFactory.java index 5ff0cf84aec..7026591190e 100644 --- a/src/java.base/share/classes/java/lang/invoke/StringConcatFactory.java +++ b/src/java.base/share/classes/java/lang/invoke/StringConcatFactory.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2022, 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 @@ -142,10 +142,10 @@ public final class StringConcatFactory { *
        *
      • zero inputs, concatenation results in an empty string;
      • *
      • one input, concatenation results in the single - * input converted as per JLS 5.1.11 "String Conversion"; otherwise
      • + * input converted as per JLS {@jls 5.1.11} "String Conversion"; otherwise *
      • two or more inputs, the inputs are concatenated as per - * requirements stated in JLS 15.18.1 "String Concatenation Operator +". - * The inputs are converted as per JLS 5.1.11 "String Conversion", + * requirements stated in JLS {@jls 15.18.1} "String Concatenation Operator +". + * The inputs are converted as per JLS {@jls 5.1.11} "String Conversion", * and combined from left to right.
      • *
      * @@ -223,10 +223,10 @@ public final class StringConcatFactory { *
        *
      • zero inputs, concatenation results in an empty string;
      • *
      • one input, concatenation results in the single - * input converted as per JLS 5.1.11 "String Conversion"; otherwise
      • + * input converted as per JLS {@jls 5.1.11} "String Conversion"; otherwise *
      • two or more inputs, the inputs are concatenated as per - * requirements stated in JLS 15.18.1 "String Concatenation Operator +". - * The inputs are converted as per JLS 5.1.11 "String Conversion", + * requirements stated in JLS {@jls 15.18.1} "String Concatenation Operator +". + * The inputs are converted as per JLS {@jls 5.1.11} "String Conversion", * and combined from left to right.
      • *
      * diff --git a/src/java.base/share/classes/java/lang/reflect/TypeVariable.java b/src/java.base/share/classes/java/lang/reflect/TypeVariable.java index 0064aed2a22..01746e34385 100644 --- a/src/java.base/share/classes/java/lang/reflect/TypeVariable.java +++ b/src/java.base/share/classes/java/lang/reflect/TypeVariable.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -30,8 +30,8 @@ package java.lang.reflect; * A type variable is created the first time it is needed by a reflective * method, as specified in this package. If a type variable t is referenced * by a type (i.e, class, interface or annotation type) T, and T is declared - * by the nth enclosing class of T (see JLS 8.1.2), then the creation of t - * requires the resolution (see JVMS 5) of the ith enclosing class of T, + * by the nth enclosing class of T (see JLS {@jls 8.1.2}), then the creation of t + * requires the resolution (see JVMS {@jvms 5}) of the ith enclosing class of T, * for i = 0 to n, inclusive. Creating a type variable must not cause the * creation of its bounds. Repeated creation of a type variable has no effect. * -- GitLab From 3e393047e12147a81e2899784b943923fc34da8e Mon Sep 17 00:00:00 2001 From: XenoAmess Date: Wed, 16 Mar 2022 16:48:49 +0000 Subject: [PATCH 261/340] 8281631: HashMap copy constructor and putAll can over-allocate table Reviewed-by: smarks --- .../share/classes/java/util/HashMap.java | 14 +- .../share/classes/java/util/WeakHashMap.java | 10 +- test/jdk/ProblemList.txt | 1 + .../java/util/HashMap/WhiteBoxResizeTest.java | 305 ++++++++++++++---- 4 files changed, 258 insertions(+), 72 deletions(-) diff --git a/src/java.base/share/classes/java/util/HashMap.java b/src/java.base/share/classes/java/util/HashMap.java index 24fcd9516ca..997273aa104 100644 --- a/src/java.base/share/classes/java/util/HashMap.java +++ b/src/java.base/share/classes/java/util/HashMap.java @@ -495,9 +495,9 @@ public class HashMap extends AbstractMap int s = m.size(); if (s > 0) { if (table == null) { // pre-size - float ft = ((float)s / loadFactor) + 1.0F; - int t = ((ft < (float)MAXIMUM_CAPACITY) ? - (int)ft : MAXIMUM_CAPACITY); + double dt = Math.ceil(s / (double)loadFactor); + int t = ((dt < (double)MAXIMUM_CAPACITY) ? + (int)dt : MAXIMUM_CAPACITY); if (t > threshold) threshold = tableSizeFor(t); } else { @@ -1527,12 +1527,12 @@ public class HashMap extends AbstractMap } else if (mappings == 0) { // use defaults } else if (mappings > 0) { - float fc = (float)mappings / lf + 1.0f; - int cap = ((fc < DEFAULT_INITIAL_CAPACITY) ? + double dc = Math.ceil(mappings / (double)lf); + int cap = ((dc < DEFAULT_INITIAL_CAPACITY) ? DEFAULT_INITIAL_CAPACITY : - (fc >= MAXIMUM_CAPACITY) ? + (dc >= MAXIMUM_CAPACITY) ? MAXIMUM_CAPACITY : - tableSizeFor((int)fc)); + tableSizeFor((int)dc)); float ft = (float)cap * lf; threshold = ((cap < MAXIMUM_CAPACITY && ft < MAXIMUM_CAPACITY) ? (int)ft : Integer.MAX_VALUE); diff --git a/src/java.base/share/classes/java/util/WeakHashMap.java b/src/java.base/share/classes/java/util/WeakHashMap.java index d74c7d65728..bc31985b66e 100644 --- a/src/java.base/share/classes/java/util/WeakHashMap.java +++ b/src/java.base/share/classes/java/util/WeakHashMap.java @@ -213,9 +213,7 @@ public class WeakHashMap if (loadFactor <= 0 || Float.isNaN(loadFactor)) throw new IllegalArgumentException("Illegal Load factor: "+ loadFactor); - int capacity = 1; - while (capacity < initialCapacity) - capacity <<= 1; + int capacity = HashMap.tableSizeFor(initialCapacity); table = newTable(capacity); this.loadFactor = loadFactor; threshold = (int)(capacity * loadFactor); @@ -251,7 +249,7 @@ public class WeakHashMap * @since 1.3 */ public WeakHashMap(Map m) { - this(Math.max((int) ((float)m.size() / DEFAULT_LOAD_FACTOR + 1.0F), + this(Math.max((int) Math.ceil(m.size() / (double)DEFAULT_LOAD_FACTOR), DEFAULT_INITIAL_CAPACITY), DEFAULT_LOAD_FACTOR); putAll(m); @@ -468,7 +466,7 @@ public class WeakHashMap modCount++; Entry e = tab[i]; tab[i] = new Entry<>(k, value, queue, h, e); - if (++size >= threshold) + if (++size > threshold) resize(tab.length * 2); return null; } @@ -557,7 +555,7 @@ public class WeakHashMap * to at most one extra resize. */ if (numKeysToBeAdded > threshold) { - int targetCapacity = (int)(numKeysToBeAdded / loadFactor + 1); + int targetCapacity = (int)Math.ceil(numKeysToBeAdded / (double)loadFactor); if (targetCapacity > MAXIMUM_CAPACITY) targetCapacity = MAXIMUM_CAPACITY; int newCapacity = table.length; diff --git a/test/jdk/ProblemList.txt b/test/jdk/ProblemList.txt index fc1979b6ed6..0bafc13a252 100644 --- a/test/jdk/ProblemList.txt +++ b/test/jdk/ProblemList.txt @@ -542,6 +542,7 @@ java/lang/invoke/LFCaching/LFMultiThreadCachingTest.java 8151492 generic- java/lang/invoke/LFCaching/LFGarbageCollectedTest.java 8078602 generic-all java/lang/invoke/lambda/LambdaFileEncodingSerialization.java 8249079 linux-x64 java/lang/invoke/RicochetTest.java 8251969 generic-all +java/lang/Enum/ConstantDirectoryOptimalCapacity.java 8282120 generic-all ############################################################################ diff --git a/test/jdk/java/util/HashMap/WhiteBoxResizeTest.java b/test/jdk/java/util/HashMap/WhiteBoxResizeTest.java index e7374dff5cd..ad02b3000e2 100644 --- a/test/jdk/java/util/HashMap/WhiteBoxResizeTest.java +++ b/test/jdk/java/util/HashMap/WhiteBoxResizeTest.java @@ -1,5 +1,6 @@ /* * Copyright (c) 2018, Red Hat, Inc. All rights reserved. + * Copyright (c) 2022, 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 @@ -21,113 +22,299 @@ * questions. */ +import org.testng.annotations.DataProvider; import org.testng.annotations.Test; import java.lang.invoke.MethodHandle; import java.lang.invoke.MethodHandles; import java.lang.invoke.MethodType; import java.lang.invoke.VarHandle; +import java.util.AbstractMap; +import java.util.AbstractSet; +import java.util.ArrayList; +import java.util.Arrays; import java.util.HashMap; +import java.util.Iterator; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; -import java.util.concurrent.ThreadLocalRandom; +import java.util.Set; +import java.util.WeakHashMap; +import java.util.function.Consumer; import java.util.function.Supplier; -import java.util.stream.IntStream; -import static java.util.stream.Collectors.toMap; import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertNull; /* * @test - * @bug 8210280 + * @bug 8210280 8281631 * @modules java.base/java.util:open - * @summary White box tests for HashMap internals around table resize + * @summary White box tests for HashMap-related internals around table sizing * @run testng WhiteBoxResizeTest - * @key randomness */ public class WhiteBoxResizeTest { - final ThreadLocalRandom rnd = ThreadLocalRandom.current(); + final MethodHandle TABLE_SIZE_FOR; - final VarHandle THRESHOLD; - final VarHandle TABLE; + final VarHandle HM_TABLE; + final VarHandle WHM_TABLE; public WhiteBoxResizeTest() throws ReflectiveOperationException { - Class mClass = HashMap.class; - String nodeClassName = mClass.getName() + "$Node"; - Class nodeArrayClass = Class.forName("[L" + nodeClassName + ";"); - MethodHandles.Lookup lookup = MethodHandles.privateLookupIn(mClass, MethodHandles.lookup()); - TABLE = lookup.findVarHandle(mClass, "table", nodeArrayClass); - this.TABLE_SIZE_FOR = lookup.findStatic( - mClass, "tableSizeFor", - MethodType.methodType(int.class, int.class)); - this.THRESHOLD = lookup.findVarHandle(mClass, "threshold", int.class); + MethodHandles.Lookup hmlookup = MethodHandles.privateLookupIn(HashMap.class, MethodHandles.lookup()); + TABLE_SIZE_FOR = hmlookup.findStatic( + HashMap.class, "tableSizeFor", MethodType.methodType(int.class, int.class)); + HM_TABLE = hmlookup.unreflectVarHandle(HashMap.class.getDeclaredField("table")); + + MethodHandles.Lookup whmlookup = MethodHandles.privateLookupIn(WeakHashMap.class, MethodHandles.lookup()); + WHM_TABLE = whmlookup.unreflectVarHandle(WeakHashMap.class.getDeclaredField("table")); } + /* + * utility methods + */ + int tableSizeFor(int n) { try { return (int) TABLE_SIZE_FOR.invoke(n); - } catch (Throwable t) { throw new AssertionError(t); } + } catch (Throwable t) { + throw new AssertionError(t); + } } - Object[] table(HashMap map) { + Object[] table(Map map) { try { - return (Object[]) TABLE.get(map); - } catch (Throwable t) { throw new AssertionError(t); } + VarHandle vh = map instanceof WeakHashMap ? WHM_TABLE : HM_TABLE; + return (Object[]) vh.get(map); + } catch (Throwable t) { + throw new AssertionError(t); + } } - int capacity(HashMap map) { + int capacity(Map map) { return table(map).length; } - @Test - public void testTableSizeFor() { - assertEquals(tableSizeFor(0), 1); - assertEquals(tableSizeFor(1), 1); - assertEquals(tableSizeFor(2), 2); - assertEquals(tableSizeFor(3), 4); - assertEquals(tableSizeFor(15), 16); - assertEquals(tableSizeFor(16), 16); - assertEquals(tableSizeFor(17), 32); - int maxSize = 1 << 30; - assertEquals(tableSizeFor(maxSize - 1), maxSize); - assertEquals(tableSizeFor(maxSize), maxSize); - assertEquals(tableSizeFor(maxSize + 1), maxSize); - assertEquals(tableSizeFor(Integer.MAX_VALUE), maxSize); + // creates a map with size mappings + Map makeMap(int size) { + Map map = new HashMap<>(); + putN(map, size); + return map; + } + + // creates a "fake" map: size() returns the given size, but + // the entrySet iterator returns only one entry + Map fakeMap(int size) { + return new AbstractMap<>() { + public Set> entrySet() { + return new AbstractSet>() { + public int size() { + return size; + } + + public Iterator> iterator() { + return Set.of(Map.entry("1", "1")).iterator(); + } + }; + } + }; + } + + void putN(Map map, int n) { + for (int i = 0; i < n; i++) { + String string = Integer.toString(i); + map.put(string, string); + } + } + + /* + * tests of tableSizeFor + */ + + @DataProvider(name = "tableSizeFor") + public Object[][] tableSizeForCases() { + final int MAX = 1 << 30; + return new Object[][] { + // tableSizeFor(arg), expected + { 0, 1 }, + { 1, 1 }, + { 2, 2 }, + { 3, 4 }, + { 4, 4 }, + { 5, 8 }, + { 15, 16 }, + { 16, 16 }, + { 17, 32 }, + { MAX-1, MAX }, + { MAX, MAX }, + { MAX+1, MAX }, + { Integer.MAX_VALUE, MAX } + }; + } + + @Test(dataProvider = "tableSizeFor") + public void tableSizeFor(int arg, int expected) { + assertEquals(tableSizeFor(arg), expected); } - @Test - public void capacityTestDefaultConstructor() { - capacityTestDefaultConstructor(new HashMap<>()); - capacityTestDefaultConstructor(new LinkedHashMap<>()); + /* + * tests for lazy table allocation + */ + + @DataProvider(name = "lazy") + public Object[][] lazyTableAllocationCases() { + return new Object[][]{ + {new HashMap<>()}, + // { new WeakHashMap<>() }, // WHM doesn't allocate lazily + {new LinkedHashMap<>()} + }; } - void capacityTestDefaultConstructor(HashMap map) { + @Test(dataProvider = "lazy") + public void lazyTableAllocation(Map map) { assertNull(table(map)); + } - map.put(1, 1); - assertEquals(capacity(map), 16); // default initial capacity + /* + * tests for default capacity (no-arg constructor) + */ - map.putAll(IntStream.range(0, 64).boxed().collect(toMap(i -> i, i -> i))); - assertEquals(capacity(map), 128); + @DataProvider(name = "defaultCapacity") + public Object[][] defaultCapacityCases() { + return new Supplier[][]{ + {() -> new HashMap<>()}, + {() -> new LinkedHashMap<>()}, + {() -> new WeakHashMap<>()} + }; } - @Test - public void capacityTestInitialCapacity() { - int initialCapacity = rnd.nextInt(2, 128); - List>> suppliers = List.of( - () -> new HashMap<>(initialCapacity), - () -> new HashMap<>(initialCapacity, 0.75f), - () -> new LinkedHashMap<>(initialCapacity), - () -> new LinkedHashMap<>(initialCapacity, 0.75f)); + @Test(dataProvider = "defaultCapacity") + public void defaultCapacity(Supplier> s) { + Map map = s.get(); + map.put("", ""); + assertEquals(capacity(map), 16); + } - for (Supplier> supplier : suppliers) { - HashMap map = supplier.get(); - assertNull(table(map)); + /* + * tests for requested capacity (int and int+float constructors) + */ - map.put(1, 1); - assertEquals(capacity(map), tableSizeFor(initialCapacity)); + @DataProvider(name = "requestedCapacity") + public Iterator requestedCapacityCases() { + ArrayList cases = new ArrayList<>(); + for (int i = 2; i < 128; i++) { + int cap = i; + cases.add(new Object[]{"rhm1", cap, (Supplier>) () -> new HashMap<>(cap)}); + cases.add(new Object[]{"rhm2", cap, (Supplier>) () -> new HashMap<>(cap, 0.75f)}); + cases.add(new Object[]{"rlm1", cap, (Supplier>) () -> new LinkedHashMap<>(cap)}); + cases.add(new Object[]{"rlm2", cap, (Supplier>) () -> new LinkedHashMap<>(cap, 0.75f)}); + cases.add(new Object[]{"rwm1", cap, (Supplier>) () -> new WeakHashMap<>(cap)}); + cases.add(new Object[]{"rwm2", cap, (Supplier>) () -> new WeakHashMap<>(cap, 0.75f)}); } + return cases.iterator(); + } + + @Test(dataProvider = "requestedCapacity") + public void requestedCapacity(String label, int cap, Supplier> s) { + Map map = s.get(); + map.put("", ""); + assertEquals(capacity(map), tableSizeFor(cap)); + } + + /* + * Tests for capacity after map is populated with a given number N of mappings. + * Maps are populated using a copy constructor on a map with N mappings, + * other constructors followed by N put() calls, and other constructors followed + * by putAll() on a map with N mappings. + * + * String labels encode the test case for ease of diagnosis if one of the test cases fails. + * For example, "plm2pn" is "populated LinkedHashMap, 2-arg constructor, followed by putN". + */ + + // helper method for one populated capacity case, to provide target types for lambdas + Object[] pcc(String label, + int size, + int expectedCapacity, + Supplier> supplier, + Consumer> consumer) { + return new Object[]{label, size, expectedCapacity, supplier, consumer}; + } + + List genPopulatedCapacityCases(int size, int cap) { + return Arrays.asList( + pcc("phmcpy", size, cap, () -> new HashMap<>(makeMap(size)), map -> { }), + pcc("phm0pn", size, cap, () -> new HashMap<>(), map -> { putN(map, size); }), + pcc("phm1pn", size, cap, () -> new HashMap<>(cap), map -> { putN(map, size); }), + pcc("phm2pn", size, cap, () -> new HashMap<>(cap, 0.75f), map -> { putN(map, size); }), + pcc("phm0pa", size, cap, () -> new HashMap<>(), map -> { map.putAll(makeMap(size)); }), + pcc("phm1pa", size, cap, () -> new HashMap<>(cap), map -> { map.putAll(makeMap(size)); }), + pcc("phm2pa", size, cap, () -> new HashMap<>(cap, 0.75f), map -> { map.putAll(makeMap(size)); }), + + pcc("plmcpy", size, cap, () -> new LinkedHashMap<>(makeMap(size)), map -> { }), + pcc("plm0pn", size, cap, () -> new LinkedHashMap<>(), map -> { putN(map, size); }), + pcc("plm1pn", size, cap, () -> new LinkedHashMap<>(cap), map -> { putN(map, size); }), + pcc("plm2pn", size, cap, () -> new LinkedHashMap<>(cap, 0.75f), map -> { putN(map, size); }), + pcc("plm0pa", size, cap, () -> new LinkedHashMap<>(), map -> { map.putAll(makeMap(size)); }), + pcc("plm1pa", size, cap, () -> new LinkedHashMap<>(cap), map -> { map.putAll(makeMap(size)); }), + pcc("plm2pa", size, cap, () -> new LinkedHashMap<>(cap, 0.75f), map -> { map.putAll(makeMap(size)); }), + + pcc("pwmcpy", size, cap, () -> new WeakHashMap<>(makeMap(size)), map -> { }), + pcc("pwm0pn", size, cap, () -> new WeakHashMap<>(), map -> { putN(map, size); }), + pcc("pwm1pn", size, cap, () -> new WeakHashMap<>(cap), map -> { putN(map, size); }), + pcc("pwm2pn", size, cap, () -> new WeakHashMap<>(cap, 0.75f), map -> { putN(map, size); }), + pcc("pwm0pa", size, cap, () -> new WeakHashMap<>(), map -> { map.putAll(makeMap(size)); }), + pcc("pwm1pa", size, cap, () -> new WeakHashMap<>(cap), map -> { map.putAll(makeMap(size)); }), + pcc("pwm2pa", size, cap, () -> new WeakHashMap<>(cap, 0.75f), map -> { map.putAll(makeMap(size)); }) + ); + } + + List genFakePopulatedCapacityCases(int size, int cap) { + return Arrays.asList( + pcc("fhmcpy", size, cap, () -> new HashMap<>(fakeMap(size)), map -> { }), + pcc("fhm0pa", size, cap, () -> new HashMap<>(), map -> { map.putAll(fakeMap(size)); }), + pcc("fhm1pa", size, cap, () -> new HashMap<>(cap), map -> { map.putAll(fakeMap(size)); }), + pcc("fhm2pa", size, cap, () -> new HashMap<>(cap, 0.75f), map -> { map.putAll(fakeMap(size)); }), + + pcc("flmcpy", size, cap, () -> new LinkedHashMap<>(fakeMap(size)), map -> { }), + pcc("flm0pa", size, cap, () -> new LinkedHashMap<>(), map -> { map.putAll(fakeMap(size)); }), + pcc("flm1pa", size, cap, () -> new LinkedHashMap<>(cap), map -> { map.putAll(fakeMap(size)); }), + pcc("flm2pa", size, cap, () -> new LinkedHashMap<>(cap, 0.75f), map -> { map.putAll(fakeMap(size)); }), + + pcc("fwmcpy", size, cap, () -> new WeakHashMap<>(fakeMap(size)), map -> { }), + // pcc("fwm0pa", size, cap, () -> new WeakHashMap<>(), map -> { map.putAll(fakeMap(size)); }), // see note + pcc("fwm1pa", size, cap, () -> new WeakHashMap<>(cap), map -> { map.putAll(fakeMap(size)); }), + pcc("fwm2pa", size, cap, () -> new WeakHashMap<>(cap, 0.75f), map -> { map.putAll(fakeMap(size)); }) + ); + + // Test case "fwm0pa" is commented out because WeakHashMap uses a different allocation + // policy from the other map implementations: it deliberately under-allocates in this case. + } + + @DataProvider(name = "populatedCapacity") + public Iterator populatedCapacityCases() { + ArrayList cases = new ArrayList<>(); + cases.addAll(genPopulatedCapacityCases(11, 16)); + cases.addAll(genPopulatedCapacityCases(12, 16)); + cases.addAll(genPopulatedCapacityCases(13, 32)); + cases.addAll(genPopulatedCapacityCases(64, 128)); + + // numbers in this range are truncated by a float computation with 0.75f + // but can get an exact result with a double computation with 0.75d + cases.addAll(genFakePopulatedCapacityCases(25165824, 33554432)); + cases.addAll(genFakePopulatedCapacityCases(25165825, 67108864)); + cases.addAll(genFakePopulatedCapacityCases(25165826, 67108864)); + + return cases.iterator(); } + + @Test(dataProvider = "populatedCapacity") + public void populatedCapacity(String label, // unused, included for diagnostics + int size, // unused, included for diagnostics + int expectedCapacity, + Supplier> s, + Consumer> c) { + Map map = s.get(); + c.accept(map); + assertEquals(capacity(map), expectedCapacity); + } + } -- GitLab From 3da5204b3c3a3f95bddcdcfe2628c2e0ed8a12d9 Mon Sep 17 00:00:00 2001 From: Jie Fu Date: Thu, 17 Mar 2022 00:05:57 +0000 Subject: [PATCH 262/340] 8283229: compiler/arguments/TestCodeEntryAlignment.java fails with release VMs Reviewed-by: dlong --- .../hotspot/jtreg/compiler/arguments/TestCodeEntryAlignment.java | 1 + 1 file changed, 1 insertion(+) diff --git a/test/hotspot/jtreg/compiler/arguments/TestCodeEntryAlignment.java b/test/hotspot/jtreg/compiler/arguments/TestCodeEntryAlignment.java index 15a60382245..0ea1aee6bd6 100644 --- a/test/hotspot/jtreg/compiler/arguments/TestCodeEntryAlignment.java +++ b/test/hotspot/jtreg/compiler/arguments/TestCodeEntryAlignment.java @@ -27,6 +27,7 @@ * @library /test/lib / * @bug 8281467 * @requires vm.flagless + * @requires vm.debug * @requires os.arch=="amd64" | os.arch=="x86_64" * * @summary Test large CodeEntryAlignments are accepted -- GitLab From a5ebcc0c04bedd87bc9a523b0a45b50fc4b0f5f0 Mon Sep 17 00:00:00 2001 From: Ivan Walulya Date: Thu, 17 Mar 2022 08:54:29 +0000 Subject: [PATCH 263/340] 8282072: G1: Rename CardSetPtr to CardSetContainerPtr Reviewed-by: ayang, tschatzl --- src/hotspot/share/gc/g1/g1CardSet.cpp | 405 +++++++++--------- src/hotspot/share/gc/g1/g1CardSet.hpp | 133 +++--- src/hotspot/share/gc/g1/g1CardSet.inline.hpp | 35 +- .../share/gc/g1/g1CardSetContainers.hpp | 58 +-- .../gc/g1/g1CardSetContainers.inline.hpp | 56 +-- .../share/gc/g1/heapRegionRemSet.inline.hpp | 6 +- test/hotspot/gtest/gc/g1/test_g1CardSet.cpp | 4 +- .../gtest/gc/g1/test_g1CardSetContainers.cpp | 2 +- 8 files changed, 346 insertions(+), 353 deletions(-) diff --git a/src/hotspot/share/gc/g1/g1CardSet.cpp b/src/hotspot/share/gc/g1/g1CardSet.cpp index a87db1ff718..82092a1d502 100644 --- a/src/hotspot/share/gc/g1/g1CardSet.cpp +++ b/src/hotspot/share/gc/g1/g1CardSet.cpp @@ -26,25 +26,19 @@ #include "gc/g1/g1CardSet.inline.hpp" #include "gc/g1/g1CardSetContainers.inline.hpp" #include "gc/g1/g1CardSetMemory.inline.hpp" -#include "gc/g1/g1FromCardCache.hpp" #include "gc/g1/heapRegion.inline.hpp" +#include "gc/shared/gcLogPrecious.hpp" +#include "gc/shared/gcTraceTime.inline.hpp" #include "memory/allocation.inline.hpp" #include "runtime/atomic.hpp" #include "runtime/globals_extension.hpp" -#include "runtime/mutex.hpp" #include "utilities/bitMap.inline.hpp" #include "utilities/concurrentHashTable.inline.hpp" #include "utilities/globalDefinitions.hpp" -#include "utilities/lockFreeStack.hpp" -#include "utilities/spinYield.hpp" - -#include "gc/shared/gcLogPrecious.hpp" -#include "gc/shared/gcTraceTime.inline.hpp" -#include "runtime/java.hpp" -G1CardSet::CardSetPtr G1CardSet::FullCardSet = (G1CardSet::CardSetPtr)-1; +G1CardSet::ContainerPtr G1CardSet::FullCardSet = (G1CardSet::ContainerPtr)-1; -static uint default_log2_card_region_per_region() { +static uint default_log2_card_regions_per_region() { uint log2_card_regions_per_heap_region = 0; const uint card_container_limit = G1CardSetContainer::LogCardsPerRegionLimit; @@ -62,7 +56,7 @@ G1CardSetConfiguration::G1CardSetConfiguration() : G1RemSetHowlNumBuckets, /* num_buckets_in_howl */ (double)G1RemSetCoarsenHowlToFullPercent / 100, /* cards_in_howl_threshold_percent */ (uint)HeapRegion::CardsPerRegion, /* max_cards_in_cardset */ - default_log2_card_region_per_region()) /* log2_card_region_per_region */ + default_log2_card_regions_per_region()) /* log2_card_regions_per_region */ { assert((_log2_card_regions_per_heap_region + _log2_cards_per_card_region) == (uint)HeapRegion::LogCardsPerRegion, "inconsistent heap region virtualization setup"); @@ -73,7 +67,7 @@ G1CardSetConfiguration::G1CardSetConfiguration(uint max_cards_in_array, uint max_buckets_in_howl, double cards_in_howl_threshold_percent, uint max_cards_in_card_set, - uint log2_card_region_per_region) : + uint log2_card_regions_per_region) : G1CardSetConfiguration(log2i_exact(max_cards_in_card_set), /* inline_ptr_bits_per_card */ max_cards_in_array, /* max_cards_in_array */ cards_in_bitmap_threshold_percent, /* cards_in_bitmap_threshold_percent */ @@ -82,7 +76,7 @@ G1CardSetConfiguration::G1CardSetConfiguration(uint max_cards_in_array, max_buckets_in_howl), cards_in_howl_threshold_percent, /* cards_in_howl_threshold_percent */ max_cards_in_card_set, /* max_cards_in_cardset */ - log2_card_region_per_region) + log2_card_regions_per_region) { } G1CardSetConfiguration::G1CardSetConfiguration(uint inline_ptr_bits_per_card, @@ -197,7 +191,7 @@ void G1CardSetCoarsenStats::print_on(outputStream* out) { } class G1CardSetHashTable : public CHeapObj { - using CardSetPtr = G1CardSet::CardSetPtr; + using ContainerPtr = G1CardSet::ContainerPtr; // Did we insert at least one card in the table? bool volatile _inserted_card; @@ -231,12 +225,12 @@ class G1CardSetHashTable : public CHeapObj { }; class G1CardSetHashTableScan : public StackObj { - G1CardSet::CardSetPtrClosure* _scan_f; + G1CardSet::ContainerPtrClosure* _scan_f; public: - explicit G1CardSetHashTableScan(G1CardSet::CardSetPtrClosure* f) : _scan_f(f) { } + explicit G1CardSetHashTableScan(G1CardSet::ContainerPtrClosure* f) : _scan_f(f) { } bool operator()(G1CardSetHashTableValue* value) { - _scan_f->do_cardsetptr(value->_region_idx, value->_num_occupied, value->_card_set); + _scan_f->do_containerptr(value->_region_idx, value->_num_occupied, value->_container); return true; } }; @@ -284,19 +278,19 @@ public: return found.value(); } - void iterate_safepoint(G1CardSet::CardSetPtrClosure* cl2) { + void iterate_safepoint(G1CardSet::ContainerPtrClosure* cl2) { G1CardSetHashTableScan cl(cl2); _table.do_safepoint_scan(cl); } - void iterate(G1CardSet::CardSetPtrClosure* cl2) { + void iterate(G1CardSet::ContainerPtrClosure* cl2) { G1CardSetHashTableScan cl(cl2); _table.do_scan(Thread::current(), cl); } void reset() { if (Atomic::load(&_inserted_card)) { - _table.unsafe_reset(InitialLogTableSize); + _table.unsafe_reset(InitialLogTableSize); Atomic::store(&_inserted_card, false); } } @@ -343,93 +337,93 @@ G1CardSet::~G1CardSet() { _mm->flush(); } -uint G1CardSet::card_set_type_to_mem_object_type(uintptr_t type) const { - assert(type == G1CardSet::CardSetArrayOfCards || - type == G1CardSet::CardSetBitMap || - type == G1CardSet::CardSetHowl, "should not allocate card set type %zu", type); +uint G1CardSet::container_type_to_mem_object_type(uintptr_t type) const { + assert(type == G1CardSet::ContainerArrayOfCards || + type == G1CardSet::ContainerBitMap || + type == G1CardSet::ContainerHowl, "should not allocate container type %zu", type); return (uint)type; } uint8_t* G1CardSet::allocate_mem_object(uintptr_t type) { - return _mm->allocate(card_set_type_to_mem_object_type(type)); + return _mm->allocate(container_type_to_mem_object_type(type)); } -void G1CardSet::free_mem_object(CardSetPtr card_set) { - assert(card_set != G1CardSet::FreeCardSet, "should not free Free card set"); - assert(card_set != G1CardSet::FullCardSet, "should not free Full card set"); +void G1CardSet::free_mem_object(ContainerPtr container) { + assert(container != G1CardSet::FreeCardSet, "should not free container FreeCardSet"); + assert(container != G1CardSet::FullCardSet, "should not free container FullCardSet"); - uintptr_t type = card_set_type(card_set); - void* value = strip_card_set_type(card_set); + uintptr_t type = container_type(container); + void* value = strip_container_type(container); - assert(type == G1CardSet::CardSetArrayOfCards || - type == G1CardSet::CardSetBitMap || - type == G1CardSet::CardSetHowl, "should not free card set type %zu", type); + assert(type == G1CardSet::ContainerArrayOfCards || + type == G1CardSet::ContainerBitMap || + type == G1CardSet::ContainerHowl, "should not free card set type %zu", type); assert(static_cast(value)->refcount() == 1, "must be"); - _mm->free(card_set_type_to_mem_object_type(type), value); + _mm->free(container_type_to_mem_object_type(type), value); } -G1CardSet::CardSetPtr G1CardSet::acquire_card_set(CardSetPtr volatile* card_set_addr) { +G1CardSet::ContainerPtr G1CardSet::acquire_container(ContainerPtr volatile* container_addr) { // Update reference counts under RCU critical section to avoid a // use-after-cleapup bug where we increment a reference count for // an object whose memory has already been cleaned up and reused. GlobalCounter::CriticalSection cs(Thread::current()); while (true) { - // Get cardsetptr and increment refcount atomically wrt to memory reuse. - CardSetPtr card_set = Atomic::load_acquire(card_set_addr); - uint cs_type = card_set_type(card_set); - if (card_set == FullCardSet || cs_type == CardSetInlinePtr) { - return card_set; + // Get ContainerPtr and increment refcount atomically wrt to memory reuse. + ContainerPtr container = Atomic::load_acquire(container_addr); + uint cs_type = container_type(container); + if (container == FullCardSet || cs_type == ContainerInlinePtr) { + return container; } - G1CardSetContainer* card_set_on_heap = (G1CardSetContainer*)strip_card_set_type(card_set); + G1CardSetContainer* container_on_heap = (G1CardSetContainer*)strip_container_type(container); - if (card_set_on_heap->try_increment_refcount()) { - assert(card_set_on_heap->refcount() >= 3, "Smallest value is 3"); - return card_set; + if (container_on_heap->try_increment_refcount()) { + assert(container_on_heap->refcount() >= 3, "Smallest value is 3"); + return container; } } } -bool G1CardSet::release_card_set(CardSetPtr card_set) { - uint cs_type = card_set_type(card_set); - if (card_set == FullCardSet || cs_type == CardSetInlinePtr) { +bool G1CardSet::release_container(ContainerPtr container) { + uint cs_type = container_type(container); + if (container == FullCardSet || cs_type == ContainerInlinePtr) { return false; } - G1CardSetContainer* card_set_on_heap = (G1CardSetContainer*)strip_card_set_type(card_set); - return card_set_on_heap->decrement_refcount() == 1; + G1CardSetContainer* container_on_heap = (G1CardSetContainer*)strip_container_type(container); + return container_on_heap->decrement_refcount() == 1; } -void G1CardSet::release_and_maybe_free_card_set(CardSetPtr card_set) { - if (release_card_set(card_set)) { - free_mem_object(card_set); +void G1CardSet::release_and_maybe_free_container(ContainerPtr container) { + if (release_container(container)) { + free_mem_object(container); } } -void G1CardSet::release_and_must_free_card_set(CardSetPtr card_set) { - bool should_free = release_card_set(card_set); +void G1CardSet::release_and_must_free_container(ContainerPtr container) { + bool should_free = release_container(container); assert(should_free, "should have been the only one having a reference"); - free_mem_object(card_set); + free_mem_object(container); } class G1ReleaseCardsets : public StackObj { G1CardSet* _card_set; - using CardSetPtr = G1CardSet::CardSetPtr; + using ContainerPtr = G1CardSet::ContainerPtr; - void coarsen_to_full(CardSetPtr* card_set_addr) { + void coarsen_to_full(ContainerPtr* container_addr) { while (true) { - CardSetPtr cur_card_set = Atomic::load_acquire(card_set_addr); - uint cs_type = G1CardSet::card_set_type(cur_card_set); - if (cur_card_set == G1CardSet::FullCardSet) { + ContainerPtr cur_container = Atomic::load_acquire(container_addr); + uint cs_type = G1CardSet::container_type(cur_container); + if (cur_container == G1CardSet::FullCardSet) { return; } - CardSetPtr old_value = Atomic::cmpxchg(card_set_addr, cur_card_set, G1CardSet::FullCardSet); + ContainerPtr old_value = Atomic::cmpxchg(container_addr, cur_container, G1CardSet::FullCardSet); - if (old_value == cur_card_set) { - _card_set->release_and_maybe_free_card_set(cur_card_set); + if (old_value == cur_container) { + _card_set->release_and_maybe_free_container(cur_container); return; } } @@ -438,51 +432,51 @@ class G1ReleaseCardsets : public StackObj { public: explicit G1ReleaseCardsets(G1CardSet* card_set) : _card_set(card_set) { } - void operator ()(CardSetPtr* card_set_addr) { - coarsen_to_full(card_set_addr); + void operator ()(ContainerPtr* container_addr) { + coarsen_to_full(container_addr); } }; -G1AddCardResult G1CardSet::add_to_array(CardSetPtr card_set, uint card_in_region) { - G1CardSetArray* array = card_set_ptr(card_set); +G1AddCardResult G1CardSet::add_to_array(ContainerPtr container, uint card_in_region) { + G1CardSetArray* array = container_ptr(container); return array->add(card_in_region); } -G1AddCardResult G1CardSet::add_to_howl(CardSetPtr parent_card_set, - uint card_region, - uint card_in_region, - bool increment_total) { - G1CardSetHowl* howl = card_set_ptr(parent_card_set); +G1AddCardResult G1CardSet::add_to_howl(ContainerPtr parent_container, + uint card_region, + uint card_in_region, + bool increment_total) { + G1CardSetHowl* howl = container_ptr(parent_container); G1AddCardResult add_result; - CardSetPtr to_transfer = nullptr; - CardSetPtr card_set; + ContainerPtr to_transfer = nullptr; + ContainerPtr container; uint bucket = _config->howl_bucket_index(card_in_region); - volatile CardSetPtr* bucket_entry = howl->get_card_set_addr(bucket); + ContainerPtr volatile* bucket_entry = howl->get_container_addr(bucket); while (true) { if (Atomic::load(&howl->_num_entries) >= _config->cards_in_howl_threshold()) { return Overflow; } - card_set = acquire_card_set(bucket_entry); - add_result = add_to_card_set(bucket_entry, card_set, card_region, card_in_region); + container = acquire_container(bucket_entry); + add_result = add_to_container(bucket_entry, container, card_region, card_in_region); if (add_result != Overflow) { break; } - // Card set has overflown. Coarsen or retry. - bool coarsened = coarsen_card_set(bucket_entry, card_set, card_in_region, true /* within_howl */); - _coarsen_stats.record_coarsening(card_set_type(card_set) + G1CardSetCoarsenStats::CoarsenHowlOffset, !coarsened); + // Card set container has overflown. Coarsen or retry. + bool coarsened = coarsen_container(bucket_entry, container, card_in_region, true /* within_howl */); + _coarsen_stats.record_coarsening(container_type(container) + G1CardSetCoarsenStats::CoarsenHowlOffset, !coarsened); if (coarsened) { - // We have been the one coarsening this card set (and in the process added that card). + // We successful coarsened this card set container (and in the process added the card). add_result = Added; - to_transfer = card_set; + to_transfer = container; break; } // Somebody else beat us to coarsening. Retry. - release_and_maybe_free_card_set(card_set); + release_and_maybe_free_container(container); } if (increment_total && add_result == Added) { @@ -490,91 +484,91 @@ G1AddCardResult G1CardSet::add_to_howl(CardSetPtr parent_card_set, } if (to_transfer != nullptr) { - transfer_cards_in_howl(parent_card_set, to_transfer, card_region); + transfer_cards_in_howl(parent_container, to_transfer, card_region); } - release_and_maybe_free_card_set(card_set); + release_and_maybe_free_container(container); return add_result; } -G1AddCardResult G1CardSet::add_to_bitmap(CardSetPtr card_set, uint card_in_region) { - G1CardSetBitMap* bitmap = card_set_ptr(card_set); +G1AddCardResult G1CardSet::add_to_bitmap(ContainerPtr container, uint card_in_region) { + G1CardSetBitMap* bitmap = container_ptr(container); uint card_offset = _config->howl_bitmap_offset(card_in_region); return bitmap->add(card_offset, _config->cards_in_howl_bitmap_threshold(), _config->max_cards_in_howl_bitmap()); } -G1AddCardResult G1CardSet::add_to_inline_ptr(CardSetPtr volatile* card_set_addr, CardSetPtr card_set, uint card_in_region) { - G1CardSetInlinePtr value(card_set_addr, card_set); +G1AddCardResult G1CardSet::add_to_inline_ptr(ContainerPtr volatile* container_addr, ContainerPtr container, uint card_in_region) { + G1CardSetInlinePtr value(container_addr, container); return value.add(card_in_region, _config->inline_ptr_bits_per_card(), _config->max_cards_in_inline_ptr()); } -G1CardSet::CardSetPtr G1CardSet::create_coarsened_array_of_cards(uint card_in_region, bool within_howl) { +G1CardSet::ContainerPtr G1CardSet::create_coarsened_array_of_cards(uint card_in_region, bool within_howl) { uint8_t* data = nullptr; - CardSetPtr new_card_set; + ContainerPtr new_container; if (within_howl) { uint const size_in_bits = _config->max_cards_in_howl_bitmap(); - uint card_offset = _config->howl_bitmap_offset(card_in_region); - data = allocate_mem_object(CardSetBitMap); - new (data) G1CardSetBitMap(card_offset, size_in_bits); - new_card_set = make_card_set_ptr(data, CardSetBitMap); + uint container_offset = _config->howl_bitmap_offset(card_in_region); + data = allocate_mem_object(ContainerBitMap); + new (data) G1CardSetBitMap(container_offset, size_in_bits); + new_container = make_container_ptr(data, ContainerBitMap); } else { - data = allocate_mem_object(CardSetHowl); + data = allocate_mem_object(ContainerHowl); new (data) G1CardSetHowl(card_in_region, _config); - new_card_set = make_card_set_ptr(data, CardSetHowl); + new_container = make_container_ptr(data, ContainerHowl); } - return new_card_set; + return new_container; } -bool G1CardSet::coarsen_card_set(volatile CardSetPtr* card_set_addr, - CardSetPtr cur_card_set, - uint card_in_region, - bool within_howl) { - CardSetPtr new_card_set = nullptr; +bool G1CardSet::coarsen_container(ContainerPtr volatile* container_addr, + ContainerPtr cur_container, + uint card_in_region, + bool within_howl) { + ContainerPtr new_container = nullptr; - switch (card_set_type(cur_card_set)) { - case CardSetArrayOfCards : { - new_card_set = create_coarsened_array_of_cards(card_in_region, within_howl); + switch (container_type(cur_container)) { + case ContainerArrayOfCards: { + new_container = create_coarsened_array_of_cards(card_in_region, within_howl); break; } - case CardSetBitMap: { - new_card_set = FullCardSet; + case ContainerBitMap: { + new_container = FullCardSet; break; } - case CardSetInlinePtr: { + case ContainerInlinePtr: { uint const size = _config->max_cards_in_array(); - uint8_t* data = allocate_mem_object(CardSetArrayOfCards); + uint8_t* data = allocate_mem_object(ContainerArrayOfCards); new (data) G1CardSetArray(card_in_region, size); - new_card_set = make_card_set_ptr(data, CardSetArrayOfCards); + new_container = make_container_ptr(data, ContainerArrayOfCards); break; } - case CardSetHowl: { - new_card_set = FullCardSet; // anything will do at this point. + case ContainerHowl: { + new_container = FullCardSet; // anything will do at this point. break; } default: ShouldNotReachHere(); } - CardSetPtr old_value = Atomic::cmpxchg(card_set_addr, cur_card_set, new_card_set); // Memory order? - if (old_value == cur_card_set) { + ContainerPtr old_value = Atomic::cmpxchg(container_addr, cur_container, new_container); // Memory order? + if (old_value == cur_container) { // Success. Indicate that the cards from the current card set must be transferred // by this caller. // Release the hash table reference to the card. The caller still holds the // reference to this card set, so it can never be released (and we do not need to // check its result). - bool should_free = release_card_set(cur_card_set); + bool should_free = release_container(cur_container); assert(!should_free, "must have had more than one reference"); - // Free containers if cur_card_set is CardSetHowl - if (card_set_type(cur_card_set) == CardSetHowl) { + // Free containers if cur_container is ContainerHowl + if (container_type(cur_container) == ContainerHowl) { G1ReleaseCardsets rel(this); - card_set_ptr(cur_card_set)->iterate(rel, _config->num_buckets_in_howl()); + container_ptr(cur_container)->iterate(rel, _config->num_buckets_in_howl()); } return true; } else { // Somebody else beat us to coarsening that card set. Exit, but clean up first. - if (new_card_set != FullCardSet) { - assert(new_card_set != nullptr, "must not be"); - release_and_must_free_card_set(new_card_set); + if (new_container != FullCardSet) { + assert(new_container != nullptr, "must not be"); + release_and_must_free_container(new_container); } return false; } @@ -591,34 +585,34 @@ public: } }; -void G1CardSet::transfer_cards(G1CardSetHashTableValue* table_entry, CardSetPtr source_card_set, uint card_region) { - assert(source_card_set != FullCardSet, "Should not need to transfer from full"); - // Need to transfer old entries unless there is a Full card set in place now, i.e. - // the old type has been CardSetBitMap. "Full" contains all elements anyway. - if (card_set_type(source_card_set) != CardSetHowl) { +void G1CardSet::transfer_cards(G1CardSetHashTableValue* table_entry, ContainerPtr source_container, uint card_region) { + assert(source_container != FullCardSet, "Should not need to transfer from FullCardSet"); + // Need to transfer old entries unless there is a Full card set container in place now, i.e. + // the old type has been ContainerBitMap. "Full" contains all elements anyway. + if (container_type(source_container) != ContainerHowl) { G1TransferCard iter(this, card_region); - iterate_cards_during_transfer(source_card_set, iter); + iterate_cards_during_transfer(source_container, iter); } else { - assert(card_set_type(source_card_set) == CardSetHowl, "must be"); + assert(container_type(source_container) == ContainerHowl, "must be"); // Need to correct for that the Full remembered set occupies more cards than the // AoCS before. Atomic::add(&_num_occupied, _config->max_cards_in_region() - table_entry->_num_occupied, memory_order_relaxed); } } -void G1CardSet::transfer_cards_in_howl(CardSetPtr parent_card_set, - CardSetPtr source_card_set, - uint card_region) { - assert(card_set_type(parent_card_set) == CardSetHowl, "must be"); - assert(source_card_set != FullCardSet, "Should not need to transfer from full"); +void G1CardSet::transfer_cards_in_howl(ContainerPtr parent_container, + ContainerPtr source_container, + uint card_region) { + assert(container_type(parent_container) == ContainerHowl, "must be"); + assert(source_container != FullCardSet, "Should not need to transfer from full"); // Need to transfer old entries unless there is a Full card set in place now, i.e. - // the old type has been CardSetBitMap. - if (card_set_type(source_card_set) != CardSetBitMap) { - // We only need to transfer from anything below CardSetBitMap. + // the old type has been ContainerBitMap. + if (container_type(source_container) != ContainerBitMap) { + // We only need to transfer from anything below ContainerBitMap. G1TransferCard iter(this, card_region); - iterate_cards_during_transfer(source_card_set, iter); + iterate_cards_during_transfer(source_container, iter); } else { - uint diff = _config->max_cards_in_howl_bitmap() - card_set_ptr(source_card_set)->num_bits_set(); + uint diff = _config->max_cards_in_howl_bitmap() - container_ptr(source_container)->num_bits_set(); // Need to correct for that the Full remembered set occupies more cards than the // bitmap before. @@ -627,10 +621,10 @@ void G1CardSet::transfer_cards_in_howl(CardSetPtr parent_card_set, // G1CardSet::add_to_howl after coarsening. diff -= 1; - G1CardSetHowl* howling_array = card_set_ptr(parent_card_set); + G1CardSetHowl* howling_array = container_ptr(parent_container); Atomic::add(&howling_array->_num_entries, diff, memory_order_relaxed); - G1CardSetHashTableValue* table_entry = get_card_set(card_region); + G1CardSetHashTableValue* table_entry = get_container(card_region); assert(table_entry != nullptr, "Table entry not found for transferred cards"); Atomic::add(&table_entry->_num_occupied, diff, memory_order_relaxed); @@ -639,72 +633,75 @@ void G1CardSet::transfer_cards_in_howl(CardSetPtr parent_card_set, } } -G1AddCardResult G1CardSet::add_to_card_set(volatile CardSetPtr* card_set_addr, CardSetPtr card_set, uint card_region, uint card_in_region, bool increment_total) { - assert(card_set_addr != nullptr, "Cannot add to empty cardset"); +G1AddCardResult G1CardSet::add_to_container(ContainerPtr volatile* container_addr, + ContainerPtr container, + uint card_region, + uint card_in_region, + bool increment_total) { + assert(container_addr != nullptr, "must be"); G1AddCardResult add_result; - switch (card_set_type(card_set)) { - case CardSetInlinePtr: { - add_result = add_to_inline_ptr(card_set_addr, card_set, card_in_region); + switch (container_type(container)) { + case ContainerInlinePtr: { + add_result = add_to_inline_ptr(container_addr, container, card_in_region); break; } - case CardSetArrayOfCards : { - add_result = add_to_array(card_set, card_in_region); + case ContainerArrayOfCards: { + add_result = add_to_array(container, card_in_region); break; } - case CardSetBitMap: { - add_result = add_to_bitmap(card_set, card_in_region); + case ContainerBitMap: { + add_result = add_to_bitmap(container, card_in_region); break; } - case CardSetHowl: { - assert(CardSetHowl == card_set_type(FullCardSet), "must be"); - if (card_set == FullCardSet) { + case ContainerHowl: { + assert(ContainerHowl == container_type(FullCardSet), "must be"); + if (container == FullCardSet) { return Found; } - add_result = add_to_howl(card_set, card_region, card_in_region, increment_total); + add_result = add_to_howl(container, card_region, card_in_region, increment_total); break; } default: ShouldNotReachHere(); } - return add_result; } -G1CardSetHashTableValue* G1CardSet::get_or_add_card_set(uint card_region, bool* should_grow_table) { +G1CardSetHashTableValue* G1CardSet::get_or_add_container(uint card_region, bool* should_grow_table) { return _table->get_or_add(card_region, should_grow_table); } -G1CardSetHashTableValue* G1CardSet::get_card_set(uint card_region) { +G1CardSetHashTableValue* G1CardSet::get_container(uint card_region) { return _table->get(card_region); } G1AddCardResult G1CardSet::add_card(uint card_region, uint card_in_region, bool increment_total) { G1AddCardResult add_result; - CardSetPtr to_transfer = nullptr; - CardSetPtr card_set; + ContainerPtr to_transfer = nullptr; + ContainerPtr container; bool should_grow_table = false; - G1CardSetHashTableValue* table_entry = get_or_add_card_set(card_region, &should_grow_table); + G1CardSetHashTableValue* table_entry = get_or_add_container(card_region, &should_grow_table); while (true) { - card_set = acquire_card_set(&table_entry->_card_set); - add_result = add_to_card_set(&table_entry->_card_set, card_set, card_region, card_in_region, increment_total); + container = acquire_container(&table_entry->_container); + add_result = add_to_container(&table_entry->_container, container, card_region, card_in_region, increment_total); if (add_result != Overflow) { break; } // Card set has overflown. Coarsen or retry. - bool coarsened = coarsen_card_set(&table_entry->_card_set, card_set, card_in_region); - _coarsen_stats.record_coarsening(card_set_type(card_set), !coarsened); + bool coarsened = coarsen_container(&table_entry->_container, container, card_in_region); + _coarsen_stats.record_coarsening(container_type(container), !coarsened); if (coarsened) { - // We have been the one coarsening this card set (and in the process added that card). + // We successful coarsened this card set container (and in the process added the card). add_result = Added; - to_transfer = card_set; + to_transfer = container; break; } // Somebody else beat us to coarsening. Retry. - release_and_maybe_free_card_set(card_set); + release_and_maybe_free_container(container); } if (increment_total && add_result == Added) { @@ -718,7 +715,7 @@ G1AddCardResult G1CardSet::add_card(uint card_region, uint card_in_region, bool transfer_cards(table_entry, to_transfer, card_region); } - release_and_maybe_free_card_set(card_set); + release_and_maybe_free_container(container); return add_result; } @@ -727,29 +724,29 @@ bool G1CardSet::contains_card(uint card_region, uint card_in_region) { assert(card_in_region < _config->max_cards_in_region(), "Card %u is beyond max %u", card_in_region, _config->max_cards_in_region()); - // Protect the card set from reclamation. + // Protect the card set container from reclamation. GlobalCounter::CriticalSection cs(Thread::current()); - G1CardSetHashTableValue* table_entry = get_card_set(card_region); + G1CardSetHashTableValue* table_entry = get_container(card_region); if (table_entry == nullptr) { return false; } - CardSetPtr card_set = table_entry->_card_set; - if (card_set == FullCardSet) { + ContainerPtr container = table_entry->_container; + if (container == FullCardSet) { // contains_card() is not a performance critical method so we do not hide that // case in the switch below. return true; } - switch (card_set_type(card_set)) { - case CardSetInlinePtr: { - G1CardSetInlinePtr ptr(card_set); + switch (container_type(container)) { + case ContainerInlinePtr: { + G1CardSetInlinePtr ptr(container); return ptr.contains(card_in_region, _config->inline_ptr_bits_per_card()); } - case CardSetArrayOfCards : return card_set_ptr(card_set)->contains(card_in_region); - case CardSetBitMap: return card_set_ptr(card_set)->contains(card_in_region, _config->max_cards_in_howl_bitmap()); - case CardSetHowl: { - G1CardSetHowl* howling_array = card_set_ptr(card_set); + case ContainerArrayOfCards: return container_ptr(container)->contains(card_in_region); + case ContainerBitMap: return container_ptr(container)->contains(card_in_region, _config->max_cards_in_howl_bitmap()); + case ContainerHowl: { + G1CardSetHowl* howling_array = container_ptr(container); return howling_array->contains(card_in_region, _config); } @@ -759,53 +756,53 @@ bool G1CardSet::contains_card(uint card_region, uint card_in_region) { } void G1CardSet::print_info(outputStream* st, uint card_region, uint card_in_region) { - G1CardSetHashTableValue* table_entry = get_card_set(card_region); + G1CardSetHashTableValue* table_entry = get_container(card_region); if (table_entry == nullptr) { st->print("NULL card set"); return; } - CardSetPtr card_set = table_entry->_card_set; - if (card_set == FullCardSet) { + ContainerPtr container = table_entry->_container; + if (container == FullCardSet) { st->print("FULL card set)"); return; } - switch (card_set_type(card_set)) { - case CardSetInlinePtr: { + switch (container_type(container)) { + case ContainerInlinePtr: { st->print("InlinePtr not containing %u", card_in_region); break; } - case CardSetArrayOfCards : { + case ContainerArrayOfCards: { st->print("AoC not containing %u", card_in_region); break; } - case CardSetBitMap: { + case ContainerBitMap: { st->print("BitMap not containing %u", card_in_region); break; } - case CardSetHowl: { - st->print("CardSetHowl not containing %u", card_in_region); + case ContainerHowl: { + st->print("ContainerHowl not containing %u", card_in_region); break; } - default: st->print("Unknown card set type %u", card_set_type(card_set)); ShouldNotReachHere(); break; + default: st->print("Unknown card set container type %u", container_type(container)); ShouldNotReachHere(); break; } } template -void G1CardSet::iterate_cards_during_transfer(CardSetPtr const card_set, CardVisitor& cl) { - uint type = card_set_type(card_set); - assert(type == CardSetInlinePtr || type == CardSetArrayOfCards, +void G1CardSet::iterate_cards_during_transfer(ContainerPtr const container, CardVisitor& cl) { + uint type = container_type(container); + assert(type == ContainerInlinePtr || type == ContainerArrayOfCards, "invalid card set type %d to transfer from", - card_set_type(card_set)); + container_type(container)); switch (type) { - case CardSetInlinePtr: { - G1CardSetInlinePtr ptr(card_set); + case ContainerInlinePtr: { + G1CardSetInlinePtr ptr(container); ptr.iterate(cl, _config->inline_ptr_bits_per_card()); return; } - case CardSetArrayOfCards : { - card_set_ptr(card_set)->iterate(cl); + case ContainerArrayOfCards: { + container_ptr(container)->iterate(cl); return; } default: @@ -813,7 +810,7 @@ void G1CardSet::iterate_cards_during_transfer(CardSetPtr const card_set, CardVis } } -void G1CardSet::iterate_containers(CardSetPtrClosure* cl, bool at_safepoint) { +void G1CardSet::iterate_containers(ContainerPtrClosure* cl, bool at_safepoint) { if (at_safepoint) { _table->iterate_safepoint(cl); } else { @@ -844,7 +841,7 @@ public: }; template class CardOrRanges> -class G1CardSetContainersClosure : public G1CardSet::CardSetPtrClosure { +class G1CardSetContainersClosure : public G1CardSet::ContainerPtrClosure { G1CardSet* _card_set; Closure& _cl; @@ -855,9 +852,9 @@ public: _card_set(card_set), _cl(cl) { } - void do_cardsetptr(uint region_idx, size_t num_occupied, G1CardSet::CardSetPtr card_set) override { + void do_containerptr(uint region_idx, size_t num_occupied, G1CardSet::ContainerPtr container) override { CardOrRanges cl(_cl, region_idx); - _card_set->iterate_cards_or_ranges_in_container(card_set, cl); + _card_set->iterate_cards_or_ranges_in_container(container, cl); } }; @@ -879,13 +876,13 @@ size_t G1CardSet::occupied() const { } size_t G1CardSet::num_containers() { - class GetNumberOfContainers : public CardSetPtrClosure { + class GetNumberOfContainers : public ContainerPtrClosure { public: size_t _count; - GetNumberOfContainers() : CardSetPtrClosure(), _count(0) { } + GetNumberOfContainers() : ContainerPtrClosure(), _count(0) { } - void do_cardsetptr(uint region_idx, size_t num_occupied, CardSetPtr card_set) override { + void do_containerptr(uint region_idx, size_t num_occupied, ContainerPtr container) override { _count++; } } cl; diff --git a/src/hotspot/share/gc/g1/g1CardSet.hpp b/src/hotspot/share/gc/g1/g1CardSet.hpp index 465984d7138..946d8cb7338 100644 --- a/src/hotspot/share/gc/g1/g1CardSet.hpp +++ b/src/hotspot/share/gc/g1/g1CardSet.hpp @@ -26,10 +26,7 @@ #define SHARE_GC_G1_G1CARDSET_HPP #include "memory/allocation.hpp" -#include "memory/padded.hpp" -#include "oops/oopsHierarchy.hpp" #include "utilities/concurrentHashTable.hpp" -#include "utilities/lockFreeStack.hpp" class G1CardSetAllocOptions; class G1CardSetHashTable; @@ -147,10 +144,10 @@ public: class G1CardSetCoarsenStats { public: // Number of entries in the statistics tables: since we index with the source - // cardset of the coarsening, this is the total number of combinations of - // card sets - 1. + // container of the coarsening, this is the total number of combinations of + // card set containers - 1. static constexpr size_t NumCoarsenCategories = 7; - // Coarsening statistics for the possible CardSetPtr in the Howl card set + // Coarsening statistics for the possible ContainerPtr in the Howl card set // start from this offset. static constexpr size_t CoarsenHowlOffset = 4; @@ -173,14 +170,14 @@ public: void print_on(outputStream* out); }; -// Sparse set of card indexes comprising a remembered set on the Java heap. Card +// Set of card indexes comprising a remembered set on the Java heap. Card // size is assumed to be card table card size. // // Technically it is implemented using a ConcurrentHashTable that stores a card // set container for every region containing at least one card. // // There are in total five different containers, encoded in the ConcurrentHashTable -// node as CardSetPtr. A CardSetPtr may cover the whole region or just a part of +// node as ContainerPtr. A ContainerPtr may cover the whole region or just a part of // it. // See its description below for more information. class G1CardSet : public CHeapObj { @@ -194,46 +191,46 @@ class G1CardSet : public CHeapObj { static G1CardSetCoarsenStats _coarsen_stats; // Coarsening statistics since VM start. static G1CardSetCoarsenStats _last_coarsen_stats; // Coarsening statistics at last GC. public: - // Two lower bits are used to encode the card storage types - static const uintptr_t CardSetPtrHeaderSize = 2; + // Two lower bits are used to encode the card set container types + static const uintptr_t ContainerPtrHeaderSize = 2; - // CardSetPtr represents the card storage type of a given covered area. It encodes - // a type in the LSBs, in addition to having a few significant values. + // ContainerPtr represents the card set container type of a given covered area. + // It encodes a type in the LSBs, in addition to having a few significant values. // // Possible encodings: // // 0...00000 free (Empty, should never happen) - // 1...11111 full All card indexes in the whole area this CardSetPtr covers are part of this container. - // X...XXX00 inline-ptr-cards A handful of card indexes covered by this CardSetPtr are encoded within the CardSetPtr. + // 1...11111 full All card indexes in the whole area this ContainerPtr covers are part of this container. + // X...XXX00 inline-ptr-cards A handful of card indexes covered by this ContainerPtr are encoded within the ContainerPtr. // X...XXX01 array of cards The container is a contiguous array of card indexes. // X...XXX10 bitmap The container uses a bitmap to determine whether a given index is part of this set. - // X...XXX11 howl This is a card set container containing an array of CardSetPtr, with each CardSetPtr + // X...XXX11 howl This is a card set container containing an array of ContainerPtr, with each ContainerPtr // limited to a sub-range of the original range. Currently only one level of this // container is supported. - typedef void* CardSetPtr; + using ContainerPtr = void*; // Coarsening happens in the order below: - // CardSetInlinePtr -> CardSetArrayOfCards -> CardSetHowl -> Full - // Corsening of containers inside the CardSetHowl happens in the order: - // CardSetInlinePtr -> CardSetArrayOfCards -> CardSetBitMap -> Full - static const uintptr_t CardSetInlinePtr = 0x0; - static const uintptr_t CardSetArrayOfCards = 0x1; - static const uintptr_t CardSetBitMap = 0x2; - static const uintptr_t CardSetHowl = 0x3; + // ContainerInlinePtr -> ContainerArrayOfCards -> ContainerHowl -> Full + // Corsening of containers inside the ContainerHowl happens in the order: + // ContainerInlinePtr -> ContainerArrayOfCards -> ContainerBitMap -> Full + static const uintptr_t ContainerInlinePtr = 0x0; + static const uintptr_t ContainerArrayOfCards = 0x1; + static const uintptr_t ContainerBitMap = 0x2; + static const uintptr_t ContainerHowl = 0x3; // The special sentinel values - static constexpr CardSetPtr FreeCardSet = nullptr; - // Unfortunately we can't make (G1CardSet::CardSetPtr)-1 constexpr because + static constexpr ContainerPtr FreeCardSet = nullptr; + // Unfortunately we can't make (G1CardSet::ContainerPtr)-1 constexpr because // reinterpret_casts are forbidden in constexprs. Use a regular static instead. - static CardSetPtr FullCardSet; + static ContainerPtr FullCardSet; - static const uintptr_t CardSetPtrTypeMask = ((uintptr_t)1 << CardSetPtrHeaderSize) - 1; + static const uintptr_t ContainerPtrTypeMask = ((uintptr_t)1 << ContainerPtrHeaderSize) - 1; - static CardSetPtr strip_card_set_type(CardSetPtr ptr) { return (CardSetPtr)((uintptr_t)ptr & ~CardSetPtrTypeMask); } + static ContainerPtr strip_container_type(ContainerPtr ptr) { return (ContainerPtr)((uintptr_t)ptr & ~ContainerPtrTypeMask); } - static uint card_set_type(CardSetPtr ptr) { return (uintptr_t)ptr & CardSetPtrTypeMask; } + static uint container_type(ContainerPtr ptr) { return (uintptr_t)ptr & ContainerPtrTypeMask; } template - static T* card_set_ptr(CardSetPtr ptr); + static T* container_ptr(ContainerPtr ptr); private: G1CardSetMemoryManager* _mm; @@ -245,42 +242,42 @@ private: // be (slightly) more cards in the card set than this value in reality. size_t _num_occupied; - CardSetPtr make_card_set_ptr(void* value, uintptr_t type); + ContainerPtr make_container_ptr(void* value, uintptr_t type); - CardSetPtr acquire_card_set(CardSetPtr volatile* card_set_addr); - // Returns true if the card set should be released - bool release_card_set(CardSetPtr card_set); + ContainerPtr acquire_container(ContainerPtr volatile* container_addr); + // Returns true if the card set container should be released + bool release_container(ContainerPtr container); // Release card set and free if needed. - void release_and_maybe_free_card_set(CardSetPtr card_set); + void release_and_maybe_free_container(ContainerPtr container); // Release card set and free (and it must be freeable). - void release_and_must_free_card_set(CardSetPtr card_set); + void release_and_must_free_container(ContainerPtr container); - // Coarsens the CardSet cur_card_set to the next level; tries to replace the - // previous CardSet with a new one which includes the given card_in_region. - // coarsen_card_set does not transfer cards from cur_card_set - // to the new card_set. Transfer is achieved by transfer_cards. - // Returns true if this was the thread that coarsened the CardSet (and added the card). - bool coarsen_card_set(CardSetPtr volatile* card_set_addr, - CardSetPtr cur_card_set, - uint card_in_region, bool within_howl = false); + // Coarsens the card set container cur_container to the next level; tries to replace the + // previous ContainerPtr with a new one which includes the given card_in_region. + // coarsen_container does not transfer cards from cur_container + // to the new container. Transfer is achieved by transfer_cards. + // Returns true if this was the thread that coarsened the container (and added the card). + bool coarsen_container(ContainerPtr volatile* container_addr, + ContainerPtr cur_container, + uint card_in_region, bool within_howl = false); - CardSetPtr create_coarsened_array_of_cards(uint card_in_region, bool within_howl); + ContainerPtr create_coarsened_array_of_cards(uint card_in_region, bool within_howl); // Transfer entries from source_card_set to a recently installed coarser storage type - // We only need to transfer anything finer than CardSetBitMap. "Full" contains + // We only need to transfer anything finer than ContainerBitMap. "Full" contains // all elements anyway. - void transfer_cards(G1CardSetHashTableValue* table_entry, CardSetPtr source_card_set, uint card_region); - void transfer_cards_in_howl(CardSetPtr parent_card_set, CardSetPtr source_card_set, uint card_region); + void transfer_cards(G1CardSetHashTableValue* table_entry, ContainerPtr source_container, uint card_region); + void transfer_cards_in_howl(ContainerPtr parent_container, ContainerPtr source_container, uint card_region); - G1AddCardResult add_to_card_set(CardSetPtr volatile* card_set_addr, CardSetPtr card_set, uint card_region, uint card, bool increment_total = true); + G1AddCardResult add_to_container(ContainerPtr volatile* container_addr, ContainerPtr container, uint card_region, uint card, bool increment_total = true); - G1AddCardResult add_to_inline_ptr(CardSetPtr volatile* card_set_addr, CardSetPtr card_set, uint card_in_region); - G1AddCardResult add_to_array(CardSetPtr card_set, uint card_in_region); - G1AddCardResult add_to_bitmap(CardSetPtr card_set, uint card_in_region); - G1AddCardResult add_to_howl(CardSetPtr parent_card_set, uint card_region, uint card_in_region, bool increment_total = true); + G1AddCardResult add_to_inline_ptr(ContainerPtr volatile* container_addr, ContainerPtr container, uint card_in_region); + G1AddCardResult add_to_array(ContainerPtr container, uint card_in_region); + G1AddCardResult add_to_bitmap(ContainerPtr container, uint card_in_region); + G1AddCardResult add_to_howl(ContainerPtr parent_container, uint card_region, uint card_in_region, bool increment_total = true); - G1CardSetHashTableValue* get_or_add_card_set(uint card_region, bool* should_grow_table); - G1CardSetHashTableValue* get_card_set(uint card_region); + G1CardSetHashTableValue* get_or_add_container(uint card_region, bool* should_grow_table); + G1CardSetHashTableValue* get_container(uint card_region); // Iterate over cards of a card set container during transfer of the cards from // one container to another. Executes @@ -289,11 +286,11 @@ private: // // on the given class. template - void iterate_cards_during_transfer(CardSetPtr const card_set, CardVisitor& vl); + void iterate_cards_during_transfer(ContainerPtr const container, CardVisitor& vl); - uint card_set_type_to_mem_object_type(uintptr_t type) const; + uint container_type_to_mem_object_type(uintptr_t type) const; uint8_t* allocate_mem_object(uintptr_t type); - void free_mem_object(CardSetPtr card_set); + void free_mem_object(ContainerPtr container); public: G1CardSetConfiguration* config() const { return _config; } @@ -302,8 +299,8 @@ public: G1CardSet(G1CardSetConfiguration* config, G1CardSetMemoryManager* mm); virtual ~G1CardSet(); - // Adds the given card to this set, returning an appropriate result. If added, - // updates the total count. + // Adds the given card to this set, returning an appropriate result. + // If incremental_count is true and the card has been added, updates the total count. G1AddCardResult add_card(uint card_region, uint card_in_region, bool increment_total = true); bool contains_card(uint card_region, uint card_in_region); @@ -351,14 +348,14 @@ public: // start_iterate(). // template - void iterate_cards_or_ranges_in_container(CardSetPtr const card_set, CardOrRangeVisitor& cl); + void iterate_cards_or_ranges_in_container(ContainerPtr const container, CardOrRangeVisitor& cl); - class CardSetPtrClosure { + class ContainerPtrClosure { public: - virtual void do_cardsetptr(uint region_idx, size_t num_occupied, CardSetPtr card_set) = 0; + virtual void do_containerptr(uint region_idx, size_t num_occupied, ContainerPtr container) = 0; }; - void iterate_containers(CardSetPtrClosure* cl, bool safepoint = false); + void iterate_containers(ContainerPtrClosure* cl, bool safepoint = false); class CardClosure { public: @@ -370,13 +367,13 @@ public: class G1CardSetHashTableValue { public: - using CardSetPtr = G1CardSet::CardSetPtr; + using ContainerPtr = G1CardSet::ContainerPtr; const uint _region_idx; uint volatile _num_occupied; - CardSetPtr volatile _card_set; + ContainerPtr volatile _container; - G1CardSetHashTableValue(uint region_idx, CardSetPtr card_set) : _region_idx(region_idx), _num_occupied(0), _card_set(card_set) { } + G1CardSetHashTableValue(uint region_idx, ContainerPtr container) : _region_idx(region_idx), _num_occupied(0), _container(container) { } }; class G1CardSetHashTableConfig : public StackObj { @@ -391,6 +388,6 @@ public: static void free_node(void* context, void* memory, Value const& value); }; -typedef ConcurrentHashTable CardSetHash; +using CardSetHash = ConcurrentHashTable; #endif // SHARE_GC_G1_G1CARDSET_HPP diff --git a/src/hotspot/share/gc/g1/g1CardSet.inline.hpp b/src/hotspot/share/gc/g1/g1CardSet.inline.hpp index 99938b4b74e..49d7928735a 100644 --- a/src/hotspot/share/gc/g1/g1CardSet.inline.hpp +++ b/src/hotspot/share/gc/g1/g1CardSet.inline.hpp @@ -28,55 +28,54 @@ #include "gc/g1/g1CardSet.hpp" #include "gc/g1/g1CardSetContainers.inline.hpp" #include "gc/g1/g1GCPhaseTimes.hpp" -#include "runtime/atomic.hpp" #include "logging/log.hpp" template -inline T* G1CardSet::card_set_ptr(CardSetPtr ptr) { - return (T*)strip_card_set_type(ptr); +inline T* G1CardSet::container_ptr(ContainerPtr ptr) { + return (T*)strip_container_type(ptr); } -inline G1CardSet::CardSetPtr G1CardSet::make_card_set_ptr(void* value, uintptr_t type) { - assert(card_set_type(value) == 0, "Given ptr " PTR_FORMAT " already has type bits set", p2i(value)); - return (CardSetPtr)((uintptr_t)value | type); +inline G1CardSet::ContainerPtr G1CardSet::make_container_ptr(void* value, uintptr_t type) { + assert(container_type(value) == 0, "Given ptr " PTR_FORMAT " already has type bits set", p2i(value)); + return (ContainerPtr)((uintptr_t)value | type); } template -inline void G1CardSet::iterate_cards_or_ranges_in_container(CardSetPtr const card_set, CardOrRangeVisitor& cl) { - switch (card_set_type(card_set)) { - case CardSetInlinePtr: { +inline void G1CardSet::iterate_cards_or_ranges_in_container(ContainerPtr const container, CardOrRangeVisitor& cl) { + switch (container_type(container)) { + case ContainerInlinePtr: { if (cl.start_iterate(G1GCPhaseTimes::MergeRSMergedInline)) { - G1CardSetInlinePtr ptr(card_set); + G1CardSetInlinePtr ptr(container); ptr.iterate(cl, _config->inline_ptr_bits_per_card()); } return; } - case CardSetArrayOfCards : { + case ContainerArrayOfCards: { if (cl.start_iterate(G1GCPhaseTimes::MergeRSMergedArrayOfCards)) { - card_set_ptr(card_set)->iterate(cl); + container_ptr(container)->iterate(cl); } return; } - case CardSetBitMap: { + case ContainerBitMap: { // There is no first-level bitmap spanning the whole area. ShouldNotReachHere(); return; } - case CardSetHowl: { - assert(card_set_type(FullCardSet) == CardSetHowl, "Must be"); - if (card_set == FullCardSet) { + case ContainerHowl: { + assert(container_type(FullCardSet) == ContainerHowl, "Must be"); + if (container == FullCardSet) { if (cl.start_iterate(G1GCPhaseTimes::MergeRSMergedFull)) { cl(0, _config->max_cards_in_region()); } return; } if (cl.start_iterate(G1GCPhaseTimes::MergeRSMergedHowl)) { - card_set_ptr(card_set)->iterate(cl, _config); + container_ptr(container)->iterate(cl, _config); } return; } } - log_error(gc)("Unkown card set type %u", card_set_type(card_set)); + log_error(gc)("Unkown card set container type %u", container_type(container)); ShouldNotReachHere(); } diff --git a/src/hotspot/share/gc/g1/g1CardSetContainers.hpp b/src/hotspot/share/gc/g1/g1CardSetContainers.hpp index 6736a18ab02..453594da3f9 100644 --- a/src/hotspot/share/gc/g1/g1CardSetContainers.hpp +++ b/src/hotspot/share/gc/g1/g1CardSetContainers.hpp @@ -31,7 +31,7 @@ #include "utilities/bitMap.hpp" #include "utilities/globalDefinitions.hpp" -// A helper class to encode a few card indexes within a CardSetPtr. +// A helper class to encode a few card indexes within a ContainerPtr. // // The pointer value (either 32 or 64 bits) is split into two areas: // @@ -65,16 +65,16 @@ class G1CardSetInlinePtr : public StackObj { friend class G1CardSetContainersTest; - typedef G1CardSet::CardSetPtr CardSetPtr; + using ContainerPtr = G1CardSet::ContainerPtr; - CardSetPtr volatile * _value_addr; - CardSetPtr _value; + ContainerPtr volatile * _value_addr; + ContainerPtr _value; static const uint SizeFieldLen = 3; static const uint SizeFieldPos = 2; - static const uint HeaderSize = G1CardSet::CardSetPtrHeaderSize + SizeFieldLen; + static const uint HeaderSize = G1CardSet::ContainerPtrHeaderSize + SizeFieldLen; - static const uint BitsInValue = sizeof(CardSetPtr) * BitsPerByte; + static const uint BitsInValue = sizeof(ContainerPtr) * BitsPerByte; static const uintptr_t SizeFieldMask = (((uint)1 << SizeFieldLen) - 1) << SizeFieldPos; @@ -82,9 +82,9 @@ class G1CardSetInlinePtr : public StackObj { return (idx * bits_per_card + HeaderSize); } - static CardSetPtr merge(CardSetPtr orig_value, uint card_in_region, uint idx, uint bits_per_card); + static ContainerPtr merge(ContainerPtr orig_value, uint card_in_region, uint idx, uint bits_per_card); - static uint card_at(CardSetPtr value, uint const idx, uint const bits_per_card) { + static uint card_at(ContainerPtr value, uint const idx, uint const bits_per_card) { uint8_t card_pos = card_pos_for(idx, bits_per_card); uint result = ((uintptr_t)value >> card_pos) & (((uintptr_t)1 << bits_per_card) - 1); return result; @@ -93,14 +93,14 @@ class G1CardSetInlinePtr : public StackObj { uint find(uint const card_idx, uint const bits_per_card, uint start_at, uint num_cards); public: - G1CardSetInlinePtr() : _value_addr(nullptr), _value((CardSetPtr)G1CardSet::CardSetInlinePtr) { } + G1CardSetInlinePtr() : _value_addr(nullptr), _value((ContainerPtr)G1CardSet::ContainerInlinePtr) { } - G1CardSetInlinePtr(CardSetPtr value) : _value_addr(nullptr), _value(value) { - assert(G1CardSet::card_set_type(_value) == G1CardSet::CardSetInlinePtr, "Value " PTR_FORMAT " is not a valid G1CardSetInPtr.", p2i(_value)); + G1CardSetInlinePtr(ContainerPtr value) : _value_addr(nullptr), _value(value) { + assert(G1CardSet::container_type(_value) == G1CardSet::ContainerInlinePtr, "Value " PTR_FORMAT " is not a valid G1CardSetInlinePtr.", p2i(_value)); } - G1CardSetInlinePtr(CardSetPtr volatile* value_addr, CardSetPtr value) : _value_addr(value_addr), _value(value) { - assert(G1CardSet::card_set_type(_value) == G1CardSet::CardSetInlinePtr, "Value " PTR_FORMAT " is not a valid G1CardSetInPtr.", p2i(_value)); + G1CardSetInlinePtr(ContainerPtr volatile* value_addr, ContainerPtr value) : _value_addr(value_addr), _value(value) { + assert(G1CardSet::container_type(_value) == G1CardSet::ContainerInlinePtr, "Value " PTR_FORMAT " is not a valid G1CardSetInlinePtr.", p2i(_value)); } G1AddCardResult add(uint const card_idx, uint const bits_per_card, uint const max_cards_in_inline_ptr); @@ -110,13 +110,13 @@ public: template void iterate(CardVisitor& found, uint const bits_per_card); - operator CardSetPtr () { return _value; } + operator ContainerPtr () { return _value; } static uint max_cards_in_inline_ptr(uint bits_per_card) { return (BitsInValue - HeaderSize) / bits_per_card; } - static uint num_cards_in(CardSetPtr value) { + static uint num_cards_in(ContainerPtr value) { return ((uintptr_t)value & SizeFieldMask) >> SizeFieldPos; } }; @@ -139,7 +139,7 @@ public: // which requires that we increment the reference counts by 2 starting at _ref_count = 3. // // All but inline pointers are of this kind. For those, card entries are stored -// directly in the CardSetPtr of the ConcurrentHashTable node. +// directly in the ContainerPtr of the ConcurrentHashTable node. class G1CardSetContainer { uintptr_t _ref_count; protected: @@ -163,7 +163,7 @@ class G1CardSetArray : public G1CardSetContainer { public: typedef uint16_t EntryDataType; typedef uint EntryCountType; - using CardSetPtr = G1CardSet::CardSetPtr; + using ContainerPtr = G1CardSet::ContainerPtr; private: EntryCountType _size; EntryCountType volatile _num_entries; @@ -217,7 +217,7 @@ class G1CardSetBitMap : public G1CardSetContainer { size_t _num_bits_set; BitMap::bm_word_t _bits[1]; - using CardSetPtr = G1CardSet::CardSetPtr; + using ContainerPtr = G1CardSet::ContainerPtr; template static size_t header_size_in_bytes_internal() { @@ -252,10 +252,10 @@ public: class G1CardSetHowl : public G1CardSetContainer { public: typedef uint EntryCountType; - using CardSetPtr = G1CardSet::CardSetPtr; + using ContainerPtr = G1CardSet::ContainerPtr; EntryCountType volatile _num_entries; private: - CardSetPtr _buckets[2]; + ContainerPtr _buckets[2]; // Do not add class member variables beyond this point template @@ -263,32 +263,32 @@ private: return offset_of(Derived, _buckets); } - // Iterates over the given CardSetPtr with at index in this Howl card set, + // Iterates over the given ContainerPtr with at index in this Howl card set, // applying a CardOrRangeVisitor on it. template - void iterate_cardset(CardSetPtr const card_set, uint index, CardOrRangeVisitor& found, G1CardSetConfiguration* config); + void iterate_cardset(ContainerPtr const container, uint index, CardOrRangeVisitor& found, G1CardSetConfiguration* config); public: G1CardSetHowl(EntryCountType card_in_region, G1CardSetConfiguration* config); - CardSetPtr* get_card_set_addr(EntryCountType index) { + ContainerPtr* get_container_addr(EntryCountType index) { return &_buckets[index]; } bool contains(uint card_idx, G1CardSetConfiguration* config); - // Iterates over all CardSetPtrs in this Howl card set, applying a CardOrRangeVisitor + // Iterates over all ContainerPtrs in this Howl card set, applying a CardOrRangeVisitor // on it. template void iterate(CardOrRangeVisitor& found, G1CardSetConfiguration* config); - // Iterates over all CardSetPtrs in this Howl card set. Calls + // Iterates over all ContainerPtrs in this Howl card set. Calls // - // void operator ()(CardSetPtr* card_set_addr); + // void operator ()(ContainerPtr* card_set_addr); // // on all of them. - template - void iterate(CardSetPtrVisitor& found, uint num_card_sets); + template + void iterate(ContainerPtrVisitor& found, uint num_card_sets); static EntryCountType num_buckets(size_t size_in_bits, size_t num_cards_in_array, size_t max_buckets); @@ -300,7 +300,7 @@ public: static size_t header_size_in_bytes() { return header_size_in_bytes_internal(); } static size_t size_in_bytes(size_t num_arrays) { - return header_size_in_bytes() + sizeof(CardSetPtr) * num_arrays; + return header_size_in_bytes() + sizeof(ContainerPtr) * num_arrays; } }; diff --git a/src/hotspot/share/gc/g1/g1CardSetContainers.inline.hpp b/src/hotspot/share/gc/g1/g1CardSetContainers.inline.hpp index 73d84fbf934..3949687a97c 100644 --- a/src/hotspot/share/gc/g1/g1CardSetContainers.inline.hpp +++ b/src/hotspot/share/gc/g1/g1CardSetContainers.inline.hpp @@ -31,7 +31,7 @@ #include "utilities/globalDefinitions.hpp" #include "utilities/spinYield.hpp" -inline G1CardSetInlinePtr::CardSetPtr G1CardSetInlinePtr::merge(CardSetPtr orig_value, uint card_in_region, uint idx, uint bits_per_card) { +inline G1CardSetInlinePtr::ContainerPtr G1CardSetInlinePtr::merge(ContainerPtr orig_value, uint card_in_region, uint idx, uint bits_per_card) { assert((idx & (SizeFieldMask >> SizeFieldPos)) == idx, "Index %u too large to fit into size field", idx); assert(card_in_region < ((uint)1 << bits_per_card), "Card %u too large to fit into card value field", card_in_region); @@ -44,7 +44,7 @@ inline G1CardSetInlinePtr::CardSetPtr G1CardSetInlinePtr::merge(CardSetPtr orig_ uintptr_t value = ((uintptr_t)(idx + 1) << SizeFieldPos) | ((uintptr_t)card_in_region << card_pos); uintptr_t res = (((uintptr_t)orig_value & ~SizeFieldMask) | value); - return (CardSetPtr)res; + return (ContainerPtr)res; } inline G1AddCardResult G1CardSetInlinePtr::add(uint card_idx, uint bits_per_card, uint max_cards_in_inline_ptr) { @@ -64,8 +64,8 @@ inline G1AddCardResult G1CardSetInlinePtr::add(uint card_idx, uint bits_per_card if (num_cards >= max_cards_in_inline_ptr) { return Overflow; } - CardSetPtr new_value = merge(_value, card_idx, num_cards, bits_per_card); - CardSetPtr old_value = Atomic::cmpxchg(_value_addr, _value, new_value, memory_order_relaxed); + ContainerPtr new_value = merge(_value, card_idx, num_cards, bits_per_card); + ContainerPtr old_value = Atomic::cmpxchg(_value_addr, _value, new_value, memory_order_relaxed); if (_value == old_value) { return Added; } @@ -73,7 +73,7 @@ inline G1AddCardResult G1CardSetInlinePtr::add(uint card_idx, uint bits_per_card _value = old_value; // The value of the pointer may have changed to something different than // an inline card set. Exit then instead of overwriting. - if (G1CardSet::card_set_type(_value) != G1CardSet::CardSetInlinePtr) { + if (G1CardSet::container_type(_value) != G1CardSet::ContainerInlinePtr) { return Overflow; } } @@ -268,23 +268,23 @@ inline G1CardSetHowl::G1CardSetHowl(EntryCountType card_in_region, G1CardSetConf inline bool G1CardSetHowl::contains(uint card_idx, G1CardSetConfiguration* config) { EntryCountType bucket = config->howl_bucket_index(card_idx); - CardSetPtr* array_entry = get_card_set_addr(bucket); - CardSetPtr card_set = Atomic::load_acquire(array_entry); + ContainerPtr* array_entry = get_container_addr(bucket); + ContainerPtr container = Atomic::load_acquire(array_entry); - switch (G1CardSet::card_set_type(card_set)) { - case G1CardSet::CardSetArrayOfCards : { - return G1CardSet::card_set_ptr(card_set)->contains(card_idx); + switch (G1CardSet::container_type(container)) { + case G1CardSet::ContainerArrayOfCards: { + return G1CardSet::container_ptr(container)->contains(card_idx); } - case G1CardSet::CardSetBitMap: { + case G1CardSet::ContainerBitMap: { uint card_offset = config->howl_bitmap_offset(card_idx); - return G1CardSet::card_set_ptr(card_set)->contains(card_offset, config->max_cards_in_howl_bitmap()); + return G1CardSet::container_ptr(container)->contains(card_offset, config->max_cards_in_howl_bitmap()); } - case G1CardSet::CardSetInlinePtr: { - G1CardSetInlinePtr ptr(card_set); + case G1CardSet::ContainerInlinePtr: { + G1CardSetInlinePtr ptr(container); return ptr.contains(card_idx, config->inline_ptr_bits_per_card()); } - case G1CardSet::CardSetHowl: {// Fullcard set entry - assert(card_set == G1CardSet::FullCardSet, "Must be"); + case G1CardSet::ContainerHowl: {// Fullcard set entry + assert(container == G1CardSet::FullCardSet, "Must be"); return true; } } @@ -298,38 +298,38 @@ inline void G1CardSetHowl::iterate(CardOrRangeVisitor& found, G1CardSetConfigura } } -template -inline void G1CardSetHowl::iterate(CardSetPtrVisitor& found, uint num_card_sets) { +template +inline void G1CardSetHowl::iterate(ContainerPtrVisitor& found, uint num_card_sets) { for (uint i = 0; i < num_card_sets; ++i) { found(&_buckets[i]); } } template -inline void G1CardSetHowl::iterate_cardset(CardSetPtr const card_set, uint index, CardOrRangeVisitor& found, G1CardSetConfiguration* config) { - switch (G1CardSet::card_set_type(card_set)) { - case G1CardSet::CardSetInlinePtr: { +inline void G1CardSetHowl::iterate_cardset(ContainerPtr const container, uint index, CardOrRangeVisitor& found, G1CardSetConfiguration* config) { + switch (G1CardSet::container_type(container)) { + case G1CardSet::ContainerInlinePtr: { if (found.start_iterate(G1GCPhaseTimes::MergeRSHowlInline)) { - G1CardSetInlinePtr ptr(card_set); + G1CardSetInlinePtr ptr(container); ptr.iterate(found, config->inline_ptr_bits_per_card()); } return; } - case G1CardSet::CardSetArrayOfCards : { + case G1CardSet::ContainerArrayOfCards: { if (found.start_iterate(G1GCPhaseTimes::MergeRSHowlArrayOfCards)) { - G1CardSet::card_set_ptr(card_set)->iterate(found); + G1CardSet::container_ptr(container)->iterate(found); } return; } - case G1CardSet::CardSetBitMap: { + case G1CardSet::ContainerBitMap: { if (found.start_iterate(G1GCPhaseTimes::MergeRSHowlBitmap)) { uint offset = index << config->log2_max_cards_in_howl_bitmap(); - G1CardSet::card_set_ptr(card_set)->iterate(found, config->max_cards_in_howl_bitmap(), offset); + G1CardSet::container_ptr(container)->iterate(found, config->max_cards_in_howl_bitmap(), offset); } return; } - case G1CardSet::CardSetHowl: { // actually FullCardSet - assert(card_set == G1CardSet::FullCardSet, "Must be"); + case G1CardSet::ContainerHowl: { // actually FullCardSet + assert(container == G1CardSet::FullCardSet, "Must be"); if (found.start_iterate(G1GCPhaseTimes::MergeRSHowlFull)) { uint offset = index << config->log2_max_cards_in_howl_bitmap(); found(offset, config->max_cards_in_howl_bitmap()); diff --git a/src/hotspot/share/gc/g1/heapRegionRemSet.inline.hpp b/src/hotspot/share/gc/g1/heapRegionRemSet.inline.hpp index 4bb8e6c4ff9..a0e920175e1 100644 --- a/src/hotspot/share/gc/g1/heapRegionRemSet.inline.hpp +++ b/src/hotspot/share/gc/g1/heapRegionRemSet.inline.hpp @@ -78,7 +78,7 @@ public: }; template class CardOrRanges> -class G1HeapRegionRemSetMergeCardClosure : public G1CardSet::CardSetPtrClosure { +class G1HeapRegionRemSetMergeCardClosure : public G1CardSet::ContainerPtrClosure { G1CardSet* _card_set; Closure& _cl; uint _log_card_regions_per_region; @@ -98,11 +98,11 @@ public: _log_card_region_size(log_card_region_size) { } - void do_cardsetptr(uint card_region_idx, size_t num_occupied, G1CardSet::CardSetPtr card_set) override { + void do_containerptr(uint card_region_idx, size_t num_occupied, G1CardSet::ContainerPtr container) override { CardOrRanges cl(_cl, card_region_idx >> _log_card_regions_per_region, (card_region_idx & _card_regions_per_region_mask) << _log_card_region_size); - _card_set->iterate_cards_or_ranges_in_container(card_set, cl); + _card_set->iterate_cards_or_ranges_in_container(container, cl); } }; diff --git a/test/hotspot/gtest/gc/g1/test_g1CardSet.cpp b/test/hotspot/gtest/gc/g1/test_g1CardSet.cpp index 914c64aacc5..004fd71cb2f 100644 --- a/test/hotspot/gtest/gc/g1/test_g1CardSet.cpp +++ b/test/hotspot/gtest/gc/g1/test_g1CardSet.cpp @@ -165,13 +165,13 @@ void G1CardSetTest::translate_cards(uint cards_per_region, uint region_idx, uint } } -class G1CountCardsOccupied : public G1CardSet::CardSetPtrClosure { +class G1CountCardsOccupied : public G1CardSet::ContainerPtrClosure { size_t _num_occupied; public: G1CountCardsOccupied() : _num_occupied(0) { } - void do_cardsetptr(uint region_idx, size_t num_occupied, G1CardSet::CardSetPtr card_set) override { + void do_containerptr(uint region_idx, size_t num_occupied, G1CardSet::ContainerPtr container) override { _num_occupied += num_occupied; } diff --git a/test/hotspot/gtest/gc/g1/test_g1CardSetContainers.cpp b/test/hotspot/gtest/gc/g1/test_g1CardSetContainers.cpp index 9283fc3303f..0ad3aed18cc 100644 --- a/test/hotspot/gtest/gc/g1/test_g1CardSetContainers.cpp +++ b/test/hotspot/gtest/gc/g1/test_g1CardSetContainers.cpp @@ -83,7 +83,7 @@ void G1CardSetContainersTest::cardset_inlineptr_test(uint bits_per_card) { G1AddCardResult res; - G1CardSet::CardSetPtr value = G1CardSetInlinePtr(); + G1CardSet::ContainerPtr value = G1CardSetInlinePtr(); for (uint i = 0; i < CardsPerSet; i++) { { -- GitLab From 096bca4a9c5e8ac2668dd965df92153ea1d80add Mon Sep 17 00:00:00 2001 From: Prasanta Sadhukhan Date: Thu, 17 Mar 2022 09:10:08 +0000 Subject: [PATCH 264/340] 8282473: Refactor swing classes javadoc to use @throws instead of @exception Reviewed-by: aivanov, dmarkov, prr --- .../classes/javax/swing/AbstractButton.java | 18 ++--- .../javax/swing/AbstractListModel.java | 2 +- .../classes/javax/swing/BorderFactory.java | 2 +- .../share/classes/javax/swing/BoxLayout.java | 16 ++--- .../javax/swing/DefaultBoundedRangeModel.java | 2 +- .../javax/swing/DefaultButtonModel.java | 2 +- .../classes/javax/swing/DefaultListModel.java | 2 +- .../swing/DefaultListSelectionModel.java | 4 +- .../swing/DefaultSingleSelectionModel.java | 2 +- .../share/classes/javax/swing/JApplet.java | 12 ++-- .../classes/javax/swing/JColorChooser.java | 12 ++-- .../share/classes/javax/swing/JComboBox.java | 6 +- .../share/classes/javax/swing/JComponent.java | 8 +-- .../classes/javax/swing/JEditorPane.java | 12 ++-- .../classes/javax/swing/JFileChooser.java | 14 ++-- .../share/classes/javax/swing/JFrame.java | 20 +++--- .../classes/javax/swing/JInternalFrame.java | 18 ++--- .../share/classes/javax/swing/JLabel.java | 8 +-- .../share/classes/javax/swing/JLayer.java | 2 +- .../share/classes/javax/swing/JList.java | 10 +-- .../share/classes/javax/swing/JMenu.java | 26 ++++---- .../classes/javax/swing/JOptionPane.java | 40 +++++------ .../classes/javax/swing/JPasswordField.java | 2 +- .../share/classes/javax/swing/JPopupMenu.java | 6 +- .../classes/javax/swing/JProgressBar.java | 2 +- .../share/classes/javax/swing/JRootPane.java | 6 +- .../share/classes/javax/swing/JScrollBar.java | 4 +- .../classes/javax/swing/JScrollPane.java | 8 +-- .../share/classes/javax/swing/JSeparator.java | 4 +- .../share/classes/javax/swing/JSlider.java | 2 +- .../share/classes/javax/swing/JSpinner.java | 14 ++-- .../share/classes/javax/swing/JSplitPane.java | 16 ++--- .../classes/javax/swing/JTabbedPane.java | 66 +++++++++---------- .../share/classes/javax/swing/JTable.java | 26 ++++---- .../share/classes/javax/swing/JTextArea.java | 22 +++---- .../share/classes/javax/swing/JTextField.java | 6 +- .../share/classes/javax/swing/JTextPane.java | 4 +- .../share/classes/javax/swing/JToolBar.java | 4 +- .../share/classes/javax/swing/JTree.java | 6 +- .../share/classes/javax/swing/JViewport.java | 2 +- .../share/classes/javax/swing/JWindow.java | 10 +-- .../classes/javax/swing/OverlayLayout.java | 2 +- .../share/classes/javax/swing/Popup.java | 2 +- .../classes/javax/swing/PopupFactory.java | 4 +- .../classes/javax/swing/ProgressMonitor.java | 2 +- .../javax/swing/RootPaneContainer.java | 4 +- .../classes/javax/swing/ScrollPaneLayout.java | 6 +- .../classes/javax/swing/SizeSequence.java | 4 +- .../classes/javax/swing/SwingUtilities.java | 8 +-- .../share/classes/javax/swing/Timer.java | 2 +- .../classes/javax/swing/TransferHandler.java | 4 +- .../AbstractColorChooserPanel.java | 2 +- .../javax/swing/event/EventListenerList.java | 2 +- .../classes/javax/swing/plaf/TextUI.java | 10 +-- .../javax/swing/plaf/basic/BasicHTML.java | 4 +- .../swing/plaf/basic/BasicTabbedPaneUI.java | 2 +- .../swing/plaf/basic/BasicTextFieldUI.java | 6 +- .../javax/swing/plaf/basic/BasicTextUI.java | 12 ++-- .../swing/plaf/basic/BasicTransferable.java | 4 +- .../javax/swing/table/AbstractTableModel.java | 2 +- .../swing/table/DefaultTableColumnModel.java | 10 +-- .../javax/swing/table/DefaultTableModel.java | 12 ++-- .../javax/swing/table/JTableHeader.java | 2 +- .../javax/swing/table/TableColumnModel.java | 4 +- .../javax/swing/text/AbstractDocument.java | 34 +++++----- .../javax/swing/text/AbstractWriter.java | 14 ++-- .../javax/swing/text/AsyncBoxView.java | 14 ++-- .../classes/javax/swing/text/BoxView.java | 14 ++-- .../javax/swing/text/ComponentView.java | 8 +-- .../javax/swing/text/CompositeView.java | 18 ++--- .../javax/swing/text/DefaultCaret.java | 2 +- .../javax/swing/text/DefaultEditorKit.java | 16 ++--- .../javax/swing/text/DefaultHighlighter.java | 4 +- .../swing/text/DefaultStyledDocument.java | 10 +-- .../classes/javax/swing/text/Document.java | 10 +-- .../javax/swing/text/DocumentFilter.java | 12 ++-- .../classes/javax/swing/text/EditorKit.java | 16 ++--- .../classes/javax/swing/text/FieldView.java | 2 +- .../classes/javax/swing/text/GapContent.java | 10 +-- .../javax/swing/text/GlyphPainter2.java | 4 +- .../classes/javax/swing/text/GlyphView.java | 12 ++-- .../classes/javax/swing/text/Highlighter.java | 4 +- .../classes/javax/swing/text/IconView.java | 4 +- .../javax/swing/text/JTextComponent.java | 24 +++---- .../javax/swing/text/NavigationFilter.java | 4 +- .../javax/swing/text/ParagraphView.java | 2 +- .../javax/swing/text/PasswordView.java | 6 +- .../javax/swing/text/PlainDocument.java | 2 +- .../classes/javax/swing/text/PlainView.java | 12 ++-- .../javax/swing/text/StringContent.java | 10 +-- .../javax/swing/text/StyleContext.java | 14 ++-- .../javax/swing/text/StyledEditorKit.java | 4 +- .../classes/javax/swing/text/TableView.java | 2 +- .../classes/javax/swing/text/Utilities.java | 24 +++---- .../share/classes/javax/swing/text/View.java | 14 ++-- .../javax/swing/text/WrappedPlainView.java | 10 +-- .../classes/javax/swing/text/ZoneView.java | 4 +- .../javax/swing/text/html/AccessibleHTML.java | 2 +- .../javax/swing/text/html/BlockView.java | 8 +-- .../javax/swing/text/html/FormView.java | 2 +- .../javax/swing/text/html/HRuleView.java | 2 +- .../javax/swing/text/html/HTMLDocument.java | 2 +- .../javax/swing/text/html/HTMLEditorKit.java | 12 ++-- .../javax/swing/text/html/HTMLWriter.java | 36 +++++----- .../javax/swing/text/html/ImageView.java | 2 +- .../swing/text/html/MinimalHTMLWriter.java | 42 ++++++------ .../swing/text/html/OptionListModel.java | 2 +- .../javax/swing/text/html/StyleSheet.java | 2 +- .../javax/swing/text/html/TableView.java | 2 +- .../javax/swing/text/rtf/RTFEditorKit.java | 16 ++--- .../swing/tree/DefaultMutableTreeNode.java | 28 ++++---- .../javax/swing/tree/DefaultTreeModel.java | 2 +- .../swing/tree/DefaultTreeSelectionModel.java | 4 +- .../swing/undo/AbstractUndoableEdit.java | 4 +- 114 files changed, 533 insertions(+), 533 deletions(-) diff --git a/src/java.desktop/share/classes/javax/swing/AbstractButton.java b/src/java.desktop/share/classes/javax/swing/AbstractButton.java index 8a2936cd499..4f79ac8e2b3 100644 --- a/src/java.desktop/share/classes/javax/swing/AbstractButton.java +++ b/src/java.desktop/share/classes/javax/swing/AbstractButton.java @@ -876,7 +876,7 @@ public abstract class AbstractButton extends JComponent implements ItemSelectabl *
    • {@code SwingConstants.LEADING} *
    • {@code SwingConstants.TRAILING} (the default) *
    - * @exception IllegalArgumentException if textPosition + * @throws IllegalArgumentException if textPosition * is not one of the legal values listed above */ @BeanProperty(visualUpdate = true, enumerationValues = { @@ -953,7 +953,7 @@ public abstract class AbstractButton extends JComponent implements ItemSelectabl * {@code IllegalArgumentException} that is thrown for an invalid * value * @return the {@code key} argument - * @exception IllegalArgumentException if key is not one of the legal + * @throws IllegalArgumentException if key is not one of the legal * values listed above * @see #setHorizontalTextPosition * @see #setHorizontalAlignment @@ -984,7 +984,7 @@ public abstract class AbstractButton extends JComponent implements ItemSelectabl * {@code IllegalArgumentException} that is thrown for an invalid * value * @return the {@code key} argument - * @exception IllegalArgumentException if key is not one of the legal + * @throws IllegalArgumentException if key is not one of the legal * values listed above */ protected int checkVerticalKey(int key, String exception) { @@ -1571,7 +1571,7 @@ public abstract class AbstractButton extends JComponent implements ItemSelectabl * * @since 1.4 * @param index Index into the String to underline - * @exception IllegalArgumentException will be thrown if index + * @throws IllegalArgumentException will be thrown if index * is >= length of the text, or < -1 * @see #getDisplayedMnemonicIndex */ @@ -1654,7 +1654,7 @@ public abstract class AbstractButton extends JComponent implements ItemSelectabl * @see #getMultiClickThreshhold * @param threshhold the amount of time required between mouse * press events to generate corresponding action events - * @exception IllegalArgumentException if threshhold < 0 + * @throws IllegalArgumentException if threshhold < 0 * @since 1.4 */ public void setMultiClickThreshhold(long threshhold) { @@ -1791,10 +1791,10 @@ public abstract class AbstractButton extends JComponent implements ItemSelectabl * @param index the position in the container's list at which to * insert the component, where -1 * means append to the end - * @exception IllegalArgumentException if index is invalid - * @exception IllegalArgumentException if adding the container's parent + * @throws IllegalArgumentException if index is invalid + * @throws IllegalArgumentException if adding the container's parent * to itself - * @exception IllegalArgumentException if adding a window to a container + * @throws IllegalArgumentException if adding a window to a container * @since 1.5 */ protected void addImpl(Component comp, Object constraints, int index) { @@ -3064,7 +3064,7 @@ public abstract class AbstractButton extends JComponent implements ItemSelectabl * * @param i zero-based index of the key bindings * @return a javax.lang.Object which specifies the key binding - * @exception IllegalArgumentException if the index is + * @throws IllegalArgumentException if the index is * out of bounds * @see #getAccessibleKeyBindingCount */ diff --git a/src/java.desktop/share/classes/javax/swing/AbstractListModel.java b/src/java.desktop/share/classes/javax/swing/AbstractListModel.java index 0396c956597..815fbea8407 100644 --- a/src/java.desktop/share/classes/javax/swing/AbstractListModel.java +++ b/src/java.desktop/share/classes/javax/swing/AbstractListModel.java @@ -218,7 +218,7 @@ public abstract class AbstractListModel implements ListModel, Serializable * on this model, * or an empty array if no such * listeners have been added - * @exception ClassCastException if listenerType doesn't + * @throws ClassCastException if listenerType doesn't * specify a class or interface that implements * java.util.EventListener * diff --git a/src/java.desktop/share/classes/javax/swing/BorderFactory.java b/src/java.desktop/share/classes/javax/swing/BorderFactory.java index 3fcb5620e69..2e4b18848a2 100644 --- a/src/java.desktop/share/classes/javax/swing/BorderFactory.java +++ b/src/java.desktop/share/classes/javax/swing/BorderFactory.java @@ -332,7 +332,7 @@ public class BorderFactory * @param type one of EtchedBorder.RAISED, or * EtchedBorder.LOWERED * @return the Border object - * @exception IllegalArgumentException if type is not either + * @throws IllegalArgumentException if type is not either * EtchedBorder.RAISED or * EtchedBorder.LOWERED * @since 1.3 diff --git a/src/java.desktop/share/classes/javax/swing/BoxLayout.java b/src/java.desktop/share/classes/javax/swing/BoxLayout.java index bc84a4fa582..d20a05ce4ef 100644 --- a/src/java.desktop/share/classes/javax/swing/BoxLayout.java +++ b/src/java.desktop/share/classes/javax/swing/BoxLayout.java @@ -169,7 +169,7 @@ public class BoxLayout implements LayoutManager2, Serializable { * {@code BoxLayout.X_AXIS, BoxLayout.Y_AXIS, * BoxLayout.LINE_AXIS} or {@code BoxLayout.PAGE_AXIS} * - * @exception AWTError if the value of {@code axis} is invalid + * @throws AWTError if the value of {@code axis} is invalid */ @ConstructorProperties({"target", "axis"}) public BoxLayout(Container target, int axis) { @@ -234,7 +234,7 @@ public class BoxLayout implements LayoutManager2, Serializable { * * @param target the affected container * - * @exception AWTError if the target isn't the container specified to the + * @throws AWTError if the target isn't the container specified to the * BoxLayout constructor */ public synchronized void invalidateLayout(Container target) { @@ -280,7 +280,7 @@ public class BoxLayout implements LayoutManager2, Serializable { * * @param target the container that needs to be laid out * @return the dimensions >= 0 && <= Integer.MAX_VALUE - * @exception AWTError if the target isn't the container specified to the + * @throws AWTError if the target isn't the container specified to the * BoxLayout constructor * @see Container * @see #minimumLayoutSize @@ -306,7 +306,7 @@ public class BoxLayout implements LayoutManager2, Serializable { * * @param target the container that needs to be laid out * @return the dimensions >= 0 && <= Integer.MAX_VALUE - * @exception AWTError if the target isn't the container specified to the + * @throws AWTError if the target isn't the container specified to the * BoxLayout constructor * @see #preferredLayoutSize * @see #maximumLayoutSize @@ -331,7 +331,7 @@ public class BoxLayout implements LayoutManager2, Serializable { * * @param target the container that needs to be laid out * @return the dimensions >= 0 && <= Integer.MAX_VALUE - * @exception AWTError if the target isn't the container specified to the + * @throws AWTError if the target isn't the container specified to the * BoxLayout constructor * @see #preferredLayoutSize * @see #minimumLayoutSize @@ -358,7 +358,7 @@ public class BoxLayout implements LayoutManager2, Serializable { * * @param target the container * @return the alignment >= 0.0f && <= 1.0f - * @exception AWTError if the target isn't the container specified to the + * @throws AWTError if the target isn't the container specified to the * BoxLayout constructor */ public synchronized float getLayoutAlignmentX(Container target) { @@ -375,7 +375,7 @@ public class BoxLayout implements LayoutManager2, Serializable { * * @param target the container * @return the alignment >= 0.0f && <= 1.0f - * @exception AWTError if the target isn't the container specified to the + * @throws AWTError if the target isn't the container specified to the * BoxLayout constructor */ public synchronized float getLayoutAlignmentY(Container target) { @@ -390,7 +390,7 @@ public class BoxLayout implements LayoutManager2, Serializable { * * @param target the container to lay out * - * @exception AWTError if the target isn't the container specified to the + * @throws AWTError if the target isn't the container specified to the * BoxLayout constructor */ public void layoutContainer(Container target) { diff --git a/src/java.desktop/share/classes/javax/swing/DefaultBoundedRangeModel.java b/src/java.desktop/share/classes/javax/swing/DefaultBoundedRangeModel.java index 7e254d5c8b3..e9bd3d96a6a 100644 --- a/src/java.desktop/share/classes/javax/swing/DefaultBoundedRangeModel.java +++ b/src/java.desktop/share/classes/javax/swing/DefaultBoundedRangeModel.java @@ -417,7 +417,7 @@ public class DefaultBoundedRangeModel implements BoundedRangeModel, Serializable * on this model, * or an empty array if no such * listeners have been added - * @exception ClassCastException if listenerType doesn't + * @throws ClassCastException if listenerType doesn't * specify a class or interface that implements * java.util.EventListener * diff --git a/src/java.desktop/share/classes/javax/swing/DefaultButtonModel.java b/src/java.desktop/share/classes/javax/swing/DefaultButtonModel.java index 453b1d0ab0e..d391011167a 100644 --- a/src/java.desktop/share/classes/javax/swing/DefaultButtonModel.java +++ b/src/java.desktop/share/classes/javax/swing/DefaultButtonModel.java @@ -488,7 +488,7 @@ public class DefaultButtonModel implements ButtonModel, Serializable { * on this model, * or an empty array if no such * listeners have been added - * @exception ClassCastException if listenerType doesn't + * @throws ClassCastException if listenerType doesn't * specify a class or interface that implements * java.util.EventListener * diff --git a/src/java.desktop/share/classes/javax/swing/DefaultListModel.java b/src/java.desktop/share/classes/javax/swing/DefaultListModel.java index 88210b77c9c..9d519927b67 100644 --- a/src/java.desktop/share/classes/javax/swing/DefaultListModel.java +++ b/src/java.desktop/share/classes/javax/swing/DefaultListModel.java @@ -345,7 +345,7 @@ public class DefaultListModel extends AbstractListModel * * @param element the component to insert * @param index where to insert the new component - * @exception ArrayIndexOutOfBoundsException if the index was invalid + * @throws ArrayIndexOutOfBoundsException if the index was invalid * @see #add(int,Object) * @see Vector#insertElementAt(Object,int) */ diff --git a/src/java.desktop/share/classes/javax/swing/DefaultListSelectionModel.java b/src/java.desktop/share/classes/javax/swing/DefaultListSelectionModel.java index 55b8fbba66c..aa69c2d1ab0 100644 --- a/src/java.desktop/share/classes/javax/swing/DefaultListSelectionModel.java +++ b/src/java.desktop/share/classes/javax/swing/DefaultListSelectionModel.java @@ -284,7 +284,7 @@ public class DefaultListSelectionModel implements ListSelectionModel, Cloneable, * on this model, * or an empty array if no such * listeners have been added - * @exception ClassCastException if listenerType doesn't + * @throws ClassCastException if listenerType doesn't * specify a class or interface that implements * java.util.EventListener * @@ -750,7 +750,7 @@ public class DefaultListSelectionModel implements ListSelectionModel, Cloneable, * Returns a clone of this selection model with the same selection. * listenerLists are not duplicated. * - * @exception CloneNotSupportedException if the selection model does not + * @throws CloneNotSupportedException if the selection model does not * both (a) implement the Cloneable interface and (b) define a * clone method. */ diff --git a/src/java.desktop/share/classes/javax/swing/DefaultSingleSelectionModel.java b/src/java.desktop/share/classes/javax/swing/DefaultSingleSelectionModel.java index c5c2539d41f..122e635fba1 100644 --- a/src/java.desktop/share/classes/javax/swing/DefaultSingleSelectionModel.java +++ b/src/java.desktop/share/classes/javax/swing/DefaultSingleSelectionModel.java @@ -178,7 +178,7 @@ Serializable { * on this model, * or an empty array if no such * listeners have been added - * @exception ClassCastException if listenerType doesn't + * @throws ClassCastException if listenerType doesn't * specify a class or interface that implements * java.util.EventListener * diff --git a/src/java.desktop/share/classes/javax/swing/JApplet.java b/src/java.desktop/share/classes/javax/swing/JApplet.java index a1d51bf0069..e5ad62322e6 100644 --- a/src/java.desktop/share/classes/javax/swing/JApplet.java +++ b/src/java.desktop/share/classes/javax/swing/JApplet.java @@ -135,7 +135,7 @@ public class JApplet extends Applet implements Accessible, * This constructor sets the component's locale property to the value * returned by JComponent.getDefaultLocale. * - * @exception HeadlessException if GraphicsEnvironment.isHeadless() + * @throws HeadlessException if GraphicsEnvironment.isHeadless() * returns true. * @see java.awt.GraphicsEnvironment#isHeadless * @see JComponent#getDefaultLocale @@ -312,10 +312,10 @@ public class JApplet extends Applet implements Accessible, * @param comp the component to be enhanced * @param constraints the constraints to be respected * @param index the index - * @exception IllegalArgumentException if index is invalid - * @exception IllegalArgumentException if adding the container's parent + * @throws IllegalArgumentException if index is invalid + * @throws IllegalArgumentException if adding the container's parent * to itself - * @exception IllegalArgumentException if adding a window to a container + * @throws IllegalArgumentException if adding a window to a container * * @see #setRootPaneCheckingEnabled * @see javax.swing.RootPaneContainer @@ -423,7 +423,7 @@ public class JApplet extends Applet implements Accessible, * Sets the contentPane property. This method is called by the constructor. * @param contentPane the contentPane object for this applet * - * @exception java.awt.IllegalComponentStateException (a runtime + * @throws java.awt.IllegalComponentStateException (a runtime * exception) if the content pane parameter is null * @see #getContentPane * @see RootPaneContainer#setContentPane @@ -437,7 +437,7 @@ public class JApplet extends Applet implements Accessible, /** * Returns the layeredPane object for this applet. * - * @exception java.awt.IllegalComponentStateException (a runtime + * @throws java.awt.IllegalComponentStateException (a runtime * exception) if the layered pane parameter is null * @see #setLayeredPane * @see RootPaneContainer#getLayeredPane diff --git a/src/java.desktop/share/classes/javax/swing/JColorChooser.java b/src/java.desktop/share/classes/javax/swing/JColorChooser.java index 29bf7009b4f..945c6f60697 100644 --- a/src/java.desktop/share/classes/javax/swing/JColorChooser.java +++ b/src/java.desktop/share/classes/javax/swing/JColorChooser.java @@ -150,7 +150,7 @@ public class JColorChooser extends JComponent implements Accessible { * @param title the String containing the dialog's title * @param initialColor the initial Color set when the color-chooser is shown * @return the selected color or null if the user opted out - * @exception HeadlessException if GraphicsEnvironment.isHeadless() + * @throws HeadlessException if GraphicsEnvironment.isHeadless() * returns true. * @see java.awt.GraphicsEnvironment#isHeadless */ @@ -173,7 +173,7 @@ public class JColorChooser extends JComponent implements Accessible { * @param colorTransparencySelectionEnabled true if the transparency of * a color can be selected * @return the selected color or null if the user opted out - * @exception HeadlessException if GraphicsEnvironment.isHeadless() + * @throws HeadlessException if GraphicsEnvironment.isHeadless() * returns true. * @see java.awt.GraphicsEnvironment#isHeadless */ @@ -217,7 +217,7 @@ public class JColorChooser extends JComponent implements Accessible { * @param okListener the ActionListener invoked when "OK" is pressed * @param cancelListener the ActionListener invoked when "Cancel" is pressed * @return a new dialog containing the color-chooser pane - * @exception HeadlessException if GraphicsEnvironment.isHeadless() + * @throws HeadlessException if GraphicsEnvironment.isHeadless() * returns true. * @see java.awt.GraphicsEnvironment#isHeadless */ @@ -343,7 +343,7 @@ public class JColorChooser extends JComponent implements Accessible { * @param r an int specifying the amount of Red * @param g an int specifying the amount of Green * @param b an int specifying the amount of Blue - * @exception IllegalArgumentException if r,g,b values are out of range + * @throws IllegalArgumentException if r,g,b values are out of range * @see java.awt.Color */ public void setColor(int r, int g, int b) { @@ -386,7 +386,7 @@ public class JColorChooser extends JComponent implements Accessible { * TransferHandler. * * @param b the value to set the dragEnabled property to - * @exception HeadlessException if + * @throws HeadlessException if * b is true and * GraphicsEnvironment.isHeadless() * returns true @@ -464,7 +464,7 @@ public class JColorChooser extends JComponent implements Accessible { * * @param panel a string that specifies the panel to be removed * @return the color panel - * @exception IllegalArgumentException if panel is not in list of + * @throws IllegalArgumentException if panel is not in list of * known chooser panels */ public AbstractColorChooserPanel removeChooserPanel( AbstractColorChooserPanel panel ) { diff --git a/src/java.desktop/share/classes/javax/swing/JComboBox.java b/src/java.desktop/share/classes/javax/swing/JComboBox.java index fdbbdc68657..f035c186896 100644 --- a/src/java.desktop/share/classes/javax/swing/JComboBox.java +++ b/src/java.desktop/share/classes/javax/swing/JComboBox.java @@ -638,7 +638,7 @@ implements ItemSelectable,ListDataListener,ActionListener, Accessible { * * @param anIndex an integer specifying the list item to select, * where 0 specifies the first item in the list and -1 indicates no selection - * @exception IllegalArgumentException if anIndex < -1 or + * @throws IllegalArgumentException if anIndex < -1 or * anIndex is greater than or equal to size */ @BeanProperty(bound = false, preferred = true, description @@ -815,7 +815,7 @@ implements ItemSelectable,ListDataListener,ActionListener, Accessible { /** * Checks that the dataModel is an instance of * MutableComboBoxModel. If not, it throws an exception. - * @exception RuntimeException if dataModel is not an + * @throws RuntimeException if dataModel is not an * instance of MutableComboBoxModel. */ void checkMutableComboBoxModel() { @@ -2298,7 +2298,7 @@ implements ItemSelectable,ListDataListener,ActionListener, Accessible { * @return this component's locale. If this component does not have * a locale, the locale of its parent is returned. * - * @exception IllegalComponentStateException + * @throws IllegalComponentStateException * If the Component does not have its own locale and has not yet been * added to a containment hierarchy such that the locale can be * determined from the containing parent. diff --git a/src/java.desktop/share/classes/javax/swing/JComponent.java b/src/java.desktop/share/classes/javax/swing/JComponent.java index c572a12ebb4..87b8c3175bd 100644 --- a/src/java.desktop/share/classes/javax/swing/JComponent.java +++ b/src/java.desktop/share/classes/javax/swing/JComponent.java @@ -2455,7 +2455,7 @@ public abstract class JComponent extends Container implements Serializable, * * @param condition one of the values listed above * @param map the InputMap to use for the given condition - * @exception IllegalArgumentException if condition is + * @throws IllegalArgumentException if condition is * WHEN_IN_FOCUSED_WINDOW and map * is not an instance of ComponentInputMap; or * if condition is not one of the legal values @@ -2554,7 +2554,7 @@ public abstract class JComponent extends Container implements Serializable, * @return the InputMap for the given condition; * if create is false and the InputMap * hasn't been created, returns null - * @exception IllegalArgumentException if condition + * @throws IllegalArgumentException if condition * is not one of the legal values listed above */ final InputMap getInputMap(int condition, boolean create) { @@ -4623,7 +4623,7 @@ public abstract class JComponent extends Container implements Serializable, * @param propertyName the name of the property that was listened on * @param oldValue the old value of the property * @param newValue the new value of the property - * @exception java.beans.PropertyVetoException when the attempt to set the + * @throws java.beans.PropertyVetoException when the attempt to set the * property is vetoed by the component */ protected void fireVetoableChange(String propertyName, Object oldValue, Object newValue) @@ -4799,7 +4799,7 @@ public abstract class JComponent extends Container implements Serializable, * FooListeners on this component, * or an empty array if no such * listeners have been added - * @exception ClassCastException if listenerType + * @throws ClassCastException if listenerType * doesn't specify a class or interface that implements * java.util.EventListener * diff --git a/src/java.desktop/share/classes/javax/swing/JEditorPane.java b/src/java.desktop/share/classes/javax/swing/JEditorPane.java index 6b9189d550d..f347621a687 100644 --- a/src/java.desktop/share/classes/javax/swing/JEditorPane.java +++ b/src/java.desktop/share/classes/javax/swing/JEditorPane.java @@ -312,7 +312,7 @@ public class JEditorPane extends JTextComponent { * Creates a JEditorPane based on a specified URL for input. * * @param initialPage the URL - * @exception IOException if the URL is null + * @throws IOException if the URL is null * or cannot be accessed */ public JEditorPane(URL initialPage) throws IOException { @@ -325,7 +325,7 @@ public class JEditorPane extends JTextComponent { * a URL specification. * * @param url the URL - * @exception IOException if the URL is null or + * @throws IOException if the URL is null or * cannot be accessed */ public JEditorPane(String url) throws IOException { @@ -340,7 +340,7 @@ public class JEditorPane extends JTextComponent { * * @param type mime type of the given text * @param text the text to initialize with; may be null - * @exception NullPointerException if the type parameter + * @throws NullPointerException if the type parameter * is null */ public JEditorPane(String type, String text) { @@ -462,7 +462,7 @@ public class JEditorPane extends JTextComponent { * thread is done whether the load was successful or not. * * @param page the URL of the page - * @exception IOException for a null or invalid + * @throws IOException for a null or invalid * page specification, or exception from the stream being read * @see #getPage */ @@ -578,7 +578,7 @@ public class JEditorPane extends JTextComponent { * * @param in the stream from which to read * @param desc an object describing the stream - * @exception IOException as thrown by the stream being + * @throws IOException as thrown by the stream being * used to initialize * @see JTextComponent#read * @see #setDocument @@ -925,7 +925,7 @@ public class JEditorPane extends JTextComponent { * Sets the current URL being displayed. * * @param url the URL for display - * @exception IOException for a null or invalid URL + * @throws IOException for a null or invalid URL * specification */ public void setPage(String url) throws IOException { diff --git a/src/java.desktop/share/classes/javax/swing/JFileChooser.java b/src/java.desktop/share/classes/javax/swing/JFileChooser.java index 8d286e05f3b..2e0a80f788b 100644 --- a/src/java.desktop/share/classes/javax/swing/JFileChooser.java +++ b/src/java.desktop/share/classes/javax/swing/JFileChooser.java @@ -446,7 +446,7 @@ public class JFileChooser extends JComponent implements Accessible { * TransferHandler. * * @param b the value to set the dragEnabled property to - * @exception HeadlessException if + * @throws HeadlessException if * b is true and * GraphicsEnvironment.isHeadless() * returns true @@ -658,7 +658,7 @@ public class JFileChooser extends JComponent implements Accessible { *
  • JFileChooser.ERROR_OPTION if an error occurs or the * dialog is dismissed * - * @exception HeadlessException if GraphicsEnvironment.isHeadless() + * @throws HeadlessException if GraphicsEnvironment.isHeadless() * returns true. * @see java.awt.GraphicsEnvironment#isHeadless * @see #showDialog @@ -683,7 +683,7 @@ public class JFileChooser extends JComponent implements Accessible { *
  • JFileChooser.ERROR_OPTION if an error occurs or the * dialog is dismissed * - * @exception HeadlessException if GraphicsEnvironment.isHeadless() + * @throws HeadlessException if GraphicsEnvironment.isHeadless() * returns true. * @see java.awt.GraphicsEnvironment#isHeadless * @see #showDialog @@ -743,7 +743,7 @@ public class JFileChooser extends JComponent implements Accessible { *
  • JFileChooser.ERROR_OPTION if an error occurs or the * dialog is dismissed * - * @exception HeadlessException if GraphicsEnvironment.isHeadless() + * @throws HeadlessException if GraphicsEnvironment.isHeadless() * returns true. * @see java.awt.GraphicsEnvironment#isHeadless */ @@ -800,7 +800,7 @@ public class JFileChooser extends JComponent implements Accessible { * @param parent the parent component of the dialog; * can be null * @return a new JDialog containing this instance - * @exception HeadlessException if GraphicsEnvironment.isHeadless() + * @throws HeadlessException if GraphicsEnvironment.isHeadless() * returns true. * @see java.awt.GraphicsEnvironment#isHeadless * @since 1.4 @@ -924,7 +924,7 @@ public class JFileChooser extends JComponent implements Accessible { *
  • JFileChooser.CUSTOM_DIALOG * * - * @exception IllegalArgumentException if dialogType is + * @throws IllegalArgumentException if dialogType is * not legal * * @see #getDialogType @@ -1311,7 +1311,7 @@ public class JFileChooser extends JComponent implements Accessible { *
  • JFileChooser.FILES_AND_DIRECTORIES * * - * @exception IllegalArgumentException if mode is an + * @throws IllegalArgumentException if mode is an * illegal file selection mode * * @see #getFileSelectionMode diff --git a/src/java.desktop/share/classes/javax/swing/JFrame.java b/src/java.desktop/share/classes/javax/swing/JFrame.java index 339268fd165..9b37ae77ab0 100644 --- a/src/java.desktop/share/classes/javax/swing/JFrame.java +++ b/src/java.desktop/share/classes/javax/swing/JFrame.java @@ -169,7 +169,7 @@ public class JFrame extends Frame implements WindowConstants, * This constructor sets the component's locale property to the value * returned by JComponent.getDefaultLocale. * - * @exception HeadlessException if GraphicsEnvironment.isHeadless() + * @throws HeadlessException if GraphicsEnvironment.isHeadless() * returns true. * @see java.awt.GraphicsEnvironment#isHeadless * @see Component#setSize @@ -193,7 +193,7 @@ public class JFrame extends Frame implements WindowConstants, * to construct the new Frame; * if gc is null, the system * default GraphicsConfiguration is assumed - * @exception IllegalArgumentException if gc is not from + * @throws IllegalArgumentException if gc is not from * a screen device. This exception is always thrown when * GraphicsEnvironment.isHeadless() returns true. * @see java.awt.GraphicsEnvironment#isHeadless @@ -213,7 +213,7 @@ public class JFrame extends Frame implements WindowConstants, * returned by JComponent.getDefaultLocale. * * @param title the title for the frame - * @exception HeadlessException if GraphicsEnvironment.isHeadless() + * @throws HeadlessException if GraphicsEnvironment.isHeadless() * returns true. * @see java.awt.GraphicsEnvironment#isHeadless * @see Component#setSize @@ -239,7 +239,7 @@ public class JFrame extends Frame implements WindowConstants, * to construct the new JFrame with; * if gc is null, the system * default GraphicsConfiguration is assumed - * @exception IllegalArgumentException if gc is not from + * @throws IllegalArgumentException if gc is not from * a screen device. This exception is always thrown when * GraphicsEnvironment.isHeadless() returns true. * @see java.awt.GraphicsEnvironment#isHeadless @@ -357,7 +357,7 @@ public class JFrame extends Frame implements WindowConstants, * * @param operation the operation which should be performed when the * user closes the frame - * @exception IllegalArgumentException if defaultCloseOperation value + * @throws IllegalArgumentException if defaultCloseOperation value * isn't one of the above valid values * @see #addWindowListener * @see #getDefaultCloseOperation @@ -540,10 +540,10 @@ public class JFrame extends Frame implements WindowConstants, * @param comp the component to be enhanced * @param constraints the constraints to be respected * @param index the index - * @exception IllegalArgumentException if index is invalid - * @exception IllegalArgumentException if adding the container's parent + * @throws IllegalArgumentException if index is invalid + * @throws IllegalArgumentException if adding the container's parent * to itself - * @exception IllegalArgumentException if adding a window to a container + * @throws IllegalArgumentException if adding a window to a container * * @see #setRootPaneCheckingEnabled * @see javax.swing.RootPaneContainer @@ -668,7 +668,7 @@ public class JFrame extends Frame implements WindowConstants, * * @param contentPane the contentPane object for this frame * - * @exception java.awt.IllegalComponentStateException (a runtime + * @throws java.awt.IllegalComponentStateException (a runtime * exception) if the content pane parameter is null * @see #getContentPane * @see RootPaneContainer#setContentPane @@ -696,7 +696,7 @@ public class JFrame extends Frame implements WindowConstants, * This method is called by the constructor. * @param layeredPane the layeredPane object for this frame * - * @exception java.awt.IllegalComponentStateException (a runtime + * @throws java.awt.IllegalComponentStateException (a runtime * exception) if the layered pane parameter is null * @see #getLayeredPane * @see RootPaneContainer#setLayeredPane diff --git a/src/java.desktop/share/classes/javax/swing/JInternalFrame.java b/src/java.desktop/share/classes/javax/swing/JInternalFrame.java index 62efd03c0db..9caa5f966e3 100644 --- a/src/java.desktop/share/classes/javax/swing/JInternalFrame.java +++ b/src/java.desktop/share/classes/javax/swing/JInternalFrame.java @@ -497,10 +497,10 @@ public class JInternalFrame extends JComponent implements * @param comp the component to be enhanced * @param constraints the constraints to be respected * @param index the index - * @exception IllegalArgumentException if index is invalid - * @exception IllegalArgumentException if adding the container's parent + * @throws IllegalArgumentException if index is invalid + * @throws IllegalArgumentException if adding the container's parent * to itself - * @exception IllegalArgumentException if adding a window to a container + * @throws IllegalArgumentException if adding a window to a container * * @see #setRootPaneCheckingEnabled * @see javax.swing.RootPaneContainer @@ -628,7 +628,7 @@ public class JInternalFrame extends JComponent implements * * @param c the content pane for this internal frame * - * @exception java.awt.IllegalComponentStateException (a runtime + * @throws java.awt.IllegalComponentStateException (a runtime * exception) if the content pane parameter is null * @see RootPaneContainer#getContentPane */ @@ -657,7 +657,7 @@ public class JInternalFrame extends JComponent implements * * @param layered the JLayeredPane for this internal frame * - * @exception java.awt.IllegalComponentStateException (a runtime + * @throws java.awt.IllegalComponentStateException (a runtime * exception) if the layered pane parameter is null * @see RootPaneContainer#setLayeredPane */ @@ -794,7 +794,7 @@ public class JInternalFrame extends JComponent implements * * @param b must be true * - * @exception PropertyVetoException when the attempt to set the + * @throws PropertyVetoException when the attempt to set the * property is vetoed by the JInternalFrame * * @see #isClosed() @@ -906,7 +906,7 @@ public class JInternalFrame extends JComponent implements * * @param b a boolean, where true means to iconify this internal frame and * false means to de-iconify it - * @exception PropertyVetoException when the attempt to set the + * @throws PropertyVetoException when the attempt to set the * property is vetoed by the JInternalFrame * * @see InternalFrameEvent#INTERNAL_FRAME_ICONIFIED @@ -985,7 +985,7 @@ public class JInternalFrame extends JComponent implements * * @param b a boolean, where true maximizes this internal frame and false * restores it - * @exception PropertyVetoException when the attempt to set the + * @throws PropertyVetoException when the attempt to set the * property is vetoed by the JInternalFrame */ @BeanProperty(description @@ -1047,7 +1047,7 @@ public class JInternalFrame extends JComponent implements * @param selected a boolean, where true means this internal frame * should become selected (currently active) * and false means it should become deselected - * @exception PropertyVetoException when the attempt to set the + * @throws PropertyVetoException when the attempt to set the * property is vetoed by the JInternalFrame * * @see #isShowing diff --git a/src/java.desktop/share/classes/javax/swing/JLabel.java b/src/java.desktop/share/classes/javax/swing/JLabel.java index 8dff4a8fd25..eed6a157cc1 100644 --- a/src/java.desktop/share/classes/javax/swing/JLabel.java +++ b/src/java.desktop/share/classes/javax/swing/JLabel.java @@ -551,7 +551,7 @@ public class JLabel extends JComponent implements SwingConstants, Accessible * * @since 1.4 * @param index Index into the String to underline - * @exception IllegalArgumentException will be thrown if index + * @throws IllegalArgumentException will be thrown if index * is >= length of the text, or < -1 */ @BeanProperty(visualUpdate = true, description @@ -595,7 +595,7 @@ public class JLabel extends JComponent implements SwingConstants, Accessible * @param message the IllegalArgumentException detail message * @return the key value if {@code key} is a a legal value for the * horizontalAlignment properties - * @exception IllegalArgumentException if key isn't LEFT, CENTER, RIGHT, + * @throws IllegalArgumentException if key isn't LEFT, CENTER, RIGHT, * LEADING or TRAILING. * @see #setHorizontalTextPosition * @see #setHorizontalAlignment @@ -622,7 +622,7 @@ public class JLabel extends JComponent implements SwingConstants, Accessible * @param message the IllegalArgumentException detail message * @return the key value if {@code key} is a legal value for the * verticalAlignment or verticalTextPosition properties - * @exception IllegalArgumentException if key isn't TOP, CENTER, or BOTTOM. + * @throws IllegalArgumentException if key isn't TOP, CENTER, or BOTTOM. * @see #setVerticalAlignment * @see #setVerticalTextPosition */ @@ -1637,7 +1637,7 @@ public class JLabel extends JComponent implements SwingConstants, Accessible * * @param i zero-based index of the key bindings * @return a javax.lang.Object which specifies the key binding - * @exception IllegalArgumentException if the index is + * @throws IllegalArgumentException if the index is * out of bounds * @see #getAccessibleKeyBindingCount */ diff --git a/src/java.desktop/share/classes/javax/swing/JLayer.java b/src/java.desktop/share/classes/javax/swing/JLayer.java index 0ade190ce42..c2076299e44 100644 --- a/src/java.desktop/share/classes/javax/swing/JLayer.java +++ b/src/java.desktop/share/classes/javax/swing/JLayer.java @@ -316,7 +316,7 @@ public final class JLayer * a {@code JLayer}. * * @param mgr the specified layout manager - * @exception IllegalArgumentException this method is not supported + * @throws IllegalArgumentException this method is not supported */ public void setLayout(LayoutManager mgr) { if (mgr != null) { diff --git a/src/java.desktop/share/classes/javax/swing/JList.java b/src/java.desktop/share/classes/javax/swing/JList.java index ac4a1e3fe3a..220f86aca4e 100644 --- a/src/java.desktop/share/classes/javax/swing/JList.java +++ b/src/java.desktop/share/classes/javax/swing/JList.java @@ -445,7 +445,7 @@ public class JList extends JComponent implements Scrollable, Accessible * allowing for tooltips to be provided by the cell renderers. * * @param dataModel the model for the list - * @exception IllegalArgumentException if the model is {@code null} + * @throws IllegalArgumentException if the model is {@code null} */ public JList(ListModel dataModel) { @@ -1202,7 +1202,7 @@ public class JList extends JComponent implements Scrollable, Accessible * list's {@code TransferHandler}. * * @param b whether or not to enable automatic drag handling - * @exception HeadlessException if + * @throws HeadlessException if * b is true and * GraphicsEnvironment.isHeadless() * returns true @@ -1493,7 +1493,7 @@ public class JList extends JComponent implements Scrollable, Accessible * Position.Bias.Forward or Position.Bias.Backward. * @return the index of the next list element that * starts with the prefix; otherwise {@code -1} - * @exception IllegalArgumentException if prefix is {@code null} + * @throws IllegalArgumentException if prefix is {@code null} * or startIndex is out of bounds * @since 1.4 */ @@ -1695,7 +1695,7 @@ public class JList extends JComponent implements Scrollable, Accessible * * @param model the ListModel that provides the * list of items for display - * @exception IllegalArgumentException if model is + * @throws IllegalArgumentException if model is * null * @see #getModel * @see #clearSelection @@ -1910,7 +1910,7 @@ public class JList extends JComponent implements Scrollable, Accessible * * @param selectionModel the ListSelectionModel that * implements the selections - * @exception IllegalArgumentException if selectionModel + * @throws IllegalArgumentException if selectionModel * is null * @see #getSelectionModel */ diff --git a/src/java.desktop/share/classes/javax/swing/JMenu.java b/src/java.desktop/share/classes/javax/swing/JMenu.java index dbac4812ca8..1565440969a 100644 --- a/src/java.desktop/share/classes/javax/swing/JMenu.java +++ b/src/java.desktop/share/classes/javax/swing/JMenu.java @@ -508,7 +508,7 @@ public class JMenu extends JMenuItem implements Accessible,MenuElement * to manage the idiosyncrasies of the various UI implementations. * * @param d the number of milliseconds to delay - * @exception IllegalArgumentException if d + * @throws IllegalArgumentException if d * is less than 0 */ @BeanProperty(bound = false, expert = true, description @@ -674,7 +674,7 @@ public class JMenu extends JMenuItem implements Accessible,MenuElement * @param s the text for the menu item to add * @param pos an integer specifying the position at which to add the * new menu item - * @exception IllegalArgumentException when the value of + * @throws IllegalArgumentException when the value of * pos < 0 */ public void insert(String s, int pos) { @@ -693,7 +693,7 @@ public class JMenu extends JMenuItem implements Accessible,MenuElement * @param pos an integer specifying the position at which to add the * new JMenuitem * @return the new menu item - * @exception IllegalArgumentException if the value of + * @throws IllegalArgumentException if the value of * pos < 0 */ public JMenuItem insert(JMenuItem mi, int pos) { @@ -713,7 +713,7 @@ public class JMenu extends JMenuItem implements Accessible,MenuElement * @param pos an integer specifying the position at which to add the * new menu item * @return the new menu item - * @exception IllegalArgumentException if the value of + * @throws IllegalArgumentException if the value of * pos < 0 */ public JMenuItem insert(Action a, int pos) { @@ -734,7 +734,7 @@ public class JMenu extends JMenuItem implements Accessible,MenuElement * * @param index an integer specifying the position at which to * insert the menu separator - * @exception IllegalArgumentException if the value of + * @throws IllegalArgumentException if the value of * index < 0 */ public void insertSeparator(int index) { @@ -755,7 +755,7 @@ public class JMenu extends JMenuItem implements Accessible,MenuElement * @param pos an integer specifying the position * @return the menu item at the specified position; or null * if the item as the specified position is not a menu item - * @exception IllegalArgumentException if the value of + * @throws IllegalArgumentException if the value of * {@code pos} < 0 */ public JMenuItem getItem(int pos) { @@ -790,7 +790,7 @@ public class JMenu extends JMenuItem implements Accessible,MenuElement * yet implemented. * * @return true if the menu can be torn off, else false - * @exception Error if invoked -- this method is not yet implemented + * @throws Error if invoked -- this method is not yet implemented */ @BeanProperty(bound = false) public boolean isTearOff() { @@ -812,7 +812,7 @@ public class JMenu extends JMenuItem implements Accessible,MenuElement * Removes the menu item at the specified index from this menu. * * @param pos the position of the item to be removed - * @exception IllegalArgumentException if the value of + * @throws IllegalArgumentException if the value of * pos < 0, or if pos * is greater than the number of menu items */ @@ -1024,7 +1024,7 @@ public class JMenu extends JMenuItem implements Accessible,MenuElement * notification on this event type. The event instance * is created lazily. * - * @exception Error if there is a null listener + * @throws Error if there is a null listener * @see EventListenerList */ protected void fireMenuSelected() { @@ -1054,7 +1054,7 @@ public class JMenu extends JMenuItem implements Accessible,MenuElement * notification on this event type. The event instance * is created lazily. * - * @exception Error if there is a null listener + * @throws Error if there is a null listener * @see EventListenerList */ protected void fireMenuDeselected() { @@ -1084,7 +1084,7 @@ public class JMenu extends JMenuItem implements Accessible,MenuElement * notification on this event type. The event instance * is created lazily. * - * @exception Error if there is a null listener + * @throws Error if there is a null listener * @see EventListenerList */ protected void fireMenuCanceled() { @@ -1238,7 +1238,7 @@ public class JMenu extends JMenuItem implements Accessible,MenuElement * * @param o the new component orientation of this menu and * the components contained within it. - * @exception NullPointerException if orientation is null. + * @throws NullPointerException if orientation is null. * @see java.awt.Component#setComponentOrientation * @see java.awt.Component#getComponentOrientation * @since 1.4 @@ -1275,7 +1275,7 @@ public class JMenu extends JMenuItem implements Accessible,MenuElement * @param keyStroke the keystroke combination which will invoke * the JMenuItem's actionlisteners * without navigating the menu hierarchy - * @exception Error if invoked -- this method is not defined for JMenu. + * @throws Error if invoked -- this method is not defined for JMenu. * Use setMnemonic instead */ public void setAccelerator(KeyStroke keyStroke) { diff --git a/src/java.desktop/share/classes/javax/swing/JOptionPane.java b/src/java.desktop/share/classes/javax/swing/JOptionPane.java index 99eee90347b..28a547dc2cb 100644 --- a/src/java.desktop/share/classes/javax/swing/JOptionPane.java +++ b/src/java.desktop/share/classes/javax/swing/JOptionPane.java @@ -435,7 +435,7 @@ public class JOptionPane extends JComponent implements Accessible * the screen. * * @param message the Object to display - * @exception HeadlessException if + * @throws HeadlessException if * GraphicsEnvironment.isHeadless returns * true * @return user's input @@ -471,7 +471,7 @@ public class JOptionPane extends JComponent implements Accessible * @param parentComponent the parent Component for the * dialog * @param message the Object to display - * @exception HeadlessException if + * @throws HeadlessException if * GraphicsEnvironment.isHeadless returns * true * @return user's input @@ -523,7 +523,7 @@ public class JOptionPane extends JComponent implements Accessible * QUESTION_MESSAGE, * or PLAIN_MESSAGE * @return user's input - * @exception HeadlessException if + * @throws HeadlessException if * GraphicsEnvironment.isHeadless returns * true * @see java.awt.GraphicsEnvironment#isHeadless @@ -566,7 +566,7 @@ public class JOptionPane extends JComponent implements Accessible * field * @return user's input, or null meaning the user * canceled the input - * @exception HeadlessException if + * @throws HeadlessException if * GraphicsEnvironment.isHeadless returns * true * @see java.awt.GraphicsEnvironment#isHeadless @@ -609,7 +609,7 @@ public class JOptionPane extends JComponent implements Accessible * or if the parentComponent has no * Frame, a default Frame is used * @param message the Object to display - * @exception HeadlessException if + * @throws HeadlessException if * GraphicsEnvironment.isHeadless returns * true * @see java.awt.GraphicsEnvironment#isHeadless @@ -637,7 +637,7 @@ public class JOptionPane extends JComponent implements Accessible * WARNING_MESSAGE, * QUESTION_MESSAGE, * or PLAIN_MESSAGE - * @exception HeadlessException if + * @throws HeadlessException if * GraphicsEnvironment.isHeadless returns * true * @see java.awt.GraphicsEnvironment#isHeadless @@ -666,7 +666,7 @@ public class JOptionPane extends JComponent implements Accessible * or PLAIN_MESSAGE * @param icon an icon to display in the dialog that helps the user * identify the kind of message that is being displayed - * @exception HeadlessException if + * @throws HeadlessException if * GraphicsEnvironment.isHeadless returns * true * @see java.awt.GraphicsEnvironment#isHeadless @@ -690,7 +690,7 @@ public class JOptionPane extends JComponent implements Accessible * default Frame is used * @param message the Object to display * @return an integer indicating the option selected by the user - * @exception HeadlessException if + * @throws HeadlessException if * GraphicsEnvironment.isHeadless returns * true * @see java.awt.GraphicsEnvironment#isHeadless @@ -718,7 +718,7 @@ public class JOptionPane extends JComponent implements Accessible * YES_NO_CANCEL_OPTION, * or OK_CANCEL_OPTION * @return an int indicating the option selected by the user - * @exception HeadlessException if + * @throws HeadlessException if * GraphicsEnvironment.isHeadless returns * true * @see java.awt.GraphicsEnvironment#isHeadless @@ -757,7 +757,7 @@ public class JOptionPane extends JComponent implements Accessible * QUESTION_MESSAGE, * or PLAIN_MESSAGE * @return an integer indicating the option selected by the user - * @exception HeadlessException if + * @throws HeadlessException if * GraphicsEnvironment.isHeadless returns * true * @see java.awt.GraphicsEnvironment#isHeadless @@ -795,7 +795,7 @@ public class JOptionPane extends JComponent implements Accessible * or PLAIN_MESSAGE * @param icon the icon to display in the dialog * @return an int indicating the option selected by the user - * @exception HeadlessException if + * @throws HeadlessException if * GraphicsEnvironment.isHeadless returns * true * @see java.awt.GraphicsEnvironment#isHeadless @@ -856,7 +856,7 @@ public class JOptionPane extends JComponent implements Accessible * @return an integer indicating the option chosen by the user, * or CLOSED_OPTION if the user closed * the dialog - * @exception HeadlessException if + * @throws HeadlessException if * GraphicsEnvironment.isHeadless returns * true * @see java.awt.GraphicsEnvironment#isHeadless @@ -919,7 +919,7 @@ public class JOptionPane extends JComponent implements Accessible * no Frame, a default Frame is used * @param title the title string for the dialog * @return a new JDialog containing this instance - * @exception HeadlessException if + * @throws HeadlessException if * GraphicsEnvironment.isHeadless returns * true * @see java.awt.GraphicsEnvironment#isHeadless @@ -946,7 +946,7 @@ public class JOptionPane extends JComponent implements Accessible * * @param title the title string for the dialog * @return a new JDialog containing this instance - * @exception HeadlessException if + * @throws HeadlessException if * GraphicsEnvironment.isHeadless returns * true * @see java.awt.GraphicsEnvironment#isHeadless @@ -1508,7 +1508,7 @@ public class JOptionPane extends JComponent implements Accessible * frame's title bar * @return a JInternalFrame containing a * JOptionPane - * @exception RuntimeException if parentComponent does + * @throws RuntimeException if parentComponent does * not have a valid parent */ public JInternalFrame createInternalFrame(Component parentComponent, @@ -1600,7 +1600,7 @@ public class JOptionPane extends JComponent implements Accessible * or getRootFrame * if the component is null, * or does not have a valid Frame parent - * @exception HeadlessException if + * @throws HeadlessException if * GraphicsEnvironment.isHeadless returns * true * @see #getRootFrame @@ -1626,7 +1626,7 @@ public class JOptionPane extends JComponent implements Accessible * frame if the component is null, * or does not have a valid * Frame or Dialog parent - * @exception HeadlessException if + * @throws HeadlessException if * GraphicsEnvironment.isHeadless returns * true * @see java.awt.GraphicsEnvironment#isHeadless @@ -1683,7 +1683,7 @@ public class JOptionPane extends JComponent implements Accessible * which a frame is not provided. * * @return the default Frame to use - * @exception HeadlessException if + * @throws HeadlessException if * GraphicsEnvironment.isHeadless returns * true * @see #setRootFrame @@ -2050,7 +2050,7 @@ public class JOptionPane extends JComponent implements Accessible * ERROR_MESSAGE, INFORMATION_MESSAGE, * WARNING_MESSAGE, * QUESTION_MESSAGE, or PLAIN_MESSAGE - * @exception RuntimeException if newType is not one of the + * @throws RuntimeException if newType is not one of the * legal values listed above * @see #getMessageType @@ -2096,7 +2096,7 @@ public class JOptionPane extends JComponent implements Accessible * YES_NO_OPTION, * YES_NO_CANCEL_OPTION, * or OK_CANCEL_OPTION - * @exception RuntimeException if newType is not one of + * @throws RuntimeException if newType is not one of * the legal values listed above * * @see #getOptionType diff --git a/src/java.desktop/share/classes/javax/swing/JPasswordField.java b/src/java.desktop/share/classes/javax/swing/JPasswordField.java index 577998cb336..c6450d0605a 100644 --- a/src/java.desktop/share/classes/javax/swing/JPasswordField.java +++ b/src/java.desktop/share/classes/javax/swing/JPasswordField.java @@ -288,7 +288,7 @@ public class JPasswordField extends JTextField { * @param offs the offset >= 0 * @param len the length >= 0 * @return the text - * @exception BadLocationException if the offset or length are invalid + * @throws BadLocationException if the offset or length are invalid */ @Deprecated public String getText(int offs, int len) throws BadLocationException { diff --git a/src/java.desktop/share/classes/javax/swing/JPopupMenu.java b/src/java.desktop/share/classes/javax/swing/JPopupMenu.java index ef9ad42ef81..a6811fad5eb 100644 --- a/src/java.desktop/share/classes/javax/swing/JPopupMenu.java +++ b/src/java.desktop/share/classes/javax/swing/JPopupMenu.java @@ -475,7 +475,7 @@ public class JPopupMenu extends JComponent implements Accessible,MenuElement { * Removes the component at the specified index from this popup menu. * * @param pos the position of the item to be removed - * @exception IllegalArgumentException if the value of + * @throws IllegalArgumentException if the value of * pos < 0, or if the value of * pos is greater than the * number of items @@ -573,7 +573,7 @@ public class JPopupMenu extends JComponent implements Accessible,MenuElement { * @param a the Action object to insert * @param index specifies the position at which to insert the * Action, where 0 is the first - * @exception IllegalArgumentException if index < 0 + * @throws IllegalArgumentException if index < 0 * @see Action */ public void insert(Action a, int index) { @@ -589,7 +589,7 @@ public class JPopupMenu extends JComponent implements Accessible,MenuElement { * @param component the Component to insert * @param index specifies the position at which * to insert the component, where 0 is the first - * @exception IllegalArgumentException if index < 0 + * @throws IllegalArgumentException if index < 0 */ public void insert(Component component, int index) { if (index < 0) { diff --git a/src/java.desktop/share/classes/javax/swing/JProgressBar.java b/src/java.desktop/share/classes/javax/swing/JProgressBar.java index 90945bb67e3..edba6e4a5da 100644 --- a/src/java.desktop/share/classes/javax/swing/JProgressBar.java +++ b/src/java.desktop/share/classes/javax/swing/JProgressBar.java @@ -394,7 +394,7 @@ public class JProgressBar extends JComponent implements SwingConstants, Accessib * is {@code SwingConstants.HORIZONTAL}. * * @param newOrientation HORIZONTAL or VERTICAL - * @exception IllegalArgumentException if newOrientation + * @throws IllegalArgumentException if newOrientation * is an illegal value * @see #getOrientation */ diff --git a/src/java.desktop/share/classes/javax/swing/JRootPane.java b/src/java.desktop/share/classes/javax/swing/JRootPane.java index dcc6d6bb4ef..48e06a917fc 100644 --- a/src/java.desktop/share/classes/javax/swing/JRootPane.java +++ b/src/java.desktop/share/classes/javax/swing/JRootPane.java @@ -578,7 +578,7 @@ public class JRootPane extends JComponent implements Accessible { * replace it with an opaque JComponent. * * @param content the Container to use for component-contents - * @exception java.awt.IllegalComponentStateException (a runtime + * @throws java.awt.IllegalComponentStateException (a runtime * exception) if the content pane parameter is null */ public void setContentPane(Container content) { @@ -605,7 +605,7 @@ public class JRootPane extends JComponent implements Accessible { * typically holds a content pane and an optional JMenuBar. * * @param layered the JLayeredPane to use - * @exception java.awt.IllegalComponentStateException (a runtime + * @throws java.awt.IllegalComponentStateException (a runtime * exception) if the layered pane parameter is null */ public void setLayeredPane(JLayeredPane layered) { @@ -647,7 +647,7 @@ public class JRootPane extends JComponent implements Accessible { * * @param glass the Component to use as the glass pane * for this JRootPane - * @exception NullPointerException if the glass parameter is + * @throws NullPointerException if the glass parameter is * null */ public void setGlassPane(Component glass) { diff --git a/src/java.desktop/share/classes/javax/swing/JScrollBar.java b/src/java.desktop/share/classes/javax/swing/JScrollBar.java index 6bb997a6150..ba65f21a954 100644 --- a/src/java.desktop/share/classes/javax/swing/JScrollBar.java +++ b/src/java.desktop/share/classes/javax/swing/JScrollBar.java @@ -155,7 +155,7 @@ public class JScrollBar extends JComponent implements Adjustable, Accessible * That way, when the user jumps the knob to an adjacent position, * one or two lines of the original contents remain in view. * - * @exception IllegalArgumentException if orientation is not one of VERTICAL, HORIZONTAL + * @throws IllegalArgumentException if orientation is not one of VERTICAL, HORIZONTAL * * @see #setOrientation * @see #setValue @@ -279,7 +279,7 @@ public class JScrollBar extends JComponent implements Adjustable, Accessible * HORIZONTAL. * * @param orientation an orientation of the {@code JScrollBar} - * @exception IllegalArgumentException if orientation is not one of VERTICAL, HORIZONTAL + * @throws IllegalArgumentException if orientation is not one of VERTICAL, HORIZONTAL * @see #getOrientation */ @BeanProperty(preferred = true, visualUpdate = true, enumerationValues = { diff --git a/src/java.desktop/share/classes/javax/swing/JScrollPane.java b/src/java.desktop/share/classes/javax/swing/JScrollPane.java index 2c3302178df..3d5385a34d1 100644 --- a/src/java.desktop/share/classes/javax/swing/JScrollPane.java +++ b/src/java.desktop/share/classes/javax/swing/JScrollPane.java @@ -418,7 +418,7 @@ public class JScrollPane extends JComponent implements ScrollPaneConstants, Acce * will invoke syncWithScrollPane on it. * * @param layout the specified layout manager - * @exception ClassCastException if layout is not a + * @throws ClassCastException if layout is not a * ScrollPaneLayout * @see java.awt.Container#getLayout * @see java.awt.Container#setLayout @@ -476,7 +476,7 @@ public class JScrollPane extends JComponent implements ScrollPaneConstants, Acce * * * @param policy one of the three values listed above - * @exception IllegalArgumentException if policy + * @throws IllegalArgumentException if policy * is not one of the legal values shown above * @see #getVerticalScrollBarPolicy */ @@ -521,7 +521,7 @@ public class JScrollPane extends JComponent implements ScrollPaneConstants, Acce * * * @param policy one of the three values listed above - * @exception IllegalArgumentException if policy + * @throws IllegalArgumentException if policy * is not one of the legal values shown above * @see #getHorizontalScrollBarPolicy */ @@ -1195,7 +1195,7 @@ public class JScrollPane extends JComponent implements ScrollPaneConstants, Acce *
  • upperLeft *
  • upperRight * - * @exception IllegalArgumentException if corner key is invalid + * @throws IllegalArgumentException if corner key is invalid */ public void setCorner(String key, Component corner) { diff --git a/src/java.desktop/share/classes/javax/swing/JSeparator.java b/src/java.desktop/share/classes/javax/swing/JSeparator.java index 69d17382acd..10a724a7e2e 100644 --- a/src/java.desktop/share/classes/javax/swing/JSeparator.java +++ b/src/java.desktop/share/classes/javax/swing/JSeparator.java @@ -97,7 +97,7 @@ public class JSeparator extends JComponent implements SwingConstants, Accessible * @param orientation an integer specifying * SwingConstants.HORIZONTAL or * SwingConstants.VERTICAL - * @exception IllegalArgumentException if orientation + * @throws IllegalArgumentException if orientation * is neither SwingConstants.HORIZONTAL nor * SwingConstants.VERTICAL */ @@ -190,7 +190,7 @@ public class JSeparator extends JComponent implements SwingConstants, Accessible * The default value of this property is HORIZONTAL. * @param orientation either SwingConstants.HORIZONTAL * or SwingConstants.VERTICAL - * @exception IllegalArgumentException if orientation + * @throws IllegalArgumentException if orientation * is neither SwingConstants.HORIZONTAL * nor SwingConstants.VERTICAL * diff --git a/src/java.desktop/share/classes/javax/swing/JSlider.java b/src/java.desktop/share/classes/javax/swing/JSlider.java index 0d826fe7e49..4682acb8a54 100644 --- a/src/java.desktop/share/classes/javax/swing/JSlider.java +++ b/src/java.desktop/share/classes/javax/swing/JSlider.java @@ -920,7 +920,7 @@ public class JSlider extends JComponent implements SwingConstants, Accessible { * @return a new {@code Hashtable} of labels * @see #setLabelTable * @see #setPaintLabels - * @exception IllegalArgumentException if {@code start} is + * @throws IllegalArgumentException if {@code start} is * out of range, or if {@code increment} is less than or equal * to zero */ diff --git a/src/java.desktop/share/classes/javax/swing/JSpinner.java b/src/java.desktop/share/classes/javax/swing/JSpinner.java index a371c557439..245212131f2 100644 --- a/src/java.desktop/share/classes/javax/swing/JSpinner.java +++ b/src/java.desktop/share/classes/javax/swing/JSpinner.java @@ -1015,7 +1015,7 @@ public class JSpinner extends JComponent implements Accessible * on the new JFormattedTextField. * * @param spinner the spinner whose model this editor will monitor - * @exception IllegalArgumentException if the spinners model is not + * @throws IllegalArgumentException if the spinners model is not * an instance of SpinnerDateModel * * @see #getModel @@ -1039,7 +1039,7 @@ public class JSpinner extends JComponent implements Accessible * @param dateFormatPattern the initial pattern for the * SimpleDateFormat object that's used to display * and parse the value of the text field. - * @exception IllegalArgumentException if the spinners model is not + * @throws IllegalArgumentException if the spinners model is not * an instance of SpinnerDateModel * * @see #getModel @@ -1064,7 +1064,7 @@ public class JSpinner extends JComponent implements Accessible * will monitor * @param format DateFormat object that's used to display * and parse the value of the text field. - * @exception IllegalArgumentException if the spinners model is not + * @throws IllegalArgumentException if the spinners model is not * an instance of SpinnerDateModel * * @see #getModel @@ -1202,7 +1202,7 @@ public class JSpinner extends JComponent implements Accessible * on the new JFormattedTextField. * * @param spinner the spinner whose model this editor will monitor - * @exception IllegalArgumentException if the spinners model is not + * @throws IllegalArgumentException if the spinners model is not * an instance of SpinnerNumberModel * * @see #getModel @@ -1225,7 +1225,7 @@ public class JSpinner extends JComponent implements Accessible * @param decimalFormatPattern the initial pattern for the * DecimalFormat object that's used to display * and parse the value of the text field. - * @exception IllegalArgumentException if the spinners model is not + * @throws IllegalArgumentException if the spinners model is not * an instance of SpinnerNumberModel or if * decimalFormatPattern is not a legal * argument to DecimalFormat @@ -1251,7 +1251,7 @@ public class JSpinner extends JComponent implements Accessible * @param format the initial pattern for the * DecimalFormat object that's used to display * and parse the value of the text field. - * @exception IllegalArgumentException if the spinners model is not + * @throws IllegalArgumentException if the spinners model is not * an instance of SpinnerNumberModel * * @see #getTextField @@ -1346,7 +1346,7 @@ public class JSpinner extends JComponent implements Accessible * on the new JFormattedTextField. * * @param spinner the spinner whose model this editor will monitor - * @exception IllegalArgumentException if the spinners model is not + * @throws IllegalArgumentException if the spinners model is not * an instance of SpinnerListModel * * @see #getModel diff --git a/src/java.desktop/share/classes/javax/swing/JSplitPane.java b/src/java.desktop/share/classes/javax/swing/JSplitPane.java index bd5e85ed4a6..5a3cfef943e 100644 --- a/src/java.desktop/share/classes/javax/swing/JSplitPane.java +++ b/src/java.desktop/share/classes/javax/swing/JSplitPane.java @@ -262,7 +262,7 @@ public class JSplitPane extends JComponent implements Accessible * * @param newOrientation JSplitPane.HORIZONTAL_SPLIT or * JSplitPane.VERTICAL_SPLIT - * @exception IllegalArgumentException if orientation + * @throws IllegalArgumentException if orientation * is not one of HORIZONTAL_SPLIT or VERTICAL_SPLIT. */ @ConstructorProperties({"orientation"}) @@ -281,7 +281,7 @@ public class JSplitPane extends JComponent implements Accessible * @param newContinuousLayout a boolean, true for the components to * redraw continuously as the divider changes position, false * to wait until the divider position stops changing to redraw - * @exception IllegalArgumentException if orientation + * @throws IllegalArgumentException if orientation * is not one of HORIZONTAL_SPLIT or VERTICAL_SPLIT */ public JSplitPane(int newOrientation, @@ -304,7 +304,7 @@ public class JSplitPane extends JComponent implements Accessible * appear on the right * of a horizontally-split pane, or at the bottom of a * vertically-split pane - * @exception IllegalArgumentException if orientation + * @throws IllegalArgumentException if orientation * is not one of: HORIZONTAL_SPLIT or VERTICAL_SPLIT */ public JSplitPane(int newOrientation, @@ -334,7 +334,7 @@ public class JSplitPane extends JComponent implements Accessible * appear on the right * of a horizontally-split pane, or at the bottom of a * vertically-split pane - * @exception IllegalArgumentException if orientation + * @throws IllegalArgumentException if orientation * is not one of HORIZONTAL_SPLIT or VERTICAL_SPLIT */ public JSplitPane(int newOrientation, @@ -622,7 +622,7 @@ public class JSplitPane extends JComponent implements Accessible * * * @param orientation an integer specifying the orientation - * @exception IllegalArgumentException if orientation is not one of: + * @throws IllegalArgumentException if orientation is not one of: * HORIZONTAL_SPLIT or VERTICAL_SPLIT. */ @BeanProperty(enumerationValues = { @@ -701,7 +701,7 @@ public class JSplitPane extends JComponent implements Accessible * extra space. * * @param value as described above - * @exception IllegalArgumentException if value is < 0 or > 1 + * @throws IllegalArgumentException if value is < 0 or > 1 * @since 1.3 */ @BeanProperty(description @@ -754,7 +754,7 @@ public class JSplitPane extends JComponent implements Accessible * @param proportionalLocation a double-precision floating point value * that specifies a percentage, from zero (top/left) to 1.0 * (bottom/right) - * @exception IllegalArgumentException if the specified location is < 0 + * @throws IllegalArgumentException if the specified location is < 0 * or > 1.0 */ @BeanProperty(description @@ -964,7 +964,7 @@ public class JSplitPane extends JComponent implements Accessible * (position) for this component * @param index an integer specifying the index in the container's * list. - * @exception IllegalArgumentException if the constraints + * @throws IllegalArgumentException if the constraints * object does not match an existing component * @see java.awt.Container#addImpl(Component, Object, int) */ diff --git a/src/java.desktop/share/classes/javax/swing/JTabbedPane.java b/src/java.desktop/share/classes/javax/swing/JTabbedPane.java index 4acf4f8a930..2bdd93a7e8d 100644 --- a/src/java.desktop/share/classes/javax/swing/JTabbedPane.java +++ b/src/java.desktop/share/classes/javax/swing/JTabbedPane.java @@ -215,7 +215,7 @@ public class JTabbedPane extends JComponent * * @param tabPlacement the placement for the tabs relative to the content * @param tabLayoutPolicy the policy for laying out tabs when all tabs will not fit on one run - * @exception IllegalArgumentException if tab placement or tab layout policy are not + * @throws IllegalArgumentException if tab placement or tab layout policy are not * one of the above supported values * @see #addTab * @since 1.4 @@ -505,7 +505,7 @@ public class JTabbedPane extends JComponent * The default value, if not set, is SwingConstants.TOP. * * @param tabPlacement the placement for the tabs relative to the content - * @exception IllegalArgumentException if tab placement value isn't one + * @throws IllegalArgumentException if tab placement value isn't one * of the above valid values */ @BeanProperty(preferred = true, visualUpdate = true, enumerationValues = { @@ -561,7 +561,7 @@ public class JTabbedPane extends JComponent * ignored. * * @param tabLayoutPolicy the policy used to layout the tabs - * @exception IllegalArgumentException if layoutPolicy value isn't one + * @throws IllegalArgumentException if layoutPolicy value isn't one * of the above valid values * @see #getTabLayoutPolicy * @since 1.4 @@ -609,7 +609,7 @@ public class JTabbedPane extends JComponent * the results will be implementation defined. * * @param index the index to be selected - * @exception IndexOutOfBoundsException if index is out of range + * @throws IndexOutOfBoundsException if index is out of range * {@code (index < -1 || index >= tab count)} * * @see #getSelectedIndex @@ -696,7 +696,7 @@ public class JTabbedPane extends JComponent * corresponding to the specified component. * * @param c the selected {@code Component} for this {@code TabbedPane} - * @exception IllegalArgumentException if component not found in tabbed + * @throws IllegalArgumentException if component not found in tabbed * pane * @see #getSelectedComponent */ @@ -963,7 +963,7 @@ public class JTabbedPane extends JComponent * its visibility is reset to true to ensure it will be visible * if added to other containers. * @param index the index of the tab to be removed - * @exception IndexOutOfBoundsException if index is out of range + * @throws IndexOutOfBoundsException if index is out of range * {@code (index < 0 || index >= tab count)} * * @see #addTab @@ -1084,7 +1084,7 @@ public class JTabbedPane extends JComponent * * @param index the index of the component to remove from the * tabbedpane - * @exception IndexOutOfBoundsException if index is out of range + * @throws IndexOutOfBoundsException if index is out of range * {@code (index < 0 || index >= tab count)} * @see #addTab * @see #removeTabAt @@ -1148,7 +1148,7 @@ public class JTabbedPane extends JComponent * * @param index the index of the item being queried * @return the title at index - * @exception IndexOutOfBoundsException if index is out of range + * @throws IndexOutOfBoundsException if index is out of range * {@code (index < 0 || index >= tab count)} * @see #setTitleAt */ @@ -1161,7 +1161,7 @@ public class JTabbedPane extends JComponent * * @param index the index of the item being queried * @return the icon at index - * @exception IndexOutOfBoundsException if index is out of range + * @throws IndexOutOfBoundsException if index is out of range * {@code (index < 0 || index >= tab count)} * * @see #setIconAt @@ -1180,7 +1180,7 @@ public class JTabbedPane extends JComponent * * @param index the index of the item being queried * @return the icon at index - * @exception IndexOutOfBoundsException if index is out of range + * @throws IndexOutOfBoundsException if index is out of range * {@code (index < 0 || index >= tab count)} * * @see #setDisabledIconAt @@ -1198,7 +1198,7 @@ public class JTabbedPane extends JComponent * * @param index the index of the item being queried * @return a string containing the tool tip text at index - * @exception IndexOutOfBoundsException if index is out of range + * @throws IndexOutOfBoundsException if index is out of range * {@code (index < 0 || index >= tab count)} * * @see #setToolTipTextAt @@ -1214,7 +1214,7 @@ public class JTabbedPane extends JComponent * @param index the index of the item being queried * @return the Color of the tab background at * index - * @exception IndexOutOfBoundsException if index is out of range + * @throws IndexOutOfBoundsException if index is out of range * {@code (index < 0 || index >= tab count)} * * @see #setBackgroundAt @@ -1229,7 +1229,7 @@ public class JTabbedPane extends JComponent * @param index the index of the item being queried * @return the Color of the tab foreground at * index - * @exception IndexOutOfBoundsException if index is out of range + * @throws IndexOutOfBoundsException if index is out of range * {@code (index < 0 || index >= tab count)} * * @see #setForegroundAt @@ -1245,7 +1245,7 @@ public class JTabbedPane extends JComponent * @param index the index of the item being queried * @return true if the tab at index is enabled; * false otherwise - * @exception IndexOutOfBoundsException if index is out of range + * @throws IndexOutOfBoundsException if index is out of range * {@code (index < 0 || index >= tab count)} * * @see #setEnabledAt @@ -1259,7 +1259,7 @@ public class JTabbedPane extends JComponent * * @param index the index of the item being queried * @return the Component at index - * @exception IndexOutOfBoundsException if index is out of range + * @throws IndexOutOfBoundsException if index is out of range * {@code (index < 0 || index >= tab count)} * * @see #setComponentAt @@ -1278,7 +1278,7 @@ public class JTabbedPane extends JComponent * @param tabIndex the index of the tab that the mnemonic refers to * @return the key code which represents the mnemonic; * -1 if a mnemonic is not specified for the tab - * @exception IndexOutOfBoundsException if index is out of range + * @throws IndexOutOfBoundsException if index is out of range * (tabIndex < 0 || * tabIndex >= tab count) * @see #setDisplayedMnemonicIndexAt(int,int) @@ -1299,7 +1299,7 @@ public class JTabbedPane extends JComponent * @param tabIndex the index of the tab that the mnemonic refers to * @return index representing mnemonic character if one exists; * otherwise returns -1 - * @exception IndexOutOfBoundsException if index is out of range + * @throws IndexOutOfBoundsException if index is out of range * (tabIndex < 0 || * tabIndex >= tab count) * @see #setDisplayedMnemonicIndexAt(int,int) @@ -1324,7 +1324,7 @@ public class JTabbedPane extends JComponent * index, or null if tab at * index is not currently visible in the UI, * or if there is no UI set on this tabbedpane - * @exception IndexOutOfBoundsException if index is out of range + * @throws IndexOutOfBoundsException if index is out of range * {@code (index < 0 || index >= tab count)} */ public Rectangle getBoundsAt(int index) { @@ -1346,7 +1346,7 @@ public class JTabbedPane extends JComponent * * @param index the tab index where the title should be set * @param title the title to be displayed in the tab - * @exception IndexOutOfBoundsException if index is out of range + * @throws IndexOutOfBoundsException if index is out of range * {@code (index < 0 || index >= tab count)} * * @see #getTitleAt @@ -1386,7 +1386,7 @@ public class JTabbedPane extends JComponent * * @param index the tab index where the icon should be set * @param icon the icon to be displayed in the tab - * @exception IndexOutOfBoundsException if index is out of range + * @throws IndexOutOfBoundsException if index is out of range * {@code (index < 0 || index >= tab count)} * * @see #setDisabledIconAt @@ -1428,7 +1428,7 @@ public class JTabbedPane extends JComponent * * @param index the tab index where the disabled icon should be set * @param disabledIcon the icon to be displayed in the tab when disabled - * @exception IndexOutOfBoundsException if index is out of range + * @throws IndexOutOfBoundsException if index is out of range * {@code (index < 0 || index >= tab count)} * * @see #getDisabledIconAt @@ -1451,7 +1451,7 @@ public class JTabbedPane extends JComponent * * @param index the tab index where the tooltip text should be set * @param toolTipText the tooltip text to be displayed for the tab - * @exception IndexOutOfBoundsException if index is out of range + * @throws IndexOutOfBoundsException if index is out of range * {@code (index < 0 || index >= tab count)} * * @see #getToolTipTextAt @@ -1486,7 +1486,7 @@ public class JTabbedPane extends JComponent * * @param index the tab index where the background should be set * @param background the color to be displayed in the tab's background - * @exception IndexOutOfBoundsException if index is out of range + * @throws IndexOutOfBoundsException if index is out of range * {@code (index < 0 || index >= tab count)} * * @see #getBackgroundAt @@ -1517,7 +1517,7 @@ public class JTabbedPane extends JComponent * * @param index the tab index where the foreground should be set * @param foreground the color to be displayed as the tab's foreground - * @exception IndexOutOfBoundsException if index is out of range + * @throws IndexOutOfBoundsException if index is out of range * {@code (index < 0 || index >= tab count)} * * @see #getForegroundAt @@ -1542,7 +1542,7 @@ public class JTabbedPane extends JComponent * * @param index the tab index which should be enabled/disabled * @param enabled whether or not the tab should be enabled - * @exception IndexOutOfBoundsException if index is out of range + * @throws IndexOutOfBoundsException if index is out of range * {@code (index < 0 || index >= tab count)} * * @see #isEnabledAt @@ -1562,7 +1562,7 @@ public class JTabbedPane extends JComponent * * @param index the tab index where this component is being placed * @param component the component for the tab - * @exception IndexOutOfBoundsException if index is out of range + * @throws IndexOutOfBoundsException if index is out of range * {@code (index < 0 || index >= tab count)} * * @see #getComponentAt @@ -1638,10 +1638,10 @@ public class JTabbedPane extends JComponent * @since 1.4 * @param tabIndex the index of the tab that the mnemonic refers to * @param mnemonicIndex index into the String to underline - * @exception IndexOutOfBoundsException if tabIndex is + * @throws IndexOutOfBoundsException if tabIndex is * out of range ({@code tabIndex < 0 || tabIndex >= tab * count}) - * @exception IllegalArgumentException will be thrown if + * @throws IllegalArgumentException will be thrown if * mnemonicIndex is >= length of the tab * title , or < -1 * @see #setMnemonicAt(int,int) @@ -1678,7 +1678,7 @@ public class JTabbedPane extends JComponent * @since 1.4 * @param tabIndex the index of the tab that the mnemonic refers to * @param mnemonic the key code which represents the mnemonic - * @exception IndexOutOfBoundsException if tabIndex is out + * @throws IndexOutOfBoundsException if tabIndex is out * of range ({@code tabIndex < 0 || tabIndex >= tab count}) * @see #getMnemonicAt(int) * @see #setDisplayedMnemonicIndexAt(int,int) @@ -2001,7 +2001,7 @@ public class JTabbedPane extends JComponent * * @param i zero-based index of child * @return the Accessible child of the object - * @exception IllegalArgumentException if index is out of bounds + * @throws IllegalArgumentException if index is out of bounds */ public Accessible getAccessibleChild(int i) { if (i < 0 || i >= getTabCount()) { @@ -2426,9 +2426,9 @@ public class JTabbedPane extends JComponent * @param index the tab index where the component should be set * @param component the component to render the title for the * specified tab - * @exception IndexOutOfBoundsException if index is out of range + * @throws IndexOutOfBoundsException if index is out of range * {@code (index < 0 || index >= tab count)} - * @exception IllegalArgumentException if component has already been + * @throws IllegalArgumentException if component has already been * added to this JTabbedPane * * @see #getTabComponentAt @@ -2456,7 +2456,7 @@ public class JTabbedPane extends JComponent * * @param index the index of the item being queried * @return the tab component at index - * @exception IndexOutOfBoundsException if index is out of range + * @throws IndexOutOfBoundsException if index is out of range * {@code (index < 0 || index >= tab count)} * * @see #setTabComponentAt diff --git a/src/java.desktop/share/classes/javax/swing/JTable.java b/src/java.desktop/share/classes/javax/swing/JTable.java index c70ec2f935e..5d27be29454 100644 --- a/src/java.desktop/share/classes/javax/swing/JTable.java +++ b/src/java.desktop/share/classes/javax/swing/JTable.java @@ -991,7 +991,7 @@ public class JTable extends JComponent implements TableModelListener, Scrollable * the row margin. * * @param rowHeight new row height - * @exception IllegalArgumentException if rowHeight is + * @throws IllegalArgumentException if rowHeight is * less than 1 * @see #getRowHeight */ @@ -1037,7 +1037,7 @@ public class JTable extends JComponent implements TableModelListener, Scrollable * @param row the row whose height is being changed * @param rowHeight new row height, in pixels - * @exception IllegalArgumentException if rowHeight is + * @throws IllegalArgumentException if rowHeight is * less than 1 * @since 1.3 */ @@ -1126,7 +1126,7 @@ public class JTable extends JComponent implements TableModelListener, Scrollable * The default color is look and feel dependent. * * @param gridColor the new color of the grid lines - * @exception IllegalArgumentException if gridColor is null + * @throws IllegalArgumentException if gridColor is null * @see #getGridColor */ @BeanProperty(description @@ -1485,7 +1485,7 @@ public class JTable extends JComponent implements TableModelListener, Scrollable * table's {@code TransferHandler}. * * @param b whether or not to enable automatic drag handling - * @exception HeadlessException if + * @throws HeadlessException if * b is true and * GraphicsEnvironment.isHeadless() * returns true @@ -2220,7 +2220,7 @@ public class JTable extends JComponent implements TableModelListener, Scrollable * Selects the rows from index0 to index1, * inclusive. * - * @exception IllegalArgumentException if index0 or + * @throws IllegalArgumentException if index0 or * index1 lie outside * [0, getRowCount()-1] * @param index0 one end of the interval @@ -2234,7 +2234,7 @@ public class JTable extends JComponent implements TableModelListener, Scrollable * Selects the columns from index0 to index1, * inclusive. * - * @exception IllegalArgumentException if index0 or + * @throws IllegalArgumentException if index0 or * index1 lie outside * [0, getColumnCount()-1] * @param index0 one end of the interval @@ -2248,7 +2248,7 @@ public class JTable extends JComponent implements TableModelListener, Scrollable * Adds the rows from index0 to index1, inclusive, to * the current selection. * - * @exception IllegalArgumentException if index0 or index1 + * @throws IllegalArgumentException if index0 or index1 * lie outside [0, getRowCount()-1] * @param index0 one end of the interval * @param index1 the other end of the interval @@ -2261,7 +2261,7 @@ public class JTable extends JComponent implements TableModelListener, Scrollable * Adds the columns from index0 to index1, * inclusive, to the current selection. * - * @exception IllegalArgumentException if index0 or + * @throws IllegalArgumentException if index0 or * index1 lie outside * [0, getColumnCount()-1] * @param index0 one end of the interval @@ -2274,7 +2274,7 @@ public class JTable extends JComponent implements TableModelListener, Scrollable /** * Deselects the rows from index0 to index1, inclusive. * - * @exception IllegalArgumentException if index0 or + * @throws IllegalArgumentException if index0 or * index1 lie outside * [0, getRowCount()-1] * @param index0 one end of the interval @@ -2287,7 +2287,7 @@ public class JTable extends JComponent implements TableModelListener, Scrollable /** * Deselects the columns from index0 to index1, inclusive. * - * @exception IllegalArgumentException if index0 or + * @throws IllegalArgumentException if index0 or * index1 lie outside * [0, getColumnCount()-1] * @param index0 one end of the interval @@ -2596,7 +2596,7 @@ public class JTable extends JComponent implements TableModelListener, Scrollable * equals. * * @return the TableColumn object that matches the identifier - * @exception IllegalArgumentException if identifier is null or no TableColumn has this identifier + * @throws IllegalArgumentException if identifier is null or no TableColumn has this identifier * * @param identifier the identifier object */ @@ -8355,7 +8355,7 @@ public class JTable extends JComponent implements TableModelListener, Scrollable * * @return this component's locale; if this component does * not have a locale, the locale of its parent is returned - * @exception IllegalComponentStateException if the + * @throws IllegalComponentStateException if the * Component does not have its own locale * and has not yet been added to a containment hierarchy * such that the locale can be determined from the @@ -9161,7 +9161,7 @@ public class JTable extends JComponent implements TableModelListener, Scrollable * * @return this component's locale; if this component does * not have a locale, the locale of its parent is returned - * @exception IllegalComponentStateException if the + * @throws IllegalComponentStateException if the * Component does not have its own locale * and has not yet been added to a containment hierarchy * such that the locale can be determined from the diff --git a/src/java.desktop/share/classes/javax/swing/JTextArea.java b/src/java.desktop/share/classes/javax/swing/JTextArea.java index ecc9342f05a..03b3bc7e9bd 100644 --- a/src/java.desktop/share/classes/javax/swing/JTextArea.java +++ b/src/java.desktop/share/classes/javax/swing/JTextArea.java @@ -166,7 +166,7 @@ public class JTextArea extends JTextComponent { * * @param rows the number of rows >= 0 * @param columns the number of columns >= 0 - * @exception IllegalArgumentException if the rows or columns + * @throws IllegalArgumentException if the rows or columns * arguments are negative. */ public JTextArea(int rows, int columns) { @@ -180,7 +180,7 @@ public class JTextArea extends JTextComponent { * @param text the text to be displayed, or null * @param rows the number of rows >= 0 * @param columns the number of columns >= 0 - * @exception IllegalArgumentException if the rows or columns + * @throws IllegalArgumentException if the rows or columns * arguments are negative. */ public JTextArea(String text, int rows, int columns) { @@ -206,7 +206,7 @@ public class JTextArea extends JTextComponent { * @param text the text to be displayed, null if none * @param rows the number of rows >= 0 * @param columns the number of columns >= 0 - * @exception IllegalArgumentException if the rows or columns + * @throws IllegalArgumentException if the rows or columns * arguments are negative. */ public JTextArea(Document doc, String text, int rows, int columns) { @@ -370,7 +370,7 @@ public class JTextArea extends JTextComponent { * * @param offset the offset >= 0 * @return the line number >= 0 - * @exception BadLocationException thrown if the offset is + * @throws BadLocationException thrown if the offset is * less than zero or greater than the document length. */ public int getLineOfOffset(int offset) throws BadLocationException { @@ -401,7 +401,7 @@ public class JTextArea extends JTextComponent { * * @param line the line number to translate >= 0 * @return the offset >= 0 - * @exception BadLocationException thrown if the line is + * @throws BadLocationException thrown if the line is * less than zero or greater or equal to the number of * lines contained in the document (as reported by * getLineCount). @@ -424,7 +424,7 @@ public class JTextArea extends JTextComponent { * * @param line the line >= 0 * @return the offset >= 0 - * @exception BadLocationException Thrown if the line is + * @throws BadLocationException Thrown if the line is * less than zero or greater or equal to the number of * lines contained in the document (as reported by * getLineCount). @@ -452,7 +452,7 @@ public class JTextArea extends JTextComponent { * * @param str the text to insert * @param pos the position at which to insert >= 0 - * @exception IllegalArgumentException if pos is an + * @throws IllegalArgumentException if pos is an * invalid position in the model * @see TextComponent#setText * @see #replaceRange @@ -493,7 +493,7 @@ public class JTextArea extends JTextComponent { * @param str the text to use as the replacement * @param start the start position >= 0 * @param end the end position >= start - * @exception IllegalArgumentException if part of the range is an + * @throws IllegalArgumentException if part of the range is an * invalid position in the model * @see #insert */ @@ -532,7 +532,7 @@ public class JTextArea extends JTextComponent { * setting the new value. * * @param rows the number of rows >= 0 - * @exception IllegalArgumentException if rows is less than 0 + * @throws IllegalArgumentException if rows is less than 0 * @see #getRows */ @BeanProperty(bound = false, description @@ -576,7 +576,7 @@ public class JTextArea extends JTextComponent { * after setting the new value. * * @param columns the number of columns >= 0 - * @exception IllegalArgumentException if columns is less than 0 + * @throws IllegalArgumentException if columns is less than 0 * @see #getColumns */ @BeanProperty(bound = false, description @@ -726,7 +726,7 @@ public class JTextArea extends JTextComponent { * @param direction Less than zero to scroll up/left, * greater than zero for down/right. * @return The "unit" increment for scrolling in the specified direction - * @exception IllegalArgumentException for an invalid orientation + * @throws IllegalArgumentException for an invalid orientation * @see JScrollBar#setUnitIncrement * @see #getRowHeight * @see #getColumnWidth diff --git a/src/java.desktop/share/classes/javax/swing/JTextField.java b/src/java.desktop/share/classes/javax/swing/JTextField.java index 3abe09d0565..0d66209d8af 100644 --- a/src/java.desktop/share/classes/javax/swing/JTextField.java +++ b/src/java.desktop/share/classes/javax/swing/JTextField.java @@ -242,7 +242,7 @@ public class JTextField extends JTextComponent implements SwingConstants { * the preferred width >= 0; if columns * is set to zero, the preferred width will be whatever * naturally results from the component implementation - * @exception IllegalArgumentException if columns < 0 + * @throws IllegalArgumentException if columns < 0 */ public JTextField(Document doc, String text, int columns) { if (columns < 0) { @@ -343,7 +343,7 @@ public class JTextField extends JTextComponent implements SwingConstants { * and a PropertyChange event ("horizontalAlignment") is fired. * * @param alignment the alignment - * @exception IllegalArgumentException if alignment + * @throws IllegalArgumentException if alignment * is not a valid key */ @BeanProperty(preferred = true, enumerationValues = { @@ -393,7 +393,7 @@ public class JTextField extends JTextComponent implements SwingConstants { * and then invalidate the layout. * * @param columns the number of columns >= 0 - * @exception IllegalArgumentException if columns + * @throws IllegalArgumentException if columns * is less than 0 */ @BeanProperty(bound = false, description diff --git a/src/java.desktop/share/classes/javax/swing/JTextPane.java b/src/java.desktop/share/classes/javax/swing/JTextPane.java index 41e16034c23..228181f31f7 100644 --- a/src/java.desktop/share/classes/javax/swing/JTextPane.java +++ b/src/java.desktop/share/classes/javax/swing/JTextPane.java @@ -138,7 +138,7 @@ public class JTextPane extends JEditorPane { * must be a StyledDocument. * * @param doc the document to display/edit - * @exception IllegalArgumentException if doc can't + * @throws IllegalArgumentException if doc can't * be narrowed to a StyledDocument which is the * required type of model for this text component */ @@ -480,7 +480,7 @@ public class JTextPane extends JEditorPane { * establishes the content type of the editor. * * @param kit the desired editor behavior - * @exception IllegalArgumentException if kit is not a + * @throws IllegalArgumentException if kit is not a * StyledEditorKit */ public final void setEditorKit(EditorKit kit) { diff --git a/src/java.desktop/share/classes/javax/swing/JToolBar.java b/src/java.desktop/share/classes/javax/swing/JToolBar.java index 114ef0d169c..4d93a1bceef 100644 --- a/src/java.desktop/share/classes/javax/swing/JToolBar.java +++ b/src/java.desktop/share/classes/javax/swing/JToolBar.java @@ -142,7 +142,7 @@ public class JToolBar extends JComponent implements SwingConstants, Accessible * @param name the name of the tool bar * @param orientation the initial orientation -- it must be * either HORIZONTAL or VERTICAL - * @exception IllegalArgumentException if orientation is neither + * @throws IllegalArgumentException if orientation is neither * HORIZONTAL nor VERTICAL * @since 1.3 */ @@ -406,7 +406,7 @@ public class JToolBar extends JComponent implements SwingConstants, Accessible * * @param o the new orientation -- either HORIZONTAL or * VERTICAL - * @exception IllegalArgumentException if orientation is neither + * @throws IllegalArgumentException if orientation is neither * HORIZONTAL nor VERTICAL * @see #getOrientation */ diff --git a/src/java.desktop/share/classes/javax/swing/JTree.java b/src/java.desktop/share/classes/javax/swing/JTree.java index ae90ea8be8b..e6e591bad27 100644 --- a/src/java.desktop/share/classes/javax/swing/JTree.java +++ b/src/java.desktop/share/classes/javax/swing/JTree.java @@ -1251,7 +1251,7 @@ public class JTree extends JComponent implements Scrollable, Accessible * tree's {@code TransferHandler}. * * @param b whether or not to enable automatic drag handling - * @exception HeadlessException if + * @throws HeadlessException if * b is true and * GraphicsEnvironment.isHeadless() * returns true @@ -3087,7 +3087,7 @@ public class JTree extends JComponent implements Scrollable, Accessible * Position.Bias.Forward or Position.Bias.Backward. * @return the TreePath of the next tree element that * starts with the prefix; otherwise null - * @exception IllegalArgumentException if prefix is null + * @throws IllegalArgumentException if prefix is null * or startingRow is out of bounds * @since 1.4 */ @@ -5053,7 +5053,7 @@ public class JTree extends JComponent implements Scrollable, Accessible * * @return This component's locale. If this component does not have * a locale, the locale of its parent is returned. - * @exception IllegalComponentStateException + * @throws IllegalComponentStateException * If the Component does not have its own locale and has not yet * been added to a containment hierarchy such that the locale can be * determined from the containing parent. diff --git a/src/java.desktop/share/classes/javax/swing/JViewport.java b/src/java.desktop/share/classes/javax/swing/JViewport.java index e3974a84f27..ff082acc694 100644 --- a/src/java.desktop/share/classes/javax/swing/JViewport.java +++ b/src/java.desktop/share/classes/javax/swing/JViewport.java @@ -565,7 +565,7 @@ public class JViewport extends JComponent implements Accessible * a JViewPort. * * @param border the Border to set - * @exception IllegalArgumentException this method is not implemented + * @throws IllegalArgumentException this method is not implemented */ public final void setBorder(Border border) { if (border != null) { diff --git a/src/java.desktop/share/classes/javax/swing/JWindow.java b/src/java.desktop/share/classes/javax/swing/JWindow.java index 69269c9f284..a306ea6d4ea 100644 --- a/src/java.desktop/share/classes/javax/swing/JWindow.java +++ b/src/java.desktop/share/classes/javax/swing/JWindow.java @@ -387,10 +387,10 @@ public class JWindow extends Window implements Accessible, * @param comp the component to be enhanced * @param constraints the constraints to be respected * @param index the index - * @exception IllegalArgumentException if index is invalid - * @exception IllegalArgumentException if adding the container's parent + * @throws IllegalArgumentException if index is invalid + * @throws IllegalArgumentException if adding the container's parent * to itself - * @exception IllegalArgumentException if adding a window to a container + * @throws IllegalArgumentException if adding a window to a container * * @see #setRootPaneCheckingEnabled * @see javax.swing.RootPaneContainer @@ -504,7 +504,7 @@ public class JWindow extends Window implements Accessible, * * @param contentPane the new contentPane * - * @exception IllegalComponentStateException (a runtime + * @throws IllegalComponentStateException (a runtime * exception) if the content pane parameter is null * @see #getContentPane * @see RootPaneContainer#setContentPane @@ -532,7 +532,7 @@ public class JWindow extends Window implements Accessible, * * @param layeredPane the new layeredPane object * - * @exception IllegalComponentStateException (a runtime + * @throws IllegalComponentStateException (a runtime * exception) if the content pane parameter is null * @see #getLayeredPane * @see RootPaneContainer#setLayeredPane diff --git a/src/java.desktop/share/classes/javax/swing/OverlayLayout.java b/src/java.desktop/share/classes/javax/swing/OverlayLayout.java index 0067f6fd6bd..71ca34f1aa0 100644 --- a/src/java.desktop/share/classes/javax/swing/OverlayLayout.java +++ b/src/java.desktop/share/classes/javax/swing/OverlayLayout.java @@ -217,7 +217,7 @@ public class OverlayLayout implements LayoutManager2,Serializable { * * @param target the container to lay out * - * @exception AWTError if the target isn't the container specified to the + * @throws AWTError if the target isn't the container specified to the * constructor */ public void layoutContainer(Container target) { diff --git a/src/java.desktop/share/classes/javax/swing/Popup.java b/src/java.desktop/share/classes/javax/swing/Popup.java index 605ecd6fd78..15c90ad3be7 100644 --- a/src/java.desktop/share/classes/javax/swing/Popup.java +++ b/src/java.desktop/share/classes/javax/swing/Popup.java @@ -82,7 +82,7 @@ public class Popup { * @param contents Contents of the Popup * @param x Initial x screen coordinate * @param y Initial y screen coordinate - * @exception IllegalArgumentException if contents is null + * @throws IllegalArgumentException if contents is null */ protected Popup(Component owner, Component contents, int x, int y) { this(); diff --git a/src/java.desktop/share/classes/javax/swing/PopupFactory.java b/src/java.desktop/share/classes/javax/swing/PopupFactory.java index 462675fa828..a30aba6f2fc 100644 --- a/src/java.desktop/share/classes/javax/swing/PopupFactory.java +++ b/src/java.desktop/share/classes/javax/swing/PopupFactory.java @@ -127,7 +127,7 @@ public class PopupFactory { * factory is null. * * @param factory Shared PopupFactory - * @exception IllegalArgumentException if factory is null + * @throws IllegalArgumentException if factory is null * @see #getPopup */ public static void setSharedInstance(PopupFactory factory) { @@ -186,7 +186,7 @@ public class PopupFactory { * @param contents Contents of the Popup * @param x Initial x screen coordinate * @param y Initial y screen coordinate - * @exception IllegalArgumentException if contents is null + * @throws IllegalArgumentException if contents is null * @return Popup containing Contents */ public Popup getPopup(Component owner, Component contents, diff --git a/src/java.desktop/share/classes/javax/swing/ProgressMonitor.java b/src/java.desktop/share/classes/javax/swing/ProgressMonitor.java index 8733d5b3cfe..6f2d1eda4b6 100644 --- a/src/java.desktop/share/classes/javax/swing/ProgressMonitor.java +++ b/src/java.desktop/share/classes/javax/swing/ProgressMonitor.java @@ -794,7 +794,7 @@ public class ProgressMonitor implements Accessible * @return this component's locale. If this component does not have * a locale, the locale of its parent is returned. * - * @exception IllegalComponentStateException + * @throws IllegalComponentStateException * If the Component does not have its own locale and has not yet been * added to a containment hierarchy such that the locale can be * determined from the containing parent. diff --git a/src/java.desktop/share/classes/javax/swing/RootPaneContainer.java b/src/java.desktop/share/classes/javax/swing/RootPaneContainer.java index 76dc2286f87..b05e0c52e55 100644 --- a/src/java.desktop/share/classes/javax/swing/RootPaneContainer.java +++ b/src/java.desktop/share/classes/javax/swing/RootPaneContainer.java @@ -103,7 +103,7 @@ public interface RootPaneContainer * Generally implemented with * getRootPane().setContentPane(contentPane); * - * @exception java.awt.IllegalComponentStateException (a runtime + * @throws java.awt.IllegalComponentStateException (a runtime * exception) if the content pane parameter is null * @param contentPane the Container to use for the contents of this * JRootPane @@ -134,7 +134,7 @@ public interface RootPaneContainer * getRootPane().setLayeredPane(layeredPane); * * @param layeredPane the layered pane - * @exception java.awt.IllegalComponentStateException (a runtime + * @throws java.awt.IllegalComponentStateException (a runtime * exception) if the layered pane parameter is null * @see #getLayeredPane * @see JRootPane#getLayeredPane diff --git a/src/java.desktop/share/classes/javax/swing/ScrollPaneLayout.java b/src/java.desktop/share/classes/javax/swing/ScrollPaneLayout.java index 9f9e6660666..0b8d8576f14 100644 --- a/src/java.desktop/share/classes/javax/swing/ScrollPaneLayout.java +++ b/src/java.desktop/share/classes/javax/swing/ScrollPaneLayout.java @@ -230,7 +230,7 @@ public class ScrollPaneLayout * * @param s the component identifier * @param c the component to be added - * @exception IllegalArgumentException if s is an invalid key + * @throws IllegalArgumentException if s is an invalid key */ public void addLayoutComponent(String s, Component c) { @@ -328,7 +328,7 @@ public class ScrollPaneLayout * with the Swing 1.0.2 (and earlier) versions of this class. * * @param x an integer giving the display policy - * @exception IllegalArgumentException if x is an invalid + * @throws IllegalArgumentException if x is an invalid * vertical scroll bar policy, as listed above */ public void setVerticalScrollBarPolicy(int x) { @@ -366,7 +366,7 @@ public class ScrollPaneLayout * with the Swing 1.0.2 (and earlier) versions of this class. * * @param x an int giving the display policy - * @exception IllegalArgumentException if x is not a valid + * @throws IllegalArgumentException if x is not a valid * horizontal scrollbar policy, as listed above */ public void setHorizontalScrollBarPolicy(int x) { diff --git a/src/java.desktop/share/classes/javax/swing/SizeSequence.java b/src/java.desktop/share/classes/javax/swing/SizeSequence.java index 899a64570f3..c6877dc8b2b 100644 --- a/src/java.desktop/share/classes/javax/swing/SizeSequence.java +++ b/src/java.desktop/share/classes/javax/swing/SizeSequence.java @@ -142,7 +142,7 @@ public class SizeSequence { * all initialized to have size 0. * * @param numEntries the number of sizes to track - * @exception NegativeArraySizeException if + * @throws NegativeArraySizeException if * numEntries < 0 */ public SizeSequence(int numEntries) { @@ -355,7 +355,7 @@ public class SizeSequence { * in the group * @param length the number of entries in the group * @param value the size to be assigned to each new entry - * @exception ArrayIndexOutOfBoundsException if the parameters + * @throws ArrayIndexOutOfBoundsException if the parameters * are outside of the range: * (0 <= start < (getSizes().length)) AND (length >= 0) */ diff --git a/src/java.desktop/share/classes/javax/swing/SwingUtilities.java b/src/java.desktop/share/classes/javax/swing/SwingUtilities.java index 5e3965e69b8..1d58541dfee 100644 --- a/src/java.desktop/share/classes/javax/swing/SwingUtilities.java +++ b/src/java.desktop/share/classes/javax/swing/SwingUtilities.java @@ -1466,10 +1466,10 @@ public class SwingUtilities implements SwingConstants * java.awt.EventQueue.invokeAndWait(). * * @param doRun the instance of {@code Runnable} - * @exception InterruptedException if we're interrupted while waiting for + * @throws InterruptedException if we're interrupted while waiting for * the event dispatching thread to finish executing * doRun.run() - * @exception InvocationTargetException if an exception is thrown + * @throws InvocationTargetException if an exception is thrown * while running doRun * * @see #invokeLater @@ -1984,7 +1984,7 @@ public class SwingUtilities implements SwingConstants * Returns a toolkit-private, shared, invisible Frame * to be the owner for JDialogs and JWindows created with * {@code null} owners. - * @exception HeadlessException if GraphicsEnvironment.isHeadless() + * @throws HeadlessException if GraphicsEnvironment.isHeadless() * returns true. * @see java.awt.GraphicsEnvironment#isHeadless */ @@ -2002,7 +2002,7 @@ public class SwingUtilities implements SwingConstants /** * Returns a SharedOwnerFrame's shutdown listener to dispose the SharedOwnerFrame * if it has no more displayable children. - * @exception HeadlessException if GraphicsEnvironment.isHeadless() + * @throws HeadlessException if GraphicsEnvironment.isHeadless() * returns true. * @see java.awt.GraphicsEnvironment#isHeadless */ diff --git a/src/java.desktop/share/classes/javax/swing/Timer.java b/src/java.desktop/share/classes/javax/swing/Timer.java index 6b4f95be108..ced691f4e06 100644 --- a/src/java.desktop/share/classes/javax/swing/Timer.java +++ b/src/java.desktop/share/classes/javax/swing/Timer.java @@ -341,7 +341,7 @@ public class Timer implements Serializable * on this timer, * or an empty array if no such * listeners have been added - * @exception ClassCastException if listenerType doesn't + * @throws ClassCastException if listenerType doesn't * specify a class or interface that implements * java.util.EventListener * diff --git a/src/java.desktop/share/classes/javax/swing/TransferHandler.java b/src/java.desktop/share/classes/javax/swing/TransferHandler.java index f2622880e7f..445234e4bda 100644 --- a/src/java.desktop/share/classes/javax/swing/TransferHandler.java +++ b/src/java.desktop/share/classes/javax/swing/TransferHandler.java @@ -1172,9 +1172,9 @@ public class TransferHandler implements Serializable { * * @param flavor the requested flavor for the data * @see DataFlavor#getRepresentationClass - * @exception IOException if the data is no longer available + * @throws IOException if the data is no longer available * in the requested flavor. - * @exception UnsupportedFlavorException if the requested data flavor is + * @throws UnsupportedFlavorException if the requested data flavor is * not supported. */ public Object getTransferData(DataFlavor flavor) throws UnsupportedFlavorException, IOException { diff --git a/src/java.desktop/share/classes/javax/swing/colorchooser/AbstractColorChooserPanel.java b/src/java.desktop/share/classes/javax/swing/colorchooser/AbstractColorChooserPanel.java index 2f2163c8939..9a428492512 100644 --- a/src/java.desktop/share/classes/javax/swing/colorchooser/AbstractColorChooserPanel.java +++ b/src/java.desktop/share/classes/javax/swing/colorchooser/AbstractColorChooserPanel.java @@ -161,7 +161,7 @@ public abstract class AbstractColorChooserPanel extends JPanel { * If you override this, be sure to call super. * * @param enclosingChooser the chooser to which the panel is to be added - * @exception RuntimeException if the chooser panel has already been + * @throws RuntimeException if the chooser panel has already been * installed */ public void installChooserPanel(JColorChooser enclosingChooser) { diff --git a/src/java.desktop/share/classes/javax/swing/event/EventListenerList.java b/src/java.desktop/share/classes/javax/swing/event/EventListenerList.java index 1be0228864c..81ae2393008 100644 --- a/src/java.desktop/share/classes/javax/swing/event/EventListenerList.java +++ b/src/java.desktop/share/classes/javax/swing/event/EventListenerList.java @@ -144,7 +144,7 @@ public class EventListenerList implements Serializable { * @param the type of {@code EventListener} to search for * @param t the type of {@code EventListener} classes to be returned * @return all of the listeners of the specified type. - * @exception ClassCastException if the supplied class + * @throws ClassCastException if the supplied class * is not assignable to EventListener * * @since 1.3 diff --git a/src/java.desktop/share/classes/javax/swing/plaf/TextUI.java b/src/java.desktop/share/classes/javax/swing/plaf/TextUI.java index cba6691ba58..3c96fdabffd 100644 --- a/src/java.desktop/share/classes/javax/swing/plaf/TextUI.java +++ b/src/java.desktop/share/classes/javax/swing/plaf/TextUI.java @@ -49,7 +49,7 @@ public abstract class TextUI extends ComponentUI * @param t the text component for which this UI is installed * @param pos the local location in the model to translate >= 0 * @return the coordinates as a {@code Rectangle} - * @exception BadLocationException if the given position does not + * @throws BadLocationException if the given position does not * represent a valid location in the associated document * * @deprecated replaced by @@ -66,7 +66,7 @@ public abstract class TextUI extends ComponentUI * @param pos the local location in the model to translate >= 0 * @param bias the bias for the position * @return the coordinates as a {@code Rectangle} - * @exception BadLocationException if the given position does not + * @throws BadLocationException if the given position does not * represent a valid location in the associated document * * @deprecated replaced by @@ -86,7 +86,7 @@ public abstract class TextUI extends ComponentUI * @param pos the local location in the model to translate {@code >= 0} * @param bias the bias for the position * @return the coordinates as a {@code Rectangle2D} - * @exception BadLocationException if the given position does not + * @throws BadLocationException if the given position does not * represent a valid location in the associated document * * @since 9 @@ -178,8 +178,8 @@ public abstract class TextUI extends ComponentUI * @param biasRet an array to contain the bias for the returned position * @return the location within the model that best represents the next * location visual position - * @exception BadLocationException for a bad location within a document model - * @exception IllegalArgumentException for an invalid direction + * @throws BadLocationException for a bad location within a document model + * @throws IllegalArgumentException for an invalid direction */ public abstract int getNextVisualPositionFrom(JTextComponent t, int pos, Position.Bias b, diff --git a/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicHTML.java b/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicHTML.java index 3e1108fb25b..5a7f88ff3ce 100644 --- a/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicHTML.java +++ b/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicHTML.java @@ -585,9 +585,9 @@ public class BasicHTML { * position is a boundary of two views. * @param a the allocated region to render into * @return the bounding box of the given position is returned - * @exception BadLocationException if the given position does + * @throws BadLocationException if the given position does * not represent a valid location in the associated document - * @exception IllegalArgumentException for an invalid bias argument + * @throws IllegalArgumentException for an invalid bias argument * @see View#viewToModel */ public Shape modelToView(int p0, Position.Bias b0, int p1, diff --git a/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicTabbedPaneUI.java b/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicTabbedPaneUI.java index 360e98eee7a..92d5896bca2 100644 --- a/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicTabbedPaneUI.java +++ b/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicTabbedPaneUI.java @@ -775,7 +775,7 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants { * Returns the baseline for the specified tab. * * @param tab index of tab to get baseline for - * @exception IndexOutOfBoundsException if index is out of range + * @throws IndexOutOfBoundsException if index is out of range * (index < 0 || index >= tab count) * @return baseline or a value < 0 indicating there is no reasonable * baseline diff --git a/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicTextFieldUI.java b/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicTextFieldUI.java index 2e67a99720a..5d767d3b703 100644 --- a/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicTextFieldUI.java +++ b/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicTextFieldUI.java @@ -345,7 +345,7 @@ public class BasicTextFieldUI extends BasicTextUI { * @param pos the position to convert >= 0 * @param a the allocated region to render into * @return the bounding box of the given position - * @exception BadLocationException if the given position does not + * @throws BadLocationException if the given position does not * represent a valid location in the associated document * @see View#modelToView */ @@ -367,9 +367,9 @@ public class BasicTextFieldUI extends BasicTextUI { * position is a boundary of two views. * @param a the allocated region to render into * @return the bounding box of the given position is returned - * @exception BadLocationException if the given position does + * @throws BadLocationException if the given position does * not represent a valid location in the associated document - * @exception IllegalArgumentException for an invalid bias argument + * @throws IllegalArgumentException for an invalid bias argument * @see View#viewToModel */ public Shape modelToView(int p0, Position.Bias b0, diff --git a/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicTextUI.java b/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicTextUI.java index 6e98a57e5c3..881b9557b0c 100644 --- a/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicTextUI.java +++ b/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicTextUI.java @@ -1045,7 +1045,7 @@ public abstract class BasicTextUI extends TextUI implements ViewFactory { * @param tc the text component for which this UI is installed * @param pos the local location in the model to translate >= 0 * @return the coordinates as a rectangle, null if the model is not painted - * @exception BadLocationException if the given position does not + * @throws BadLocationException if the given position does not * represent a valid location in the associated document * @see TextUI#modelToView * @@ -1067,7 +1067,7 @@ public abstract class BasicTextUI extends TextUI implements ViewFactory { * @param tc the text component for which this UI is installed * @param pos the local location in the model to translate >= 0 * @return the coordinates as a rectangle, null if the model is not painted - * @exception BadLocationException if the given position does not + * @throws BadLocationException if the given position does not * represent a valid location in the associated document * @see TextUI#modelToView * @@ -1626,9 +1626,9 @@ public abstract class BasicTextUI extends TextUI implements ViewFactory { * position is a boundary of two views. * @param a the allocated region to render into * @return the bounding box of the given position is returned - * @exception BadLocationException if the given position does + * @throws BadLocationException if the given position does * not represent a valid location in the associated document - * @exception IllegalArgumentException for an invalid bias argument + * @throws IllegalArgumentException for an invalid bias argument * @see View#viewToModel */ public Shape modelToView(int p0, Position.Bias b0, int p1, Position.Bias b1, Shape a) throws BadLocationException { @@ -1674,9 +1674,9 @@ public abstract class BasicTextUI extends TextUI implements ViewFactory { * SwingConstants.NORTH, or SwingConstants.SOUTH. * @return the location within the model that best represents the next * location visual position. - * @exception BadLocationException the given position is not a valid + * @throws BadLocationException the given position is not a valid * position within the document - * @exception IllegalArgumentException for an invalid direction + * @throws IllegalArgumentException for an invalid direction */ public int getNextVisualPositionFrom(int pos, Position.Bias b, Shape a, int direction, diff --git a/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicTransferable.java b/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicTransferable.java index 544c2ebe731..116226188c9 100644 --- a/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicTransferable.java +++ b/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicTransferable.java @@ -130,9 +130,9 @@ class BasicTransferable implements Transferable, UIResource { * * @param flavor the requested flavor for the data * @see DataFlavor#getRepresentationClass - * @exception IOException if the data is no longer available + * @throws IOException if the data is no longer available * in the requested flavor. - * @exception UnsupportedFlavorException if the requested data flavor is + * @throws UnsupportedFlavorException if the requested data flavor is * not supported. */ public Object getTransferData(DataFlavor flavor) throws UnsupportedFlavorException, IOException { diff --git a/src/java.desktop/share/classes/javax/swing/table/AbstractTableModel.java b/src/java.desktop/share/classes/javax/swing/table/AbstractTableModel.java index 886d0ad64b0..99208f3cd26 100644 --- a/src/java.desktop/share/classes/javax/swing/table/AbstractTableModel.java +++ b/src/java.desktop/share/classes/javax/swing/table/AbstractTableModel.java @@ -331,7 +331,7 @@ public abstract class AbstractTableModel implements TableModel, Serializable * FooListeners on this component, * or an empty array if no such * listeners have been added - * @exception ClassCastException if listenerType + * @throws ClassCastException if listenerType * doesn't specify a class or interface that implements * java.util.EventListener * diff --git a/src/java.desktop/share/classes/javax/swing/table/DefaultTableColumnModel.java b/src/java.desktop/share/classes/javax/swing/table/DefaultTableColumnModel.java index ab5ff974eb9..e1a6264a478 100644 --- a/src/java.desktop/share/classes/javax/swing/table/DefaultTableColumnModel.java +++ b/src/java.desktop/share/classes/javax/swing/table/DefaultTableColumnModel.java @@ -109,7 +109,7 @@ public class DefaultTableColumnModel implements TableColumnModel, * event to its listeners. * * @param aColumn the TableColumn to be added - * @exception IllegalArgumentException if aColumn is + * @throws IllegalArgumentException if aColumn is * null * @see #removeColumn */ @@ -170,7 +170,7 @@ public class DefaultTableColumnModel implements TableColumnModel, * * @param columnIndex the index of column to be moved * @param newIndex new index to move the column - * @exception IllegalArgumentException if column or + * @throws IllegalArgumentException if column or * newIndex * are not in the valid range */ @@ -258,7 +258,7 @@ public class DefaultTableColumnModel implements TableColumnModel, * @return the index of the first column in the * tableColumns array whose identifier * is equal to identifier - * @exception IllegalArgumentException if identifier + * @throws IllegalArgumentException if identifier * is null, or if no * TableColumn has this * identifier @@ -368,7 +368,7 @@ public class DefaultTableColumnModel implements TableColumnModel, * an exception is thrown. * * @param newModel the new selection model - * @exception IllegalArgumentException if newModel + * @throws IllegalArgumentException if newModel * is null * @see #getSelectionModel */ @@ -636,7 +636,7 @@ public class DefaultTableColumnModel implements TableColumnModel, * FooListeners on this model, * or an empty array if no such * listeners have been added - * @exception ClassCastException if listenerType + * @throws ClassCastException if listenerType * doesn't specify a class or interface that implements * java.util.EventListener * diff --git a/src/java.desktop/share/classes/javax/swing/table/DefaultTableModel.java b/src/java.desktop/share/classes/javax/swing/table/DefaultTableModel.java index 08dfc85b0a9..cdb3f29b76a 100644 --- a/src/java.desktop/share/classes/javax/swing/table/DefaultTableModel.java +++ b/src/java.desktop/share/classes/javax/swing/table/DefaultTableModel.java @@ -375,7 +375,7 @@ public class DefaultTableModel extends AbstractTableModel implements Serializabl * * @param row the row index of the row to be inserted * @param rowData optional data of the row being added - * @exception ArrayIndexOutOfBoundsException if the row was invalid + * @throws ArrayIndexOutOfBoundsException if the row was invalid */ public void insertRow(int row, Vector rowData) { dataVector.insertElementAt(rowData, row); @@ -390,7 +390,7 @@ public class DefaultTableModel extends AbstractTableModel implements Serializabl * * @param row the row index of the row to be inserted * @param rowData optional data of the row being added - * @exception ArrayIndexOutOfBoundsException if the row was invalid + * @throws ArrayIndexOutOfBoundsException if the row was invalid */ public void insertRow(int row, Object[] rowData) { insertRow(row, convertToVector(rowData)); @@ -438,7 +438,7 @@ public class DefaultTableModel extends AbstractTableModel implements Serializabl * @param start the starting row index to be moved * @param end the ending row index to be moved * @param to the destination of the rows to be moved - * @exception ArrayIndexOutOfBoundsException if any of the elements + * @throws ArrayIndexOutOfBoundsException if any of the elements * would be moved out of the table's range * */ @@ -463,7 +463,7 @@ public class DefaultTableModel extends AbstractTableModel implements Serializabl * of the row being removed will be sent to all the listeners. * * @param row the row index of the row to be removed - * @exception ArrayIndexOutOfBoundsException if the row was invalid + * @throws ArrayIndexOutOfBoundsException if the row was invalid */ public void removeRow(int row) { dataVector.removeElementAt(row); @@ -652,7 +652,7 @@ public class DefaultTableModel extends AbstractTableModel implements Serializabl * @param row the row whose value is to be queried * @param column the column whose value is to be queried * @return the value Object at the specified cell - * @exception ArrayIndexOutOfBoundsException if an invalid row or + * @throws ArrayIndexOutOfBoundsException if an invalid row or * column was given */ public Object getValueAt(int row, int column) { @@ -669,7 +669,7 @@ public class DefaultTableModel extends AbstractTableModel implements Serializabl * @param aValue the new value; this can be null * @param row the row whose value is to be changed * @param column the column whose value is to be changed - * @exception ArrayIndexOutOfBoundsException if an invalid row or + * @throws ArrayIndexOutOfBoundsException if an invalid row or * column was given */ public void setValueAt(Object aValue, int row, int column) { diff --git a/src/java.desktop/share/classes/javax/swing/table/JTableHeader.java b/src/java.desktop/share/classes/javax/swing/table/JTableHeader.java index f36b5646e3d..561d6a71c75 100644 --- a/src/java.desktop/share/classes/javax/swing/table/JTableHeader.java +++ b/src/java.desktop/share/classes/javax/swing/table/JTableHeader.java @@ -550,7 +550,7 @@ public class JTableHeader extends JComponent implements TableColumnModelListener * for listener notifications from the new column model. * * @param columnModel the new data source for this table - * @exception IllegalArgumentException + * @throws IllegalArgumentException * if newModel is null * @see #getColumnModel */ diff --git a/src/java.desktop/share/classes/javax/swing/table/TableColumnModel.java b/src/java.desktop/share/classes/javax/swing/table/TableColumnModel.java index eaaa8447ef7..4cf4870b5e3 100644 --- a/src/java.desktop/share/classes/javax/swing/table/TableColumnModel.java +++ b/src/java.desktop/share/classes/javax/swing/table/TableColumnModel.java @@ -79,7 +79,7 @@ public interface TableColumnModel * * @param columnIndex the index of column to be moved * @param newIndex index of the column's new location - * @exception IllegalArgumentException if columnIndex or + * @throws IllegalArgumentException if columnIndex or * newIndex * are not in the valid range */ @@ -119,7 +119,7 @@ public interface TableColumnModel * @param columnIdentifier the identifier object * @return the index of the first table column * whose identifier is equal to identifier - * @exception IllegalArgumentException if identifier + * @throws IllegalArgumentException if identifier * is null, or no * TableColumn has this * identifier diff --git a/src/java.desktop/share/classes/javax/swing/text/AbstractDocument.java b/src/java.desktop/share/classes/javax/swing/text/AbstractDocument.java index 1b97006bc34..db19b81e8e5 100644 --- a/src/java.desktop/share/classes/javax/swing/text/AbstractDocument.java +++ b/src/java.desktop/share/classes/javax/swing/text/AbstractDocument.java @@ -344,7 +344,7 @@ public abstract class AbstractDocument implements Document, Serializable { * FooListeners on this component, * or an empty array if no such * listeners have been added - * @exception ClassCastException if listenerType + * @throws ClassCastException if listenerType * doesn't specify a class or interface that implements * java.util.EventListener * @@ -604,7 +604,7 @@ public abstract class AbstractDocument implements Document, Serializable { * * @param offs the starting offset >= 0 * @param len the number of characters to remove >= 0 - * @exception BadLocationException the given remove position is not a valid + * @throws BadLocationException the given remove position is not a valid * position within the document * @see Document#remove */ @@ -674,7 +674,7 @@ public abstract class AbstractDocument implements Document, Serializable { * null * is legal, and typically treated as an empty attributeset, * but exact interpretation is left to the subclass - * @exception BadLocationException the given position is not a valid + * @throws BadLocationException the given position is not a valid * position within the document * @since 1.4 */ @@ -718,7 +718,7 @@ public abstract class AbstractDocument implements Document, Serializable { * @param offs the starting offset >= 0 * @param str the string to insert; does nothing with null/empty strings * @param a the attributes for the inserted content - * @exception BadLocationException the given insert position is not a valid + * @throws BadLocationException the given insert position is not a valid * position within the document * @see Document#insertString */ @@ -792,7 +792,7 @@ public abstract class AbstractDocument implements Document, Serializable { * @param offset the starting offset >= 0 * @param length the number of characters to retrieve >= 0 * @return the text - * @exception BadLocationException the range given includes a position + * @throws BadLocationException the range given includes a position * that is not a valid position within the document * @see Document#getText */ @@ -833,7 +833,7 @@ public abstract class AbstractDocument implements Document, Serializable { * @param offset the starting offset >= 0 * @param length the number of characters to retrieve >= 0 * @param txt the Segment object to retrieve the text into - * @exception BadLocationException the range given includes a position + * @throws BadLocationException the range given includes a position * that is not a valid position within the document */ public void getText(int offset, int length, Segment txt) throws BadLocationException { @@ -854,7 +854,7 @@ public abstract class AbstractDocument implements Document, Serializable { * * @param offs the position in the model >= 0 * @return the position - * @exception BadLocationException if the given position does not + * @throws BadLocationException if the given position does not * represent a valid location in the associated document * @see Document#createPosition */ @@ -1354,7 +1354,7 @@ public abstract class AbstractDocument implements Document, Serializable { * Document will be left in a locked state so that no * reading or writing can be done. * - * @exception IllegalStateException thrown on illegal lock + * @throws IllegalStateException thrown on illegal lock * attempt. If the document is implemented properly, this can * only happen if a document listener attempts to mutate the * document. This situation violates the bean event model @@ -1633,7 +1633,7 @@ public abstract class AbstractDocument implements Document, Serializable { * * @param offset the offset in the content >= 0 * @return a Position - * @exception BadLocationException for an invalid offset + * @throws BadLocationException for an invalid offset */ public Position createPosition(int offset) throws BadLocationException; @@ -1652,7 +1652,7 @@ public abstract class AbstractDocument implements Document, Serializable { * @return if the implementation supports a history mechanism, * a reference to an Edit implementation will be returned, * otherwise returns null - * @exception BadLocationException thrown if the area covered by + * @throws BadLocationException thrown if the area covered by * the arguments is not contained in the character sequence */ public UndoableEdit insertString(int where, String str) throws BadLocationException; @@ -1666,7 +1666,7 @@ public abstract class AbstractDocument implements Document, Serializable { * @return If the implementation supports a history mechanism, * a reference to an Edit implementation will be returned, * otherwise null. - * @exception BadLocationException Thrown if the area covered by + * @throws BadLocationException Thrown if the area covered by * the arguments is not contained in the character sequence. */ public UndoableEdit remove(int where, int nitems) throws BadLocationException; @@ -1677,7 +1677,7 @@ public abstract class AbstractDocument implements Document, Serializable { * @param where Offset into the sequence to fetch >= 0. * @param len number of characters to copy >= 0. * @return the string - * @exception BadLocationException Thrown if the area covered by + * @throws BadLocationException Thrown if the area covered by * the arguments is not contained in the character sequence. */ public String getString(int where, int len) throws BadLocationException; @@ -1688,7 +1688,7 @@ public abstract class AbstractDocument implements Document, Serializable { * @param where the starting offset >= 0 * @param len the number of characters >= 0 * @param txt the target location to copy into - * @exception BadLocationException Thrown if the area covered by + * @throws BadLocationException Thrown if the area covered by * the arguments is not contained in the character sequence. */ public void getChars(int where, int len, Segment txt) throws BadLocationException; @@ -2819,7 +2819,7 @@ public abstract class AbstractDocument implements Document, Serializable { /** * Redoes a change. * - * @exception CannotRedoException if the change cannot be redone + * @throws CannotRedoException if the change cannot be redone */ public void redo() throws CannotRedoException { writeLock(); @@ -2843,7 +2843,7 @@ public abstract class AbstractDocument implements Document, Serializable { /** * Undoes a change. * - * @exception CannotUndoException if the change cannot be undone + * @throws CannotUndoException if the change cannot be undone */ public void undo() throws CannotUndoException { writeLock(); @@ -3187,7 +3187,7 @@ public abstract class AbstractDocument implements Document, Serializable { /** * Redoes a change. * - * @exception CannotRedoException if the change cannot be redone + * @throws CannotRedoException if the change cannot be redone */ public void redo() throws CannotRedoException { super.redo(); @@ -3204,7 +3204,7 @@ public abstract class AbstractDocument implements Document, Serializable { /** * Undoes a change. * - * @exception CannotUndoException if the change cannot be undone + * @throws CannotUndoException if the change cannot be undone */ public void undo() throws CannotUndoException { super.undo(); diff --git a/src/java.desktop/share/classes/javax/swing/text/AbstractWriter.java b/src/java.desktop/share/classes/javax/swing/text/AbstractWriter.java index 0ca0fecb5a8..07a8301f0b5 100644 --- a/src/java.desktop/share/classes/javax/swing/text/AbstractWriter.java +++ b/src/java.desktop/share/classes/javax/swing/text/AbstractWriter.java @@ -270,7 +270,7 @@ public abstract class AbstractWriter { * when encountered. * * @param elem an Element - * @exception BadLocationException if pos represents an invalid + * @throws BadLocationException if pos represents an invalid * location within the document * @return the text as a String */ @@ -286,8 +286,8 @@ public abstract class AbstractWriter { * out. * * @param elem an Element. - * @exception IOException on any I/O error - * @exception BadLocationException if pos represents an invalid + * @throws IOException on any I/O error + * @throws BadLocationException if pos represents an invalid * location within the document. */ protected void text(Element elem) throws BadLocationException, @@ -462,7 +462,7 @@ public abstract class AbstractWriter { * line is empty, this will not make it so that the current line is * still considered empty. * - * @exception IOException on any I/O error + * @throws IOException on any I/O error */ protected void indent() throws IOException { int max = getIndentLevel() * getIndentSpace(); @@ -485,7 +485,7 @@ public abstract class AbstractWriter { * the write method that takes a char[]. * * @param ch a char. - * @exception IOException on any I/O error + * @throws IOException on any I/O error */ protected void write(char ch) throws IOException { if (tempChars == null) { @@ -500,7 +500,7 @@ public abstract class AbstractWriter { * write method that takes a char[]. * * @param content a String. - * @exception IOException on any I/O error + * @throws IOException on any I/O error */ protected void write(String content) throws IOException { if (content == null) { @@ -671,7 +671,7 @@ public abstract class AbstractWriter { * pairs. It throws an IOException when encountered. * * @param attr an AttributeSet. - * @exception IOException on any I/O error + * @throws IOException on any I/O error */ protected void writeAttributes(AttributeSet attr) throws IOException { diff --git a/src/java.desktop/share/classes/javax/swing/text/AsyncBoxView.java b/src/java.desktop/share/classes/javax/swing/text/AsyncBoxView.java index a9e4c58fbaa..ac0dd40b28a 100644 --- a/src/java.desktop/share/classes/javax/swing/text/AsyncBoxView.java +++ b/src/java.desktop/share/classes/javax/swing/text/AsyncBoxView.java @@ -640,7 +640,7 @@ public class AsyncBoxView extends View { * Typically the view is told to render into the span * that is returned, although there is no guarantee. * The parent may choose to resize or break the view. - * @exception IllegalArgumentException for an invalid axis type + * @throws IllegalArgumentException for an invalid axis type */ public float getPreferredSpan(int axis) { float margin = getInsetSpan(axis); @@ -665,7 +665,7 @@ public class AsyncBoxView extends View { * Typically the view is told to render into the span * that is returned, although there is no guarantee. * The parent may choose to resize or break the view. - * @exception IllegalArgumentException for an invalid axis type + * @throws IllegalArgumentException for an invalid axis type */ public float getMinimumSpan(int axis) { if (axis == this.axis) { @@ -693,7 +693,7 @@ public class AsyncBoxView extends View { * Typically the view is told to render into the span * that is returned, although there is no guarantee. * The parent may choose to resize or break the view. - * @exception IllegalArgumentException for an invalid axis type + * @throws IllegalArgumentException for an invalid axis type */ public float getMaximumSpan(int axis) { if (axis == this.axis) { @@ -773,9 +773,9 @@ public class AsyncBoxView extends View { * next character represented by the offset, in case the * position is a boundary of two views. * @return the bounding box of the given position is returned - * @exception BadLocationException if the given position does + * @throws BadLocationException if the given position does * not represent a valid location in the associated document - * @exception IllegalArgumentException for an invalid bias argument + * @throws IllegalArgumentException for an invalid bias argument * @see View#viewToModel */ public Shape modelToView(int pos, Shape a, Position.Bias b) throws BadLocationException { @@ -864,9 +864,9 @@ public class AsyncBoxView extends View { * @param biasRet an array contain the bias that was checked * @return the location within the model that best represents the next * location visual position - * @exception BadLocationException the given position is not a valid + * @throws BadLocationException the given position is not a valid * position within the document - * @exception IllegalArgumentException if direction is invalid + * @throws IllegalArgumentException if direction is invalid */ public int getNextVisualPositionFrom(int pos, Position.Bias b, Shape a, int direction, diff --git a/src/java.desktop/share/classes/javax/swing/text/BoxView.java b/src/java.desktop/share/classes/javax/swing/text/BoxView.java index afaefacccf5..cc21e039021 100644 --- a/src/java.desktop/share/classes/javax/swing/text/BoxView.java +++ b/src/java.desktop/share/classes/javax/swing/text/BoxView.java @@ -293,7 +293,7 @@ public class BoxView extends CompositeView { * @param axis may be either View.X_AXIS or * View.Y_AXIS * @return the weight - * @exception IllegalArgumentException for an invalid axis + * @throws IllegalArgumentException for an invalid axis */ public int getResizeWeight(int axis) { checkRequests(axis); @@ -473,7 +473,7 @@ public class BoxView extends CompositeView { * @param pos the position to convert >= 0 * @param a the allocated region to render into * @return the bounding box of the given position - * @exception BadLocationException if the given position does + * @throws BadLocationException if the given position does * not represent a valid location in the associated document * @see View#modelToView */ @@ -519,7 +519,7 @@ public class BoxView extends CompositeView { * origin and 1.0 indicates alignment to the full span * away from the origin; an alignment of 0.5 would be the * center of the view - * @exception IllegalArgumentException for an invalid axis + * @throws IllegalArgumentException for an invalid axis */ public float getAlignment(int axis) { checkRequests(axis); @@ -540,7 +540,7 @@ public class BoxView extends CompositeView { * typically the view is told to render into the span * that is returned, although there is no guarantee; * the parent may choose to resize or break the view - * @exception IllegalArgumentException for an invalid axis type + * @throws IllegalArgumentException for an invalid axis type */ public float getPreferredSpan(int axis) { checkRequests(axis); @@ -563,7 +563,7 @@ public class BoxView extends CompositeView { * typically the view is told to render into the span * that is returned, although there is no guarantee; * the parent may choose to resize or break the view - * @exception IllegalArgumentException for an invalid axis type + * @throws IllegalArgumentException for an invalid axis type */ public float getMinimumSpan(int axis) { checkRequests(axis); @@ -586,7 +586,7 @@ public class BoxView extends CompositeView { * typically the view is told to render into the span * that is returned, although there is no guarantee; * the parent may choose to resize or break the view - * @exception IllegalArgumentException for an invalid axis type + * @throws IllegalArgumentException for an invalid axis type */ public float getMaximumSpan(int axis) { checkRequests(axis); @@ -919,7 +919,7 @@ public class BoxView extends CompositeView { /** * Checks the request cache and update if needed. * @param axis the axis being studied - * @exception IllegalArgumentException if axis is + * @throws IllegalArgumentException if axis is * neither View.X_AXIS nor View.Y_AXIS */ void checkRequests(int axis) { diff --git a/src/java.desktop/share/classes/javax/swing/text/ComponentView.java b/src/java.desktop/share/classes/javax/swing/text/ComponentView.java index a4aaa30e512..0d8743f86ed 100644 --- a/src/java.desktop/share/classes/javax/swing/text/ComponentView.java +++ b/src/java.desktop/share/classes/javax/swing/text/ComponentView.java @@ -132,7 +132,7 @@ public class ComponentView extends View { * Typically the view is told to render into the span * that is returned, although there is no guarantee. * The parent may choose to resize or break the view. - * @exception IllegalArgumentException for an invalid axis + * @throws IllegalArgumentException for an invalid axis */ public float getPreferredSpan(int axis) { if ((axis != X_AXIS) && (axis != Y_AXIS)) { @@ -160,7 +160,7 @@ public class ComponentView extends View { * Typically the view is told to render into the span * that is returned, although there is no guarantee. * The parent may choose to resize or break the view. - * @exception IllegalArgumentException for an invalid axis + * @throws IllegalArgumentException for an invalid axis */ public float getMinimumSpan(int axis) { if ((axis != X_AXIS) && (axis != Y_AXIS)) { @@ -188,7 +188,7 @@ public class ComponentView extends View { * Typically the view is told to render into the span * that is returned, although there is no guarantee. * The parent may choose to resize or break the view. - * @exception IllegalArgumentException for an invalid axis + * @throws IllegalArgumentException for an invalid axis */ public float getMaximumSpan(int axis) { if ((axis != X_AXIS) && (axis != Y_AXIS)) { @@ -325,7 +325,7 @@ public class ComponentView extends View { * @param pos the position to convert >=0 * @param a the allocated region to render into * @return the bounding box of the given position is returned - * @exception BadLocationException if the given position does not + * @throws BadLocationException if the given position does not * represent a valid location in the associated document * @see View#modelToView */ diff --git a/src/java.desktop/share/classes/javax/swing/text/CompositeView.java b/src/java.desktop/share/classes/javax/swing/text/CompositeView.java index 343c02feddc..5220395d35a 100644 --- a/src/java.desktop/share/classes/javax/swing/text/CompositeView.java +++ b/src/java.desktop/share/classes/javax/swing/text/CompositeView.java @@ -244,7 +244,7 @@ public abstract class CompositeView extends View { * @param b a bias value of either Position.Bias.Forward * or Position.Bias.Backward * @return the bounding box of the given position - * @exception BadLocationException if the given position does + * @throws BadLocationException if the given position does * not represent a valid location in the associated document * @see View#modelToView */ @@ -294,9 +294,9 @@ public abstract class CompositeView extends View { * position is a boundary of two views * @param a the allocated region to render into * @return the bounding box of the given position is returned - * @exception BadLocationException if the given position does + * @throws BadLocationException if the given position does * not represent a valid location in the associated document - * @exception IllegalArgumentException for an invalid bias argument + * @throws IllegalArgumentException for an invalid bias argument * @see View#viewToModel */ public Shape modelToView(int p0, Position.Bias b0, int p1, Position.Bias b1, Shape a) throws BadLocationException { @@ -458,9 +458,9 @@ public abstract class CompositeView extends View { * @param biasRet an array containing the bias that was checked * @return the location within the model that best represents the next * location visual position - * @exception BadLocationException the given position is not a valid + * @throws BadLocationException the given position is not a valid * position within the document - * @exception IllegalArgumentException if direction is invalid + * @throws IllegalArgumentException if direction is invalid */ public int getNextVisualPositionFrom(int pos, Position.Bias b, Shape a, int direction, Position.Bias[] biasRet) @@ -715,8 +715,8 @@ public abstract class CompositeView extends View { * @param biasRet an array containing the bias that was checked * @return the location within the model that best represents the next * north or south location - * @exception BadLocationException for a bad location within a document model - * @exception IllegalArgumentException if direction is invalid + * @throws BadLocationException for a bad location within a document model + * @throws IllegalArgumentException if direction is invalid * @see #getNextVisualPositionFrom */ protected int getNextNorthSouthVisualPositionFrom(int pos, Position.Bias b, @@ -748,8 +748,8 @@ public abstract class CompositeView extends View { * @param biasRet an array containing the bias that was checked * @return the location within the model that best represents the next * west or east location - * @exception BadLocationException for a bad location within a document model - * @exception IllegalArgumentException if direction is invalid + * @throws BadLocationException for a bad location within a document model + * @throws IllegalArgumentException if direction is invalid * @see #getNextVisualPositionFrom */ protected int getNextEastWestVisualPositionFrom(int pos, Position.Bias b, diff --git a/src/java.desktop/share/classes/javax/swing/text/DefaultCaret.java b/src/java.desktop/share/classes/javax/swing/text/DefaultCaret.java index a980268bd94..ff4d37224e3 100644 --- a/src/java.desktop/share/classes/javax/swing/text/DefaultCaret.java +++ b/src/java.desktop/share/classes/javax/swing/text/DefaultCaret.java @@ -870,7 +870,7 @@ public class DefaultCaret extends Rectangle implements Caret, FocusListener, Mou * FooListeners on this component, * or an empty array if no such * listeners have been added - * @exception ClassCastException if listenerType + * @throws ClassCastException if listenerType * doesn't specify a class or interface that implements * java.util.EventListener * diff --git a/src/java.desktop/share/classes/javax/swing/text/DefaultEditorKit.java b/src/java.desktop/share/classes/javax/swing/text/DefaultEditorKit.java index ee1db4739ce..2d9971d3794 100644 --- a/src/java.desktop/share/classes/javax/swing/text/DefaultEditorKit.java +++ b/src/java.desktop/share/classes/javax/swing/text/DefaultEditorKit.java @@ -142,8 +142,8 @@ public class DefaultEditorKit extends EditorKit { * @param doc The destination for the insertion. * @param pos The location in the document to place the * content >=0. - * @exception IOException on any I/O error - * @exception BadLocationException if pos represents an invalid + * @throws IOException on any I/O error + * @throws BadLocationException if pos represents an invalid * location within the document. */ public void read(InputStream in, Document doc, int pos) @@ -161,8 +161,8 @@ public class DefaultEditorKit extends EditorKit { * @param pos The location in the document to fetch the * content >=0. * @param len The amount to write out >=0. - * @exception IOException on any I/O error - * @exception BadLocationException if pos represents an invalid + * @throws IOException on any I/O error + * @throws BadLocationException if pos represents an invalid * location within the document. */ public void write(OutputStream out, Document doc, int pos, int len) @@ -193,8 +193,8 @@ public class DefaultEditorKit extends EditorKit { * @param doc The destination for the insertion. * @param pos The location in the document to place the * content >=0. - * @exception IOException on any I/O error - * @exception BadLocationException if pos represents an invalid + * @throws IOException on any I/O error + * @throws BadLocationException if pos represents an invalid * location within the document. */ public void read(Reader in, Document doc, int pos) @@ -303,8 +303,8 @@ public class DefaultEditorKit extends EditorKit { * @param pos The location in the document to fetch the * content from >=0. * @param len The amount to write out >=0. - * @exception IOException on any I/O error - * @exception BadLocationException if pos is not within 0 and + * @throws IOException on any I/O error + * @throws BadLocationException if pos is not within 0 and * the length of the document. */ public void write(Writer out, Document doc, int pos, int len) diff --git a/src/java.desktop/share/classes/javax/swing/text/DefaultHighlighter.java b/src/java.desktop/share/classes/javax/swing/text/DefaultHighlighter.java index 4e874ec1f00..0465b9157e2 100644 --- a/src/java.desktop/share/classes/javax/swing/text/DefaultHighlighter.java +++ b/src/java.desktop/share/classes/javax/swing/text/DefaultHighlighter.java @@ -110,7 +110,7 @@ public class DefaultHighlighter extends LayeredHighlighter { * @param p the painter to use to actually render the highlight * @return an object that can be used as a tag * to refer to the highlight - * @exception BadLocationException if the specified location is invalid + * @throws BadLocationException if the specified location is invalid */ public Object addHighlight(int p0, int p1, Highlighter.HighlightPainter p) throws BadLocationException { if (p0 < 0) { @@ -222,7 +222,7 @@ public class DefaultHighlighter extends LayeredHighlighter { * @param tag the highlight tag * @param p0 the beginning of the range >= 0 * @param p1 the end of the range >= p0 - * @exception BadLocationException if the specified location is invalid + * @throws BadLocationException if the specified location is invalid */ public void changeHighlight(Object tag, int p0, int p1) throws BadLocationException { if (p0 < 0) { diff --git a/src/java.desktop/share/classes/javax/swing/text/DefaultStyledDocument.java b/src/java.desktop/share/classes/javax/swing/text/DefaultStyledDocument.java index f549f522ff2..5d373177eaf 100644 --- a/src/java.desktop/share/classes/javax/swing/text/DefaultStyledDocument.java +++ b/src/java.desktop/share/classes/javax/swing/text/DefaultStyledDocument.java @@ -182,7 +182,7 @@ public class DefaultStyledDocument extends AbstractDocument implements StyledDoc * * @param offset the starting offset >= 0 * @param data the element data - * @exception BadLocationException for an invalid starting offset + * @throws BadLocationException for an invalid starting offset */ protected void insert(int offset, ElementSpec[] data) throws BadLocationException { if (data == null || data.length == 0) { @@ -2548,7 +2548,7 @@ public class DefaultStyledDocument extends AbstractDocument implements StyledDoc /** * Redoes a change. * - * @exception CannotRedoException if the change cannot be redone + * @throws CannotRedoException if the change cannot be redone */ public void redo() throws CannotRedoException { super.redo(); @@ -2562,7 +2562,7 @@ public class DefaultStyledDocument extends AbstractDocument implements StyledDoc /** * Undoes a change. * - * @exception CannotUndoException if the change cannot be undone + * @throws CannotUndoException if the change cannot be undone */ public void undo() throws CannotUndoException { super.undo(); @@ -2604,7 +2604,7 @@ public class DefaultStyledDocument extends AbstractDocument implements StyledDoc /** * Redoes a change. * - * @exception CannotRedoException if the change cannot be redone + * @throws CannotRedoException if the change cannot be redone */ public void redo() throws CannotRedoException { super.redo(); @@ -2614,7 +2614,7 @@ public class DefaultStyledDocument extends AbstractDocument implements StyledDoc /** * Undoes a change. * - * @exception CannotUndoException if the change cannot be undone + * @throws CannotUndoException if the change cannot be undone */ public void undo() throws CannotUndoException { super.undo(); diff --git a/src/java.desktop/share/classes/javax/swing/text/Document.java b/src/java.desktop/share/classes/javax/swing/text/Document.java index e0f4ac791d5..09f162733cf 100644 --- a/src/java.desktop/share/classes/javax/swing/text/Document.java +++ b/src/java.desktop/share/classes/javax/swing/text/Document.java @@ -453,7 +453,7 @@ public interface Document { * * @param offs the offset from the beginning >= 0 * @param len the number of characters to remove >= 0 - * @exception BadLocationException some portion of the removal range + * @throws BadLocationException some portion of the removal range * was not a valid part of the document. The location in the exception * is the first bad position encountered. * @see javax.swing.event.DocumentEvent @@ -490,7 +490,7 @@ public interface Document { * @param str the string to insert * @param a the attributes to associate with the inserted * content. This may be null if there are no attributes. - * @exception BadLocationException the given insert position is not a valid + * @throws BadLocationException the given insert position is not a valid * position within the document * @see javax.swing.event.DocumentEvent * @see javax.swing.event.DocumentListener @@ -507,7 +507,7 @@ public interface Document { * start of the text >= 0 * @param length the length of the desired string >= 0 * @return the text, in a String of length >= 0 - * @exception BadLocationException some portion of the given range + * @throws BadLocationException some portion of the given range * was not a valid part of the document. The location in the exception * is the first bad position encountered. */ @@ -546,7 +546,7 @@ public interface Document { * @param length the length of the desired string >= 0 * @param txt the Segment object to return the text in * - * @exception BadLocationException Some portion of the given range + * @throws BadLocationException Some portion of the given range * was not a valid part of the document. The location in the exception * is the first bad position encountered. */ @@ -582,7 +582,7 @@ public interface Document { * * @param offs the offset from the start of the document >= 0 * @return the position - * @exception BadLocationException if the given position does not + * @throws BadLocationException if the given position does not * represent a valid location in the associated document */ public Position createPosition(int offs) throws BadLocationException; diff --git a/src/java.desktop/share/classes/javax/swing/text/DocumentFilter.java b/src/java.desktop/share/classes/javax/swing/text/DocumentFilter.java index 5f69882ff8e..d0334bce45e 100644 --- a/src/java.desktop/share/classes/javax/swing/text/DocumentFilter.java +++ b/src/java.desktop/share/classes/javax/swing/text/DocumentFilter.java @@ -75,7 +75,7 @@ public class DocumentFilter { * @param fb FilterBypass that can be used to mutate Document * @param offset the offset from the beginning >= 0 * @param length the number of characters to remove >= 0 - * @exception BadLocationException some portion of the removal range + * @throws BadLocationException some portion of the removal range * was not a valid part of the document. The location in the exception * is the first bad position encountered. */ @@ -97,7 +97,7 @@ public class DocumentFilter { * @param string the string to insert * @param attr the attributes to associate with the inserted * content. This may be null if there are no attributes. - * @exception BadLocationException the given insert position is not a + * @throws BadLocationException the given insert position is not a * valid position within the document */ public void insertString(FilterBypass fb, int offset, String string, @@ -117,7 +117,7 @@ public class DocumentFilter { * @param text Text to insert, null indicates no text to insert * @param attrs AttributeSet indicating attributes of inserted text, * null is legal. - * @exception BadLocationException the given insert position is not a + * @throws BadLocationException the given insert position is not a * valid position within the document */ public void replace(FilterBypass fb, int offset, int length, String text, @@ -153,7 +153,7 @@ public class DocumentFilter { * * @param offset the offset from the beginning >= 0 * @param length the number of characters to remove >= 0 - * @exception BadLocationException some portion of the removal range + * @throws BadLocationException some portion of the removal range * was not a valid part of the document. The location in the * exception is the first bad position encountered. */ @@ -169,7 +169,7 @@ public class DocumentFilter { * @param string the string to insert * @param attr the attributes to associate with the inserted * content. This may be null if there are no attributes. - * @exception BadLocationException the given insert position is not a + * @throws BadLocationException the given insert position is not a * valid position within the document */ public abstract void insertString(int offset, String string, @@ -186,7 +186,7 @@ public class DocumentFilter { * @param string Text to insert, null indicates no text to insert * @param attrs AttributeSet indicating attributes of inserted text, * null is legal. - * @exception BadLocationException the given insert is not a + * @throws BadLocationException the given insert is not a * valid position within the document */ public abstract void replace(int offset, int length, String string, diff --git a/src/java.desktop/share/classes/javax/swing/text/EditorKit.java b/src/java.desktop/share/classes/javax/swing/text/EditorKit.java index 9163a6361e4..cd491fb5bac 100644 --- a/src/java.desktop/share/classes/javax/swing/text/EditorKit.java +++ b/src/java.desktop/share/classes/javax/swing/text/EditorKit.java @@ -141,8 +141,8 @@ public abstract class EditorKit implements Cloneable, Serializable { * @param doc The destination for the insertion. * @param pos The location in the document to place the * content >= 0. - * @exception IOException on any I/O error - * @exception BadLocationException if pos represents an invalid + * @throws IOException on any I/O error + * @throws BadLocationException if pos represents an invalid * location within the document. */ public abstract void read(InputStream in, Document doc, int pos) @@ -157,8 +157,8 @@ public abstract class EditorKit implements Cloneable, Serializable { * @param pos The location in the document to fetch the * content from >= 0. * @param len The amount to write out >= 0. - * @exception IOException on any I/O error - * @exception BadLocationException if pos represents an invalid + * @throws IOException on any I/O error + * @throws BadLocationException if pos represents an invalid * location within the document. */ public abstract void write(OutputStream out, Document doc, int pos, int len) @@ -178,8 +178,8 @@ public abstract class EditorKit implements Cloneable, Serializable { * @param doc The destination for the insertion. * @param pos The location in the document to place the * content >= 0. - * @exception IOException on any I/O error - * @exception BadLocationException if pos represents an invalid + * @throws IOException on any I/O error + * @throws BadLocationException if pos represents an invalid * location within the document. */ public abstract void read(Reader in, Document doc, int pos) @@ -199,8 +199,8 @@ public abstract class EditorKit implements Cloneable, Serializable { * @param pos The location in the document to fetch the * content >= 0. * @param len The amount to write out >= 0. - * @exception IOException on any I/O error - * @exception BadLocationException if pos represents an invalid + * @throws IOException on any I/O error + * @throws BadLocationException if pos represents an invalid * location within the document. */ public abstract void write(Writer out, Document doc, int pos, int len) diff --git a/src/java.desktop/share/classes/javax/swing/text/FieldView.java b/src/java.desktop/share/classes/javax/swing/text/FieldView.java index 936a78700be..b5ad6369945 100644 --- a/src/java.desktop/share/classes/javax/swing/text/FieldView.java +++ b/src/java.desktop/share/classes/javax/swing/text/FieldView.java @@ -258,7 +258,7 @@ public class FieldView extends PlainView { * @param pos the position to convert >= 0 * @param a the allocated region to render into * @return the bounding box of the given position - * @exception BadLocationException if the given position does not + * @throws BadLocationException if the given position does not * represent a valid location in the associated document * @see View#modelToView */ diff --git a/src/java.desktop/share/classes/javax/swing/text/GapContent.java b/src/java.desktop/share/classes/javax/swing/text/GapContent.java index c59c350541b..6c96b2b0ec3 100644 --- a/src/java.desktop/share/classes/javax/swing/text/GapContent.java +++ b/src/java.desktop/share/classes/javax/swing/text/GapContent.java @@ -130,7 +130,7 @@ public class GapContent extends GapVector implements AbstractDocument.Content, S * @param where the starting position >= 0, < length() * @param str the non-null string to insert * @return an UndoableEdit object for undoing - * @exception BadLocationException if the specified position is invalid + * @throws BadLocationException if the specified position is invalid * @see AbstractDocument.Content#insertString */ public UndoableEdit insertString(int where, String str) throws BadLocationException { @@ -148,7 +148,7 @@ public class GapContent extends GapVector implements AbstractDocument.Content, S * @param where the starting position >= 0, where + nitems < length() * @param nitems the number of characters to remove >= 0 * @return an UndoableEdit object for undoing - * @exception BadLocationException if the specified position is invalid + * @throws BadLocationException if the specified position is invalid * @see AbstractDocument.Content#remove */ public UndoableEdit remove(int where, int nitems) throws BadLocationException { @@ -168,7 +168,7 @@ public class GapContent extends GapVector implements AbstractDocument.Content, S * @param where the starting position >= 0 * @param len the length to retrieve >= 0 * @return a string representing the content - * @exception BadLocationException if the specified position is invalid + * @throws BadLocationException if the specified position is invalid * @see AbstractDocument.Content#getString */ public String getString(int where, int len) throws BadLocationException { @@ -186,7 +186,7 @@ public class GapContent extends GapVector implements AbstractDocument.Content, S * @param where the starting position >= 0, where + len <= length() * @param len the number of characters to retrieve >= 0 * @param chars the Segment object to return the characters in - * @exception BadLocationException if the specified position is invalid + * @throws BadLocationException if the specified position is invalid * @see AbstractDocument.Content#getChars */ public void getChars(int where, int len, Segment chars) throws BadLocationException { @@ -237,7 +237,7 @@ public class GapContent extends GapVector implements AbstractDocument.Content, S * * @param offset the offset to track >= 0 * @return the position - * @exception BadLocationException if the specified position is invalid + * @throws BadLocationException if the specified position is invalid */ public Position createPosition(int offset) throws BadLocationException { while ( queue.poll() != null ) { diff --git a/src/java.desktop/share/classes/javax/swing/text/GlyphPainter2.java b/src/java.desktop/share/classes/javax/swing/text/GlyphPainter2.java index 3a070bb4040..59e2a9da491 100644 --- a/src/java.desktop/share/classes/javax/swing/text/GlyphPainter2.java +++ b/src/java.desktop/share/classes/javax/swing/text/GlyphPainter2.java @@ -231,8 +231,8 @@ class GlyphPainter2 extends GlyphView.GlyphPainter { * SwingConstants.NORTH, or SwingConstants.SOUTH. * @return the location within the model that best represents the next * location visual position. - * @exception BadLocationException - * @exception IllegalArgumentException for an invalid direction + * @throws BadLocationException + * @throws IllegalArgumentException for an invalid direction */ public int getNextVisualPositionFrom(GlyphView v, int pos, Position.Bias b, Shape a, diff --git a/src/java.desktop/share/classes/javax/swing/text/GlyphView.java b/src/java.desktop/share/classes/javax/swing/text/GlyphView.java index b075356593c..8a4828f62d5 100644 --- a/src/java.desktop/share/classes/javax/swing/text/GlyphView.java +++ b/src/java.desktop/share/classes/javax/swing/text/GlyphView.java @@ -637,7 +637,7 @@ public class GlyphView extends View implements TabableView, Cloneable { * @param b either Position.Bias.Forward * or Position.Bias.Backward * @return the bounding box of the given position - * @exception BadLocationException if the given position does not represent a + * @throws BadLocationException if the given position does not represent a * valid location in the associated document * @see View#modelToView */ @@ -885,9 +885,9 @@ public class GlyphView extends View implements TabableView, Cloneable { * SwingConstants.NORTH, or SwingConstants.SOUTH. * @return the location within the model that best represents the next * location visual position. - * @exception BadLocationException the given position is not a valid + * @throws BadLocationException the given position is not a valid * position within the document - * @exception IllegalArgumentException for an invalid direction + * @throws IllegalArgumentException for an invalid direction */ public int getNextVisualPositionFrom(int pos, Position.Bias b, Shape a, int direction, @@ -1199,7 +1199,7 @@ public class GlyphView extends View implements TabableView, Cloneable { * or Position.Bias.Backward * @param a Bounds of the View * @return the bounding box of the given position - * @exception BadLocationException if the given position does not represent a + * @throws BadLocationException if the given position does not represent a * valid location in the associated document * @see View#modelToView */ @@ -1283,8 +1283,8 @@ public class GlyphView extends View implements TabableView, Cloneable { * is returned as the zero-th element of this array * @return the location within the model that best represents the next * location visual position. - * @exception BadLocationException for a bad location within a document model - * @exception IllegalArgumentException for an invalid direction + * @throws BadLocationException for a bad location within a document model + * @throws IllegalArgumentException for an invalid direction */ public int getNextVisualPositionFrom(GlyphView v, int pos, Position.Bias b, Shape a, int direction, diff --git a/src/java.desktop/share/classes/javax/swing/text/Highlighter.java b/src/java.desktop/share/classes/javax/swing/text/Highlighter.java index 10243f10cdd..7913e47b948 100644 --- a/src/java.desktop/share/classes/javax/swing/text/Highlighter.java +++ b/src/java.desktop/share/classes/javax/swing/text/Highlighter.java @@ -70,7 +70,7 @@ public interface Highlighter { * @param p1 the end of the range >= p0 * @param p the painter to use for the actual highlighting * @return an object that refers to the highlight - * @exception BadLocationException for an invalid range specification + * @throws BadLocationException for an invalid range specification */ public Object addHighlight(int p0, int p1, HighlightPainter p) throws BadLocationException; @@ -95,7 +95,7 @@ public interface Highlighter { * @param tag which highlight to change * @param p0 the beginning of the range >= 0 * @param p1 the end of the range >= p0 - * @exception BadLocationException for an invalid range specification + * @throws BadLocationException for an invalid range specification */ public void changeHighlight(Object tag, int p0, int p1) throws BadLocationException; diff --git a/src/java.desktop/share/classes/javax/swing/text/IconView.java b/src/java.desktop/share/classes/javax/swing/text/IconView.java index c908e973753..76cb653c9ae 100644 --- a/src/java.desktop/share/classes/javax/swing/text/IconView.java +++ b/src/java.desktop/share/classes/javax/swing/text/IconView.java @@ -81,7 +81,7 @@ public class IconView extends View { * Typically the view is told to render into the span * that is returned, although there is no guarantee. * The parent may choose to resize or break the view. - * @exception IllegalArgumentException for an invalid axis + * @throws IllegalArgumentException for an invalid axis */ public float getPreferredSpan(int axis) { switch (axis) { @@ -123,7 +123,7 @@ public class IconView extends View { * @param pos the position to convert >= 0 * @param a the allocated region to render into * @return the bounding box of the given position - * @exception BadLocationException if the given position does not + * @throws BadLocationException if the given position does not * represent a valid location in the associated document * @see View#modelToView */ diff --git a/src/java.desktop/share/classes/javax/swing/text/JTextComponent.java b/src/java.desktop/share/classes/javax/swing/text/JTextComponent.java index cbdd308cc84..d618dc6a2a1 100644 --- a/src/java.desktop/share/classes/javax/swing/text/JTextComponent.java +++ b/src/java.desktop/share/classes/javax/swing/text/JTextComponent.java @@ -672,7 +672,7 @@ public abstract class JTextComponent extends JComponent implements Scrollable, A * component's {@code TransferHandler}. * * @param b whether or not to enable automatic drag handling - * @exception HeadlessException if + * @throws HeadlessException if * b is true and * GraphicsEnvironment.isHeadless() * returns true @@ -1358,7 +1358,7 @@ public abstract class JTextComponent extends JComponent implements Scrollable, A * @param offs the offset ≥ 0 * @param len the length ≥ 0 * @return the text - * @exception BadLocationException if the offset or length are invalid + * @throws BadLocationException if the offset or length are invalid */ public String getText(int offs, int len) throws BadLocationException { return getDocument().getText(offs, len); @@ -1376,7 +1376,7 @@ public abstract class JTextComponent extends JComponent implements Scrollable, A * @return the coordinates as a rectangle, with (r.x, r.y) as the location * in the coordinate system, or null if the component does * not yet have a positive size. - * @exception BadLocationException if the given position does not + * @throws BadLocationException if the given position does not * represent a valid location in the associated document * @see TextUI#modelToView * @@ -1400,7 +1400,7 @@ public abstract class JTextComponent extends JComponent implements Scrollable, A * @return the coordinates as a rectangle, with (r.x, r.y) as the location * in the coordinate system, or null if the component does * not yet have a positive size. - * @exception BadLocationException if the given position does not + * @throws BadLocationException if the given position does not * represent a valid location in the associated document * @see TextUI#modelToView2D * @@ -1545,7 +1545,7 @@ public abstract class JTextComponent extends JComponent implements Scrollable, A * an exception is thrown. * * @param pos the position - * @exception IllegalArgumentException if the value supplied + * @throws IllegalArgumentException if the value supplied * for position is less than zero or greater * than the component's text length * @see #setCaretPosition @@ -1617,7 +1617,7 @@ public abstract class JTextComponent extends JComponent implements Scrollable, A * of documents (such as html for example) might be * able to make use of this information; if non-null, * it is added as a property of the document - * @exception IOException as thrown by the stream being + * @throws IOException as thrown by the stream being * used to initialize * @see EditorKit#createDefaultDocument * @see #setDocument @@ -1643,7 +1643,7 @@ public abstract class JTextComponent extends JComponent implements Scrollable, A * text. * * @param out the output stream - * @exception IOException on any I/O error + * @throws IOException on any I/O error */ public void write(Writer out) throws IOException { Document doc = getDocument(); @@ -1672,7 +1672,7 @@ public abstract class JTextComponent extends JComponent implements Scrollable, A * an exception is thrown. * * @param position the position - * @exception IllegalArgumentException if the value supplied + * @throws IllegalArgumentException if the value supplied * for position is less than zero or greater * than the component's text length */ @@ -1743,7 +1743,7 @@ public abstract class JTextComponent extends JComponent implements Scrollable, A * use DocumentListener. * * @return the text - * @exception NullPointerException if the document is null + * @throws NullPointerException if the document is null * @see #setText */ public String getText() { @@ -1763,7 +1763,7 @@ public abstract class JTextComponent extends JComponent implements Scrollable, A * null or the document empty, returns null. * * @return the text - * @exception IllegalArgumentException if the selection doesn't + * @throws IllegalArgumentException if the selection doesn't * have a valid mapping into the document for some reason * @see #setText */ @@ -2013,7 +2013,7 @@ public abstract class JTextComponent extends JComponent implements Scrollable, A * @param direction less than zero to scroll up/left, greater than * zero for down/right * @return the "unit" increment for scrolling in the specified direction - * @exception IllegalArgumentException for an invalid orientation + * @throws IllegalArgumentException for an invalid orientation * @see JScrollBar#setUnitIncrement */ public int getScrollableUnitIncrement(Rectangle visibleRect, int orientation, int direction) { @@ -2043,7 +2043,7 @@ public abstract class JTextComponent extends JComponent implements Scrollable, A * @param direction less than zero to scroll up/left, greater than zero * for down/right * @return the "block" increment for scrolling in the specified direction - * @exception IllegalArgumentException for an invalid orientation + * @throws IllegalArgumentException for an invalid orientation * @see JScrollBar#setBlockIncrement */ public int getScrollableBlockIncrement(Rectangle visibleRect, int orientation, int direction) { diff --git a/src/java.desktop/share/classes/javax/swing/text/NavigationFilter.java b/src/java.desktop/share/classes/javax/swing/text/NavigationFilter.java index 648625e8974..a7d85a71e02 100644 --- a/src/java.desktop/share/classes/javax/swing/text/NavigationFilter.java +++ b/src/java.desktop/share/classes/javax/swing/text/NavigationFilter.java @@ -105,8 +105,8 @@ public class NavigationFilter { * @param biasRet Used to return resulting Bias of next position * @return the location within the model that best represents the next * location visual position - * @exception BadLocationException for a bad location within a document model - * @exception IllegalArgumentException if direction + * @throws BadLocationException for a bad location within a document model + * @throws IllegalArgumentException if direction * doesn't have one of the legal values above */ public int getNextVisualPositionFrom(JTextComponent text, int pos, diff --git a/src/java.desktop/share/classes/javax/swing/text/ParagraphView.java b/src/java.desktop/share/classes/javax/swing/text/ParagraphView.java index f8d0e390cb2..e24583af13b 100644 --- a/src/java.desktop/share/classes/javax/swing/text/ParagraphView.java +++ b/src/java.desktop/share/classes/javax/swing/text/ParagraphView.java @@ -876,7 +876,7 @@ public class ParagraphView extends FlowView implements TabExpander { * @param pos the position to convert * @param a the allocated region to render into * @return the bounding box of the given position - * @exception BadLocationException if the given position does not represent a + * @throws BadLocationException if the given position does not represent a * valid location in the associated document * @see View#modelToView */ diff --git a/src/java.desktop/share/classes/javax/swing/text/PasswordView.java b/src/java.desktop/share/classes/javax/swing/text/PasswordView.java index 38bb0eec13e..bdf8d5cdfe6 100644 --- a/src/java.desktop/share/classes/javax/swing/text/PasswordView.java +++ b/src/java.desktop/share/classes/javax/swing/text/PasswordView.java @@ -61,7 +61,7 @@ public class PasswordView extends FieldView { * @param p0 the starting offset in the model >= 0 * @param p1 the ending offset in the model >= p0 * @return the X location of the end of the range >= 0 - * @exception BadLocationException if p0 or p1 are out of range + * @throws BadLocationException if p0 or p1 are out of range * * @deprecated replaced by * {@link #drawUnselectedText(Graphics2D, float, float, int, int)} @@ -131,7 +131,7 @@ public class PasswordView extends FieldView { * @param p0 the starting offset in the model >= 0 * @param p1 the ending offset in the model >= p0 * @return the X location of the end of the range >= 0 - * @exception BadLocationException if p0 or p1 are out of range + * @throws BadLocationException if p0 or p1 are out of range * * @deprecated replaced by * {@link #drawSelectedText(Graphics2D, float, float, int, int)} @@ -240,7 +240,7 @@ public class PasswordView extends FieldView { * @param pos the position to convert >= 0 * @param a the allocated region to render into * @return the bounding box of the given position - * @exception BadLocationException if the given position does not + * @throws BadLocationException if the given position does not * represent a valid location in the associated document * @see View#modelToView */ diff --git a/src/java.desktop/share/classes/javax/swing/text/PlainDocument.java b/src/java.desktop/share/classes/javax/swing/text/PlainDocument.java index cd397d12a68..ad6a0bdf2d3 100644 --- a/src/java.desktop/share/classes/javax/swing/text/PlainDocument.java +++ b/src/java.desktop/share/classes/javax/swing/text/PlainDocument.java @@ -107,7 +107,7 @@ public class PlainDocument extends AbstractDocument { * @param offs the starting offset >= 0 * @param str the string to insert; does nothing with null/empty strings * @param a the attributes for the inserted content - * @exception BadLocationException the given insert position is not a valid + * @throws BadLocationException the given insert position is not a valid * position within the document * @see Document#insertString */ diff --git a/src/java.desktop/share/classes/javax/swing/text/PlainView.java b/src/java.desktop/share/classes/javax/swing/text/PlainView.java index 725dec9bb7d..0c245196d99 100644 --- a/src/java.desktop/share/classes/javax/swing/text/PlainView.java +++ b/src/java.desktop/share/classes/javax/swing/text/PlainView.java @@ -179,7 +179,7 @@ public class PlainView extends View implements TabExpander { * @param p0 the beginning position in the model >= 0 * @param p1 the ending position in the model >= 0 * @return the X location of the end of the range >= 0 - * @exception BadLocationException if the range is invalid + * @throws BadLocationException if the range is invalid * * @deprecated replaced by * {@link #drawUnselectedText(Graphics2D, float, float, int, int)} @@ -224,7 +224,7 @@ public class PlainView extends View implements TabExpander { * @param p0 the beginning position in the model {@code >= 0} * @param p1 the ending position in the model {@code >= 0} * @return the X location of the end of the range {@code >= 0} - * @exception BadLocationException if the range is invalid + * @throws BadLocationException if the range is invalid * * @since 9 */ @@ -245,7 +245,7 @@ public class PlainView extends View implements TabExpander { * @param p0 the beginning position in the model >= 0 * @param p1 the ending position in the model >= 0 * @return the location of the end of the range - * @exception BadLocationException if the range is invalid + * @throws BadLocationException if the range is invalid * * @deprecated replaced by * {@link #drawSelectedText(Graphics2D, float, float, int, int)} @@ -294,7 +294,7 @@ public class PlainView extends View implements TabExpander { * @param p0 the beginning position in the model {@code >= 0} * @param p1 the ending position in the model {@code >= 0} * @return the location of the end of the range - * @exception BadLocationException if the range is invalid + * @throws BadLocationException if the range is invalid * * @since 9 */ @@ -351,7 +351,7 @@ public class PlainView extends View implements TabExpander { * Typically the view is told to render into the span * that is returned, although there is no guarantee. * The parent may choose to resize or break the view. - * @exception IllegalArgumentException for an invalid axis + * @throws IllegalArgumentException for an invalid axis */ public float getPreferredSpan(int axis) { updateMetrics(); @@ -468,7 +468,7 @@ public class PlainView extends View implements TabExpander { * @param pos the position to convert >= 0 * @param a the allocated region to render into * @return the bounding box of the given position - * @exception BadLocationException if the given position does not + * @throws BadLocationException if the given position does not * represent a valid location in the associated document * @see View#modelToView */ diff --git a/src/java.desktop/share/classes/javax/swing/text/StringContent.java b/src/java.desktop/share/classes/javax/swing/text/StringContent.java index 7f154df38ed..04bd4d7e0b4 100644 --- a/src/java.desktop/share/classes/javax/swing/text/StringContent.java +++ b/src/java.desktop/share/classes/javax/swing/text/StringContent.java @@ -90,7 +90,7 @@ public final class StringContent implements AbstractDocument.Content, Serializab * @param where the starting position >= 0 && < length() * @param str the non-null string to insert * @return an UndoableEdit object for undoing - * @exception BadLocationException if the specified position is invalid + * @throws BadLocationException if the specified position is invalid * @see AbstractDocument.Content#insertString */ public UndoableEdit insertString(int where, String str) throws BadLocationException { @@ -111,7 +111,7 @@ public final class StringContent implements AbstractDocument.Content, Serializab * @param where the starting position >= 0 * @param nitems the number of characters to remove >= 0 * @return an UndoableEdit object for undoing - * @exception BadLocationException if the specified position is invalid + * @throws BadLocationException if the specified position is invalid * @see AbstractDocument.Content#remove */ public UndoableEdit remove(int where, int nitems) throws BadLocationException { @@ -134,7 +134,7 @@ public final class StringContent implements AbstractDocument.Content, Serializab * @param where the starting position >= 0 * @param len the length to retrieve >= 0 * @return a string representing the content; may be empty - * @exception BadLocationException if the specified position is invalid + * @throws BadLocationException if the specified position is invalid * @see AbstractDocument.Content#getString */ public String getString(int where, int len) throws BadLocationException { @@ -150,7 +150,7 @@ public final class StringContent implements AbstractDocument.Content, Serializab * @param where the starting position >= 0 * @param len the number of characters to retrieve >= 0 * @param chars the Segment object to return the characters in - * @exception BadLocationException if the specified position is invalid + * @throws BadLocationException if the specified position is invalid * @see AbstractDocument.Content#getChars */ public void getChars(int where, int len, Segment chars) throws BadLocationException { @@ -168,7 +168,7 @@ public final class StringContent implements AbstractDocument.Content, Serializab * * @param offset the offset to create a position for >= 0 * @return the position - * @exception BadLocationException if the specified position is invalid + * @throws BadLocationException if the specified position is invalid */ public Position createPosition(int offset) throws BadLocationException { // some small documents won't have any sticky positions diff --git a/src/java.desktop/share/classes/javax/swing/text/StyleContext.java b/src/java.desktop/share/classes/javax/swing/text/StyleContext.java index 9e01aecd3fb..70da1356b99 100644 --- a/src/java.desktop/share/classes/javax/swing/text/StyleContext.java +++ b/src/java.desktop/share/classes/javax/swing/text/StyleContext.java @@ -579,7 +579,7 @@ public class StyleContext implements Serializable, AbstractDocument.AttributeCon * Context-specific handling of writing out attributes * @param out the output stream * @param a the attribute set - * @exception IOException on any I/O error + * @throws IOException on any I/O error */ public void writeAttributes(ObjectOutputStream out, AttributeSet a) throws IOException { @@ -591,9 +591,9 @@ public class StyleContext implements Serializable, AbstractDocument.AttributeCon * @param in the object stream to read the attribute data from. * @param a the attribute set to place the attribute * definitions in. - * @exception ClassNotFoundException passed upward if encountered + * @throws ClassNotFoundException passed upward if encountered * when reading the object stream. - * @exception IOException passed upward if encountered when + * @throws IOException passed upward if encountered when * reading the object stream. */ public void readAttributes(ObjectInputStream in, @@ -613,7 +613,7 @@ public class StyleContext implements Serializable, AbstractDocument.AttributeCon * * @param out the output stream * @param a the attribute set - * @exception IOException on any I/O error + * @throws IOException on any I/O error */ public static void writeAttributeSet(ObjectOutputStream out, AttributeSet a) throws IOException { @@ -660,9 +660,9 @@ public class StyleContext implements Serializable, AbstractDocument.AttributeCon * @param in the object stream to read the attribute data from. * @param a the attribute set to place the attribute * definitions in. - * @exception ClassNotFoundException passed upward if encountered + * @throws ClassNotFoundException passed upward if encountered * when reading the object stream. - * @exception IOException passed upward if encountered when + * @throws IOException passed upward if encountered when * reading the object stream. */ public static void readAttributeSet(ObjectInputStream in, @@ -1077,7 +1077,7 @@ public class StyleContext implements Serializable, AbstractDocument.AttributeCon * Returns the next element of this enumeration. * * @return the next element of this enumeration. - * @exception NoSuchElementException if no more elements exist. + * @throws NoSuchElementException if no more elements exist. * @since 1.0 */ public Object nextElement() { diff --git a/src/java.desktop/share/classes/javax/swing/text/StyledEditorKit.java b/src/java.desktop/share/classes/javax/swing/text/StyledEditorKit.java index 00ad982cbf4..a4984efce6c 100644 --- a/src/java.desktop/share/classes/javax/swing/text/StyledEditorKit.java +++ b/src/java.desktop/share/classes/javax/swing/text/StyledEditorKit.java @@ -411,7 +411,7 @@ public class StyledEditorKit extends DefaultEditorKit { * * @param e the editor * @return the document - * @exception IllegalArgumentException for the wrong document type + * @throws IllegalArgumentException for the wrong document type */ protected final StyledDocument getStyledDocument(JEditorPane e) { Document d = e.getDocument(); @@ -426,7 +426,7 @@ public class StyledEditorKit extends DefaultEditorKit { * * @param e the editor pane * @return the kit - * @exception IllegalArgumentException for the wrong document type + * @throws IllegalArgumentException for the wrong document type */ protected final StyledEditorKit getStyledEditorKit(JEditorPane e) { EditorKit k = e.getEditorKit(); diff --git a/src/java.desktop/share/classes/javax/swing/text/TableView.java b/src/java.desktop/share/classes/javax/swing/text/TableView.java index bd1c677ffae..d18bd5a93db 100644 --- a/src/java.desktop/share/classes/javax/swing/text/TableView.java +++ b/src/java.desktop/share/classes/javax/swing/text/TableView.java @@ -805,7 +805,7 @@ public abstract class TableView extends BoxView { * * @param axis may be either View.X_AXIS or View.Y_AXIS * @return the resize weight - * @exception IllegalArgumentException for an invalid axis + * @throws IllegalArgumentException for an invalid axis */ public int getResizeWeight(int axis) { return 1; diff --git a/src/java.desktop/share/classes/javax/swing/text/Utilities.java b/src/java.desktop/share/classes/javax/swing/text/Utilities.java index ae93b5a40b5..62f323f076a 100644 --- a/src/java.desktop/share/classes/javax/swing/text/Utilities.java +++ b/src/java.desktop/share/classes/javax/swing/text/Utilities.java @@ -683,7 +683,7 @@ public class Utilities { * @param offs the offset in the document >= 0 * @return the position >= 0 if the request can be computed, otherwise * a value of -1 will be returned. - * @exception BadLocationException if the offset is out of range + * @throws BadLocationException if the offset is out of range */ @SuppressWarnings("deprecation") public static final int getRowStart(JTextComponent c, int offs) throws BadLocationException { @@ -714,7 +714,7 @@ public class Utilities { * @param offs the offset in the document >= 0 * @return the position >= 0 if the request can be computed, otherwise * a value of -1 will be returned. - * @exception BadLocationException if the offset is out of range + * @throws BadLocationException if the offset is out of range */ @SuppressWarnings("deprecation") public static final int getRowEnd(JTextComponent c, int offs) throws BadLocationException { @@ -747,7 +747,7 @@ public class Utilities { * @param x the X coordinate >= 0 * @return the position >= 0 if the request can be computed, otherwise * a value of -1 will be returned. - * @exception BadLocationException if the offset is out of range + * @throws BadLocationException if the offset is out of range * * @deprecated replaced by * {@link #getPositionAbove(JTextComponent, int, float)} @@ -802,7 +802,7 @@ public class Utilities { * @param x the X coordinate {@code >= 0} * @return the position {@code >= 0} if the request can be computed, otherwise * a value of -1 will be returned. - * @exception BadLocationException if the offset is out of range + * @throws BadLocationException if the offset is out of range * * @since 9 */ @@ -822,7 +822,7 @@ public class Utilities { * @param x the X coordinate >= 0 * @return the position >= 0 if the request can be computed, otherwise * a value of -1 will be returned. - * @exception BadLocationException if the offset is out of range + * @throws BadLocationException if the offset is out of range * * @deprecated replaced by * {@link #getPositionBelow(JTextComponent, int, float)} @@ -878,7 +878,7 @@ public class Utilities { * @param x the X coordinate {@code >= 0} * @return the position {@code >= 0} if the request can be computed, otherwise * a value of -1 will be returned. - * @exception BadLocationException if the offset is out of range + * @throws BadLocationException if the offset is out of range * * @since 9 */ @@ -894,7 +894,7 @@ public class Utilities { * @param c the editor * @param offs the offset in the document >= 0 * @return the location in the model of the word start >= 0 - * @exception BadLocationException if the offset is out of range + * @throws BadLocationException if the offset is out of range */ public static final int getWordStart(JTextComponent c, int offs) throws BadLocationException { Document doc = c.getDocument(); @@ -928,7 +928,7 @@ public class Utilities { * @param c the editor * @param offs the offset in the document >= 0 * @return the location in the model of the word end >= 0 - * @exception BadLocationException if the offset is out of range + * @throws BadLocationException if the offset is out of range */ public static final int getWordEnd(JTextComponent c, int offs) throws BadLocationException { Document doc = c.getDocument(); @@ -961,7 +961,7 @@ public class Utilities { * @param c the editor * @param offs the offset in the document >= 0 * @return the location in the model of the word start >= 0 - * @exception BadLocationException if the offset is out of range + * @throws BadLocationException if the offset is out of range */ public static final int getNextWord(JTextComponent c, int offs) throws BadLocationException { int nextWord; @@ -1039,7 +1039,7 @@ public class Utilities { * @param c the editor * @param offs the offset in the document >= 0 * @return the location in the model of the word start >= 0 - * @exception BadLocationException if the offset is out of range + * @throws BadLocationException if the offset is out of range */ public static final int getPreviousWord(JTextComponent c, int offs) throws BadLocationException { int prevWord; @@ -1271,8 +1271,8 @@ public class Utilities { * @param biasRet an array contain the bias that was checked * @return the location within the model that best represents the next * location visual position - * @exception BadLocationException - * @exception IllegalArgumentException if direction is invalid + * @throws BadLocationException + * @throws IllegalArgumentException if direction is invalid */ static int getNextVisualPositionFrom(View v, int pos, Position.Bias b, Shape alloc, int direction, diff --git a/src/java.desktop/share/classes/javax/swing/text/View.java b/src/java.desktop/share/classes/javax/swing/text/View.java index a3ad927e3a8..eb10efb0e83 100644 --- a/src/java.desktop/share/classes/javax/swing/text/View.java +++ b/src/java.desktop/share/classes/javax/swing/text/View.java @@ -495,9 +495,9 @@ public abstract class View implements SwingConstants { * @param biasRet the returned bias * @return the location within the model that best represents the next * location visual position - * @exception BadLocationException the given position is not a valid + * @throws BadLocationException the given position is not a valid * position within the document - * @exception IllegalArgumentException if direction + * @throws IllegalArgumentException if direction * doesn't have one of the legal values above */ @SuppressWarnings("deprecation") @@ -585,9 +585,9 @@ public abstract class View implements SwingConstants { * * @return the bounding box, in view coordinate space, * of the character at the specified position - * @exception BadLocationException if the specified position does + * @throws BadLocationException if the specified position does * not represent a valid location in the associated document - * @exception IllegalArgumentException if b is not one of the + * @throws IllegalArgumentException if b is not one of the * legal Position.Bias values listed above * @see View#viewToModel */ @@ -615,9 +615,9 @@ public abstract class View implements SwingConstants { * @param a the area of the view, which encompasses the requested region * @return the bounding box which is a union of the region specified * by the first and last character positions - * @exception BadLocationException if the given position does + * @throws BadLocationException if the given position does * not represent a valid location in the associated document - * @exception IllegalArgumentException if b0 or + * @throws IllegalArgumentException if b0 or * b1 are not one of the * legal Position.Bias values listed above * @see View#viewToModel @@ -1337,7 +1337,7 @@ public abstract class View implements SwingConstants { * @param pos the position to convert >= 0 * @param a the allocated region in which to render * @return the bounding box of the given position is returned - * @exception BadLocationException if the given position does + * @throws BadLocationException if the given position does * not represent a valid location in the associated document * @see View#modelToView * @deprecated diff --git a/src/java.desktop/share/classes/javax/swing/text/WrappedPlainView.java b/src/java.desktop/share/classes/javax/swing/text/WrappedPlainView.java index b229fa69f9f..d3587c8b40b 100644 --- a/src/java.desktop/share/classes/javax/swing/text/WrappedPlainView.java +++ b/src/java.desktop/share/classes/javax/swing/text/WrappedPlainView.java @@ -207,7 +207,7 @@ public class WrappedPlainView extends BoxView implements TabExpander { * @param p0 the beginning position in the model >= 0 * @param p1 the ending position in the model >= p0 * @return the X location of the end of the range >= 0 - * @exception BadLocationException if the range is invalid + * @throws BadLocationException if the range is invalid * * @deprecated replaced by * {@link #drawUnselectedText(Graphics2D, float, float, int, int)} @@ -252,7 +252,7 @@ public class WrappedPlainView extends BoxView implements TabExpander { * @param p0 the beginning position in the model >= 0 * @param p1 the ending position in the model >= p0 * @return the X location of the end of the range >= 0 - * @exception BadLocationException if the range is invalid + * @throws BadLocationException if the range is invalid * * @since 9 */ @@ -272,7 +272,7 @@ public class WrappedPlainView extends BoxView implements TabExpander { * @param p0 the beginning position in the model >= 0 * @param p1 the ending position in the model >= p0 * @return the location of the end of the range. - * @exception BadLocationException if the range is invalid + * @throws BadLocationException if the range is invalid * * @deprecated replaced by * {@link #drawSelectedText(Graphics2D, float, float, int, int)} @@ -320,7 +320,7 @@ public class WrappedPlainView extends BoxView implements TabExpander { * @param p0 the beginning position in the model >= 0 * @param p1 the ending position in the model >= p0 * @return the location of the end of the range. - * @exception BadLocationException if the range is invalid + * @throws BadLocationException if the range is invalid * * @since 9 */ @@ -748,7 +748,7 @@ public class WrappedPlainView extends BoxView implements TabExpander { * @param pos the position to convert * @param a the allocated region to render into * @return the bounding box of the given position is returned - * @exception BadLocationException if the given position does not represent a + * @throws BadLocationException if the given position does not represent a * valid location in the associated document * @see View#modelToView */ diff --git a/src/java.desktop/share/classes/javax/swing/text/ZoneView.java b/src/java.desktop/share/classes/javax/swing/text/ZoneView.java index 1deb927fb6e..595eafc336b 100644 --- a/src/java.desktop/share/classes/javax/swing/text/ZoneView.java +++ b/src/java.desktop/share/classes/javax/swing/text/ZoneView.java @@ -134,7 +134,7 @@ public class ZoneView extends BoxView { * * @param mzl the desired maximum number of zones * to be actively loaded, must be greater than 0 - * @exception IllegalArgumentException if mzl is < 1 + * @throws IllegalArgumentException if mzl is < 1 */ public void setMaxZonesLoaded(int mzl) { if (mzl < 1) { @@ -579,7 +579,7 @@ public class ZoneView extends BoxView { * @param pos the position to convert * @param a the allocated region to render into * @return the bounding box of the given position - * @exception BadLocationException if the given position does not represent a + * @throws BadLocationException if the given position does not represent a * valid location in the associated document * @see View#modelToView */ diff --git a/src/java.desktop/share/classes/javax/swing/text/html/AccessibleHTML.java b/src/java.desktop/share/classes/javax/swing/text/html/AccessibleHTML.java index 12cd5a74a72..77623a541e0 100644 --- a/src/java.desktop/share/classes/javax/swing/text/html/AccessibleHTML.java +++ b/src/java.desktop/share/classes/javax/swing/text/html/AccessibleHTML.java @@ -384,7 +384,7 @@ class AccessibleHTML implements Accessible { * @return this component's locale. If this component does not have * a locale, the locale of its parent is returned. * - * @exception IllegalComponentStateException + * @throws IllegalComponentStateException * If the Component does not have its own locale and has not yet been * added to a containment hierarchy such that the locale can be * determined from the containing parent. diff --git a/src/java.desktop/share/classes/javax/swing/text/html/BlockView.java b/src/java.desktop/share/classes/javax/swing/text/html/BlockView.java index 524a57d93c1..dc2a5e22477 100644 --- a/src/java.desktop/share/classes/javax/swing/text/html/BlockView.java +++ b/src/java.desktop/share/classes/javax/swing/text/html/BlockView.java @@ -300,7 +300,7 @@ public class BlockView extends BoxView { * * @param axis may be either X_AXIS or Y_AXIS * @return the weight - * @exception IllegalArgumentException for an invalid axis + * @throws IllegalArgumentException for an invalid axis */ public int getResizeWeight(int axis) { switch (axis) { @@ -356,7 +356,7 @@ public class BlockView extends BoxView { * typically the view is told to render into the span * that is returned, although there is no guarantee; * the parent may choose to resize or break the view - * @exception IllegalArgumentException for an invalid axis type + * @throws IllegalArgumentException for an invalid axis type */ public float getPreferredSpan(int axis) { return super.getPreferredSpan(axis); @@ -372,7 +372,7 @@ public class BlockView extends BoxView { * typically the view is told to render into the span * that is returned, although there is no guarantee; * the parent may choose to resize or break the view - * @exception IllegalArgumentException for an invalid axis type + * @throws IllegalArgumentException for an invalid axis type */ public float getMinimumSpan(int axis) { return super.getMinimumSpan(axis); @@ -388,7 +388,7 @@ public class BlockView extends BoxView { * typically the view is told to render into the span * that is returned, although there is no guarantee; * the parent may choose to resize or break the view - * @exception IllegalArgumentException for an invalid axis type + * @throws IllegalArgumentException for an invalid axis type */ public float getMaximumSpan(int axis) { return super.getMaximumSpan(axis); diff --git a/src/java.desktop/share/classes/javax/swing/text/html/FormView.java b/src/java.desktop/share/classes/javax/swing/text/html/FormView.java index 467651a9d98..b0855832a1d 100644 --- a/src/java.desktop/share/classes/javax/swing/text/html/FormView.java +++ b/src/java.desktop/share/classes/javax/swing/text/html/FormView.java @@ -380,7 +380,7 @@ public class FormView extends ComponentView implements ActionListener { * Typically the view is told to render into the span * that is returned, although there is no guarantee. * The parent may choose to resize or break the view. - * @exception IllegalArgumentException for an invalid axis + * @throws IllegalArgumentException for an invalid axis */ public float getMaximumSpan(int axis) { switch (axis) { diff --git a/src/java.desktop/share/classes/javax/swing/text/html/HRuleView.java b/src/java.desktop/share/classes/javax/swing/text/html/HRuleView.java index 885f0b7f2c9..29a7fce803d 100644 --- a/src/java.desktop/share/classes/javax/swing/text/html/HRuleView.java +++ b/src/java.desktop/share/classes/javax/swing/text/html/HRuleView.java @@ -245,7 +245,7 @@ class HRuleView extends View { * @param pos the position to convert * @param a the allocated region to render into * @return the bounding box of the given position - * @exception BadLocationException if the given position does not + * @throws BadLocationException if the given position does not * represent a valid location in the associated document * @see View#modelToView */ diff --git a/src/java.desktop/share/classes/javax/swing/text/html/HTMLDocument.java b/src/java.desktop/share/classes/javax/swing/text/html/HTMLDocument.java index 46d84e3cadc..f4bbb772e78 100644 --- a/src/java.desktop/share/classes/javax/swing/text/html/HTMLDocument.java +++ b/src/java.desktop/share/classes/javax/swing/text/html/HTMLDocument.java @@ -427,7 +427,7 @@ public class HTMLDocument extends DefaultStyledDocument { * * @param offset the starting offset * @param data the element data - * @exception BadLocationException if the given position does not + * @throws BadLocationException if the given position does not * represent a valid location in the associated document. */ protected void insert(int offset, ElementSpec[] data) throws BadLocationException { diff --git a/src/java.desktop/share/classes/javax/swing/text/html/HTMLEditorKit.java b/src/java.desktop/share/classes/javax/swing/text/html/HTMLEditorKit.java index 8d78819b0e8..a5c1067f03f 100644 --- a/src/java.desktop/share/classes/javax/swing/text/html/HTMLEditorKit.java +++ b/src/java.desktop/share/classes/javax/swing/text/html/HTMLEditorKit.java @@ -298,10 +298,10 @@ public class HTMLEditorKit extends StyledEditorKit implements Accessible { * @param doc the destination for the insertion * @param pos the location in the document to place the * content - * @exception IOException on any I/O error - * @exception BadLocationException if pos represents an invalid + * @throws IOException on any I/O error + * @throws BadLocationException if pos represents an invalid * location within the document - * @exception RuntimeException (will eventually be a BadLocationException) + * @throws RuntimeException (will eventually be a BadLocationException) * if pos is invalid */ public void read(Reader in, Document doc, int pos) throws IOException, BadLocationException { @@ -337,7 +337,7 @@ public class HTMLEditorKit extends StyledEditorKit implements Accessible { * * @throws BadLocationException if {@code offset} is invalid * @throws IOException on I/O error - * @exception RuntimeException (will eventually be a BadLocationException) + * @throws RuntimeException (will eventually be a BadLocationException) * if pos is invalid */ public void insertHTML(HTMLDocument doc, int offset, String html, @@ -367,8 +367,8 @@ public class HTMLEditorKit extends StyledEditorKit implements Accessible { * @param pos the location in the document to fetch the * content * @param len the amount to write out - * @exception IOException on any I/O error - * @exception BadLocationException if {@code pos} represents an invalid + * @throws IOException on any I/O error + * @throws BadLocationException if {@code pos} represents an invalid * location within the document */ public void write(Writer out, Document doc, int pos, int len) diff --git a/src/java.desktop/share/classes/javax/swing/text/html/HTMLWriter.java b/src/java.desktop/share/classes/javax/swing/text/html/HTMLWriter.java index c11214d71e3..270e4615309 100644 --- a/src/java.desktop/share/classes/javax/swing/text/html/HTMLWriter.java +++ b/src/java.desktop/share/classes/javax/swing/text/html/HTMLWriter.java @@ -125,8 +125,8 @@ public class HTMLWriter extends AbstractWriter { * Element tree and controls the writing out of * all the tags and its attributes. * - * @exception IOException on any I/O error - * @exception BadLocationException if pos represents an invalid + * @throws IOException on any I/O error + * @throws BadLocationException if pos represents an invalid * location within the document. * */ @@ -248,7 +248,7 @@ public class HTMLWriter extends AbstractWriter { * HTML.Attribute.ENDTAG. * * @param attr an AttributeSet - * @exception IOException on any I/O error + * @throws IOException on any I/O error * */ protected void writeAttributes(AttributeSet attr) throws IOException { @@ -273,8 +273,8 @@ public class HTMLWriter extends AbstractWriter { * corresponding end tag). * * @param elem an Element - * @exception IOException on any I/O error - * @exception BadLocationException if pos represents an invalid + * @throws IOException on any I/O error + * @throws BadLocationException if pos represents an invalid * location within the document. */ protected void emptyTag(Element elem) throws BadLocationException, IOException { @@ -451,8 +451,8 @@ public class HTMLWriter extends AbstractWriter { * element. * * @param attr an AttributeSet - * @exception IOException on any I/O error - * @exception BadLocationException if pos represents an invalid + * @throws IOException on any I/O error + * @throws BadLocationException if pos represents an invalid * location within the document. */ protected void textAreaContent(AttributeSet attr) throws BadLocationException, IOException { @@ -485,8 +485,8 @@ public class HTMLWriter extends AbstractWriter { * out. * * @param elem an Element - * @exception IOException on any I/O error - * @exception BadLocationException if pos represents an invalid + * @throws IOException on any I/O error + * @throws BadLocationException if pos represents an invalid * location within the document. */ protected void text(Element elem) throws BadLocationException, IOException { @@ -523,7 +523,7 @@ public class HTMLWriter extends AbstractWriter { * Writes out the content of the SELECT form element. * * @param attr the AttributeSet associated with the form element - * @exception IOException on any I/O error + * @throws IOException on any I/O error */ protected void selectContent(AttributeSet attr) throws IOException { Object model = attr.getAttribute(StyleConstants.ModelAttribute); @@ -552,7 +552,7 @@ public class HTMLWriter extends AbstractWriter { /** * Writes out the content of the Option form element. * @param option an Option - * @exception IOException on any I/O error + * @throws IOException on any I/O error * */ protected void writeOption(Option option) throws IOException { @@ -580,7 +580,7 @@ public class HTMLWriter extends AbstractWriter { * Writes out an end tag for the element. * * @param elem an Element - * @exception IOException on any I/O error + * @throws IOException on any I/O error */ protected void endTag(Element elem) throws IOException { if (synthesizedElement(elem)) { @@ -615,8 +615,8 @@ public class HTMLWriter extends AbstractWriter { * Writes out comments. * * @param elem an Element - * @exception IOException on any I/O error - * @exception BadLocationException if pos represents an invalid + * @throws IOException on any I/O error + * @throws BadLocationException if pos represents an invalid * location within the document. */ protected void comment(Element elem) throws BadLocationException, IOException { @@ -637,8 +637,8 @@ public class HTMLWriter extends AbstractWriter { * Writes out comment string. * * @param string the comment - * @exception IOException on any I/O error - * @exception BadLocationException if pos represents an invalid + * @throws IOException on any I/O error + * @throws BadLocationException if pos represents an invalid * location within the document. */ void writeComment(String string) throws IOException { @@ -712,7 +712,7 @@ public class HTMLWriter extends AbstractWriter { * written out. * * @param attr a set of attributes - * @exception IOException on any I/O error + * @throws IOException on any I/O error */ protected void writeEmbeddedTags(AttributeSet attr) throws IOException { @@ -767,7 +767,7 @@ public class HTMLWriter extends AbstractWriter { * end tag is written out. * * @param attr a set of attributes - * @exception IOException on any I/O error + * @throws IOException on any I/O error */ protected void closeOutUnwantedEmbeddedTags(AttributeSet attr) throws IOException { diff --git a/src/java.desktop/share/classes/javax/swing/text/html/ImageView.java b/src/java.desktop/share/classes/javax/swing/text/html/ImageView.java index 6f0a7cbdff4..7d2583509c1 100644 --- a/src/java.desktop/share/classes/javax/swing/text/html/ImageView.java +++ b/src/java.desktop/share/classes/javax/swing/text/html/ImageView.java @@ -557,7 +557,7 @@ public class ImageView extends View { * @param pos the position to convert * @param a the allocated region to render into * @return the bounding box of the given position - * @exception BadLocationException if the given position does not represent a + * @throws BadLocationException if the given position does not represent a * valid location in the associated document * @see View#modelToView */ diff --git a/src/java.desktop/share/classes/javax/swing/text/html/MinimalHTMLWriter.java b/src/java.desktop/share/classes/javax/swing/text/html/MinimalHTMLWriter.java index caa8dd07051..712cb350ee9 100644 --- a/src/java.desktop/share/classes/javax/swing/text/html/MinimalHTMLWriter.java +++ b/src/java.desktop/share/classes/javax/swing/text/html/MinimalHTMLWriter.java @@ -128,8 +128,8 @@ public class MinimalHTMLWriter extends AbstractWriter { * Generates HTML output * from a StyledDocument. * - * @exception IOException on any I/O error - * @exception BadLocationException if pos represents an invalid + * @throws IOException on any I/O error + * @throws BadLocationException if pos represents an invalid * location within the document. * */ @@ -152,7 +152,7 @@ public class MinimalHTMLWriter extends AbstractWriter { * The attribute name and value are separated by a colon. * Each pair is separated by a semicolon. * - * @exception IOException on any I/O error + * @throws IOException on any I/O error */ protected void writeAttributes(AttributeSet attr) throws IOException { Enumeration attributeNames = attr.getAttributeNames(); @@ -178,7 +178,7 @@ public class MinimalHTMLWriter extends AbstractWriter { /** * Writes out text. * - * @exception IOException on any I/O error + * @throws IOException on any I/O error */ protected void text(Element elem) throws IOException, BadLocationException { String contentStr = getText(elem); @@ -196,7 +196,7 @@ public class MinimalHTMLWriter extends AbstractWriter { * indented. Also increments the indent level. * * @param tag a start tag - * @exception IOException on any I/O error + * @throws IOException on any I/O error */ protected void writeStartTag(String tag) throws IOException { indent(); @@ -211,7 +211,7 @@ public class MinimalHTMLWriter extends AbstractWriter { * indented. Also decrements the indent level. * * @param endTag an end tag - * @exception IOException on any I/O error + * @throws IOException on any I/O error */ protected void writeEndTag(String endTag) throws IOException { decrIndent(); @@ -230,7 +230,7 @@ public class MinimalHTMLWriter extends AbstractWriter { * document is viewable in applications/browsers * that do not support the tag. * - * @exception IOException on any I/O error + * @throws IOException on any I/O error */ protected void writeHeader() throws IOException { writeStartTag(""); @@ -248,7 +248,7 @@ public class MinimalHTMLWriter extends AbstractWriter { * Writes out all the named styles as the * content of the <style> tag. * - * @exception IOException on any I/O error + * @throws IOException on any I/O error */ protected void writeStyles() throws IOException { /* @@ -338,7 +338,7 @@ public class MinimalHTMLWriter extends AbstractWriter { * that all other tags that have been opened are * appropriately closed off. * - * @exception IOException on any I/O error + * @throws IOException on any I/O error */ protected void writeEndParagraph() throws IOException { writeEndMask(fontMask); @@ -359,7 +359,7 @@ public class MinimalHTMLWriter extends AbstractWriter { * style. * * @param elem an element - * @exception IOException on any I/O error + * @throws IOException on any I/O error */ protected void writeStartParagraph(Element elem) throws IOException { AttributeSet attr = elem.getAttributes(); @@ -377,7 +377,7 @@ public class MinimalHTMLWriter extends AbstractWriter { * elements. * * @param elem an element - * @exception IOException on any I/O error + * @throws IOException on any I/O error */ protected void writeLeaf(Element elem) throws IOException { indent(); @@ -434,8 +434,8 @@ public class MinimalHTMLWriter extends AbstractWriter { * * @param elem an element * @param needsIndenting indention will be added if {@code needsIndenting} is {@code true} - * @exception IOException on any I/O error - * @exception BadLocationException if pos represents an invalid + * @throws IOException on any I/O error + * @throws BadLocationException if pos represents an invalid * location within the document. */ protected void writeContent(Element elem, boolean needsIndenting) @@ -457,7 +457,7 @@ public class MinimalHTMLWriter extends AbstractWriter { * text based on its attribute settings. * * @param attr a set of attributes - * @exception IOException on any I/O error + * @throws IOException on any I/O error */ protected void writeHTMLTags(AttributeSet attr) throws IOException { @@ -522,7 +522,7 @@ public class MinimalHTMLWriter extends AbstractWriter { * Writes out start tags <u>, <i>, and <b> based on * the mask settings. * - * @exception IOException on any I/O error + * @throws IOException on any I/O error */ private void writeStartMask(int mask) throws IOException { if (mask != 0) { @@ -542,7 +542,7 @@ public class MinimalHTMLWriter extends AbstractWriter { * Writes out end tags for <u>, <i>, and <b> based on * the mask settings. * - * @exception IOException on any I/O error + * @throws IOException on any I/O error */ private void writeEndMask(int mask) throws IOException { if (mask != 0) { @@ -569,7 +569,7 @@ public class MinimalHTMLWriter extends AbstractWriter { * attributes just like inline styles. * * @param attr a set of attributes - * @exception IOException on any I/O error + * @throws IOException on any I/O error */ protected void writeNonHTMLAttributes(AttributeSet attr) throws IOException { @@ -636,7 +636,7 @@ public class MinimalHTMLWriter extends AbstractWriter { *

    * Writes out an end tag for the <font> tag. * - * @exception IOException on any I/O error + * @throws IOException on any I/O error */ protected void endFontTag() throws IOException { write(NEWLINE); @@ -655,7 +655,7 @@ public class MinimalHTMLWriter extends AbstractWriter { * new start tag. * * @param style a font style - * @exception IOException on any I/O error + * @throws IOException on any I/O error */ protected void startFontTag(String style) throws IOException { boolean callIndent = false; @@ -676,7 +676,7 @@ public class MinimalHTMLWriter extends AbstractWriter { * any enclosing font tag before writing out a * new start tag. * - * @exception IOException on any I/O error + * @throws IOException on any I/O error */ private void startSpanTag(String style) throws IOException { boolean callIndent = false; @@ -693,7 +693,7 @@ public class MinimalHTMLWriter extends AbstractWriter { /** * Writes out an end tag for the <span> tag. * - * @exception IOException on any I/O error + * @throws IOException on any I/O error */ private void endSpanTag() throws IOException { write(NEWLINE); diff --git a/src/java.desktop/share/classes/javax/swing/text/html/OptionListModel.java b/src/java.desktop/share/classes/javax/swing/text/html/OptionListModel.java index 2b84b54b3e1..c7f0ff34a9b 100644 --- a/src/java.desktop/share/classes/javax/swing/text/html/OptionListModel.java +++ b/src/java.desktop/share/classes/javax/swing/text/html/OptionListModel.java @@ -464,7 +464,7 @@ class OptionListModel extends DefaultListModel implements ListSelectionMod * listenerLists are not duplicated. * * @return a clone of the receiver - * @exception CloneNotSupportedException if the receiver does not + * @throws CloneNotSupportedException if the receiver does not * both (a) implement the Cloneable interface * and (b) define a clone method */ diff --git a/src/java.desktop/share/classes/javax/swing/text/html/StyleSheet.java b/src/java.desktop/share/classes/javax/swing/text/html/StyleSheet.java index 9ce35f47ee9..35002f9fff2 100644 --- a/src/java.desktop/share/classes/javax/swing/text/html/StyleSheet.java +++ b/src/java.desktop/share/classes/javax/swing/text/html/StyleSheet.java @@ -1886,7 +1886,7 @@ public class StyleSheet extends StyleContext { * used to get the AttributeSet, and may be used to * resolve percentage arguments. * @return the inset needed for the margin, border and padding. - * @exception IllegalArgumentException for an invalid direction + * @throws IllegalArgumentException for an invalid direction */ public float getInset(int side, View v) { AttributeSet a = v.getAttributes(); diff --git a/src/java.desktop/share/classes/javax/swing/text/html/TableView.java b/src/java.desktop/share/classes/javax/swing/text/html/TableView.java index c088bf0eb9a..11b383acd31 100644 --- a/src/java.desktop/share/classes/javax/swing/text/html/TableView.java +++ b/src/java.desktop/share/classes/javax/swing/text/html/TableView.java @@ -1611,7 +1611,7 @@ import javax.swing.text.*; * * @param axis may be either View.X_AXIS or View.Y_AXIS * @return the resize weight - * @exception IllegalArgumentException for an invalid axis + * @throws IllegalArgumentException for an invalid axis */ public int getResizeWeight(int axis) { return 1; diff --git a/src/java.desktop/share/classes/javax/swing/text/rtf/RTFEditorKit.java b/src/java.desktop/share/classes/javax/swing/text/rtf/RTFEditorKit.java index 794c2cfee40..f841d9119f5 100644 --- a/src/java.desktop/share/classes/javax/swing/text/rtf/RTFEditorKit.java +++ b/src/java.desktop/share/classes/javax/swing/text/rtf/RTFEditorKit.java @@ -70,8 +70,8 @@ public class RTFEditorKit extends StyledEditorKit { * @param doc The destination for the insertion. * @param pos The location in the document to place the * content. - * @exception IOException on any I/O error - * @exception BadLocationException if pos represents an invalid + * @throws IOException on any I/O error + * @throws BadLocationException if pos represents an invalid * location within the document. */ public void read(InputStream in, Document doc, int pos) throws IOException, BadLocationException { @@ -97,8 +97,8 @@ public class RTFEditorKit extends StyledEditorKit { * @param pos The location in the document to fetch the * content. * @param len The amount to write out. - * @exception IOException on any I/O error - * @exception BadLocationException if pos represents an invalid + * @throws IOException on any I/O error + * @throws BadLocationException if pos represents an invalid * location within the document. */ public void write(OutputStream out, Document doc, int pos, int len) @@ -117,8 +117,8 @@ public class RTFEditorKit extends StyledEditorKit { * @param doc The destination for the insertion. * @param pos The location in the document to place the * content. - * @exception IOException on any I/O error - * @exception BadLocationException if pos represents an invalid + * @throws IOException on any I/O error + * @throws BadLocationException if pos represents an invalid * location within the document. */ public void read(Reader in, Document doc, int pos) @@ -143,8 +143,8 @@ public class RTFEditorKit extends StyledEditorKit { * @param pos The location in the document to fetch the * content. * @param len The amount to write out. - * @exception IOException on any I/O error - * @exception BadLocationException if pos represents an invalid + * @throws IOException on any I/O error + * @throws BadLocationException if pos represents an invalid * location within the document. */ public void write(Writer out, Document doc, int pos, int len) diff --git a/src/java.desktop/share/classes/javax/swing/tree/DefaultMutableTreeNode.java b/src/java.desktop/share/classes/javax/swing/tree/DefaultMutableTreeNode.java index 7735895502e..11efb12e7a2 100644 --- a/src/java.desktop/share/classes/javax/swing/tree/DefaultMutableTreeNode.java +++ b/src/java.desktop/share/classes/javax/swing/tree/DefaultMutableTreeNode.java @@ -174,12 +174,12 @@ public class DefaultMutableTreeNode implements Cloneable, * @param newChild the MutableTreeNode to insert under this node * @param childIndex the index in this node's child array * where this node is to be inserted - * @exception ArrayIndexOutOfBoundsException if + * @throws ArrayIndexOutOfBoundsException if * childIndex is out of bounds - * @exception IllegalArgumentException if + * @throws IllegalArgumentException if * newChild is null or is an * ancestor of this node - * @exception IllegalStateException if this node does not allow + * @throws IllegalStateException if this node does not allow * children * @see #isNodeDescendant */ @@ -211,7 +211,7 @@ public class DefaultMutableTreeNode implements Cloneable, * * @param childIndex the index in this node's child array * of the child to remove - * @exception ArrayIndexOutOfBoundsException if + * @throws ArrayIndexOutOfBoundsException if * childIndex is out of bounds */ public void remove(int childIndex) { @@ -247,7 +247,7 @@ public class DefaultMutableTreeNode implements Cloneable, * Returns the child at the specified index in this node's child array. * * @param index an index into this node's child array - * @exception ArrayIndexOutOfBoundsException if index + * @throws ArrayIndexOutOfBoundsException if index * is out of bounds * @return the TreeNode in this node's child array at the specified index */ @@ -278,7 +278,7 @@ public class DefaultMutableTreeNode implements Cloneable, * where n is the number of children. * * @param aChild the TreeNode to search for among this node's children - * @exception IllegalArgumentException if aChild + * @throws IllegalArgumentException if aChild * is null * @return an int giving the index of the node in this node's child * array, or -1 if the specified node is a not @@ -382,7 +382,7 @@ public class DefaultMutableTreeNode implements Cloneable, * null parent. * * @param aChild a child of this node to remove - * @exception IllegalArgumentException if aChild + * @throws IllegalArgumentException if aChild * is null or is not a child of this node */ public void remove(MutableTreeNode aChild) { @@ -412,9 +412,9 @@ public class DefaultMutableTreeNode implements Cloneable, * * @see #insert * @param newChild node to add as a child of this node - * @exception IllegalArgumentException if newChild + * @throws IllegalArgumentException if newChild * is null - * @exception IllegalStateException if this node does not allow + * @throws IllegalStateException if this node does not allow * children */ public void add(MutableTreeNode newChild) { @@ -846,7 +846,7 @@ public class DefaultMutableTreeNode implements Cloneable, * @param ancestor the node to start enumeration from * @see #isNodeAncestor * @see #isNodeDescendant - * @exception IllegalArgumentException if ancestor is + * @throws IllegalArgumentException if ancestor is * not an ancestor of this node * @return an enumeration for following the path from an ancestor of * this node to this one @@ -890,7 +890,7 @@ public class DefaultMutableTreeNode implements Cloneable, * throws NoSuchElementException. * * @return the first child of this node - * @exception NoSuchElementException if this node has no children + * @throws NoSuchElementException if this node has no children */ public TreeNode getFirstChild() { if (getChildCount() == 0) { @@ -905,7 +905,7 @@ public class DefaultMutableTreeNode implements Cloneable, * throws NoSuchElementException. * * @return the last child of this node - * @exception NoSuchElementException if this node has no children + * @throws NoSuchElementException if this node has no children */ public TreeNode getLastChild() { if (getChildCount() == 0) { @@ -925,7 +925,7 @@ public class DefaultMutableTreeNode implements Cloneable, * * @param aChild the child node to look for next child after it * @see #children - * @exception IllegalArgumentException if aChild is + * @throws IllegalArgumentException if aChild is * null or is not a child of this node * @return the child of this node that immediately follows * aChild @@ -957,7 +957,7 @@ public class DefaultMutableTreeNode implements Cloneable, * and is O(n) where n is the number of children. * * @param aChild the child node to look for previous child before it - * @exception IllegalArgumentException if aChild is null + * @throws IllegalArgumentException if aChild is null * or is not a child of this node * @return the child of this node that immediately precedes * aChild diff --git a/src/java.desktop/share/classes/javax/swing/tree/DefaultTreeModel.java b/src/java.desktop/share/classes/javax/swing/tree/DefaultTreeModel.java index 4cdec3f6b38..511cde568c0 100644 --- a/src/java.desktop/share/classes/javax/swing/tree/DefaultTreeModel.java +++ b/src/java.desktop/share/classes/javax/swing/tree/DefaultTreeModel.java @@ -672,7 +672,7 @@ public class DefaultTreeModel implements Serializable, TreeModel { * FooListeners on this component, * or an empty array if no such * listeners have been added - * @exception ClassCastException if listenerType + * @throws ClassCastException if listenerType * doesn't specify a class or interface that implements * java.util.EventListener * diff --git a/src/java.desktop/share/classes/javax/swing/tree/DefaultTreeSelectionModel.java b/src/java.desktop/share/classes/javax/swing/tree/DefaultTreeSelectionModel.java index e1bdc4fc94b..ff7ed27302d 100644 --- a/src/java.desktop/share/classes/javax/swing/tree/DefaultTreeSelectionModel.java +++ b/src/java.desktop/share/classes/javax/swing/tree/DefaultTreeSelectionModel.java @@ -679,7 +679,7 @@ public class DefaultTreeSelectionModel implements Cloneable, Serializable, TreeS * FooListeners on this component, * or an empty array if no such * listeners have been added - * @exception ClassCastException if listenerType + * @throws ClassCastException if listenerType * doesn't specify a class or interface that implements * java.util.EventListener * @@ -1187,7 +1187,7 @@ public class DefaultTreeSelectionModel implements Cloneable, Serializable, TreeS * This method does not duplicate * selection listeners and property listeners. * - * @exception CloneNotSupportedException never thrown by instances of + * @throws CloneNotSupportedException never thrown by instances of * this class */ public Object clone() throws CloneNotSupportedException { diff --git a/src/java.desktop/share/classes/javax/swing/undo/AbstractUndoableEdit.java b/src/java.desktop/share/classes/javax/swing/undo/AbstractUndoableEdit.java index 7184557d1e7..94f5eb69a74 100644 --- a/src/java.desktop/share/classes/javax/swing/undo/AbstractUndoableEdit.java +++ b/src/java.desktop/share/classes/javax/swing/undo/AbstractUndoableEdit.java @@ -102,7 +102,7 @@ public class AbstractUndoableEdit implements UndoableEdit, Serializable { * operation represented by this edit. Override should begin with * a call to super. * - * @exception CannotUndoException if canUndo + * @throws CannotUndoException if canUndo * returns false * @see #canUndo */ @@ -134,7 +134,7 @@ public class AbstractUndoableEdit implements UndoableEdit, Serializable { * Subclasses should override to redo the operation represented by * this edit. Override should begin with a call to super. * - * @exception CannotRedoException if canRedo + * @throws CannotRedoException if canRedo * returns false * @see #canRedo */ -- GitLab From 249d553659ab75a2271e98c77e7d62f662ffa684 Mon Sep 17 00:00:00 2001 From: Prasanta Sadhukhan Date: Thu, 17 Mar 2022 09:15:54 +0000 Subject: [PATCH 265/340] 8282602: Refactor awt classes javadoc to use @throws instead of @exception Reviewed-by: aivanov, prr --- .../classes/java/awt/AWTEventMulticaster.java | 4 +- .../share/classes/java/awt/BorderLayout.java | 8 +- .../classes/java/awt/BufferCapabilities.java | 2 +- .../share/classes/java/awt/Button.java | 6 +- .../share/classes/java/awt/Canvas.java | 8 +- .../share/classes/java/awt/CardLayout.java | 2 +- .../share/classes/java/awt/Checkbox.java | 12 +-- .../classes/java/awt/CheckboxMenuItem.java | 8 +- .../share/classes/java/awt/Choice.java | 16 ++-- .../share/classes/java/awt/Color.java | 2 +- .../share/classes/java/awt/Component.java | 36 ++++----- .../share/classes/java/awt/Container.java | 42 +++++------ .../share/classes/java/awt/Cursor.java | 4 +- .../share/classes/java/awt/Dialog.java | 74 +++++++++---------- .../share/classes/java/awt/EventQueue.java | 8 +- .../share/classes/java/awt/FileDialog.java | 18 ++--- .../share/classes/java/awt/Frame.java | 12 +-- .../java/awt/GraphicsConfiguration.java | 4 +- .../classes/java/awt/GraphicsDevice.java | 4 +- .../classes/java/awt/GraphicsEnvironment.java | 8 +- .../share/classes/java/awt/GridBagLayout.java | 2 +- .../share/classes/java/awt/GridLayout.java | 6 +- .../share/classes/java/awt/Image.java | 4 +- .../share/classes/java/awt/Label.java | 8 +- .../share/classes/java/awt/List.java | 16 ++-- .../share/classes/java/awt/MediaTracker.java | 8 +- .../share/classes/java/awt/Menu.java | 12 +-- .../share/classes/java/awt/MenuBar.java | 2 +- .../share/classes/java/awt/MenuComponent.java | 2 +- .../share/classes/java/awt/MenuItem.java | 8 +- .../share/classes/java/awt/MouseInfo.java | 6 +- .../share/classes/java/awt/Polygon.java | 6 +- .../share/classes/java/awt/PopupMenu.java | 12 +-- .../classes/java/awt/RenderingHints.java | 16 ++-- .../share/classes/java/awt/Scrollbar.java | 14 ++-- .../share/classes/java/awt/TextArea.java | 14 ++-- .../share/classes/java/awt/TextComponent.java | 6 +- .../share/classes/java/awt/TextField.java | 12 +-- .../share/classes/java/awt/Toolkit.java | 46 ++++++------ .../share/classes/java/awt/Window.java | 30 ++++---- .../classes/java/awt/dnd/DragSource.java | 6 +- .../classes/java/awt/dnd/DropTarget.java | 10 +-- .../java/awt/event/InputMethodEvent.java | 2 +- .../classes/java/awt/font/TextLayout.java | 2 +- .../java/awt/geom/AffineTransform.java | 8 +- .../classes/java/awt/geom/CubicCurve2D.java | 2 +- .../classes/java/awt/geom/Dimension2D.java | 2 +- .../java/awt/geom/FlatteningPathIterator.java | 6 +- .../share/classes/java/awt/geom/Line2D.java | 2 +- .../share/classes/java/awt/geom/Path2D.java | 8 +- .../share/classes/java/awt/geom/Point2D.java | 2 +- .../classes/java/awt/geom/QuadCurve2D.java | 2 +- .../java/awt/geom/RectangularShape.java | 2 +- .../classes/java/awt/im/InputContext.java | 6 +- .../java/awt/im/InputMethodHighlight.java | 6 +- .../classes/java/awt/im/spi/InputMethod.java | 6 +- .../java/awt/im/spi/InputMethodContext.java | 4 +- .../awt/im/spi/InputMethodDescriptor.java | 4 +- .../classes/java/awt/image/BufferedImage.java | 10 +-- .../java/awt/image/ByteLookupTable.java | 4 +- .../java/awt/image/ColorConvertOp.java | 8 +- .../java/awt/image/DirectColorModel.java | 30 ++++---- .../classes/java/awt/image/ImageFilter.java | 4 +- .../image/MultiPixelPackedSampleModel.java | 14 ++-- .../classes/java/awt/image/PixelGrabber.java | 4 +- .../java/awt/image/RGBImageFilter.java | 2 +- .../share/classes/java/awt/image/Raster.java | 4 +- .../java/awt/image/ShortLookupTable.java | 4 +- .../image/SinglePixelPackedSampleModel.java | 2 +- .../java/awt/image/WritableRaster.java | 2 +- .../classes/java/awt/print/PageFormat.java | 2 +- .../classes/java/awt/print/Printable.java | 2 +- .../classes/java/awt/print/PrinterJob.java | 20 ++--- 73 files changed, 350 insertions(+), 350 deletions(-) diff --git a/src/java.desktop/share/classes/java/awt/AWTEventMulticaster.java b/src/java.desktop/share/classes/java/awt/AWTEventMulticaster.java index a9f102643f4..b7584fc84dd 100644 --- a/src/java.desktop/share/classes/java/awt/AWTEventMulticaster.java +++ b/src/java.desktop/share/classes/java/awt/AWTEventMulticaster.java @@ -1097,9 +1097,9 @@ public class AWTEventMulticaster implements * FooListeners by the specified multicast * listener, or an empty array if no such listeners have been * chained by the specified multicast listener - * @exception NullPointerException if the specified + * @throws NullPointerException if the specified * {@code listenertype} parameter is {@code null} - * @exception ClassCastException if {@code listenerType} + * @throws ClassCastException if {@code listenerType} * doesn't specify a class or interface that implements * {@code java.util.EventListener} * diff --git a/src/java.desktop/share/classes/java/awt/BorderLayout.java b/src/java.desktop/share/classes/java/awt/BorderLayout.java index 88edc23dec4..e3b92a7996a 100644 --- a/src/java.desktop/share/classes/java/awt/BorderLayout.java +++ b/src/java.desktop/share/classes/java/awt/BorderLayout.java @@ -419,7 +419,7 @@ public class BorderLayout implements LayoutManager2, * @param constraints an object that specifies how and where * the component is added to the layout. * @see java.awt.Container#add(java.awt.Component, java.lang.Object) - * @exception IllegalArgumentException if the constraint object is not + * @throws IllegalArgumentException if the constraint object is not * a string, or if it not one of the five specified constants. * @since 1.1 */ @@ -514,7 +514,7 @@ public class BorderLayout implements LayoutManager2, * {@code LINE_START}, {@code LINE_END} * @return the component at the given location, or {@code null} if * the location is empty - * @exception IllegalArgumentException if the constraint object is + * @throws IllegalArgumentException if the constraint object is * not one of the nine specified constants * @see #addLayoutComponent(java.awt.Component, java.lang.Object) * @since 1.5 @@ -562,9 +562,9 @@ public class BorderLayout implements LayoutManager2, * {@code Container}'s component orientation. * @return the component at the given location, or {@code null} if * the location is empty - * @exception IllegalArgumentException if the constraint object is + * @throws IllegalArgumentException if the constraint object is * not one of the five specified constants - * @exception NullPointerException if the target parameter is null + * @throws NullPointerException if the target parameter is null * @see #addLayoutComponent(java.awt.Component, java.lang.Object) * @since 1.5 */ diff --git a/src/java.desktop/share/classes/java/awt/BufferCapabilities.java b/src/java.desktop/share/classes/java/awt/BufferCapabilities.java index 22df13cfb50..6edeae843aa 100644 --- a/src/java.desktop/share/classes/java/awt/BufferCapabilities.java +++ b/src/java.desktop/share/classes/java/awt/BufferCapabilities.java @@ -47,7 +47,7 @@ public class BufferCapabilities implements Cloneable { * cannot be {@code null} * @param flipContents the contents of the back buffer after page-flipping, * {@code null} if page flipping is not used (implies blitting) - * @exception IllegalArgumentException if frontCaps or backCaps are + * @throws IllegalArgumentException if frontCaps or backCaps are * {@code null} */ public BufferCapabilities(ImageCapabilities frontCaps, diff --git a/src/java.desktop/share/classes/java/awt/Button.java b/src/java.desktop/share/classes/java/awt/Button.java index 35acb8d2928..524008e401a 100644 --- a/src/java.desktop/share/classes/java/awt/Button.java +++ b/src/java.desktop/share/classes/java/awt/Button.java @@ -140,7 +140,7 @@ public class Button extends Component implements Accessible { /** * Constructs a button with an empty string for its label. * - * @exception HeadlessException if GraphicsEnvironment.isHeadless() + * @throws HeadlessException if GraphicsEnvironment.isHeadless() * returns true * @see java.awt.GraphicsEnvironment#isHeadless */ @@ -153,7 +153,7 @@ public class Button extends Component implements Accessible { * * @param label a string label for the button, or * {@code null} for no label - * @exception HeadlessException if GraphicsEnvironment.isHeadless() + * @throws HeadlessException if GraphicsEnvironment.isHeadless() * returns true * @see java.awt.GraphicsEnvironment#isHeadless */ @@ -339,7 +339,7 @@ public class Button extends Component implements Accessible { * FooListeners on this button, * or an empty array if no such * listeners have been added - * @exception ClassCastException if {@code listenerType} + * @throws ClassCastException if {@code listenerType} * doesn't specify a class or interface that implements * {@code java.util.EventListener} * diff --git a/src/java.desktop/share/classes/java/awt/Canvas.java b/src/java.desktop/share/classes/java/awt/Canvas.java index 1ee5380c6df..7d90e148b6c 100644 --- a/src/java.desktop/share/classes/java/awt/Canvas.java +++ b/src/java.desktop/share/classes/java/awt/Canvas.java @@ -166,8 +166,8 @@ public class Canvas extends Component implements Accessible { * Each time this method is called, * the existing buffer strategy for this component is discarded. * @param numBuffers number of buffers to create, including the front buffer - * @exception IllegalArgumentException if numBuffers is less than 1. - * @exception IllegalStateException if the component is not displayable + * @throws IllegalArgumentException if numBuffers is less than 1. + * @throws IllegalStateException if the component is not displayable * @see #isDisplayable * @see #getBufferStrategy * @since 1.4 @@ -187,11 +187,11 @@ public class Canvas extends Component implements Accessible { * @param numBuffers number of buffers to create * @param caps the required capabilities for creating the buffer strategy; * cannot be {@code null} - * @exception AWTException if the capabilities supplied could not be + * @throws AWTException if the capabilities supplied could not be * supported or met; this may happen, for example, if there is not enough * accelerated memory currently available, or if page flipping is specified * but not possible. - * @exception IllegalArgumentException if numBuffers is less than 1, or if + * @throws IllegalArgumentException if numBuffers is less than 1, or if * caps is {@code null} * @see #getBufferStrategy * @since 1.4 diff --git a/src/java.desktop/share/classes/java/awt/CardLayout.java b/src/java.desktop/share/classes/java/awt/CardLayout.java index d53c86a9d45..915376d0320 100644 --- a/src/java.desktop/share/classes/java/awt/CardLayout.java +++ b/src/java.desktop/share/classes/java/awt/CardLayout.java @@ -206,7 +206,7 @@ public class CardLayout implements LayoutManager2, * @param constraints a tag that identifies a particular * card in the layout. * @see java.awt.CardLayout#show(java.awt.Container, java.lang.String) - * @exception IllegalArgumentException if the constraint is not a string. + * @throws IllegalArgumentException if the constraint is not a string. */ public void addLayoutComponent(Component comp, Object constraints) { synchronized (comp.getTreeLock()) { diff --git a/src/java.desktop/share/classes/java/awt/Checkbox.java b/src/java.desktop/share/classes/java/awt/Checkbox.java index e72d249f8e3..f4a642cb329 100644 --- a/src/java.desktop/share/classes/java/awt/Checkbox.java +++ b/src/java.desktop/share/classes/java/awt/Checkbox.java @@ -146,7 +146,7 @@ public class Checkbox extends Component implements ItemSelectable, Accessible { * Creates a check box with an empty string for its label. * The state of this check box is set to "off," and it is not * part of any check box group. - * @exception HeadlessException if GraphicsEnvironment.isHeadless() + * @throws HeadlessException if GraphicsEnvironment.isHeadless() * returns true * @see java.awt.GraphicsEnvironment#isHeadless */ @@ -161,7 +161,7 @@ public class Checkbox extends Component implements ItemSelectable, Accessible { * * @param label a string label for this check box, * or {@code null} for no label. - * @exception HeadlessException if + * @throws HeadlessException if * {@code GraphicsEnvironment.isHeadless} * returns {@code true} * @see java.awt.GraphicsEnvironment#isHeadless @@ -178,7 +178,7 @@ public class Checkbox extends Component implements ItemSelectable, Accessible { * @param label a string label for this check box, * or {@code null} for no label * @param state the initial state of this check box - * @exception HeadlessException if + * @throws HeadlessException if * {@code GraphicsEnvironment.isHeadless} * returns {@code true} * @see java.awt.GraphicsEnvironment#isHeadless @@ -196,7 +196,7 @@ public class Checkbox extends Component implements ItemSelectable, Accessible { * @param state the initial state of this check box. * @param group a check box group for this check box, * or {@code null} for no group. - * @exception HeadlessException if + * @throws HeadlessException if * {@code GraphicsEnvironment.isHeadless} * returns {@code true} * @see java.awt.GraphicsEnvironment#isHeadless @@ -222,7 +222,7 @@ public class Checkbox extends Component implements ItemSelectable, Accessible { * @param group a check box group for this check box, * or {@code null} for no group. * @param state the initial state of this check box. - * @exception HeadlessException if + * @throws HeadlessException if * {@code GraphicsEnvironment.isHeadless} * returns {@code true} * @see java.awt.GraphicsEnvironment#isHeadless @@ -508,7 +508,7 @@ public class Checkbox extends Component implements ItemSelectable, Accessible { * FooListeners on this checkbox, * or an empty array if no such * listeners have been added - * @exception ClassCastException if {@code listenerType} + * @throws ClassCastException if {@code listenerType} * doesn't specify a class or interface that implements * {@code java.util.EventListener} * diff --git a/src/java.desktop/share/classes/java/awt/CheckboxMenuItem.java b/src/java.desktop/share/classes/java/awt/CheckboxMenuItem.java index 4df4ddbef85..f95d1d39424 100644 --- a/src/java.desktop/share/classes/java/awt/CheckboxMenuItem.java +++ b/src/java.desktop/share/classes/java/awt/CheckboxMenuItem.java @@ -110,7 +110,7 @@ public class CheckboxMenuItem extends MenuItem implements ItemSelectable, Access /** * Create a check box menu item with an empty label. * The item's state is initially set to "off." - * @exception HeadlessException if GraphicsEnvironment.isHeadless() + * @throws HeadlessException if GraphicsEnvironment.isHeadless() * returns true * @see java.awt.GraphicsEnvironment#isHeadless * @since 1.1 @@ -125,7 +125,7 @@ public class CheckboxMenuItem extends MenuItem implements ItemSelectable, Access * @param label a string label for the check box menu item, * or {@code null} for an unlabeled menu item. - * @exception HeadlessException if GraphicsEnvironment.isHeadless() + * @throws HeadlessException if GraphicsEnvironment.isHeadless() * returns true * @see java.awt.GraphicsEnvironment#isHeadless */ @@ -140,7 +140,7 @@ public class CheckboxMenuItem extends MenuItem implements ItemSelectable, Access * @param state the initial state of the menu item, where * {@code true} indicates "on" and * {@code false} indicates "off." - * @exception HeadlessException if GraphicsEnvironment.isHeadless() + * @throws HeadlessException if GraphicsEnvironment.isHeadless() * returns true * @see java.awt.GraphicsEnvironment#isHeadless * @since 1.1 @@ -316,7 +316,7 @@ public class CheckboxMenuItem extends MenuItem implements ItemSelectable, Access * FooListeners on this checkbox menuitem, * or an empty array if no such * listeners have been added - * @exception ClassCastException if {@code listenerType} + * @throws ClassCastException if {@code listenerType} * doesn't specify a class or interface that implements * {@code java.util.EventListener} * diff --git a/src/java.desktop/share/classes/java/awt/Choice.java b/src/java.desktop/share/classes/java/awt/Choice.java index d8e8ab4c026..2b04239fd31 100644 --- a/src/java.desktop/share/classes/java/awt/Choice.java +++ b/src/java.desktop/share/classes/java/awt/Choice.java @@ -124,7 +124,7 @@ public class Choice extends Component implements ItemSelectable, Accessible { * By default, the first item added to the choice menu becomes the * selected item, until a different selection is made by the user * by calling one of the {@code select} methods. - * @exception HeadlessException if GraphicsEnvironment.isHeadless() + * @throws HeadlessException if GraphicsEnvironment.isHeadless() * returns true * @see java.awt.GraphicsEnvironment#isHeadless * @see #select(int) @@ -205,7 +205,7 @@ public class Choice extends Component implements ItemSelectable, Accessible { /** * Adds an item to this {@code Choice} menu. * @param item the item to be added - * @exception NullPointerException if the item's value is + * @throws NullPointerException if the item's value is * {@code null} * @since 1.1 */ @@ -219,7 +219,7 @@ public class Choice extends Component implements ItemSelectable, Accessible { *

    * Adds an item to this {@code Choice} menu. * @param item the item to be added - * @exception NullPointerException if the item's value is equal to + * @throws NullPointerException if the item's value is equal to * {@code null} */ public void addItem(String item) { @@ -238,7 +238,7 @@ public class Choice extends Component implements ItemSelectable, Accessible { * invoking this method. * @param item the item to be added * @param index the new item position - * @exception NullPointerException if the item's value is equal to + * @throws NullPointerException if the item's value is equal to * {@code null} */ private void insertNoInvalidate(String item, int index) { @@ -274,7 +274,7 @@ public class Choice extends Component implements ItemSelectable, Accessible { * the selected item. * @param item the non-{@code null} item to be inserted * @param index the position at which the item should be inserted - * @exception IllegalArgumentException if index is less than 0 + * @throws IllegalArgumentException if index is less than 0 */ public void insert(String item, int index) { synchronized (this) { @@ -300,7 +300,7 @@ public class Choice extends Component implements ItemSelectable, Accessible { * item remains selected (and the selected index is * updated accordingly). * @param item the item to remove from this {@code Choice} menu - * @exception IllegalArgumentException if the item doesn't + * @throws IllegalArgumentException if the item doesn't * exist in the choice menu * @since 1.1 */ @@ -430,7 +430,7 @@ public class Choice extends Component implements ItemSelectable, Accessible { * {@code ItemEvent} is by user interaction. * * @param pos the position of the selected item - * @exception IllegalArgumentException if the specified + * @throws IllegalArgumentException if the specified * position is greater than the * number of items or less than zero * @see #getSelectedItem @@ -561,7 +561,7 @@ public class Choice extends Component implements ItemSelectable, Accessible { * FooListeners on this choice, * or an empty array if no such * listeners have been added - * @exception ClassCastException if {@code listenerType} + * @throws ClassCastException if {@code listenerType} * doesn't specify a class or interface that implements * {@code java.util.EventListener} * diff --git a/src/java.desktop/share/classes/java/awt/Color.java b/src/java.desktop/share/classes/java/awt/Color.java index aae90be8616..6bb4befd8e8 100644 --- a/src/java.desktop/share/classes/java/awt/Color.java +++ b/src/java.desktop/share/classes/java/awt/Color.java @@ -722,7 +722,7 @@ public class Color implements Paint, java.io.Serializable { * an opaque color as a 24-bit integer * @return the new {@code Color} object. * @see java.lang.Integer#decode - * @exception NumberFormatException if the specified string cannot + * @throws NumberFormatException if the specified string cannot * be interpreted as a decimal, * octal, or hexadecimal integer. * @since 1.1 diff --git a/src/java.desktop/share/classes/java/awt/Component.java b/src/java.desktop/share/classes/java/awt/Component.java index 813f9bd0c79..cfd4cbe025a 100644 --- a/src/java.desktop/share/classes/java/awt/Component.java +++ b/src/java.desktop/share/classes/java/awt/Component.java @@ -1420,7 +1420,7 @@ public abstract class Component implements ImageObserver, MenuContainer, * pointer. If the return value of this method is {@code null}, mouse * pointer is not directly above the {@code Component}. * - * @exception HeadlessException if GraphicsEnvironment.isHeadless() returns true + * @throws HeadlessException if GraphicsEnvironment.isHeadless() returns true * @see #isShowing * @see Container#getMousePosition * @return mouse coordinates relative to this {@code Component}, or null @@ -1984,7 +1984,7 @@ public abstract class Component implements ImageObserver, MenuContainer, * @return this component's locale; if this component does not * have a locale, the locale of its parent is returned * @see #setLocale - * @exception IllegalComponentStateException if the {@code Component} + * @throws IllegalComponentStateException if the {@code Component} * does not have its own locale and has not yet been added to * a containment hierarchy such that the locale can be determined * from the containing parent @@ -3827,8 +3827,8 @@ public abstract class Component implements ImageObserver, MenuContainer, * Each time this method is called, * the existing buffer strategy for this component is discarded. * @param numBuffers number of buffers to create, including the front buffer - * @exception IllegalArgumentException if numBuffers is less than 1. - * @exception IllegalStateException if the component is not displayable + * @throws IllegalArgumentException if numBuffers is less than 1. + * @throws IllegalStateException if the component is not displayable * @see #isDisplayable * @see Window#getBufferStrategy() * @see Canvas#getBufferStrategy() @@ -3884,11 +3884,11 @@ public abstract class Component implements ImageObserver, MenuContainer, * @param numBuffers number of buffers to create * @param caps the required capabilities for creating the buffer strategy; * cannot be {@code null} - * @exception AWTException if the capabilities supplied could not be + * @throws AWTException if the capabilities supplied could not be * supported or met; this may happen, for example, if there is not enough * accelerated memory currently available, or if page flipping is specified * but not possible. - * @exception IllegalArgumentException if numBuffers is less than 1, or if + * @throws IllegalArgumentException if numBuffers is less than 1, or if * caps is {@code null} * @see Window#getBufferStrategy() * @see Canvas#getBufferStrategy() @@ -4032,12 +4032,12 @@ public abstract class Component implements ImageObserver, MenuContainer, * @see Applet * @param numBuffers the number of buffers * @param caps the capabilities of the buffers - * @exception AWTException if the capabilities supplied could not be + * @throws AWTException if the capabilities supplied could not be * supported or met - * @exception ClassCastException if the component is not a canvas or + * @throws ClassCastException if the component is not a canvas or * window. - * @exception IllegalStateException if the component has no peer - * @exception IllegalArgumentException if {@code numBuffers} is less than two, + * @throws IllegalStateException if the component has no peer + * @throws IllegalArgumentException if {@code numBuffers} is less than two, * or if {@code BufferCapabilities.isPageFlipping} is not * {@code true}. * @see #createBuffers(int, BufferCapabilities) @@ -4066,10 +4066,10 @@ public abstract class Component implements ImageObserver, MenuContainer, * @param caps the capabilities of the buffers. * {@code BufferCapabilities.isPageFlipping} must be * {@code true}. - * @exception AWTException if the capabilities supplied could not be + * @throws AWTException if the capabilities supplied could not be * supported or met - * @exception IllegalStateException if the component has no peer - * @exception IllegalArgumentException if numBuffers is less than two, + * @throws IllegalStateException if the component has no peer + * @throws IllegalArgumentException if numBuffers is less than two, * or if {@code BufferCapabilities.isPageFlipping} is not * {@code true}. * @see java.awt.BufferCapabilities#isPageFlipping() @@ -4135,7 +4135,7 @@ public abstract class Component implements ImageObserver, MenuContainer, * Provides direct access to the back buffer as an image. * * @return the back buffer as an image - * @exception IllegalStateException if the buffers have not yet + * @throws IllegalStateException if the buffers have not yet * been created */ protected Image getBackBuffer() { @@ -4154,7 +4154,7 @@ public abstract class Component implements ImageObserver, MenuContainer, * for the contents of the back buffer. This should be one of the * values of the {@code BufferCapabilities.FlipContents} * property. - * @exception IllegalStateException if the buffers have not yet + * @throws IllegalStateException if the buffers have not yet * been created * @see java.awt.BufferCapabilities#getFlipContents() */ @@ -6060,7 +6060,7 @@ public abstract class Component implements ImageObserver, MenuContainer, * @return an array of all objects registered as * FooListeners on this component, * or an empty array if no such listeners have been added - * @exception ClassCastException if {@code listenerType} + * @throws ClassCastException if {@code listenerType} * doesn't specify a class or interface that implements * {@code java.util.EventListener} * @throws NullPointerException if {@code listenerType} is {@code null} @@ -8352,7 +8352,7 @@ public abstract class Component implements ImageObserver, MenuContainer, * Adds the specified popup menu to the component. * @param popup the popup menu to be added to the component. * @see #remove(MenuComponent) - * @exception NullPointerException if {@code popup} is {@code null} + * @throws NullPointerException if {@code popup} is {@code null} * @since 1.1 */ public void add(PopupMenu popup) { @@ -9192,7 +9192,7 @@ public abstract class Component implements ImageObserver, MenuContainer, * * @param orientation the new component orientation of this component and * the components contained within it. - * @exception NullPointerException if {@code orientation} is null. + * @throws NullPointerException if {@code orientation} is null. * @see #setComponentOrientation * @see #getComponentOrientation * @see #invalidate diff --git a/src/java.desktop/share/classes/java/awt/Container.java b/src/java.desktop/share/classes/java/awt/Container.java index 5b4489f3cac..f63c507a829 100644 --- a/src/java.desktop/share/classes/java/awt/Container.java +++ b/src/java.desktop/share/classes/java/awt/Container.java @@ -340,7 +340,7 @@ public class Container extends Component { * * @param n the index of the component to get. * @return the nth component in this container. - * @exception ArrayIndexOutOfBoundsException + * @throws ArrayIndexOutOfBoundsException * if the nth value does not exist. * @see Component#getTreeLock() */ @@ -429,7 +429,7 @@ public class Container extends Component { * display the added component. * * @param comp the component to be added - * @exception NullPointerException if {@code comp} is {@code null} + * @throws NullPointerException if {@code comp} is {@code null} * @see #addImpl * @see #invalidate * @see #validate @@ -456,7 +456,7 @@ public class Container extends Component { * @param name the name of the component to be added * @param comp the component to be added * @return the component added - * @exception NullPointerException if {@code comp} is {@code null} + * @throws NullPointerException if {@code comp} is {@code null} * @see #add(Component, Object) * @see #invalidate */ @@ -479,8 +479,8 @@ public class Container extends Component { * @param comp the component to be added * @param index the position at which to insert the component, * or {@code -1} to append the component to the end - * @exception NullPointerException if {@code comp} is {@code null} - * @exception IllegalArgumentException if {@code index} is invalid (see + * @throws NullPointerException if {@code comp} is {@code null} + * @throws IllegalArgumentException if {@code index} is invalid (see * {@link #addImpl} for details) * @return the component {@code comp} * @see #addImpl @@ -764,17 +764,17 @@ public class Container extends Component { * @param index the position in the container's list to * insert the component, where {@code getComponentCount()} * appends to the end - * @exception NullPointerException if {@code comp} is + * @throws NullPointerException if {@code comp} is * {@code null} - * @exception IllegalArgumentException if {@code comp} is one of the + * @throws IllegalArgumentException if {@code comp} is one of the * container's parents - * @exception IllegalArgumentException if {@code index} is not in + * @throws IllegalArgumentException if {@code index} is not in * the range {@code [0, getComponentCount()]} for moving * between containers, or not in the range * {@code [0, getComponentCount()-1]} for moving inside * a container - * @exception IllegalArgumentException if adding a container to itself - * @exception IllegalArgumentException if adding a {@code Window} + * @throws IllegalArgumentException if adding a container to itself + * @throws IllegalArgumentException if adding a {@code Window} * to a container * @see #getComponentZOrder(java.awt.Component) * @see #invalidate @@ -989,7 +989,7 @@ public class Container extends Component { * @param comp the component to be added * @param constraints an object expressing * layout constraints for this component - * @exception NullPointerException if {@code comp} is {@code null} + * @throws NullPointerException if {@code comp} is {@code null} * @see #addImpl * @see #invalidate * @see #validate @@ -1019,8 +1019,8 @@ public class Container extends Component { * @param index the position in the container's list at which to insert * the component; {@code -1} means insert at the end * component - * @exception NullPointerException if {@code comp} is {@code null} - * @exception IllegalArgumentException if {@code index} is invalid (see + * @throws NullPointerException if {@code comp} is {@code null} + * @throws IllegalArgumentException if {@code index} is invalid (see * {@link #addImpl} for details) * @see #addImpl * @see #invalidate @@ -1082,16 +1082,16 @@ public class Container extends Component { * @param index the position in the container's list at which to * insert the component, where {@code -1} * means append to the end - * @exception IllegalArgumentException if {@code index} is invalid; + * @throws IllegalArgumentException if {@code index} is invalid; * if {@code comp} is a child of this container, the valid * range is {@code [-1, getComponentCount()-1]}; if component is * not a child of this container, the valid range is * {@code [-1, getComponentCount()]} * - * @exception IllegalArgumentException if {@code comp} is an ancestor of + * @throws IllegalArgumentException if {@code comp} is an ancestor of * this container - * @exception IllegalArgumentException if adding a window to a container - * @exception NullPointerException if {@code comp} is {@code null} + * @throws IllegalArgumentException if adding a window to a container + * @throws NullPointerException if {@code comp} is {@code null} * @see #add(Component) * @see #add(Component, int) * @see #add(Component, java.lang.Object) @@ -2213,10 +2213,10 @@ public class Container extends Component { * @return an array of all objects registered as * FooListeners on this container, * or an empty array if no such listeners have been added - * @exception ClassCastException if {@code listenerType} + * @throws ClassCastException if {@code listenerType} * doesn't specify a class or interface that implements * {@code java.util.EventListener} - * @exception NullPointerException if {@code listenerType} is {@code null} + * @throws NullPointerException if {@code listenerType} is {@code null} * * @see #getContainerListeners * @@ -2622,7 +2622,7 @@ public class Container extends Component { * a non-null value if the mouse pointer is above {@code Container} or any * of its descendants. * - * @exception HeadlessException if GraphicsEnvironment.isHeadless() returns true + * @throws HeadlessException if GraphicsEnvironment.isHeadless() returns true * @param allowChildren true if children should be taken into account * @see Component#getMousePosition * @return mouse coordinates relative to this {@code Component}, or null @@ -3556,7 +3556,7 @@ public class Container extends Component { * * @param o the new component orientation of this container and * the components contained within it. - * @exception NullPointerException if {@code orientation} is null. + * @throws NullPointerException if {@code orientation} is null. * @see Component#setComponentOrientation * @see Component#getComponentOrientation * @see #invalidate diff --git a/src/java.desktop/share/classes/java/awt/Cursor.java b/src/java.desktop/share/classes/java/awt/Cursor.java index 936d17da46f..cfccf06723b 100644 --- a/src/java.desktop/share/classes/java/awt/Cursor.java +++ b/src/java.desktop/share/classes/java/awt/Cursor.java @@ -285,9 +285,9 @@ public class Cursor implements java.io.Serializable { * * @param name a string describing the desired system-specific custom cursor * @return the system specific custom cursor named - * @exception HeadlessException if + * @throws HeadlessException if * {@code GraphicsEnvironment.isHeadless} returns true - * @exception AWTException in case of erroneous retrieving of the cursor + * @throws AWTException in case of erroneous retrieving of the cursor */ public static Cursor getSystemCustomCursor(final String name) throws AWTException, HeadlessException { diff --git a/src/java.desktop/share/classes/java/awt/Dialog.java b/src/java.desktop/share/classes/java/awt/Dialog.java index 1a54d707306..2c126e74ffc 100644 --- a/src/java.desktop/share/classes/java/awt/Dialog.java +++ b/src/java.desktop/share/classes/java/awt/Dialog.java @@ -329,9 +329,9 @@ public class Dialog extends Window { * * @param owner the owner of the dialog or {@code null} if * this dialog has no owner - * @exception java.lang.IllegalArgumentException if the {@code owner}'s + * @throws java.lang.IllegalArgumentException if the {@code owner}'s * {@code GraphicsConfiguration} is not from a screen device - * @exception HeadlessException when + * @throws HeadlessException when * {@code GraphicsEnvironment.isHeadless()} returns {@code true} * * @see java.awt.GraphicsEnvironment#isHeadless @@ -352,9 +352,9 @@ public class Dialog extends Window { * windows when shown. If {@code false}, the dialog is {@code MODELESS}; * if {@code true}, the modality type property is set to * {@code DEFAULT_MODALITY_TYPE} - * @exception java.lang.IllegalArgumentException if the {@code owner}'s + * @throws java.lang.IllegalArgumentException if the {@code owner}'s * {@code GraphicsConfiguration} is not from a screen device - * @exception HeadlessException when + * @throws HeadlessException when * {@code GraphicsEnvironment.isHeadless()} returns {@code true} * * @see java.awt.Dialog.ModalityType @@ -376,9 +376,9 @@ public class Dialog extends Window { * this dialog has no owner * @param title the title of the dialog or {@code null} if this dialog * has no title - * @exception IllegalArgumentException if the {@code owner}'s + * @throws IllegalArgumentException if the {@code owner}'s * {@code GraphicsConfiguration} is not from a screen device - * @exception HeadlessException when + * @throws HeadlessException when * {@code GraphicsEnvironment.isHeadless()} returns {@code true} * * @see java.awt.GraphicsEnvironment#isHeadless @@ -401,9 +401,9 @@ public class Dialog extends Window { * windows when shown. If {@code false}, the dialog is {@code MODELESS}; * if {@code true}, the modality type property is set to * {@code DEFAULT_MODALITY_TYPE} - * @exception java.lang.IllegalArgumentException if the {@code owner}'s + * @throws java.lang.IllegalArgumentException if the {@code owner}'s * {@code GraphicsConfiguration} is not from a screen device - * @exception HeadlessException when + * @throws HeadlessException when * {@code GraphicsEnvironment.isHeadless()} returns {@code true} * * @see java.awt.Dialog.ModalityType @@ -433,9 +433,9 @@ public class Dialog extends Window { * @param gc the {@code GraphicsConfiguration} of the target screen device; * if {@code null}, the default system {@code GraphicsConfiguration} * is assumed - * @exception java.lang.IllegalArgumentException if {@code gc} + * @throws java.lang.IllegalArgumentException if {@code gc} * is not from a screen device - * @exception HeadlessException when + * @throws HeadlessException when * {@code GraphicsEnvironment.isHeadless()} returns {@code true} * * @see java.awt.Dialog.ModalityType @@ -459,9 +459,9 @@ public class Dialog extends Window { * * @param owner the owner of the dialog or {@code null} if this * dialog has no owner - * @exception java.lang.IllegalArgumentException if the {@code owner}'s + * @throws java.lang.IllegalArgumentException if the {@code owner}'s * {@code GraphicsConfiguration} is not from a screen device - * @exception HeadlessException when + * @throws HeadlessException when * {@code GraphicsEnvironment.isHeadless()} returns {@code true} * @see java.awt.GraphicsEnvironment#isHeadless * @since 1.2 @@ -478,9 +478,9 @@ public class Dialog extends Window { * has no owner * @param title the title of the dialog or {@code null} if this dialog * has no title - * @exception java.lang.IllegalArgumentException if the {@code owner}'s + * @throws java.lang.IllegalArgumentException if the {@code owner}'s * {@code GraphicsConfiguration} is not from a screen device - * @exception HeadlessException when + * @throws HeadlessException when * {@code GraphicsEnvironment.isHeadless()} returns {@code true} * * @see java.awt.GraphicsEnvironment#isHeadless @@ -502,9 +502,9 @@ public class Dialog extends Window { * windows when shown. If {@code false}, the dialog is {@code MODELESS}; * if {@code true}, the modality type property is set to * {@code DEFAULT_MODALITY_TYPE} - * @exception IllegalArgumentException if the {@code owner}'s + * @throws IllegalArgumentException if the {@code owner}'s * {@code GraphicsConfiguration} is not from a screen device - * @exception HeadlessException when + * @throws HeadlessException when * {@code GraphicsEnvironment.isHeadless()} returns {@code true} * * @see java.awt.Dialog.ModalityType @@ -536,9 +536,9 @@ public class Dialog extends Window { * @param gc the {@code GraphicsConfiguration} of the target screen device; * if {@code null}, the default system {@code GraphicsConfiguration} * is assumed - * @exception java.lang.IllegalArgumentException if {@code gc} + * @throws java.lang.IllegalArgumentException if {@code gc} * is not from a screen device - * @exception HeadlessException when + * @throws HeadlessException when * {@code GraphicsEnvironment.isHeadless()} returns {@code true} * * @see java.awt.Dialog.ModalityType @@ -565,12 +565,12 @@ public class Dialog extends Window { * {@link java.awt.Dialog Dialog}, {@link java.awt.Frame Frame}, any * of their descendants or {@code null} * - * @exception java.lang.IllegalArgumentException if the {@code owner} + * @throws java.lang.IllegalArgumentException if the {@code owner} * is not an instance of {@link java.awt.Dialog Dialog} or {@link * java.awt.Frame Frame} - * @exception java.lang.IllegalArgumentException if the {@code owner}'s + * @throws java.lang.IllegalArgumentException if the {@code owner}'s * {@code GraphicsConfiguration} is not from a screen device - * @exception HeadlessException when + * @throws HeadlessException when * {@code GraphicsEnvironment.isHeadless()} returns {@code true} * * @see java.awt.GraphicsEnvironment#isHeadless @@ -591,12 +591,12 @@ public class Dialog extends Window { * @param title the title of the dialog or {@code null} if this dialog * has no title * - * @exception java.lang.IllegalArgumentException if the {@code owner} + * @throws java.lang.IllegalArgumentException if the {@code owner} * is not an instance of {@link java.awt.Dialog Dialog} or {@link * java.awt.Frame Frame} - * @exception java.lang.IllegalArgumentException if the {@code owner}'s + * @throws java.lang.IllegalArgumentException if the {@code owner}'s * {@code GraphicsConfiguration} is not from a screen device - * @exception HeadlessException when + * @throws HeadlessException when * {@code GraphicsEnvironment.isHeadless()} returns {@code true} * * @see java.awt.GraphicsEnvironment#isHeadless @@ -618,14 +618,14 @@ public class Dialog extends Window { * windows when shown. {@code null} value and unsupported modality * types are equivalent to {@code MODELESS} * - * @exception java.lang.IllegalArgumentException if the {@code owner} + * @throws java.lang.IllegalArgumentException if the {@code owner} * is not an instance of {@link java.awt.Dialog Dialog} or {@link * java.awt.Frame Frame} - * @exception java.lang.IllegalArgumentException if the {@code owner}'s + * @throws java.lang.IllegalArgumentException if the {@code owner}'s * {@code GraphicsConfiguration} is not from a screen device - * @exception HeadlessException when + * @throws HeadlessException when * {@code GraphicsEnvironment.isHeadless()} returns {@code true} - * @exception SecurityException if the calling thread does not have permission + * @throws SecurityException if the calling thread does not have permission * to create modal dialogs with the given {@code modalityType} * * @see java.awt.Dialog.ModalityType @@ -653,14 +653,14 @@ public class Dialog extends Window { * windows when shown. {@code null} value and unsupported modality * types are equivalent to {@code MODELESS} * - * @exception java.lang.IllegalArgumentException if the {@code owner} + * @throws java.lang.IllegalArgumentException if the {@code owner} * is not an instance of {@link java.awt.Dialog Dialog} or {@link * java.awt.Frame Frame} - * @exception java.lang.IllegalArgumentException if the {@code owner}'s + * @throws java.lang.IllegalArgumentException if the {@code owner}'s * {@code GraphicsConfiguration} is not from a screen device - * @exception HeadlessException when + * @throws HeadlessException when * {@code GraphicsEnvironment.isHeadless()} returns {@code true} - * @exception SecurityException if the calling thread does not have permission + * @throws SecurityException if the calling thread does not have permission * to create modal dialogs with the given {@code modalityType} * * @see java.awt.Dialog.ModalityType @@ -704,14 +704,14 @@ public class Dialog extends Window { * if {@code null}, the default system {@code GraphicsConfiguration} * is assumed * - * @exception java.lang.IllegalArgumentException if the {@code owner} + * @throws java.lang.IllegalArgumentException if the {@code owner} * is not an instance of {@link java.awt.Dialog Dialog} or {@link * java.awt.Frame Frame} - * @exception java.lang.IllegalArgumentException if {@code gc} + * @throws java.lang.IllegalArgumentException if {@code gc} * is not from a screen device - * @exception HeadlessException when + * @throws HeadlessException when * {@code GraphicsEnvironment.isHeadless()} returns {@code true} - * @exception SecurityException if the calling thread does not have permission + * @throws SecurityException if the calling thread does not have permission * to create modal dialogs with the given {@code modalityType} * * @see java.awt.Dialog.ModalityType @@ -848,7 +848,7 @@ public class Dialog extends Window { * @param type specifies whether dialog blocks input to other * windows when shown. {@code null} value and unsupported modality * types are equivalent to {@code MODELESS} - * @exception SecurityException if the calling thread does not have permission + * @throws SecurityException if the calling thread does not have permission * to create modal dialogs with the given {@code modalityType} * * @see java.awt.Dialog#getModalityType diff --git a/src/java.desktop/share/classes/java/awt/EventQueue.java b/src/java.desktop/share/classes/java/awt/EventQueue.java index e7d1dcc8286..4dce257f727 100644 --- a/src/java.desktop/share/classes/java/awt/EventQueue.java +++ b/src/java.desktop/share/classes/java/awt/EventQueue.java @@ -544,7 +544,7 @@ public class EventQueue { * returns it. This method will block until an event has * been posted by another thread. * @return the next {@code AWTEvent} - * @exception InterruptedException + * @throws InterruptedException * if any thread has interrupted this thread */ public AWTEvent getNextEvent() throws InterruptedException { @@ -946,7 +946,7 @@ public class EventQueue { * Warning: To avoid deadlock, do not declare this method * synchronized in a subclass. * - * @exception EmptyStackException if no previous push was made + * @throws EmptyStackException if no previous push was made * on this {@code EventQueue} * @see java.awt.EventQueue#push * @since 1.2 @@ -1331,9 +1331,9 @@ public class EventQueue { * synchronously in the * {@link #isDispatchThread event dispatch thread} * of {@link Toolkit#getSystemEventQueue the system EventQueue} - * @exception InterruptedException if any thread has + * @throws InterruptedException if any thread has * interrupted this thread - * @exception InvocationTargetException if an throwable is thrown + * @throws InvocationTargetException if an throwable is thrown * when running {@code runnable} * @see #invokeLater * @see Toolkit#getSystemEventQueue diff --git a/src/java.desktop/share/classes/java/awt/FileDialog.java b/src/java.desktop/share/classes/java/awt/FileDialog.java index b6a501b44e9..399544b9547 100644 --- a/src/java.desktop/share/classes/java/awt/FileDialog.java +++ b/src/java.desktop/share/classes/java/awt/FileDialog.java @@ -232,7 +232,7 @@ public class FileDialog extends Dialog { * @param title the title of the dialog * @param mode the mode of the dialog; either * {@code FileDialog.LOAD} or {@code FileDialog.SAVE} - * @exception IllegalArgumentException if an illegal file + * @throws IllegalArgumentException if an illegal file * dialog mode is supplied * @see java.awt.FileDialog#LOAD * @see java.awt.FileDialog#SAVE @@ -255,10 +255,10 @@ public class FileDialog extends Dialog { * displayed. * * @param parent the owner of the dialog - * @exception java.lang.IllegalArgumentException if the {@code parent}'s + * @throws java.lang.IllegalArgumentException if the {@code parent}'s * {@code GraphicsConfiguration} * is not from a screen device; - * @exception java.lang.IllegalArgumentException if {@code parent} + * @throws java.lang.IllegalArgumentException if {@code parent} * is {@code null}; this exception is always thrown when * {@code GraphicsEnvironment.isHeadless} * returns {@code true} @@ -285,10 +285,10 @@ public class FileDialog extends Dialog { * @param title the title of the dialog; a {@code null} value * will be accepted without causing a * {@code NullPointerException} to be thrown - * @exception java.lang.IllegalArgumentException if the {@code parent}'s + * @throws java.lang.IllegalArgumentException if the {@code parent}'s * {@code GraphicsConfiguration} * is not from a screen device; - * @exception java.lang.IllegalArgumentException if {@code parent} + * @throws java.lang.IllegalArgumentException if {@code parent} * is {@code null}; this exception is always thrown when * {@code GraphicsEnvironment.isHeadless} * returns {@code true} @@ -321,12 +321,12 @@ public class FileDialog extends Dialog { * {@code NullPointerException} to be thrown * @param mode the mode of the dialog; either * {@code FileDialog.LOAD} or {@code FileDialog.SAVE} - * @exception java.lang.IllegalArgumentException if an illegal + * @throws java.lang.IllegalArgumentException if an illegal * file dialog mode is supplied; - * @exception java.lang.IllegalArgumentException if the {@code parent}'s + * @throws java.lang.IllegalArgumentException if the {@code parent}'s * {@code GraphicsConfiguration} * is not from a screen device; - * @exception java.lang.IllegalArgumentException if {@code parent} + * @throws java.lang.IllegalArgumentException if {@code parent} * is {@code null}; this exception is always thrown when * {@code GraphicsEnvironment.isHeadless} * returns {@code true} @@ -408,7 +408,7 @@ public class FileDialog extends Dialog { * @see java.awt.FileDialog#LOAD * @see java.awt.FileDialog#SAVE * @see java.awt.FileDialog#getMode - * @exception IllegalArgumentException if an illegal file + * @throws IllegalArgumentException if an illegal file * dialog mode is supplied * @since 1.1 */ diff --git a/src/java.desktop/share/classes/java/awt/Frame.java b/src/java.desktop/share/classes/java/awt/Frame.java index 6dde9373c38..e01ef082d42 100644 --- a/src/java.desktop/share/classes/java/awt/Frame.java +++ b/src/java.desktop/share/classes/java/awt/Frame.java @@ -383,7 +383,7 @@ public class Frame extends Window implements MenuContainer { * Constructs a new instance of {@code Frame} that is * initially invisible. The title of the {@code Frame} * is empty. - * @exception HeadlessException when + * @throws HeadlessException when * {@code GraphicsEnvironment.isHeadless()} returns {@code true} * @see java.awt.GraphicsEnvironment#isHeadless() * @see Component#setSize @@ -401,9 +401,9 @@ public class Frame extends Window implements MenuContainer { * of the target screen device. If {@code gc} * is {@code null}, the system default * {@code GraphicsConfiguration} is assumed. - * @exception IllegalArgumentException if + * @throws IllegalArgumentException if * {@code gc} is not from a screen device. - * @exception HeadlessException when + * @throws HeadlessException when * {@code GraphicsEnvironment.isHeadless()} returns {@code true} * @see java.awt.GraphicsEnvironment#isHeadless() * @since 1.3 @@ -418,7 +418,7 @@ public class Frame extends Window implements MenuContainer { * @param title the title to be displayed in the frame's border. * A {@code null} value * is treated as an empty string, "". - * @exception HeadlessException when + * @throws HeadlessException when * {@code GraphicsEnvironment.isHeadless()} returns {@code true} * @see java.awt.GraphicsEnvironment#isHeadless() * @see java.awt.Component#setSize @@ -440,9 +440,9 @@ public class Frame extends Window implements MenuContainer { * of the target screen device. If {@code gc} is * {@code null}, the system default * {@code GraphicsConfiguration} is assumed. - * @exception IllegalArgumentException if {@code gc} + * @throws IllegalArgumentException if {@code gc} * is not from a screen device. - * @exception HeadlessException when + * @throws HeadlessException when * {@code GraphicsEnvironment.isHeadless()} returns {@code true} * @see java.awt.GraphicsEnvironment#isHeadless() * @see java.awt.Component#setSize diff --git a/src/java.desktop/share/classes/java/awt/GraphicsConfiguration.java b/src/java.desktop/share/classes/java/awt/GraphicsConfiguration.java index b698f0f3706..58d502ac03f 100644 --- a/src/java.desktop/share/classes/java/awt/GraphicsConfiguration.java +++ b/src/java.desktop/share/classes/java/awt/GraphicsConfiguration.java @@ -261,7 +261,7 @@ public abstract class GraphicsConfiguration { * @param width the width of the returned {@code VolatileImage} * @param height the height of the returned {@code VolatileImage} * @param caps the image capabilities - * @exception AWTException if the supplied image capabilities could not + * @throws AWTException if the supplied image capabilities could not * be met by this graphics configuration * @since 1.4 */ @@ -294,7 +294,7 @@ public abstract class GraphicsConfiguration { * @see Transparency#BITMASK * @see Transparency#TRANSLUCENT * @throws IllegalArgumentException if the transparency is not a valid value - * @exception AWTException if the supplied image capabilities could not + * @throws AWTException if the supplied image capabilities could not * be met by this graphics configuration * @see Component#createVolatileImage(int, int) * @since 1.5 diff --git a/src/java.desktop/share/classes/java/awt/GraphicsDevice.java b/src/java.desktop/share/classes/java/awt/GraphicsDevice.java index d878f610fca..c08c5580ae7 100644 --- a/src/java.desktop/share/classes/java/awt/GraphicsDevice.java +++ b/src/java.desktop/share/classes/java/awt/GraphicsDevice.java @@ -418,10 +418,10 @@ public abstract class GraphicsDevice { * * * @param dm The new display mode of this graphics device. - * @exception IllegalArgumentException if the {@code DisplayMode} + * @throws IllegalArgumentException if the {@code DisplayMode} * supplied is {@code null}, or is not available in the array returned * by {@code getDisplayModes} - * @exception UnsupportedOperationException if + * @throws UnsupportedOperationException if * {@code isDisplayChangeSupported} returns {@code false} * @see #getDisplayMode * @see #getDisplayModes diff --git a/src/java.desktop/share/classes/java/awt/GraphicsEnvironment.java b/src/java.desktop/share/classes/java/awt/GraphicsEnvironment.java index 438f9f399a0..79102059b0e 100644 --- a/src/java.desktop/share/classes/java/awt/GraphicsEnvironment.java +++ b/src/java.desktop/share/classes/java/awt/GraphicsEnvironment.java @@ -191,7 +191,7 @@ public abstract class GraphicsEnvironment { * objects. * @return an array containing all the {@code GraphicsDevice} * objects that represent screen devices - * @exception HeadlessException if isHeadless() returns true + * @throws HeadlessException if isHeadless() returns true * @see #isHeadless() */ public abstract GraphicsDevice[] getScreenDevices() @@ -201,7 +201,7 @@ public abstract class GraphicsEnvironment { * Returns the default screen {@code GraphicsDevice}. * @return the {@code GraphicsDevice} that represents the * default screen device - * @exception HeadlessException if isHeadless() returns true + * @throws HeadlessException if isHeadless() returns true * @see #isHeadless() */ public abstract GraphicsDevice getDefaultScreenDevice() @@ -383,7 +383,7 @@ public abstract class GraphicsEnvironment { * within the available display area using getMaximumWindowBounds(). * @return the point where Windows should be centered * - * @exception HeadlessException if isHeadless() returns true + * @throws HeadlessException if isHeadless() returns true * @see #getMaximumWindowBounds * @since 1.4 */ @@ -409,7 +409,7 @@ public abstract class GraphicsEnvironment { * {@code Toolkit.getScreenInsets()}. * @return the maximum bounds for centered Windows * - * @exception HeadlessException if isHeadless() returns true + * @throws HeadlessException if isHeadless() returns true * @see #getCenterPoint * @see GraphicsConfiguration#getBounds * @see Toolkit#getScreenInsets diff --git a/src/java.desktop/share/classes/java/awt/GridBagLayout.java b/src/java.desktop/share/classes/java/awt/GridBagLayout.java index ff3bec8b115..e0692ac0624 100644 --- a/src/java.desktop/share/classes/java/awt/GridBagLayout.java +++ b/src/java.desktop/share/classes/java/awt/GridBagLayout.java @@ -688,7 +688,7 @@ java.io.Serializable { * @param comp the component to be added * @param constraints an object that determines how * the component is added to the layout - * @exception IllegalArgumentException if {@code constraints} + * @throws IllegalArgumentException if {@code constraints} * is not a {@code GridBagConstraint} */ public void addLayoutComponent(Component comp, Object constraints) { diff --git a/src/java.desktop/share/classes/java/awt/GridLayout.java b/src/java.desktop/share/classes/java/awt/GridLayout.java index 4a3b66f4332..5c9265bc912 100644 --- a/src/java.desktop/share/classes/java/awt/GridLayout.java +++ b/src/java.desktop/share/classes/java/awt/GridLayout.java @@ -186,7 +186,7 @@ public class GridLayout implements LayoutManager, java.io.Serializable { * any number of columns * @param hgap the horizontal gap * @param vgap the vertical gap - * @exception IllegalArgumentException if the value of both + * @throws IllegalArgumentException if the value of both * {@code rows} and {@code cols} is * set to zero */ @@ -212,7 +212,7 @@ public class GridLayout implements LayoutManager, java.io.Serializable { /** * Sets the number of rows in this layout to the specified value. * @param rows the number of rows in this layout - * @exception IllegalArgumentException if the value of both + * @throws IllegalArgumentException if the value of both * {@code rows} and {@code cols} is set to zero * @since 1.1 */ @@ -240,7 +240,7 @@ public class GridLayout implements LayoutManager, java.io.Serializable { * of columns displayed in the layout is determined by the total * number of components and the number of rows specified. * @param cols the number of columns in this layout - * @exception IllegalArgumentException if the value of both + * @throws IllegalArgumentException if the value of both * {@code rows} and {@code cols} is set to zero * @since 1.1 */ diff --git a/src/java.desktop/share/classes/java/awt/Image.java b/src/java.desktop/share/classes/java/awt/Image.java index 7e627323269..1ad4ec9226f 100644 --- a/src/java.desktop/share/classes/java/awt/Image.java +++ b/src/java.desktop/share/classes/java/awt/Image.java @@ -105,7 +105,7 @@ public abstract class Image { * Creates a graphics context for drawing to an off-screen image. * This method can only be called for off-screen images. * @return a graphics context to draw to the off-screen image. - * @exception UnsupportedOperationException if called for a + * @throws UnsupportedOperationException if called for a * non-off-screen image. * @see java.awt.Graphics * @see java.awt.Component#createImage(int, int) @@ -162,7 +162,7 @@ public abstract class Image { * @param hints flags to indicate the type of algorithm to use * for image resampling. * @return a scaled version of the image. - * @exception IllegalArgumentException if {@code width} + * @throws IllegalArgumentException if {@code width} * or {@code height} is zero. * @see java.awt.Image#SCALE_DEFAULT * @see java.awt.Image#SCALE_FAST diff --git a/src/java.desktop/share/classes/java/awt/Label.java b/src/java.desktop/share/classes/java/awt/Label.java index b061efb5170..ad8ff4c2b82 100644 --- a/src/java.desktop/share/classes/java/awt/Label.java +++ b/src/java.desktop/share/classes/java/awt/Label.java @@ -114,7 +114,7 @@ public class Label extends Component implements Accessible { /** * Constructs an empty label. * The text of the label is the empty string {@code ""}. - * @exception HeadlessException if GraphicsEnvironment.isHeadless() + * @throws HeadlessException if GraphicsEnvironment.isHeadless() * returns true. * @see java.awt.GraphicsEnvironment#isHeadless */ @@ -129,7 +129,7 @@ public class Label extends Component implements Accessible { * A {@code null} value * will be accepted without causing a NullPointerException * to be thrown. - * @exception HeadlessException if GraphicsEnvironment.isHeadless() + * @throws HeadlessException if GraphicsEnvironment.isHeadless() * returns true. * @see java.awt.GraphicsEnvironment#isHeadless */ @@ -147,7 +147,7 @@ public class Label extends Component implements Accessible { * will be accepted without causing a NullPointerException * to be thrown. * @param alignment the alignment value. - * @exception HeadlessException if GraphicsEnvironment.isHeadless() + * @throws HeadlessException if GraphicsEnvironment.isHeadless() * returns true. * @see java.awt.GraphicsEnvironment#isHeadless */ @@ -216,7 +216,7 @@ public class Label extends Component implements Accessible { * Possible values are {@code Label.LEFT}, * {@code Label.RIGHT}, and {@code Label.CENTER}. * @param alignment the alignment to be set. - * @exception IllegalArgumentException if an improper value for + * @throws IllegalArgumentException if an improper value for * {@code alignment} is given. * @see java.awt.Label#getAlignment */ diff --git a/src/java.desktop/share/classes/java/awt/List.java b/src/java.desktop/share/classes/java/awt/List.java index f29374ab6bc..fe1a5dc5530 100644 --- a/src/java.desktop/share/classes/java/awt/List.java +++ b/src/java.desktop/share/classes/java/awt/List.java @@ -193,7 +193,7 @@ public class List extends Component implements ItemSelectable, Accessible { * not allowed. Note that this is a convenience method for * {@code List(0, false)}. Also note that the number of visible * lines in the list cannot be changed after it has been created. - * @exception HeadlessException if GraphicsEnvironment.isHeadless() + * @throws HeadlessException if GraphicsEnvironment.isHeadless() * returns true. * @see java.awt.GraphicsEnvironment#isHeadless */ @@ -209,7 +209,7 @@ public class List extends Component implements ItemSelectable, Accessible { * of visible rows in the list cannot be changed after it has * been created. * @param rows the number of items to show. - * @exception HeadlessException if GraphicsEnvironment.isHeadless() + * @throws HeadlessException if GraphicsEnvironment.isHeadless() * returns true. * @see java.awt.GraphicsEnvironment#isHeadless * @since 1.1 @@ -238,7 +238,7 @@ public class List extends Component implements ItemSelectable, Accessible { * @param multipleMode if {@code true}, * then multiple selections are allowed; * otherwise, only one item can be selected at a time. - * @exception HeadlessException if GraphicsEnvironment.isHeadless() + * @throws HeadlessException if GraphicsEnvironment.isHeadless() * returns true. * @see java.awt.GraphicsEnvironment#isHeadless */ @@ -411,7 +411,7 @@ public class List extends Component implements ItemSelectable, Accessible { * with the new string. * @param newValue a new string to replace an existing item * @param index the position of the item to replace - * @exception ArrayIndexOutOfBoundsException if {@code index} + * @throws ArrayIndexOutOfBoundsException if {@code index} * is out of range */ public synchronized void replaceItem(String newValue, int index) { @@ -448,7 +448,7 @@ public class List extends Component implements ItemSelectable, Accessible { * If the specified item is selected, and is the only selected * item in the list, the list is set to have no selection. * @param item the item to remove from the list - * @exception IllegalArgumentException + * @throws IllegalArgumentException * if the item doesn't exist in the list * @since 1.1 */ @@ -470,7 +470,7 @@ public class List extends Component implements ItemSelectable, Accessible { * @param position the index of the item to delete * @see #add(String, int) * @since 1.1 - * @exception ArrayIndexOutOfBoundsException + * @throws ArrayIndexOutOfBoundsException * if the {@code position} is less than 0 or * greater than {@code getItemCount()-1} */ @@ -1053,7 +1053,7 @@ public class List extends Component implements ItemSelectable, Accessible { * FooListeners on this list, * or an empty array if no such * listeners have been added - * @exception ClassCastException if {@code listenerType} + * @throws ClassCastException if {@code listenerType} * doesn't specify a class or interface that implements * {@code java.util.EventListener} * @@ -1631,7 +1631,7 @@ public class List extends Component implements ItemSelectable, Accessible { * @return This component's locale. If this component does not have * a locale, the locale of its parent is returned. * - * @exception IllegalComponentStateException + * @throws IllegalComponentStateException * If the Component does not have its own locale and has not yet * been added to a containment hierarchy such that the locale can * be determined from the containing parent. diff --git a/src/java.desktop/share/classes/java/awt/MediaTracker.java b/src/java.desktop/share/classes/java/awt/MediaTracker.java index e2b754c40af..37e372d0d1f 100644 --- a/src/java.desktop/share/classes/java/awt/MediaTracker.java +++ b/src/java.desktop/share/classes/java/awt/MediaTracker.java @@ -396,7 +396,7 @@ public class MediaTracker implements java.io.Serializable { * @see java.awt.MediaTracker#waitForAll(long) * @see java.awt.MediaTracker#isErrorAny * @see java.awt.MediaTracker#isErrorID - * @exception InterruptedException if any thread has + * @throws InterruptedException if any thread has * interrupted this thread */ public void waitForAll() throws InterruptedException { @@ -421,7 +421,7 @@ public class MediaTracker implements java.io.Serializable { * @see java.awt.MediaTracker#waitForAll(long) * @see java.awt.MediaTracker#isErrorAny * @see java.awt.MediaTracker#isErrorID - * @exception InterruptedException if any thread has + * @throws InterruptedException if any thread has * interrupted this thread. */ public synchronized boolean waitForAll(long ms) @@ -627,7 +627,7 @@ public class MediaTracker implements java.io.Serializable { * @see java.awt.MediaTracker#waitForAll * @see java.awt.MediaTracker#isErrorAny() * @see java.awt.MediaTracker#isErrorID(int) - * @exception InterruptedException if any thread has + * @throws InterruptedException if any thread has * interrupted this thread. */ public void waitForID(int id) throws InterruptedException { @@ -655,7 +655,7 @@ public class MediaTracker implements java.io.Serializable { * @see java.awt.MediaTracker#statusID * @see java.awt.MediaTracker#isErrorAny() * @see java.awt.MediaTracker#isErrorID(int) - * @exception InterruptedException if any thread has + * @throws InterruptedException if any thread has * interrupted this thread. */ public synchronized boolean waitForID(int id, long ms) diff --git a/src/java.desktop/share/classes/java/awt/Menu.java b/src/java.desktop/share/classes/java/awt/Menu.java index 5f24c7cb8bd..79c3dfe0d82 100644 --- a/src/java.desktop/share/classes/java/awt/Menu.java +++ b/src/java.desktop/share/classes/java/awt/Menu.java @@ -125,7 +125,7 @@ public class Menu extends MenuItem implements MenuContainer, Accessible { /** * Constructs a new menu with an empty label. This menu is not * a tear-off menu. - * @exception HeadlessException if GraphicsEnvironment.isHeadless() + * @throws HeadlessException if GraphicsEnvironment.isHeadless() * returns true. * @see java.awt.GraphicsEnvironment#isHeadless * @since 1.1 @@ -139,7 +139,7 @@ public class Menu extends MenuItem implements MenuContainer, Accessible { * a tear-off menu. * @param label the menu's label in the menu bar, or in * another menu of which this menu is a submenu. - * @exception HeadlessException if GraphicsEnvironment.isHeadless() + * @throws HeadlessException if GraphicsEnvironment.isHeadless() * returns true. * @see java.awt.GraphicsEnvironment#isHeadless */ @@ -158,7 +158,7 @@ public class Menu extends MenuItem implements MenuContainer, Accessible { * another menu of which this menu is a submenu. * @param tearOff if {@code true}, the menu * is a tear-off menu. - * @exception HeadlessException if GraphicsEnvironment.isHeadless() + * @throws HeadlessException if GraphicsEnvironment.isHeadless() * returns true. * @see java.awt.GraphicsEnvironment#isHeadless */ @@ -313,7 +313,7 @@ public class Menu extends MenuItem implements MenuContainer, Accessible { * item should be inserted. * @see java.awt.Menu#add(java.lang.String) * @see java.awt.Menu#add(java.awt.MenuItem) - * @exception IllegalArgumentException if the value of + * @throws IllegalArgumentException if the value of * {@code index} is less than zero * @since 1.1 */ @@ -357,7 +357,7 @@ public class Menu extends MenuItem implements MenuContainer, Accessible { * should be inserted * @see java.awt.Menu#add(java.lang.String) * @see java.awt.Menu#add(java.awt.MenuItem) - * @exception IllegalArgumentException if the value of + * @throws IllegalArgumentException if the value of * {@code index} is less than zero * @since 1.1 */ @@ -378,7 +378,7 @@ public class Menu extends MenuItem implements MenuContainer, Accessible { * Inserts a separator at the specified position. * @param index the position at which the * menu separator should be inserted. - * @exception IllegalArgumentException if the value of + * @throws IllegalArgumentException if the value of * {@code index} is less than 0. * @see java.awt.Menu#addSeparator * @since 1.1 diff --git a/src/java.desktop/share/classes/java/awt/MenuBar.java b/src/java.desktop/share/classes/java/awt/MenuBar.java index 2f78371407a..c1016f5bd0b 100644 --- a/src/java.desktop/share/classes/java/awt/MenuBar.java +++ b/src/java.desktop/share/classes/java/awt/MenuBar.java @@ -127,7 +127,7 @@ public class MenuBar extends MenuComponent implements MenuContainer, Accessible /** * Creates a new menu bar. - * @exception HeadlessException if GraphicsEnvironment.isHeadless() + * @throws HeadlessException if GraphicsEnvironment.isHeadless() * returns true. * @see java.awt.GraphicsEnvironment#isHeadless */ diff --git a/src/java.desktop/share/classes/java/awt/MenuComponent.java b/src/java.desktop/share/classes/java/awt/MenuComponent.java index 2550eea7f52..a2d28fb9e3e 100644 --- a/src/java.desktop/share/classes/java/awt/MenuComponent.java +++ b/src/java.desktop/share/classes/java/awt/MenuComponent.java @@ -176,7 +176,7 @@ public abstract class MenuComponent implements java.io.Serializable { /** * Creates a {@code MenuComponent}. - * @exception HeadlessException if + * @throws HeadlessException if * {@code GraphicsEnvironment.isHeadless} * returns {@code true} * @see java.awt.GraphicsEnvironment#isHeadless diff --git a/src/java.desktop/share/classes/java/awt/MenuItem.java b/src/java.desktop/share/classes/java/awt/MenuItem.java index d1f6f59aa15..adc37db7111 100644 --- a/src/java.desktop/share/classes/java/awt/MenuItem.java +++ b/src/java.desktop/share/classes/java/awt/MenuItem.java @@ -185,7 +185,7 @@ public class MenuItem extends MenuComponent implements Accessible { /** * Constructs a new MenuItem with an empty label and no keyboard * shortcut. - * @exception HeadlessException if GraphicsEnvironment.isHeadless() + * @throws HeadlessException if GraphicsEnvironment.isHeadless() * returns true. * @see java.awt.GraphicsEnvironment#isHeadless * @since 1.1 @@ -201,7 +201,7 @@ public class MenuItem extends MenuComponent implements Accessible { * menu items. By default, all menu items except for * separators are enabled. * @param label the label for this menu item. - * @exception HeadlessException if GraphicsEnvironment.isHeadless() + * @throws HeadlessException if GraphicsEnvironment.isHeadless() * returns true. * @see java.awt.GraphicsEnvironment#isHeadless * @since 1.0 @@ -218,7 +218,7 @@ public class MenuItem extends MenuComponent implements Accessible { * @param label the label for this menu item. * @param s the instance of {@code MenuShortcut} * associated with this menu item. - * @exception HeadlessException if GraphicsEnvironment.isHeadless() + * @throws HeadlessException if GraphicsEnvironment.isHeadless() * returns true. * @see java.awt.GraphicsEnvironment#isHeadless * @since 1.1 @@ -616,7 +616,7 @@ public class MenuItem extends MenuComponent implements Accessible { * FooListeners on this menu item, * or an empty array if no such * listeners have been added - * @exception ClassCastException if {@code listenerType} + * @throws ClassCastException if {@code listenerType} * doesn't specify a class or interface that implements * {@code java.util.EventListener} * diff --git a/src/java.desktop/share/classes/java/awt/MouseInfo.java b/src/java.desktop/share/classes/java/awt/MouseInfo.java index 76b5ed6e397..3dd115e0724 100644 --- a/src/java.desktop/share/classes/java/awt/MouseInfo.java +++ b/src/java.desktop/share/classes/java/awt/MouseInfo.java @@ -62,8 +62,8 @@ public class MouseInfo { * permission before creating and returning a {@code PointerInfo} * object. This may result in a {@code SecurityException}. * - * @exception HeadlessException if GraphicsEnvironment.isHeadless() returns true - * @exception SecurityException if a security manager exists and its + * @throws HeadlessException if GraphicsEnvironment.isHeadless() returns true + * @throws SecurityException if a security manager exists and its * {@code checkPermission} method doesn't allow the operation * @see GraphicsConfiguration * @see SecurityManager#checkPermission @@ -124,7 +124,7 @@ public class MouseInfo { * by requesting the {@code "awt.mouse.numButtons"} desktop property * which is set by the underlying native platform. * - * @exception HeadlessException if GraphicsEnvironment.isHeadless() returns true + * @throws HeadlessException if GraphicsEnvironment.isHeadless() returns true * @return number of buttons on the mouse * @see Toolkit#getDesktopProperty * @since 1.5 diff --git a/src/java.desktop/share/classes/java/awt/Polygon.java b/src/java.desktop/share/classes/java/awt/Polygon.java index 64f049cd1c7..e74ce5cb10f 100644 --- a/src/java.desktop/share/classes/java/awt/Polygon.java +++ b/src/java.desktop/share/classes/java/awt/Polygon.java @@ -139,12 +139,12 @@ public class Polygon implements Shape, java.io.Serializable { * @param ypoints an array of Y coordinates * @param npoints the total number of points in the * {@code Polygon} - * @exception NegativeArraySizeException if the value of + * @throws NegativeArraySizeException if the value of * {@code npoints} is negative. - * @exception IndexOutOfBoundsException if {@code npoints} is + * @throws IndexOutOfBoundsException if {@code npoints} is * greater than the length of {@code xpoints} * or the length of {@code ypoints}. - * @exception NullPointerException if {@code xpoints} or + * @throws NullPointerException if {@code xpoints} or * {@code ypoints} is {@code null}. * @since 1.0 */ diff --git a/src/java.desktop/share/classes/java/awt/PopupMenu.java b/src/java.desktop/share/classes/java/awt/PopupMenu.java index fd56461df55..e9b88d2a12f 100644 --- a/src/java.desktop/share/classes/java/awt/PopupMenu.java +++ b/src/java.desktop/share/classes/java/awt/PopupMenu.java @@ -69,7 +69,7 @@ public class PopupMenu extends Menu { /** * Creates a new popup menu with an empty name. - * @exception HeadlessException if GraphicsEnvironment.isHeadless() + * @throws HeadlessException if GraphicsEnvironment.isHeadless() * returns true. * @see java.awt.GraphicsEnvironment#isHeadless */ @@ -82,7 +82,7 @@ public class PopupMenu extends Menu { * * @param label a non-{@code null} string specifying * the popup menu's label - * @exception HeadlessException if GraphicsEnvironment.isHeadless() + * @throws HeadlessException if GraphicsEnvironment.isHeadless() * returns true. * @see java.awt.GraphicsEnvironment#isHeadless */ @@ -149,12 +149,12 @@ public class PopupMenu extends Menu { * @param origin the component which defines the coordinate space * @param x the x coordinate position to popup the menu * @param y the y coordinate position to popup the menu - * @exception NullPointerException if the parent is {@code null} - * @exception IllegalArgumentException if this {@code PopupMenu} + * @throws NullPointerException if the parent is {@code null} + * @throws IllegalArgumentException if this {@code PopupMenu} * has a non-{@code Component} parent - * @exception IllegalArgumentException if the origin is not in the + * @throws IllegalArgumentException if the origin is not in the * parent's hierarchy - * @exception RuntimeException if the parent is not showing on screen + * @throws RuntimeException if the parent is not showing on screen */ @SuppressWarnings("deprecation") public void show(Component origin, int x, int y) { diff --git a/src/java.desktop/share/classes/java/awt/RenderingHints.java b/src/java.desktop/share/classes/java/awt/RenderingHints.java index d69ed339eee..46d2fda1031 100644 --- a/src/java.desktop/share/classes/java/awt/RenderingHints.java +++ b/src/java.desktop/share/classes/java/awt/RenderingHints.java @@ -1064,7 +1064,7 @@ public class RenderingHints * {@code RenderingHints} is to be tested. * @return {@code true} if this {@code RenderingHints} * contains a mapping for the specified key. - * @exception ClassCastException if the key can not + * @throws ClassCastException if the key can not * be cast to {@code RenderingHints.Key} */ public boolean containsKey(Object key) { @@ -1099,7 +1099,7 @@ public class RenderingHints * @return the value to which the key is mapped in this object or * {@code null} if the key is not mapped to any value in * this object. - * @exception ClassCastException if the key can not + * @throws ClassCastException if the key can not * be cast to {@code RenderingHints.Key} * @see #put(Object, Object) */ @@ -1117,11 +1117,11 @@ public class RenderingHints * @param value the rendering hint value. * @return the previous value of the specified key in this object * or {@code null} if it did not have one. - * @exception NullPointerException if the key is + * @throws NullPointerException if the key is * {@code null}. - * @exception ClassCastException if the key can not + * @throws ClassCastException if the key can not * be cast to {@code RenderingHints.Key} - * @exception IllegalArgumentException if the + * @throws IllegalArgumentException if the * {@link Key#isCompatibleValue(java.lang.Object) * Key.isCompatibleValue()} * method of the specified key returns false for the @@ -1163,7 +1163,7 @@ public class RenderingHints * {@code RenderingHints} object. This method does nothing if the * key is not in this {@code RenderingHints} object. * @param key the rendering hints key that needs to be removed - * @exception ClassCastException if the key can not + * @throws ClassCastException if the key can not * be cast to {@code RenderingHints.Key} * @return the value to which the key had previously been mapped in this * {@code RenderingHints} object, or {@code null} @@ -1179,10 +1179,10 @@ public class RenderingHints * any mappings that this {@code RenderingHints} had for any * of the keys currently in the specified {@code Map}. * @param m the specified {@code Map} - * @exception ClassCastException class of a key or value + * @throws ClassCastException class of a key or value * in the specified {@code Map} prevents it from being * stored in this {@code RenderingHints}. - * @exception IllegalArgumentException some aspect + * @throws IllegalArgumentException some aspect * of a key or value in the specified {@code Map} * prevents it from being stored in * this {@code RenderingHints}. diff --git a/src/java.desktop/share/classes/java/awt/Scrollbar.java b/src/java.desktop/share/classes/java/awt/Scrollbar.java index 34cd3ecc799..c8f100cc1c2 100644 --- a/src/java.desktop/share/classes/java/awt/Scrollbar.java +++ b/src/java.desktop/share/classes/java/awt/Scrollbar.java @@ -349,7 +349,7 @@ public class Scrollbar extends Component implements Adjustable, Accessible { * * * - * @exception HeadlessException if GraphicsEnvironment.isHeadless() + * @throws HeadlessException if GraphicsEnvironment.isHeadless() * returns true. * @see java.awt.GraphicsEnvironment#isHeadless */ @@ -366,9 +366,9 @@ public class Scrollbar extends Component implements Adjustable, Accessible { * indicating a horizontal or vertical scroll bar, respectively. * * @param orientation indicates the orientation of the scroll bar - * @exception IllegalArgumentException when an illegal value for + * @throws IllegalArgumentException when an illegal value for * the {@code orientation} argument is supplied - * @exception HeadlessException if GraphicsEnvironment.isHeadless() + * @throws HeadlessException if GraphicsEnvironment.isHeadless() * returns true. * @see java.awt.GraphicsEnvironment#isHeadless */ @@ -394,9 +394,9 @@ public class Scrollbar extends Component implements Adjustable, Accessible { * represented by the size of the bubble * @param minimum the minimum value of the scroll bar * @param maximum the maximum value of the scroll bar - * @exception IllegalArgumentException when an illegal value for + * @throws IllegalArgumentException when an illegal value for * the {@code orientation} argument is supplied - * @exception HeadlessException if GraphicsEnvironment.isHeadless() + * @throws HeadlessException if GraphicsEnvironment.isHeadless() * returns true. * @see #setValues * @see java.awt.GraphicsEnvironment#isHeadless @@ -457,7 +457,7 @@ public class Scrollbar extends Component implements Adjustable, Accessible { * {@code Scrollbar.HORIZONTAL} or * {@code Scrollbar.VERTICAL} * @see java.awt.Scrollbar#getOrientation - * @exception IllegalArgumentException if the value supplied + * @throws IllegalArgumentException if the value supplied * for {@code orientation} is not a * legal value * @since 1.1 @@ -1062,7 +1062,7 @@ public class Scrollbar extends Component implements Adjustable, Accessible { * @return an array of all objects registered as * FooListeners on this component, * or an empty array if no such listeners have been added - * @exception ClassCastException if {@code listenerType} + * @throws ClassCastException if {@code listenerType} * doesn't specify a class or interface that implements * {@code java.util.EventListener} * diff --git a/src/java.desktop/share/classes/java/awt/TextArea.java b/src/java.desktop/share/classes/java/awt/TextArea.java index 5e3e5ca6b33..4c7baa52e4e 100644 --- a/src/java.desktop/share/classes/java/awt/TextArea.java +++ b/src/java.desktop/share/classes/java/awt/TextArea.java @@ -157,7 +157,7 @@ public class TextArea extends TextComponent { * This text area is created with scrollbar visibility equal to * {@link #SCROLLBARS_BOTH}, so both vertical and horizontal * scrollbars will be visible for this text area. - * @exception HeadlessException if + * @throws HeadlessException if * {@code GraphicsEnvironment.isHeadless} returns true * @see java.awt.GraphicsEnvironment#isHeadless() */ @@ -173,7 +173,7 @@ public class TextArea extends TextComponent { * @param text the text to be displayed; if * {@code text} is {@code null}, the empty * string {@code ""} will be displayed - * @exception HeadlessException if + * @throws HeadlessException if * {@code GraphicsEnvironment.isHeadless} returns true * @see java.awt.GraphicsEnvironment#isHeadless() */ @@ -191,7 +191,7 @@ public class TextArea extends TextComponent { * text area. * @param rows the number of rows * @param columns the number of columns - * @exception HeadlessException if + * @throws HeadlessException if * {@code GraphicsEnvironment.isHeadless} returns true * @see java.awt.GraphicsEnvironment#isHeadless() */ @@ -212,7 +212,7 @@ public class TextArea extends TextComponent { * string {@code ""} will be displayed * @param rows the number of rows * @param columns the number of columns - * @exception HeadlessException if + * @throws HeadlessException if * {@code GraphicsEnvironment.isHeadless} returns true * @see java.awt.GraphicsEnvironment#isHeadless() */ @@ -252,7 +252,7 @@ public class TextArea extends TextComponent { * @param scrollbars a constant that determines what * scrollbars are created to view the text area * @since 1.1 - * @exception HeadlessException if + * @throws HeadlessException if * {@code GraphicsEnvironment.isHeadless} returns true * @see java.awt.GraphicsEnvironment#isHeadless() */ @@ -421,7 +421,7 @@ public class TextArea extends TextComponent { * @param rows the number of rows * @see #getRows() * @see #setColumns(int) - * @exception IllegalArgumentException if the value + * @throws IllegalArgumentException if the value * supplied for {@code rows} * is less than {@code 0} * @since 1.1 @@ -452,7 +452,7 @@ public class TextArea extends TextComponent { * @param columns the number of columns * @see #getColumns() * @see #setRows(int) - * @exception IllegalArgumentException if the value + * @throws IllegalArgumentException if the value * supplied for {@code columns} * is less than {@code 0} * @since 1.1 diff --git a/src/java.desktop/share/classes/java/awt/TextComponent.java b/src/java.desktop/share/classes/java/awt/TextComponent.java index 5dc8d4068cc..b471b4e5ec6 100644 --- a/src/java.desktop/share/classes/java/awt/TextComponent.java +++ b/src/java.desktop/share/classes/java/awt/TextComponent.java @@ -137,7 +137,7 @@ public class TextComponent extends Component implements Accessible { * @param text the text to be displayed; if * {@code text} is {@code null}, the empty * string {@code ""} will be displayed - * @exception HeadlessException if + * @throws HeadlessException if * {@code GraphicsEnvironment.isHeadless} * returns true * @see java.awt.GraphicsEnvironment#isHeadless @@ -511,7 +511,7 @@ public class TextComponent extends Component implements Accessible { * is thrown. * * @param position the position of the text insertion caret - * @exception IllegalArgumentException if {@code position} + * @throws IllegalArgumentException if {@code position} * is less than zero * @since 1.1 */ @@ -645,7 +645,7 @@ public class TextComponent extends Component implements Accessible { * FooListeners on this text component, * or an empty array if no such * listeners have been added - * @exception ClassCastException if {@code listenerType} + * @throws ClassCastException if {@code listenerType} * doesn't specify a class or interface that implements * {@code java.util.EventListener} * diff --git a/src/java.desktop/share/classes/java/awt/TextField.java b/src/java.desktop/share/classes/java/awt/TextField.java index 5ca720ee80e..d2bfa0360b9 100644 --- a/src/java.desktop/share/classes/java/awt/TextField.java +++ b/src/java.desktop/share/classes/java/awt/TextField.java @@ -152,7 +152,7 @@ public class TextField extends TextComponent { /** * Constructs a new text field. - * @exception HeadlessException if GraphicsEnvironment.isHeadless() + * @throws HeadlessException if GraphicsEnvironment.isHeadless() * returns true. * @see java.awt.GraphicsEnvironment#isHeadless */ @@ -167,7 +167,7 @@ public class TextField extends TextComponent { * string {@code ""} will be displayed. * If {@code text} contains EOL and/or LF characters, then * each will be replaced by space character. - * @exception HeadlessException if GraphicsEnvironment.isHeadless() + * @throws HeadlessException if GraphicsEnvironment.isHeadless() * returns true. * @see java.awt.GraphicsEnvironment#isHeadless */ @@ -182,7 +182,7 @@ public class TextField extends TextComponent { * @param columns the number of columns. If * {@code columns} is less than {@code 0}, * {@code columns} is set to {@code 0}. - * @exception HeadlessException if GraphicsEnvironment.isHeadless() + * @throws HeadlessException if GraphicsEnvironment.isHeadless() * returns true. * @see java.awt.GraphicsEnvironment#isHeadless */ @@ -203,7 +203,7 @@ public class TextField extends TextComponent { * @param columns the number of columns. If * {@code columns} is less than {@code 0}, * {@code columns} is set to {@code 0}. - * @exception HeadlessException if GraphicsEnvironment.isHeadless() + * @throws HeadlessException if GraphicsEnvironment.isHeadless() * returns true. * @see java.awt.GraphicsEnvironment#isHeadless */ @@ -369,7 +369,7 @@ public class TextField extends TextComponent { * approximate average character width that is platform-dependent. * @param columns the number of columns. * @see java.awt.TextField#getColumns - * @exception IllegalArgumentException if the value + * @throws IllegalArgumentException if the value * supplied for {@code columns} * is less than {@code 0}. * @since 1.1 @@ -585,7 +585,7 @@ public class TextField extends TextComponent { * FooListeners on this textfield, * or an empty array if no such * listeners have been added - * @exception ClassCastException if {@code listenerType} + * @throws ClassCastException if {@code listenerType} * doesn't specify a class or interface that implements * {@code java.util.EventListener} * diff --git a/src/java.desktop/share/classes/java/awt/Toolkit.java b/src/java.desktop/share/classes/java/awt/Toolkit.java index f3f4bcbb5c8..7399ced02bb 100644 --- a/src/java.desktop/share/classes/java/awt/Toolkit.java +++ b/src/java.desktop/share/classes/java/awt/Toolkit.java @@ -149,7 +149,7 @@ public abstract class Toolkit { * with the current system color values. * * @param systemColors an integer array. - * @exception HeadlessException if GraphicsEnvironment.isHeadless() + * @throws HeadlessException if GraphicsEnvironment.isHeadless() * returns true * @see java.awt.GraphicsEnvironment#isHeadless * @since 1.1 @@ -181,7 +181,7 @@ public abstract class Toolkit { * @param dynamic If true, Containers should re-layout their * components as the Container is being resized. If false, * the layout will be validated after resizing is completed. - * @exception HeadlessException if GraphicsEnvironment.isHeadless() + * @throws HeadlessException if GraphicsEnvironment.isHeadless() * returns true * @see #isDynamicLayoutSet() * @see #isDynamicLayoutActive() @@ -208,7 +208,7 @@ public abstract class Toolkit { * * @return true if validation of Containers is done dynamically, * false if validation is done after resizing is finished. - * @exception HeadlessException if GraphicsEnvironment.isHeadless() + * @throws HeadlessException if GraphicsEnvironment.isHeadless() * returns true * @see #setDynamicLayout(boolean dynamic) * @see #isDynamicLayoutActive() @@ -274,7 +274,7 @@ public abstract class Toolkit { * available from {@code GraphicsConfiguration} and * {@code GraphicsDevice}. * @return the size of this toolkit's screen, in pixels. - * @exception HeadlessException if GraphicsEnvironment.isHeadless() + * @throws HeadlessException if GraphicsEnvironment.isHeadless() * returns true * @see java.awt.GraphicsConfiguration#getBounds * @see java.awt.GraphicsDevice#getDisplayMode @@ -286,7 +286,7 @@ public abstract class Toolkit { /** * Returns the screen resolution in dots-per-inch. * @return this toolkit's screen resolution, in dots-per-inch. - * @exception HeadlessException if GraphicsEnvironment.isHeadless() + * @throws HeadlessException if GraphicsEnvironment.isHeadless() * returns true * @see java.awt.GraphicsEnvironment#isHeadless */ @@ -297,7 +297,7 @@ public abstract class Toolkit { * Gets the insets of the screen. * @param gc a {@code GraphicsConfiguration} * @return the insets of this toolkit's screen, in pixels. - * @exception HeadlessException if GraphicsEnvironment.isHeadless() + * @throws HeadlessException if GraphicsEnvironment.isHeadless() * returns true * @see java.awt.GraphicsEnvironment#isHeadless * @since 1.4 @@ -324,7 +324,7 @@ public abstract class Toolkit { * {@code getColorModel} method * of the {@code Component} class. * @return the color model of this toolkit's screen. - * @exception HeadlessException if GraphicsEnvironment.isHeadless() + * @throws HeadlessException if GraphicsEnvironment.isHeadless() * returns true * @see java.awt.GraphicsEnvironment#isHeadless * @see java.awt.image.ColorModel @@ -973,7 +973,7 @@ public abstract class Toolkit { * checkPermission} method to check {@code AWTPermission("accessClipboard")}. * * @return the system Clipboard - * @exception HeadlessException if GraphicsEnvironment.isHeadless() + * @throws HeadlessException if GraphicsEnvironment.isHeadless() * returns true * @see java.awt.GraphicsEnvironment#isHeadless * @see java.awt.datatransfer.Clipboard @@ -1020,7 +1020,7 @@ public abstract class Toolkit { * @return the system selection as a {@code Clipboard}, or * {@code null} if the native platform does not support a * system selection {@code Clipboard} - * @exception HeadlessException if GraphicsEnvironment.isHeadless() + * @throws HeadlessException if GraphicsEnvironment.isHeadless() * returns true * * @see java.awt.datatransfer.Clipboard @@ -1057,7 +1057,7 @@ public abstract class Toolkit { * Control key isn't the correct key for accelerators. * @return the modifier mask on the {@code Event} class * that is used for menu shortcuts on this toolkit. - * @exception HeadlessException if GraphicsEnvironment.isHeadless() + * @throws HeadlessException if GraphicsEnvironment.isHeadless() * returns true * @see java.awt.GraphicsEnvironment#isHeadless * @see java.awt.MenuBar @@ -1111,12 +1111,12 @@ public abstract class Toolkit { * @param keyCode the key code * @return {@code true} if the given key is currently in its "on" state; * otherwise {@code false} - * @exception java.lang.IllegalArgumentException if {@code keyCode} + * @throws java.lang.IllegalArgumentException if {@code keyCode} * is not one of the valid key codes - * @exception java.lang.UnsupportedOperationException if the host system doesn't + * @throws java.lang.UnsupportedOperationException if the host system doesn't * allow getting the state of this key programmatically, or if the keyboard * doesn't have this key - * @exception HeadlessException if GraphicsEnvironment.isHeadless() + * @throws HeadlessException if GraphicsEnvironment.isHeadless() * returns true * @see java.awt.GraphicsEnvironment#isHeadless * @since 1.3 @@ -1147,12 +1147,12 @@ public abstract class Toolkit { * * @param keyCode the key code * @param on the state of the key - * @exception java.lang.IllegalArgumentException if {@code keyCode} + * @throws java.lang.IllegalArgumentException if {@code keyCode} * is not one of the valid key codes - * @exception java.lang.UnsupportedOperationException if the host system doesn't + * @throws java.lang.UnsupportedOperationException if the host system doesn't * allow setting the state of this key programmatically, or if the keyboard * doesn't have this key - * @exception HeadlessException if GraphicsEnvironment.isHeadless() + * @throws HeadlessException if GraphicsEnvironment.isHeadless() * returns true * @see java.awt.GraphicsEnvironment#isHeadless * @since 1.3 @@ -1193,10 +1193,10 @@ public abstract class Toolkit { * hotSpot values must be less than the Dimension returned by * {@code getBestCursorSize} * @param name a localized description of the cursor, for Java Accessibility use - * @exception IndexOutOfBoundsException if the hotSpot values are outside + * @throws IndexOutOfBoundsException if the hotSpot values are outside * the bounds of the cursor * @return the cursor created - * @exception HeadlessException if GraphicsEnvironment.isHeadless() + * @throws HeadlessException if GraphicsEnvironment.isHeadless() * returns true * @see java.awt.GraphicsEnvironment#isHeadless * @since 1.2 @@ -1232,7 +1232,7 @@ public abstract class Toolkit { * to use. * @return the closest matching supported cursor size, or a dimension of 0,0 if * the Toolkit implementation doesn't support custom cursors. - * @exception HeadlessException if GraphicsEnvironment.isHeadless() + * @throws HeadlessException if GraphicsEnvironment.isHeadless() * returns true * @see java.awt.GraphicsEnvironment#isHeadless * @since 1.2 @@ -1262,7 +1262,7 @@ public abstract class Toolkit { * * @return the maximum number of colors, or zero if custom cursors are not * supported by this Toolkit implementation. - * @exception HeadlessException if GraphicsEnvironment.isHeadless() + * @throws HeadlessException if GraphicsEnvironment.isHeadless() * returns true * @see java.awt.GraphicsEnvironment#isHeadless * @since 1.2 @@ -1310,7 +1310,7 @@ public abstract class Toolkit { * @param state one of named frame state constants. * @return {@code true} is this frame state is supported by * this Toolkit implementation, {@code false} otherwise. - * @exception HeadlessException + * @throws HeadlessException * if {@code GraphicsEnvironment.isHeadless()} * returns {@code true}. * @see java.awt.Window#addWindowStateListener @@ -2203,7 +2203,7 @@ public abstract class Toolkit { * returned is unmodifiable. * @param highlight input method highlight * @return style attribute map, or {@code null} - * @exception HeadlessException if + * @throws HeadlessException if * {@code GraphicsEnvironment.isHeadless} returns true * @see java.awt.GraphicsEnvironment#isHeadless * @since 1.3 @@ -2360,7 +2360,7 @@ public abstract class Toolkit { * initialized with {@code true}. * Changing this value after the {@code Toolkit} class initialization will have no effect. * - * @exception HeadlessException if GraphicsEnvironment.isHeadless() returns true + * @throws HeadlessException if GraphicsEnvironment.isHeadless() returns true * @return {@code true} if events from extra mouse buttons are allowed to be processed and posted; * {@code false} otherwise * @see System#getProperty(String propertyName) diff --git a/src/java.desktop/share/classes/java/awt/Window.java b/src/java.desktop/share/classes/java/awt/Window.java index 59e63abbb3c..c58b2a5e94a 100644 --- a/src/java.desktop/share/classes/java/awt/Window.java +++ b/src/java.desktop/share/classes/java/awt/Window.java @@ -442,9 +442,9 @@ public class Window extends Container implements Accessible { * @param gc the {@code GraphicsConfiguration} of the target screen * device. If {@code gc} is {@code null}, the system default * {@code GraphicsConfiguration} is assumed - * @exception IllegalArgumentException if {@code gc} + * @throws IllegalArgumentException if {@code gc} * is not from a screen device - * @exception HeadlessException when + * @throws HeadlessException when * {@code GraphicsEnvironment.isHeadless()} returns {@code true} * * @see java.awt.GraphicsEnvironment#isHeadless @@ -544,7 +544,7 @@ public class Window extends Container implements Accessible { * If that check fails with a {@code SecurityException} then a warning * banner is created. * - * @exception HeadlessException when + * @throws HeadlessException when * {@code GraphicsEnvironment.isHeadless()} returns {@code true} * * @see java.awt.GraphicsEnvironment#isHeadless @@ -566,9 +566,9 @@ public class Window extends Container implements Accessible { * * @param owner the {@code Frame} to act as owner or {@code null} * if this window has no owner - * @exception IllegalArgumentException if the {@code owner}'s + * @throws IllegalArgumentException if the {@code owner}'s * {@code GraphicsConfiguration} is not from a screen device - * @exception HeadlessException when + * @throws HeadlessException when * {@code GraphicsEnvironment.isHeadless} returns {@code true} * * @see java.awt.GraphicsEnvironment#isHeadless @@ -593,9 +593,9 @@ public class Window extends Container implements Accessible { * * @param owner the {@code Window} to act as owner or * {@code null} if this window has no owner - * @exception IllegalArgumentException if the {@code owner}'s + * @throws IllegalArgumentException if the {@code owner}'s * {@code GraphicsConfiguration} is not from a screen device - * @exception HeadlessException when + * @throws HeadlessException when * {@code GraphicsEnvironment.isHeadless()} returns * {@code true} * @@ -627,9 +627,9 @@ public class Window extends Container implements Accessible { * @param gc the {@code GraphicsConfiguration} of the target * screen device; if {@code gc} is {@code null}, * the system default {@code GraphicsConfiguration} is assumed - * @exception IllegalArgumentException if {@code gc} + * @throws IllegalArgumentException if {@code gc} * is not from a screen device - * @exception HeadlessException when + * @throws HeadlessException when * {@code GraphicsEnvironment.isHeadless()} returns * {@code true} * @@ -1964,10 +1964,10 @@ public class Window extends Container implements Accessible { * FooListeners on this window, * or an empty array if no such * listeners have been added - * @exception ClassCastException if {@code listenerType} + * @throws ClassCastException if {@code listenerType} * doesn't specify a class or interface that implements * {@code java.util.EventListener} - * @exception NullPointerException if {@code listenerType} is {@code null} + * @throws NullPointerException if {@code listenerType} is {@code null} * * @see #getWindowListeners * @since 1.3 @@ -3372,8 +3372,8 @@ public class Window extends Container implements Accessible { * Each time this method is called, * the existing buffer strategy for this component is discarded. * @param numBuffers number of buffers to create - * @exception IllegalArgumentException if numBuffers is less than 1. - * @exception IllegalStateException if the component is not displayable + * @throws IllegalArgumentException if numBuffers is less than 1. + * @throws IllegalStateException if the component is not displayable * @see #isDisplayable * @see #getBufferStrategy * @since 1.4 @@ -3393,11 +3393,11 @@ public class Window extends Container implements Accessible { * @param numBuffers number of buffers to create, including the front buffer * @param caps the required capabilities for creating the buffer strategy; * cannot be {@code null} - * @exception AWTException if the capabilities supplied could not be + * @throws AWTException if the capabilities supplied could not be * supported or met; this may happen, for example, if there is not enough * accelerated memory currently available, or if page flipping is specified * but not possible. - * @exception IllegalArgumentException if numBuffers is less than 1, or if + * @throws IllegalArgumentException if numBuffers is less than 1, or if * caps is {@code null} * @see #getBufferStrategy * @since 1.4 diff --git a/src/java.desktop/share/classes/java/awt/dnd/DragSource.java b/src/java.desktop/share/classes/java/awt/dnd/DragSource.java index 8bbdfc24c06..71bf6d27c83 100644 --- a/src/java.desktop/share/classes/java/awt/dnd/DragSource.java +++ b/src/java.desktop/share/classes/java/awt/dnd/DragSource.java @@ -217,7 +217,7 @@ public class DragSource implements Serializable { * the underlying platform. * * @return the platform DragSource - * @exception HeadlessException if GraphicsEnvironment.isHeadless() + * @throws HeadlessException if GraphicsEnvironment.isHeadless() * returns true * @see java.awt.GraphicsEnvironment#isHeadless */ @@ -255,7 +255,7 @@ public class DragSource implements Serializable { /** * Creates a new {@code DragSource}. * - * @exception HeadlessException if GraphicsEnvironment.isHeadless() + * @throws HeadlessException if GraphicsEnvironment.isHeadless() * returns true * @see java.awt.GraphicsEnvironment#isHeadless */ @@ -682,7 +682,7 @@ public class DragSource implements Serializable { * FooListeners on this * {@code DragSource}, or an empty array if no such listeners * have been added - * @exception ClassCastException if {@code listenerType} + * @throws ClassCastException if {@code listenerType} * doesn't specify a class or interface that implements * {@code java.util.EventListener} * diff --git a/src/java.desktop/share/classes/java/awt/dnd/DropTarget.java b/src/java.desktop/share/classes/java/awt/dnd/DropTarget.java index 7ba9c9711da..fbd086792a5 100644 --- a/src/java.desktop/share/classes/java/awt/dnd/DropTarget.java +++ b/src/java.desktop/share/classes/java/awt/dnd/DropTarget.java @@ -89,7 +89,7 @@ public class DropTarget implements DropTargetListener, Serializable { * @param dtl The {@code DropTargetListener} for this {@code DropTarget} * @param act Is the {@code DropTarget} accepting drops. * @param fm The {@code FlavorMap} to use, or null for the default {@code FlavorMap} - * @exception HeadlessException if GraphicsEnvironment.isHeadless() + * @throws HeadlessException if GraphicsEnvironment.isHeadless() * returns true * @see java.awt.GraphicsEnvironment#isHeadless */ @@ -136,7 +136,7 @@ public class DropTarget implements DropTargetListener, Serializable { * @param ops The default acceptable actions for this {@code DropTarget} * @param dtl The {@code DropTargetListener} for this {@code DropTarget} * @param act Is the {@code DropTarget} accepting drops. - * @exception HeadlessException if GraphicsEnvironment.isHeadless() + * @throws HeadlessException if GraphicsEnvironment.isHeadless() * returns true * @see java.awt.GraphicsEnvironment#isHeadless */ @@ -149,7 +149,7 @@ public class DropTarget implements DropTargetListener, Serializable { /** * Creates a {@code DropTarget}. - * @exception HeadlessException if GraphicsEnvironment.isHeadless() + * @throws HeadlessException if GraphicsEnvironment.isHeadless() * returns true * @see java.awt.GraphicsEnvironment#isHeadless */ @@ -165,7 +165,7 @@ public class DropTarget implements DropTargetListener, Serializable { * The Component will receive drops only if it is enabled. * @param c The {@code Component} with which this {@code DropTarget} is associated * @param dtl The {@code DropTargetListener} for this {@code DropTarget} - * @exception HeadlessException if GraphicsEnvironment.isHeadless() + * @throws HeadlessException if GraphicsEnvironment.isHeadless() * returns true * @see java.awt.GraphicsEnvironment#isHeadless */ @@ -185,7 +185,7 @@ public class DropTarget implements DropTargetListener, Serializable { * @param c The {@code Component} with which this {@code DropTarget} is associated * @param ops The default acceptable actions for this {@code DropTarget} * @param dtl The {@code DropTargetListener} for this {@code DropTarget} - * @exception HeadlessException if GraphicsEnvironment.isHeadless() + * @throws HeadlessException if GraphicsEnvironment.isHeadless() * returns true * @see java.awt.GraphicsEnvironment#isHeadless */ diff --git a/src/java.desktop/share/classes/java/awt/event/InputMethodEvent.java b/src/java.desktop/share/classes/java/awt/event/InputMethodEvent.java index 94cfcc0bf40..12ad1a03171 100644 --- a/src/java.desktop/share/classes/java/awt/event/InputMethodEvent.java +++ b/src/java.desktop/share/classes/java/awt/event/InputMethodEvent.java @@ -436,7 +436,7 @@ public class InputMethodEvent extends AWTEvent { * belongs to. * * @param source the source of the event - * @exception IllegalArgumentException if source is null. + * @throws IllegalArgumentException if source is null. * @return most recent event time in the {@code EventQueue} */ private static long getMostRecentEventTimeForSource(Object source) { diff --git a/src/java.desktop/share/classes/java/awt/font/TextLayout.java b/src/java.desktop/share/classes/java/awt/font/TextLayout.java index ddc5199b843..352d3c81df2 100644 --- a/src/java.desktop/share/classes/java/awt/font/TextLayout.java +++ b/src/java.desktop/share/classes/java/awt/font/TextLayout.java @@ -789,7 +789,7 @@ public final class TextLayout implements Cloneable { * For best results, it should not be too different from the current * advance of the line. * @return a {@code TextLayout} justified to the specified width. - * @exception Error if this layout has already been justified, an Error is + * @throws Error if this layout has already been justified, an Error is * thrown. */ public TextLayout getJustifiedLayout(float justificationWidth) { diff --git a/src/java.desktop/share/classes/java/awt/geom/AffineTransform.java b/src/java.desktop/share/classes/java/awt/geom/AffineTransform.java index 44324e2d3b9..7f6fc7c34f9 100644 --- a/src/java.desktop/share/classes/java/awt/geom/AffineTransform.java +++ b/src/java.desktop/share/classes/java/awt/geom/AffineTransform.java @@ -2667,7 +2667,7 @@ public class AffineTransform implements Cloneable, java.io.Serializable { * @return a new {@code AffineTransform} object representing the * inverse transformation. * @see #getDeterminant - * @exception NoninvertibleTransformException + * @throws NoninvertibleTransformException * if the matrix cannot be inverted. * @since 1.2 */ @@ -2762,7 +2762,7 @@ public class AffineTransform implements Cloneable, java.io.Serializable { * transform has no inverse, in which case an exception will be * thrown if the {@code invert} method is called. * @see #getDeterminant - * @exception NoninvertibleTransformException + * @throws NoninvertibleTransformException * if the matrix cannot be inverted. * @since 1.6 */ @@ -3464,7 +3464,7 @@ public class AffineTransform implements Cloneable, java.io.Serializable { * @param ptDst the resulting transformed point * @return {@code ptDst}, which contains the result of the * inverse transform. - * @exception NoninvertibleTransformException if the matrix cannot be + * @throws NoninvertibleTransformException if the matrix cannot be * inverted. * @since 1.2 */ @@ -3550,7 +3550,7 @@ public class AffineTransform implements Cloneable, java.io.Serializable { * @param dstOff the offset to the location of the first * transformed point that is stored in the destination array * @param numPts the number of point objects to be transformed - * @exception NoninvertibleTransformException if the matrix cannot be + * @throws NoninvertibleTransformException if the matrix cannot be * inverted. * @since 1.2 */ diff --git a/src/java.desktop/share/classes/java/awt/geom/CubicCurve2D.java b/src/java.desktop/share/classes/java/awt/geom/CubicCurve2D.java index 76d366c0ec6..cf33fb30438 100644 --- a/src/java.desktop/share/classes/java/awt/geom/CubicCurve2D.java +++ b/src/java.desktop/share/classes/java/awt/geom/CubicCurve2D.java @@ -1564,7 +1564,7 @@ public abstract class CubicCurve2D implements Shape, Cloneable { * Creates a new object of the same class as this object. * * @return a clone of this instance. - * @exception OutOfMemoryError if there is not enough memory. + * @throws OutOfMemoryError if there is not enough memory. * @see java.lang.Cloneable * @since 1.2 */ diff --git a/src/java.desktop/share/classes/java/awt/geom/Dimension2D.java b/src/java.desktop/share/classes/java/awt/geom/Dimension2D.java index 180d96a3840..0a2015b15a9 100644 --- a/src/java.desktop/share/classes/java/awt/geom/Dimension2D.java +++ b/src/java.desktop/share/classes/java/awt/geom/Dimension2D.java @@ -99,7 +99,7 @@ public abstract class Dimension2D implements Cloneable { * Creates a new object of the same class as this object. * * @return a clone of this instance. - * @exception OutOfMemoryError if there is not enough memory. + * @throws OutOfMemoryError if there is not enough memory. * @see java.lang.Cloneable * @since 1.2 */ diff --git a/src/java.desktop/share/classes/java/awt/geom/FlatteningPathIterator.java b/src/java.desktop/share/classes/java/awt/geom/FlatteningPathIterator.java index 40159f2db5f..123e6d60b92 100644 --- a/src/java.desktop/share/classes/java/awt/geom/FlatteningPathIterator.java +++ b/src/java.desktop/share/classes/java/awt/geom/FlatteningPathIterator.java @@ -109,7 +109,7 @@ public class FlatteningPathIterator implements PathIterator { * control points and the flattened curve * @param limit the maximum number of recursive subdivisions * allowed for any curved segment - * @exception IllegalArgumentException if + * @throws IllegalArgumentException if * {@code flatness} or {@code limit} * is less than zero */ @@ -336,7 +336,7 @@ public class FlatteningPathIterator implements PathIterator { * @param coords an array that holds the data returned from * this method * @return the path segment type of the current path segment. - * @exception NoSuchElementException if there + * @throws NoSuchElementException if there * are no more elements in the flattening path to be * returned. * @see PathIterator#SEG_MOVETO @@ -371,7 +371,7 @@ public class FlatteningPathIterator implements PathIterator { * @param coords an array that holds the data returned from * this method * @return the path segment type of the current path segment. - * @exception NoSuchElementException if there + * @throws NoSuchElementException if there * are no more elements in the flattening path to be * returned. * @see PathIterator#SEG_MOVETO diff --git a/src/java.desktop/share/classes/java/awt/geom/Line2D.java b/src/java.desktop/share/classes/java/awt/geom/Line2D.java index 3d79e44dfee..305b51942d9 100644 --- a/src/java.desktop/share/classes/java/awt/geom/Line2D.java +++ b/src/java.desktop/share/classes/java/awt/geom/Line2D.java @@ -1111,7 +1111,7 @@ public abstract class Line2D implements Shape, Cloneable { * Creates a new object of the same class as this object. * * @return a clone of this instance. - * @exception OutOfMemoryError if there is not enough memory. + * @throws OutOfMemoryError if there is not enough memory. * @see java.lang.Cloneable * @since 1.2 */ diff --git a/src/java.desktop/share/classes/java/awt/geom/Path2D.java b/src/java.desktop/share/classes/java/awt/geom/Path2D.java index 6168664452b..e777f276602 100644 --- a/src/java.desktop/share/classes/java/awt/geom/Path2D.java +++ b/src/java.desktop/share/classes/java/awt/geom/Path2D.java @@ -842,7 +842,7 @@ public abstract class Path2D implements Shape, Cloneable { * Creates a new object of the same class as this object. * * @return a clone of this instance. - * @exception OutOfMemoryError if there is not enough memory. + * @throws OutOfMemoryError if there is not enough memory. * @see java.lang.Cloneable * @since 1.6 */ @@ -1638,7 +1638,7 @@ public abstract class Path2D implements Shape, Cloneable { * Creates a new object of the same class as this object. * * @return a clone of this instance. - * @exception OutOfMemoryError if there is not enough memory. + * @throws OutOfMemoryError if there is not enough memory. * @see java.lang.Cloneable * @since 1.6 */ @@ -2018,7 +2018,7 @@ public abstract class Path2D implements Shape, Cloneable { * * @param rule an integer representing the specified * winding rule - * @exception IllegalArgumentException if + * @throws IllegalArgumentException if * {@code rule} is not either * {@link #WIND_EVEN_ODD} or * {@link #WIND_NON_ZERO} @@ -2530,7 +2530,7 @@ public abstract class Path2D implements Shape, Cloneable { * Creates a new object of the same class as this object. * * @return a clone of this instance. - * @exception OutOfMemoryError if there is not enough memory. + * @throws OutOfMemoryError if there is not enough memory. * @see java.lang.Cloneable * @since 1.6 */ diff --git a/src/java.desktop/share/classes/java/awt/geom/Point2D.java b/src/java.desktop/share/classes/java/awt/geom/Point2D.java index bffb5594cfa..2b0a2aabef1 100644 --- a/src/java.desktop/share/classes/java/awt/geom/Point2D.java +++ b/src/java.desktop/share/classes/java/awt/geom/Point2D.java @@ -387,7 +387,7 @@ public abstract class Point2D implements Cloneable { * Creates a new object of the same class and with the * same contents as this object. * @return a clone of this instance. - * @exception OutOfMemoryError if there is not enough memory. + * @throws OutOfMemoryError if there is not enough memory. * @see java.lang.Cloneable * @since 1.2 */ diff --git a/src/java.desktop/share/classes/java/awt/geom/QuadCurve2D.java b/src/java.desktop/share/classes/java/awt/geom/QuadCurve2D.java index f7dce7ea8e3..6f4990df49c 100644 --- a/src/java.desktop/share/classes/java/awt/geom/QuadCurve2D.java +++ b/src/java.desktop/share/classes/java/awt/geom/QuadCurve2D.java @@ -1388,7 +1388,7 @@ public abstract class QuadCurve2D implements Shape, Cloneable { * as this object. * * @return a clone of this instance. - * @exception OutOfMemoryError if there is not enough memory. + * @throws OutOfMemoryError if there is not enough memory. * @see java.lang.Cloneable * @since 1.2 */ diff --git a/src/java.desktop/share/classes/java/awt/geom/RectangularShape.java b/src/java.desktop/share/classes/java/awt/geom/RectangularShape.java index 892eb634559..d0b0792792e 100644 --- a/src/java.desktop/share/classes/java/awt/geom/RectangularShape.java +++ b/src/java.desktop/share/classes/java/awt/geom/RectangularShape.java @@ -382,7 +382,7 @@ public abstract class RectangularShape implements Shape, Cloneable { * Creates a new object of the same class and with the same * contents as this object. * @return a clone of this instance. - * @exception OutOfMemoryError if there is not enough memory. + * @throws OutOfMemoryError if there is not enough memory. * @see java.lang.Cloneable * @since 1.2 */ diff --git a/src/java.desktop/share/classes/java/awt/im/InputContext.java b/src/java.desktop/share/classes/java/awt/im/InputContext.java index 2a73793df2b..5476d9e2518 100644 --- a/src/java.desktop/share/classes/java/awt/im/InputContext.java +++ b/src/java.desktop/share/classes/java/awt/im/InputContext.java @@ -140,7 +140,7 @@ public class InputContext { * @param locale The desired new locale. * @return true if the input method or keyboard layout that's active after * this call supports the desired locale. - * @exception NullPointerException if {@code locale} is null + * @throws NullPointerException if {@code locale} is null */ public boolean selectInputMethod(Locale locale) { // real implementation is in sun.awt.im.InputContext @@ -268,7 +268,7 @@ public class InputContext { * If no input method is available, then the event will never be consumed. * * @param event The event - * @exception NullPointerException if {@code event} is null + * @throws NullPointerException if {@code event} is null */ public void dispatchEvent(AWTEvent event) { // real implementation is in sun.awt.im.InputContext @@ -286,7 +286,7 @@ public class InputContext { * If no input methods are available, then this method has no effect. * * @param client Client component - * @exception NullPointerException if {@code client} is null + * @throws NullPointerException if {@code client} is null */ public void removeNotify(Component client) { // real implementation is in sun.awt.im.InputContext diff --git a/src/java.desktop/share/classes/java/awt/im/InputMethodHighlight.java b/src/java.desktop/share/classes/java/awt/im/InputMethodHighlight.java index 7fcf3c9549b..4b8d4d5c9ea 100644 --- a/src/java.desktop/share/classes/java/awt/im/InputMethodHighlight.java +++ b/src/java.desktop/share/classes/java/awt/im/InputMethodHighlight.java @@ -111,7 +111,7 @@ public class InputMethodHighlight { * @param state The conversion state for the text range - RAW_TEXT or CONVERTED_TEXT * @see InputMethodHighlight#RAW_TEXT * @see InputMethodHighlight#CONVERTED_TEXT - * @exception IllegalArgumentException if a state other than RAW_TEXT or CONVERTED_TEXT is given + * @throws IllegalArgumentException if a state other than RAW_TEXT or CONVERTED_TEXT is given */ public InputMethodHighlight(boolean selected, int state) { this(selected, state, 0, null); @@ -125,7 +125,7 @@ public class InputMethodHighlight { * @param variation The style variation for the text range * @see InputMethodHighlight#RAW_TEXT * @see InputMethodHighlight#CONVERTED_TEXT - * @exception IllegalArgumentException if a state other than RAW_TEXT or CONVERTED_TEXT is given + * @throws IllegalArgumentException if a state other than RAW_TEXT or CONVERTED_TEXT is given */ public InputMethodHighlight(boolean selected, int state, int variation) { this(selected, state, variation, null); @@ -140,7 +140,7 @@ public class InputMethodHighlight { * @param style the rendering style attributes for the text range, or null * @see InputMethodHighlight#RAW_TEXT * @see InputMethodHighlight#CONVERTED_TEXT - * @exception IllegalArgumentException if a state other than RAW_TEXT or CONVERTED_TEXT is given + * @throws IllegalArgumentException if a state other than RAW_TEXT or CONVERTED_TEXT is given * @since 1.3 */ public InputMethodHighlight(boolean selected, int state, int variation, diff --git a/src/java.desktop/share/classes/java/awt/im/spi/InputMethod.java b/src/java.desktop/share/classes/java/awt/im/spi/InputMethod.java index 1174493cc58..c01987bbfed 100644 --- a/src/java.desktop/share/classes/java/awt/im/spi/InputMethod.java +++ b/src/java.desktop/share/classes/java/awt/im/spi/InputMethod.java @@ -59,7 +59,7 @@ public interface InputMethod { * method. * * @param context the input method context for this input method - * @exception NullPointerException if {@code context} is null + * @throws NullPointerException if {@code context} is null */ public void setInputMethodContext(InputMethodContext context); @@ -80,7 +80,7 @@ public interface InputMethod { * * @param locale locale to input * @return whether the specified locale is supported - * @exception NullPointerException if {@code locale} is null + * @throws NullPointerException if {@code locale} is null */ public boolean setLocale(Locale locale); @@ -211,7 +211,7 @@ public interface InputMethod { * This method is called by {@link java.awt.im.InputContext#dispatchEvent InputContext.dispatchEvent}. * * @param event the event being dispatched to the input method - * @exception NullPointerException if {@code event} is null + * @throws NullPointerException if {@code event} is null */ public void dispatchEvent(AWTEvent event); diff --git a/src/java.desktop/share/classes/java/awt/im/spi/InputMethodContext.java b/src/java.desktop/share/classes/java/awt/im/spi/InputMethodContext.java index 09d44a5eda4..c17c4e4afef 100644 --- a/src/java.desktop/share/classes/java/awt/im/spi/InputMethodContext.java +++ b/src/java.desktop/share/classes/java/awt/im/spi/InputMethodContext.java @@ -92,7 +92,7 @@ public interface InputMethodContext extends InputMethodRequests { * @param attachToInputContext whether this window should share the input context * that corresponds to this input method context * @return a window with special characteristics for use by input methods - * @exception HeadlessException if {@code GraphicsEnvironment.isHeadless} + * @throws HeadlessException if {@code GraphicsEnvironment.isHeadless} * returns {@code true} */ public Window createInputMethodWindow(String title, boolean attachToInputContext); @@ -124,7 +124,7 @@ public interface InputMethodContext extends InputMethodRequests { * @param attachToInputContext whether this window should share the input context * that corresponds to this input method context * @return a JFrame with special characteristics for use by input methods - * @exception HeadlessException if {@code GraphicsEnvironment.isHeadless} + * @throws HeadlessException if {@code GraphicsEnvironment.isHeadless} * returns {@code true} * * @since 1.4 diff --git a/src/java.desktop/share/classes/java/awt/im/spi/InputMethodDescriptor.java b/src/java.desktop/share/classes/java/awt/im/spi/InputMethodDescriptor.java index 885e7ad4e09..6e3d8f89706 100644 --- a/src/java.desktop/share/classes/java/awt/im/spi/InputMethodDescriptor.java +++ b/src/java.desktop/share/classes/java/awt/im/spi/InputMethodDescriptor.java @@ -63,7 +63,7 @@ public interface InputMethodDescriptor { * unavailable. * * @return the locales supported by the input method - * @exception AWTException if it can be determined that the input method + * @throws AWTException if it can be determined that the input method * is inoperable, for example, because of incomplete installation. */ Locale[] getAvailableLocales() throws AWTException; @@ -122,7 +122,7 @@ public interface InputMethodDescriptor { * Creates a new instance of the corresponding input method. * * @return a new instance of the corresponding input method - * @exception Exception any exception that may occur while creating the + * @throws Exception any exception that may occur while creating the * input method instance */ InputMethod createInputMethod() throws Exception; diff --git a/src/java.desktop/share/classes/java/awt/image/BufferedImage.java b/src/java.desktop/share/classes/java/awt/image/BufferedImage.java index 3c937dd3866..770fec6e8ab 100644 --- a/src/java.desktop/share/classes/java/awt/image/BufferedImage.java +++ b/src/java.desktop/share/classes/java/awt/image/BufferedImage.java @@ -594,12 +594,12 @@ public class BufferedImage extends java.awt.Image * the raster has been premultiplied with alpha. * @param properties {@code Hashtable} of * {@code String}/{@code Object} pairs. - * @exception RasterFormatException if the number and + * @throws RasterFormatException if the number and * types of bands in the {@code SampleModel} of the * {@code Raster} do not match the number and types required by * the {@code ColorModel} to represent its color and alpha * components. - * @exception IllegalArgumentException if + * @throws IllegalArgumentException if * {@code raster} is incompatible with {@code cm} * @see ColorModel * @see Raster @@ -1195,7 +1195,7 @@ public class BufferedImage extends java.awt.Image * @param h the height of the specified rectangular region * @return a {@code BufferedImage} that is the subimage of this * {@code BufferedImage}. - * @exception RasterFormatException if the specified + * @throws RasterFormatException if the specified * area is not contained within this {@code BufferedImage}. */ public BufferedImage getSubimage (int x, int y, int w, int h) { @@ -1391,7 +1391,7 @@ public class BufferedImage extends java.awt.Image * @param tileY the y index of the requested tile in the tile array * @return a {@code Raster} that is the tile defined by the * arguments {@code tileX} and {@code tileY}. - * @exception ArrayIndexOutOfBoundsException if both + * @throws ArrayIndexOutOfBoundsException if both * {@code tileX} and {@code tileY} are not * equal to 0 */ @@ -1561,7 +1561,7 @@ public class BufferedImage extends java.awt.Image * @return {@code true} if the tile specified by the specified * indices is checked out for writing; {@code false} * otherwise. - * @exception ArrayIndexOutOfBoundsException if both + * @throws ArrayIndexOutOfBoundsException if both * {@code tileX} and {@code tileY} are not equal * to 0 */ diff --git a/src/java.desktop/share/classes/java/awt/image/ByteLookupTable.java b/src/java.desktop/share/classes/java/awt/image/ByteLookupTable.java index 01bebc12ee2..2bb5a1219ef 100644 --- a/src/java.desktop/share/classes/java/awt/image/ByteLookupTable.java +++ b/src/java.desktop/share/classes/java/awt/image/ByteLookupTable.java @@ -117,7 +117,7 @@ public class ByteLookupTable extends LookupTable { * same length as {@code src}. * @return the array {@code dst}, an {@code int} array of * samples. - * @exception ArrayIndexOutOfBoundsException if {@code src} is + * @throws ArrayIndexOutOfBoundsException if {@code src} is * longer than {@code dst} or if for any element * {@code i} of {@code src}, * {@code src[i]-offset} is either less than zero or @@ -168,7 +168,7 @@ public class ByteLookupTable extends LookupTable { * same length as {@code src}. * @return the array {@code dst}, an {@code int} array of * samples. - * @exception ArrayIndexOutOfBoundsException if {@code src} is + * @throws ArrayIndexOutOfBoundsException if {@code src} is * longer than {@code dst} or if for any element * {@code i} of {@code src}, * {@code (src[i]&0xff)-offset} is either less than diff --git a/src/java.desktop/share/classes/java/awt/image/ColorConvertOp.java b/src/java.desktop/share/classes/java/awt/image/ColorConvertOp.java index 023b376d73d..f5ec86a151a 100644 --- a/src/java.desktop/share/classes/java/awt/image/ColorConvertOp.java +++ b/src/java.desktop/share/classes/java/awt/image/ColorConvertOp.java @@ -194,9 +194,9 @@ public class ColorConvertOp implements BufferedImageOp, RasterOp { * @param profiles the array of {@code ICC_Profile} objects * @param hints the {@code RenderingHints} object used to control * the color conversion, or {@code null} - * @exception IllegalArgumentException when the profile sequence does not + * @throws IllegalArgumentException when the profile sequence does not * specify a well-defined color conversion - * @exception NullPointerException if profiles is null + * @throws NullPointerException if profiles is null */ public ColorConvertOp (ICC_Profile[] profiles, RenderingHints hints) { @@ -242,7 +242,7 @@ public class ColorConvertOp implements BufferedImageOp, RasterOp { * @return {@code dest} color converted from {@code src} * or a new, converted {@code BufferedImage} * if {@code dest} is {@code null} - * @exception IllegalArgumentException if dest is null and this op was + * @throws IllegalArgumentException if dest is null and this op was * constructed using the constructor which takes only a * RenderingHints argument, since the operation is ill defined. */ @@ -456,7 +456,7 @@ public class ColorConvertOp implements BufferedImageOp, RasterOp { * @return {@code dest} color converted from {@code src} * or a new, converted {@code WritableRaster} * if {@code dest} is {@code null} - * @exception IllegalArgumentException if the number of source or + * @throws IllegalArgumentException if the number of source or * destination bands is incorrect, the source or destination * color spaces are undefined, or this op was constructed * with one of the constructors that applies only to diff --git a/src/java.desktop/share/classes/java/awt/image/DirectColorModel.java b/src/java.desktop/share/classes/java/awt/image/DirectColorModel.java index bf7ad07a22e..5853f3802a4 100644 --- a/src/java.desktop/share/classes/java/awt/image/DirectColorModel.java +++ b/src/java.desktop/share/classes/java/awt/image/DirectColorModel.java @@ -642,12 +642,12 @@ public class DirectColorModel extends PackedColorModel { * @param inData the specified pixel * @return the alpha component of the specified pixel, scaled from * 0 to 255. - * @exception ClassCastException if {@code inData} + * @throws ClassCastException if {@code inData} * is not a primitive array of type {@code transferType} - * @exception ArrayIndexOutOfBoundsException if + * @throws ArrayIndexOutOfBoundsException if * {@code inData} is not large enough to hold a pixel value * for this {@code ColorModel} - * @exception UnsupportedOperationException if this + * @throws UnsupportedOperationException if this * {@code tranferType} is not supported by this * {@code ColorModel} */ @@ -694,7 +694,7 @@ public class DirectColorModel extends PackedColorModel { * * @param inData the specified pixel * @return the color and alpha components of the specified pixel. - * @exception UnsupportedOperationException if this + * @throws UnsupportedOperationException if this * {@code transferType} is not supported by this * {@code ColorModel} * @see ColorModel#getRGBdefault @@ -744,12 +744,12 @@ public class DirectColorModel extends PackedColorModel { * @param pixel the specified pixel * @return an array representation of the specified pixel in this * {@code ColorModel} - * @exception ClassCastException if {@code pixel} + * @throws ClassCastException if {@code pixel} * is not a primitive array of type {@code transferType} - * @exception ArrayIndexOutOfBoundsException if + * @throws ArrayIndexOutOfBoundsException if * {@code pixel} is not large enough to hold a pixel value * for this {@code ColorModel} - * @exception UnsupportedOperationException if this + * @throws UnsupportedOperationException if this * {@code transferType} is not supported by this * {@code ColorModel} * @see WritableRaster#setDataElements @@ -963,14 +963,14 @@ public class DirectColorModel extends PackedColorModel { * which to start storing the color and alpha components * @return an array containing the color and alpha components of the * specified pixel starting at the specified offset. - * @exception ClassCastException if {@code pixel} + * @throws ClassCastException if {@code pixel} * is not a primitive array of type {@code transferType} - * @exception ArrayIndexOutOfBoundsException if + * @throws ArrayIndexOutOfBoundsException if * {@code pixel} is not large enough to hold a pixel value * for this {@code ColorModel}, or if {@code components} * is not {@code null} and is not large enough to hold all the * color and alpha components, starting at {@code offset} - * @exception UnsupportedOperationException if this + * @throws UnsupportedOperationException if this * {@code transferType} is not supported by this * color model */ @@ -1055,7 +1055,7 @@ public class DirectColorModel extends PackedColorModel { * begin retrieving the color and alpha components * @return an {@code int} pixel value in this * {@code ColorModel} corresponding to the specified components. - * @exception ArrayIndexOutOfBoundsException if + * @throws ArrayIndexOutOfBoundsException if * the {@code components} array is not large enough to * hold all of the color and alpha components starting at * {@code offset} @@ -1097,14 +1097,14 @@ public class DirectColorModel extends PackedColorModel { * and alpha components * @return an {@code Object} representing an array of color and * alpha components. - * @exception ClassCastException if {@code obj} + * @throws ClassCastException if {@code obj} * is not a primitive array of type {@code transferType} - * @exception ArrayIndexOutOfBoundsException if + * @throws ArrayIndexOutOfBoundsException if * {@code obj} is not large enough to hold a pixel value * for this {@code ColorModel} or the {@code components} * array is not large enough to hold all of the color and alpha * components starting at {@code offset} - * @exception UnsupportedOperationException if this + * @throws UnsupportedOperationException if this * {@code transferType} is not supported by this * color model * @see WritableRaster#setDataElements @@ -1169,7 +1169,7 @@ public class DirectColorModel extends PackedColorModel { * premultiplied; {@code false} otherwise * @return a {@code ColorModel} object that represents the * coerced data. - * @exception UnsupportedOperationException if this + * @throws UnsupportedOperationException if this * {@code transferType} is not supported by this * color model */ diff --git a/src/java.desktop/share/classes/java/awt/image/ImageFilter.java b/src/java.desktop/share/classes/java/awt/image/ImageFilter.java index d136e16fc6b..94586b851ae 100644 --- a/src/java.desktop/share/classes/java/awt/image/ImageFilter.java +++ b/src/java.desktop/share/classes/java/awt/image/ImageFilter.java @@ -107,7 +107,7 @@ public class ImageFilter implements ImageConsumer, Cloneable { * with the filtering operation. * * @param props the properties from the source object - * @exception NullPointerException if {@code props} is null + * @throws NullPointerException if {@code props} is null */ public void setProperties(Hashtable props) { @SuppressWarnings("unchecked") @@ -245,7 +245,7 @@ public class ImageFilter implements ImageConsumer, Cloneable { * @param ip the ImageProducer that is feeding this instance of * the filter - also the ImageProducer that the request should be * forwarded to if necessary - * @exception NullPointerException if {@code ip} is null + * @throws NullPointerException if {@code ip} is null */ public void resendTopDownLeftRight(ImageProducer ip) { ip.requestTopDownLeftRightResend(this); diff --git a/src/java.desktop/share/classes/java/awt/image/MultiPixelPackedSampleModel.java b/src/java.desktop/share/classes/java/awt/image/MultiPixelPackedSampleModel.java index dcec78fb348..9254d9fa717 100644 --- a/src/java.desktop/share/classes/java/awt/image/MultiPixelPackedSampleModel.java +++ b/src/java.desktop/share/classes/java/awt/image/MultiPixelPackedSampleModel.java @@ -130,7 +130,7 @@ public class MultiPixelPackedSampleModel extends SampleModel * @param scanlineStride the line stride of the image data * @param dataBitOffset the data bit offset for the region of image * data described - * @exception RasterFormatException if the number of bits per pixel + * @throws RasterFormatException if the number of bits per pixel * is not a power of 2 or if a power of 2 number of * pixels do not fit in one data element. * @throws IllegalArgumentException if {@code w} or @@ -321,7 +321,7 @@ public class MultiPixelPackedSampleModel extends SampleModel * @param bands the specified bands * @return a new {@code SampleModel} with a subset of bands of * this {@code MultiPixelPackedSampleModel}. - * @exception RasterFormatException if the number of bands requested + * @throws RasterFormatException if the number of bands requested * is not one. * @throws IllegalArgumentException if {@code w} or * {@code h} is not greater than 0 @@ -348,7 +348,7 @@ public class MultiPixelPackedSampleModel extends SampleModel * data * @return the specified band containing the sample of the specified * pixel. - * @exception ArrayIndexOutOfBoundsException if the specified + * @throws ArrayIndexOutOfBoundsException if the specified * coordinates are not in bounds. * @see #setSample(int, int, int, int, DataBuffer) */ @@ -377,7 +377,7 @@ public class MultiPixelPackedSampleModel extends SampleModel * @param b the band to return, which is assumed to be 0 * @param s the input sample as an {@code int} * @param data the {@code DataBuffer} where image data is stored - * @exception ArrayIndexOutOfBoundsException if the coordinates are + * @throws ArrayIndexOutOfBoundsException if the coordinates are * not in bounds. * @see #getSample(int, int, int, DataBuffer) */ @@ -442,9 +442,9 @@ public class MultiPixelPackedSampleModel extends SampleModel * @param data the {@code DataBuffer} containing the image data. * @return an {@code Object} containing data for the specified * pixel. - * @exception ClassCastException if {@code obj} is not a + * @throws ClassCastException if {@code obj} is not a * primitive array of type TransferType or is not {@code null} - * @exception ArrayIndexOutOfBoundsException if the coordinates are + * @throws ArrayIndexOutOfBoundsException if the coordinates are * not in bounds, or if {@code obj} is not {@code null} or * not large enough to hold the pixel data * @see #setDataElements(int, int, Object, DataBuffer) @@ -526,7 +526,7 @@ public class MultiPixelPackedSampleModel extends SampleModel * {@code null} * @param data the {@code DataBuffer} where image data is stored * @return an array containing the specified pixel. - * @exception ArrayIndexOutOfBoundsException if the coordinates + * @throws ArrayIndexOutOfBoundsException if the coordinates * are not in bounds * @see #setPixel(int, int, int[], DataBuffer) */ diff --git a/src/java.desktop/share/classes/java/awt/image/PixelGrabber.java b/src/java.desktop/share/classes/java/awt/image/PixelGrabber.java index 3855316d986..fb66a95f539 100644 --- a/src/java.desktop/share/classes/java/awt/image/PixelGrabber.java +++ b/src/java.desktop/share/classes/java/awt/image/PixelGrabber.java @@ -219,7 +219,7 @@ public class PixelGrabber implements ImageConsumer { * delivered. * @return true if the pixels were successfully grabbed, false on * abort, error or timeout - * @exception InterruptedException + * @throws InterruptedException * Another thread has interrupted this thread. */ public boolean grabPixels() throws InterruptedException { @@ -243,7 +243,7 @@ public class PixelGrabber implements ImageConsumer { * to arrive before timing out * @return true if the pixels were successfully grabbed, false on * abort, error or timeout - * @exception InterruptedException + * @throws InterruptedException * Another thread has interrupted this thread. */ public synchronized boolean grabPixels(long ms) diff --git a/src/java.desktop/share/classes/java/awt/image/RGBImageFilter.java b/src/java.desktop/share/classes/java/awt/image/RGBImageFilter.java index 44302923d17..9838fdfe8b6 100644 --- a/src/java.desktop/share/classes/java/awt/image/RGBImageFilter.java +++ b/src/java.desktop/share/classes/java/awt/image/RGBImageFilter.java @@ -146,7 +146,7 @@ public abstract class RGBImageFilter extends ImageFilter { * a color table entry is being filtered rather than an actual * pixel value. * @param icm the IndexColorModel object to be filtered - * @exception NullPointerException if {@code icm} is null + * @throws NullPointerException if {@code icm} is null * @return a new IndexColorModel representing the filtered colors */ public IndexColorModel filterIndexColorModel(IndexColorModel icm) { diff --git a/src/java.desktop/share/classes/java/awt/image/Raster.java b/src/java.desktop/share/classes/java/awt/image/Raster.java index 32d45078b38..d388aa1f79c 100644 --- a/src/java.desktop/share/classes/java/awt/image/Raster.java +++ b/src/java.desktop/share/classes/java/awt/image/Raster.java @@ -1375,7 +1375,7 @@ public class Raster { * @param h the specified height of the new {@code WritableRaster} * @return a compatible {@code WritableRaster} with the specified * size and a new sample model and data buffer. - * @exception RasterFormatException if the width or height is less than + * @throws RasterFormatException if the width or height is less than * or equal to zero. */ public WritableRaster createCompatibleWritableRaster(int w, int h) { @@ -1501,7 +1501,7 @@ public class Raster { * of the returned Raster * @param bandList Array of band indices, or null to use all bands * @return a new {@code Raster}. - * @exception RasterFormatException if the specified subregion is outside + * @throws RasterFormatException if the specified subregion is outside * of the raster bounds. * @throws RasterFormatException if {@code width} or * {@code height} diff --git a/src/java.desktop/share/classes/java/awt/image/ShortLookupTable.java b/src/java.desktop/share/classes/java/awt/image/ShortLookupTable.java index 3f4e236b9bc..e9c97ad864e 100644 --- a/src/java.desktop/share/classes/java/awt/image/ShortLookupTable.java +++ b/src/java.desktop/share/classes/java/awt/image/ShortLookupTable.java @@ -111,7 +111,7 @@ public class ShortLookupTable extends LookupTable { * same length as {@code src}. * @return the array {@code dst}, an {@code int} array of * samples. - * @exception ArrayIndexOutOfBoundsException if {@code src} is + * @throws ArrayIndexOutOfBoundsException if {@code src} is * longer than {@code dst} or if for any element * {@code i} of {@code src}, * {@code (src[i]&0xffff)-offset} is either less than @@ -162,7 +162,7 @@ public class ShortLookupTable extends LookupTable { * same length as {@code src}. * @return the array {@code dst}, an {@code int} array of * samples. - * @exception ArrayIndexOutOfBoundsException if {@code src} is + * @throws ArrayIndexOutOfBoundsException if {@code src} is * longer than {@code dst} or if for any element * {@code i} of {@code src}, * {@code (src[i]&0xffff)-offset} is either less than diff --git a/src/java.desktop/share/classes/java/awt/image/SinglePixelPackedSampleModel.java b/src/java.desktop/share/classes/java/awt/image/SinglePixelPackedSampleModel.java index 864ed00cf76..abb669e02c6 100644 --- a/src/java.desktop/share/classes/java/awt/image/SinglePixelPackedSampleModel.java +++ b/src/java.desktop/share/classes/java/awt/image/SinglePixelPackedSampleModel.java @@ -302,7 +302,7 @@ public class SinglePixelPackedSampleModel extends SampleModel * SinglePixelPackedSampleModel/DataBuffer combination will represent * an image with a subset of the bands of the original * SinglePixelPackedSampleModel/DataBuffer combination. - * @exception RasterFormatException if the length of the bands argument is + * @throws RasterFormatException if the length of the bands argument is * greater than the number of bands in * the sample model. */ diff --git a/src/java.desktop/share/classes/java/awt/image/WritableRaster.java b/src/java.desktop/share/classes/java/awt/image/WritableRaster.java index 0e345026c2b..729317d85a3 100644 --- a/src/java.desktop/share/classes/java/awt/image/WritableRaster.java +++ b/src/java.desktop/share/classes/java/awt/image/WritableRaster.java @@ -204,7 +204,7 @@ public class WritableRaster extends Raster { * @param bandList Array of band indices, or null to use all bands. * @return a {@code WritableRaster} sharing all or part of the * {@code DataBuffer} of this {@code WritableRaster}. - * @exception RasterFormatException if the subregion is outside of the + * @throws RasterFormatException if the subregion is outside of the * raster bounds. * @throws RasterFormatException if {@code w} or * {@code h} diff --git a/src/java.desktop/share/classes/java/awt/print/PageFormat.java b/src/java.desktop/share/classes/java/awt/print/PageFormat.java index b7709eb581e..019c5d0bdcc 100644 --- a/src/java.desktop/share/classes/java/awt/print/PageFormat.java +++ b/src/java.desktop/share/classes/java/awt/print/PageFormat.java @@ -286,7 +286,7 @@ public class PageFormat implements Cloneable * {@code PageFormat}. * @param paper the {@code Paper} object to which to set * the {@code Paper} object for this {@code PageFormat}. - * @exception NullPointerException + * @throws NullPointerException * a null paper instance was passed as a parameter. * @see #getPaper */ diff --git a/src/java.desktop/share/classes/java/awt/print/Printable.java b/src/java.desktop/share/classes/java/awt/print/Printable.java index 28a01cc9a16..1fbf1f7c616 100644 --- a/src/java.desktop/share/classes/java/awt/print/Printable.java +++ b/src/java.desktop/share/classes/java/awt/print/Printable.java @@ -134,7 +134,7 @@ public interface Printable { * @return PAGE_EXISTS if the page is rendered successfully * or NO_SUCH_PAGE if {@code pageIndex} specifies a * non-existent page. - * @exception java.awt.print.PrinterException + * @throws java.awt.print.PrinterException * thrown when the print job is terminated. */ int print(Graphics graphics, PageFormat pageFormat, int pageIndex) diff --git a/src/java.desktop/share/classes/java/awt/print/PrinterJob.java b/src/java.desktop/share/classes/java/awt/print/PrinterJob.java index 41656367183..ddf565f3ce3 100644 --- a/src/java.desktop/share/classes/java/awt/print/PrinterJob.java +++ b/src/java.desktop/share/classes/java/awt/print/PrinterJob.java @@ -168,7 +168,7 @@ public abstract class PrinterJob { * cannot support the {@code Pageable} and * {@code Printable} interfaces necessary to support 2D printing. * @param service a print service that supports 2D printing - * @exception PrinterException if the specified service does not support + * @throws PrinterException if the specified service does not support * 2D printing, or this PrinterJob class does not support * setting a 2D print service, or the specified service is * otherwise not a valid print service. @@ -212,7 +212,7 @@ public abstract class PrinterJob { * {@code document}. * @param document the pages to be printed. It can not be * {@code null}. - * @exception NullPointerException the {@code Pageable} passed in + * @throws NullPointerException the {@code Pageable} passed in * was {@code null}. * @see PageFormat * @see Printable @@ -235,7 +235,7 @@ public abstract class PrinterJob { * selected by the user. * @return {@code true} if the user does not cancel the dialog; * {@code false} otherwise. - * @exception HeadlessException if GraphicsEnvironment.isHeadless() + * @throws HeadlessException if GraphicsEnvironment.isHeadless() * returns true. * @see java.awt.GraphicsEnvironment#isHeadless */ @@ -279,9 +279,9 @@ public abstract class PrinterJob { * This parameter may not be null. * @return {@code true} if the user does not cancel the dialog; * {@code false} otherwise. - * @exception HeadlessException if GraphicsEnvironment.isHeadless() + * @throws HeadlessException if GraphicsEnvironment.isHeadless() * returns true. - * @exception NullPointerException if {@code attributes} parameter + * @throws NullPointerException if {@code attributes} parameter * is null. * @see java.awt.GraphicsEnvironment#isHeadless * @since 1.4 @@ -313,7 +313,7 @@ public abstract class PrinterJob { * is cancelled; a new {@code PageFormat} object * containing the format indicated by the user if the * dialog is acknowledged. - * @exception HeadlessException if GraphicsEnvironment.isHeadless() + * @throws HeadlessException if GraphicsEnvironment.isHeadless() * returns true. * @see java.awt.GraphicsEnvironment#isHeadless * @since 1.2 @@ -342,9 +342,9 @@ public abstract class PrinterJob { * This parameter may not be null. * @return a page format if the user does not cancel the dialog; * {@code null} otherwise. - * @exception HeadlessException if GraphicsEnvironment.isHeadless() + * @throws HeadlessException if GraphicsEnvironment.isHeadless() * returns true. - * @exception NullPointerException if {@code attributes} parameter + * @throws NullPointerException if {@code attributes} parameter * is null. * @see java.awt.GraphicsEnvironment#isHeadless * @since 1.4 @@ -495,7 +495,7 @@ public abstract class PrinterJob { /** * Prints a set of pages. - * @exception PrinterException an error in the print system + * @throws PrinterException an error in the print system * caused the job to be aborted. * @see Book * @see Pageable @@ -533,7 +533,7 @@ public abstract class PrinterJob { * this print() method. * * @param attributes a set of attributes for the job - * @exception PrinterException an error in the print system + * @throws PrinterException an error in the print system * caused the job to be aborted. * @see Book * @see Pageable -- GitLab From beedae1141b6b650dc4cedf1f038afc1c8b460dd Mon Sep 17 00:00:00 2001 From: Claes Redestad Date: Thu, 17 Mar 2022 09:20:24 +0000 Subject: [PATCH 266/340] 8281146: Replace StringCoding.hasNegatives with countPositives Co-authored-by: Lutz Schmidt Co-authored-by: Martin Doerr Reviewed-by: kvn, lucy, rriggs --- src/hotspot/cpu/aarch64/aarch64.ad | 8 +- .../cpu/aarch64/macroAssembler_aarch64.cpp | 36 ++-- .../cpu/aarch64/macroAssembler_aarch64.hpp | 2 +- .../cpu/aarch64/stubGenerator_aarch64.cpp | 54 +++--- .../cpu/aarch64/stubRoutines_aarch64.cpp | 4 +- .../cpu/aarch64/stubRoutines_aarch64.hpp | 12 +- src/hotspot/cpu/ppc/c2_MacroAssembler_ppc.cpp | 32 ++-- src/hotspot/cpu/ppc/c2_MacroAssembler_ppc.hpp | 2 +- src/hotspot/cpu/ppc/ppc.ad | 14 +- .../cpu/s390/c2_MacroAssembler_s390.cpp | 104 ++++++----- .../cpu/s390/c2_MacroAssembler_s390.hpp | 4 +- src/hotspot/cpu/s390/s390.ad | 11 +- src/hotspot/cpu/x86/c2_MacroAssembler_x86.cpp | 155 +++++++++++------ src/hotspot/cpu/x86/c2_MacroAssembler_x86.hpp | 9 +- src/hotspot/cpu/x86/x86_32.ad | 28 +-- src/hotspot/cpu/x86/x86_64.ad | 28 +-- src/hotspot/share/adlc/formssel.cpp | 4 +- src/hotspot/share/classfile/vmIntrinsics.cpp | 2 +- src/hotspot/share/classfile/vmIntrinsics.hpp | 9 +- .../gc/shenandoah/c2/shenandoahSupport.cpp | 2 +- src/hotspot/share/jvmci/vmStructs_jvmci.cpp | 4 +- src/hotspot/share/opto/c2compiler.cpp | 4 +- src/hotspot/share/opto/classes.hpp | 2 +- src/hotspot/share/opto/escape.cpp | 9 +- src/hotspot/share/opto/intrinsicnode.hpp | 8 +- src/hotspot/share/opto/lcm.cpp | 2 +- src/hotspot/share/opto/library_call.cpp | 12 +- src/hotspot/share/opto/library_call.hpp | 2 +- src/hotspot/share/opto/loopTransform.cpp | 4 +- src/hotspot/share/opto/loopnode.cpp | 2 +- src/hotspot/share/opto/matcher.cpp | 4 +- .../share/classes/java/lang/String.java | 164 +++++++++--------- .../share/classes/java/lang/StringCoding.java | 23 ++- .../intrinsics/string/TestCountPositives.java | 130 ++++++++++++++ .../patches/java.base/java/lang/Helper.java | 5 + .../openjdk/bench/java/lang/StringDecode.java | 4 +- 36 files changed, 558 insertions(+), 341 deletions(-) create mode 100644 test/hotspot/jtreg/compiler/intrinsics/string/TestCountPositives.java diff --git a/src/hotspot/cpu/aarch64/aarch64.ad b/src/hotspot/cpu/aarch64/aarch64.ad index 96075ecd9d5..68fd336aa33 100644 --- a/src/hotspot/cpu/aarch64/aarch64.ad +++ b/src/hotspot/cpu/aarch64/aarch64.ad @@ -17080,13 +17080,13 @@ instruct array_equalsC(iRegP_R1 ary1, iRegP_R2 ary2, iRegI_R0 result, ins_pipe(pipe_class_memory); %} -instruct has_negatives(iRegP_R1 ary1, iRegI_R2 len, iRegI_R0 result, rFlagsReg cr) +instruct count_positives(iRegP_R1 ary1, iRegI_R2 len, iRegI_R0 result, rFlagsReg cr) %{ - match(Set result (HasNegatives ary1 len)); + match(Set result (CountPositives ary1 len)); effect(USE_KILL ary1, USE_KILL len, KILL cr); - format %{ "has negatives byte[] $ary1,$len -> $result" %} + format %{ "count positives byte[] $ary1,$len -> $result" %} ins_encode %{ - address tpc = __ has_negatives($ary1$$Register, $len$$Register, $result$$Register); + address tpc = __ count_positives($ary1$$Register, $len$$Register, $result$$Register); if (tpc == NULL) { ciEnv::current()->record_failure("CodeCache is full"); return; diff --git a/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp b/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp index 80287fb6949..dae4e22b15b 100644 --- a/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp @@ -4339,16 +4339,17 @@ void MacroAssembler::remove_frame(int framesize) { } -// This method checks if provided byte array contains byte with highest bit set. -address MacroAssembler::has_negatives(Register ary1, Register len, Register result) { +// This method counts leading positive bytes (highest bit not set) in provided byte array +address MacroAssembler::count_positives(Register ary1, Register len, Register result) { // Simple and most common case of aligned small array which is not at the // end of memory page is placed here. All other cases are in stub. Label LOOP, END, STUB, STUB_LONG, SET_RESULT, DONE; const uint64_t UPPER_BIT_MASK=0x8080808080808080; assert_different_registers(ary1, len, result); + mov(result, len); cmpw(len, 0); - br(LE, SET_RESULT); + br(LE, DONE); cmpw(len, 4 * wordSize); br(GE, STUB_LONG); // size > 32 then go to stub @@ -4367,19 +4368,20 @@ address MacroAssembler::has_negatives(Register ary1, Register len, Register resu subs(len, len, wordSize); br(GE, LOOP); cmpw(len, -wordSize); - br(EQ, SET_RESULT); + br(EQ, DONE); BIND(END); - ldr(result, Address(ary1)); - sub(len, zr, len, LSL, 3); // LSL 3 is to get bits from bytes - lslv(result, result, len); - tst(result, UPPER_BIT_MASK); - b(SET_RESULT); + ldr(rscratch1, Address(ary1)); + sub(rscratch2, zr, len, LSL, 3); // LSL 3 is to get bits from bytes + lslv(rscratch1, rscratch1, rscratch2); + tst(rscratch1, UPPER_BIT_MASK); + br(NE, SET_RESULT); + b(DONE); BIND(STUB); - RuntimeAddress has_neg = RuntimeAddress(StubRoutines::aarch64::has_negatives()); - assert(has_neg.target() != NULL, "has_negatives stub has not been generated"); - address tpc1 = trampoline_call(has_neg); + RuntimeAddress count_pos = RuntimeAddress(StubRoutines::aarch64::count_positives()); + assert(count_pos.target() != NULL, "count_positives stub has not been generated"); + address tpc1 = trampoline_call(count_pos); if (tpc1 == NULL) { DEBUG_ONLY(reset_labels(STUB_LONG, SET_RESULT, DONE)); postcond(pc() == badAddress); @@ -4388,9 +4390,9 @@ address MacroAssembler::has_negatives(Register ary1, Register len, Register resu b(DONE); BIND(STUB_LONG); - RuntimeAddress has_neg_long = RuntimeAddress(StubRoutines::aarch64::has_negatives_long()); - assert(has_neg_long.target() != NULL, "has_negatives stub has not been generated"); - address tpc2 = trampoline_call(has_neg_long); + RuntimeAddress count_pos_long = RuntimeAddress(StubRoutines::aarch64::count_positives_long()); + assert(count_pos_long.target() != NULL, "count_positives_long stub has not been generated"); + address tpc2 = trampoline_call(count_pos_long); if (tpc2 == NULL) { DEBUG_ONLY(reset_labels(SET_RESULT, DONE)); postcond(pc() == badAddress); @@ -4399,7 +4401,9 @@ address MacroAssembler::has_negatives(Register ary1, Register len, Register resu b(DONE); BIND(SET_RESULT); - cset(result, NE); // set true or false + + add(len, len, wordSize); + sub(result, result, len); BIND(DONE); postcond(pc() != badAddress); diff --git a/src/hotspot/cpu/aarch64/macroAssembler_aarch64.hpp b/src/hotspot/cpu/aarch64/macroAssembler_aarch64.hpp index 29d4b8ac119..1344250febb 100644 --- a/src/hotspot/cpu/aarch64/macroAssembler_aarch64.hpp +++ b/src/hotspot/cpu/aarch64/macroAssembler_aarch64.hpp @@ -1234,7 +1234,7 @@ public: Register table0, Register table1, Register table2, Register table3, bool upper = false); - address has_negatives(Register ary1, Register len, Register result); + address count_positives(Register ary1, Register len, Register result); address arrays_equals(Register a1, Register a2, Register result, Register cnt1, Register tmp1, Register tmp2, Register tmp3, int elem_size); diff --git a/src/hotspot/cpu/aarch64/stubGenerator_aarch64.cpp b/src/hotspot/cpu/aarch64/stubGenerator_aarch64.cpp index eef7e6afe71..5a92dcb6b47 100644 --- a/src/hotspot/cpu/aarch64/stubGenerator_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/stubGenerator_aarch64.cpp @@ -4657,7 +4657,7 @@ class StubGenerator: public StubCodeGenerator { return start; } - address generate_has_negatives(address &has_negatives_long) { + address generate_count_positives(address &count_positives_long) { const u1 large_loop_size = 64; const uint64_t UPPER_BIT_MASK=0x8080808080808080; int dcache_line = VM_Version::dcache_line_size(); @@ -4666,13 +4666,15 @@ class StubGenerator: public StubCodeGenerator { __ align(CodeEntryAlignment); - StubCodeMark mark(this, "StubRoutines", "has_negatives"); + StubCodeMark mark(this, "StubRoutines", "count_positives"); address entry = __ pc(); __ enter(); + // precondition: a copy of len is already in result + // __ mov(result, len); - Label RET_TRUE, RET_TRUE_NO_POP, RET_FALSE, ALIGNED, LOOP16, CHECK_16, + Label RET_ADJUST, RET_ADJUST_16, RET_ADJUST_LONG, RET_NO_POP, RET_LEN, ALIGNED, LOOP16, CHECK_16, LARGE_LOOP, POST_LOOP16, LEN_OVER_15, LEN_OVER_8, POST_LOOP16_LOAD_TAIL; __ cmp(len, (u1)15); @@ -4686,25 +4688,26 @@ class StubGenerator: public StubCodeGenerator { __ sub(rscratch1, zr, len, __ LSL, 3); // LSL 3 is to get bits from bytes. __ lsrv(rscratch2, rscratch2, rscratch1); __ tst(rscratch2, UPPER_BIT_MASK); - __ cset(result, Assembler::NE); + __ csel(result, zr, result, Assembler::NE); __ leave(); __ ret(lr); __ bind(LEN_OVER_8); __ ldp(rscratch1, rscratch2, Address(ary1, -16)); __ sub(len, len, 8); // no data dep., then sub can be executed while loading __ tst(rscratch2, UPPER_BIT_MASK); - __ br(Assembler::NE, RET_TRUE_NO_POP); + __ br(Assembler::NE, RET_NO_POP); __ sub(rscratch2, zr, len, __ LSL, 3); // LSL 3 is to get bits from bytes __ lsrv(rscratch1, rscratch1, rscratch2); __ tst(rscratch1, UPPER_BIT_MASK); - __ cset(result, Assembler::NE); + __ bind(RET_NO_POP); + __ csel(result, zr, result, Assembler::NE); __ leave(); __ ret(lr); Register tmp1 = r3, tmp2 = r4, tmp3 = r5, tmp4 = r6, tmp5 = r7, tmp6 = r10; const RegSet spilled_regs = RegSet::range(tmp1, tmp5) + tmp6; - has_negatives_long = __ pc(); // 2nd entry point + count_positives_long = __ pc(); // 2nd entry point __ enter(); @@ -4716,10 +4719,10 @@ class StubGenerator: public StubCodeGenerator { __ mov(tmp5, 16); __ sub(rscratch1, tmp5, rscratch2); // amount of bytes until aligned address __ add(ary1, ary1, rscratch1); - __ sub(len, len, rscratch1); __ orr(tmp6, tmp6, tmp1); __ tst(tmp6, UPPER_BIT_MASK); - __ br(Assembler::NE, RET_TRUE); + __ br(Assembler::NE, RET_ADJUST); + __ sub(len, len, rscratch1); __ bind(ALIGNED); __ cmp(len, large_loop_size); @@ -4734,7 +4737,7 @@ class StubGenerator: public StubCodeGenerator { __ sub(len, len, 16); __ orr(tmp6, tmp6, tmp1); __ tst(tmp6, UPPER_BIT_MASK); - __ br(Assembler::NE, RET_TRUE); + __ br(Assembler::NE, RET_ADJUST_16); __ cmp(len, large_loop_size); __ br(Assembler::LT, CHECK_16); @@ -4766,7 +4769,7 @@ class StubGenerator: public StubCodeGenerator { __ orr(rscratch1, rscratch1, tmp6); __ orr(tmp2, tmp2, rscratch1); __ tst(tmp2, UPPER_BIT_MASK); - __ br(Assembler::NE, RET_TRUE); + __ br(Assembler::NE, RET_ADJUST_LONG); __ cmp(len, large_loop_size); __ br(Assembler::GE, LARGE_LOOP); @@ -4779,7 +4782,7 @@ class StubGenerator: public StubCodeGenerator { __ sub(len, len, 16); __ orr(tmp2, tmp2, tmp3); __ tst(tmp2, UPPER_BIT_MASK); - __ br(Assembler::NE, RET_TRUE); + __ br(Assembler::NE, RET_ADJUST_16); __ cmp(len, (u1)16); __ br(Assembler::GE, LOOP16); // 16-byte load loop end @@ -4787,31 +4790,36 @@ class StubGenerator: public StubCodeGenerator { __ cmp(len, (u1)8); __ br(Assembler::LE, POST_LOOP16_LOAD_TAIL); __ ldr(tmp3, Address(__ post(ary1, 8))); - __ sub(len, len, 8); __ tst(tmp3, UPPER_BIT_MASK); - __ br(Assembler::NE, RET_TRUE); + __ br(Assembler::NE, RET_ADJUST); + __ sub(len, len, 8); __ bind(POST_LOOP16_LOAD_TAIL); - __ cbz(len, RET_FALSE); // Can't shift left by 64 when len==0 + __ cbz(len, RET_LEN); // Can't shift left by 64 when len==0 __ ldr(tmp1, Address(ary1)); __ mov(tmp2, 64); __ sub(tmp4, tmp2, len, __ LSL, 3); __ lslv(tmp1, tmp1, tmp4); __ tst(tmp1, UPPER_BIT_MASK); - __ br(Assembler::NE, RET_TRUE); + __ br(Assembler::NE, RET_ADJUST); // Fallthrough - __ bind(RET_FALSE); + __ bind(RET_LEN); __ pop(spilled_regs, sp); __ leave(); - __ mov(result, zr); __ ret(lr); - __ bind(RET_TRUE); + // difference result - len is the count of guaranteed to be + // positive bytes + + __ bind(RET_ADJUST_LONG); + __ add(len, len, (u1)(large_loop_size - 16)); + __ bind(RET_ADJUST_16); + __ add(len, len, 16); + __ bind(RET_ADJUST); __ pop(spilled_regs, sp); - __ bind(RET_TRUE_NO_POP); __ leave(); - __ mov(result, 1); + __ sub(result, result, len); __ ret(lr); return entry; @@ -7515,8 +7523,8 @@ class StubGenerator: public StubCodeGenerator { // arraycopy stubs used by compilers generate_arraycopy_stubs(); - // has negatives stub for large arrays. - StubRoutines::aarch64::_has_negatives = generate_has_negatives(StubRoutines::aarch64::_has_negatives_long); + // countPositives stub for large arrays. + StubRoutines::aarch64::_count_positives = generate_count_positives(StubRoutines::aarch64::_count_positives_long); // array equals stub for large arrays. if (!UseSimpleArrayEquals) { diff --git a/src/hotspot/cpu/aarch64/stubRoutines_aarch64.cpp b/src/hotspot/cpu/aarch64/stubRoutines_aarch64.cpp index 9e16a1f9f88..2e1c4b69542 100644 --- a/src/hotspot/cpu/aarch64/stubRoutines_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/stubRoutines_aarch64.cpp @@ -45,8 +45,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_blocks = NULL; -address StubRoutines::aarch64::_has_negatives = NULL; -address StubRoutines::aarch64::_has_negatives_long = NULL; +address StubRoutines::aarch64::_count_positives = NULL; +address StubRoutines::aarch64::_count_positives_long = NULL; address StubRoutines::aarch64::_large_array_equals = NULL; address StubRoutines::aarch64::_compare_long_string_LL = NULL; address StubRoutines::aarch64::_compare_long_string_UU = NULL; diff --git a/src/hotspot/cpu/aarch64/stubRoutines_aarch64.hpp b/src/hotspot/cpu/aarch64/stubRoutines_aarch64.hpp index ae48d8788e1..a17e7540e42 100644 --- a/src/hotspot/cpu/aarch64/stubRoutines_aarch64.hpp +++ b/src/hotspot/cpu/aarch64/stubRoutines_aarch64.hpp @@ -76,8 +76,8 @@ class aarch64 { public: - static address _has_negatives; - static address _has_negatives_long; + static address _count_positives; + static address _count_positives_long; static address get_previous_sp_entry() { @@ -132,12 +132,12 @@ class aarch64 { return _zero_blocks; } - static address has_negatives() { - return _has_negatives; + static address count_positives() { + return _count_positives; } - static address has_negatives_long() { - return _has_negatives_long; + static address count_positives_long() { + return _count_positives_long; } static address large_array_equals() { diff --git a/src/hotspot/cpu/ppc/c2_MacroAssembler_ppc.cpp b/src/hotspot/cpu/ppc/c2_MacroAssembler_ppc.cpp index 1ae5c13e62e..30104094983 100644 --- a/src/hotspot/cpu/ppc/c2_MacroAssembler_ppc.cpp +++ b/src/hotspot/cpu/ppc/c2_MacroAssembler_ppc.cpp @@ -565,16 +565,16 @@ void C2_MacroAssembler::string_indexof_char(Register result, Register haystack, } // string_indexof_char -void C2_MacroAssembler::has_negatives(Register src, Register cnt, Register result, - Register tmp1, Register tmp2) { +void C2_MacroAssembler::count_positives(Register src, Register cnt, Register result, + Register tmp1, Register tmp2) { const Register tmp0 = R0; assert_different_registers(src, result, cnt, tmp0, tmp1, tmp2); - Label Lfastloop, Lslow, Lloop, Lnoneg, Ldone; + Label Lfastloop, Lslow, Lloop, Ldone; // Check if cnt >= 8 (= 16 bytes) lis(tmp1, (int)(short)0x8080); // tmp1 = 0x8080808080808080 srwi_(tmp2, cnt, 4); - li(result, 1); // Assume there's a negative byte. + mr(result, src); // Use result reg to point to the current position. beq(CCR0, Lslow); ori(tmp1, tmp1, 0x8080); rldimi(tmp1, tmp1, 32, 0); @@ -582,30 +582,28 @@ void C2_MacroAssembler::has_negatives(Register src, Register cnt, Register resul // 2x unrolled loop bind(Lfastloop); - ld(tmp2, 0, src); - ld(tmp0, 8, src); + ld(tmp2, 0, result); + ld(tmp0, 8, result); orr(tmp0, tmp2, tmp0); and_(tmp0, tmp0, tmp1); - bne(CCR0, Ldone); // Found negative byte. - addi(src, src, 16); - + bne(CCR0, Lslow); // Found negative byte. + addi(result, result, 16); bdnz(Lfastloop); - bind(Lslow); // Fallback to slow version - rldicl_(tmp0, cnt, 0, 64-4); - beq(CCR0, Lnoneg); + bind(Lslow); // Fallback to slow version. + subf(tmp0, src, result); // Bytes known positive. + subf_(tmp0, tmp0, cnt); // Remaining Bytes. + beq(CCR0, Ldone); mtctr(tmp0); bind(Lloop); - lbz(tmp0, 0, src); - addi(src, src, 1); + lbz(tmp0, 0, result); andi_(tmp0, tmp0, 0x80); bne(CCR0, Ldone); // Found negative byte. + addi(result, result, 1); bdnz(Lloop); - bind(Lnoneg); - li(result, 0); bind(Ldone); + subf(result, src, result); // Result is offset from src. } - diff --git a/src/hotspot/cpu/ppc/c2_MacroAssembler_ppc.hpp b/src/hotspot/cpu/ppc/c2_MacroAssembler_ppc.hpp index 9c4576f2eaf..ef4840b08a2 100644 --- a/src/hotspot/cpu/ppc/c2_MacroAssembler_ppc.hpp +++ b/src/hotspot/cpu/ppc/c2_MacroAssembler_ppc.hpp @@ -63,6 +63,6 @@ void string_indexof_char(Register result, Register haystack, Register haycnt, Register needle, jchar needleChar, Register tmp1, Register tmp2, bool is_byte); - void has_negatives(Register src, Register cnt, Register result, Register tmp1, Register tmp2); + void count_positives(Register src, Register cnt, Register result, Register tmp1, Register tmp2); #endif // CPU_PPC_C2_MACROASSEMBLER_PPC_HPP diff --git a/src/hotspot/cpu/ppc/ppc.ad b/src/hotspot/cpu/ppc/ppc.ad index 832982deb45..b41c72ab449 100644 --- a/src/hotspot/cpu/ppc/ppc.ad +++ b/src/hotspot/cpu/ppc/ppc.ad @@ -12779,16 +12779,16 @@ instruct string_inflate(Universe dummy, rarg1RegP src, rarg2RegP dst, iRegIsrc l %} // StringCoding.java intrinsics -instruct has_negatives(rarg1RegP ary1, iRegIsrc len, iRegIdst result, iRegLdst tmp1, iRegLdst tmp2, - regCTR ctr, flagsRegCR0 cr0) +instruct count_positives(iRegPsrc ary1, iRegIsrc len, iRegIdst result, iRegLdst tmp1, iRegLdst tmp2, + regCTR ctr, flagsRegCR0 cr0) %{ - match(Set result (HasNegatives ary1 len)); - effect(TEMP_DEF result, USE_KILL ary1, TEMP tmp1, TEMP tmp2, KILL ctr, KILL cr0); + match(Set result (CountPositives ary1 len)); + effect(TEMP_DEF result, TEMP tmp1, TEMP tmp2, KILL ctr, KILL cr0); ins_cost(300); - format %{ "has negatives byte[] $ary1,$len -> $result \t// KILL $tmp1, $tmp2" %} + format %{ "count positives byte[] $ary1,$len -> $result \t// KILL $tmp1, $tmp2" %} ins_encode %{ - __ has_negatives($ary1$$Register, $len$$Register, $result$$Register, - $tmp1$$Register, $tmp2$$Register); + __ count_positives($ary1$$Register, $len$$Register, $result$$Register, + $tmp1$$Register, $tmp2$$Register); %} ins_pipe(pipe_class_default); %} diff --git a/src/hotspot/cpu/s390/c2_MacroAssembler_s390.cpp b/src/hotspot/cpu/s390/c2_MacroAssembler_s390.cpp index 04a6b88052c..6fac285f738 100644 --- a/src/hotspot/cpu/s390/c2_MacroAssembler_s390.cpp +++ b/src/hotspot/cpu/s390/c2_MacroAssembler_s390.cpp @@ -823,52 +823,64 @@ unsigned int C2_MacroAssembler::string_inflate_const(Register src, Register dst, return offset() - block_start; } -// Kills src. -unsigned int C2_MacroAssembler::has_negatives(Register result, Register src, Register cnt, - Register odd_reg, Register even_reg, Register tmp) { - int block_start = offset(); - Label Lloop1, Lloop2, Lslow, Lnotfound, Ldone; - const Register addr = src, mask = tmp; - - BLOCK_COMMENT("has_negatives {"); - - z_llgfr(Z_R1, cnt); // Number of bytes to read. (Must be a positive simm32.) - z_llilf(mask, 0x80808080); - z_lhi(result, 1); // Assume true. - // Last possible addr for fast loop. - z_lay(odd_reg, -16, Z_R1, src); - z_chi(cnt, 16); - z_brl(Lslow); - - // ind1: index, even_reg: index increment, odd_reg: index limit - z_iihf(mask, 0x80808080); - z_lghi(even_reg, 16); - - bind(Lloop1); // 16 bytes per iteration. - z_lg(Z_R0, Address(addr)); - z_lg(Z_R1, Address(addr, 8)); - z_ogr(Z_R0, Z_R1); - z_ngr(Z_R0, mask); - z_brne(Ldone); // If found return 1. - z_brxlg(addr, even_reg, Lloop1); - - bind(Lslow); - z_aghi(odd_reg, 16-1); // Last possible addr for slow loop. - z_lghi(even_reg, 1); - z_cgr(addr, odd_reg); - z_brh(Lnotfound); - - bind(Lloop2); // 1 byte per iteration. - z_cli(Address(addr), 0x80); - z_brnl(Ldone); // If found return 1. - z_brxlg(addr, even_reg, Lloop2); - - bind(Lnotfound); - z_lhi(result, 0); - - bind(Ldone); - - BLOCK_COMMENT("} has_negatives"); +// Returns the number of non-negative bytes (aka US-ASCII characters) found +// before the first negative byte is encountered. +unsigned int C2_MacroAssembler::count_positives(Register result, Register src, Register cnt, Register tmp) { + const unsigned int block_start = offset(); + const unsigned int byte_mask = 0x80; + const unsigned int twobyte_mask = byte_mask<<8 | byte_mask; + const unsigned int unroll_factor = 16; + const unsigned int log_unroll_factor = exact_log2(unroll_factor); + Register pos = src; // current position in src array, restored at end + Register ctr = result; // loop counter, result value + Register mask = tmp; // holds the sign detection mask + Label unrolledLoop, unrolledDone, byteLoop, allDone; + + assert_different_registers(result, src, cnt, tmp); + + BLOCK_COMMENT("count_positives {"); + + lgr_if_needed(pos, src); // current position in src array + z_srak(ctr, cnt, log_unroll_factor); // # iterations of unrolled loop + z_brnh(unrolledDone); // array too short for unrolled loop + + z_iilf(mask, twobyte_mask<<16 | twobyte_mask); + z_iihf(mask, twobyte_mask<<16 | twobyte_mask); + + bind(unrolledLoop); + z_lmg(Z_R0, Z_R1, 0, pos); + z_ogr(Z_R0, Z_R1); + z_ngr(Z_R0, mask); + z_brne(unrolledDone); // There is a negative byte somewhere. + // ctr and pos are not updated yet -> + // delegate finding correct pos to byteLoop. + add2reg(pos, unroll_factor); + z_brct(ctr, unrolledLoop); + + // Once we arrive here, we have to examine at most (unroll_factor - 1) bytes more. + // We then either have reached the end of the array or we hit a negative byte. + bind(unrolledDone); + z_sll(ctr, log_unroll_factor); // calculate # bytes not processed by unrolled loop + // > 0 only if a negative byte was found + z_lr(Z_R0, cnt); // calculate remainder bytes + z_nilf(Z_R0, unroll_factor - 1); + z_ar(ctr, Z_R0); // remaining bytes + z_brnh(allDone); // shortcut if nothing left to do + + bind(byteLoop); + z_cli(0, pos, byte_mask); // unsigned comparison! byte@pos must be smaller that byte_mask + z_brnl(allDone); // negative byte found. + + add2reg(pos, 1); + z_brct(ctr, byteLoop); + + bind(allDone); + + z_srk(ctr, cnt, ctr); // # bytes actually processed (= cnt or index of first negative byte) + z_sgfr(pos, ctr); // restore src + z_lgfr(result, ctr); // unnecessary. Only there to be sure the high word has a defined state. + + BLOCK_COMMENT("} count_positives"); return offset() - block_start; } diff --git a/src/hotspot/cpu/s390/c2_MacroAssembler_s390.hpp b/src/hotspot/cpu/s390/c2_MacroAssembler_s390.hpp index a6c98656495..a502e41ee08 100644 --- a/src/hotspot/cpu/s390/c2_MacroAssembler_s390.hpp +++ b/src/hotspot/cpu/s390/c2_MacroAssembler_s390.hpp @@ -57,9 +57,7 @@ // len is signed int. Counts # characters, not bytes. unsigned int string_inflate_const(Register src, Register dst, Register tmp, int len); - // Kills src. - unsigned int has_negatives(Register result, Register src, Register cnt, - Register odd_reg, Register even_reg, Register tmp); + unsigned int count_positives(Register result, Register src, Register cnt, Register tmp); unsigned int string_compare(Register str1, Register str2, Register cnt1, Register cnt2, Register odd_reg, Register even_reg, Register result, int ae); diff --git a/src/hotspot/cpu/s390/s390.ad b/src/hotspot/cpu/s390/s390.ad index 74ad8ef40d3..d13afd1c8b4 100644 --- a/src/hotspot/cpu/s390/s390.ad +++ b/src/hotspot/cpu/s390/s390.ad @@ -10273,14 +10273,13 @@ instruct string_inflate_const(Universe dummy, iRegP src, iRegP dst, iRegI tmp, i %} // StringCoding.java intrinsics -instruct has_negatives(rarg5RegP ary1, iRegI len, iRegI result, roddRegI oddReg, revenRegI evenReg, iRegI tmp, flagsReg cr) %{ - match(Set result (HasNegatives ary1 len)); - effect(TEMP_DEF result, USE_KILL ary1, TEMP oddReg, TEMP evenReg, TEMP tmp, KILL cr); // R0, R1 are killed, too. +instruct count_positives(iRegP ary1, iRegI len, iRegI result, iRegI tmp, flagsReg cr) %{ + match(Set result (CountPositives ary1 len)); + effect(TEMP_DEF result, TEMP tmp, KILL cr); // R0, R1 are killed, too. ins_cost(300); - format %{ "has negatives byte[] $ary1($len) -> $result" %} + format %{ "count positives byte[] $ary1($len) -> $result" %} ins_encode %{ - __ has_negatives($result$$Register, $ary1$$Register, $len$$Register, - $oddReg$$Register, $evenReg$$Register, $tmp$$Register); + __ count_positives($result$$Register, $ary1$$Register, $len$$Register, $tmp$$Register); %} ins_pipe(pipe_class_dummy); %} diff --git a/src/hotspot/cpu/x86/c2_MacroAssembler_x86.cpp b/src/hotspot/cpu/x86/c2_MacroAssembler_x86.cpp index f3f684b1b25..6d8b9101303 100644 --- a/src/hotspot/cpu/x86/c2_MacroAssembler_x86.cpp +++ b/src/hotspot/cpu/x86/c2_MacroAssembler_x86.cpp @@ -3374,18 +3374,19 @@ void C2_MacroAssembler::string_compare(Register str1, Register str2, } // Search for Non-ASCII character (Negative byte value) in a byte array, -// return true if it has any and false otherwise. +// return the index of the first such character, otherwise the length +// of the array segment searched. // ..\jdk\src\java.base\share\classes\java\lang\StringCoding.java // @IntrinsicCandidate -// private static boolean hasNegatives(byte[] ba, int off, int len) { +// public static int countPositives(byte[] ba, int off, int len) { // for (int i = off; i < off + len; i++) { // if (ba[i] < 0) { -// return true; +// return i - off; // } // } -// return false; +// return len; // } -void C2_MacroAssembler::has_negatives(Register ary1, Register len, +void C2_MacroAssembler::count_positives(Register ary1, Register len, Register result, Register tmp1, XMMRegister vec1, XMMRegister vec2, KRegister mask1, KRegister mask2) { // rsi: byte array @@ -3394,17 +3395,18 @@ void C2_MacroAssembler::has_negatives(Register ary1, Register len, ShortBranchVerifier sbv(this); assert_different_registers(ary1, len, result, tmp1); assert_different_registers(vec1, vec2); - Label TRUE_LABEL, FALSE_LABEL, DONE, COMPARE_CHAR, COMPARE_VECTORS, COMPARE_BYTE; + Label ADJUST, TAIL_ADJUST, DONE, TAIL_START, CHAR_ADJUST, COMPARE_CHAR, COMPARE_VECTORS, COMPARE_BYTE; + movl(result, len); // copy // len == 0 testl(len, len); - jcc(Assembler::zero, FALSE_LABEL); + jcc(Assembler::zero, DONE); if ((AVX3Threshold == 0) && (UseAVX > 2) && // AVX512 VM_Version::supports_avx512vlbw() && VM_Version::supports_bmi2()) { - Label test_64_loop, test_tail; + Label test_64_loop, test_tail, BREAK_LOOP; Register tmp3_aliased = len; movl(tmp1, len); @@ -3421,16 +3423,15 @@ void C2_MacroAssembler::has_negatives(Register ary1, Register len, // Check whether our 64 elements of size byte contain negatives evpcmpgtb(mask1, vec2, Address(ary1, len, Address::times_1), Assembler::AVX_512bit); kortestql(mask1, mask1); - jcc(Assembler::notZero, TRUE_LABEL); + jcc(Assembler::notZero, BREAK_LOOP); addptr(len, 64); jccb(Assembler::notZero, test_64_loop); - bind(test_tail); // bail out when there is nothing to be done testl(tmp1, -1); - jcc(Assembler::zero, FALSE_LABEL); + jcc(Assembler::zero, DONE); // ~(~0 << len) applied up to two times (for 32-bit scenario) #ifdef _LP64 @@ -3467,21 +3468,30 @@ void C2_MacroAssembler::has_negatives(Register ary1, Register len, #endif evpcmpgtb(mask1, mask2, vec2, Address(ary1, 0), Assembler::AVX_512bit); ktestq(mask1, mask2); - jcc(Assembler::notZero, TRUE_LABEL); + jcc(Assembler::zero, DONE); - jmp(FALSE_LABEL); + bind(BREAK_LOOP); + // At least one byte in the last 64 bytes is negative. + // Set up to look at the last 64 bytes as if they were a tail + lea(ary1, Address(ary1, len, Address::times_1)); + addptr(result, len); + // Ignore the very last byte: if all others are positive, + // it must be negative, so we can skip right to the 2+1 byte + // end comparison at this point + orl(result, 63); + movl(len, 63); + // Fallthru to tail compare } else { - movl(result, len); // copy if (UseAVX >= 2 && UseSSE >= 2) { // With AVX2, use 32-byte vector compare - Label COMPARE_WIDE_VECTORS, COMPARE_TAIL; + Label COMPARE_WIDE_VECTORS, BREAK_LOOP; // Compare 32-byte vectors - andl(result, 0x0000001f); // tail count (in bytes) - andl(len, 0xffffffe0); // vector count (in bytes) - jccb(Assembler::zero, COMPARE_TAIL); + testl(len, 0xffffffe0); // vector count (in bytes) + jccb(Assembler::zero, TAIL_START); + andl(len, 0xffffffe0); lea(ary1, Address(ary1, len, Address::times_1)); negptr(len); @@ -3492,30 +3502,42 @@ void C2_MacroAssembler::has_negatives(Register ary1, Register len, bind(COMPARE_WIDE_VECTORS); vmovdqu(vec1, Address(ary1, len, Address::times_1)); vptest(vec1, vec2); - jccb(Assembler::notZero, TRUE_LABEL); + jccb(Assembler::notZero, BREAK_LOOP); addptr(len, 32); - jcc(Assembler::notZero, COMPARE_WIDE_VECTORS); + jccb(Assembler::notZero, COMPARE_WIDE_VECTORS); - testl(result, result); - jccb(Assembler::zero, FALSE_LABEL); + testl(result, 0x0000001f); // any bytes remaining? + jcc(Assembler::zero, DONE); - vmovdqu(vec1, Address(ary1, result, Address::times_1, -32)); + // Quick test using the already prepared vector mask + movl(len, result); + andl(len, 0x0000001f); + vmovdqu(vec1, Address(ary1, len, Address::times_1, -32)); vptest(vec1, vec2); - jccb(Assembler::notZero, TRUE_LABEL); - jmpb(FALSE_LABEL); + jcc(Assembler::zero, DONE); + // There are zeros, jump to the tail to determine exactly where + jmpb(TAIL_START); - bind(COMPARE_TAIL); // len is zero - movl(len, result); + bind(BREAK_LOOP); + // At least one byte in the last 32-byte vector is negative. + // Set up to look at the last 32 bytes as if they were a tail + lea(ary1, Address(ary1, len, Address::times_1)); + addptr(result, len); + // Ignore the very last byte: if all others are positive, + // it must be negative, so we can skip right to the 2+1 byte + // end comparison at this point + orl(result, 31); + movl(len, 31); // Fallthru to tail compare } else if (UseSSE42Intrinsics) { // With SSE4.2, use double quad vector compare - Label COMPARE_WIDE_VECTORS, COMPARE_TAIL; + Label COMPARE_WIDE_VECTORS, BREAK_LOOP; // Compare 16-byte vectors - andl(result, 0x0000000f); // tail count (in bytes) - andl(len, 0xfffffff0); // vector count (in bytes) - jcc(Assembler::zero, COMPARE_TAIL); + testl(len, 0xfffffff0); // vector count (in bytes) + jcc(Assembler::zero, TAIL_START); + andl(len, 0xfffffff0); lea(ary1, Address(ary1, len, Address::times_1)); negptr(len); @@ -3526,23 +3548,36 @@ void C2_MacroAssembler::has_negatives(Register ary1, Register len, bind(COMPARE_WIDE_VECTORS); movdqu(vec1, Address(ary1, len, Address::times_1)); ptest(vec1, vec2); - jcc(Assembler::notZero, TRUE_LABEL); + jccb(Assembler::notZero, BREAK_LOOP); addptr(len, 16); - jcc(Assembler::notZero, COMPARE_WIDE_VECTORS); + jccb(Assembler::notZero, COMPARE_WIDE_VECTORS); - testl(result, result); - jcc(Assembler::zero, FALSE_LABEL); + testl(result, 0x0000000f); // len is zero, any bytes remaining? + jcc(Assembler::zero, DONE); - movdqu(vec1, Address(ary1, result, Address::times_1, -16)); + // Quick test using the already prepared vector mask + movl(len, result); + andl(len, 0x0000000f); // tail count (in bytes) + movdqu(vec1, Address(ary1, len, Address::times_1, -16)); ptest(vec1, vec2); - jccb(Assembler::notZero, TRUE_LABEL); - jmpb(FALSE_LABEL); + jcc(Assembler::zero, DONE); + jmpb(TAIL_START); - bind(COMPARE_TAIL); // len is zero - movl(len, result); + bind(BREAK_LOOP); + // At least one byte in the last 16-byte vector is negative. + // Set up and look at the last 16 bytes as if they were a tail + lea(ary1, Address(ary1, len, Address::times_1)); + addptr(result, len); + // Ignore the very last byte: if all others are positive, + // it must be negative, so we can skip right to the 2+1 byte + // end comparison at this point + orl(result, 15); + movl(len, 15); // Fallthru to tail compare } } + + bind(TAIL_START); // Compare 4-byte vectors andl(len, 0xfffffffc); // vector count (in bytes) jccb(Assembler::zero, COMPARE_CHAR); @@ -3553,34 +3588,45 @@ void C2_MacroAssembler::has_negatives(Register ary1, Register len, bind(COMPARE_VECTORS); movl(tmp1, Address(ary1, len, Address::times_1)); andl(tmp1, 0x80808080); - jccb(Assembler::notZero, TRUE_LABEL); + jccb(Assembler::notZero, TAIL_ADJUST); addptr(len, 4); - jcc(Assembler::notZero, COMPARE_VECTORS); + jccb(Assembler::notZero, COMPARE_VECTORS); - // Compare trailing char (final 2 bytes), if any + // Compare trailing char (final 2-3 bytes), if any bind(COMPARE_CHAR); + testl(result, 0x2); // tail char jccb(Assembler::zero, COMPARE_BYTE); load_unsigned_short(tmp1, Address(ary1, 0)); andl(tmp1, 0x00008080); - jccb(Assembler::notZero, TRUE_LABEL); - subptr(result, 2); + jccb(Assembler::notZero, CHAR_ADJUST); lea(ary1, Address(ary1, 2)); bind(COMPARE_BYTE); testl(result, 0x1); // tail byte - jccb(Assembler::zero, FALSE_LABEL); + jccb(Assembler::zero, DONE); load_unsigned_byte(tmp1, Address(ary1, 0)); - andl(tmp1, 0x00000080); - jccb(Assembler::notEqual, TRUE_LABEL); - jmpb(FALSE_LABEL); - - bind(TRUE_LABEL); - movl(result, 1); // return true + testl(tmp1, 0x00000080); + jccb(Assembler::zero, DONE); + subptr(result, 1); jmpb(DONE); - bind(FALSE_LABEL); - xorl(result, result); // return false + bind(TAIL_ADJUST); + // there are negative bits in the last 4 byte block. + // Adjust result and check the next three bytes + addptr(result, len); + orl(result, 3); + lea(ary1, Address(ary1, len, Address::times_1)); + jmpb(COMPARE_CHAR); + + bind(CHAR_ADJUST); + // We are looking at a char + optional byte tail, and found that one + // of the bytes in the char is negative. Adjust the result, check the + // first byte and readjust if needed. + andl(result, 0xfffffffc); + testl(tmp1, 0x00000080); // little-endian, so lowest byte comes first + jccb(Assembler::notZero, DONE); + addptr(result, 1); // That's it bind(DONE); @@ -3590,6 +3636,7 @@ void C2_MacroAssembler::has_negatives(Register ary1, Register len, vpxor(vec2, vec2); } } + // Compare char[] or byte[] arrays aligned to 4 bytes or substrings. void C2_MacroAssembler::arrays_equals(bool is_array_equ, Register ary1, Register ary2, Register limit, Register result, Register chr, diff --git a/src/hotspot/cpu/x86/c2_MacroAssembler_x86.hpp b/src/hotspot/cpu/x86/c2_MacroAssembler_x86.hpp index 0464d755ed4..5ecdf20700d 100644 --- a/src/hotspot/cpu/x86/c2_MacroAssembler_x86.hpp +++ b/src/hotspot/cpu/x86/c2_MacroAssembler_x86.hpp @@ -271,11 +271,10 @@ public: XMMRegister vec1, int ae, KRegister mask = knoreg); // Search for Non-ASCII character (Negative byte value) in a byte array, - // return true if it has any and false otherwise. - void has_negatives(Register ary1, Register len, - Register result, Register tmp1, - XMMRegister vec1, XMMRegister vec2, KRegister mask1 = knoreg, KRegister mask2 = knoreg); - + // return index of the first such character, otherwise len. + void count_positives(Register ary1, Register len, + Register result, Register tmp1, + XMMRegister vec1, XMMRegister vec2, KRegister mask1 = knoreg, KRegister mask2 = knoreg); // Compare char[] or byte[] arrays. void arrays_equals(bool is_array_equ, Register ary1, Register ary2, Register limit, Register result, Register chr, diff --git a/src/hotspot/cpu/x86/x86_32.ad b/src/hotspot/cpu/x86/x86_32.ad index 3bb01e3eeae..9bba150516e 100644 --- a/src/hotspot/cpu/x86/x86_32.ad +++ b/src/hotspot/cpu/x86/x86_32.ad @@ -12122,34 +12122,34 @@ instruct array_equalsC_evex(eDIRegP ary1, eSIRegP ary2, eAXRegI result, ins_pipe( pipe_slow ); %} -instruct has_negatives(eSIRegP ary1, eCXRegI len, eAXRegI result, - regD tmp1, regD tmp2, eBXRegI tmp3, eFlagsReg cr) +instruct count_positives(eSIRegP ary1, eCXRegI len, eAXRegI result, + regD tmp1, regD tmp2, eBXRegI tmp3, eFlagsReg cr) %{ predicate(!VM_Version::supports_avx512vlbw() || !VM_Version::supports_bmi2()); - match(Set result (HasNegatives ary1 len)); + match(Set result (CountPositives ary1 len)); effect(TEMP tmp1, TEMP tmp2, USE_KILL ary1, USE_KILL len, KILL tmp3, KILL cr); - format %{ "has negatives byte[] $ary1,$len -> $result // KILL $tmp1, $tmp2, $tmp3" %} + format %{ "countPositives byte[] $ary1,$len -> $result // KILL $tmp1, $tmp2, $tmp3" %} ins_encode %{ - __ has_negatives($ary1$$Register, $len$$Register, - $result$$Register, $tmp3$$Register, - $tmp1$$XMMRegister, $tmp2$$XMMRegister, knoreg, knoreg); + __ count_positives($ary1$$Register, $len$$Register, + $result$$Register, $tmp3$$Register, + $tmp1$$XMMRegister, $tmp2$$XMMRegister, knoreg, knoreg); %} ins_pipe( pipe_slow ); %} -instruct has_negatives_evex(eSIRegP ary1, eCXRegI len, eAXRegI result, - regD tmp1, regD tmp2, kReg ktmp1, kReg ktmp2, eBXRegI tmp3, eFlagsReg cr) +instruct count_positives_evex(eSIRegP ary1, eCXRegI len, eAXRegI result, + regD tmp1, regD tmp2, kReg ktmp1, kReg ktmp2, eBXRegI tmp3, eFlagsReg cr) %{ predicate(VM_Version::supports_avx512vlbw() && VM_Version::supports_bmi2()); - match(Set result (HasNegatives ary1 len)); + match(Set result (CountPositives ary1 len)); effect(TEMP tmp1, TEMP tmp2, TEMP ktmp1, TEMP ktmp2, USE_KILL ary1, USE_KILL len, KILL tmp3, KILL cr); - format %{ "has negatives byte[] $ary1,$len -> $result // KILL $tmp1, $tmp2, $tmp3" %} + format %{ "countPositives byte[] $ary1,$len -> $result // KILL $tmp1, $tmp2, $tmp3" %} ins_encode %{ - __ has_negatives($ary1$$Register, $len$$Register, - $result$$Register, $tmp3$$Register, - $tmp1$$XMMRegister, $tmp2$$XMMRegister, $ktmp1$$KRegister, $ktmp2$$KRegister); + __ count_positives($ary1$$Register, $len$$Register, + $result$$Register, $tmp3$$Register, + $tmp1$$XMMRegister, $tmp2$$XMMRegister, $ktmp1$$KRegister, $ktmp2$$KRegister); %} ins_pipe( pipe_slow ); %} diff --git a/src/hotspot/cpu/x86/x86_64.ad b/src/hotspot/cpu/x86/x86_64.ad index bc04106f3f2..3eed117ece8 100644 --- a/src/hotspot/cpu/x86/x86_64.ad +++ b/src/hotspot/cpu/x86/x86_64.ad @@ -11685,34 +11685,34 @@ instruct array_equalsC_evex(rdi_RegP ary1, rsi_RegP ary2, rax_RegI result, ins_pipe( pipe_slow ); %} -instruct has_negatives(rsi_RegP ary1, rcx_RegI len, rax_RegI result, - legRegD tmp1, legRegD tmp2, rbx_RegI tmp3, rFlagsReg cr,) +instruct count_positives(rsi_RegP ary1, rcx_RegI len, rax_RegI result, + legRegD tmp1, legRegD tmp2, rbx_RegI tmp3, rFlagsReg cr,) %{ predicate(!VM_Version::supports_avx512vlbw() || !VM_Version::supports_bmi2()); - match(Set result (HasNegatives ary1 len)); + match(Set result (CountPositives ary1 len)); effect(TEMP tmp1, TEMP tmp2, USE_KILL ary1, USE_KILL len, KILL tmp3, KILL cr); - format %{ "has negatives byte[] $ary1,$len -> $result // KILL $tmp1, $tmp2, $tmp3" %} + format %{ "countPositives byte[] $ary1,$len -> $result // KILL $tmp1, $tmp2, $tmp3" %} ins_encode %{ - __ has_negatives($ary1$$Register, $len$$Register, - $result$$Register, $tmp3$$Register, - $tmp1$$XMMRegister, $tmp2$$XMMRegister, knoreg, knoreg); + __ count_positives($ary1$$Register, $len$$Register, + $result$$Register, $tmp3$$Register, + $tmp1$$XMMRegister, $tmp2$$XMMRegister, knoreg, knoreg); %} ins_pipe( pipe_slow ); %} -instruct has_negatives_evex(rsi_RegP ary1, rcx_RegI len, rax_RegI result, - legRegD tmp1, legRegD tmp2, kReg ktmp1, kReg ktmp2, rbx_RegI tmp3, rFlagsReg cr,) +instruct count_positives_evex(rsi_RegP ary1, rcx_RegI len, rax_RegI result, + legRegD tmp1, legRegD tmp2, kReg ktmp1, kReg ktmp2, rbx_RegI tmp3, rFlagsReg cr,) %{ predicate(VM_Version::supports_avx512vlbw() && VM_Version::supports_bmi2()); - match(Set result (HasNegatives ary1 len)); + match(Set result (CountPositives ary1 len)); effect(TEMP tmp1, TEMP tmp2, TEMP ktmp1, TEMP ktmp2, USE_KILL ary1, USE_KILL len, KILL tmp3, KILL cr); - format %{ "has negatives byte[] $ary1,$len -> $result // KILL $tmp1, $tmp2, $tmp3" %} + format %{ "countPositives byte[] $ary1,$len -> $result // KILL $tmp1, $tmp2, $tmp3" %} ins_encode %{ - __ has_negatives($ary1$$Register, $len$$Register, - $result$$Register, $tmp3$$Register, - $tmp1$$XMMRegister, $tmp2$$XMMRegister, $ktmp1$$KRegister, $ktmp2$$KRegister); + __ count_positives($ary1$$Register, $len$$Register, + $result$$Register, $tmp3$$Register, + $tmp1$$XMMRegister, $tmp2$$XMMRegister, $ktmp1$$KRegister, $ktmp2$$KRegister); %} ins_pipe( pipe_slow ); %} diff --git a/src/hotspot/share/adlc/formssel.cpp b/src/hotspot/share/adlc/formssel.cpp index 274e623ea61..0ae7b075074 100644 --- a/src/hotspot/share/adlc/formssel.cpp +++ b/src/hotspot/share/adlc/formssel.cpp @@ -612,7 +612,7 @@ bool InstructForm::needs_anti_dependence_check(FormDict &globals) const { strcmp(_matrule->_rChild->_opType,"StrEquals" )==0 || strcmp(_matrule->_rChild->_opType,"StrIndexOf" )==0 || strcmp(_matrule->_rChild->_opType,"StrIndexOfChar" )==0 || - strcmp(_matrule->_rChild->_opType,"HasNegatives" )==0 || + strcmp(_matrule->_rChild->_opType,"CountPositives" )==0 || strcmp(_matrule->_rChild->_opType,"AryEq" )==0 )) return true; @@ -902,7 +902,7 @@ uint InstructForm::oper_input_base(FormDict &globals) { strcmp(_matrule->_rChild->_opType,"StrCompressedCopy" )==0 || strcmp(_matrule->_rChild->_opType,"StrIndexOf")==0 || strcmp(_matrule->_rChild->_opType,"StrIndexOfChar")==0 || - strcmp(_matrule->_rChild->_opType,"HasNegatives")==0 || + strcmp(_matrule->_rChild->_opType,"CountPositives")==0 || strcmp(_matrule->_rChild->_opType,"EncodeISOArray")==0)) { // String.(compareTo/equals/indexOf) and Arrays.equals // and sun.nio.cs.iso8859_1$Encoder.EncodeISOArray diff --git a/src/hotspot/share/classfile/vmIntrinsics.cpp b/src/hotspot/share/classfile/vmIntrinsics.cpp index cc3dc1ebdcc..a329669bed3 100644 --- a/src/hotspot/share/classfile/vmIntrinsics.cpp +++ b/src/hotspot/share/classfile/vmIntrinsics.cpp @@ -229,7 +229,7 @@ bool vmIntrinsics::disabled_by_jvm_flags(vmIntrinsics::ID id) { case vmIntrinsics::_loadFence: case vmIntrinsics::_storeFence: case vmIntrinsics::_fullFence: - case vmIntrinsics::_hasNegatives: + case vmIntrinsics::_countPositives: case vmIntrinsics::_Reference_get: break; default: diff --git a/src/hotspot/share/classfile/vmIntrinsics.hpp b/src/hotspot/share/classfile/vmIntrinsics.hpp index 7c3cb1d3f10..5b2c6a9ce56 100644 --- a/src/hotspot/share/classfile/vmIntrinsics.hpp +++ b/src/hotspot/share/classfile/vmIntrinsics.hpp @@ -354,9 +354,9 @@ class methodHandle; do_signature(Preconditions_checkLongIndex_signature, "(JJLjava/util/function/BiFunction;)J") \ \ do_class(java_lang_StringCoding, "java/lang/StringCoding") \ - do_intrinsic(_hasNegatives, java_lang_StringCoding, hasNegatives_name, hasNegatives_signature, F_S) \ - do_name( hasNegatives_name, "hasNegatives") \ - do_signature(hasNegatives_signature, "([BII)Z") \ + do_intrinsic(_countPositives, java_lang_StringCoding, countPositives_name, countPositives_signature, F_S) \ + do_name( countPositives_name, "countPositives") \ + do_signature(countPositives_signature, "([BII)I") \ \ do_class(sun_nio_cs_iso8859_1_Encoder, "sun/nio/cs/ISO_8859_1$Encoder") \ do_intrinsic(_encodeISOArray, sun_nio_cs_iso8859_1_Encoder, encodeISOArray_name, encodeISOArray_signature, F_S) \ @@ -459,9 +459,8 @@ class methodHandle; \ /* support for sun.security.provider.DigestBase */ \ do_class(sun_security_provider_digestbase, "sun/security/provider/DigestBase") \ - do_intrinsic(_digestBase_implCompressMB, sun_security_provider_digestbase, implCompressMB_name, implCompressMB_signature, F_R) \ + do_intrinsic(_digestBase_implCompressMB, sun_security_provider_digestbase, implCompressMB_name, countPositives_signature, F_R) \ do_name( implCompressMB_name, "implCompressMultiBlock0") \ - do_signature(implCompressMB_signature, "([BII)I") \ \ /* support for java.util.Base64.Encoder*/ \ do_class(java_util_Base64_Encoder, "java/util/Base64$Encoder") \ diff --git a/src/hotspot/share/gc/shenandoah/c2/shenandoahSupport.cpp b/src/hotspot/share/gc/shenandoah/c2/shenandoahSupport.cpp index 849b40f3d79..667808f4efd 100644 --- a/src/hotspot/share/gc/shenandoah/c2/shenandoahSupport.cpp +++ b/src/hotspot/share/gc/shenandoah/c2/shenandoahSupport.cpp @@ -567,7 +567,7 @@ void ShenandoahBarrierC2Support::verify(RootNode* root) { { { 2, ShenandoahLoad }, { 3, ShenandoahLoad } }, Op_EncodeISOArray, { { 2, ShenandoahLoad }, { 3, ShenandoahStore } }, - Op_HasNegatives, + Op_CountPositives, { { 2, ShenandoahLoad }, { -1, ShenandoahNone} }, Op_CastP2X, { { 1, ShenandoahLoad }, { -1, ShenandoahNone} }, diff --git a/src/hotspot/share/jvmci/vmStructs_jvmci.cpp b/src/hotspot/share/jvmci/vmStructs_jvmci.cpp index 998f1d1ad4f..7ed48a79eeb 100644 --- a/src/hotspot/share/jvmci/vmStructs_jvmci.cpp +++ b/src/hotspot/share/jvmci/vmStructs_jvmci.cpp @@ -742,8 +742,8 @@ #define VM_STRUCTS_CPU(nonstatic_field, static_field, unchecked_nonstatic_field, volatile_nonstatic_field, nonproduct_nonstatic_field, c2_nonstatic_field, unchecked_c1_static_field, unchecked_c2_static_field) \ static_field(VM_Version, _zva_length, int) \ - static_field(StubRoutines::aarch64, _has_negatives, address) \ - static_field(StubRoutines::aarch64, _has_negatives_long, address) \ + static_field(StubRoutines::aarch64, _count_positives, address) \ + static_field(StubRoutines::aarch64, _count_positives_long, address) \ static_field(VM_Version, _rop_protection, bool) \ volatile_nonstatic_field(JavaFrameAnchor, _last_Java_fp, intptr_t*) diff --git a/src/hotspot/share/opto/c2compiler.cpp b/src/hotspot/share/opto/c2compiler.cpp index af2b8e5456c..94e7fb4f4a0 100644 --- a/src/hotspot/share/opto/c2compiler.cpp +++ b/src/hotspot/share/opto/c2compiler.cpp @@ -234,8 +234,8 @@ bool C2Compiler::is_intrinsic_supported(const methodHandle& method, bool is_virt case vmIntrinsics::_encodeByteISOArray: if (!Matcher::match_rule_supported(Op_EncodeISOArray)) return false; break; - case vmIntrinsics::_hasNegatives: - if (!Matcher::match_rule_supported(Op_HasNegatives)) return false; + case vmIntrinsics::_countPositives: + if (!Matcher::match_rule_supported(Op_CountPositives)) return false; break; case vmIntrinsics::_bitCount_i: if (!Matcher::match_rule_supported(Op_PopCountI)) return false; diff --git a/src/hotspot/share/opto/classes.hpp b/src/hotspot/share/opto/classes.hpp index 4abb3fef3b4..35dd640b4ee 100644 --- a/src/hotspot/share/opto/classes.hpp +++ b/src/hotspot/share/opto/classes.hpp @@ -174,7 +174,7 @@ macro(FmaD) macro(FmaF) macro(Goto) macro(Halt) -macro(HasNegatives) +macro(CountPositives) macro(If) macro(RangeCheck) macro(IfFalse) diff --git a/src/hotspot/share/opto/escape.cpp b/src/hotspot/share/opto/escape.cpp index d9df238aff4..3e02b18f50f 100644 --- a/src/hotspot/share/opto/escape.cpp +++ b/src/hotspot/share/opto/escape.cpp @@ -635,7 +635,7 @@ void ConnectionGraph::add_node_to_connection_graph(Node *n, Unique_Node_List *de break; } case Op_AryEq: - case Op_HasNegatives: + case Op_CountPositives: case Op_StrComp: case Op_StrEquals: case Op_StrIndexOf: @@ -773,7 +773,7 @@ void ConnectionGraph::add_final_edges(Node *n) { break; } case Op_AryEq: - case Op_HasNegatives: + case Op_CountPositives: case Op_StrComp: case Op_StrEquals: case Op_StrIndexOf: @@ -3344,7 +3344,8 @@ void ConnectionGraph::split_unique_types(GrowableArray &alloc_worklist, memnode_worklist.append_if_missing(use); } else if (!(op == Op_CmpP || op == Op_Conv2B || op == Op_CastP2X || op == Op_StoreCM || - op == Op_FastLock || op == Op_AryEq || op == Op_StrComp || op == Op_HasNegatives || + op == Op_FastLock || op == Op_AryEq || op == Op_StrComp || + op == Op_CountPositives || op == Op_StrCompressedCopy || op == Op_StrInflatedCopy || op == Op_StrEquals || op == Op_StrIndexOf || op == Op_StrIndexOfChar || op == Op_SubTypeCheck || @@ -3475,7 +3476,7 @@ void ConnectionGraph::split_unique_types(GrowableArray &alloc_worklist, // They overwrite memory edge corresponding to destination array, memnode_worklist.append_if_missing(use); } else if (!(BarrierSet::barrier_set()->barrier_set_c2()->is_gc_barrier_node(use) || - op == Op_AryEq || op == Op_StrComp || op == Op_HasNegatives || + op == Op_AryEq || op == Op_StrComp || op == Op_CountPositives || op == Op_StrCompressedCopy || op == Op_StrInflatedCopy || op == Op_StrEquals || op == Op_StrIndexOf || op == Op_StrIndexOfChar)) { n->dump(); diff --git a/src/hotspot/share/opto/intrinsicnode.hpp b/src/hotspot/share/opto/intrinsicnode.hpp index ab8a834bb28..477842869c3 100644 --- a/src/hotspot/share/opto/intrinsicnode.hpp +++ b/src/hotspot/share/opto/intrinsicnode.hpp @@ -157,13 +157,13 @@ class AryEqNode: public StrIntrinsicNode { virtual const Type* bottom_type() const { return TypeInt::BOOL; } }; -//------------------------------HasNegatives--------------------------------- -class HasNegativesNode: public StrIntrinsicNode { +//------------------------------CountPositives------------------------------ +class CountPositivesNode: public StrIntrinsicNode { public: - HasNegativesNode(Node* control, Node* char_array_mem, Node* s1, Node* c1): + CountPositivesNode(Node* control, Node* char_array_mem, Node* s1, Node* c1): StrIntrinsicNode(control, char_array_mem, s1, c1, none) {}; virtual int Opcode() const; - virtual const Type* bottom_type() const { return TypeInt::BOOL; } + virtual const Type* bottom_type() const { return TypeInt::POS; } }; diff --git a/src/hotspot/share/opto/lcm.cpp b/src/hotspot/share/opto/lcm.cpp index fe799dd9847..97740e90a29 100644 --- a/src/hotspot/share/opto/lcm.cpp +++ b/src/hotspot/share/opto/lcm.cpp @@ -203,7 +203,7 @@ void PhaseCFG::implicit_null_check(Block* block, Node *proj, Node *val, int allo case Op_StrInflatedCopy: case Op_StrCompressedCopy: case Op_EncodeISOArray: - case Op_HasNegatives: + case Op_CountPositives: // Not a legit memory op for implicit null check regardless of // embedded loads continue; diff --git a/src/hotspot/share/opto/library_call.cpp b/src/hotspot/share/opto/library_call.cpp index f5c19d8123c..2f7c7fdc84c 100644 --- a/src/hotspot/share/opto/library_call.cpp +++ b/src/hotspot/share/opto/library_call.cpp @@ -617,8 +617,8 @@ bool LibraryCallKit::try_to_inline(int predicate) { case vmIntrinsics::_isCompileConstant: return inline_isCompileConstant(); - case vmIntrinsics::_hasNegatives: - return inline_hasNegatives(); + case vmIntrinsics::_countPositives: + return inline_countPositives(); case vmIntrinsics::_fmaD: case vmIntrinsics::_fmaF: @@ -1011,13 +1011,13 @@ bool LibraryCallKit::inline_array_equals(StrIntrinsicNode::ArgEnc ae) { return true; } -//------------------------------inline_hasNegatives------------------------------ -bool LibraryCallKit::inline_hasNegatives() { +//------------------------------inline_countPositives------------------------------ +bool LibraryCallKit::inline_countPositives() { if (too_many_traps(Deoptimization::Reason_intrinsic)) { return false; } - assert(callee()->signature()->size() == 3, "hasNegatives has 3 parameters"); + assert(callee()->signature()->size() == 3, "countPositives has 3 parameters"); // no receiver since it is static method Node* ba = argument(0); Node* offset = argument(1); @@ -1031,7 +1031,7 @@ bool LibraryCallKit::inline_hasNegatives() { return true; } Node* ba_start = array_element_address(ba, offset, T_BYTE); - Node* result = new HasNegativesNode(control(), memory(TypeAryPtr::BYTES), ba_start, len); + Node* result = new CountPositivesNode(control(), memory(TypeAryPtr::BYTES), ba_start, len); set_result(_gvn.transform(result)); return true; } diff --git a/src/hotspot/share/opto/library_call.hpp b/src/hotspot/share/opto/library_call.hpp index eca3e70bb5a..d8f86233d6b 100644 --- a/src/hotspot/share/opto/library_call.hpp +++ b/src/hotspot/share/opto/library_call.hpp @@ -296,7 +296,7 @@ class LibraryCallKit : public GraphKit { bool inline_updateBytesAdler32(); bool inline_updateByteBufferAdler32(); bool inline_multiplyToLen(); - bool inline_hasNegatives(); + bool inline_countPositives(); bool inline_squareToLen(); bool inline_mulAdd(); bool inline_montgomeryMultiply(); diff --git a/src/hotspot/share/opto/loopTransform.cpp b/src/hotspot/share/opto/loopTransform.cpp index dccf75c0022..4257b0fd6e5 100644 --- a/src/hotspot/share/opto/loopTransform.cpp +++ b/src/hotspot/share/opto/loopTransform.cpp @@ -828,7 +828,7 @@ bool IdealLoopTree::policy_maximally_unroll(PhaseIdealLoop* phase) const { case Op_StrIndexOfChar: case Op_EncodeISOArray: case Op_AryEq: - case Op_HasNegatives: { + case Op_CountPositives: { return false; } #if INCLUDE_RTM_OPT @@ -981,7 +981,7 @@ bool IdealLoopTree::policy_unroll(PhaseIdealLoop *phase) { case Op_StrIndexOfChar: case Op_EncodeISOArray: case Op_AryEq: - case Op_HasNegatives: { + case Op_CountPositives: { // Do not unroll a loop with String intrinsics code. // String intrinsics are large and have loops. return false; diff --git a/src/hotspot/share/opto/loopnode.cpp b/src/hotspot/share/opto/loopnode.cpp index 39c6ad49563..f08b1d46b1c 100644 --- a/src/hotspot/share/opto/loopnode.cpp +++ b/src/hotspot/share/opto/loopnode.cpp @@ -5775,7 +5775,7 @@ void PhaseIdealLoop::build_loop_late_post_work(Node *n, bool pinned) { case Op_StrIndexOf: case Op_StrIndexOfChar: case Op_AryEq: - case Op_HasNegatives: + case Op_CountPositives: pinned = false; } if (n->is_CMove() || n->is_ConstraintCast()) { diff --git a/src/hotspot/share/opto/matcher.cpp b/src/hotspot/share/opto/matcher.cpp index 35ccf26e7cb..20a08e0cb4b 100644 --- a/src/hotspot/share/opto/matcher.cpp +++ b/src/hotspot/share/opto/matcher.cpp @@ -1066,7 +1066,7 @@ static void match_alias_type(Compile* C, Node* n, Node* m) { case Op_StrIndexOf: case Op_StrIndexOfChar: case Op_AryEq: - case Op_HasNegatives: + case Op_CountPositives: case Op_MemBarVolatile: case Op_MemBarCPUOrder: // %%% these ideals should have narrower adr_type? case Op_StrInflatedCopy: @@ -2252,7 +2252,7 @@ bool Matcher::find_shared_visit(MStack& mstack, Node* n, uint opcode, bool& mem_ case Op_StrIndexOf: case Op_StrIndexOfChar: case Op_AryEq: - case Op_HasNegatives: + case Op_CountPositives: case Op_StrInflatedCopy: case Op_StrCompressedCopy: case Op_EncodeISOArray: diff --git a/src/java.base/share/classes/java/lang/String.java b/src/java.base/share/classes/java/lang/String.java index e79884bd4cc..3c3a2ba28f0 100644 --- a/src/java.base/share/classes/java/lang/String.java +++ b/src/java.base/share/classes/java/lang/String.java @@ -525,56 +525,63 @@ public final class String this.value = "".value; this.coder = "".coder; } else if (charset == UTF_8.INSTANCE) { - if (COMPACT_STRINGS && !StringCoding.hasNegatives(bytes, offset, length)) { - this.value = Arrays.copyOfRange(bytes, offset, offset + length); - this.coder = LATIN1; - } else { + if (COMPACT_STRINGS) { + int dp = StringCoding.countPositives(bytes, offset, length); + if (dp == length) { + this.value = Arrays.copyOfRange(bytes, offset, offset + length); + this.coder = LATIN1; + return; + } int sl = offset + length; - int dp = 0; - byte[] dst = null; - if (COMPACT_STRINGS) { - dst = new byte[length]; - while (offset < sl) { - int b1 = bytes[offset]; - if (b1 >= 0) { - dst[dp++] = (byte)b1; + byte[] dst = new byte[length]; + if (dp > 0) { + System.arraycopy(bytes, offset, dst, 0, dp); + offset += dp; + } + while (offset < sl) { + int b1 = bytes[offset++]; + if (b1 >= 0) { + dst[dp++] = (byte)b1; + continue; + } + if ((b1 & 0xfe) == 0xc2 && offset < sl) { // b1 either 0xc2 or 0xc3 + int b2 = bytes[offset]; + if (b2 < -64) { // continuation bytes are always negative values in the range -128 to -65 + dst[dp++] = (byte)decode2(b1, b2); offset++; continue; } - if ((b1 & 0xfe) == 0xc2 && offset + 1 < sl) { // b1 either 0xc2 or 0xc3 - int b2 = bytes[offset + 1]; - if (!isNotContinuation(b2)) { - dst[dp++] = (byte)decode2(b1, b2); - offset += 2; - continue; - } - } - // anything not a latin1, including the repl - // we have to go with the utf16 - break; - } - if (offset == sl) { - if (dp != dst.length) { - dst = Arrays.copyOf(dst, dp); - } - this.value = dst; - this.coder = LATIN1; - return; } + // anything not a latin1, including the REPL + // we have to go with the utf16 + offset--; + break; } - if (dp == 0 || dst == null) { - dst = new byte[length << 1]; - } else { - byte[] buf = new byte[length << 1]; - StringLatin1.inflate(dst, 0, buf, 0, dp); - dst = buf; + if (offset == sl) { + if (dp != dst.length) { + dst = Arrays.copyOf(dst, dp); + } + this.value = dst; + this.coder = LATIN1; + return; } + byte[] buf = new byte[length << 1]; + StringLatin1.inflate(dst, 0, buf, 0, dp); + dst = buf; dp = decodeUTF8_UTF16(bytes, offset, sl, dst, dp, true); if (dp != length) { dst = Arrays.copyOf(dst, dp << 1); } this.value = dst; this.coder = UTF16; + } else { // !COMPACT_STRINGS + byte[] dst = new byte[length << 1]; + int dp = decodeUTF8_UTF16(bytes, offset, offset + length, dst, 0, true); + if (dp != length) { + dst = Arrays.copyOf(dst, dp << 1); + } + this.value = dst; + this.coder = UTF16; } } else if (charset == ISO_8859_1.INSTANCE) { if (COMPACT_STRINGS) { @@ -682,41 +689,43 @@ public final class String if (length == 0) { return ""; } - if (COMPACT_STRINGS && !StringCoding.hasNegatives(bytes, offset, length)) { - return new String(Arrays.copyOfRange(bytes, offset, offset + length), LATIN1); - } else { + int dp; + byte[] dst; + if (COMPACT_STRINGS) { + dp = StringCoding.countPositives(bytes, offset, length); int sl = offset + length; - int dp = 0; - byte[] dst = null; - if (COMPACT_STRINGS) { - dst = new byte[length]; - while (offset < sl) { - int b1 = bytes[offset]; - if (b1 >= 0) { - dst[dp++] = (byte) b1; + if (dp == length) { + return new String(Arrays.copyOfRange(bytes, offset, offset + length), LATIN1); + } + dst = new byte[length]; + System.arraycopy(bytes, offset, dst, 0, dp); + offset += dp; + while (offset < sl) { + int b1 = bytes[offset++]; + if (b1 >= 0) { + dst[dp++] = (byte)b1; + continue; + } + if ((b1 & 0xfe) == 0xc2 && offset < sl) { // b1 either 0xc2 or 0xc3 + int b2 = bytes[offset]; + if (b2 < -64) { // continuation bytes are always negative values in the range -128 to -65 + dst[dp++] = (byte)decode2(b1, b2); offset++; continue; } - if ((b1 & 0xfe) == 0xc2 && offset + 1 < sl) { // b1 either 0xc2 or 0xc3 - int b2 = bytes[offset + 1]; - if (!isNotContinuation(b2)) { - dst[dp++] = (byte) decode2(b1, b2); - offset += 2; - continue; - } - } - // anything not a latin1, including the REPL - // we have to go with the utf16 - break; } - if (offset == sl) { - if (dp != dst.length) { - dst = Arrays.copyOf(dst, dp); - } - return new String(dst, LATIN1); + // anything not a latin1, including the REPL + // we have to go with the utf16 + offset--; + break; + } + if (offset == sl) { + if (dp != dst.length) { + dst = Arrays.copyOf(dst, dp); } + return new String(dst, LATIN1); } - if (dp == 0 || dst == null) { + if (dp == 0) { dst = new byte[length << 1]; } else { byte[] buf = new byte[length << 1]; @@ -724,11 +733,14 @@ public final class String dst = buf; } dp = decodeUTF8_UTF16(bytes, offset, sl, dst, dp, false); - if (dp != length) { - dst = Arrays.copyOf(dst, dp << 1); - } - return new String(dst, UTF16); + } else { // !COMPACT_STRINGS + dst = new byte[length << 1]; + dp = decodeUTF8_UTF16(bytes, offset, offset + length, dst, 0, false); } + if (dp != length) { + dst = Arrays.copyOf(dst, dp << 1); + } + return new String(dst, UTF16); } static String newStringNoRepl(byte[] src, Charset cs) throws CharacterCodingException { @@ -1019,17 +1031,9 @@ public final class String */ /* package-private */ static int decodeASCII(byte[] sa, int sp, char[] da, int dp, int len) { - if (!StringCoding.hasNegatives(sa, sp, len)) { - StringLatin1.inflate(sa, sp, da, dp, len); - return len; - } else { - int start = sp; - int end = sp + len; - while (sp < end && sa[sp] >= 0) { - da[dp++] = (char) sa[sp++]; - } - return sp - start; - } + int count = StringCoding.countPositives(sa, sp, len); + StringLatin1.inflate(sa, sp, da, dp, count); + return count; } private static boolean isNotContinuation(int b) { diff --git a/src/java.base/share/classes/java/lang/StringCoding.java b/src/java.base/share/classes/java/lang/StringCoding.java index ec81c379579..293fbdb78dc 100644 --- a/src/java.base/share/classes/java/lang/StringCoding.java +++ b/src/java.base/share/classes/java/lang/StringCoding.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -34,14 +34,27 @@ class StringCoding { private StringCoding() { } - @IntrinsicCandidate public static boolean hasNegatives(byte[] ba, int off, int len) { - for (int i = off; i < off + len; i++) { + return countPositives(ba, off, len) != len; + } + + /** + * Count the number of leading positive bytes in the range. + * + * @implSpec the implementation must return len if there are no negative + * bytes in the range. If there are negative bytes, the implementation must return + * a value that is less than or equal to the index of the first negative byte + * in the range. + */ + @IntrinsicCandidate + public static int countPositives(byte[] ba, int off, int len) { + int limit = off + len; + for (int i = off; i < limit; i++) { if (ba[i] < 0) { - return true; + return i - off; } } - return false; + return len; } @IntrinsicCandidate diff --git a/test/hotspot/jtreg/compiler/intrinsics/string/TestCountPositives.java b/test/hotspot/jtreg/compiler/intrinsics/string/TestCountPositives.java new file mode 100644 index 00000000000..afc308c37dd --- /dev/null +++ b/test/hotspot/jtreg/compiler/intrinsics/string/TestCountPositives.java @@ -0,0 +1,130 @@ +/* + * Copyright (c) 2022, 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 compiler.intrinsics.string; + +/* + * @test + * @bug 8999999 + * @summary Validates StringCoding.countPositives intrinsic with a small range of tests. + * @library /compiler/patches + * + * @build java.base/java.lang.Helper + * @run main compiler.intrinsics.string.TestCountPositives + */ + +public class TestCountPositives { + + private static byte[] tBa = new byte[4096 + 16]; + + /** + * Completely initialize the test array, preparing it for tests of the + * StringCoding.hasNegatives method with a given array segment offset, + * length, and number of negative bytes. + */ + public static void initialize(int off, int len, int neg) { + assert (len + off <= tBa.length); + // insert "canary" (negative) values before offset + for (int i = 0; i < off; ++i) { + tBa[i] = (byte) (((i + 15) & 0x7F) | 0x80); + } + // fill the array segment + for (int i = off; i < len + off; ++i) { + tBa[i] = (byte) (((i - off + 15) & 0x7F)); + } + if (neg != 0) { + // modify a number (neg) disparate array bytes inside + // segment to be negative. + int div = (neg > 1) ? (len - 1) / (neg - 1) : 0; + int idx; + for (int i = 0; i < neg; ++i) { + idx = off + (len - 1) - div * i; + tBa[idx] = (byte) (0x80 | tBa[idx]); + } + } + // insert "canary" negative values after array segment + for (int i = len + off; i < tBa.length; ++i) { + tBa[i] = (byte) (((i + 15) & 0x7F) | 0x80); + } + } + + /** Sizes of array segments to test. */ + private static int sizes[] = { 1, 2, 3, 4, 5, 6, 7, 8, 10, 11, 13, 17, 19, 23, 37, 61, 131, + 4099 }; + + /** + * Test different array segment sizes, offsets, and number of negative + * bytes. + */ + public static void test_countPositives() throws Exception { + int len, off; + int ng; + + for (ng = 0; ng < 57; ++ng) { // number of negatives in array segment + for (off = 0; off < 8; ++off) { // starting offset of array segment + for (int i = 0; i < sizes.length; ++i) { // array segment size + // choice + len = sizes[i]; + if (len + off > tBa.length) + continue; + initialize(off, len, ng); + int calculated = Helper.StringCodingCountPositives(tBa, off, len); + int expected = countPositives(tBa, off, len); + if (calculated != expected) { + if (expected != len && calculated >= 0 && calculated < expected) { + // allow intrinsics to return early with a lower value, + // but only if we're not expecting the full length (no + // negative bytes) + continue; + } + throw new Exception("Failed test countPositives " + "offset: " + off + " " + + "length: " + len + " " + "return: " + calculated + " expected: " + expected + " negatives: " + + ng); + } + } + } + } + } + + private static int countPositives(byte[] ba, int off, int len) { + int limit = off + len; + for (int i = off; i < limit; i++) { + if (ba[i] < 0) { + return i - off; + } + } + return len; + } + + public void run() throws Exception { + // iterate to eventually get intrinsic inlined + for (int j = 0; j < 1000; ++j) { + test_countPositives(); + } + } + + public static void main(String[] args) throws Exception { + (new TestCountPositives()).run(); + System.out.println("countPositives validated"); + } +} diff --git a/test/hotspot/jtreg/compiler/patches/java.base/java/lang/Helper.java b/test/hotspot/jtreg/compiler/patches/java.base/java/lang/Helper.java index ded4a58945d..6d8b5be79bf 100644 --- a/test/hotspot/jtreg/compiler/patches/java.base/java/lang/Helper.java +++ b/test/hotspot/jtreg/compiler/patches/java.base/java/lang/Helper.java @@ -32,6 +32,11 @@ public class Helper { return StringCoding.hasNegatives(ba, off, len); } + @jdk.internal.vm.annotation.ForceInline + public static int StringCodingCountPositives(byte[] ba, int off, int len) { + return StringCoding.countPositives(ba, off, len); + } + @jdk.internal.vm.annotation.ForceInline public static byte[] compressByte(byte[] src, int srcOff, int dstSize, int dstOff, int len) { byte[] dst = new byte[dstSize]; diff --git a/test/micro/org/openjdk/bench/java/lang/StringDecode.java b/test/micro/org/openjdk/bench/java/lang/StringDecode.java index c5609ce4e51..ee4f8df7c73 100644 --- a/test/micro/org/openjdk/bench/java/lang/StringDecode.java +++ b/test/micro/org/openjdk/bench/java/lang/StringDecode.java @@ -87,7 +87,7 @@ public class StringDecode { bh.consume(new String(asciiString, charset)); bh.consume(new String(longAsciiString, 0, 15, charset)); bh.consume(new String(asciiString, 0, 3, charset)); - bh.consume(new String(longAsciiString, 512, 512 + 7, charset)); + bh.consume(new String(longAsciiString, 512, 7, charset)); } @Benchmark @@ -103,7 +103,7 @@ public class StringDecode { bh.consume(new String(latin1String, charset)); bh.consume(new String(latin1String, 0, 15, charset)); bh.consume(new String(latin1String, 0, 3, charset)); - bh.consume(new String(longLatin1OnlyString, 512, 512 + 7, charset)); + bh.consume(new String(longLatin1OnlyString, 512, 7, charset)); } @Benchmark -- GitLab From bad658e8e93c831631d41b6dbf66a0a102cd0462 Mon Sep 17 00:00:00 2001 From: Albert Mingkun Yang Date: Thu, 17 Mar 2022 09:47:51 +0000 Subject: [PATCH 267/340] 8282727: Parallel: Remove PSPromotionManager::_totally_drain Reviewed-by: tschatzl, kbarrett --- src/hotspot/share/gc/parallel/psPromotionManager.cpp | 5 ++--- src/hotspot/share/gc/parallel/psPromotionManager.hpp | 1 - 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/hotspot/share/gc/parallel/psPromotionManager.cpp b/src/hotspot/share/gc/parallel/psPromotionManager.cpp index 9c6b8acf624..652342ae31f 100644 --- a/src/hotspot/share/gc/parallel/psPromotionManager.cpp +++ b/src/hotspot/share/gc/parallel/psPromotionManager.cpp @@ -180,8 +180,7 @@ PSPromotionManager::PSPromotionManager() { uint queue_size; queue_size = claimed_stack_depth()->max_elems(); - _totally_drain = (ParallelGCThreads == 1) || (GCDrainStackTargetSize == 0); - if (_totally_drain) { + if (ParallelGCThreads == 1) { _target_stack_size = 0; } else { // don't let the target stack size to be more than 1/4 of the entries @@ -227,7 +226,7 @@ void PSPromotionManager::restore_preserved_marks() { } void PSPromotionManager::drain_stacks_depth(bool totally_drain) { - totally_drain = totally_drain || _totally_drain; + totally_drain = totally_drain || (_target_stack_size == 0); PSScannerTasksQueue* const tq = claimed_stack_depth(); do { diff --git a/src/hotspot/share/gc/parallel/psPromotionManager.hpp b/src/hotspot/share/gc/parallel/psPromotionManager.hpp index bd48135f134..a1d2b38db31 100644 --- a/src/hotspot/share/gc/parallel/psPromotionManager.hpp +++ b/src/hotspot/share/gc/parallel/psPromotionManager.hpp @@ -83,7 +83,6 @@ class PSPromotionManager { PSScannerTasksQueue _claimed_stack_depth; - bool _totally_drain; uint _target_stack_size; uint _array_chunk_size; -- GitLab From 69e4e338b19c0ffd2f0881be1bbb19a5642bc4d4 Mon Sep 17 00:00:00 2001 From: Doug Simon Date: Thu, 17 Mar 2022 12:51:10 +0000 Subject: [PATCH 268/340] 8283056: show abstract machine code in hs-err for all VM crashes Reviewed-by: thartmann, dholmes --- src/hotspot/share/utilities/vmError.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/hotspot/share/utilities/vmError.cpp b/src/hotspot/share/utilities/vmError.cpp index 1d72092f8ae..89b4645fa45 100644 --- a/src/hotspot/share/utilities/vmError.cpp +++ b/src/hotspot/share/utilities/vmError.cpp @@ -910,7 +910,7 @@ void VMError::report(outputStream* st, bool _verbose) { STEP("printing code blobs if possible") - if (_verbose && _context) { + if (_verbose) { const int printed_capacity = max_error_log_print_code; address printed[printed_capacity]; printed[0] = nullptr; @@ -929,7 +929,8 @@ void VMError::report(outputStream* st, bool _verbose) { printed_len++; } } else { - frame fr = os::fetch_frame_from_context(_context); + frame fr = _context ? os::fetch_frame_from_context(_context) + : os::current_frame(); while (printed_len < limit && fr.pc() != nullptr) { if (print_code(st, _thread, fr.pc(), fr.pc() == _pc, printed, printed_capacity)) { printed_len++; -- GitLab From 0f1766dff633e55532d94069d7266a7fe625286c Mon Sep 17 00:00:00 2001 From: Julian Waters Date: Thu, 17 Mar 2022 15:30:17 +0000 Subject: [PATCH 269/340] 8283320: Error message for Windows libraries always points to --with-msvcr-dll no matter the actual file name Reviewed-by: erikj, ihse --- make/autoconf/toolchain_microsoft.m4 | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/make/autoconf/toolchain_microsoft.m4 b/make/autoconf/toolchain_microsoft.m4 index 2e02c531da7..03d4ae50dfb 100644 --- a/make/autoconf/toolchain_microsoft.m4 +++ b/make/autoconf/toolchain_microsoft.m4 @@ -481,6 +481,7 @@ AC_DEFUN([TOOLCHAIN_CHECK_POSSIBLE_MSVC_DLL], AC_DEFUN([TOOLCHAIN_SETUP_MSVC_DLL], [ DLL_NAME="$1" + DLL_HELP="$2" MSVC_DLL= if test "x$OPENJDK_TARGET_CPU" = xx86; then @@ -565,7 +566,7 @@ AC_DEFUN([TOOLCHAIN_SETUP_MSVC_DLL], if test "x$MSVC_DLL" = x; then AC_MSG_CHECKING([for $DLL_NAME]) AC_MSG_RESULT([no]) - AC_MSG_ERROR([Could not find $DLL_NAME. Please specify using --with-msvcr-dll.]) + AC_MSG_ERROR([Could not find $DLL_NAME. Please specify using ${DLL_HELP}.]) fi ]) @@ -588,7 +589,7 @@ AC_DEFUN([TOOLCHAIN_SETUP_VS_RUNTIME_DLLS], fi MSVCR_DLL="$MSVC_DLL" else - TOOLCHAIN_SETUP_MSVC_DLL([${MSVCR_NAME}]) + TOOLCHAIN_SETUP_MSVC_DLL([${MSVCR_NAME}], [--with-msvcr-dll]) MSVCR_DLL="$MSVC_DLL" fi AC_SUBST(MSVCR_DLL) @@ -611,7 +612,7 @@ AC_DEFUN([TOOLCHAIN_SETUP_VS_RUNTIME_DLLS], fi MSVCP_DLL="$MSVC_DLL" else - TOOLCHAIN_SETUP_MSVC_DLL([${MSVCP_NAME}]) + TOOLCHAIN_SETUP_MSVC_DLL([${MSVCP_NAME}], [--with-msvcp-dll]) MSVCP_DLL="$MSVC_DLL" fi AC_SUBST(MSVCP_DLL) @@ -636,7 +637,7 @@ AC_DEFUN([TOOLCHAIN_SETUP_VS_RUNTIME_DLLS], fi VCRUNTIME_1_DLL="$MSVC_DLL" else - TOOLCHAIN_SETUP_MSVC_DLL([${VCRUNTIME_1_NAME}]) + TOOLCHAIN_SETUP_MSVC_DLL([${VCRUNTIME_1_NAME}], [--with-vcruntime-1-dll]) VCRUNTIME_1_DLL="$MSVC_DLL" fi fi -- GitLab From 31df6a60a8853be224d8c8b8c8ca6aea1bae2167 Mon Sep 17 00:00:00 2001 From: Albert Mingkun Yang Date: Thu, 17 Mar 2022 16:17:18 +0000 Subject: [PATCH 270/340] 8283188: Build time regression caused by JDK-8278917 Reviewed-by: kbarrett, tschatzl --- src/hotspot/share/gc/g1/g1CollectedHeap.cpp | 7 +++++++ src/hotspot/share/gc/g1/g1CollectedHeap.hpp | 2 +- src/hotspot/share/gc/g1/g1CollectedHeap.inline.hpp | 8 -------- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/hotspot/share/gc/g1/g1CollectedHeap.cpp b/src/hotspot/share/gc/g1/g1CollectedHeap.cpp index cbd13a7f282..3b6458b9f82 100644 --- a/src/hotspot/share/gc/g1/g1CollectedHeap.cpp +++ b/src/hotspot/share/gc/g1/g1CollectedHeap.cpp @@ -3313,6 +3313,13 @@ HeapRegion* G1CollectedHeap::alloc_highest_free_region() { return NULL; } +void G1CollectedHeap::mark_evac_failure_object(const oop obj, uint worker_id) const { + // All objects failing evacuation are live. What we'll do is + // that we'll update the prev marking info so that they are + // all under PTAMS and explicitly marked. + _cm->par_mark_in_prev_bitmap(obj); +} + // Optimized nmethod scanning class RegisterNMethodOopClosure: public OopClosure { diff --git a/src/hotspot/share/gc/g1/g1CollectedHeap.hpp b/src/hotspot/share/gc/g1/g1CollectedHeap.hpp index 6c1b60a3faa..de2442c7ce5 100644 --- a/src/hotspot/share/gc/g1/g1CollectedHeap.hpp +++ b/src/hotspot/share/gc/g1/g1CollectedHeap.hpp @@ -1249,7 +1249,7 @@ public: inline bool is_obj_dead_full(const oop obj) const; // Mark the live object that failed evacuation in the prev bitmap. - inline void mark_evac_failure_object(const oop obj, uint worker_id) const; + void mark_evac_failure_object(const oop obj, uint worker_id) const; G1ConcurrentMark* concurrent_mark() const { return _cm; } diff --git a/src/hotspot/share/gc/g1/g1CollectedHeap.inline.hpp b/src/hotspot/share/gc/g1/g1CollectedHeap.inline.hpp index 13231603533..0cd8de23e56 100644 --- a/src/hotspot/share/gc/g1/g1CollectedHeap.inline.hpp +++ b/src/hotspot/share/gc/g1/g1CollectedHeap.inline.hpp @@ -29,7 +29,6 @@ #include "gc/g1/g1BarrierSet.hpp" #include "gc/g1/g1CollectorState.hpp" -#include "gc/g1/g1ConcurrentMark.inline.hpp" #include "gc/g1/g1EvacFailureRegions.hpp" #include "gc/g1/g1Policy.hpp" #include "gc/g1/g1RemSet.hpp" @@ -234,13 +233,6 @@ inline bool G1CollectedHeap::is_obj_dead_full(const oop obj) const { return is_obj_dead_full(obj, heap_region_containing(obj)); } -inline void G1CollectedHeap::mark_evac_failure_object(const oop obj, uint worker_id) const { - // All objects failing evacuation are live. What we'll do is - // that we'll update the prev marking info so that they are - // all under PTAMS and explicitly marked. - _cm->par_mark_in_prev_bitmap(obj); -} - inline void G1CollectedHeap::set_humongous_reclaim_candidate(uint region, bool value) { assert(_hrm.at(region)->is_starts_humongous(), "Must start a humongous object"); _humongous_reclaim_candidates.set_candidate(region, value); -- GitLab From 5ef1990d6ce35a85c86689badba465b6c8f9f4a1 Mon Sep 17 00:00:00 2001 From: Joe Darcy Date: Thu, 17 Mar 2022 16:37:20 +0000 Subject: [PATCH 271/340] 8283274: Improve @jvms usage in java.base Reviewed-by: iris --- .../share/classes/java/lang/constant/ClassDesc.java | 2 +- .../share/classes/java/lang/constant/Constable.java | 6 +++--- .../share/classes/java/lang/constant/ConstantDesc.java | 6 +++--- .../share/classes/java/lang/constant/package-info.java | 4 ++-- .../share/classes/java/lang/invoke/ConstantBootstraps.java | 4 ++-- .../share/classes/java/lang/invoke/MethodHandles.java | 2 +- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/java.base/share/classes/java/lang/constant/ClassDesc.java b/src/java.base/share/classes/java/lang/constant/ClassDesc.java index c992bfb4380..6742b622a40 100644 --- a/src/java.base/share/classes/java/lang/constant/ClassDesc.java +++ b/src/java.base/share/classes/java/lang/constant/ClassDesc.java @@ -116,7 +116,7 @@ public sealed interface ClassDesc * followed by the field descriptor for the component type. Examples of * valid type descriptor strings include {@code "Ljava/lang/String;"}, {@code "I"}, * {@code "[I"}, {@code "V"}, {@code "[Ljava/lang/String;"}, etc. - * See JVMS 4.3.2 ("Field Descriptors") for more detail. + * See JVMS {@jvms 4.3.2 }("Field Descriptors") for more detail. * * @param descriptor a field descriptor string * @return a {@linkplain ClassDesc} describing the desired class diff --git a/src/java.base/share/classes/java/lang/constant/Constable.java b/src/java.base/share/classes/java/lang/constant/Constable.java index 33875654c05..e404dff6e4b 100644 --- a/src/java.base/share/classes/java/lang/constant/Constable.java +++ b/src/java.base/share/classes/java/lang/constant/Constable.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2022, 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 @@ -32,7 +32,7 @@ import java.util.Optional; /** * Represents a type which is constable. A constable type is one whose * values are constants that can be represented in the constant pool of a Java - * classfile as described in JVMS 4.4, and whose instances can describe themselves + * classfile as described in JVMS {@jvms 4.4}, and whose instances can describe themselves * nominally as a {@link ConstantDesc}. * *

    Some constable types have a native representation in the constant pool: @@ -48,7 +48,7 @@ import java.util.Optional; * Platform API are types that support Java language features such as {@link Enum}, * and runtime support classes such as {@link VarHandle}. These are typically * described with a {@link DynamicConstantDesc}, which describes dynamically - * generated constants (JVMS 4.4.10). + * generated constants (JVMS {@jvms 4.4.10}). * *

    The nominal form of an instance of a constable type is obtained via * {@link #describeConstable()}. A {@linkplain Constable} need diff --git a/src/java.base/share/classes/java/lang/constant/ConstantDesc.java b/src/java.base/share/classes/java/lang/constant/ConstantDesc.java index 70c5f8fcb55..401119989a9 100644 --- a/src/java.base/share/classes/java/lang/constant/ConstantDesc.java +++ b/src/java.base/share/classes/java/lang/constant/ConstantDesc.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2022, 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 @@ -32,7 +32,7 @@ import java.lang.invoke.VarHandle.VarHandleDesc; /** * A nominal descriptor for a loadable - * constant value, as defined in JVMS 4.4. Such a descriptor can be resolved via + * constant value, as defined in JVMS {@jvms 4.4}. Such a descriptor can be resolved via * {@link ConstantDesc#resolveConstantDesc(MethodHandles.Lookup)} to yield the * constant value itself. * @@ -87,7 +87,7 @@ public sealed interface ConstantDesc String { /** * Resolves this descriptor reflectively, emulating the resolution behavior - * of JVMS 5.4.3 and the access control behavior of JVMS 5.4.4. The resolution + * of JVMS {@jvms 5.4.3} and the access control behavior of JVMS {@jvms 5.4.4}. The resolution * and access control context is provided by the {@link MethodHandles.Lookup} * parameter. No caching of the resulting value is performed. * diff --git a/src/java.base/share/classes/java/lang/constant/package-info.java b/src/java.base/share/classes/java/lang/constant/package-info.java index 9bc978e44a1..fd85dfb93d7 100644 --- a/src/java.base/share/classes/java/lang/constant/package-info.java +++ b/src/java.base/share/classes/java/lang/constant/package-info.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2022, 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 @@ -55,7 +55,7 @@ * referenced in their nominal description are present and accessible. * *

    The subtypes of {@link java.lang.constant.ConstantDesc} describe various kinds - * of constant values. For each type of loadable constant pool entry defined in JVMS 4.4, + * of constant values. For each type of loadable constant pool entry defined in JVMS {@jvms 4.4}, * there is a corresponding subtype of {@link java.lang.constant.ConstantDesc}: * {@link java.lang.constant.ClassDesc}, {@link java.lang.constant.MethodTypeDesc}, * {@link java.lang.constant.DirectMethodHandleDesc}, {@link java.lang.String}, diff --git a/src/java.base/share/classes/java/lang/invoke/ConstantBootstraps.java b/src/java.base/share/classes/java/lang/invoke/ConstantBootstraps.java index 27d74284dc6..b3858104e21 100644 --- a/src/java.base/share/classes/java/lang/invoke/ConstantBootstraps.java +++ b/src/java.base/share/classes/java/lang/invoke/ConstantBootstraps.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2022, 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 @@ -96,7 +96,7 @@ public final class ConstantBootstraps { * descriptor is specified by {@code name}. * * @param lookup unused - * @param name the descriptor (JVMS 4.3) of the desired primitive type + * @param name the descriptor (JVMS {@jvms 4.3}) of the desired primitive type * @param type the required result type (must be {@code Class.class}) * @return the {@link Class} mirror * @throws IllegalArgumentException if the name is not a descriptor for a diff --git a/src/java.base/share/classes/java/lang/invoke/MethodHandles.java b/src/java.base/share/classes/java/lang/invoke/MethodHandles.java index dd8b01c73bc..7488db060d2 100644 --- a/src/java.base/share/classes/java/lang/invoke/MethodHandles.java +++ b/src/java.base/share/classes/java/lang/invoke/MethodHandles.java @@ -2759,7 +2759,7 @@ assertEquals("[x, y, z]", pb.command().toString()); /** * Looks up a class by name from the lookup context defined by this {@code Lookup} object, * as if resolved by an {@code ldc} instruction. - * Such a resolution, as specified in JVMS 5.4.3.1 section, attempts to locate and load the class, + * Such a resolution, as specified in JVMS {@jvms 5.4.3.1}, attempts to locate and load the class, * and then determines whether the class is accessible to this lookup object. *

    * The lookup context here is determined by the {@linkplain #lookupClass() lookup class}, -- GitLab From b004fb0550d8fc94e3f6412975c23c0a2ac2a42f Mon Sep 17 00:00:00 2001 From: Ioi Lam Date: Thu, 17 Mar 2022 17:50:20 +0000 Subject: [PATCH 272/340] 8282773: Refactor parsing of integer VM options Reviewed-by: dholmes, kbarrett --- src/hotspot/share/runtime/arguments.cpp | 235 ++++++----- .../share/runtime/flags/debug_globals.hpp | 25 +- test/hotspot/gtest/runtime/test_arguments.cpp | 366 +++++++++++++++++- .../gtest/runtime/test_largeOptions.cpp | 108 ------ 4 files changed, 529 insertions(+), 205 deletions(-) delete mode 100644 test/hotspot/gtest/runtime/test_largeOptions.cpp diff --git a/src/hotspot/share/runtime/arguments.cpp b/src/hotspot/share/runtime/arguments.cpp index a38e70b0b26..1d7fb5f983a 100644 --- a/src/hotspot/share/runtime/arguments.cpp +++ b/src/hotspot/share/runtime/arguments.cpp @@ -40,6 +40,7 @@ #include "logging/logStream.hpp" #include "logging/logTag.hpp" #include "memory/allocation.inline.hpp" +#include "metaprogramming/enableIf.hpp" #include "oops/instanceKlass.hpp" #include "oops/oop.inline.hpp" #include "prims/jvmtiExport.hpp" @@ -56,6 +57,7 @@ #include "services/management.hpp" #include "services/nmtCommon.hpp" #include "utilities/align.hpp" +#include "utilities/debug.hpp" #include "utilities/defaultStream.hpp" #include "utilities/macros.hpp" #include "utilities/powerOfTwo.hpp" @@ -63,6 +65,7 @@ #if INCLUDE_JFR #include "jfr/jfr.hpp" #endif +#include #define DEFAULT_JAVA_LAUNCHER "generic" @@ -744,20 +747,84 @@ bool Arguments::verify_special_jvm_flags(bool check_globals) { } #endif -// Parses a size specification string. -bool Arguments::atojulong(const char *s, julong* result) { - julong n = 0; +template ::value), ENABLE_IF(sizeof(T) == 4)> // signed 32-bit +static bool parse_integer_impl(const char *s, char **endptr, int base, T* result) { + // Don't use strtol -- on 64-bit builds, "long" could be either 32- or 64-bits + // so the range tests could be tautological and might cause compiler warnings. + STATIC_ASSERT(sizeof(long long) >= 8); // C++ specification + errno = 0; // errno is thread safe + long long v = strtoll(s, endptr, base); + if (errno != 0 || v < min_jint || v > max_jint) { + return false; + } + *result = static_cast(v); + return true; +} - // First char must be a digit. Don't allow negative numbers or leading spaces. - if (!isdigit(*s)) { +template ::value), ENABLE_IF(sizeof(T) == 4)> // unsigned 32-bit +static bool parse_integer_impl(const char *s, char **endptr, int base, T* result) { + if (s[0] == '-') { return false; } + // Don't use strtoul -- same reason as above. + STATIC_ASSERT(sizeof(unsigned long long) >= 8); // C++ specification + errno = 0; // errno is thread safe + unsigned long long v = strtoull(s, endptr, base); + if (errno != 0 || v > max_juint) { + return false; + } + *result = static_cast(v); + return true; +} - bool is_hex = (s[0] == '0' && (s[1] == 'x' || s[1] == 'X')); +template ::value), ENABLE_IF(sizeof(T) == 8)> // signed 64-bit +static bool parse_integer_impl(const char *s, char **endptr, int base, T* result) { + errno = 0; // errno is thread safe + *result = strtoll(s, endptr, base); + return errno == 0; +} + +template ::value), ENABLE_IF(sizeof(T) == 8)> // unsigned 64-bit +static bool parse_integer_impl(const char *s, char **endptr, int base, T* result) { + if (s[0] == '-') { + return false; + } + errno = 0; // errno is thread safe + *result = strtoull(s, endptr, base); + return errno == 0; +} + +template +static bool multiply_by_1k(T& n) { + if (n >= std::numeric_limits::min() / 1024 && + n <= std::numeric_limits::max() / 1024) { + n *= 1024; + return true; + } else { + return false; + } +} + +// All of the integral types that can be used for command line options: +// int, uint, intx, uintx, uint64_t, size_t +// +// In all supported platforms, these types can be mapped to only 4 native types: +// {signed, unsigned} x {32-bit, 64-bit} +// +// We use SFINAE to pick the correct parse_integer_impl() function +template +static bool parse_integer(const char *s, T* result) { + if (!isdigit(s[0]) && s[0] != '-') { + // strtoll/strtoull may allow leading spaces. Forbid it. + return false; + } + + T n = 0; + bool is_hex = (s[0] == '0' && (s[1] == 'x' || s[1] == 'X')) || + (s[0] == '-' && s[1] == '0' && (s[2] == 'x' || s[3] == 'X')); char* remainder; - errno = 0; - n = strtoull(s, &remainder, (is_hex ? 16 : 10)); - if (errno != 0) { + + if (!parse_integer_impl(s, &remainder, (is_hex ? 16 : 10), &n)) { return false; } @@ -768,28 +835,29 @@ bool Arguments::atojulong(const char *s, julong* result) { switch (*remainder) { case 'T': case 't': - *result = n * G * K; - // Check for overflow. - if (*result/((julong)G * K) != n) return false; - return true; + if (!multiply_by_1k(n)) return false; + // fall-through case 'G': case 'g': - *result = n * G; - if (*result/G != n) return false; - return true; + if (!multiply_by_1k(n)) return false; + // fall-through case 'M': case 'm': - *result = n * M; - if (*result/M != n) return false; - return true; + if (!multiply_by_1k(n)) return false; + // fall-through case 'K': case 'k': - *result = n * K; - if (*result/K != n) return false; - return true; + if (!multiply_by_1k(n)) return false; + break; case '\0': - *result = n; - return true; + break; default: return false; } + + *result = n; + return true; +} + +bool Arguments::atojulong(const char *s, julong* result) { + return parse_integer(s, result); } Arguments::ArgsRange Arguments::check_memory_size(julong size, julong min_size, julong max_size) { @@ -838,72 +906,57 @@ static bool set_fp_numeric_flag(JVMFlag* flag, char* value, JVMFlagOrigin origin return false; } -static bool set_numeric_flag(JVMFlag* flag, char* value, JVMFlagOrigin origin) { - julong v; - int int_v; - intx intx_v; - bool is_neg = false; - +static JVMFlag::Error set_numeric_flag(JVMFlag* flag, char* value, JVMFlagOrigin origin) { if (flag == NULL) { - return false; + return JVMFlag::INVALID_FLAG; } - // Check the sign first since atojulong() parses only unsigned values. - if (*value == '-') { - if (!flag->is_intx() && !flag->is_int()) { - return false; - } - value++; - is_neg = true; - } - if (!Arguments::atojulong(value, &v)) { - return false; - } if (flag->is_int()) { - int_v = (int) v; - if (is_neg) { - int_v = -int_v; + int v; + if (parse_integer(value, &v)) { + return JVMFlagAccess::set_int(flag, &v, origin); } - if ((!is_neg && v > max_jint) || (is_neg && -(intx)v < min_jint)) { - return false; - } - return JVMFlagAccess::set_int(flag, &int_v, origin) == JVMFlag::SUCCESS; } else if (flag->is_uint()) { - if (v > max_juint) { - return false; + uint v; + if (parse_integer(value, &v)) { + return JVMFlagAccess::set_uint(flag, &v, origin); } - uint uint_v = (uint) v; - return JVMFlagAccess::set_uint(flag, &uint_v, origin) == JVMFlag::SUCCESS; } else if (flag->is_intx()) { - intx_v = (intx) v; - if (is_neg) { - if (intx_v != min_intx) { - intx_v = - intx_v; - if (intx_v > 0) { - return false; // underflow - } - } - } else { - if (intx_v < 0) { - return false; // overflow - } + intx v; + if (parse_integer(value, &v)) { + return JVMFlagAccess::set_intx(flag, &v, origin); } - return JVMFlagAccess::set_intx(flag, &intx_v, origin) == JVMFlag::SUCCESS; } else if (flag->is_uintx()) { - uintx uintx_v = (uintx) v; - return JVMFlagAccess::set_uintx(flag, &uintx_v, origin) == JVMFlag::SUCCESS; + uintx v; + if (parse_integer(value, &v)) { + return JVMFlagAccess::set_uintx(flag, &v, origin); + } } else if (flag->is_uint64_t()) { - uint64_t uint64_t_v = (uint64_t) v; - return JVMFlagAccess::set_uint64_t(flag, &uint64_t_v, origin) == JVMFlag::SUCCESS; + uint64_t v; + if (parse_integer(value, &v)) { + return JVMFlagAccess::set_uint64_t(flag, &v, origin); + } } else if (flag->is_size_t()) { - size_t size_t_v = (size_t) v; - return JVMFlagAccess::set_size_t(flag, &size_t_v, origin) == JVMFlag::SUCCESS; + size_t v; + if (parse_integer(value, &v)) { + return JVMFlagAccess::set_size_t(flag, &v, origin); + } } else if (flag->is_double()) { - double double_v = (double) v; - return JVMFlagAccess::set_double(flag, &double_v, origin) == JVMFlag::SUCCESS; - } else { - return false; + // This function parses only input strings without a decimal + // point character (.) + // If a string looks like a FP number, it would be parsed by + // set_fp_numeric_flag(). See Arguments::parse_argument(). + jlong v; + if (parse_integer(value, &v)) { + double double_v = (double) v; + if (value[0] == '-' && v == 0) { // special case: 0.0 is different than -0.0. + double_v = -0.0; + } + return JVMFlagAccess::set_double(flag, &double_v, origin); + } } + + return JVMFlag::WRONG_FORMAT; } static bool set_string_flag(JVMFlag* flag, const char* value, JVMFlagOrigin origin) { @@ -1065,7 +1118,7 @@ bool Arguments::parse_argument(const char* arg, JVMFlagOrigin origin) { return false; } JVMFlag* flag = JVMFlag::find_flag(real_name); - return set_numeric_flag(flag, value, origin); + return set_numeric_flag(flag, value, origin) == JVMFlag::SUCCESS; } return false; @@ -2082,24 +2135,16 @@ static const char* system_assertion_options[] = { bool Arguments::parse_uintx(const char* value, uintx* uintx_arg, uintx min_size) { - - // Check the sign first since atojulong() parses only unsigned values. - bool value_is_positive = !(*value == '-'); - - if (value_is_positive) { - julong n; - bool good_return = atojulong(value, &n); - if (good_return) { - bool above_minimum = n >= min_size; - bool value_is_too_large = n > max_uintx; - - if (above_minimum && !value_is_too_large) { - *uintx_arg = n; - return true; - } - } + uintx n; + if (!parse_integer(value, &n)) { + return false; + } + if (n >= min_size) { + *uintx_arg = n; + return true; + } else { + return false; } - return false; } bool Arguments::create_module_property(const char* prop_name, const char* prop_value, PropertyInternal internal) { @@ -2150,7 +2195,7 @@ Arguments::ArgsRange Arguments::parse_memory_size(const char* s, julong* long_arg, julong min_size, julong max_size) { - if (!atojulong(s, long_arg)) return arg_unreadable; + if (!parse_integer(s, long_arg)) return arg_unreadable; return check_memory_size(*long_arg, min_size, max_size); } diff --git a/src/hotspot/share/runtime/flags/debug_globals.hpp b/src/hotspot/share/runtime/flags/debug_globals.hpp index 11ea2f60104..177a4ae074b 100644 --- a/src/hotspot/share/runtime/flags/debug_globals.hpp +++ b/src/hotspot/share/runtime/flags/debug_globals.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -62,6 +62,29 @@ product(ccstr, DummyManageableStringFlag, NULL, MANAGEABLE, \ "Dummy flag for testing string handling in WriteableFlags") \ \ + product(bool, TestFlagFor_bool, false, \ + "Used by VM internal regression tests only") \ + \ + product(int, TestFlagFor_int, 0, \ + "Used by VM internal regression tests only") \ + \ + product(uint, TestFlagFor_uint, 0, \ + "Used by VM internal regression tests only") \ + \ + product(intx, TestFlagFor_intx, 0, \ + "Used by VM internal regression tests only") \ + \ + product(uintx, TestFlagFor_uintx, 0, \ + "Used by VM internal regression tests only") \ + \ + product(uint64_t, TestFlagFor_uint64_t, 0, \ + "Used by VM internal regression tests only") \ + \ + product(size_t, TestFlagFor_size_t, 0, \ + "Used by VM internal regression tests only") \ + \ + product(double, TestFlagFor_double, 0.0, \ + "Used by VM internal regression tests only") \ // end of DEBUG_RUNTIME_FLAGS diff --git a/test/hotspot/gtest/runtime/test_arguments.cpp b/test/hotspot/gtest/runtime/test_arguments.cpp index 81bae6c468a..234bb2a015b 100644 --- a/test/hotspot/gtest/runtime/test_arguments.cpp +++ b/test/hotspot/gtest/runtime/test_arguments.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2022, 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 @@ -25,6 +25,7 @@ #include "jvm.h" #include "unittest.hpp" #include "runtime/arguments.hpp" +#include "runtime/flags/jvmFlag.hpp" #include "utilities/align.hpp" #include "utilities/globalDefinitions.hpp" @@ -41,6 +42,16 @@ public: static jint parse_xss(const JavaVMOption* option, const char* tail, intx* out_ThreadStackSize) { return Arguments::parse_xss(option, tail, out_ThreadStackSize); } + + static bool parse_argument(const char* name, const char* value) { + char buf[1024]; + int ret = jio_snprintf(buf, sizeof(buf), "%s=%s", name, value); + if (ret > 0) { + return Arguments::parse_argument(buf, JVMFlagOrigin::COMMAND_LINE); + } else { + return false; + } + } }; TEST_F(ArgumentsTest, atojulong) { @@ -201,3 +212,356 @@ TEST_VM_F(ArgumentsTest, parse_xss) { EXPECT_EQ(parse_xss_inner(to_string(K + 1), JNI_OK), calc_expected(K + 1)); } } + +struct Dummy {}; +static Dummy BAD; + +template +struct NumericArgument { + bool bad; + const char* str; + T expected_value; + + NumericArgument(const char* s, T v) : bad(false), str(s), expected_value(v) {} + NumericArgument(const char* s, Dummy & dummy) : bad(true), str(s), expected_value(0) {} +}; + +static void check_invalid_numeric_string(JVMFlag* flag, const char** invalid_strings) { + for (uint i = 0; ; i++) { + const char* str = invalid_strings[i]; + if (str == NULL) { + return; + } + ASSERT_FALSE(ArgumentsTest::parse_argument(flag->name(), str)) + << "Invalid string '" << str + << "' parsed without error for type " << flag->type_string() << "."; + } +} + +template +void check_numeric_flag(JVMFlag* flag, T getvalue(JVMFlag* flag), + NumericArgument* valid_args, size_t n, + bool is_double = false) { + for (size_t i = 0; i < n; i++) { + NumericArgument* info = &valid_args[i]; + const char* str = info->str; + if (info->bad) { + ASSERT_FALSE(ArgumentsTest::parse_argument(flag->name(), str)) + << "Invalid string '" << str + << "' parsed without error for type " << flag->type_string() << "."; + } else { + ASSERT_TRUE(ArgumentsTest::parse_argument(flag->name(), str)) + << "Valid string '" << + str << "' did not parse for type " << flag->type_string() << "."; + ASSERT_EQ(getvalue(flag), info->expected_value) + << "Valid string '" << str + << "' did not parse to the correct value for type " + << flag->type_string() << "."; + } + } + + { + // Invalid strings for *any* type of integer VM arguments + const char* invalid_strings[] = { + "", " 1", "2 ", "3 2", + "0x", "0x0x1" "e" + "K", "M", "G", "1MB", "1KM", "AA", "0B", + "18446744073709551615K", "17179869184G", + "999999999999999999999999999999", + "0x10000000000000000", "18446744073709551616", + "-0x10000000000000000", "-18446744073709551616", + "-0x8000000000000001", "-9223372036854775809", + "0x8000000t", "0x800000000g", + "0x800000000000m", "0x800000000000000k", + "-0x8000000t", "-0x800000000g", + "-0x800000000000m", "-0x800000000000000k", + NULL, + }; + check_invalid_numeric_string(flag, invalid_strings); + } + + if (!is_double) { + const char* invalid_strings_for_integers[] = { + "1.0", "0x4.5", "0.001", "4e10", + NULL, + }; + check_invalid_numeric_string(flag, invalid_strings_for_integers); + } +} + +#define INTEGER_TEST_TABLE(f) \ + /*input i32 u32 i64 u64 */ \ + f("0", 0, 0, 0, 0 ) \ + f("-0", 0, BAD, 0, BAD ) \ + f("-1", -1, BAD, -1, BAD ) \ + f("0x1", 1, 1, 1, 1 ) \ + f("-0x1", -1, BAD, -1, BAD ) \ + f("4711", 4711, 4711, 4711, 4711 ) \ + f("1K", 1024, 1024, 1024, 1024 ) \ + f("1k", 1024, 1024, 1024, 1024 ) \ + f("2M", 2097152, 2097152, 2097152, 2097152 ) \ + f("2m", 2097152, 2097152, 2097152, 2097152 ) \ + f("1G", 1073741824, 1073741824, 1073741824, 1073741824 ) \ + f("2G", BAD, 0x80000000, 2147483648LL, 2147483648ULL ) \ + f("1T", BAD, BAD, 1099511627776LL, 1099511627776ULL ) \ + f("1t", BAD, BAD, 1099511627776LL, 1099511627776ULL ) \ + f("-1K", -1024, BAD, -1024, BAD ) \ + f("0x1K", 1024, 1024, 1024, 1024 ) \ + f("-0x1K", -1024, BAD, -1024, BAD ) \ + f("0K", 0, 0, 0, 0 ) \ + f("0x1000000k", BAD, BAD, 17179869184LL, 17179869184ULL ) \ + f("0x800000m", BAD, BAD, 0x80000000000LL, 0x80000000000ULL ) \ + f("0x8000g", BAD, BAD, 0x200000000000LL, 0x200000000000ULL ) \ + f("0x8000t", BAD, BAD, 0x80000000000000LL, 0x80000000000000ULL ) \ + f("-0x1000000k", BAD, BAD, -17179869184LL, BAD ) \ + f("-0x800000m", BAD, BAD, -0x80000000000LL, BAD ) \ + f("-0x8000g", BAD, BAD, -0x200000000000LL, BAD ) \ + f("-0x8000t", BAD, BAD, -0x80000000000000LL, BAD ) \ + f("0x7fffffff", 0x7fffffff, 0x7fffffff, 0x7fffffff, 0x7fffffff ) \ + f("0xffffffff", BAD, 0xffffffff, 0xffffffff, 0xffffffff ) \ + f("0x80000000", BAD, 0x80000000, 0x80000000, 0x80000000 ) \ + f("-0x7fffffff", -2147483647, BAD, -2147483647LL, BAD ) \ + f("-0x80000000", -2147483648, BAD, -2147483648LL, BAD ) \ + f("-0x80000001", BAD, BAD, -2147483649LL, BAD ) \ + f("0x100000000", BAD, BAD, 0x100000000LL, 0x100000000ULL ) \ + f("0xcafebabe", BAD, 0xcafebabe, 0xcafebabe, 0xcafebabe ) \ + f("0XCAFEBABE", BAD, 0xcafebabe, 0xcafebabe, 0xcafebabe ) \ + f("0XCAFEbabe", BAD, 0xcafebabe, 0xcafebabe, 0xcafebabe ) \ + f("0xcafebabe1", BAD, BAD, 0xcafebabe1, 0xcafebabe1 ) \ + f("0x7fffffffffffffff", BAD, BAD, max_jlong, 9223372036854775807ULL ) \ + f("0x8000000000000000", BAD, BAD, BAD, 9223372036854775808ULL ) \ + f("0xffffffffffffffff", BAD, BAD, BAD, max_julong ) \ + f("9223372036854775807", BAD, BAD, 9223372036854775807LL, 9223372036854775807ULL ) \ + f("9223372036854775808", BAD, BAD, BAD, 9223372036854775808ULL ) \ + f("-9223372036854775808", BAD, BAD, min_jlong, BAD ) \ + f("18446744073709551615", BAD, BAD, BAD, max_julong ) \ + \ + /* All edge cases without a k/m/g/t suffix */ \ + f("0x7ffffffe", max_jint-1, 0x7ffffffe, 0x7ffffffeLL, 0x7ffffffeULL ) \ + f("0x7fffffff", max_jint, 0x7fffffff, 0x7fffffffLL, 0x7fffffffULL ) \ + f("0x80000000", BAD, 0x80000000, 0x80000000LL, 0x80000000ULL ) \ + f("0xfffffffe", BAD, max_juint-1, 0xfffffffeLL, 0xfffffffeULL ) \ + f("0xffffffff", BAD, max_juint, 0xffffffffLL, 0xffffffffULL ) \ + f("0x100000000", BAD, BAD, 0x100000000LL, 0x100000000ULL ) \ + f("-0x7fffffff", min_jint+1, BAD, -0x7fffffffLL, BAD ) \ + f("-0x80000000", min_jint, BAD, -0x80000000LL, BAD ) \ + f("-0x80000001", BAD, BAD, -0x80000001LL, BAD ) \ + \ + f("0x7ffffffffffffffe", BAD, BAD, max_jlong-1, 0x7ffffffffffffffeULL ) \ + f("0x7fffffffffffffff", BAD, BAD, max_jlong, 0x7fffffffffffffffULL ) \ + f("0x8000000000000000", BAD, BAD, BAD, 0x8000000000000000ULL ) \ + f("0xfffffffffffffffe", BAD, BAD, BAD, max_julong-1 ) \ + f("0xffffffffffffffff", BAD, BAD, BAD, max_julong ) \ + f("0x10000000000000000", BAD, BAD, BAD, BAD ) \ + f("-0x7fffffffffffffff", BAD, BAD, min_jlong+1, BAD ) \ + f("-0x8000000000000000", BAD, BAD, min_jlong, BAD ) \ + f("-0x8000000000000001", BAD, BAD, BAD, BAD ) \ + \ + /* edge cases for suffix: K */ \ + f("0x1ffffek", 0x1ffffe * k, 0x1ffffeU * k,0x1ffffeLL * k, 0x1ffffeULL * k ) \ + f("0x1fffffk", 0x1fffff * k, 0x1fffffU * k,0x1fffffLL * k, 0x1fffffULL * k ) \ + f("0x200000k", BAD, 0x200000U * k,0x200000LL * k, 0x200000ULL * k ) \ + f("0x3ffffek", BAD, 0x3ffffeU * k,0x3ffffeLL * k, 0x3ffffeULL * k ) \ + f("0x3fffffk", BAD, 0x3fffffU * k,0x3fffffLL * k, 0x3fffffULL * k ) \ + f("0x400000k", BAD, BAD, 0x400000LL * k, 0x400000ULL * k ) \ + f("-0x1fffffk", -0x1fffff * k, BAD, -0x1fffffLL * k, BAD ) \ + f("-0x200000k", -0x200000 * k, BAD, -0x200000LL * k, BAD ) \ + f("-0x200001k", BAD, BAD, -0x200001LL * k, BAD ) \ + \ + f("0x1ffffffffffffek", BAD, BAD, 0x1ffffffffffffeLL * k, 0x1ffffffffffffeULL * k ) \ + f("0x1fffffffffffffk", BAD, BAD, 0x1fffffffffffffLL * k, 0x1fffffffffffffULL * k ) \ + f("0x20000000000000k", BAD, BAD, BAD, 0x20000000000000ULL * k ) \ + f("0x3ffffffffffffek", BAD, BAD, BAD, 0x3ffffffffffffeULL * k ) \ + f("0x3fffffffffffffk", BAD, BAD, BAD, 0x3fffffffffffffULL * k ) \ + f("0x40000000000000k", BAD, BAD, BAD, BAD ) \ + f("-0x1fffffffffffffk", BAD, BAD, -0x1fffffffffffffLL * k, BAD ) \ + f("-0x20000000000000k", BAD, BAD, -0x20000000000000LL * k, BAD ) \ + f("-0x20000000000001k", BAD, BAD, BAD, BAD ) \ + \ + /* edge cases for suffix: M */ \ + f("0x7fem", 0x7fe * m, 0x7feU * m, 0x7feLL * m, 0x7feULL * m ) \ + f("0x7ffm", 0x7ff * m, 0x7ffU * m, 0x7ffLL * m, 0x7ffULL * m ) \ + f("0x800m", BAD, 0x800U * m, 0x800LL * m, 0x800ULL * m ) \ + f("0xffem", BAD, 0xffeU * m, 0xffeLL * m, 0xffeULL * m ) \ + f("0xfffm", BAD, 0xfffU * m, 0xfffLL * m, 0xfffULL * m ) \ + f("0x1000m", BAD, BAD, 0x1000LL * m, 0x1000ULL * m ) \ + f("-0x7ffm", -0x7ff * m, BAD, -0x7ffLL * m, BAD ) \ + f("-0x800m", -0x800 * m, BAD, -0x800LL * m, BAD ) \ + f("-0x801m", BAD, BAD, -0x801LL * m, BAD ) \ + \ + f("0x7fffffffffem", BAD, BAD, 0x7fffffffffeLL * m, 0x7fffffffffeULL * m ) \ + f("0x7ffffffffffm", BAD, BAD, 0x7ffffffffffLL * m, 0x7ffffffffffULL * m ) \ + f("0x80000000000m", BAD, BAD, BAD, 0x80000000000ULL * m ) \ + f("0xffffffffffem", BAD, BAD, BAD, 0xffffffffffeULL * m ) \ + f("0xfffffffffffm", BAD, BAD, BAD, 0xfffffffffffULL * m ) \ + f("0x100000000000m", BAD, BAD, BAD, BAD ) \ + f("-0x7ffffffffffm", BAD, BAD, -0x7ffffffffffLL * m, BAD ) \ + f("-0x80000000000m", BAD, BAD, -0x80000000000LL * m, BAD ) \ + f("-0x80000000001m", BAD, BAD, BAD, BAD ) \ + \ + /* edge cases for suffix: G */ \ + f("0x0g", 0x0 * g, 0x0U * g, 0x0LL * g, 0x0ULL * g ) \ + f("0x1g", 0x1 * g, 0x1U * g, 0x1LL * g, 0x1ULL * g ) \ + f("0x2g", BAD, 0x2U * g, 0x2LL * g, 0x2ULL * g ) \ + f("0x3g", BAD, 0x3U * g, 0x3LL * g, 0x3ULL * g ) \ + f("0x4g", BAD, BAD, 0x4LL * g, 0x4ULL * g ) \ + f("-0x1g", -0x1 * g, BAD, -0x1LL * g, BAD ) \ + f("-0x2g", -0x2 * g, BAD, -0x2LL * g, BAD ) \ + f("-0x3g", BAD, BAD, -0x3LL * g, BAD ) \ + \ + f("0x1fffffffeg", BAD, BAD, 0x1fffffffeLL * g, 0x1fffffffeULL * g ) \ + f("0x1ffffffffg", BAD, BAD, 0x1ffffffffLL * g, 0x1ffffffffULL * g ) \ + f("0x200000000g", BAD, BAD, BAD, 0x200000000ULL * g ) \ + f("0x3fffffffeg", BAD, BAD, BAD, 0x3fffffffeULL * g ) \ + f("0x3ffffffffg", BAD, BAD, BAD, 0x3ffffffffULL * g ) \ + f("0x400000000g", BAD, BAD, BAD, BAD ) \ + f("-0x1ffffffffg", BAD, BAD, -0x1ffffffffLL * g, BAD ) \ + f("-0x200000000g", BAD, BAD, -0x200000000LL * g, BAD ) \ + f("-0x200000001g", BAD, BAD, BAD, BAD ) \ + \ + /* edge cases for suffix: T */ \ + f("0x7ffffet", BAD, BAD, 0x7ffffeLL * t, 0x7ffffeULL * t ) \ + f("0x7ffffft", BAD, BAD, 0x7fffffLL * t, 0x7fffffULL * t ) \ + f("0x800000t", BAD, BAD, BAD, 0x800000ULL * t ) \ + f("0xfffffet", BAD, BAD, BAD, 0xfffffeULL * t ) \ + f("0xfffffft", BAD, BAD, BAD, 0xffffffULL * t ) \ + f("0x1000000t", BAD, BAD, BAD, BAD ) \ + f("-0x7ffffft", BAD, BAD, -0x7fffffLL * t, BAD ) \ + f("-0x800000t", BAD, BAD, -0x800000LL * t, BAD ) \ + f("-0x800001t", BAD, BAD, BAD, BAD ) + +#define INTEGER_TEST_i32(s, i32, u32, i64, u64) NumericArgument(s, i32), +#define INTEGER_TEST_u32(s, i32, u32, i64, u64) NumericArgument(s, u32), +#define INTEGER_TEST_i64(s, i32, u32, i64, u64) NumericArgument(s, i64), +#define INTEGER_TEST_u64(s, i32, u32, i64, u64) NumericArgument(s, u64), + +// signed 32-bit +template ::value), ENABLE_IF(sizeof(T) == 4)> +void check_flag(const char* f, T getvalue(JVMFlag* flag)) { + JVMFlag* flag = JVMFlag::find_flag(f); + if (flag == NULL) { // not available in product builds + return; + } + + T k = static_cast(K); + T m = static_cast(M); + T g = static_cast(G); + NumericArgument valid_strings[] = { INTEGER_TEST_TABLE(INTEGER_TEST_i32) }; + check_numeric_flag(flag, getvalue, valid_strings, ARRAY_SIZE(valid_strings)); +} + +// unsigned 32-bit +template ::value), ENABLE_IF(sizeof(T) == 4)> +void check_flag(const char* f, T getvalue(JVMFlag* flag)) { + JVMFlag* flag = JVMFlag::find_flag(f); + if (flag == NULL) { // not available in product builds + return; + } + + T k = static_cast(K); + T m = static_cast(M); + T g = static_cast(G); + NumericArgument valid_strings[] = { INTEGER_TEST_TABLE(INTEGER_TEST_u32) }; + check_numeric_flag(flag, getvalue, valid_strings, ARRAY_SIZE(valid_strings)); +} + +// signed 64-bit +template ::value), ENABLE_IF(sizeof(T) == 8)> +void check_flag(const char* f, T getvalue(JVMFlag* flag)) { + JVMFlag* flag = JVMFlag::find_flag(f); + if (flag == NULL) { // not available in product builds + return; + } + + T k = static_cast(K); + T m = static_cast(M); + T g = static_cast(G); + T t = static_cast(G) * k; + NumericArgument valid_strings[] = { INTEGER_TEST_TABLE(INTEGER_TEST_i64) }; + check_numeric_flag(flag, getvalue, valid_strings, ARRAY_SIZE(valid_strings)); +} + +// unsigned 64-bit +template ::value), ENABLE_IF(sizeof(T) == 8)> +void check_flag(const char* f, T getvalue(JVMFlag* flag)) { + JVMFlag* flag = JVMFlag::find_flag(f); + if (flag == NULL) { // not available in product builds + return; + } + + T k = static_cast(K); + T m = static_cast(M); + T g = static_cast(G); + T t = static_cast(G) * k; + NumericArgument valid_strings[] = { INTEGER_TEST_TABLE(INTEGER_TEST_u64) }; + check_numeric_flag(flag, getvalue, valid_strings, ARRAY_SIZE(valid_strings)); +} + +// Testing the parsing of -XX:= +// +// All of the integral types that can be used for command line options: +// int, uint, intx, uintx, uint64_t, size_t +// +// In all supported platforms, these types can be mapped to only 4 native types: +// {signed, unsigned} x {32-bit, 64-bit} +// +// We use SFINAE to pick the correct column in the INTEGER_TEST_TABLE for each type. + +TEST_VM_F(ArgumentsTest, set_numeric_flag_int) { + check_flag("TestFlagFor_int", [] (JVMFlag* flag) { + return flag->get_int(); + }); +} + +TEST_VM_F(ArgumentsTest, set_numeric_flag_uint) { + check_flag("TestFlagFor_uint", [] (JVMFlag* flag) { + return flag->get_uint(); + }); +} + +TEST_VM_F(ArgumentsTest, set_numeric_flag_intx) { + check_flag("TestFlagFor_intx", [] (JVMFlag* flag) { + return flag->get_intx(); + }); +} + +TEST_VM_F(ArgumentsTest, set_numeric_flag_uintx) { + check_flag("TestFlagFor_uintx", [] (JVMFlag* flag) { + return flag->get_uintx(); + }); +} + +TEST_VM_F(ArgumentsTest, set_numeric_flag_uint64_t) { + check_flag("TestFlagFor_uint64_t", [] (JVMFlag* flag) { + return flag->get_uint64_t(); + }); +} + +TEST_VM_F(ArgumentsTest, set_numeric_flag_size_t) { + check_flag("TestFlagFor_size_t", [] (JVMFlag* flag) { + return flag->get_size_t(); + }); +} + +TEST_VM_F(ArgumentsTest, set_numeric_flag_double) { + JVMFlag* flag = JVMFlag::find_flag("TestFlagFor_double"); + if (flag == NULL) { // not available in product builds + return; + } + + // TODO -- JDK-8282774 + // Need to add more test input that have a fractional part like "4.2". + NumericArgument valid_strings[] = { + NumericArgument("0", 0.0), + NumericArgument("1", 1.0), + NumericArgument("-0", -0.0), + NumericArgument("-1", -1.0), + }; + + auto getvalue = [] (JVMFlag* flag) { + return flag->get_double(); + }; + + check_numeric_flag(flag, getvalue, valid_strings, + ARRAY_SIZE(valid_strings), /*is_double=*/true); +} diff --git a/test/hotspot/gtest/runtime/test_largeOptions.cpp b/test/hotspot/gtest/runtime/test_largeOptions.cpp deleted file mode 100644 index a8d5af24915..00000000000 --- a/test/hotspot/gtest/runtime/test_largeOptions.cpp +++ /dev/null @@ -1,108 +0,0 @@ -/* - * Copyright (c) 2022, 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. - */ - -#include "precompiled.hpp" -#include "compiler/compiler_globals.hpp" -#include "runtime/arguments.hpp" -#include "runtime/flags/jvmFlag.hpp" -#include "runtime/globals.hpp" -#include "unittest.hpp" - -class LargeOptionsTest : public ::testing::Test { -public: - static bool test_option_value(const char* option, intx value) { - char buffer[100]; - UnlockDiagnosticVMOptions = true; - os::snprintf(buffer, 100, "%s=" INTX_FORMAT, option, value); - return Arguments::parse_argument(buffer, JVMFlagOrigin::COMMAND_LINE); - } - - static bool test_option_value(const char* option) { - UnlockDiagnosticVMOptions = true; - return Arguments::parse_argument(option, JVMFlagOrigin::COMMAND_LINE); - } -}; - -#ifdef _LP64 -// CompilerDirectivesLimit is a diagnostic int option. -TEST_VM(LARGE_OPTION, large_ints) { - for (intx x = max_jint - 1; x <= (intx)max_jint + 1; x++) { - bool result = LargeOptionsTest::test_option_value("CompilerDirectivesLimit", x); - if (x > max_jint) { - ASSERT_FALSE(result); - } else { - ASSERT_TRUE(result); - ASSERT_EQ(CompilerDirectivesLimit, x); - } - } -} - -TEST_VM(LARGE_OPTION, small_ints) { - for (intx x = min_jint + 1; x >= (intx)min_jint - 1; x--) { - bool result = LargeOptionsTest::test_option_value("CompilerDirectivesLimit", x); - if (x < min_jint) { - ASSERT_FALSE(result); - } else { - ASSERT_TRUE(result); - ASSERT_EQ(CompilerDirectivesLimit, x); - } - } -} - -TEST_VM(LARGE_OPTION, large_int_overflow) { // Test 0x100000000 - ASSERT_FALSE(LargeOptionsTest::test_option_value("CompilerDirectivesLimit", 4294967296)); -} -#endif - -// HandshakeTimeout is a diagnostic uint option. -TEST_VM(LARGE_OPTION, large_uints) { - for (uintx x = max_juint - 1; x <= (uintx)max_juint + 1; x++) { - bool result = LargeOptionsTest::test_option_value("HandshakeTimeout", x); - if (x <= max_juint) { - ASSERT_TRUE(result); - ASSERT_EQ(HandshakeTimeout, x); - } else { - ASSERT_FALSE(result); - } - } -} - -#ifdef _LP64 -// MaxJNILocalCapacity is an intx option. -TEST_VM(LARGE_OPTION, large_intxs) { - // max_intx + 1 equals min_intx! - for (julong x = max_intx - 1; x <= (julong)max_intx + 1; x++) { - ASSERT_TRUE(LargeOptionsTest::test_option_value("MaxJNILocalCapacity", x)); - ASSERT_EQ((julong)MaxJNILocalCapacity, x); - } -} - -TEST_VM(LARGE_OPTION, small_intxs) { - ASSERT_TRUE(LargeOptionsTest::test_option_value("MaxJNILocalCapacity", min_intx + 1)); - ASSERT_EQ(MaxJNILocalCapacity, -9223372036854775807); - ASSERT_TRUE(LargeOptionsTest::test_option_value("MaxJNILocalCapacity", min_intx)); - ASSERT_EQ(MaxJNILocalCapacity, min_intx); - // Test value that's less than min_intx (-0x8000000000000001). - ASSERT_FALSE(LargeOptionsTest::test_option_value("MaxJNILocalCapacity=-9223372036854775809")); -} -#endif -- GitLab From 002e3667443d94e2303c875daf72cf1ccbbb0099 Mon Sep 17 00:00:00 2001 From: Claes Redestad Date: Thu, 17 Mar 2022 21:15:36 +0000 Subject: [PATCH 273/340] 8283325: US_ASCII decoder relies on String.decodeASCII being exhaustive Reviewed-by: rriggs, dcubed --- .../share/classes/java/lang/String.java | 6 ++ .../charset/CharsetDecoder/ASCIIDecode.java | 55 +++++++++++++++++++ 2 files changed, 61 insertions(+) create mode 100644 test/jdk/java/nio/charset/CharsetDecoder/ASCIIDecode.java diff --git a/src/java.base/share/classes/java/lang/String.java b/src/java.base/share/classes/java/lang/String.java index 3c3a2ba28f0..009a61a9ba3 100644 --- a/src/java.base/share/classes/java/lang/String.java +++ b/src/java.base/share/classes/java/lang/String.java @@ -1032,6 +1032,12 @@ public final class String /* package-private */ static int decodeASCII(byte[] sa, int sp, char[] da, int dp, int len) { int count = StringCoding.countPositives(sa, sp, len); + while (count < len) { + if (sa[sp + count] < 0) { + break; + } + count++; + } StringLatin1.inflate(sa, sp, da, dp, count); return count; } diff --git a/test/jdk/java/nio/charset/CharsetDecoder/ASCIIDecode.java b/test/jdk/java/nio/charset/CharsetDecoder/ASCIIDecode.java new file mode 100644 index 00000000000..330c2c49a07 --- /dev/null +++ b/test/jdk/java/nio/charset/CharsetDecoder/ASCIIDecode.java @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* @test + * @bug 8283325 + * @summary Ensure that decoding to ASCII from a stream with a non-ASCII + * character correctly decodes up until the byte in error. + */ + +import java.nio.*; +import java.nio.charset.*; +import java.util.Arrays; + +public class ASCIIDecode { + + public static void main(String[] args) throws Exception { + final Charset ascii = Charset.forName("US-ASCII"); + final CharsetDecoder decoder = ascii.newDecoder(); + + byte[] ba = new byte[] { 0x60, 0x60, 0x60, (byte)0xFF }; + + // Repeat enough times to test that interpreter and JIT:ed versions + // behave the same (without the patch for 8283325 this fails within + // 50 000 iterations on the system used for verification) + for (int i = 0; i < 100_000; i++) { + ByteBuffer bb = ByteBuffer.wrap(ba); + char[] ca = new char[4]; + CharBuffer cb = CharBuffer.wrap(ca); + CoderResult buf = decoder.decode(bb, cb, true); + if (ca[0] != 0x60 || ca[1] != 0x60 || ca[2] != 0x60) { + throw new RuntimeException("Unexpected output on iteration " + i); + } + } + } +} -- GitLab From d83cee98b5e6628f19f1b5dea11038079dd0c758 Mon Sep 17 00:00:00 2001 From: Alexander Matveev Date: Fri, 18 Mar 2022 03:14:32 +0000 Subject: [PATCH 274/340] 8282407: Missing ')' in MacResources.properties Reviewed-by: naoto --- .../jdk/jpackage/internal/resources/MacResources.properties | 4 ++-- .../jpackage/internal/resources/MacResources_ja.properties | 4 ++-- .../jpackage/internal/resources/MacResources_zh_CN.properties | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/resources/MacResources.properties b/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/resources/MacResources.properties index 23a4f9d0437..25a9facea5f 100644 --- a/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/resources/MacResources.properties +++ b/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/resources/MacResources.properties @@ -1,5 +1,5 @@ # -# Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2017, 2022, 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 @@ -80,7 +80,7 @@ message.building-dmg=Building DMG package for {0}. message.running-script=Running shell script on application image [{0}]. message.preparing-dmg-setup=Preparing dmg setup: {0}. message.creating-dmg-file=Creating DMG file: {0}. -message.dmg-cannot-be-overwritten=Dmg file exists ({0} and can not be removed. +message.dmg-cannot-be-overwritten=Dmg file exists [{0}] and can not be removed. message.output-to-location=Result DMG installer for {0}: {1}. message.building-pkg=Building PKG package for {0}. message.preparing-scripts=Preparing package scripts. diff --git a/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/resources/MacResources_ja.properties b/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/resources/MacResources_ja.properties index d9da226ec92..291130fb237 100644 --- a/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/resources/MacResources_ja.properties +++ b/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/resources/MacResources_ja.properties @@ -1,5 +1,5 @@ # -# Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2017, 2022, 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 @@ -79,7 +79,7 @@ message.building-dmg={0}\u306EDMG\u30D1\u30C3\u30B1\u30FC\u30B8\u3092\u4F5C\u621 message.running-script=\u30A2\u30D7\u30EA\u30B1\u30FC\u30B7\u30E7\u30F3\u30FB\u30A4\u30E1\u30FC\u30B8[{0}]\u3067\u30B7\u30A7\u30EB\u30FB\u30B9\u30AF\u30EA\u30D7\u30C8\u3092\u5B9F\u884C\u3057\u3066\u3044\u307E\u3059\u3002 message.preparing-dmg-setup=dmg\u306E\u8A2D\u5B9A\u3092\u6E96\u5099\u3057\u3066\u3044\u307E\u3059: {0} message.creating-dmg-file=DMG\u30D5\u30A1\u30A4\u30EB\u3092\u4F5C\u6210\u3057\u3066\u3044\u307E\u3059: {0} -message.dmg-cannot-be-overwritten=Dmg\u30D5\u30A1\u30A4\u30EB\u306F\u5B58\u5728\u3057({0}\u3001\u524A\u9664\u3067\u304D\u307E\u305B\u3093\u3002 +message.dmg-cannot-be-overwritten=Dmg\u30D5\u30A1\u30A4\u30EB\u306F\u5B58\u5728\u3057[{0}]\u3001\u524A\u9664\u3067\u304D\u307E\u305B\u3093\u3002 message.output-to-location={0}\u306E\u7D50\u679C\u306EDMG\u30A4\u30F3\u30B9\u30C8\u30FC\u30E9: {1} message.building-pkg={0}\u306EPKG\u30D1\u30C3\u30B1\u30FC\u30B8\u3092\u4F5C\u6210\u3057\u3066\u3044\u307E\u3059 message.preparing-scripts=\u30D1\u30C3\u30B1\u30FC\u30B8\u30FB\u30B9\u30AF\u30EA\u30D7\u30C8\u3092\u6E96\u5099\u3057\u3066\u3044\u307E\u3059 diff --git a/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/resources/MacResources_zh_CN.properties b/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/resources/MacResources_zh_CN.properties index d6f47a7bc85..ecf9e8796d5 100644 --- a/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/resources/MacResources_zh_CN.properties +++ b/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/resources/MacResources_zh_CN.properties @@ -1,5 +1,5 @@ # -# Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2017, 2022, 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 @@ -79,7 +79,7 @@ message.building-dmg=\u6B63\u5728\u4E3A {0} \u6784\u5EFA DMG \u7A0B\u5E8F\u5305\ message.running-script=\u6B63\u5728\u5E94\u7528\u7A0B\u5E8F\u6620\u50CF [{0}] \u4E0A\u8FD0\u884C shell \u811A\u672C\u3002 message.preparing-dmg-setup=\u6B63\u5728\u51C6\u5907 dmg \u8BBE\u7F6E: {0}\u3002 message.creating-dmg-file=\u6B63\u5728\u521B\u5EFA DMG \u6587\u4EF6: {0}\u3002 -message.dmg-cannot-be-overwritten=Dmg \u6587\u4EF6\u5DF2\u5B58\u5728 ({0}) \u4E14\u65E0\u6CD5\u5220\u9664\u3002 +message.dmg-cannot-be-overwritten=Dmg \u6587\u4EF6\u5DF2\u5B58\u5728 [{0}] \u4E14\u65E0\u6CD5\u5220\u9664\u3002 message.output-to-location=\u4E3A {0} \u751F\u6210\u7684 DMG \u5B89\u88C5\u7A0B\u5E8F: {1}\u3002 message.building-pkg=\u6B63\u5728\u4E3A {0} \u6784\u5EFA PKG \u7A0B\u5E8F\u5305\u3002 message.preparing-scripts=\u6B63\u5728\u51C6\u5907\u7A0B\u5E8F\u5305\u811A\u672C\u3002 -- GitLab From cab4ff64541393a974ea91e35167668ef0036804 Mon Sep 17 00:00:00 2001 From: Tyler Steele Date: Fri, 18 Mar 2022 07:02:26 +0000 Subject: [PATCH 275/340] 8283225: ClassLoader.c produces incorrect OutOfMemory Exception when length is 0 (aix) Reviewed-by: stuefe, rriggs, dholmes --- src/java.base/share/native/libjava/ClassLoader.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/java.base/share/native/libjava/ClassLoader.c b/src/java.base/share/native/libjava/ClassLoader.c index bbdff87b0b3..da34a7b438b 100644 --- a/src/java.base/share/native/libjava/ClassLoader.c +++ b/src/java.base/share/native/libjava/ClassLoader.c @@ -99,7 +99,12 @@ Java_java_lang_ClassLoader_defineClass1(JNIEnv *env, return 0; } + // On AIX malloc(0) returns NULL which looks like an out-of-memory condition; so adjust it to malloc(1) + #ifdef _AIX + body = (jbyte *)malloc(length == 0 ? 1 : length); + #else body = (jbyte *)malloc(length); + #endif if (body == 0) { JNU_ThrowOutOfMemoryError(env, 0); @@ -239,7 +244,13 @@ Java_java_lang_ClassLoader_defineClass0(JNIEnv *env, return 0; } + // On AIX malloc(0) returns NULL which looks like an out-of-memory condition; so adjust it to malloc(1) + #ifdef _AIX + body = (jbyte *)malloc(length == 0 ? 1 : length); + #else body = (jbyte *)malloc(length); + #endif + if (body == 0) { JNU_ThrowOutOfMemoryError(env, 0); return 0; -- GitLab From b96cb048f1a7f3ae6e745b245f2b04c64ebb911e Mon Sep 17 00:00:00 2001 From: Jie Fu Date: Fri, 18 Mar 2022 07:58:58 +0000 Subject: [PATCH 276/340] 8283353: compiler/c2/cr6865031/Test.java and compiler/runtime/Test6826736.java fails on x86_32 Reviewed-by: chagedorn --- test/hotspot/jtreg/compiler/c2/cr6865031/Test.java | 2 ++ test/hotspot/jtreg/compiler/runtime/Test6826736.java | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/test/hotspot/jtreg/compiler/c2/cr6865031/Test.java b/test/hotspot/jtreg/compiler/c2/cr6865031/Test.java index 71689eaca18..af23628577b 100644 --- a/test/hotspot/jtreg/compiler/c2/cr6865031/Test.java +++ b/test/hotspot/jtreg/compiler/c2/cr6865031/Test.java @@ -1,5 +1,6 @@ /* * Copyright 2009 Goldman Sachs International. All Rights Reserved. + * Copyright (C) 2022 THL A29 Limited, a Tencent company. 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 @@ -27,6 +28,7 @@ * @bug 6865031 * @summary Application gives bad result (throws bad exception) with compressed oops * + * @requires vm.bits == 64 * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+UseCompressedOops * -XX:HeapBaseMinAddress=32g -XX:-LoopUnswitching * -XX:CompileCommand=inline,compiler.c2.cr6865031.AbstractMemoryEfficientList::equals diff --git a/test/hotspot/jtreg/compiler/runtime/Test6826736.java b/test/hotspot/jtreg/compiler/runtime/Test6826736.java index 2f078506e55..0b028947f77 100644 --- a/test/hotspot/jtreg/compiler/runtime/Test6826736.java +++ b/test/hotspot/jtreg/compiler/runtime/Test6826736.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2022, 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,6 +26,7 @@ * @bug 6826736 * @summary CMS: core dump with -XX:+UseCompressedOops * + * @requires vm.bits == 64 * @run main/othervm/timeout=600 -XX:+IgnoreUnrecognizedVMOptions -Xbatch * -XX:+ScavengeALot -XX:+UseCompressedOops -XX:HeapBaseMinAddress=32g * -XX:CompileThreshold=100 -XX:-BlockLayoutRotateLoops -- GitLab From 4b5079b9836c1cc881f571d060b310f58c8a860c Mon Sep 17 00:00:00 2001 From: Erik Gahlin Date: Fri, 18 Mar 2022 13:18:38 +0000 Subject: [PATCH 277/340] 8283202: Potential off-read when checking JFR's status in awaitFinished Reviewed-by: mgronlun --- .../jfr/internal/consumer/ChunkHeader.java | 22 +++++++++++-------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/src/jdk.jfr/share/classes/jdk/jfr/internal/consumer/ChunkHeader.java b/src/jdk.jfr/share/classes/jdk/jfr/internal/consumer/ChunkHeader.java index 54687725b74..550878888cd 100644 --- a/src/jdk.jfr/share/classes/jdk/jfr/internal/consumer/ChunkHeader.java +++ b/src/jdk.jfr/share/classes/jdk/jfr/internal/consumer/ChunkHeader.java @@ -109,14 +109,19 @@ public final class ChunkHeader { input.position(absoluteEventStart); } + private byte readFileState() throws IOException { + byte fs; + input.positionPhysical(absoluteChunkStart + FILE_STATE_POSITION); + while ((fs = input.readPhysicalByte()) == UPDATING_CHUNK_HEADER) { + Utils.takeNap(1); + input.positionPhysical(absoluteChunkStart + FILE_STATE_POSITION); + } + return fs; + } + public void refresh() throws IOException { while (true) { - byte fileState1; - input.positionPhysical(absoluteChunkStart + FILE_STATE_POSITION); - while ((fileState1 = input.readPhysicalByte()) == UPDATING_CHUNK_HEADER) { - Utils.takeNap(1); - input.positionPhysical(absoluteChunkStart + FILE_STATE_POSITION); - } + byte fileState1 = readFileState(); input.positionPhysical(absoluteChunkStart + CHUNK_SIZE_POSITION); long chunkSize = input.readPhysicalLong(); long constantPoolPosition = input.readPhysicalLong(); @@ -169,10 +174,9 @@ public final class ChunkHeader { } long pos = input.position(); try { - input.positionPhysical(absoluteChunkStart + FILE_STATE_POSITION); while (true) { - byte filestate = input.readPhysicalByte(); - if (filestate == 0) { + byte fileState = readFileState(); + if (fileState == 0) { finished = true; return; } -- GitLab From c72bcfc1b230d22137ac7f683cf46dc70b6e3d16 Mon Sep 17 00:00:00 2001 From: Erik Gahlin Date: Fri, 18 Mar 2022 13:27:49 +0000 Subject: [PATCH 278/340] 8283289: JFR: Rename CheckPoint Reviewed-by: mgronlun --- .../jfr/internal/consumer/ChunkParser.java | 12 ++++---- .../consumer/filter/CheckPointEvent.java | 14 ++++----- .../consumer/filter/CheckPointPool.java | 4 +-- .../internal/consumer/filter/ChunkWriter.java | 30 +++++++++---------- .../jdk/jfr/internal/tool/Summary.java | 2 +- .../jdk/management/jfr/DiskRepository.java | 8 ++--- 6 files changed, 35 insertions(+), 35 deletions(-) diff --git a/src/jdk.jfr/share/classes/jdk/jfr/internal/consumer/ChunkParser.java b/src/jdk.jfr/share/classes/jdk/jfr/internal/consumer/ChunkParser.java index 8a392d985c5..9d88adcf478 100644 --- a/src/jdk.jfr/share/classes/jdk/jfr/internal/consumer/ChunkParser.java +++ b/src/jdk.jfr/share/classes/jdk/jfr/internal/consumer/ChunkParser.java @@ -41,7 +41,7 @@ import jdk.jfr.internal.LongMap; import jdk.jfr.internal.MetadataDescriptor; import jdk.jfr.internal.Type; import jdk.jfr.internal.Utils; -import jdk.jfr.internal.consumer.filter.CheckPointEvent; +import jdk.jfr.internal.consumer.filter.CheckpointEvent; import jdk.jfr.internal.consumer.filter.ChunkWriter; /** @@ -77,7 +77,7 @@ public final class ChunkParser { } } - private enum CheckPointType { + private enum CheckpointType { // Checkpoint that finishes a flush segment FLUSH(1), // Checkpoint contains chunk header information in the first pool @@ -87,7 +87,7 @@ public final class ChunkParser { // Checkpoint contains thread related information THREAD(8); private final int mask; - private CheckPointType(int mask) { + private CheckpointType(int mask) { this.mask = mask; } @@ -267,7 +267,7 @@ public final class ChunkParser { // Not accepted by filter } else { if (typeId == 1) { // checkpoint event - if (CheckPointType.FLUSH.is(parseCheckpointType())) { + if (CheckpointType.FLUSH.is(parseCheckpointType())) { input.position(pos + size); return FLUSH_MARKER; } @@ -317,9 +317,9 @@ public final class ChunkParser { long delta = -1; boolean logTrace = Logger.shouldLog(LogTag.JFR_SYSTEM_PARSER, LogLevel.TRACE); while (thisCP != abortCP && delta != 0) { - CheckPointEvent cp = null; + CheckpointEvent cp = null; if (configuration.chunkWriter != null) { - cp = configuration.chunkWriter.newCheckPointEvent(thisCP); + cp = configuration.chunkWriter.newCheckpointEvent(thisCP); } input.position(thisCP); lastCP = thisCP; diff --git a/src/jdk.jfr/share/classes/jdk/jfr/internal/consumer/filter/CheckPointEvent.java b/src/jdk.jfr/share/classes/jdk/jfr/internal/consumer/filter/CheckPointEvent.java index a2c1723a1e3..72f40c0e7a7 100644 --- a/src/jdk.jfr/share/classes/jdk/jfr/internal/consumer/filter/CheckPointEvent.java +++ b/src/jdk.jfr/share/classes/jdk/jfr/internal/consumer/filter/CheckPointEvent.java @@ -35,12 +35,12 @@ import jdk.jfr.internal.Type; *

    * All positional values are relative to file start, not the chunk. */ -public final class CheckPointEvent { +public final class CheckpointEvent { private final ChunkWriter chunkWriter; - private final LinkedHashMap pools = new LinkedHashMap<>(); + private final LinkedHashMap pools = new LinkedHashMap<>(); private final long startPosition; - public CheckPointEvent(ChunkWriter chunkWriter, long startPosition) { + public CheckpointEvent(ChunkWriter chunkWriter, long startPosition) { this.chunkWriter = chunkWriter; this.startPosition = startPosition; } @@ -48,7 +48,7 @@ public final class CheckPointEvent { public PoolEntry addEntry(Type type, long id, long startPosition, long endPosition, Object references) { long typeId = type.getId(); PoolEntry pe = new PoolEntry(startPosition, endPosition, type, id, references); - var cpp = pools.computeIfAbsent(typeId, k -> new CheckPointPool(typeId)); + var cpp = pools.computeIfAbsent(typeId, k -> new CheckpointPool(typeId)); cpp.add(pe); chunkWriter.getPool(type).add(id, pe); return pe; @@ -56,7 +56,7 @@ public final class CheckPointEvent { public long touchedPools() { int count = 0; - for (CheckPointPool cpp : pools.values()) { + for (CheckpointPool cpp : pools.values()) { if (cpp.isTouched()) { count++; } @@ -64,7 +64,7 @@ public final class CheckPointEvent { return count; } - public Collection getPools() { + public Collection getPools() { return pools.values(); } @@ -74,7 +74,7 @@ public final class CheckPointEvent { public String toString() { StringBuilder sb = new StringBuilder(); - for (CheckPointPool p : pools.values()) { + for (CheckpointPool p : pools.values()) { for (var e : p.getEntries()) { if (e.isTouched()) { sb.append(e.getType().getName() + " " + e.getId() + "\n"); diff --git a/src/jdk.jfr/share/classes/jdk/jfr/internal/consumer/filter/CheckPointPool.java b/src/jdk.jfr/share/classes/jdk/jfr/internal/consumer/filter/CheckPointPool.java index 3b0ca0f58eb..d4b1ce926be 100644 --- a/src/jdk.jfr/share/classes/jdk/jfr/internal/consumer/filter/CheckPointPool.java +++ b/src/jdk.jfr/share/classes/jdk/jfr/internal/consumer/filter/CheckPointPool.java @@ -29,11 +29,11 @@ import java.util.List; /** * Represents a constant pool in a checkpoint, both entries and type id */ -final class CheckPointPool { +final class CheckpointPool { private final List entries = new ArrayList<>(); private final long typeId; - public CheckPointPool(long typeId) { + public CheckpointPool(long typeId) { this.typeId = typeId; } diff --git a/src/jdk.jfr/share/classes/jdk/jfr/internal/consumer/filter/ChunkWriter.java b/src/jdk.jfr/share/classes/jdk/jfr/internal/consumer/filter/ChunkWriter.java index 1a1cc236359..8c22432512a 100644 --- a/src/jdk.jfr/share/classes/jdk/jfr/internal/consumer/filter/ChunkWriter.java +++ b/src/jdk.jfr/share/classes/jdk/jfr/internal/consumer/filter/ChunkWriter.java @@ -51,7 +51,7 @@ import jdk.jfr.internal.consumer.Reference; */ public final class ChunkWriter implements Closeable { private LongMap pools = new LongMap<>(); - private final Deque checkPoints = new ArrayDeque<>(); + private final Deque checkpoints = new ArrayDeque<>(); private final Path destination; private final RecordingInput input; private final RecordingOutput output; @@ -59,7 +59,7 @@ public final class ChunkWriter implements Closeable { private long chunkStartPosition; private boolean chunkComplete; - private long lastCheckPoint; + private long lastCheckpoint; public ChunkWriter(Path source, Path destination, Predicate filter) throws IOException { this.destination = destination; @@ -78,9 +78,9 @@ public final class ChunkWriter implements Closeable { return pool; } - public CheckPointEvent newCheckPointEvent(long startPosition) { - CheckPointEvent event = new CheckPointEvent(this, startPosition); - checkPoints.add(event); + public CheckpointEvent newCheckpointEvent(long startPosition) { + CheckpointEvent event = new CheckpointEvent(this, startPosition); + checkpoints.add(event); return event; } @@ -120,16 +120,16 @@ public final class ChunkWriter implements Closeable { // Write check point events before a position private void writeCheckpointEvents(long before) throws IOException { - CheckPointEvent cp = checkPoints.peek(); + CheckpointEvent cp = checkpoints.peek(); while (cp != null && cp.getStartPosition() < before) { - checkPoints.poll(); + checkpoints.poll(); long delta = 0; - if (lastCheckPoint != 0) { - delta = lastCheckPoint - output.position(); + if (lastCheckpoint != 0) { + delta = lastCheckpoint - output.position(); } - lastCheckPoint = output.position(); + lastCheckpoint = output.position(); write(cp, delta); - cp = checkPoints.peek(); + cp = checkpoints.peek(); } } @@ -174,10 +174,10 @@ public final class ChunkWriter implements Closeable { writeCheckpointEvents(Long.MAX_VALUE); long metadata = output.position(); writeMetadataEvent(header); - updateHeader(output.position(), lastCheckPoint, metadata); + updateHeader(output.position(), lastCheckpoint, metadata); pools = new LongMap<>(); chunkComplete = true; - lastCheckPoint = 0; + lastCheckpoint = 0; } private void writeMetadataEvent(ChunkHeader header) throws IOException { @@ -190,7 +190,7 @@ public final class ChunkWriter implements Closeable { } } - private void write(CheckPointEvent event, long delta) throws IOException { + private void write(CheckpointEvent event, long delta) throws IOException { input.position(event.getStartPosition()); long startPosition = output.position(); @@ -205,7 +205,7 @@ public final class ChunkWriter implements Closeable { // Write even if touched pools are zero, checkpoint works as sync point output.writeLong(event.touchedPools()); // Pool count - for (CheckPointPool pool : event.getPools()) { + for (CheckpointPool pool : event.getPools()) { if (pool.isTouched()) { output.writeLong(pool.getTypeId()); output.writeLong(pool.getTouchedCount()); diff --git a/src/jdk.jfr/share/classes/jdk/jfr/internal/tool/Summary.java b/src/jdk.jfr/share/classes/jdk/jfr/internal/tool/Summary.java index 767ccf63507..850e995acf3 100644 --- a/src/jdk.jfr/share/classes/jdk/jfr/internal/tool/Summary.java +++ b/src/jdk.jfr/share/classes/jdk/jfr/internal/tool/Summary.java @@ -100,7 +100,7 @@ final class Summary extends Command { } HashMap stats = new HashMap<>(); stats.put(0L, new Statistics(eventPrefix + "Metadata")); - stats.put(1L, new Statistics(eventPrefix + "CheckPoint")); + stats.put(1L, new Statistics(eventPrefix + "Checkpoint")); int minWidth = 0; while (true) { long chunkEnd = ch.getEnd(); diff --git a/src/jdk.management.jfr/share/classes/jdk/management/jfr/DiskRepository.java b/src/jdk.management.jfr/share/classes/jdk/management/jfr/DiskRepository.java index 7ce5f9c9360..d8ff2debe9e 100644 --- a/src/jdk.management.jfr/share/classes/jdk/management/jfr/DiskRepository.java +++ b/src/jdk.management.jfr/share/classes/jdk/management/jfr/DiskRepository.java @@ -179,7 +179,7 @@ final class DiskRepository implements Closeable { bufferIndex = 0; break; case CHECKPOINT_EVENT_HEADER_BYTE_ARRAY_CONTENT: - processCheckPointHeader(); + processCheckpointHeader(); break; case CHECKPOINT_EVENT_FLUSH_TYPE: processFlush(); @@ -286,10 +286,10 @@ final class DiskRepository implements Closeable { } } - private void processCheckPointHeader() throws IOException { + private void processCheckpointHeader() throws IOException { buffer.put(bufferIndex, nextByte(true)); if (bufferIndex == HEADER_SIZE) { - writeCheckPointHeader(); + writeCheckpointHeader(); state = State.EVENT_PAYLOAD; bufferIndex = 0; } @@ -321,7 +321,7 @@ final class DiskRepository implements Closeable { } } - private void writeCheckPointHeader() throws IOException { + private void writeCheckpointHeader() throws IOException { Objects.requireNonNull(raf); byte state = buffer.get(HEADER_FILE_STATE_POSITION); boolean complete = state == COMPLETE_STATE; -- GitLab From 85cc6f1440aa7e073cab894cb9a72d9eed4e8369 Mon Sep 17 00:00:00 2001 From: Andrew Leonard Date: Fri, 18 Mar 2022 13:40:35 +0000 Subject: [PATCH 279/340] 8283315: jrt-fs.jar not always deterministically built Reviewed-by: ihse --- make/common/JarArchive.gmk | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/make/common/JarArchive.gmk b/make/common/JarArchive.gmk index 5a87e471428..26b08fc1509 100644 --- a/make/common/JarArchive.gmk +++ b/make/common/JarArchive.gmk @@ -1,5 +1,5 @@ # -# Copyright (c) 2011, 2021, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2011, 2022, 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 @@ -193,7 +193,8 @@ define SetupJarArchiveBody $1_UPDATE_CONTENTS=\ if [ "`$(WC) -l $$($1_BIN)/_the.$$($1_JARNAME)_contents | $(AWK) '{ print $$$$1 }'`" -gt "0" ]; then \ $(ECHO) " updating" `$(WC) -l $$($1_BIN)/_the.$$($1_JARNAME)_contents | $(AWK) '{ print $$$$1 }'` files && \ - $$($1_JAR_CMD) --update $$($1_JAR_OPTIONS) --file $$@ @$$($1_BIN)/_the.$$($1_JARNAME)_contents; \ + $(SORT) $$($1_BIN)/_the.$$($1_JARNAME)_contents > $$($1_BIN)/_the.$$($1_JARNAME)_contents_sorted && \ + $$($1_JAR_CMD) --update $$($1_JAR_OPTIONS) --file $$@ @$$($1_BIN)/_the.$$($1_JARNAME)_contents_sorted; \ fi $$(NEWLINE) # The s-variants of the above macros are used when the jar is created from scratch. # NOTICE: please leave the parentheses space separated otherwise the AIX build will break! @@ -212,7 +213,9 @@ define SetupJarArchiveBody | $(SED) 's|$$(src)/|-C $$(src) |g' >> \ $$($1_BIN)/_the.$$($1_JARNAME)_contents) $$(NEWLINE) ) endif - $1_SUPDATE_CONTENTS=$$($1_JAR_CMD) --update $$($1_JAR_OPTIONS) --file $$@ @$$($1_BIN)/_the.$$($1_JARNAME)_contents $$(NEWLINE) + $1_SUPDATE_CONTENTS=\ + $(SORT) $$($1_BIN)/_the.$$($1_JARNAME)_contents > $$($1_BIN)/_the.$$($1_JARNAME)_contents_sorted && \ + $$($1_JAR_CMD) --update $$($1_JAR_OPTIONS) --file $$@ @$$($1_BIN)/_the.$$($1_JARNAME)_contents_sorted $$(NEWLINE) # Use a slightly shorter name for logging, but with enough path to identify this jar. $1_NAME:=$$(subst $$(OUTPUTDIR)/,,$$($1_JAR)) -- GitLab From b2aa085e67711a32e1679b68aabb092058dca044 Mon Sep 17 00:00:00 2001 From: Erik Gahlin Date: Fri, 18 Mar 2022 14:54:56 +0000 Subject: [PATCH 280/340] 8283378: JFR: Checkpoint classes not renamed properly Reviewed-by: dcubed --- .../filter/{CheckPointEvent.java => CheckpointEvent.java} | 0 .../consumer/filter/{CheckPointPool.java => CheckpointPool.java} | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename src/jdk.jfr/share/classes/jdk/jfr/internal/consumer/filter/{CheckPointEvent.java => CheckpointEvent.java} (100%) rename src/jdk.jfr/share/classes/jdk/jfr/internal/consumer/filter/{CheckPointPool.java => CheckpointPool.java} (100%) diff --git a/src/jdk.jfr/share/classes/jdk/jfr/internal/consumer/filter/CheckPointEvent.java b/src/jdk.jfr/share/classes/jdk/jfr/internal/consumer/filter/CheckpointEvent.java similarity index 100% rename from src/jdk.jfr/share/classes/jdk/jfr/internal/consumer/filter/CheckPointEvent.java rename to src/jdk.jfr/share/classes/jdk/jfr/internal/consumer/filter/CheckpointEvent.java diff --git a/src/jdk.jfr/share/classes/jdk/jfr/internal/consumer/filter/CheckPointPool.java b/src/jdk.jfr/share/classes/jdk/jfr/internal/consumer/filter/CheckpointPool.java similarity index 100% rename from src/jdk.jfr/share/classes/jdk/jfr/internal/consumer/filter/CheckPointPool.java rename to src/jdk.jfr/share/classes/jdk/jfr/internal/consumer/filter/CheckpointPool.java -- GitLab From ff0b0927a2df8b36f8fd6ed41bd4e20e71a5b653 Mon Sep 17 00:00:00 2001 From: Ravi Reddy Date: Fri, 18 Mar 2022 15:31:30 +0000 Subject: [PATCH 281/340] 8278794: Infinite loop in DeflaterOutputStream.finish() Reviewed-by: coffeys, lancea --- .../share/classes/java/util/zip/Deflater.java | 12 +- .../java/util/zip/DeflaterOutputStream.java | 14 +- .../java/util/zip/ZipOutputStream.java | 4 +- test/jdk/java/util/zip/CloseDeflaterTest.java | 147 ------------- .../util/zip/CloseInflaterDeflaterTest.java | 208 ++++++++++++++++++ 5 files changed, 231 insertions(+), 154 deletions(-) delete mode 100644 test/jdk/java/util/zip/CloseDeflaterTest.java create mode 100644 test/jdk/java/util/zip/CloseInflaterDeflaterTest.java diff --git a/src/java.base/share/classes/java/util/zip/Deflater.java b/src/java.base/share/classes/java/util/zip/Deflater.java index d41b8a7e126..155264e4afe 100644 --- a/src/java.base/share/classes/java/util/zip/Deflater.java +++ b/src/java.base/share/classes/java/util/zip/Deflater.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2022, 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 @@ -895,6 +895,16 @@ public class Deflater { throw new NullPointerException("Deflater has been closed"); } + /** + * Returns the value of 'finish' flag. + * 'finish' will be set to true if def.finish() method is called. + */ + boolean shouldFinish() { + synchronized (zsRef) { + return finish; + } + } + private static native long init(int level, int strategy, boolean nowrap); private static native void setDictionary(long addr, byte[] b, int off, int len); diff --git a/src/java.base/share/classes/java/util/zip/DeflaterOutputStream.java b/src/java.base/share/classes/java/util/zip/DeflaterOutputStream.java index 7dfbd7f9edb..c856d8999b3 100644 --- a/src/java.base/share/classes/java/util/zip/DeflaterOutputStream.java +++ b/src/java.base/share/classes/java/util/zip/DeflaterOutputStream.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2022, 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 @@ -220,9 +220,15 @@ public class DeflaterOutputStream extends FilterOutputStream { */ public void finish() throws IOException { if (!def.finished()) { - def.finish(); - while (!def.finished()) { - deflate(); + try{ + def.finish(); + while (!def.finished()) { + deflate(); + } + } catch(IOException e) { + if (usesDefaultDeflater) + def.end(); + throw e; } } } diff --git a/src/java.base/share/classes/java/util/zip/ZipOutputStream.java b/src/java.base/share/classes/java/util/zip/ZipOutputStream.java index 1b8ed562d9f..d11eb4d4aae 100644 --- a/src/java.base/share/classes/java/util/zip/ZipOutputStream.java +++ b/src/java.base/share/classes/java/util/zip/ZipOutputStream.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2022, 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 @@ -314,7 +314,7 @@ public class ZipOutputStream extends DeflaterOutputStream implements ZipConstant crc.reset(); current = null; } catch (IOException e) { - if (usesDefaultDeflater && !(e instanceof ZipException)) + if (def.shouldFinish() && usesDefaultDeflater && !(e instanceof ZipException)) def.end(); throw e; } diff --git a/test/jdk/java/util/zip/CloseDeflaterTest.java b/test/jdk/java/util/zip/CloseDeflaterTest.java deleted file mode 100644 index 8aa4960f543..00000000000 --- a/test/jdk/java/util/zip/CloseDeflaterTest.java +++ /dev/null @@ -1,147 +0,0 @@ -/* - * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/** - * @test - * @bug 8193682 - * @summary Test Infinite loop while writing on closed GZipOutputStream , ZipOutputStream and JarOutputStream. - * @run testng CloseDeflaterTest - */ -import java.io.*; -import java.util.Random; -import java.util.jar.JarOutputStream; -import java.util.zip.GZIPOutputStream; -import java.util.zip.ZipOutputStream; -import java.util.zip.ZipEntry; - -import org.testng.annotations.BeforeTest; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; -import static org.testng.Assert.fail; - - -public class CloseDeflaterTest { - - //number of bytes to write - private static final int INPUT_LENGTH= 512; - //OutputStream that will throw an exception during a write operation - private static OutputStream outStream = new OutputStream() { - @Override - public void write(byte[] b, int off, int len) throws IOException { - //throw exception during write - throw new IOException(); - } - @Override - public void write(byte b[]) throws IOException {} - @Override - public void write(int b) throws IOException {} - }; - private static byte[] inputBytes = new byte[INPUT_LENGTH]; - private static Random rand = new Random(); - - @DataProvider(name = "testgzipinput") - public Object[][] testGZipInput() { - //testGZip will close the GZipOutputStream using close() method when the boolean - //useCloseMethod is set to true and finish() method if the value is set to false - return new Object[][] { - { GZIPOutputStream.class, true }, - { GZIPOutputStream.class, false }, - }; - } - - @DataProvider(name = "testzipjarinput") - public Object[][] testZipAndJarInput() { - //testZipAndJarInput will perfrom write/closeEntry operations on JarOutputStream when the boolean - //useJar is set to true and on ZipOutputStream if the value is set to false - return new Object[][] { - { JarOutputStream.class, true }, - { ZipOutputStream.class, false }, - }; - } - - @BeforeTest - public void before_test() - { - //add inputBytes array with random bytes to write into Zip - rand.nextBytes(inputBytes); - } - - //Test for infinite loop by writing bytes to closed GZIPOutputStream - @Test(dataProvider = "testgzipinput") - public void testGZip(Class type, boolean useCloseMethod) throws IOException { - GZIPOutputStream zip = new GZIPOutputStream(outStream); - try { - zip.write(inputBytes, 0, INPUT_LENGTH); - //close zip - if(useCloseMethod) { - zip.close(); - } else { - zip.finish(); - } - } catch (IOException e) { - //expected - } - for (int i = 0; i < 3; i++) { - try { - //write on a closed GZIPOutputStream - zip.write(inputBytes, 0, INPUT_LENGTH); - fail("Deflater closed exception not thrown"); - } catch (NullPointerException e) { - //expected , Deflater has been closed exception - } - } - } - - //Test for infinite loop by writing bytes to closed ZipOutputStream/JarOutputStream - @Test(dataProvider = "testzipjarinput") - public void testZipCloseEntry(Class type,boolean useJar) throws IOException { - ZipOutputStream zip = null; - if(useJar) { - zip = new JarOutputStream(outStream); - } else { - zip = new ZipOutputStream(outStream); - } - try { - zip.putNextEntry(new ZipEntry("")); - } catch (IOException e) { - //expected to throw IOException since putNextEntry calls write method - } - try { - zip.write(inputBytes, 0, INPUT_LENGTH); - //close zip entry - zip.closeEntry(); - } catch (IOException e) { - //expected - } - for (int i = 0; i < 3; i++) { - try { - //write on a closed ZipOutputStream - zip.write(inputBytes, 0, INPUT_LENGTH); - fail("Deflater closed exception not thrown"); - } catch (NullPointerException e) { - //expected , Deflater has been closed exception - } - } - } - -} diff --git a/test/jdk/java/util/zip/CloseInflaterDeflaterTest.java b/test/jdk/java/util/zip/CloseInflaterDeflaterTest.java new file mode 100644 index 00000000000..4f0fafc8dbe --- /dev/null +++ b/test/jdk/java/util/zip/CloseInflaterDeflaterTest.java @@ -0,0 +1,208 @@ +/* + * Copyright (c) 2021, 2022, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/** + * @test + * @bug 8193682 8278794 + * @summary Test Infinite loop while writing on closed Deflater and Inflater. + * @run testng CloseInflaterDeflaterTest + */ +import java.io.*; +import java.util.Random; +import java.util.jar.JarOutputStream; +import java.util.zip.DeflaterInputStream; +import java.util.zip.DeflaterOutputStream; +import java.util.zip.GZIPOutputStream; +import java.util.zip.InflaterOutputStream; +import java.util.zip.ZipOutputStream; +import java.util.zip.ZipEntry; + +import org.testng.annotations.BeforeTest; +import org.testng.annotations.DataProvider; +import org.testng.annotations.Test; +import static org.testng.Assert.assertThrows; + + +public class CloseInflaterDeflaterTest { + + // Number of bytes to write/read from Deflater/Inflater + private static final int INPUT_LENGTH= 512; + // OutputStream that will throw an exception during a write operation + private static OutputStream outStream = new OutputStream() { + @Override + public void write(byte[] b, int off, int len) throws IOException { + throw new IOException(); + } + @Override + public void write(byte[] b) throws IOException {} + @Override + public void write(int b) throws IOException {} + }; + // InputStream that will throw an exception during a read operation + private static InputStream inStream = new InputStream() { + @Override + public int read(byte[] b, int off, int len) throws IOException { + throw new IOException(); + } + @Override + public int read(byte[] b) throws IOException { throw new IOException();} + @Override + public int read() throws IOException { throw new IOException();} + }; + // Input bytes for read/write operation + private static byte[] inputBytes = new byte[INPUT_LENGTH]; + // Random function to add bytes to inputBytes + private static Random rand = new Random(); + + /** + * DataProvider to specify whether to use close() or finish() of OutputStream + * + * @return Entry object indicating which method to use for closing OutputStream + */ + @DataProvider + public Object[][] testOutputStreams() { + return new Object[][] { + { true }, + { false }, + }; + } + + /** + * DataProvider to specify on which outputstream closeEntry() has to be called + * + * @return Entry object returning either JarOutputStream or ZipOutputStream + */ + @DataProvider + public Object[][] testZipAndJar() throws IOException{ + return new Object[][] { + { new JarOutputStream(outStream)}, + { new ZipOutputStream(outStream)}, + }; + } + + /** + * Add inputBytes array with random bytes to write into OutputStream + */ + @BeforeTest + public void before_test() + { + rand.nextBytes(inputBytes); + } + + /** + * Test for infinite loop by writing bytes to closed GZIPOutputStream + * + * @param useCloseMethod indicates whether to use Close() or finish() method + * @throws IOException if an error occurs + */ + @Test(dataProvider = "testOutputStreams") + public void testGZip(boolean useCloseMethod) throws IOException { + GZIPOutputStream gzip = new GZIPOutputStream(outStream); + gzip.write(inputBytes, 0, INPUT_LENGTH); + assertThrows(IOException.class, () -> { + // Close GZIPOutputStream + if (useCloseMethod) { + gzip.close(); + } else { + gzip.finish(); + } + }); + // Write on a closed GZIPOutputStream, closed Deflater IOException expected + assertThrows(NullPointerException.class , () -> gzip.write(inputBytes, 0, INPUT_LENGTH)); + } + + /** + * Test for infinite loop by writing bytes to closed DeflaterOutputStream + * + * @param useCloseMethod indicates whether to use Close() or finish() method + * @throws IOException if an error occurs + */ + @Test(dataProvider = "testOutputStreams") + public void testDeflaterOutputStream(boolean useCloseMethod) throws IOException { + DeflaterOutputStream def = new DeflaterOutputStream(outStream); + assertThrows(IOException.class , () -> def.write(inputBytes, 0, INPUT_LENGTH)); + assertThrows(IOException.class, () -> { + // Close DeflaterOutputStream + if (useCloseMethod) { + def.close(); + } else { + def.finish(); + } + }); + // Write on a closed DeflaterOutputStream, 'Deflater has been closed' NPE is expected + assertThrows(NullPointerException.class , () -> def.write(inputBytes, 0, INPUT_LENGTH)); + } + + /** + * Test for infinite loop by reading bytes from closed DeflaterInputStream + * + * @throws IOException if an error occurs + */ + @Test + public void testDeflaterInputStream() throws IOException { + DeflaterInputStream def = new DeflaterInputStream(inStream); + assertThrows(IOException.class , () -> def.read(inputBytes, 0, INPUT_LENGTH)); + // Close DeflaterInputStream + def.close(); + // Read from a closed DeflaterInputStream, closed Deflater IOException expected + assertThrows(IOException.class , () -> def.read(inputBytes, 0, INPUT_LENGTH)); + } + + /** + * Test for infinite loop by writing bytes to closed InflaterOutputStream + * + * @param useCloseMethod indicates whether to use Close() or finish() method + * @throws IOException if an error occurs + */ + @Test(dataProvider = "testOutputStreams") + public void testInflaterOutputStream(boolean useCloseMethod) throws IOException { + InflaterOutputStream inf = new InflaterOutputStream(outStream); + assertThrows(IOException.class , () -> inf.write(inputBytes, 0, INPUT_LENGTH)); + assertThrows(IOException.class , () -> { + // Close InflaterOutputStream + if (useCloseMethod) { + inf.close(); + } else { + inf.finish(); + } + }); + // Write on a closed InflaterOutputStream , closed Inflater IOException expected + assertThrows(IOException.class , () -> inf.write(inputBytes, 0, INPUT_LENGTH)); + } + + /** + * Test for infinite loop by writing bytes to closed ZipOutputStream/JarOutputStream + * + * @param zip will be the instance of either JarOutputStream or ZipOutputStream + * @throws IOException if an error occurs + */ + @Test(dataProvider = "testZipAndJar") + public void testZipCloseEntry(ZipOutputStream zip) throws IOException { + assertThrows(IOException.class , () -> zip.putNextEntry(new ZipEntry(""))); + zip.write(inputBytes, 0, INPUT_LENGTH); + assertThrows(IOException.class , () -> zip.closeEntry()); + // Write on a closed ZipOutputStream , 'Deflater has been closed' NPE is expected + assertThrows(NullPointerException.class , () -> zip.write(inputBytes, 0, INPUT_LENGTH)); + } + +} -- GitLab From d8893fad23d1ee6841336b96c34599643edb81ce Mon Sep 17 00:00:00 2001 From: Mikael Vidstedt Date: Fri, 18 Mar 2022 20:28:39 +0000 Subject: [PATCH 282/340] 8283059: Uninitialized warning in check_code.c with GCC 11.2 Reviewed-by: dholmes --- .../share/native/libverify/check_code.c | 51 +++++++++++-------- 1 file changed, 30 insertions(+), 21 deletions(-) diff --git a/src/java.base/share/native/libverify/check_code.c b/src/java.base/share/native/libverify/check_code.c index fca549cfc9b..55d6fbcf42a 100644 --- a/src/java.base/share/native/libverify/check_code.c +++ b/src/java.base/share/native/libverify/check_code.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1994, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1994, 2022, 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 @@ -468,7 +468,8 @@ static void CCout_of_memory (context_type *); /* Because we can longjmp any time, we need to be very careful about * remembering what needs to be freed. */ -static void check_and_push(context_type *context, const void *ptr, int kind); +static void check_and_push_malloc_block(context_type *context, void *ptr); +static void check_and_push_string_utf(context_type *context, const char *ptr); static void pop_and_free(context_type *context); static int signature_to_args_size(const char *method_signature); @@ -604,7 +605,7 @@ class_to_ID(context_type *context, jclass cb, jboolean loadable) unsigned short *pID; const char *name = JVM_GetClassNameUTF(env, cb); - check_and_push(context, name, VM_STRING_UTF); + check_and_push_string_utf(context, name); hash = class_hash_fun(name); pID = &(class_hash->table[hash % HASH_TABLE_SIZE]); while (*pID) { @@ -939,10 +940,10 @@ read_all_code(context_type* context, jclass cb, int num_methods, int i; lengths = malloc(sizeof(int) * num_methods); - check_and_push(context, lengths, VM_MALLOC_BLK); + check_and_push_malloc_block(context, lengths); code = malloc(sizeof(unsigned char*) * num_methods); - check_and_push(context, code, VM_MALLOC_BLK); + check_and_push_malloc_block(context, code); *(lengths_addr) = lengths; *(code_addr) = code; @@ -951,7 +952,7 @@ read_all_code(context_type* context, jclass cb, int num_methods, lengths[i] = JVM_GetMethodIxByteCodeLength(context->env, cb, i); if (lengths[i] > 0) { code[i] = malloc(sizeof(unsigned char) * (lengths[i] + 1)); - check_and_push(context, code[i], VM_MALLOC_BLK); + check_and_push_malloc_block(context, code[i]); JVM_GetMethodIxByteCode(context->env, cb, i, code[i]); } else { code[i] = NULL; @@ -1305,7 +1306,7 @@ verify_opcode_operands(context_type *context, unsigned int inumber, int offset) /* Make sure the constant pool item is the right type. */ verify_constant_pool_type(context, key, kind); methodname = JVM_GetCPMethodNameUTF(env, cb, key); - check_and_push(context, methodname, VM_STRING_UTF); + check_and_push_string_utf(context, methodname); is_constructor = !strcmp(methodname, ""); is_internal = methodname[0] == '<'; pop_and_free(context); @@ -1354,7 +1355,7 @@ verify_opcode_operands(context_type *context, unsigned int inumber, int offset) unsigned int args2; const char *signature = JVM_GetCPMethodSignatureUTF(env, context->class, key); - check_and_push(context, signature, VM_STRING_UTF); + check_and_push_string_utf(context, signature); args1 = signature_to_args_size(signature) + 1; args2 = code[offset + 3]; if (args1 != args2) { @@ -1652,7 +1653,7 @@ initialize_exception_table(context_type *context) classname = JVM_GetCPClassNameUTF(env, context->class, einfo.catchType); - check_and_push(context, classname, VM_STRING_UTF); + check_and_push_string_utf(context, classname); stack_item->item = make_class_info_from_name(context, classname); if (!isAssignableTo(context, stack_item->item, @@ -1807,7 +1808,7 @@ initialize_dataflow(context_type *context) } } signature = JVM_GetMethodIxSignatureUTF(env, cb, mi); - check_and_push(context, signature, VM_STRING_UTF); + check_and_push_string_utf(context, signature); /* Fill in each of the arguments into the registers. */ for (p = signature + 1; *p != JVM_SIGNATURE_ENDFUNC; ) { char fieldchar = signature_to_fieldtype(context, &p, &full_info); @@ -2050,7 +2051,7 @@ pop_stack(context_type *context, unsigned int inumber, stack_info_type *new_stac context->class, operand); char *ip = buffer; - check_and_push(context, signature, VM_STRING_UTF); + check_and_push_string_utf(context, signature); #ifdef DEBUG if (verify_verbose) { print_formatted_fieldname(context, operand); @@ -2076,7 +2077,7 @@ pop_stack(context_type *context, unsigned int inumber, stack_info_type *new_stac operand); char *ip = buffer; const char *p; - check_and_push(context, signature, VM_STRING_UTF); + check_and_push_string_utf(context, signature); #ifdef DEBUG if (verify_verbose) { print_formatted_methodname(context, operand); @@ -2376,7 +2377,7 @@ pop_stack(context_type *context, unsigned int inumber, stack_info_type *new_stac operand); int item; const char *p; - check_and_push(context, signature, VM_STRING_UTF); + check_and_push_string_utf(context, signature); if (opcode == JVM_OPC_invokestatic) { item = 0; } else if (opcode == JVM_OPC_invokeinit) { @@ -2758,7 +2759,7 @@ push_stack(context_type *context, unsigned int inumber, stack_info_type *new_sta const char *signature = JVM_GetCPFieldSignatureUTF(context->env, context->class, operand); - check_and_push(context, signature, VM_STRING_UTF); + check_and_push_string_utf(context, signature); #ifdef DEBUG if (verify_verbose) { print_formatted_fieldname(context, operand); @@ -2780,7 +2781,7 @@ push_stack(context_type *context, unsigned int inumber, stack_info_type *new_sta context->class, operand); const char *result_signature; - check_and_push(context, signature, VM_STRING_UTF); + check_and_push_string_utf(context, signature); result_signature = get_result_signature(signature); if (result_signature++ == NULL) { CCerror(context, "Illegal signature %s", signature); @@ -3621,7 +3622,7 @@ cp_index_to_class_fullinfo(context_type *context, int cp_index, int kind) CCerror(context, "Internal error #5"); } - check_and_push(context, classname, VM_STRING_UTF); + check_and_push_string_utf(context, classname); if (classname[0] == JVM_SIGNATURE_ARRAY) { /* This make recursively call us, in case of a class array */ signature_to_fieldtype(context, &classname, &result); @@ -3822,8 +3823,8 @@ signature_to_fieldtype(context_type *context, assert(finish >= p); length = (int)(finish - p); if (length + 1 > (int)sizeof(buffer_space)) { - buffer = calloc(length + 1, sizeof(char)); - check_and_push(context, buffer, VM_MALLOC_BLK); + buffer = malloc(length + 1); + check_and_push_malloc_block(context, buffer); } memcpy(buffer, p, length); buffer[length] = '\0'; @@ -4142,7 +4143,7 @@ static void free_block(void *ptr, int kind) } } -static void check_and_push(context_type *context, const void *ptr, int kind) +static void check_and_push_common(context_type *context, void *ptr, int kind) { alloc_stack_type *p; if (ptr == 0) @@ -4154,16 +4155,24 @@ static void check_and_push(context_type *context, const void *ptr, int kind) p = malloc(sizeof(alloc_stack_type)); if (p == 0) { /* Make sure we clean up. */ - free_block((void *)ptr, kind); + free_block(ptr, kind); CCout_of_memory(context); } } p->kind = kind; - p->ptr = (void *)ptr; + p->ptr = ptr; p->next = context->allocated_memory; context->allocated_memory = p; } +static void check_and_push_malloc_block(context_type *context, void *ptr) { + check_and_push_common(context, ptr, VM_MALLOC_BLK); +} + +static void check_and_push_string_utf(context_type *context, const char *ptr) { + check_and_push_common(context, (void *)ptr, VM_STRING_UTF); +} + static void pop_and_free(context_type *context) { alloc_stack_type *p = context->allocated_memory; -- GitLab From 8384ac4ed3eaaa18998ab88e1ca36358c212e699 Mon Sep 17 00:00:00 2001 From: Mikael Vidstedt Date: Fri, 18 Mar 2022 22:01:27 +0000 Subject: [PATCH 283/340] 8283057: Update GCC to version 11.2 for Oracle builds on Linux Reviewed-by: erikj --- doc/building.html | 4 ++-- doc/building.md | 4 ++-- make/conf/jib-profiles.js | 4 ++-- make/devkit/Tools.gmk | 13 +++++++++++-- 4 files changed, 17 insertions(+), 8 deletions(-) diff --git a/doc/building.html b/doc/building.html index 09ea7dc7f72..66e07f07b9d 100644 --- a/doc/building.html +++ b/doc/building.html @@ -273,7 +273,7 @@ Linux -gcc 10.2.0 +gcc 11.2.0 macOS @@ -288,7 +288,7 @@

    All compilers are expected to be able to compile to the C99 language standard, as some C99 features are used in the source code. Microsoft Visual Studio doesn't fully support C99 so in practice shared code is limited to using C99 features that it does support.

    gcc

    The minimum accepted version of gcc is 5.0. Older versions will generate a warning by configure and are unlikely to work.

    -

    The JDK is currently known to be able to compile with at least version 10.2 of gcc.

    +

    The JDK is currently known to be able to compile with at least version 11.2 of gcc.

    In general, any version between these two should be usable.

    clang

    The minimum accepted version of clang is 3.5. Older versions will not be accepted by configure.

    diff --git a/doc/building.md b/doc/building.md index e83c2bada21..6bc5857811e 100644 --- a/doc/building.md +++ b/doc/building.md @@ -329,7 +329,7 @@ issues. Operating system Toolchain version ------------------ ------------------------------------------------------- - Linux gcc 10.2.0 + Linux gcc 11.2.0 macOS Apple Xcode 10.1 (using clang 10.0.0) Windows Microsoft Visual Studio 2019 update 16.7.2 @@ -343,7 +343,7 @@ features that it does support. The minimum accepted version of gcc is 5.0. Older versions will generate a warning by `configure` and are unlikely to work. -The JDK is currently known to be able to compile with at least version 10.2 of +The JDK is currently known to be able to compile with at least version 11.2 of gcc. In general, any version between these two should be usable. diff --git a/make/conf/jib-profiles.js b/make/conf/jib-profiles.js index 137d7cc7bb2..f16d7fd12e7 100644 --- a/make/conf/jib-profiles.js +++ b/make/conf/jib-profiles.js @@ -1052,10 +1052,10 @@ var getJibProfilesProfiles = function (input, common, data) { var getJibProfilesDependencies = function (input, common) { var devkit_platform_revisions = { - linux_x64: "gcc10.3.0-OL6.4+1.0", + linux_x64: "gcc11.2.0-OL6.4+1.0", macosx: "Xcode12.4+1.0", windows_x64: "VS2019-16.9.3+1.0", - linux_aarch64: "gcc10.3.0-OL7.6+1.0", + linux_aarch64: "gcc11.2.0-OL7.6+1.0", linux_arm: "gcc8.2.0-Fedora27+1.0", linux_ppc64le: "gcc8.2.0-Fedora27+1.0", linux_s390x: "gcc8.2.0-Fedora27+1.0" diff --git a/make/devkit/Tools.gmk b/make/devkit/Tools.gmk index 19eccf89be2..e94a74d0063 100644 --- a/make/devkit/Tools.gmk +++ b/make/devkit/Tools.gmk @@ -87,8 +87,17 @@ endif # Define external dependencies # Latest that could be made to work. -GCC_VER := 10.3.0 -ifeq ($(GCC_VER), 10.3.0) +GCC_VER := 11.2.0 +ifeq ($(GCC_VER), 11.2.0) + gcc_ver := gcc-11.2.0 + binutils_ver := binutils-2.37 + ccache_ver := ccache-3.7.12 + mpfr_ver := mpfr-4.1.0 + gmp_ver := gmp-6.2.1 + mpc_ver := mpc-1.2.1 + gdb_ver := gdb-11.1 + REQUIRED_MIN_MAKE_MAJOR_VERSION := 4 +else ifeq ($(GCC_VER), 10.3.0) gcc_ver := gcc-10.3.0 binutils_ver := binutils-2.36.1 ccache_ver := ccache-3.7.11 -- GitLab From 0c3094c8186b4d53e8bad80e2369fc7b9ae9e201 Mon Sep 17 00:00:00 2001 From: Ichiroh Takiguchi Date: Sat, 19 Mar 2022 04:43:20 +0000 Subject: [PATCH 284/340] 8204541: Correctly support AIX xlC 16.1 symbol visibility flags Reviewed-by: ihse, stuefe --- make/autoconf/flags-ldflags.m4 | 2 +- make/common/modules/LauncherCommon.gmk | 5 +++-- make/common/modules/LibCommon.gmk | 7 +++++-- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/make/autoconf/flags-ldflags.m4 b/make/autoconf/flags-ldflags.m4 index 8f77734c93c..457690ac391 100644 --- a/make/autoconf/flags-ldflags.m4 +++ b/make/autoconf/flags-ldflags.m4 @@ -77,7 +77,7 @@ AC_DEFUN([FLAGS_SETUP_LDFLAGS_HELPER], -fPIC" elif test "x$TOOLCHAIN_TYPE" = xxlc; then - BASIC_LDFLAGS="-b64 -brtl -bnorwexec -bnolibpath -bexpall -bernotok -btextpsize:64K \ + BASIC_LDFLAGS="-b64 -brtl -bnorwexec -bnolibpath -bnoexpall -bernotok -btextpsize:64K \ -bdatapsize:64K -bstackpsize:64K" # libjvm.so has gotten too large for normal TOC size; compile with qpic=large and link with bigtoc BASIC_LDFLAGS_JVM_ONLY="-Wl,-lC_r -bbigtoc" diff --git a/make/common/modules/LauncherCommon.gmk b/make/common/modules/LauncherCommon.gmk index 7ad0375e2e3..85056bbe40f 100644 --- a/make/common/modules/LauncherCommon.gmk +++ b/make/common/modules/LauncherCommon.gmk @@ -1,5 +1,5 @@ # -# Copyright (c) 2011, 2020, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2011, 2022, 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 @@ -33,13 +33,14 @@ include ToolsJdk.gmk # On Mac, we have always exported all symbols, probably due to oversight # and/or misunderstanding. To emulate this, don't hide any symbols # by default. -# On AIX/xlc we need at least xlc 13.1 for the symbol hiding (see JDK-8214063) # Also provide an override for non-conformant libraries. ifeq ($(TOOLCHAIN_TYPE), gcc) LAUNCHER_CFLAGS += -fvisibility=hidden LDFLAGS_JDKEXE += -Wl,--exclude-libs,ALL else ifeq ($(TOOLCHAIN_TYPE), clang) LAUNCHER_CFLAGS += -fvisibility=hidden +else ifeq ($(TOOLCHAIN_TYPE), xlc) + LAUNCHER_CFLAGS += -qvisibility=hidden endif LAUNCHER_SRC := $(TOPDIR)/src/java.base/share/native/launcher diff --git a/make/common/modules/LibCommon.gmk b/make/common/modules/LibCommon.gmk index 8ca3ddfffe9..aa5c9f0a5c6 100644 --- a/make/common/modules/LibCommon.gmk +++ b/make/common/modules/LibCommon.gmk @@ -1,5 +1,5 @@ # -# Copyright (c) 2011, 2020, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2011, 2022, 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 @@ -36,7 +36,6 @@ WIN_JAVA_LIB := $(SUPPORT_OUTPUTDIR)/native/java.base/libjava/java.lib # On Mac, we have always exported all symbols, probably due to oversight # and/or misunderstanding. To emulate this, don't hide any symbols # by default. -# On AIX/xlc we need at least xlc 13.1 for the symbol hiding (see JDK-8214063) # Also provide an override for non-conformant libraries. ifeq ($(TOOLCHAIN_TYPE), gcc) CFLAGS_JDKLIB += -fvisibility=hidden @@ -47,6 +46,10 @@ else ifeq ($(TOOLCHAIN_TYPE), clang) CFLAGS_JDKLIB += -fvisibility=hidden CXXFLAGS_JDKLIB += -fvisibility=hidden EXPORT_ALL_SYMBOLS := -fvisibility=default +else ifeq ($(TOOLCHAIN_TYPE), xlc) + CFLAGS_JDKLIB += -qvisibility=hidden + CXXFLAGS_JDKLIB += -qvisibility=hidden + EXPORT_ALL_SYMBOLS := -qvisibility=default endif # Put the libraries here. -- GitLab From 3e58a438e9051d4c976273eea35e36d37d5428c3 Mon Sep 17 00:00:00 2001 From: Tyler Steele Date: Sat, 19 Mar 2022 07:06:47 +0000 Subject: [PATCH 285/340] 8283287: ClassLoader.c cleanups Reviewed-by: stuefe, alanb, rriggs --- .../share/native/libjava/ClassLoader.c | 53 ++++++++++--------- 1 file changed, 28 insertions(+), 25 deletions(-) diff --git a/src/java.base/share/native/libjava/ClassLoader.c b/src/java.base/share/native/libjava/ClassLoader.c index da34a7b438b..301f068070b 100644 --- a/src/java.base/share/native/libjava/ClassLoader.c +++ b/src/java.base/share/native/libjava/ClassLoader.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2022, 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,16 +23,16 @@ * questions. */ -#include #include +#include +#include +#include "check_classname.h" +#include "java_lang_ClassLoader.h" +#include "jlong.h" #include "jni.h" #include "jni_util.h" -#include "jlong.h" #include "jvm.h" -#include "check_classname.h" -#include "java_lang_ClassLoader.h" -#include static JNINativeMethod methods[] = { {"retrieveDirectives", "()Ljava/lang/AssertionStatusDirectives;", (void *)&JVM_AssertionStatusDirectives} @@ -88,7 +88,7 @@ Java_java_lang_ClassLoader_defineClass1(JNIEnv *env, if (data == NULL) { JNU_ThrowNullPointerException(env, 0); - return 0; + return NULL; } /* Work around 4153825. malloc crashes on Solaris when passed a @@ -96,25 +96,27 @@ Java_java_lang_ClassLoader_defineClass1(JNIEnv *env, */ if (length < 0) { JNU_ThrowArrayIndexOutOfBoundsException(env, 0); - return 0; + return NULL; } - // On AIX malloc(0) returns NULL which looks like an out-of-memory condition; so adjust it to malloc(1) + // On AIX malloc(0) returns NULL which looks like an out-of-memory + // condition; so adjust it to malloc(1) #ifdef _AIX - body = (jbyte *)malloc(length == 0 ? 1 : length); + body = (jbyte *)malloc(length == 0 ? 1 : length); #else - body = (jbyte *)malloc(length); + body = (jbyte *)malloc(length); #endif - if (body == 0) { + if (body == NULL) { JNU_ThrowOutOfMemoryError(env, 0); - return 0; + return NULL; } (*env)->GetByteArrayRegion(env, data, offset, length, body); - if ((*env)->ExceptionOccurred(env)) + if ((*env)->ExceptionOccurred(env)) { goto free_body; + } if (name != NULL) { utfName = getUTF(env, name, buf, sizeof(buf)); @@ -173,9 +175,9 @@ Java_java_lang_ClassLoader_defineClass2(JNIEnv *env, body = (*env)->GetDirectBufferAddress(env, data); - if (body == 0) { + if (body == NULL) { JNU_ThrowNullPointerException(env, 0); - return 0; + return NULL; } body += offset; @@ -233,7 +235,7 @@ Java_java_lang_ClassLoader_defineClass0(JNIEnv *env, if (data == NULL) { JNU_ThrowNullPointerException(env, 0); - return 0; + return NULL; } /* Work around 4153825. malloc crashes on Solaris when passed a @@ -241,19 +243,20 @@ Java_java_lang_ClassLoader_defineClass0(JNIEnv *env, */ if (length < 0) { JNU_ThrowArrayIndexOutOfBoundsException(env, 0); - return 0; + return NULL; } - // On AIX malloc(0) returns NULL which looks like an out-of-memory condition; so adjust it to malloc(1) + // On AIX malloc(0) returns NULL which looks like an out-of-memory + // condition; so adjust it to malloc(1) #ifdef _AIX - body = (jbyte *)malloc(length == 0 ? 1 : length); + body = (jbyte *)malloc(length == 0 ? 1 : length); #else - body = (jbyte *)malloc(length); + body = (jbyte *)malloc(length); #endif - if (body == 0) { + if (body == NULL) { JNU_ThrowOutOfMemoryError(env, 0); - return 0; + return NULL; } (*env)->GetByteArrayRegion(env, data, offset, length, body); @@ -293,7 +296,7 @@ Java_java_lang_ClassLoader_findBootstrapClass(JNIEnv *env, jclass dummy, char buf[128]; if (classname == NULL) { - return 0; + return NULL; } clname = getUTF(env, classname, buf, sizeof(buf)); @@ -322,7 +325,7 @@ Java_java_lang_ClassLoader_findLoadedClass0(JNIEnv *env, jobject loader, jstring name) { if (name == NULL) { - return 0; + return NULL; } else { return JVM_FindLoadedClass(env, loader, name); } -- GitLab From 10ccfffae1f18dd1a3d2f3dca53ad547d3d3ecb5 Mon Sep 17 00:00:00 2001 From: Jie Fu Date: Sat, 19 Mar 2022 07:08:47 +0000 Subject: [PATCH 286/340] 8283352: [CDS] SharedBaseAddress.java fails on x86_32 Reviewed-by: dholmes, iklam, stuefe --- .../jtreg/runtime/cds/SharedBaseAddress.java | 32 +++++++++++++------ .../runtime/cds/appcds/SharedBaseAddress.java | 26 +++++++++++---- 2 files changed, 41 insertions(+), 17 deletions(-) diff --git a/test/hotspot/jtreg/runtime/cds/SharedBaseAddress.java b/test/hotspot/jtreg/runtime/cds/SharedBaseAddress.java index 761b5a05d29..a7f31cf1a08 100644 --- a/test/hotspot/jtreg/runtime/cds/SharedBaseAddress.java +++ b/test/hotspot/jtreg/runtime/cds/SharedBaseAddress.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2022, 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 @@ -70,26 +70,31 @@ import jdk.test.lib.process.OutputAnalyzer; public class SharedBaseAddress { - // shared base address test table - private static final String[] testTable = { - "1g", "8g", "64g","512g", "4t", - "32t", "128t", "0", + // shared base address test table for {32, 64}bit VM + private static final String[] testTableShared = { + "1g", "0", "1", "64k", "64M", + "0xfff80000", // archive top wraps around 32-bit address space + "0xffffffff", // archive bottom wraps around 32-bit address space -- due to align_up() + "0" // always let OS pick the base address at runtime (ASLR for CDS archive) + }; + + // shared base address test table for 64bit VM only + private static final String[] testTable64 = { + "8g", "64g","512g", "4t", + "32t", "128t", "0x800001000", // Default base address + 1 page - probably valid but unaligned to metaspace alignment, see JDK 8247522 "0xfffffffffff00000", // archive top wraps around 64-bit address space - "0xfff80000", // archive top wraps around 32-bit address space "0xffffffffffffffff", // archive bottom wraps around 64-bit address space -- due to align_up() - "0xffffffff", // archive bottom wraps around 32-bit address space -- due to align_up() "0x00007ffffff00000", // end of archive will go past the end of user space on linux/x64 - "0x500000000", // (20g) below 32g at a 4g aligned address, but cannot be expressed with a logical + "0x500000000" // (20g) below 32g at a 4g aligned address, but cannot be expressed with a logical // immediate on aarch64 (0x5_0000_0000) (see JDK-8265705) - "0", // always let OS pick the base address at runtime (ASLR for CDS archive) }; // failed pattern private static String failedPattern = "os::release_memory\\(0x[0-9a-fA-F]*,\\s[0-9]*\\)\\sfailed"; - public static void main(String[] args) throws Exception { + public static void test(String[] args, String[] testTable) throws Exception { int mid = testTable.length / 2; int start = args[0].equals("0") ? 0 : mid; int end = args[0].equals("0") ? mid : testTable.length; @@ -134,4 +139,11 @@ public class SharedBaseAddress { } } } + + public static void main(String[] args) throws Exception { + test(args, testTableShared); + if (Platform.is64bit()) { + test(args, testTable64); + } + } } diff --git a/test/hotspot/jtreg/runtime/cds/appcds/SharedBaseAddress.java b/test/hotspot/jtreg/runtime/cds/appcds/SharedBaseAddress.java index 5d981c01794..2220fc52baa 100644 --- a/test/hotspot/jtreg/runtime/cds/appcds/SharedBaseAddress.java +++ b/test/hotspot/jtreg/runtime/cds/appcds/SharedBaseAddress.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2022, 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 @@ -33,19 +33,24 @@ * @run main/timeout=240 SharedBaseAddress */ +import jdk.test.lib.Platform; import jdk.test.lib.process.OutputAnalyzer; public class SharedBaseAddress { - // shared base address test table - private static final String[] testTable = { - "1g", "8g", "64g","512g", "4t", - "32t", "128t", "0", - "1", "64k", "64M", "320g", + // shared base address test table for {32, 64}bit VM + private static final String[] testTableShared = { + "1g", "0", "1", "64k", "64M" + }; + + // shared base address test table for 64bit VM only + private static final String[] testTable64 = { + "8g", "64g","512g", "4t", + "32t", "128t", "320g", "0x800001000" // Default base address + 1 page - probably valid but unaligned to metaspace alignment, see JDK 8247522 }; - public static void main(String[] args) throws Exception { + public static void test(String[] testTable) throws Exception { String appJar = JarBuilder.getOrCreateHelloJar(); for (String testEntry : testTable) { @@ -62,4 +67,11 @@ public class SharedBaseAddress { TestCommon.checkExec(execOutput, "Hello World"); } } + + public static void main(String[] args) throws Exception { + test(testTableShared); + if (Platform.is64bit()) { + test(testTable64); + } + } } -- GitLab From e8caf84fb9dfcbb59da6459972724b6780b0871a Mon Sep 17 00:00:00 2001 From: Andrey Turbanov Date: Sat, 19 Mar 2022 13:29:49 +0000 Subject: [PATCH 287/340] 8282574: Cleanup unnecessary calls to Throwable.initCause() in jdk.compiler Reviewed-by: darcy --- .../tools/javac/processing/JavacProcessingEnvironment.java | 7 ++----- .../share/classes/com/sun/tools/javac/tree/Pretty.java | 6 ++---- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java index 9dd94f74252..9174f0b7385 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2022, 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 @@ -300,10 +300,7 @@ public class JavacProcessingEnvironment implements ProcessingEnvironment, Closea try { processorIterator = List.of(new PrintingProcessor()).iterator(); } catch (Throwable t) { - AssertionError assertError = - new AssertionError("Problem instantiating PrintingProcessor."); - assertError.initCause(t); - throw assertError; + throw new AssertionError("Problem instantiating PrintingProcessor.", t); } } else if (processors != null) { processorIterator = processors.iterator(); diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/Pretty.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/Pretty.java index acccd4d574c..bdfef06fd7c 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/Pretty.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/Pretty.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2022, 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 @@ -194,9 +194,7 @@ public class Pretty extends JCTree.Visitor { tree.accept(this); } } catch (UncheckedIOException ex) { - IOException e = new IOException(ex.getMessage()); - e.initCause(ex); - throw e; + throw new IOException(ex.getMessage(), ex); } finally { this.prec = prevPrec; } -- GitLab From 80415e04c5fd6709e7e5b5ffb7a3d9431b672d99 Mon Sep 17 00:00:00 2001 From: Andrey Turbanov Date: Sat, 19 Mar 2022 13:31:50 +0000 Subject: [PATCH 288/340] 8282534: Remove redundant null check in ChaCha20Cipher.engineInit Reviewed-by: xuelei --- .../com/sun/crypto/provider/ChaCha20Cipher.java | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/java.base/share/classes/com/sun/crypto/provider/ChaCha20Cipher.java b/src/java.base/share/classes/com/sun/crypto/provider/ChaCha20Cipher.java index 8cb200876ac..917921801cb 100644 --- a/src/java.base/share/classes/com/sun/crypto/provider/ChaCha20Cipher.java +++ b/src/java.base/share/classes/com/sun/crypto/provider/ChaCha20Cipher.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2022, 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 @@ -159,7 +159,7 @@ abstract class ChaCha20Cipher extends CipherSpi { * ciphers, but allow {@code NoPadding}. See JCE spec. * * @param padding The padding type. The only allowed value is - * {@code NoPadding} case insensitive). + * {@code NoPadding} case insensitive. * * @throws NoSuchPaddingException if a padding scheme besides * {@code NoPadding} is provided. @@ -393,7 +393,7 @@ abstract class ChaCha20Cipher extends CipherSpi { return; } - byte[] newNonce = null; + byte[] newNonce; switch (mode) { case MODE_NONE: throw new InvalidAlgorithmParameterException( @@ -420,12 +420,6 @@ abstract class ChaCha20Cipher extends CipherSpi { throw new RuntimeException("Invalid mode: " + mode); } - // If after all the above processing we still don't have a nonce value - // then supply a random one provided a random source has been given. - if (newNonce == null) { - newNonce = createRandomNonce(random); - } - // Continue with initialization init(opmode, key, newNonce); } -- GitLab From 3f923b82c31325504430b50dee262fd460004e7b Mon Sep 17 00:00:00 2001 From: "Daniel D. Daugherty" Date: Sat, 19 Mar 2022 13:43:06 +0000 Subject: [PATCH 289/340] 8282704: runtime/Thread/StopAtExit.java may leak memory Reviewed-by: dholmes, alanb --- .../jtreg/runtime/Thread/StopAtExit.java | 69 ++++++++++++++++++- 1 file changed, 66 insertions(+), 3 deletions(-) diff --git a/test/hotspot/jtreg/runtime/Thread/StopAtExit.java b/test/hotspot/jtreg/runtime/Thread/StopAtExit.java index 22550093202..b997890e347 100644 --- a/test/hotspot/jtreg/runtime/Thread/StopAtExit.java +++ b/test/hotspot/jtreg/runtime/Thread/StopAtExit.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2022, 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,11 +23,13 @@ /** * @test - * @bug 8167108 8266130 + * @bug 8167108 8266130 8282704 * @summary Stress test java.lang.Thread.stop() at thread exit. + * @modules java.base/java.lang:open * @run main/othervm StopAtExit */ +import java.lang.reflect.Method; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; @@ -38,6 +40,10 @@ public class StopAtExit extends Thread { public CountDownLatch exitSyncObj = new CountDownLatch(1); public CountDownLatch startSyncObj = new CountDownLatch(1); + public StopAtExit(ThreadGroup group, Runnable target) { + super(group, target); + } + @Override public void run() { try { @@ -72,11 +78,18 @@ public class StopAtExit extends Thread { System.out.println("About to execute for " + timeMax + " seconds."); long count = 0; + long manualDestroyCnt = 0; + long manualTerminateCnt = 0; long start_time = System.currentTimeMillis(); while (System.currentTimeMillis() < start_time + (timeMax * 1000)) { count++; - StopAtExit thread = new StopAtExit(); + // Use my own ThreadGroup so the thread count is known and make + // it a daemon ThreadGroup so it is automatically destroyed when + // the thread is terminated. + ThreadGroup myTG = new ThreadGroup("myTG-" + count); + myTG.setDaemon(true); + StopAtExit thread = new StopAtExit(myTG, null); thread.start(); try { // Wait for the worker thread to get going. @@ -107,9 +120,52 @@ public class StopAtExit extends Thread { } catch (InterruptedException e) { throw new Error("Unexpected: " + e); } + // This stop() call happens after the join() so it should do + // nothing, but let's make sure. thread.stop(); + + if (myTG.activeCount() != 0) { + // If the ThreadGroup still has a count, then the thread + // received the async exception while in exit() so we need + // to do a manual terminate. + manualTerminateCnt++; + try { + threadTerminated(myTG, thread); + } catch (Exception e) { + throw new Error("threadTerminated() threw unexpected: " + e); + } + int activeCount = myTG.activeCount(); + if (activeCount != 0) { + throw new Error("threadTerminated() did not clean up " + + "worker thread: count=" + activeCount); + } + if (!myTG.isDestroyed()) { + throw new Error("threadTerminated() did not destroy " + + myTG.getName()); + } + } else if (!myTG.isDestroyed()) { + // If the ThreadGroup does not have a count, but is not + // yet destroyed, then the thread received the async + // exception while the thread was in the later stages of + // its threadTerminated() call so we need to do a manual + // destroy. + manualDestroyCnt++; + try { + myTG.destroy(); + } catch (Exception e) { + throw new Error("myTG.destroy() threw unexpected: " + e); + } + } } + if (manualDestroyCnt != 0) { + System.out.println("Manually destroyed ThreadGroup " + + manualDestroyCnt + " times."); + } + if (manualTerminateCnt != 0) { + System.out.println("Manually terminated Thread " + + manualTerminateCnt + " times."); + } System.out.println("Executed " + count + " loops in " + timeMax + " seconds."); @@ -120,6 +176,13 @@ public class StopAtExit extends Thread { } } + static void threadTerminated(ThreadGroup group, Thread thread) throws Exception { + // ThreadGroup.threadTerminated() is package private: + Method method = ThreadGroup.class.getDeclaredMethod("threadTerminated", Thread.class); + method.setAccessible(true); + method.invoke(group, thread); + } + public static void usage() { System.err.println("Usage: " + PROG_NAME + " [time_max]"); System.err.println("where:"); -- GitLab From 4df67426ed02f18af0757897acb28b636a317a91 Mon Sep 17 00:00:00 2001 From: Xue-Lei Andrew Fan Date: Sun, 20 Mar 2022 06:46:13 +0000 Subject: [PATCH 290/340] 8282723: Add constructors taking a cause to JSSE exceptions Reviewed-by: wetmore, iris --- .../classes/javax/net/ssl/SSLException.java | 15 ++---- .../javax/net/ssl/SSLHandshakeException.java | 27 +++++++--- .../javax/net/ssl/SSLKeyException.java | 25 +++++++--- .../net/ssl/SSLPeerUnverifiedException.java | 25 +++++++--- .../javax/net/ssl/SSLProtocolException.java | 25 +++++++--- .../share/classes/sun/security/ssl/Alert.java | 17 ++----- .../sun/security/ssl/DHClientKeyExchange.java | 6 +-- .../sun/security/ssl/ECDHKeyExchange.java | 12 ++--- .../sun/security/ssl/KAKeyDerivation.java | 8 ++- .../sun/security/ssl/NewSessionTicket.java | 5 +- .../security/ssl/SSLBasicKeyDerivation.java | 5 +- .../sun/security/ssl/SSLEngineImpl.java | 14 ++---- .../security/ssl/SSLEngineInputRecord.java | 5 +- .../sun/security/ssl/SSLSecretDerivation.java | 5 +- .../sun/security/ssl/SSLSocketImpl.java | 16 ++---- .../security/ssl/SSLSocketInputRecord.java | 5 +- .../security/ssl/SSLTrafficKeyDerivation.java | 6 +-- .../classes/sun/security/ssl/ServerHello.java | 5 +- .../sun/security/ssl/ServerNameExtension.java | 12 ++--- .../jndi/ldap/ext/StartTlsResponseImpl.java | 7 ++- .../jdk/internal/net/http/HttpClientImpl.java | 6 +-- .../jdk/internal/net/http/common/SSLTube.java | 6 +-- .../net/ssl/ALPN/SSLServerSocketAlpnTest.java | 4 +- .../javax/net/ssl/ALPN/SSLSocketAlpnTest.java | 4 +- .../CheckSSLHandshakeException.java | 50 +++++++++++++++++++ .../SSLException/CheckSSLKeyException.java | 50 +++++++++++++++++++ .../CheckSSLPeerUnverifiedException.java | 50 +++++++++++++++++++ .../CheckSSLProtocolException.java | 50 +++++++++++++++++++ .../templates/SSLSocketSSLEngineTemplate.java | 6 +-- .../net/ssl/templates/SSLSocketTemplate.java | 4 +- 30 files changed, 343 insertions(+), 132 deletions(-) create mode 100644 test/jdk/javax/net/ssl/SSLException/CheckSSLHandshakeException.java create mode 100644 test/jdk/javax/net/ssl/SSLException/CheckSSLKeyException.java create mode 100644 test/jdk/javax/net/ssl/SSLException/CheckSSLPeerUnverifiedException.java create mode 100644 test/jdk/javax/net/ssl/SSLException/CheckSSLProtocolException.java diff --git a/src/java.base/share/classes/javax/net/ssl/SSLException.java b/src/java.base/share/classes/javax/net/ssl/SSLException.java index c77992db301..b2e96afa7d6 100644 --- a/src/java.base/share/classes/javax/net/ssl/SSLException.java +++ b/src/java.base/share/classes/javax/net/ssl/SSLException.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2022, 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 @@ -36,9 +36,7 @@ import java.io.IOException; * @since 1.4 * @author David Brownell */ -public -class SSLException extends IOException -{ +public class SSLException extends IOException { @java.io.Serial private static final long serialVersionUID = 4511006460650708967L; @@ -48,8 +46,7 @@ class SSLException extends IOException * * @param reason describes the problem. */ - public SSLException(String reason) - { + public SSLException(String reason) { super(reason); } @@ -66,8 +63,7 @@ class SSLException extends IOException * @since 1.5 */ public SSLException(String message, Throwable cause) { - super(message); - initCause(cause); + super(message, cause); } /** @@ -83,7 +79,6 @@ class SSLException extends IOException * @since 1.5 */ public SSLException(Throwable cause) { - super(cause == null ? null : cause.toString()); - initCause(cause); + super(cause); } } diff --git a/src/java.base/share/classes/javax/net/ssl/SSLHandshakeException.java b/src/java.base/share/classes/javax/net/ssl/SSLHandshakeException.java index 5f342b074db..e6fa239bdcb 100644 --- a/src/java.base/share/classes/javax/net/ssl/SSLHandshakeException.java +++ b/src/java.base/share/classes/javax/net/ssl/SSLHandshakeException.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2022, 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,10 +23,8 @@ * questions. */ - package javax.net.ssl; - /** * Indicates that the client and server could not negotiate the * desired level of security. The connection is no longer usable. @@ -34,9 +32,7 @@ package javax.net.ssl; * @since 1.4 * @author David Brownell */ -public -class SSLHandshakeException extends SSLException -{ +public class SSLHandshakeException extends SSLException { @java.io.Serial private static final long serialVersionUID = -5045881315018326890L; @@ -46,8 +42,23 @@ class SSLHandshakeException extends SSLException * * @param reason describes the problem. */ - public SSLHandshakeException(String reason) - { + public SSLHandshakeException(String reason) { super(reason); } + + /** + * Creates a {@code SSLHandshakeException} with the specified detail + * message and cause. + * + * @param message the detail message (which is saved for later retrieval + * by the {@link #getMessage()} method). + * @param cause the cause (which is saved for later retrieval by the + * {@link #getCause()} method). (A {@code null} value is + * permitted, and indicates that the cause is nonexistent or + * unknown.) + * @since 19 + */ + public SSLHandshakeException(String message, Throwable cause) { + super(message, cause); + } } diff --git a/src/java.base/share/classes/javax/net/ssl/SSLKeyException.java b/src/java.base/share/classes/javax/net/ssl/SSLKeyException.java index 49fe57c369d..f27c9ee554c 100644 --- a/src/java.base/share/classes/javax/net/ssl/SSLKeyException.java +++ b/src/java.base/share/classes/javax/net/ssl/SSLKeyException.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2022, 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 @@ -33,9 +33,7 @@ package javax.net.ssl; * @since 1.4 * @author David Brownell */ -public -class SSLKeyException extends SSLException -{ +public class SSLKeyException extends SSLException { @java.io.Serial private static final long serialVersionUID = -8071664081941937874L; @@ -45,8 +43,23 @@ class SSLKeyException extends SSLException * * @param reason describes the problem. */ - public SSLKeyException(String reason) - { + public SSLKeyException(String reason) { super(reason); } + + /** + * Creates a {@code SSLKeyException} with the specified detail + * message and cause. + * + * @param message the detail message (which is saved for later retrieval + * by the {@link #getMessage()} method). + * @param cause the cause (which is saved for later retrieval by the + * {@link #getCause()} method). (A {@code null} value is + * permitted, and indicates that the cause is nonexistent or + * unknown.) + * @since 19 + */ + public SSLKeyException(String message, Throwable cause) { + super(message, cause); + } } diff --git a/src/java.base/share/classes/javax/net/ssl/SSLPeerUnverifiedException.java b/src/java.base/share/classes/javax/net/ssl/SSLPeerUnverifiedException.java index e98e2b4b7f4..3fbec6c0434 100644 --- a/src/java.base/share/classes/javax/net/ssl/SSLPeerUnverifiedException.java +++ b/src/java.base/share/classes/javax/net/ssl/SSLPeerUnverifiedException.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2022, 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 @@ -39,9 +39,7 @@ package javax.net.ssl; * @since 1.4 * @author David Brownell */ -public -class SSLPeerUnverifiedException extends SSLException -{ +public class SSLPeerUnverifiedException extends SSLException { @java.io.Serial private static final long serialVersionUID = -8919512675000600547L; @@ -51,8 +49,23 @@ class SSLPeerUnverifiedException extends SSLException * * @param reason describes the problem. */ - public SSLPeerUnverifiedException(String reason) - { + public SSLPeerUnverifiedException(String reason) { super(reason); } + + /** + * Creates a {@code SSLPeerUnverifiedException} with the specified detail + * message and cause. + * + * @param message the detail message (which is saved for later retrieval + * by the {@link #getMessage()} method). + * @param cause the cause (which is saved for later retrieval by the + * {@link #getCause()} method). (A {@code null} value is + * permitted, and indicates that the cause is nonexistent or + * unknown.) + * @since 19 + */ + public SSLPeerUnverifiedException(String message, Throwable cause) { + super(message, cause); + } } diff --git a/src/java.base/share/classes/javax/net/ssl/SSLProtocolException.java b/src/java.base/share/classes/javax/net/ssl/SSLProtocolException.java index a39b2048924..bf590430b3f 100644 --- a/src/java.base/share/classes/javax/net/ssl/SSLProtocolException.java +++ b/src/java.base/share/classes/javax/net/ssl/SSLProtocolException.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2022, 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 @@ -33,9 +33,7 @@ package javax.net.ssl; * @since 1.4 * @author David Brownell */ -public -class SSLProtocolException extends SSLException -{ +public class SSLProtocolException extends SSLException { @java.io.Serial private static final long serialVersionUID = 5445067063799134928L; @@ -45,8 +43,23 @@ class SSLProtocolException extends SSLException * * @param reason describes the problem. */ - public SSLProtocolException(String reason) - { + public SSLProtocolException(String reason) { super(reason); } + + /** + * Creates a {@code SSLProtocolException} with the specified detail + * message and cause. + * + * @param message the detail message (which is saved for later retrieval + * by the {@link #getMessage()} method). + * @param cause the cause (which is saved for later retrieval by the + * {@link #getCause()} method). (A {@code null} value is + * permitted, and indicates that the cause is nonexistent or + * unknown.) + * @since 19 + */ + public SSLProtocolException(String message, Throwable cause) { + super(message, cause); + } } diff --git a/src/java.base/share/classes/sun/security/ssl/Alert.java b/src/java.base/share/classes/sun/security/ssl/Alert.java index bc034dc8c3b..922937887aa 100644 --- a/src/java.base/share/classes/sun/security/ssl/Alert.java +++ b/src/java.base/share/classes/sun/security/ssl/Alert.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2022, 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 @@ -122,22 +122,15 @@ enum Alert { reason = (cause != null) ? cause.getMessage() : ""; } - SSLException ssle; if (cause instanceof IOException) { - ssle = new SSLException(reason); + return new SSLException(reason, cause); } else if ((this == UNEXPECTED_MESSAGE)) { - ssle = new SSLProtocolException(reason); + return new SSLProtocolException(reason, cause); } else if (handshakeOnly) { - ssle = new SSLHandshakeException(reason); + return new SSLHandshakeException(reason, cause); } else { - ssle = new SSLException(reason); + return new SSLException(reason, cause); } - - if (cause != null) { - ssle.initCause(cause); - } - - return ssle; } /** diff --git a/src/java.base/share/classes/sun/security/ssl/DHClientKeyExchange.java b/src/java.base/share/classes/sun/security/ssl/DHClientKeyExchange.java index f9753ffe078..996e3f78ec1 100644 --- a/src/java.base/share/classes/sun/security/ssl/DHClientKeyExchange.java +++ b/src/java.base/share/classes/sun/security/ssl/DHClientKeyExchange.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2022, 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 @@ -295,8 +295,8 @@ final class DHClientKeyExchange { shc.handshakeCredentials.add( new DHECredentials(peerPublicKey, namedGroup)); } catch (GeneralSecurityException | java.io.IOException e) { - throw (SSLHandshakeException)(new SSLHandshakeException( - "Could not generate DHPublicKey").initCause(e)); + throw new SSLHandshakeException( + "Could not generate DHPublicKey", e); } // update the states diff --git a/src/java.base/share/classes/sun/security/ssl/ECDHKeyExchange.java b/src/java.base/share/classes/sun/security/ssl/ECDHKeyExchange.java index 59bc40411ce..9833ea94e8d 100644 --- a/src/java.base/share/classes/sun/security/ssl/ECDHKeyExchange.java +++ b/src/java.base/share/classes/sun/security/ssl/ECDHKeyExchange.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2022, 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 @@ -160,8 +160,7 @@ final class ECDHKeyExchange { ka.doPhase(peerPublicKey, true); return ka.generateSecret("TlsPremasterSecret"); } catch (GeneralSecurityException e) { - throw (SSLHandshakeException) new SSLHandshakeException( - "Could not generate secret").initCause(e); + throw new SSLHandshakeException("Could not generate secret", e); } } @@ -177,8 +176,7 @@ final class ECDHKeyExchange { PublicKey peerPublicKey = kf.generatePublic(spec); return getAgreedSecret(peerPublicKey); } catch (GeneralSecurityException | java.io.IOException e) { - throw (SSLHandshakeException) new SSLHandshakeException( - "Could not generate secret").initCause(e); + throw new SSLHandshakeException("Could not generate secret", e); } } @@ -202,8 +200,8 @@ final class ECDHKeyExchange { "ECPublicKey does not comply to algorithm constraints"); } } catch (GeneralSecurityException | java.io.IOException e) { - throw (SSLHandshakeException) new SSLHandshakeException( - "Could not generate ECPublicKey").initCause(e); + throw new SSLHandshakeException( + "Could not generate ECPublicKey", e); } } diff --git a/src/java.base/share/classes/sun/security/ssl/KAKeyDerivation.java b/src/java.base/share/classes/sun/security/ssl/KAKeyDerivation.java index 7c791e85f77..b76da75c763 100644 --- a/src/java.base/share/classes/sun/security/ssl/KAKeyDerivation.java +++ b/src/java.base/share/classes/sun/security/ssl/KAKeyDerivation.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2022, 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 @@ -88,8 +88,7 @@ public class KAKeyDerivation implements SSLKeyDerivation { context, preMasterSecret); return kd.deriveKey("MasterSecret", params); } catch (GeneralSecurityException gse) { - throw (SSLHandshakeException) new SSLHandshakeException( - "Could not generate secret").initCause(gse); + throw new SSLHandshakeException("Could not generate secret", gse); } } @@ -125,8 +124,7 @@ public class KAKeyDerivation implements SSLKeyDerivation { // derive handshake secret return hkdf.extract(saltSecret, sharedSecret, algorithm); } catch (GeneralSecurityException gse) { - throw (SSLHandshakeException) new SSLHandshakeException( - "Could not generate secret").initCause(gse); + throw new SSLHandshakeException("Could not generate secret", gse); } } } diff --git a/src/java.base/share/classes/sun/security/ssl/NewSessionTicket.java b/src/java.base/share/classes/sun/security/ssl/NewSessionTicket.java index 50f19dbf715..337c8384991 100644 --- a/src/java.base/share/classes/sun/security/ssl/NewSessionTicket.java +++ b/src/java.base/share/classes/sun/security/ssl/NewSessionTicket.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2022, 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 @@ -302,8 +302,7 @@ final class NewSessionTicket { return hkdf.expand(resumptionMasterSecret, hkdfInfo, hashAlg.hashLength, "TlsPreSharedKey"); } catch (GeneralSecurityException gse) { - throw (SSLHandshakeException) new SSLHandshakeException( - "Could not derive PSK").initCause(gse); + throw new SSLHandshakeException("Could not derive PSK", gse); } } diff --git a/src/java.base/share/classes/sun/security/ssl/SSLBasicKeyDerivation.java b/src/java.base/share/classes/sun/security/ssl/SSLBasicKeyDerivation.java index 7f693400637..20fc7112593 100644 --- a/src/java.base/share/classes/sun/security/ssl/SSLBasicKeyDerivation.java +++ b/src/java.base/share/classes/sun/security/ssl/SSLBasicKeyDerivation.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2022, 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 @@ -52,8 +52,7 @@ final class SSLBasicKeyDerivation implements SSLKeyDerivation { return hkdf.expand(secret, hkdfInfo, ((SecretSizeSpec)keySpec).length, algorithm); } catch (GeneralSecurityException gse) { - throw (SSLHandshakeException) new SSLHandshakeException( - "Could not generate secret").initCause(gse); + throw new SSLHandshakeException("Could not generate secret", gse); } } diff --git a/src/java.base/share/classes/sun/security/ssl/SSLEngineImpl.java b/src/java.base/share/classes/sun/security/ssl/SSLEngineImpl.java index ca4a80c5a5c..1db9ba8d86b 100644 --- a/src/java.base/share/classes/sun/security/ssl/SSLEngineImpl.java +++ b/src/java.base/share/classes/sun/security/ssl/SSLEngineImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2022, 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 @@ -1167,17 +1167,13 @@ final class SSLEngineImpl extends SSLEngine implements SSLTransport { if (taskThrown instanceof RuntimeException) { throw new RuntimeException(msg, taskThrown); } else if (taskThrown instanceof SSLHandshakeException) { - return (SSLHandshakeException) - new SSLHandshakeException(msg).initCause(taskThrown); + return new SSLHandshakeException(msg, taskThrown); } else if (taskThrown instanceof SSLKeyException) { - return (SSLKeyException) - new SSLKeyException(msg).initCause(taskThrown); + return new SSLKeyException(msg, taskThrown); } else if (taskThrown instanceof SSLPeerUnverifiedException) { - return (SSLPeerUnverifiedException) - new SSLPeerUnverifiedException(msg).initCause(taskThrown); + return new SSLPeerUnverifiedException(msg, taskThrown); } else if (taskThrown instanceof SSLProtocolException) { - return (SSLProtocolException) - new SSLProtocolException(msg).initCause(taskThrown); + return new SSLProtocolException(msg, taskThrown); } else if (taskThrown instanceof SSLException) { return (SSLException)taskThrown; } else { diff --git a/src/java.base/share/classes/sun/security/ssl/SSLEngineInputRecord.java b/src/java.base/share/classes/sun/security/ssl/SSLEngineInputRecord.java index 938768aaf76..dc957ca1419 100644 --- a/src/java.base/share/classes/sun/security/ssl/SSLEngineInputRecord.java +++ b/src/java.base/share/classes/sun/security/ssl/SSLEngineInputRecord.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2022, 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 @@ -242,8 +242,7 @@ final class SSLEngineInputRecord extends InputRecord implements SSLRecord { } catch (BadPaddingException bpe) { throw bpe; } catch (GeneralSecurityException gse) { - throw (SSLProtocolException)(new SSLProtocolException( - "Unexpected exception")).initCause(gse); + throw new SSLProtocolException("Unexpected exception", gse); } finally { // consume a complete record packet.limit(srcLim); diff --git a/src/java.base/share/classes/sun/security/ssl/SSLSecretDerivation.java b/src/java.base/share/classes/sun/security/ssl/SSLSecretDerivation.java index a7ba9a5e566..ff13948a67c 100644 --- a/src/java.base/share/classes/sun/security/ssl/SSLSecretDerivation.java +++ b/src/java.base/share/classes/sun/security/ssl/SSLSecretDerivation.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2022, 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 @@ -113,8 +113,7 @@ final class SSLSecretDerivation implements SSLKeyDerivation { HKDF hkdf = new HKDF(hashAlg.name); return hkdf.expand(secret, hkdfInfo, hashAlg.hashLength, algorithm); } catch (GeneralSecurityException gse) { - throw (SSLHandshakeException) new SSLHandshakeException( - "Could not generate secret").initCause(gse); + throw new SSLHandshakeException("Could not generate secret", gse); } } diff --git a/src/java.base/share/classes/sun/security/ssl/SSLSocketImpl.java b/src/java.base/share/classes/sun/security/ssl/SSLSocketImpl.java index 842cef11911..68fb3860203 100644 --- a/src/java.base/share/classes/sun/security/ssl/SSLSocketImpl.java +++ b/src/java.base/share/classes/sun/security/ssl/SSLSocketImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2022, 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 @@ -1709,19 +1709,13 @@ public final class SSLSocketImpl private Plaintext handleEOF(EOFException eofe) throws IOException { if (requireCloseNotify || conContext.handshakeContext != null) { - SSLException ssle; if (conContext.handshakeContext != null) { - ssle = new SSLHandshakeException( - "Remote host terminated the handshake"); + throw new SSLHandshakeException( + "Remote host terminated the handshake", eofe); } else { - ssle = new SSLProtocolException( - "Remote host terminated the connection"); - } - - if (eofe != null) { - ssle.initCause(eofe); + throw new SSLProtocolException( + "Remote host terminated the connection", eofe); } - throw ssle; } else { // treat as if we had received a close_notify conContext.isInputCloseNotified = true; diff --git a/src/java.base/share/classes/sun/security/ssl/SSLSocketInputRecord.java b/src/java.base/share/classes/sun/security/ssl/SSLSocketInputRecord.java index da189f4f3ff..7afacb0f3d7 100644 --- a/src/java.base/share/classes/sun/security/ssl/SSLSocketInputRecord.java +++ b/src/java.base/share/classes/sun/security/ssl/SSLSocketInputRecord.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2022, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2020, Azul Systems, Inc. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -263,8 +263,7 @@ final class SSLSocketInputRecord extends InputRecord implements SSLRecord { } catch (BadPaddingException bpe) { throw bpe; } catch (GeneralSecurityException gse) { - throw (SSLProtocolException)(new SSLProtocolException( - "Unexpected exception")).initCause(gse); + throw new SSLProtocolException("Unexpected exception", gse); } if (contentType != ContentType.HANDSHAKE.id && diff --git a/src/java.base/share/classes/sun/security/ssl/SSLTrafficKeyDerivation.java b/src/java.base/share/classes/sun/security/ssl/SSLTrafficKeyDerivation.java index ac39cbb16fb..6e890c8818d 100644 --- a/src/java.base/share/classes/sun/security/ssl/SSLTrafficKeyDerivation.java +++ b/src/java.base/share/classes/sun/security/ssl/SSLTrafficKeyDerivation.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2022, 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 @@ -154,8 +154,8 @@ enum SSLTrafficKeyDerivation implements SSLKeyDerivationGenerator { ks.getKeyLength(cs), ks.getAlgorithm(cs, algorithm)); } catch (GeneralSecurityException gse) { - throw (SSLHandshakeException)(new SSLHandshakeException( - "Could not generate secret").initCause(gse)); + throw new SSLHandshakeException( + "Could not generate secret", gse); } } diff --git a/src/java.base/share/classes/sun/security/ssl/ServerHello.java b/src/java.base/share/classes/sun/security/ssl/ServerHello.java index 193a71cde86..efbe860bfd6 100644 --- a/src/java.base/share/classes/sun/security/ssl/ServerHello.java +++ b/src/java.base/share/classes/sun/security/ssl/ServerHello.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2022, 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 @@ -1205,8 +1205,7 @@ final class ServerHello { hc.handshakeKeyDerivation = new SSLSecretDerivation(hc, earlySecret); } catch (GeneralSecurityException gse) { - throw (SSLHandshakeException) new SSLHandshakeException( - "Could not generate secret").initCause(gse); + throw new SSLHandshakeException("Could not generate secret", gse); } } diff --git a/src/java.base/share/classes/sun/security/ssl/ServerNameExtension.java b/src/java.base/share/classes/sun/security/ssl/ServerNameExtension.java index 74f38bf5b56..eaf154af3bb 100644 --- a/src/java.base/share/classes/sun/security/ssl/ServerNameExtension.java +++ b/src/java.base/share/classes/sun/security/ssl/ServerNameExtension.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2022, 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 @@ -135,9 +135,8 @@ final class ServerNameExtension { nameType + "), name=" + (new String(encoded, StandardCharsets.UTF_8)) + ", value={" + - Utilities.toHexString(encoded) + "}"); - throw hc.conContext.fatal(Alert.ILLEGAL_PARAMETER, - (SSLProtocolException)spe.initCause(iae)); + Utilities.toHexString(encoded) + "}", iae); + throw hc.conContext.fatal(Alert.ILLEGAL_PARAMETER, spe); } } else { try { @@ -146,9 +145,8 @@ final class ServerNameExtension { SSLProtocolException spe = new SSLProtocolException( "Illegal server name, type=(" + nameType + "), value={" + - Utilities.toHexString(encoded) + "}"); - throw hc.conContext.fatal(Alert.ILLEGAL_PARAMETER, - (SSLProtocolException)spe.initCause(iae)); + Utilities.toHexString(encoded) + "}", iae); + throw hc.conContext.fatal(Alert.ILLEGAL_PARAMETER, spe); } } diff --git a/src/java.naming/share/classes/com/sun/jndi/ldap/ext/StartTlsResponseImpl.java b/src/java.naming/share/classes/com/sun/jndi/ldap/ext/StartTlsResponseImpl.java index 3c75f75519a..41144b132c0 100644 --- a/src/java.naming/share/classes/com/sun/jndi/ldap/ext/StartTlsResponseImpl.java +++ b/src/java.naming/share/classes/com/sun/jndi/ldap/ext/StartTlsResponseImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2022, 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 @@ -435,11 +435,10 @@ public final class StartTlsResponseImpl extends StartTlsResponse { /* * Pass up the cause of the failure */ - throw(SSLPeerUnverifiedException) - new SSLPeerUnverifiedException("hostname of the server '" + + throw new SSLPeerUnverifiedException("hostname of the server '" + hostname + "' does not match the hostname in the " + - "server's certificate.").initCause(e); + "server's certificate.", e); } } diff --git a/src/java.net.http/share/classes/jdk/internal/net/http/HttpClientImpl.java b/src/java.net.http/share/classes/jdk/internal/net/http/HttpClientImpl.java index 6394b7b3cfa..fc2596e0aa4 100644 --- a/src/java.net.http/share/classes/jdk/internal/net/http/HttpClientImpl.java +++ b/src/java.net.http/share/classes/jdk/internal/net/http/HttpClientImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2022, 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 @@ -573,9 +573,7 @@ final class HttpClientImpl extends HttpClient implements Trackable { throw ce; } else if (throwable instanceof SSLHandshakeException) { // special case for SSLHandshakeException - SSLHandshakeException he = new SSLHandshakeException(msg); - he.initCause(throwable); - throw he; + throw new SSLHandshakeException(msg, throwable); } else if (throwable instanceof SSLException) { // any other SSLException is wrapped in a plain // SSLException diff --git a/src/java.net.http/share/classes/jdk/internal/net/http/common/SSLTube.java b/src/java.net.http/share/classes/jdk/internal/net/http/common/SSLTube.java index 42174ef9c44..e72ba9d33dc 100644 --- a/src/java.net.http/share/classes/jdk/internal/net/http/common/SSLTube.java +++ b/src/java.net.http/share/classes/jdk/internal/net/http/common/SSLTube.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2022, 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 @@ -592,9 +592,7 @@ public class SSLTube implements FlowTube { engine.isOutboundDone(), handshakeFailed); - SSLHandshakeException e = new SSLHandshakeException(handshakeFailed); - if (t != null) e.initCause(t); - return e; + return new SSLHandshakeException(handshakeFailed, t); } @Override diff --git a/test/jdk/javax/net/ssl/ALPN/SSLServerSocketAlpnTest.java b/test/jdk/javax/net/ssl/ALPN/SSLServerSocketAlpnTest.java index a9373ed09f9..2752649dc74 100644 --- a/test/jdk/javax/net/ssl/ALPN/SSLServerSocketAlpnTest.java +++ b/test/jdk/javax/net/ssl/ALPN/SSLServerSocketAlpnTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2022, 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 @@ -484,7 +484,7 @@ public class SSLServerSocketAlpnTest { */ if ((local != null) && (remote != null)) { // If both failed, return the curthread's exception. - local.initCause(remote); + local.addSuppressed(remote); exception = local; } else if (local != null) { exception = local; diff --git a/test/jdk/javax/net/ssl/ALPN/SSLSocketAlpnTest.java b/test/jdk/javax/net/ssl/ALPN/SSLSocketAlpnTest.java index ef72474f417..172eecd4608 100644 --- a/test/jdk/javax/net/ssl/ALPN/SSLSocketAlpnTest.java +++ b/test/jdk/javax/net/ssl/ALPN/SSLSocketAlpnTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2022, 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 @@ -480,7 +480,7 @@ public class SSLSocketAlpnTest { */ if ((local != null) && (remote != null)) { // If both failed, return the curthread's exception. - local.initCause(remote); + local.addSuppressed(remote); exception = local; } else if (local != null) { exception = local; diff --git a/test/jdk/javax/net/ssl/SSLException/CheckSSLHandshakeException.java b/test/jdk/javax/net/ssl/SSLException/CheckSSLHandshakeException.java new file mode 100644 index 00000000000..4c8aba3de44 --- /dev/null +++ b/test/jdk/javax/net/ssl/SSLException/CheckSSLHandshakeException.java @@ -0,0 +1,50 @@ +/* + * Copyright (C) 2022 THL A29 Limited, a Tencent company. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 8282723 + * @summary Add constructors taking a cause to JSSE exceptions + */ +import javax.net.ssl.SSLHandshakeException; +import java.util.Objects; + +public class CheckSSLHandshakeException { + private static String exceptionMessage = "message"; + private static Throwable exceptionCause = new RuntimeException(); + + public static void main(String[] args) throws Exception { + testException( + new SSLHandshakeException(exceptionMessage, exceptionCause)); + } + + private static void testException(Exception ex) { + if (!Objects.equals(ex.getMessage(), exceptionMessage)) { + throw new RuntimeException("Unexpected exception message"); + } + + if (ex.getCause() != exceptionCause) { + throw new RuntimeException("Unexpected exception cause"); + } + } +} diff --git a/test/jdk/javax/net/ssl/SSLException/CheckSSLKeyException.java b/test/jdk/javax/net/ssl/SSLException/CheckSSLKeyException.java new file mode 100644 index 00000000000..dcd62fcf8e7 --- /dev/null +++ b/test/jdk/javax/net/ssl/SSLException/CheckSSLKeyException.java @@ -0,0 +1,50 @@ +/* + * Copyright (C) 2022 THL A29 Limited, a Tencent company. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 8282723 + * @summary Add constructors taking a cause to JSSE exceptions + */ +import javax.net.ssl.SSLKeyException; +import java.util.Objects; + +public class CheckSSLKeyException { + private static String exceptionMessage = "message"; + private static Throwable exceptionCause = new RuntimeException(); + + public static void main(String[] args) throws Exception { + testException( + new SSLKeyException(exceptionMessage, exceptionCause)); + } + + private static void testException(Exception ex) { + if (!Objects.equals(ex.getMessage(), exceptionMessage)) { + throw new RuntimeException("Unexpected exception message"); + } + + if (ex.getCause() != exceptionCause) { + throw new RuntimeException("Unexpected exception cause"); + } + } +} diff --git a/test/jdk/javax/net/ssl/SSLException/CheckSSLPeerUnverifiedException.java b/test/jdk/javax/net/ssl/SSLException/CheckSSLPeerUnverifiedException.java new file mode 100644 index 00000000000..04184e99306 --- /dev/null +++ b/test/jdk/javax/net/ssl/SSLException/CheckSSLPeerUnverifiedException.java @@ -0,0 +1,50 @@ +/* + * Copyright (C) 2022 THL A29 Limited, a Tencent company. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 8282723 + * @summary Add constructors taking a cause to JSSE exceptions + */ +import javax.net.ssl.SSLPeerUnverifiedException; +import java.util.Objects; + +public class CheckSSLPeerUnverifiedException { + private static String exceptionMessage = "message"; + private static Throwable exceptionCause = new RuntimeException(); + + public static void main(String[] args) throws Exception { + testException( + new SSLPeerUnverifiedException(exceptionMessage, exceptionCause)); + } + + private static void testException(Exception ex) { + if (!Objects.equals(ex.getMessage(), exceptionMessage)) { + throw new RuntimeException("Unexpected exception message"); + } + + if (ex.getCause() != exceptionCause) { + throw new RuntimeException("Unexpected exception cause"); + } + } +} diff --git a/test/jdk/javax/net/ssl/SSLException/CheckSSLProtocolException.java b/test/jdk/javax/net/ssl/SSLException/CheckSSLProtocolException.java new file mode 100644 index 00000000000..3f62fac8f77 --- /dev/null +++ b/test/jdk/javax/net/ssl/SSLException/CheckSSLProtocolException.java @@ -0,0 +1,50 @@ +/* + * Copyright (C) 2022 THL A29 Limited, a Tencent company. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 8282723 + * @summary Add constructors taking a cause to JSSE exceptions + */ +import javax.net.ssl.SSLProtocolException; +import java.util.Objects; + +public class CheckSSLProtocolException { + private static String exceptionMessage = "message"; + private static Throwable exceptionCause = new RuntimeException(); + + public static void main(String[] args) throws Exception { + testException( + new SSLProtocolException(exceptionMessage, exceptionCause)); + } + + private static void testException(Exception ex) { + if (!Objects.equals(ex.getMessage(), exceptionMessage)) { + throw new RuntimeException("Unexpected exception message"); + } + + if (ex.getCause() != exceptionCause) { + throw new RuntimeException("Unexpected exception cause"); + } + } +} diff --git a/test/jdk/javax/net/ssl/templates/SSLSocketSSLEngineTemplate.java b/test/jdk/javax/net/ssl/templates/SSLSocketSSLEngineTemplate.java index 54b4e3c6840..cbb42ee1a69 100644 --- a/test/jdk/javax/net/ssl/templates/SSLSocketSSLEngineTemplate.java +++ b/test/jdk/javax/net/ssl/templates/SSLSocketSSLEngineTemplate.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2022, 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 @@ -349,13 +349,13 @@ public class SSLSocketSSLEngineTemplate { } finally { if (serverException != null) { if (clientException != null) { - serverException.initCause(clientException); + serverException.addSuppressed(clientException); } throw serverException; } if (clientException != null) { if (serverException != null) { - clientException.initCause(serverException); + clientException.addSuppressed(serverException); } throw clientException; } diff --git a/test/jdk/javax/net/ssl/templates/SSLSocketTemplate.java b/test/jdk/javax/net/ssl/templates/SSLSocketTemplate.java index ce2e3ee121b..f200752d2a7 100644 --- a/test/jdk/javax/net/ssl/templates/SSLSocketTemplate.java +++ b/test/jdk/javax/net/ssl/templates/SSLSocketTemplate.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2022, 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 @@ -544,7 +544,7 @@ public class SSLSocketTemplate { */ if ((local != null) && (remote != null)) { // If both failed, return the curthread's exception. - local.initCause(remote); + local.addSuppressed(remote); exception = local; } else if (local != null) { exception = local; -- GitLab From 8a2d5ab07e6a1668f3e3918bdc8a30bd28a8f93b Mon Sep 17 00:00:00 2001 From: Maxim Kartashev Date: Mon, 21 Mar 2022 07:21:00 +0000 Subject: [PATCH 291/340] 8282270: java/awt/Robot Screen Capture tests fail after 8280861 Reviewed-by: aivanov --- test/jdk/ProblemList.txt | 2 - .../HiDPIRobotScreenCaptureTest.java | 6 +- .../ScreenCaptureGtkTest.java | 61 ++++++++++++++----- 3 files changed, 49 insertions(+), 20 deletions(-) diff --git a/test/jdk/ProblemList.txt b/test/jdk/ProblemList.txt index 0bafc13a252..25858d1cb71 100644 --- a/test/jdk/ProblemList.txt +++ b/test/jdk/ProblemList.txt @@ -739,8 +739,6 @@ javax/swing/plaf/metal/MetalGradient/8163193/ButtonGradientTest.java 8277816 ma javax/swing/JInternalFrame/8160248/JInternalFrameDraggingTest.java 8277816 macosx-aarch64 javax/swing/JInternalFrame/8069348/bug8069348.java 8277816 macosx-aarch64 java/awt/Robot/HiDPIScreenCapture/ScreenCaptureTest.java 8277816 macosx-aarch64 -java/awt/Robot/HiDPIScreenCapture/ScreenCaptureGtkTest.java 8282270 linux-all -java/awt/Robot/HiDPIScreenCapture/HiDPIRobotScreenCaptureTest.java 8282270 windows-all java/awt/Robot/CheckCommonColors/CheckCommonColors.java 8277816 macosx-aarch64 java/awt/ColorClass/AlphaColorTest.java 8277816 macosx-aarch64 java/awt/AlphaComposite/WindowAlphaCompositeTest.java 8277816 macosx-aarch64 diff --git a/test/jdk/java/awt/Robot/HiDPIScreenCapture/HiDPIRobotScreenCaptureTest.java b/test/jdk/java/awt/Robot/HiDPIScreenCapture/HiDPIRobotScreenCaptureTest.java index 835a52c7719..db34b1714b5 100644 --- a/test/jdk/java/awt/Robot/HiDPIScreenCapture/HiDPIRobotScreenCaptureTest.java +++ b/test/jdk/java/awt/Robot/HiDPIScreenCapture/HiDPIRobotScreenCaptureTest.java @@ -66,14 +66,14 @@ public class HiDPIRobotScreenCaptureTest { } Frame frame = new Frame(); - // Position the frame on prime number coordinates to avoid - // them being multiple of the desktop scale; this tests Linux + // Position the frame on prime number coordinates (mind OFFSET) + // to avoid them being multiple of the desktop scale; this tests Linux // color picker better. // Also, the position should be far enough from the top left // corner of the screen to reduce the chance of being repositioned // by the system because that area's occupied by the global // menu bar and such. - frame.setBounds(83, 97, 400, 300); + frame.setBounds(78, 92, 100, 100); frame.setUndecorated(true); Panel panel = new Panel(new BorderLayout()); diff --git a/test/jdk/java/awt/Robot/HiDPIScreenCapture/ScreenCaptureGtkTest.java b/test/jdk/java/awt/Robot/HiDPIScreenCapture/ScreenCaptureGtkTest.java index ef45c08988a..6ba5ec18e0a 100644 --- a/test/jdk/java/awt/Robot/HiDPIScreenCapture/ScreenCaptureGtkTest.java +++ b/test/jdk/java/awt/Robot/HiDPIScreenCapture/ScreenCaptureGtkTest.java @@ -31,6 +31,12 @@ import java.awt.Panel; import java.awt.Point; import java.awt.Rectangle; import java.awt.Robot; +import java.awt.image.BufferedImage; +import javax.swing.UIManager; +import javax.imageio.ImageIO; +import java.io.File; +import java.io.IOException; + /** * @test @@ -40,11 +46,7 @@ import java.awt.Robot; * Gtk backends and presence of UI scaling * @requires os.family == "linux" * @run main/othervm -Djdk.gtk.version=2 -Dsun.java2d.uiScale=1 ScreenCaptureGtkTest - * @run main/othervm -Djdk.gtk.version=2 -Dsun.java2d.uiScale=2 ScreenCaptureGtkTest - * @run main/othervm -Djdk.gtk.version=2 -Dsun.java2d.uiScale=3 ScreenCaptureGtkTest * @run main/othervm -Djdk.gtk.version=3 -Dsun.java2d.uiScale=1 ScreenCaptureGtkTest - * @run main/othervm -Djdk.gtk.version=3 -Dsun.java2d.uiScale=2 ScreenCaptureGtkTest - * @run main/othervm -Djdk.gtk.version=3 -Dsun.java2d.uiScale=3 ScreenCaptureGtkTest */ public class ScreenCaptureGtkTest { @@ -52,15 +54,18 @@ public class ScreenCaptureGtkTest { Color.GREEN, Color.BLUE, Color.ORANGE, Color.RED}; public static void main(String[] args) throws Exception { + final int topOffset = 50; + final int leftOffset = 50; + Frame frame = new Frame(); - // Position the frame on prime number coordinates to avoid - // them being multiple of the desktop scale; this tests Linux - // color picker better. + // Position the frame such that color picker will work with + // prime number coordinates (mind the offset) to avoid them being + // multiple of the desktop scale; this tests Linux color picker better. // Also, the position should be far enough from the top left // corner of the screen to reduce the chance of being repositioned // by the system because that area's occupied by the global // menu bar and such. - frame.setBounds(83, 97, 400, 300); + frame.setBounds(89, 99, 100, 100); frame.setUndecorated(true); Panel panel = new Panel(new BorderLayout()); @@ -74,9 +79,9 @@ public class ScreenCaptureGtkTest { g.fillRect(0, 0, w, h); // Paint several distinct pixels next to one another // in order to test color picker's precision. - for (int i = 1; i < 4; i++) { + for (int i = 1; i < COLORS.length; i++) { g.setColor(COLORS[i]); - g.fillRect(i, 0, 1, 1); + g.fillRect(leftOffset + i, topOffset, 1, 1); } } }; @@ -88,19 +93,25 @@ public class ScreenCaptureGtkTest { robot.waitForIdle(); robot.delay(500); - final Point screenLocation = frame.getLocationOnScreen(); - checkPixelColors(robot, screenLocation.x, screenLocation.y); + captureImageOf(frame, robot); - robot.delay(100); - frame.dispose(); + final Point screenLocation = frame.getLocationOnScreen(); + try { + checkPixelColors(robot, screenLocation.x + leftOffset, + screenLocation.y + topOffset); + } finally { + robot.delay(100); + frame.dispose(); + } } static void checkPixelColors(Robot robot, int x, int y) { - for (int i = 0; i < 4; i++) { + for (int i = 0; i < COLORS.length; i++) { final Color actualColor = robot.getPixelColor(x + i, y); System.out.print("Checking color at " + (x + i) + ", " + y + " to be equal to " + COLORS[i]); if (!actualColor.equals(COLORS[i])) { System.out.println("... Mismatch: found " + actualColor + " instead"); + saveImage(); throw new RuntimeException("Wrong screen pixel color"); } else { @@ -108,4 +119,24 @@ public class ScreenCaptureGtkTest { } } } + + private static BufferedImage image; + + static void captureImageOf(Frame frame, Robot robot) { + Rectangle rect = frame.getBounds(); + rect.setLocation(frame.getLocationOnScreen()); + + System.out.println("Creating screen capture of " + rect); + image = robot.createScreenCapture(rect); + } + + static void saveImage() { + System.out.println("Check image.png"); + try { + ImageIO.write(image, "png", new File("image.png")); + } catch(IOException e) { + System.out.println("failed to save image.png."); + e.printStackTrace(); + } + } } -- GitLab From b451273d209d9dfce3d7c4464defe0df523dfc7c Mon Sep 17 00:00:00 2001 From: Manukumar V S Date: Mon, 21 Mar 2022 07:33:20 +0000 Subject: [PATCH 292/340] 8282548: Create a regression test for JDK-4330998 Reviewed-by: aivanov --- .../4330998/JEditorPaneSetTextNullTest.java | 45 +++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 test/jdk/javax/swing/JEditorPane/4330998/JEditorPaneSetTextNullTest.java diff --git a/test/jdk/javax/swing/JEditorPane/4330998/JEditorPaneSetTextNullTest.java b/test/jdk/javax/swing/JEditorPane/4330998/JEditorPaneSetTextNullTest.java new file mode 100644 index 00000000000..5b543894ef6 --- /dev/null +++ b/test/jdk/javax/swing/JEditorPane/4330998/JEditorPaneSetTextNullTest.java @@ -0,0 +1,45 @@ + /* + * Copyright (c) 2013, 2022, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + + import javax.swing.JEditorPane; + import javax.swing.SwingUtilities; + + /* + * @test + * @bug 4330998 + * @summary Verifies that JEditorPane.setText(null) doesn't throw NullPointerException. + * @run main JEditorPaneSetTextNullTest + */ + public class JEditorPaneSetTextNullTest { + + public static void main(String[] args) throws Exception { + try { + SwingUtilities.invokeAndWait(() -> new JEditorPane().setText(null)); + System.out.println("Test passed"); + } catch (Exception e) { + throw new RuntimeException("Test failed, caught Exception " + e + + " when calling JEditorPane.setText(null)"); + } + } + + } -- GitLab From 83a1c90433343107eaa2a7fa41b9b07f86b6ce19 Mon Sep 17 00:00:00 2001 From: Manukumar V S Date: Mon, 21 Mar 2022 07:36:21 +0000 Subject: [PATCH 293/340] 8282789: Create a regression test for the JTree usecase of JDK-4618767 Reviewed-by: aivanov --- .../4618767/JTreeSelectedElementTest.java | 226 ++++++++++++++++++ 1 file changed, 226 insertions(+) create mode 100644 test/jdk/javax/swing/JTree/4618767/JTreeSelectedElementTest.java diff --git a/test/jdk/javax/swing/JTree/4618767/JTreeSelectedElementTest.java b/test/jdk/javax/swing/JTree/4618767/JTreeSelectedElementTest.java new file mode 100644 index 00000000000..19b00c05d37 --- /dev/null +++ b/test/jdk/javax/swing/JTree/4618767/JTreeSelectedElementTest.java @@ -0,0 +1,226 @@ +/* + * Copyright (c) 2002, 2022, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Point; +import java.awt.Rectangle; +import java.awt.Robot; +import java.awt.event.InputEvent; +import java.awt.event.KeyEvent; +import java.util.Arrays; +import java.util.List; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicBoolean; +import java.util.concurrent.atomic.AtomicReference; +import java.util.stream.Collectors; +import javax.swing.JFrame; +import javax.swing.JMenu; +import javax.swing.JMenuBar; +import javax.swing.JMenuItem; +import javax.swing.JTree; +import javax.swing.SwingUtilities; +import javax.swing.UIManager; +import javax.swing.UIManager.LookAndFeelInfo; +import javax.swing.UnsupportedLookAndFeelException; +import javax.swing.event.MenuEvent; +import javax.swing.event.MenuListener; + +import static javax.swing.UIManager.getInstalledLookAndFeels; + +/* + * @test + * @key headful + * @bug 4618767 + * @summary This test confirms that typing a letter while a JTree has focus now makes the selection + * not jump to the item whose text starts with that letter if that typed letter is accompanied + * by modifier keys such as ALT or CTRL(eg: ALT+F). + * @run main JTreeSelectedElementTest + */ +public class JTreeSelectedElementTest { + + private static final int FILE_MENU = KeyEvent.VK_F; + private static JFrame frame; + private static JTree tree; + private static Robot robot; + private static CountDownLatch menuSelectedEventLatch; + + public static void main(String[] args) throws Exception { + robot = new Robot(); + robot.setAutoWaitForIdle(true); + robot.setAutoDelay(200); + + final boolean isMac = System.getProperty("os.name") + .toLowerCase() + .contains("os x"); + + List lafs = Arrays.stream(getInstalledLookAndFeels()) + .map(LookAndFeelInfo::getClassName) + .collect(Collectors.toList()); + for (final String laf : lafs) { + menuSelectedEventLatch = new CountDownLatch(1); + try { + AtomicBoolean lafSetSuccess = new AtomicBoolean(false); + SwingUtilities.invokeAndWait(() -> { + lafSetSuccess.set(setLookAndFeel(laf)); + if (lafSetSuccess.get()) { + createUI(); + } + }); + if (!lafSetSuccess.get()) { + continue; + } + robot.waitForIdle(); + + // Select the node named as 'colors' + Point pt = getNodeLocation(1); + robot.mouseMove(pt.x, pt.y); + robot.mousePress(InputEvent.BUTTON1_DOWN_MASK); + robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); + + // Assertion check to verify that the selected node is 'colors' + final String elementSelBefore = getCurrentNodeName(); + if (!"colors".equals(elementSelBefore)) { + throw new RuntimeException("Test failed for " + laf + + " as the tree node selected: " + elementSelBefore + + " is not the expected one 'colors'" + ); + } + + // Now operate Menu using Mnemonics, different key combinations for different OSes. + // For most OSes it's ALT+F; on macOS it's ALT+CNTRL+F except for Nimbus LaF. + if (isMac && !laf.contains("Nimbus")) { + hitKeys(KeyEvent.VK_ALT, KeyEvent.VK_CONTROL, FILE_MENU); + } else { + hitKeys(KeyEvent.VK_ALT, FILE_MENU); + } + + // Wait until the menu got selected. + if (!menuSelectedEventLatch.await(3, TimeUnit.SECONDS)) { + throw new RuntimeException("Waited too long, but can't select menu using mnemonics for " + laf); + } + + hitKeys(KeyEvent.VK_ENTER); + + String elementSelAfter = getCurrentNodeName(); + + // As per the fix of BugID 4618767, the tree element selection should not change + if (!elementSelBefore.equals(elementSelAfter)) { + throw new RuntimeException("Test failed for " + laf + + " as tree.getLastSelectedPathComponent() before: " + elementSelBefore + + " not same as tree.getLastSelectedPathComponent() after pressing Enter: " + + elementSelAfter + ); + } + + System.out.println("Test passed for laf: " + laf); + + } finally { + SwingUtilities.invokeAndWait(JTreeSelectedElementTest::disposeFrame); + } + } + } + + private static void hitKeys(int... keys) { + for (int key : keys) { + robot.keyPress(key); + } + + for (int i = keys.length - 1; i >= 0; i--) { + robot.keyRelease(keys[i]); + } + } + + private static String getCurrentNodeName() throws Exception { + AtomicReference nodeName = new AtomicReference<>(); + SwingUtilities.invokeAndWait(() -> { + nodeName.set(tree.getLastSelectedPathComponent().toString().trim()); + }); + return nodeName.get(); + } + + private static Point getNodeLocation(int rowCount) throws Exception { + AtomicReference treeNodeLoc = new AtomicReference<>(); + SwingUtilities.invokeAndWait(() -> { + final Point locationOnScreen = tree.getLocationOnScreen(); + Rectangle rt = tree.getPathBounds(tree.getPathForRow(rowCount)); + locationOnScreen.translate(rt.x + rt.width / 2, rt.y + rt.height / 2); + treeNodeLoc.set(locationOnScreen); + }); + return treeNodeLoc.get(); + } + + private static void createUI() { + frame = new JFrame(); + tree = new JTree(); + JMenu menu = new JMenu("File"); + menu.setMnemonic(FILE_MENU); + JMenuItem menuItem = new JMenuItem("Dummy"); + menu.add(menuItem); + menu.addMenuListener(new MenuListener() { + @Override + public void menuSelected(MenuEvent e) { + menuSelectedEventLatch.countDown(); + } + + @Override + public void menuDeselected(MenuEvent e) { + } + + @Override + public void menuCanceled(MenuEvent e) { + } + }); + + JMenuBar menuBar = new JMenuBar(); + menuBar.add(menu); + + frame.setJMenuBar(menuBar); + frame.setContentPane(tree); + frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); + frame.pack(); + frame.setAlwaysOnTop(true); + frame.setLocationRelativeTo(null); + frame.setVisible(true); + } + + private static boolean setLookAndFeel(String lafName) { + try { + UIManager.setLookAndFeel(lafName); + } catch (UnsupportedLookAndFeelException ignored) { + System.out.println("Ignoring Unsupported L&F: " + lafName); + return false; + } catch (ClassNotFoundException | InstantiationException + | IllegalAccessException e) { + throw new RuntimeException(e); + } + return true; + } + + private static void disposeFrame() { + if (frame != null) { + frame.dispose(); + frame = null; + } + } + +} -- GitLab From e709cb05dcf67462f266c1f3dae30976b562676d Mon Sep 17 00:00:00 2001 From: Thomas Schatzl Date: Mon, 21 Mar 2022 08:25:33 +0000 Subject: [PATCH 294/340] 8283186: Explicitly pass a third temp register to MacroAssembler::store_heap_oop Reviewed-by: eosterlund --- .../x86/gc/g1/g1BarrierSetAssembler_x86.cpp | 7 ++- .../x86/gc/g1/g1BarrierSetAssembler_x86.hpp | 2 +- .../x86/gc/shared/barrierSetAssembler_x86.cpp | 2 +- .../x86/gc/shared/barrierSetAssembler_x86.hpp | 2 +- .../cardTableBarrierSetAssembler_x86.cpp | 4 +- .../cardTableBarrierSetAssembler_x86.hpp | 2 +- .../shared/modRefBarrierSetAssembler_x86.cpp | 6 +-- .../shared/modRefBarrierSetAssembler_x86.hpp | 4 +- .../shenandoahBarrierSetAssembler_x86.cpp | 9 ++-- .../shenandoahBarrierSetAssembler_x86.hpp | 2 +- .../cpu/x86/gc/z/zBarrierSetAssembler_x86.cpp | 5 +- .../cpu/x86/gc/z/zBarrierSetAssembler_x86.hpp | 3 +- src/hotspot/cpu/x86/macroAssembler_x86.cpp | 12 ++--- src/hotspot/cpu/x86/macroAssembler_x86.hpp | 4 +- src/hotspot/cpu/x86/stubGenerator_x86_64.cpp | 2 +- src/hotspot/cpu/x86/templateTable_x86.cpp | 46 +++++++++---------- 16 files changed, 56 insertions(+), 56 deletions(-) diff --git a/src/hotspot/cpu/x86/gc/g1/g1BarrierSetAssembler_x86.cpp b/src/hotspot/cpu/x86/gc/g1/g1BarrierSetAssembler_x86.cpp index 6525b13c5c2..0fb005ce06f 100644 --- a/src/hotspot/cpu/x86/gc/g1/g1BarrierSetAssembler_x86.cpp +++ b/src/hotspot/cpu/x86/gc/g1/g1BarrierSetAssembler_x86.cpp @@ -342,7 +342,7 @@ void G1BarrierSetAssembler::g1_write_barrier_post(MacroAssembler* masm, } void G1BarrierSetAssembler::oop_store_at(MacroAssembler* masm, DecoratorSet decorators, BasicType type, - Address dst, Register val, Register tmp1, Register tmp2) { + Address dst, Register val, Register tmp1, Register tmp2, Register tmp3) { bool in_heap = (decorators & IN_HEAP) != 0; bool as_normal = (decorators & AS_NORMAL) != 0; assert((decorators & IS_DEST_UNINITIALIZED) == 0, "unsupported"); @@ -350,7 +350,6 @@ void G1BarrierSetAssembler::oop_store_at(MacroAssembler* masm, DecoratorSet deco bool needs_pre_barrier = as_normal; bool needs_post_barrier = val != noreg && in_heap; - Register tmp3 = LP64_ONLY(r8) NOT_LP64(rsi); Register rthread = LP64_ONLY(r15_thread) NOT_LP64(rcx); // flatten object address if needed // We do it regardless of precise because we need the registers @@ -379,7 +378,7 @@ void G1BarrierSetAssembler::oop_store_at(MacroAssembler* masm, DecoratorSet deco false /* expand_call */); } if (val == noreg) { - BarrierSetAssembler::store_at(masm, decorators, type, Address(tmp1, 0), val, noreg, noreg); + BarrierSetAssembler::store_at(masm, decorators, type, Address(tmp1, 0), val, noreg, noreg, noreg); } else { Register new_val = val; if (needs_post_barrier) { @@ -389,7 +388,7 @@ void G1BarrierSetAssembler::oop_store_at(MacroAssembler* masm, DecoratorSet deco __ movptr(new_val, val); } } - BarrierSetAssembler::store_at(masm, decorators, type, Address(tmp1, 0), val, noreg, noreg); + BarrierSetAssembler::store_at(masm, decorators, type, Address(tmp1, 0), val, noreg, noreg, noreg); if (needs_post_barrier) { g1_write_barrier_post(masm /*masm*/, tmp1 /* store_adr */, diff --git a/src/hotspot/cpu/x86/gc/g1/g1BarrierSetAssembler_x86.hpp b/src/hotspot/cpu/x86/gc/g1/g1BarrierSetAssembler_x86.hpp index 94bbadc7b2b..a5695f5657a 100644 --- a/src/hotspot/cpu/x86/gc/g1/g1BarrierSetAssembler_x86.hpp +++ b/src/hotspot/cpu/x86/gc/g1/g1BarrierSetAssembler_x86.hpp @@ -54,7 +54,7 @@ class G1BarrierSetAssembler: public ModRefBarrierSetAssembler { Register tmp2); virtual void oop_store_at(MacroAssembler* masm, DecoratorSet decorators, BasicType type, - Address dst, Register val, Register tmp1, Register tmp2); + Address dst, Register val, Register tmp1, Register tmp2, Register tmp3); public: void gen_pre_barrier_stub(LIR_Assembler* ce, G1PreBarrierStub* stub); diff --git a/src/hotspot/cpu/x86/gc/shared/barrierSetAssembler_x86.cpp b/src/hotspot/cpu/x86/gc/shared/barrierSetAssembler_x86.cpp index 55823bdf217..930926bbb17 100644 --- a/src/hotspot/cpu/x86/gc/shared/barrierSetAssembler_x86.cpp +++ b/src/hotspot/cpu/x86/gc/shared/barrierSetAssembler_x86.cpp @@ -103,7 +103,7 @@ void BarrierSetAssembler::load_at(MacroAssembler* masm, DecoratorSet decorators, } void BarrierSetAssembler::store_at(MacroAssembler* masm, DecoratorSet decorators, BasicType type, - Address dst, Register val, Register tmp1, Register tmp2) { + Address dst, Register val, Register tmp1, Register tmp2, Register tmp3) { bool in_heap = (decorators & IN_HEAP) != 0; bool in_native = (decorators & IN_NATIVE) != 0; bool is_not_null = (decorators & IS_NOT_NULL) != 0; diff --git a/src/hotspot/cpu/x86/gc/shared/barrierSetAssembler_x86.hpp b/src/hotspot/cpu/x86/gc/shared/barrierSetAssembler_x86.hpp index 3c63c00e4db..085238d60b5 100644 --- a/src/hotspot/cpu/x86/gc/shared/barrierSetAssembler_x86.hpp +++ b/src/hotspot/cpu/x86/gc/shared/barrierSetAssembler_x86.hpp @@ -47,7 +47,7 @@ public: virtual void load_at(MacroAssembler* masm, DecoratorSet decorators, BasicType type, Register dst, Address src, Register tmp1, Register tmp_thread); virtual void store_at(MacroAssembler* masm, DecoratorSet decorators, BasicType type, - Address dst, Register val, Register tmp1, Register tmp2); + Address dst, Register val, Register tmp1, Register tmp2, Register tmp3); // Support for jniFastGetField to try resolving a jobject/jweak in native virtual void try_resolve_jobject_in_native(MacroAssembler* masm, Register jni_env, diff --git a/src/hotspot/cpu/x86/gc/shared/cardTableBarrierSetAssembler_x86.cpp b/src/hotspot/cpu/x86/gc/shared/cardTableBarrierSetAssembler_x86.cpp index 7fc36ffae8f..f314cac5980 100644 --- a/src/hotspot/cpu/x86/gc/shared/cardTableBarrierSetAssembler_x86.cpp +++ b/src/hotspot/cpu/x86/gc/shared/cardTableBarrierSetAssembler_x86.cpp @@ -128,7 +128,7 @@ void CardTableBarrierSetAssembler::store_check(MacroAssembler* masm, Register ob } void CardTableBarrierSetAssembler::oop_store_at(MacroAssembler* masm, DecoratorSet decorators, BasicType type, - Address dst, Register val, Register tmp1, Register tmp2) { + Address dst, Register val, Register tmp1, Register tmp2, Register tmp3) { bool in_heap = (decorators & IN_HEAP) != 0; bool is_array = (decorators & IS_ARRAY) != 0; @@ -137,7 +137,7 @@ void CardTableBarrierSetAssembler::oop_store_at(MacroAssembler* masm, DecoratorS bool needs_post_barrier = val != noreg && in_heap; - BarrierSetAssembler::store_at(masm, decorators, type, dst, val, noreg, noreg); + BarrierSetAssembler::store_at(masm, decorators, type, dst, val, noreg, noreg, noreg); if (needs_post_barrier) { // flatten object address if needed if (!precise || (dst.index() == noreg && dst.disp() == 0)) { diff --git a/src/hotspot/cpu/x86/gc/shared/cardTableBarrierSetAssembler_x86.hpp b/src/hotspot/cpu/x86/gc/shared/cardTableBarrierSetAssembler_x86.hpp index a65286bd599..4760b222977 100644 --- a/src/hotspot/cpu/x86/gc/shared/cardTableBarrierSetAssembler_x86.hpp +++ b/src/hotspot/cpu/x86/gc/shared/cardTableBarrierSetAssembler_x86.hpp @@ -35,7 +35,7 @@ protected: virtual void gen_write_ref_array_post_barrier(MacroAssembler* masm, DecoratorSet decorators, Register addr, Register count, Register tmp); virtual void oop_store_at(MacroAssembler* masm, DecoratorSet decorators, BasicType type, - Address dst, Register val, Register tmp1, Register tmp2); + Address dst, Register val, Register tmp1, Register tmp2, Register tmp3); }; #endif // CPU_X86_GC_SHARED_CARDTABLEBARRIERSETASSEMBLER_X86_HPP diff --git a/src/hotspot/cpu/x86/gc/shared/modRefBarrierSetAssembler_x86.cpp b/src/hotspot/cpu/x86/gc/shared/modRefBarrierSetAssembler_x86.cpp index 9325ab7ecf9..618095bdfa6 100644 --- a/src/hotspot/cpu/x86/gc/shared/modRefBarrierSetAssembler_x86.cpp +++ b/src/hotspot/cpu/x86/gc/shared/modRefBarrierSetAssembler_x86.cpp @@ -84,10 +84,10 @@ void ModRefBarrierSetAssembler::arraycopy_epilogue(MacroAssembler* masm, Decorat } void ModRefBarrierSetAssembler::store_at(MacroAssembler* masm, DecoratorSet decorators, BasicType type, - Address dst, Register val, Register tmp1, Register tmp2) { + Address dst, Register val, Register tmp1, Register tmp2, Register tmp3) { if (is_reference_type(type)) { - oop_store_at(masm, decorators, type, dst, val, tmp1, tmp2); + oop_store_at(masm, decorators, type, dst, val, tmp1, tmp2, tmp3); } else { - BarrierSetAssembler::store_at(masm, decorators, type, dst, val, tmp1, tmp2); + BarrierSetAssembler::store_at(masm, decorators, type, dst, val, tmp1, tmp2, tmp3); } } diff --git a/src/hotspot/cpu/x86/gc/shared/modRefBarrierSetAssembler_x86.hpp b/src/hotspot/cpu/x86/gc/shared/modRefBarrierSetAssembler_x86.hpp index 39950225bfe..c8b5043256a 100644 --- a/src/hotspot/cpu/x86/gc/shared/modRefBarrierSetAssembler_x86.hpp +++ b/src/hotspot/cpu/x86/gc/shared/modRefBarrierSetAssembler_x86.hpp @@ -39,7 +39,7 @@ protected: virtual void gen_write_ref_array_post_barrier(MacroAssembler* masm, DecoratorSet decorators, Register addr, Register count, Register tmp) {} virtual void oop_store_at(MacroAssembler* masm, DecoratorSet decorators, BasicType type, - Address dst, Register val, Register tmp1, Register tmp2) = 0; + Address dst, Register val, Register tmp1, Register tmp2, Register tmp3) = 0; public: virtual void arraycopy_prologue(MacroAssembler* masm, DecoratorSet decorators, BasicType type, Register src, Register dst, Register count); @@ -47,7 +47,7 @@ public: Register src, Register dst, Register count); virtual void store_at(MacroAssembler* masm, DecoratorSet decorators, BasicType type, - Address dst, Register val, Register tmp1, Register tmp2); + Address dst, Register val, Register tmp1, Register tmp2, Register tmp3); }; #endif // CPU_X86_GC_SHARED_MODREFBARRIERSETASSEMBLER_X86_HPP diff --git a/src/hotspot/cpu/x86/gc/shenandoah/shenandoahBarrierSetAssembler_x86.cpp b/src/hotspot/cpu/x86/gc/shenandoah/shenandoahBarrierSetAssembler_x86.cpp index 64169b01529..d213e6fda39 100644 --- a/src/hotspot/cpu/x86/gc/shenandoah/shenandoahBarrierSetAssembler_x86.cpp +++ b/src/hotspot/cpu/x86/gc/shenandoah/shenandoahBarrierSetAssembler_x86.cpp @@ -591,7 +591,7 @@ void ShenandoahBarrierSetAssembler::load_at(MacroAssembler* masm, DecoratorSet d } void ShenandoahBarrierSetAssembler::store_at(MacroAssembler* masm, DecoratorSet decorators, BasicType type, - Address dst, Register val, Register tmp1, Register tmp2) { + Address dst, Register val, Register tmp1, Register tmp2, Register tmp3) { bool on_oop = is_reference_type(type); bool in_heap = (decorators & IN_HEAP) != 0; @@ -599,7 +599,6 @@ void ShenandoahBarrierSetAssembler::store_at(MacroAssembler* masm, DecoratorSet if (on_oop && in_heap) { bool needs_pre_barrier = as_normal; - Register tmp3 = LP64_ONLY(r8) NOT_LP64(rsi); Register rthread = LP64_ONLY(r15_thread) NOT_LP64(rcx); // flatten object address if needed // We do it regardless of precise because we need the registers @@ -629,14 +628,14 @@ void ShenandoahBarrierSetAssembler::store_at(MacroAssembler* masm, DecoratorSet false /* expand_call */); } if (val == noreg) { - BarrierSetAssembler::store_at(masm, decorators, type, Address(tmp1, 0), val, noreg, noreg); + BarrierSetAssembler::store_at(masm, decorators, type, Address(tmp1, 0), val, noreg, noreg, noreg); } else { iu_barrier(masm, val, tmp3); - BarrierSetAssembler::store_at(masm, decorators, type, Address(tmp1, 0), val, noreg, noreg); + BarrierSetAssembler::store_at(masm, decorators, type, Address(tmp1, 0), val, noreg, noreg, noreg); } NOT_LP64(imasm->restore_bcp()); } else { - BarrierSetAssembler::store_at(masm, decorators, type, dst, val, tmp1, tmp2); + BarrierSetAssembler::store_at(masm, decorators, type, dst, val, tmp1, tmp2, tmp3); } } diff --git a/src/hotspot/cpu/x86/gc/shenandoah/shenandoahBarrierSetAssembler_x86.hpp b/src/hotspot/cpu/x86/gc/shenandoah/shenandoahBarrierSetAssembler_x86.hpp index 2a8c0862b9e..47dfe144928 100644 --- a/src/hotspot/cpu/x86/gc/shenandoah/shenandoahBarrierSetAssembler_x86.hpp +++ b/src/hotspot/cpu/x86/gc/shenandoah/shenandoahBarrierSetAssembler_x86.hpp @@ -77,7 +77,7 @@ public: virtual void load_at(MacroAssembler* masm, DecoratorSet decorators, BasicType type, Register dst, Address src, Register tmp1, Register tmp_thread); virtual void store_at(MacroAssembler* masm, DecoratorSet decorators, BasicType type, - Address dst, Register val, Register tmp1, Register tmp2); + Address dst, Register val, Register tmp1, Register tmp2, Register tmp3); virtual void try_resolve_jobject_in_native(MacroAssembler* masm, Register jni_env, Register obj, Register tmp, Label& slowpath); }; diff --git a/src/hotspot/cpu/x86/gc/z/zBarrierSetAssembler_x86.cpp b/src/hotspot/cpu/x86/gc/z/zBarrierSetAssembler_x86.cpp index 8c74db952e8..00071d66da3 100644 --- a/src/hotspot/cpu/x86/gc/z/zBarrierSetAssembler_x86.cpp +++ b/src/hotspot/cpu/x86/gc/z/zBarrierSetAssembler_x86.cpp @@ -193,7 +193,8 @@ void ZBarrierSetAssembler::store_at(MacroAssembler* masm, Address dst, Register src, Register tmp1, - Register tmp2) { + Register tmp2, + Register tmp3) { BLOCK_COMMENT("ZBarrierSetAssembler::store_at {"); // Verify oop store @@ -211,7 +212,7 @@ void ZBarrierSetAssembler::store_at(MacroAssembler* masm, } // Store value - BarrierSetAssembler::store_at(masm, decorators, type, dst, src, tmp1, tmp2); + BarrierSetAssembler::store_at(masm, decorators, type, dst, src, tmp1, tmp2, tmp3); BLOCK_COMMENT("} ZBarrierSetAssembler::store_at"); } diff --git a/src/hotspot/cpu/x86/gc/z/zBarrierSetAssembler_x86.hpp b/src/hotspot/cpu/x86/gc/z/zBarrierSetAssembler_x86.hpp index 134f7e6c9e2..2446bd1e46a 100644 --- a/src/hotspot/cpu/x86/gc/z/zBarrierSetAssembler_x86.hpp +++ b/src/hotspot/cpu/x86/gc/z/zBarrierSetAssembler_x86.hpp @@ -61,7 +61,8 @@ public: Address dst, Register src, Register tmp1, - Register tmp2); + Register tmp2, + Register tmp3); #endif // ASSERT virtual void arraycopy_prologue(MacroAssembler* masm, diff --git a/src/hotspot/cpu/x86/macroAssembler_x86.cpp b/src/hotspot/cpu/x86/macroAssembler_x86.cpp index 7659598fcb7..944e7b9b816 100644 --- a/src/hotspot/cpu/x86/macroAssembler_x86.cpp +++ b/src/hotspot/cpu/x86/macroAssembler_x86.cpp @@ -4590,14 +4590,14 @@ void MacroAssembler::access_load_at(BasicType type, DecoratorSet decorators, Reg } void MacroAssembler::access_store_at(BasicType type, DecoratorSet decorators, Address dst, Register src, - Register tmp1, Register tmp2) { + Register tmp1, Register tmp2, Register tmp3) { BarrierSetAssembler* bs = BarrierSet::barrier_set()->barrier_set_assembler(); decorators = AccessInternal::decorator_fixup(decorators); bool as_raw = (decorators & AS_RAW) != 0; if (as_raw) { - bs->BarrierSetAssembler::store_at(this, decorators, type, dst, src, tmp1, tmp2); + bs->BarrierSetAssembler::store_at(this, decorators, type, dst, src, tmp1, tmp2, tmp3); } else { - bs->store_at(this, decorators, type, dst, src, tmp1, tmp2); + bs->store_at(this, decorators, type, dst, src, tmp1, tmp2, tmp3); } } @@ -4613,13 +4613,13 @@ void MacroAssembler::load_heap_oop_not_null(Register dst, Address src, Register } void MacroAssembler::store_heap_oop(Address dst, Register src, Register tmp1, - Register tmp2, DecoratorSet decorators) { - access_store_at(T_OBJECT, IN_HEAP | decorators, dst, src, tmp1, tmp2); + Register tmp2, Register tmp3, DecoratorSet decorators) { + access_store_at(T_OBJECT, IN_HEAP | decorators, dst, src, tmp1, tmp2, tmp3); } // Used for storing NULLs. void MacroAssembler::store_heap_oop_null(Address dst) { - access_store_at(T_OBJECT, IN_HEAP, dst, noreg, noreg, noreg); + access_store_at(T_OBJECT, IN_HEAP, dst, noreg, noreg, noreg, noreg); } #ifdef _LP64 diff --git a/src/hotspot/cpu/x86/macroAssembler_x86.hpp b/src/hotspot/cpu/x86/macroAssembler_x86.hpp index 3bffad9940b..918019d015c 100644 --- a/src/hotspot/cpu/x86/macroAssembler_x86.hpp +++ b/src/hotspot/cpu/x86/macroAssembler_x86.hpp @@ -345,14 +345,14 @@ class MacroAssembler: public Assembler { void access_load_at(BasicType type, DecoratorSet decorators, Register dst, Address src, Register tmp1, Register thread_tmp); void access_store_at(BasicType type, DecoratorSet decorators, Address dst, Register src, - Register tmp1, Register tmp2); + Register tmp1, Register tmp2, Register tmp3); void load_heap_oop(Register dst, Address src, Register tmp1 = noreg, Register thread_tmp = noreg, DecoratorSet decorators = 0); void load_heap_oop_not_null(Register dst, Address src, Register tmp1 = noreg, Register thread_tmp = noreg, DecoratorSet decorators = 0); void store_heap_oop(Address dst, Register src, Register tmp1 = noreg, - Register tmp2 = noreg, DecoratorSet decorators = 0); + Register tmp2 = noreg, Register tmp3 = noreg, DecoratorSet decorators = 0); // Used for storing NULL. All other oop constants should be // stored using routines that take a jobject. diff --git a/src/hotspot/cpu/x86/stubGenerator_x86_64.cpp b/src/hotspot/cpu/x86/stubGenerator_x86_64.cpp index 6bdff24bddd..39d5cbe2fb4 100644 --- a/src/hotspot/cpu/x86/stubGenerator_x86_64.cpp +++ b/src/hotspot/cpu/x86/stubGenerator_x86_64.cpp @@ -2848,7 +2848,7 @@ class StubGenerator: public StubCodeGenerator { __ align(OptoLoopAlignment); __ BIND(L_store_element); - __ store_heap_oop(to_element_addr, rax_oop, noreg, noreg, AS_RAW); // store the oop + __ store_heap_oop(to_element_addr, rax_oop, noreg, noreg, noreg, AS_RAW); // store the oop __ increment(count); // increment the count toward zero __ jcc(Assembler::zero, L_do_card_marks); diff --git a/src/hotspot/cpu/x86/templateTable_x86.cpp b/src/hotspot/cpu/x86/templateTable_x86.cpp index 0532fb17785..cadc71916db 100644 --- a/src/hotspot/cpu/x86/templateTable_x86.cpp +++ b/src/hotspot/cpu/x86/templateTable_x86.cpp @@ -152,7 +152,7 @@ static void do_oop_store(InterpreterMacroAssembler* _masm, Register val, DecoratorSet decorators = 0) { assert(val == noreg || val == rax, "parameter is just for looks"); - __ store_heap_oop(dst, val, rdx, rbx, decorators); + __ store_heap_oop(dst, val, rdx, rbx, LP64_ONLY(r8) NOT_LP64(rsi), decorators); } static void do_oop_load(InterpreterMacroAssembler* _masm, @@ -1067,7 +1067,7 @@ void TemplateTable::iastore() { __ access_store_at(T_INT, IN_HEAP | IS_ARRAY, Address(rdx, rbx, Address::times_4, arrayOopDesc::base_offset_in_bytes(T_INT)), - rax, noreg, noreg); + rax, noreg, noreg, noreg); } void TemplateTable::lastore() { @@ -1081,7 +1081,7 @@ void TemplateTable::lastore() { __ access_store_at(T_LONG, IN_HEAP | IS_ARRAY, Address(rcx, rbx, Address::times_8, arrayOopDesc::base_offset_in_bytes(T_LONG)), - noreg /* ltos */, noreg, noreg); + noreg /* ltos */, noreg, noreg, noreg); } @@ -1095,7 +1095,7 @@ void TemplateTable::fastore() { __ access_store_at(T_FLOAT, IN_HEAP | IS_ARRAY, Address(rdx, rbx, Address::times_4, arrayOopDesc::base_offset_in_bytes(T_FLOAT)), - noreg /* ftos */, noreg, noreg); + noreg /* ftos */, noreg, noreg, noreg); } void TemplateTable::dastore() { @@ -1108,7 +1108,7 @@ void TemplateTable::dastore() { __ access_store_at(T_DOUBLE, IN_HEAP | IS_ARRAY, Address(rdx, rbx, Address::times_8, arrayOopDesc::base_offset_in_bytes(T_DOUBLE)), - noreg /* dtos */, noreg, noreg); + noreg /* dtos */, noreg, noreg, noreg); } void TemplateTable::aastore() { @@ -1186,7 +1186,7 @@ void TemplateTable::bastore() { __ access_store_at(T_BYTE, IN_HEAP | IS_ARRAY, Address(rdx, rbx,Address::times_1, arrayOopDesc::base_offset_in_bytes(T_BYTE)), - rax, noreg, noreg); + rax, noreg, noreg, noreg); } void TemplateTable::castore() { @@ -1199,7 +1199,7 @@ void TemplateTable::castore() { __ access_store_at(T_CHAR, IN_HEAP | IS_ARRAY, Address(rdx, rbx, Address::times_2, arrayOopDesc::base_offset_in_bytes(T_CHAR)), - rax, noreg, noreg); + rax, noreg, noreg, noreg); } @@ -3102,7 +3102,7 @@ void TemplateTable::putfield_or_static_helper(int byte_no, bool is_static, Rewri { __ pop(btos); if (!is_static) pop_and_check_object(obj); - __ access_store_at(T_BYTE, IN_HEAP, field, rax, noreg, noreg); + __ access_store_at(T_BYTE, IN_HEAP, field, rax, noreg, noreg, noreg); if (!is_static && rc == may_rewrite) { patch_bytecode(Bytecodes::_fast_bputfield, bc, rbx, true, byte_no); } @@ -3117,7 +3117,7 @@ void TemplateTable::putfield_or_static_helper(int byte_no, bool is_static, Rewri { __ pop(ztos); if (!is_static) pop_and_check_object(obj); - __ access_store_at(T_BOOLEAN, IN_HEAP, field, rax, noreg, noreg); + __ access_store_at(T_BOOLEAN, IN_HEAP, field, rax, noreg, noreg, noreg); if (!is_static && rc == may_rewrite) { patch_bytecode(Bytecodes::_fast_zputfield, bc, rbx, true, byte_no); } @@ -3148,7 +3148,7 @@ void TemplateTable::putfield_or_static_helper(int byte_no, bool is_static, Rewri { __ pop(itos); if (!is_static) pop_and_check_object(obj); - __ access_store_at(T_INT, IN_HEAP, field, rax, noreg, noreg); + __ access_store_at(T_INT, IN_HEAP, field, rax, noreg, noreg, noreg); if (!is_static && rc == may_rewrite) { patch_bytecode(Bytecodes::_fast_iputfield, bc, rbx, true, byte_no); } @@ -3163,7 +3163,7 @@ void TemplateTable::putfield_or_static_helper(int byte_no, bool is_static, Rewri { __ pop(ctos); if (!is_static) pop_and_check_object(obj); - __ access_store_at(T_CHAR, IN_HEAP, field, rax, noreg, noreg); + __ access_store_at(T_CHAR, IN_HEAP, field, rax, noreg, noreg, noreg); if (!is_static && rc == may_rewrite) { patch_bytecode(Bytecodes::_fast_cputfield, bc, rbx, true, byte_no); } @@ -3178,7 +3178,7 @@ void TemplateTable::putfield_or_static_helper(int byte_no, bool is_static, Rewri { __ pop(stos); if (!is_static) pop_and_check_object(obj); - __ access_store_at(T_SHORT, IN_HEAP, field, rax, noreg, noreg); + __ access_store_at(T_SHORT, IN_HEAP, field, rax, noreg, noreg, noreg); if (!is_static && rc == may_rewrite) { patch_bytecode(Bytecodes::_fast_sputfield, bc, rbx, true, byte_no); } @@ -3194,7 +3194,7 @@ void TemplateTable::putfield_or_static_helper(int byte_no, bool is_static, Rewri __ pop(ltos); if (!is_static) pop_and_check_object(obj); // MO_RELAXED: generate atomic store for the case of volatile field (important for x86_32) - __ access_store_at(T_LONG, IN_HEAP | MO_RELAXED, field, noreg /* ltos*/, noreg, noreg); + __ access_store_at(T_LONG, IN_HEAP | MO_RELAXED, field, noreg /* ltos*/, noreg, noreg, noreg); #ifdef _LP64 if (!is_static && rc == may_rewrite) { patch_bytecode(Bytecodes::_fast_lputfield, bc, rbx, true, byte_no); @@ -3211,7 +3211,7 @@ void TemplateTable::putfield_or_static_helper(int byte_no, bool is_static, Rewri { __ pop(ftos); if (!is_static) pop_and_check_object(obj); - __ access_store_at(T_FLOAT, IN_HEAP, field, noreg /* ftos */, noreg, noreg); + __ access_store_at(T_FLOAT, IN_HEAP, field, noreg /* ftos */, noreg, noreg, noreg); if (!is_static && rc == may_rewrite) { patch_bytecode(Bytecodes::_fast_fputfield, bc, rbx, true, byte_no); } @@ -3230,7 +3230,7 @@ void TemplateTable::putfield_or_static_helper(int byte_no, bool is_static, Rewri __ pop(dtos); if (!is_static) pop_and_check_object(obj); // MO_RELAXED: for the case of volatile field, in fact it adds no extra work for the underlying implementation - __ access_store_at(T_DOUBLE, IN_HEAP | MO_RELAXED, field, noreg /* dtos */, noreg, noreg); + __ access_store_at(T_DOUBLE, IN_HEAP | MO_RELAXED, field, noreg /* dtos */, noreg, noreg, noreg); if (!is_static && rc == may_rewrite) { patch_bytecode(Bytecodes::_fast_dputfield, bc, rbx, true, byte_no); } @@ -3373,31 +3373,31 @@ void TemplateTable::fast_storefield_helper(Address field, Register rax) { break; case Bytecodes::_fast_lputfield: #ifdef _LP64 - __ access_store_at(T_LONG, IN_HEAP, field, noreg /* ltos */, noreg, noreg); + __ access_store_at(T_LONG, IN_HEAP, field, noreg /* ltos */, noreg, noreg, noreg); #else __ stop("should not be rewritten"); #endif break; case Bytecodes::_fast_iputfield: - __ access_store_at(T_INT, IN_HEAP, field, rax, noreg, noreg); + __ access_store_at(T_INT, IN_HEAP, field, rax, noreg, noreg, noreg); break; case Bytecodes::_fast_zputfield: - __ access_store_at(T_BOOLEAN, IN_HEAP, field, rax, noreg, noreg); + __ access_store_at(T_BOOLEAN, IN_HEAP, field, rax, noreg, noreg, noreg); break; case Bytecodes::_fast_bputfield: - __ access_store_at(T_BYTE, IN_HEAP, field, rax, noreg, noreg); + __ access_store_at(T_BYTE, IN_HEAP, field, rax, noreg, noreg, noreg); break; case Bytecodes::_fast_sputfield: - __ access_store_at(T_SHORT, IN_HEAP, field, rax, noreg, noreg); + __ access_store_at(T_SHORT, IN_HEAP, field, rax, noreg, noreg, noreg); break; case Bytecodes::_fast_cputfield: - __ access_store_at(T_CHAR, IN_HEAP, field, rax, noreg, noreg); + __ access_store_at(T_CHAR, IN_HEAP, field, rax, noreg, noreg, noreg); break; case Bytecodes::_fast_fputfield: - __ access_store_at(T_FLOAT, IN_HEAP, field, noreg /* ftos*/, noreg, noreg); + __ access_store_at(T_FLOAT, IN_HEAP, field, noreg /* ftos*/, noreg, noreg, noreg); break; case Bytecodes::_fast_dputfield: - __ access_store_at(T_DOUBLE, IN_HEAP, field, noreg /* dtos*/, noreg, noreg); + __ access_store_at(T_DOUBLE, IN_HEAP, field, noreg /* dtos*/, noreg, noreg, noreg); break; default: ShouldNotReachHere(); -- GitLab From ec62d90db2428d0da6ed0f338858f5bc2a76e991 Mon Sep 17 00:00:00 2001 From: Albert Mingkun Yang Date: Mon, 21 Mar 2022 08:39:17 +0000 Subject: [PATCH 295/340] 8283365: G1: Remove duplicate assertions in HeapRegion::oops_on_memregion_seq_iterate_careful Reviewed-by: kbarrett, tschatzl --- src/hotspot/share/gc/g1/heapRegion.inline.hpp | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/src/hotspot/share/gc/g1/heapRegion.inline.hpp b/src/hotspot/share/gc/g1/heapRegion.inline.hpp index 3d61cc1620a..e94320fbdb4 100644 --- a/src/hotspot/share/gc/g1/heapRegion.inline.hpp +++ b/src/hotspot/share/gc/g1/heapRegion.inline.hpp @@ -329,16 +329,6 @@ HeapWord* HeapRegion::oops_on_memregion_seq_iterate_careful(MemRegion mr, // Find the obj that extends onto mr.start(). HeapWord* cur = block_start(start); -#ifdef ASSERT - { - assert(cur <= start, - "cur: " PTR_FORMAT ", start: " PTR_FORMAT, p2i(cur), p2i(start)); - HeapWord* next = cur + block_size(cur); - assert(start < next, - "start: " PTR_FORMAT ", next: " PTR_FORMAT, p2i(start), p2i(next)); - } -#endif - const G1CMBitMap* const bitmap = g1h->concurrent_mark()->prev_mark_bitmap(); while (true) { oop obj = cast_to_oop(cur); -- GitLab From fd9301514e2093d9dcd7bcd9e4b812146b20dd03 Mon Sep 17 00:00:00 2001 From: Albert Mingkun Yang Date: Mon, 21 Mar 2022 08:40:14 +0000 Subject: [PATCH 296/340] 8283332: G1: Stricter assertion in G1BlockOffsetTablePart::forward_to_block_containing_addr Reviewed-by: kbarrett, iwalulya --- src/hotspot/share/gc/g1/g1BlockOffsetTable.inline.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hotspot/share/gc/g1/g1BlockOffsetTable.inline.hpp b/src/hotspot/share/gc/g1/g1BlockOffsetTable.inline.hpp index f70cb118627..058a9f58785 100644 --- a/src/hotspot/share/gc/g1/g1BlockOffsetTable.inline.hpp +++ b/src/hotspot/share/gc/g1/g1BlockOffsetTable.inline.hpp @@ -140,7 +140,7 @@ inline HeapWord* G1BlockOffsetTablePart::forward_to_block_containing_addr(HeapWo "start of block must be an initialized object"); n += block_size(q); } - assert(q <= n, "wrong order for q and addr"); + assert(q <= addr, "wrong order for q and addr"); assert(addr < n, "wrong order for addr and n"); return q; } -- GitLab From eb4849e5615dd307a5abc435a0204a6d26610fcb Mon Sep 17 00:00:00 2001 From: Thomas Schatzl Date: Mon, 21 Mar 2022 10:42:38 +0000 Subject: [PATCH 297/340] 8283327: Add methods to save/restore registers when calling into the VM from C1/interpreter barrier code Reviewed-by: eosterlund, dlong --- .../cpu/aarch64/macroAssembler_aarch64.cpp | 6 +- .../cpu/aarch64/macroAssembler_aarch64.hpp | 2 +- src/hotspot/cpu/aarch64/register_aarch64.hpp | 105 ---------- .../cpu/aarch64/stubGenerator_aarch64.cpp | 7 +- .../x86/gc/g1/g1BarrierSetAssembler_x86.cpp | 58 ++---- src/hotspot/cpu/x86/macroAssembler_x86.cpp | 185 ++++++++++++++++++ src/hotspot/cpu/x86/macroAssembler_x86.hpp | 30 +++ src/hotspot/cpu/x86/register_x86.hpp | 31 +++ src/hotspot/share/asm/register.hpp | 144 ++++++++++++++ 9 files changed, 417 insertions(+), 151 deletions(-) diff --git a/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp b/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp index dae4e22b15b..ad1a6d58596 100644 --- a/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp @@ -2543,7 +2543,7 @@ void MacroAssembler::debug64(char* msg, int64_t pc, int64_t regs[]) fatal("DEBUG MESSAGE: %s", msg); } -RegSet MacroAssembler::call_clobbered_registers() { +RegSet MacroAssembler::call_clobbered_gp_registers() { RegSet regs = RegSet::range(r0, r17) - RegSet::of(rscratch1, rscratch2); #ifndef R18_RESERVED regs += r18_tls; @@ -2553,7 +2553,7 @@ RegSet MacroAssembler::call_clobbered_registers() { void MacroAssembler::push_call_clobbered_registers_except(RegSet exclude) { int step = 4 * wordSize; - push(call_clobbered_registers() - exclude, sp); + push(call_clobbered_gp_registers() - exclude, sp); sub(sp, sp, step); mov(rscratch1, -step); // Push v0-v7, v16-v31. @@ -2575,7 +2575,7 @@ void MacroAssembler::pop_call_clobbered_registers_except(RegSet exclude) { reinitialize_ptrue(); - pop(call_clobbered_registers() - exclude, sp); + pop(call_clobbered_gp_registers() - exclude, sp); } void MacroAssembler::push_CPU_state(bool save_vectors, bool use_sve, diff --git a/src/hotspot/cpu/aarch64/macroAssembler_aarch64.hpp b/src/hotspot/cpu/aarch64/macroAssembler_aarch64.hpp index 1344250febb..d5bfc42e784 100644 --- a/src/hotspot/cpu/aarch64/macroAssembler_aarch64.hpp +++ b/src/hotspot/cpu/aarch64/macroAssembler_aarch64.hpp @@ -468,7 +468,7 @@ public: void push_fp(FloatRegSet regs, Register stack) { if (regs.bits()) push_fp(regs.bits(), stack); } void pop_fp(FloatRegSet regs, Register stack) { if (regs.bits()) pop_fp(regs.bits(), stack); } - static RegSet call_clobbered_registers(); + static RegSet call_clobbered_gp_registers(); void push_p(PRegSet regs, Register stack) { if (regs.bits()) push_p(regs.bits(), stack); } void pop_p(PRegSet regs, Register stack) { if (regs.bits()) pop_p(regs.bits(), stack); } diff --git a/src/hotspot/cpu/aarch64/register_aarch64.hpp b/src/hotspot/cpu/aarch64/register_aarch64.hpp index 400eaeb90f2..3fe2fae42a1 100644 --- a/src/hotspot/cpu/aarch64/register_aarch64.hpp +++ b/src/hotspot/cpu/aarch64/register_aarch64.hpp @@ -314,115 +314,10 @@ class ConcreteRegisterImpl : public AbstractRegisterImpl { static const int max_pr; }; -template class RegSetIterator; - -// A set of registers -template -class AbstractRegSet { - uint32_t _bitset; - - AbstractRegSet(uint32_t bitset) : _bitset(bitset) { } - -public: - - AbstractRegSet() : _bitset(0) { } - - AbstractRegSet(RegImpl r1) : _bitset(1 << r1->encoding()) { } - - AbstractRegSet operator+(const AbstractRegSet aSet) const { - AbstractRegSet result(_bitset | aSet._bitset); - return result; - } - - AbstractRegSet operator-(const AbstractRegSet aSet) const { - AbstractRegSet result(_bitset & ~aSet._bitset); - return result; - } - - AbstractRegSet &operator+=(const AbstractRegSet aSet) { - *this = *this + aSet; - return *this; - } - - AbstractRegSet &operator-=(const AbstractRegSet aSet) { - *this = *this - aSet; - return *this; - } - - static AbstractRegSet of(RegImpl r1) { - return AbstractRegSet(r1); - } - - static AbstractRegSet of(RegImpl r1, RegImpl r2) { - return of(r1) + r2; - } - - static AbstractRegSet of(RegImpl r1, RegImpl r2, RegImpl r3) { - return of(r1, r2) + r3; - } - - static AbstractRegSet of(RegImpl r1, RegImpl r2, RegImpl r3, RegImpl r4) { - return of(r1, r2, r3) + r4; - } - - static AbstractRegSet range(RegImpl start, RegImpl end) { - uint32_t bits = ~0; - bits <<= start->encoding(); - bits <<= 31 - end->encoding(); - bits >>= 31 - end->encoding(); - - return AbstractRegSet(bits); - } - - uint32_t bits() const { return _bitset; } - -private: - - RegImpl first(); - -public: - - friend class RegSetIterator; - - RegSetIterator begin(); -}; - typedef AbstractRegSet RegSet; typedef AbstractRegSet FloatRegSet; typedef AbstractRegSet PRegSet; -template -class RegSetIterator { - AbstractRegSet _regs; - -public: - RegSetIterator(AbstractRegSet x): _regs(x) {} - RegSetIterator(const RegSetIterator& mit) : _regs(mit._regs) {} - - RegSetIterator& operator++() { - RegImpl r = _regs.first(); - if (r->is_valid()) - _regs -= r; - return *this; - } - - bool operator==(const RegSetIterator& rhs) const { - return _regs.bits() == rhs._regs.bits(); - } - bool operator!=(const RegSetIterator& rhs) const { - return ! (rhs == *this); - } - - RegImpl operator*() { - return _regs.first(); - } -}; - -template -inline RegSetIterator AbstractRegSet::begin() { - return RegSetIterator(*this); -} - template <> inline Register AbstractRegSet::first() { uint32_t first = _bitset & -_bitset; diff --git a/src/hotspot/cpu/aarch64/stubGenerator_aarch64.cpp b/src/hotspot/cpu/aarch64/stubGenerator_aarch64.cpp index 5a92dcb6b47..1b41f09d972 100644 --- a/src/hotspot/cpu/aarch64/stubGenerator_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/stubGenerator_aarch64.cpp @@ -26,6 +26,7 @@ #include "precompiled.hpp" #include "asm/macroAssembler.hpp" #include "asm/macroAssembler.inline.hpp" +#include "asm/register.hpp" #include "atomic_aarch64.hpp" #include "compiler/oopMap.hpp" #include "gc/shared/barrierSet.hpp" @@ -1320,10 +1321,10 @@ class StubGenerator: public StubCodeGenerator { void clobber_registers() { #ifdef ASSERT RegSet clobbered - = MacroAssembler::call_clobbered_registers() - rscratch1; + = MacroAssembler::call_clobbered_gp_registers() - rscratch1; __ mov(rscratch1, (uint64_t)0xdeadbeef); __ orr(rscratch1, rscratch1, rscratch1, Assembler::LSL, 32); - for (RegSetIterator<> it = clobbered.begin(); *it != noreg; ++it) { + for (RegSetIterator it = clobbered.begin(); *it != noreg; ++it) { __ mov(*it, rscratch1); } #endif @@ -6629,7 +6630,7 @@ class StubGenerator: public StubCodeGenerator { // Register allocation - RegSetIterator<> regs = (RegSet::range(r0, r26) - r18_tls).begin(); + RegSetIterator regs = (RegSet::range(r0, r26) - r18_tls).begin(); Pa_base = *regs; // Argument registers if (squaring) Pb_base = Pa_base; diff --git a/src/hotspot/cpu/x86/gc/g1/g1BarrierSetAssembler_x86.cpp b/src/hotspot/cpu/x86/gc/g1/g1BarrierSetAssembler_x86.cpp index 0fb005ce06f..475a92d0f43 100644 --- a/src/hotspot/cpu/x86/gc/g1/g1BarrierSetAssembler_x86.cpp +++ b/src/hotspot/cpu/x86/gc/g1/g1BarrierSetAssembler_x86.cpp @@ -67,7 +67,7 @@ void G1BarrierSetAssembler::gen_write_ref_array_pre_barrier(MacroAssembler* masm __ jcc(Assembler::equal, filtered); - __ pusha(); // push registers + __ push_call_clobbered_registers(false /* save_fpu */); #ifdef _LP64 if (count == c_rarg0) { if (addr == c_rarg1) { @@ -90,7 +90,7 @@ void G1BarrierSetAssembler::gen_write_ref_array_pre_barrier(MacroAssembler* masm __ call_VM_leaf(CAST_FROM_FN_PTR(address, G1BarrierSetRuntime::write_ref_array_pre_oop_entry), addr, count); #endif - __ popa(); + __ pop_call_clobbered_registers(false /* save_fpu */); __ bind(filtered); } @@ -98,7 +98,7 @@ void G1BarrierSetAssembler::gen_write_ref_array_pre_barrier(MacroAssembler* masm void G1BarrierSetAssembler::gen_write_ref_array_post_barrier(MacroAssembler* masm, DecoratorSet decorators, Register addr, Register count, Register tmp) { - __ pusha(); // push registers (overkill) + __ push_call_clobbered_registers(false /* save_fpu */); #ifdef _LP64 if (c_rarg0 == count) { // On win64 c_rarg0 == rcx assert_different_registers(c_rarg1, addr); @@ -114,7 +114,7 @@ void G1BarrierSetAssembler::gen_write_ref_array_post_barrier(MacroAssembler* mas __ call_VM_leaf(CAST_FROM_FN_PTR(address, G1BarrierSetRuntime::write_ref_array_post_entry), addr, count); #endif - __ popa(); + __ pop_call_clobbered_registers(false /* save_fpu */); } void G1BarrierSetAssembler::load_at(MacroAssembler* masm, DecoratorSet decorators, BasicType type, @@ -204,14 +204,15 @@ void G1BarrierSetAssembler::g1_write_barrier_pre(MacroAssembler* masm, __ jmp(done); __ bind(runtime); - // save the live input values - if(tosca_live) __ push(rax); - if (obj != noreg && obj != rax) - __ push(obj); + // Determine and save the live input values + RegSet saved; + if (tosca_live) saved += RegSet::of(rax); + if (obj != noreg && obj != rax) saved += RegSet::of(obj); + if (pre_val != rax) saved += RegSet::of(pre_val); + NOT_LP64( saved += RegSet::of(thread); ) - if (pre_val != rax) - __ push(pre_val); + __ push_set(saved); // Calling the runtime using the regular call_VM_leaf mechanism generates // code (generated by InterpreterMacroAssember::call_VM_leaf_base) @@ -225,8 +226,6 @@ void G1BarrierSetAssembler::g1_write_barrier_pre(MacroAssembler* masm, // So when we do not have have a full interpreter frame on the stack // expand_call should be passed true. - NOT_LP64( __ push(thread); ) - if (expand_call) { LP64_ONLY( assert(pre_val != c_rarg1, "smashed arg"); ) #ifdef _LP64 @@ -244,17 +243,7 @@ void G1BarrierSetAssembler::g1_write_barrier_pre(MacroAssembler* masm, } else { __ call_VM_leaf(CAST_FROM_FN_PTR(address, G1BarrierSetRuntime::write_ref_field_pre_entry), pre_val, thread); } - - NOT_LP64( __ pop(thread); ) - - // save the live input values - if (pre_val != rax) - __ pop(pre_val); - - if (obj != noreg && obj != rax) - __ pop(obj); - - if(tosca_live) __ pop(rax); + __ pop_set(saved); __ bind(done); } @@ -328,15 +317,10 @@ void G1BarrierSetAssembler::g1_write_barrier_post(MacroAssembler* masm, __ bind(runtime); // save the live input values - __ push(store_addr); -#ifdef _LP64 - __ call_VM_leaf(CAST_FROM_FN_PTR(address, G1BarrierSetRuntime::write_ref_field_post_entry), card_addr, r15_thread); -#else - __ push(thread); + RegSet saved = RegSet::of(store_addr NOT_LP64(COMMA thread)); + __ push_set(saved); __ call_VM_leaf(CAST_FROM_FN_PTR(address, G1BarrierSetRuntime::write_ref_field_post_entry), card_addr, thread); - __ pop(thread); -#endif - __ pop(store_addr); + __ pop_set(saved); __ bind(done); } @@ -495,13 +479,13 @@ void G1BarrierSetAssembler::generate_c1_pre_barrier_runtime_stub(StubAssembler* __ bind(runtime); - __ save_live_registers_no_oop_map(true); + __ push_call_clobbered_registers(); // load the pre-value __ load_parameter(0, rcx); __ call_VM_leaf(CAST_FROM_FN_PTR(address, G1BarrierSetRuntime::write_ref_field_pre_entry), rcx, thread); - __ restore_live_registers(true); + __ pop_call_clobbered_registers(); __ bind(done); @@ -514,9 +498,6 @@ void G1BarrierSetAssembler::generate_c1_pre_barrier_runtime_stub(StubAssembler* void G1BarrierSetAssembler::generate_c1_post_barrier_runtime_stub(StubAssembler* sasm) { __ prologue("g1_post_barrier", false); - // arg0: store_address - Address store_addr(rbp, 2*BytesPerWord); - CardTableBarrierSet* ct = barrier_set_cast(BarrierSet::barrier_set()); @@ -572,12 +553,11 @@ void G1BarrierSetAssembler::generate_c1_post_barrier_runtime_stub(StubAssembler* __ jmp(enqueued); __ bind(runtime); - - __ save_live_registers_no_oop_map(true); + __ push_call_clobbered_registers(); __ call_VM_leaf(CAST_FROM_FN_PTR(address, G1BarrierSetRuntime::write_ref_field_post_entry), card_addr, thread); - __ restore_live_registers(true); + __ pop_call_clobbered_registers(); __ bind(enqueued); __ pop(rdx); diff --git a/src/hotspot/cpu/x86/macroAssembler_x86.cpp b/src/hotspot/cpu/x86/macroAssembler_x86.cpp index 944e7b9b816..e9285b11e42 100644 --- a/src/hotspot/cpu/x86/macroAssembler_x86.cpp +++ b/src/hotspot/cpu/x86/macroAssembler_x86.cpp @@ -26,6 +26,7 @@ #include "jvm.h" #include "asm/assembler.hpp" #include "asm/assembler.inline.hpp" +#include "c1/c1_FrameMap.hpp" #include "compiler/compiler_globals.hpp" #include "compiler/disassembler.hpp" #include "gc/shared/barrierSet.hpp" @@ -3578,6 +3579,190 @@ void MacroAssembler::tlab_allocate(Register thread, Register obj, bs->tlab_allocate(this, thread, obj, var_size_in_bytes, con_size_in_bytes, t1, t2, slow_case); } +RegSet MacroAssembler::call_clobbered_gp_registers() { + RegSet regs; +#ifdef _LP64 + regs += RegSet::of(rax, rcx, rdx); +#ifndef WINDOWS + regs += RegSet::of(rsi, rdi); +#endif + regs += RegSet::range(r8, r11); +#else + regs += RegSet::of(rax, rcx, rdx); +#endif + return regs; +} + +XMMRegSet MacroAssembler::call_clobbered_xmm_registers() { +#if defined(WINDOWS) && defined(_LP64) + XMMRegSet result = XMMRegSet::range(xmm0, xmm5); + if (FrameMap::get_num_caller_save_xmms() > 16) { + result += XMMRegSet::range(xmm16, as_XMMRegister(FrameMap::get_num_caller_save_xmms() - 1)); + } + return result; +#else + return XMMRegSet::range(xmm0, as_XMMRegister(FrameMap::get_num_caller_save_xmms() - 1)); +#endif +} + +static int FPUSaveAreaSize = align_up(108, StackAlignmentInBytes); // 108 bytes needed for FPU state by fsave/frstor + +#ifndef _LP64 +static bool use_x87_registers() { return UseSSE < 2; } +#endif +static bool use_xmm_registers() { return UseSSE >= 1; } + +// C1 only ever uses the first double/float of the XMM register. +static int xmm_save_size() { return UseSSE >= 2 ? sizeof(double) : sizeof(float); } + +static void save_xmm_register(MacroAssembler* masm, int offset, XMMRegister reg) { + if (UseSSE == 1) { + masm->movflt(Address(rsp, offset), reg); + } else { + masm->movdbl(Address(rsp, offset), reg); + } +} + +static void restore_xmm_register(MacroAssembler* masm, int offset, XMMRegister reg) { + if (UseSSE == 1) { + masm->movflt(reg, Address(rsp, offset)); + } else { + masm->movdbl(reg, Address(rsp, offset)); + } +} + +int register_section_sizes(RegSet gp_registers, XMMRegSet xmm_registers, bool save_fpu, + int& gp_area_size, int& fp_area_size, int& xmm_area_size) { + + gp_area_size = align_up(gp_registers.size() * RegisterImpl::max_slots_per_register * VMRegImpl::stack_slot_size, + StackAlignmentInBytes); +#ifdef _LP64 + fp_area_size = 0; +#else + fp_area_size = (save_fpu && use_x87_registers()) ? FPUSaveAreaSize : 0; +#endif + xmm_area_size = (save_fpu && use_xmm_registers()) ? xmm_registers.size() * xmm_save_size() : 0; + + return gp_area_size + fp_area_size + xmm_area_size; +} + +void MacroAssembler::push_call_clobbered_registers_except(RegSet exclude, bool save_fpu) { + block_comment("push_call_clobbered_registers start"); + // Regular registers + RegSet gp_registers_to_push = call_clobbered_gp_registers() - exclude; + + int gp_area_size; + int fp_area_size; + int xmm_area_size; + int total_save_size = register_section_sizes(gp_registers_to_push, call_clobbered_xmm_registers(), save_fpu, + gp_area_size, fp_area_size, xmm_area_size); + subptr(rsp, total_save_size); + + push_set(gp_registers_to_push, 0); + +#ifndef _LP64 + if (save_fpu && use_x87_registers()) { + fnsave(Address(rsp, gp_area_size)); + fwait(); + } +#endif + if (save_fpu && use_xmm_registers()) { + push_set(call_clobbered_xmm_registers(), gp_area_size + fp_area_size); + } + + block_comment("push_call_clobbered_registers end"); +} + +void MacroAssembler::pop_call_clobbered_registers_except(RegSet exclude, bool restore_fpu) { + block_comment("pop_call_clobbered_registers start"); + + RegSet gp_registers_to_pop = call_clobbered_gp_registers() - exclude; + + int gp_area_size; + int fp_area_size; + int xmm_area_size; + int total_save_size = register_section_sizes(gp_registers_to_pop, call_clobbered_xmm_registers(), restore_fpu, + gp_area_size, fp_area_size, xmm_area_size); + + if (restore_fpu && use_xmm_registers()) { + pop_set(call_clobbered_xmm_registers(), gp_area_size + fp_area_size); + } +#ifndef _LP64 + if (restore_fpu && use_x87_registers()) { + frstor(Address(rsp, gp_area_size)); + } +#endif + + pop_set(gp_registers_to_pop, 0); + + addptr(rsp, total_save_size); + + vzeroupper(); + + block_comment("pop_call_clobbered_registers end"); +} + +void MacroAssembler::push_set(XMMRegSet set, int offset) { + assert(is_aligned(set.size() * xmm_save_size(), StackAlignmentInBytes), "must be"); + int spill_offset = offset; + + for (RegSetIterator it = set.begin(); *it != xnoreg; ++it) { + save_xmm_register(this, spill_offset, *it); + spill_offset += xmm_save_size(); + } +} + +void MacroAssembler::pop_set(XMMRegSet set, int offset) { + int restore_size = set.size() * xmm_save_size(); + assert(is_aligned(restore_size, StackAlignmentInBytes), "must be"); + + int restore_offset = offset + restore_size - xmm_save_size(); + + for (ReverseRegSetIterator it = set.rbegin(); *it != xnoreg; ++it) { + restore_xmm_register(this, restore_offset, *it); + restore_offset -= xmm_save_size(); + } +} + +void MacroAssembler::push_set(RegSet set, int offset) { + int spill_offset; + if (offset == -1) { + int register_push_size = set.size() * RegisterImpl::max_slots_per_register * VMRegImpl::stack_slot_size; + int aligned_size = align_up(register_push_size, StackAlignmentInBytes); + subptr(rsp, aligned_size); + spill_offset = 0; + } else { + spill_offset = offset; + } + + for (RegSetIterator it = set.begin(); *it != noreg; ++it) { + movptr(Address(rsp, spill_offset), *it); + spill_offset += RegisterImpl::max_slots_per_register * VMRegImpl::stack_slot_size; + } +} + +void MacroAssembler::pop_set(RegSet set, int offset) { + + int gp_reg_size = RegisterImpl::max_slots_per_register * VMRegImpl::stack_slot_size; + int restore_size = set.size() * gp_reg_size; + int aligned_size = align_up(restore_size, StackAlignmentInBytes); + + int restore_offset; + if (offset == -1) { + restore_offset = restore_size - gp_reg_size; + } else { + restore_offset = offset + restore_size - gp_reg_size; + } + for (ReverseRegSetIterator it = set.rbegin(); *it != noreg; ++it) { + movptr(*it, Address(rsp, restore_offset)); + restore_offset -= gp_reg_size; + } + + if (offset == -1) { + addptr(rsp, aligned_size); + } +} + // Defines obj, preserves var_size_in_bytes void MacroAssembler::eden_allocate(Register thread, Register obj, Register var_size_in_bytes, diff --git a/src/hotspot/cpu/x86/macroAssembler_x86.hpp b/src/hotspot/cpu/x86/macroAssembler_x86.hpp index 918019d015c..9b3da9d5de1 100644 --- a/src/hotspot/cpu/x86/macroAssembler_x86.hpp +++ b/src/hotspot/cpu/x86/macroAssembler_x86.hpp @@ -26,6 +26,7 @@ #define CPU_X86_MACROASSEMBLER_X86_HPP #include "asm/assembler.hpp" +#include "asm/register.hpp" #include "code/vmreg.inline.hpp" #include "compiler/oopMap.hpp" #include "utilities/macros.hpp" @@ -521,6 +522,35 @@ class MacroAssembler: public Assembler { // Round up to a power of two void round_to(Register reg, int modulus); +private: + // General purpose and XMM registers potentially clobbered by native code; there + // is no need for FPU or AVX opmask related methods because C1/interpreter + // - we save/restore FPU state as a whole always + // - do not care about AVX-512 opmask + static RegSet call_clobbered_gp_registers(); + static XMMRegSet call_clobbered_xmm_registers(); + + void push_set(XMMRegSet set, int offset); + void pop_set(XMMRegSet set, int offset); + +public: + void push_set(RegSet set, int offset = -1); + void pop_set(RegSet set, int offset = -1); + + // Push and pop everything that might be clobbered by a native + // runtime call. + // Only save the lower 64 bits of each vector register. + // Additonal registers can be excluded in a passed RegSet. + void push_call_clobbered_registers_except(RegSet exclude, bool save_fpu = true); + void pop_call_clobbered_registers_except(RegSet exclude, bool restore_fpu = true); + + void push_call_clobbered_registers(bool save_fpu = true) { + push_call_clobbered_registers_except(RegSet(), save_fpu); + } + void pop_call_clobbered_registers(bool restore_fpu = true) { + pop_call_clobbered_registers_except(RegSet(), restore_fpu); + } + // allocation void eden_allocate( Register thread, // Current thread diff --git a/src/hotspot/cpu/x86/register_x86.hpp b/src/hotspot/cpu/x86/register_x86.hpp index 38ca95c0126..f57b1db48c8 100644 --- a/src/hotspot/cpu/x86/register_x86.hpp +++ b/src/hotspot/cpu/x86/register_x86.hpp @@ -26,6 +26,8 @@ #define CPU_X86_REGISTER_X86_HPP #include "asm/register.hpp" +#include "utilities/count_leading_zeros.hpp" +#include "utilities/powerOfTwo.hpp" class VMRegImpl; typedef VMRegImpl* VMReg; @@ -272,4 +274,33 @@ class ConcreteRegisterImpl : public AbstractRegisterImpl { }; +template <> +inline Register AbstractRegSet::first() { + uint32_t first = _bitset & -_bitset; + return first ? as_Register(exact_log2(first)) : noreg; +} + +template <> +inline Register AbstractRegSet::last() { + if (_bitset == 0) { return noreg; } + uint32_t last = 31 - count_leading_zeros(_bitset); + return as_Register(last); +} + +template <> +inline XMMRegister AbstractRegSet::first() { + uint32_t first = _bitset & -_bitset; + return first ? as_XMMRegister(exact_log2(first)) : xnoreg; +} + +template <> +inline XMMRegister AbstractRegSet::last() { + if (_bitset == 0) { return xnoreg; } + uint32_t last = 31 - count_leading_zeros(_bitset); + return as_XMMRegister(last); +} + +typedef AbstractRegSet RegSet; +typedef AbstractRegSet XMMRegSet; + #endif // CPU_X86_REGISTER_X86_HPP diff --git a/src/hotspot/share/asm/register.hpp b/src/hotspot/share/asm/register.hpp index 4207267ebab..b8538e4df68 100644 --- a/src/hotspot/share/asm/register.hpp +++ b/src/hotspot/share/asm/register.hpp @@ -28,6 +28,7 @@ #include "utilities/debug.hpp" #include "utilities/globalDefinitions.hpp" #include "utilities/macros.hpp" +#include "utilities/population_count.hpp" // Use AbstractRegister as shortcut class AbstractRegisterImpl; @@ -86,6 +87,149 @@ const type name = ((type)value) #define INTERNAL_VISIBILITY #endif +template class RegSetIterator; +template class ReverseRegSetIterator; + +// A set of registers +template +class AbstractRegSet { + uint32_t _bitset; + + AbstractRegSet(uint32_t bitset) : _bitset(bitset) { } + +public: + + AbstractRegSet() : _bitset(0) { } + + AbstractRegSet(RegImpl r1) : _bitset(1 << r1->encoding()) { } + + AbstractRegSet operator+(const AbstractRegSet aSet) const { + AbstractRegSet result(_bitset | aSet._bitset); + return result; + } + + AbstractRegSet operator-(const AbstractRegSet aSet) const { + AbstractRegSet result(_bitset & ~aSet._bitset); + return result; + } + + AbstractRegSet &operator+=(const AbstractRegSet aSet) { + *this = *this + aSet; + return *this; + } + + AbstractRegSet &operator-=(const AbstractRegSet aSet) { + *this = *this - aSet; + return *this; + } + + static AbstractRegSet of(RegImpl r1) { + return AbstractRegSet(r1); + } + + static AbstractRegSet of(RegImpl r1, RegImpl r2) { + return of(r1) + r2; + } + + static AbstractRegSet of(RegImpl r1, RegImpl r2, RegImpl r3) { + return of(r1, r2) + r3; + } + + static AbstractRegSet of(RegImpl r1, RegImpl r2, RegImpl r3, RegImpl r4) { + return of(r1, r2, r3) + r4; + } + + static AbstractRegSet range(RegImpl start, RegImpl end) { + assert(start <= end, "must be"); + uint32_t bits = ~0; + bits <<= start->encoding(); + bits <<= 31 - end->encoding(); + bits >>= 31 - end->encoding(); + + return AbstractRegSet(bits); + } + + uint size() const { return population_count(_bitset); } + + uint32_t bits() const { return _bitset; } + +private: + + RegImpl first(); + RegImpl last(); + +public: + + friend class RegSetIterator; + friend class ReverseRegSetIterator; + + RegSetIterator begin(); + ReverseRegSetIterator rbegin(); +}; + +template +class RegSetIterator { + AbstractRegSet _regs; + +public: + RegSetIterator(AbstractRegSet x): _regs(x) {} + RegSetIterator(const RegSetIterator& mit) : _regs(mit._regs) {} + + RegSetIterator& operator++() { + RegImpl r = _regs.first(); + if (r->is_valid()) + _regs -= r; + return *this; + } + + bool operator==(const RegSetIterator& rhs) const { + return _regs.bits() == rhs._regs.bits(); + } + bool operator!=(const RegSetIterator& rhs) const { + return ! (rhs == *this); + } + + RegImpl operator*() { + return _regs.first(); + } +}; + +template +inline RegSetIterator AbstractRegSet::begin() { + return RegSetIterator(*this); +} + +template +class ReverseRegSetIterator { + AbstractRegSet _regs; + +public: + ReverseRegSetIterator(AbstractRegSet x): _regs(x) {} + ReverseRegSetIterator(const ReverseRegSetIterator& mit) : _regs(mit._regs) {} + + ReverseRegSetIterator& operator++() { + RegImpl r = _regs.last(); + if (r->is_valid()) + _regs -= r; + return *this; + } + + bool operator==(const ReverseRegSetIterator& rhs) const { + return _regs.bits() == rhs._regs.bits(); + } + bool operator!=(const ReverseRegSetIterator& rhs) const { + return ! (rhs == *this); + } + + RegImpl operator*() { + return _regs.last(); + } +}; + +template +inline ReverseRegSetIterator AbstractRegSet::rbegin() { + return ReverseRegSetIterator(*this); +} #include CPU_HEADER(register) -- GitLab From b617f1db4ec5d54b1ea541fb885e296da928f166 Mon Sep 17 00:00:00 2001 From: Thomas Schatzl Date: Mon, 21 Mar 2022 11:30:26 +0000 Subject: [PATCH 298/340] 8283447: Remove unused LIR_Assembler::_bs Reviewed-by: redestad --- src/hotspot/share/c1/c1_LIRAssembler.cpp | 4 +--- src/hotspot/share/c1/c1_LIRAssembler.hpp | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/src/hotspot/share/c1/c1_LIRAssembler.cpp b/src/hotspot/share/c1/c1_LIRAssembler.cpp index be0a6abc2ca..1c4e0d09306 100644 --- a/src/hotspot/share/c1/c1_LIRAssembler.cpp +++ b/src/hotspot/share/c1/c1_LIRAssembler.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2022, 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 @@ -32,7 +32,6 @@ #include "c1/c1_ValueStack.hpp" #include "ci/ciInstance.hpp" #include "compiler/oopMap.hpp" -#include "gc/shared/barrierSet.hpp" #include "runtime/os.hpp" #include "runtime/vm_version.hpp" @@ -104,7 +103,6 @@ PatchingStub::PatchID LIR_Assembler::patching_id(CodeEmitInfo* info) { LIR_Assembler::LIR_Assembler(Compilation* c): _masm(c->masm()) - , _bs(BarrierSet::barrier_set()) , _compilation(c) , _frame_map(c->frame_map()) , _current_block(NULL) diff --git a/src/hotspot/share/c1/c1_LIRAssembler.hpp b/src/hotspot/share/c1/c1_LIRAssembler.hpp index f27ade60bae..1d873b9638d 100644 --- a/src/hotspot/share/c1/c1_LIRAssembler.hpp +++ b/src/hotspot/share/c1/c1_LIRAssembler.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2022, 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 @@ -32,13 +32,11 @@ class Compilation; class ScopeValue; -class BarrierSet; class LIR_Assembler: public CompilationResourceObj { private: C1_MacroAssembler* _masm; CodeStubList* _slow_case_stubs; - BarrierSet* _bs; Compilation* _compilation; FrameMap* _frame_map; -- GitLab From 909986c7e110c8ac3ba16750be7707b1ec344ee5 Mon Sep 17 00:00:00 2001 From: Zhengyu Gu Date: Mon, 21 Mar 2022 12:26:58 +0000 Subject: [PATCH 299/340] 8283217: Leak FcObjectSet in getFontConfigLocations() in fontpath.c Reviewed-by: prr, aivanov --- src/java.desktop/unix/native/common/awt/fontpath.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/java.desktop/unix/native/common/awt/fontpath.c b/src/java.desktop/unix/native/common/awt/fontpath.c index 051c9de88fa..fd28f5c0ea6 100644 --- a/src/java.desktop/unix/native/common/awt/fontpath.c +++ b/src/java.desktop/unix/native/common/awt/fontpath.c @@ -496,6 +496,7 @@ typedef FcResult (*FcPatternGetStringFuncType)(const FcPattern *p, FcChar8 ** s); typedef FcChar8* (*FcStrDirnameFuncType)(const FcChar8 *file); typedef void (*FcPatternDestroyFuncType)(FcPattern *p); +typedef void (*FcObjectSetDestroyFuncType)(FcObjectSet *os); typedef void (*FcFontSetDestroyFuncType)(FcFontSet *s); typedef FcPattern* (*FcNameParseFuncType)(const FcChar8 *name); typedef FcBool (*FcPatternAddStringFuncType)(FcPattern *p, @@ -542,6 +543,7 @@ static char **getFontConfigLocations() { FcPatternGetStringFuncType FcPatternGetString; FcStrDirnameFuncType FcStrDirname; FcPatternDestroyFuncType FcPatternDestroy; + FcObjectSetDestroyFuncType FcObjectSetDestroy; FcFontSetDestroyFuncType FcFontSetDestroy; FcConfig *fontconfig; @@ -571,6 +573,8 @@ static char **getFontConfigLocations() { (FcStrDirnameFuncType)dlsym(libfontconfig, "FcStrDirname"); FcPatternDestroy = (FcPatternDestroyFuncType)dlsym(libfontconfig, "FcPatternDestroy"); + FcObjectSetDestroy = + (FcObjectSetDestroyFuncType)dlsym(libfontconfig, "FcObjectSetDestroy"); FcFontSetDestroy = (FcFontSetDestroyFuncType)dlsym(libfontconfig, "FcFontSetDestroy"); @@ -580,6 +584,7 @@ static char **getFontConfigLocations() { FcFontList == NULL || FcStrDirname == NULL || FcPatternDestroy == NULL || + FcObjectSetDestroy == NULL || FcFontSetDestroy == NULL) { /* problem with the library: return. */ closeFontConfig(libfontconfig, JNI_FALSE); return NULL; @@ -636,6 +641,7 @@ static char **getFontConfigLocations() { cleanup: /* Free memory and close the ".so" */ + (*FcObjectSetDestroy)(objset); (*FcPatternDestroy)(pattern); closeFontConfig(libfontconfig, JNI_TRUE); return fontdirs; -- GitLab From cb576da575ea3c8f14087dd312313843764ca2f4 Mon Sep 17 00:00:00 2001 From: Zhengyu Gu Date: Mon, 21 Mar 2022 12:28:17 +0000 Subject: [PATCH 300/340] 8283379: Memory leak in FileHeaderHelper Reviewed-by: dholmes, iklam, stuefe --- src/hotspot/share/cds/filemap.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/hotspot/share/cds/filemap.cpp b/src/hotspot/share/cds/filemap.cpp index 7901ab855ce..b8e28f30b72 100644 --- a/src/hotspot/share/cds/filemap.cpp +++ b/src/hotspot/share/cds/filemap.cpp @@ -1108,6 +1108,9 @@ public: } ~FileHeaderHelper() { + if (_header != nullptr) { + FREE_C_HEAP_ARRAY(char, _header); + } if (_fd != -1) { ::close(_fd); } -- GitLab From c4dc58e12e197562dce90c0027aa74c29047cea6 Mon Sep 17 00:00:00 2001 From: Naoto Sato Date: Mon, 21 Mar 2022 15:33:09 +0000 Subject: [PATCH 301/340] 8283277: ISO 4217 Amendment 171 Update Reviewed-by: iris, joehw --- make/data/currency/CurrencyData.properties | 8 ++++---- .../classes/sun/util/resources/CurrencyNames.properties | 4 +++- test/jdk/java/util/Currency/ValidateISO4217.java | 6 +++--- test/jdk/java/util/Currency/tablea1.txt | 8 ++++---- test/jdk/sun/text/resources/LocaleData | 1 + test/jdk/sun/text/resources/LocaleDataTest.java | 4 ++-- 6 files changed, 17 insertions(+), 14 deletions(-) diff --git a/make/data/currency/CurrencyData.properties b/make/data/currency/CurrencyData.properties index 236e544feaf..d86fc6ddfd4 100644 --- a/make/data/currency/CurrencyData.properties +++ b/make/data/currency/CurrencyData.properties @@ -1,5 +1,5 @@ # -# Copyright (c) 2000, 2021, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2000, 2022, 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 @@ -32,7 +32,7 @@ formatVersion=3 # Version of the currency code information in this class. # It is a serial number that accompanies with each amendment. -dataVersion=170 +dataVersion=171 # List of all valid ISO 4217 currency codes. # To ensure compatibility, do not remove codes. @@ -51,7 +51,7 @@ all=ADP020-AED784-AFA004-AFN971-ALL008-AMD051-ANG532-AOA973-ARS032-ATS040-AUD036 MTL470-MUR480-MVR462-MWK454-MXN484-MXV979-MYR458-MZM508-MZN943-NAD516-NGN566-\ NIO558-NLG528-NOK578-NPR524-NZD554-OMR512-PAB590-PEN604-PGK598-PHP608-\ PKR586-PLN985-PTE620-PYG600-QAR634-ROL642-RON946-RSD941-RUB643-RUR810-RWF646-SAR682-\ - SBD090-SCR690-SDD736-SDG938-SEK752-SGD702-SHP654-SIT705-SKK703-SLL694-SOS706-\ + SBD090-SCR690-SDD736-SDG938-SEK752-SGD702-SHP654-SIT705-SKK703-SLE925-SLL694-SOS706-\ SRD968-SRG740-SSP728-STD678-STN930-SVC222-SYP760-SZL748-THB764-TJS972-TMM795-TMT934-TND788-TOP776-\ TPE626-TRL792-TRY949-TTD780-TWD901-TZS834-UAH980-UGX800-USD840-USN997-USS998-UYI940-\ UYU858-UZS860-VEB862-VED926-VEF937-VES928-VND704-VUV548-WST882-XAF950-XAG961-XAU959-XBA955-\ @@ -484,7 +484,7 @@ CS=CSD # SEYCHELLES SC=SCR # SIERRA LEONE -SL=SLL +SL=SLE # SINGAPORE SG=SGD # SLOVAKIA diff --git a/src/java.base/share/classes/sun/util/resources/CurrencyNames.properties b/src/java.base/share/classes/sun/util/resources/CurrencyNames.properties index 9f1867d2cd1..53bf1d837ff 100644 --- a/src/java.base/share/classes/sun/util/resources/CurrencyNames.properties +++ b/src/java.base/share/classes/sun/util/resources/CurrencyNames.properties @@ -1,5 +1,5 @@ # -# Copyright (c) 2005, 2021, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2005, 2022, 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 @@ -221,6 +221,7 @@ SGD=SGD SHP=SHP SIT=SIT SKK=SKK +SLE=SLE SLL=SLL SOS=SOS SRD=SRD @@ -445,6 +446,7 @@ sgd=Singapore Dollar shp=Saint Helena Pound sit=Slovenian Tolar skk=Slovak Koruna +sle=Sierra Leonean Leone sll=Sierra Leonean Leone sos=Somali Shilling srd=Surinamese Dollar diff --git a/test/jdk/java/util/Currency/ValidateISO4217.java b/test/jdk/java/util/Currency/ValidateISO4217.java index 40bb55cfd1f..a0f09842ffe 100644 --- a/test/jdk/java/util/Currency/ValidateISO4217.java +++ b/test/jdk/java/util/Currency/ValidateISO4217.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,7 +24,7 @@ * @test * @bug 4691089 4819436 4942982 5104960 6544471 6627549 7066203 7195759 * 8039317 8074350 8074351 8145952 8187946 8193552 8202026 8204269 - * 8208746 8209775 8264792 8274658 + * 8208746 8209775 8264792 8274658 8283277 * @summary Validate ISO 4217 data for Currency class. * @modules java.base/java.util:open * jdk.localedata @@ -101,7 +101,7 @@ public class ValidateISO4217 { static final String otherCodes = "ADP-AFA-ATS-AYM-AZM-BEF-BGL-BOV-BYB-BYR-CHE-CHW-CLF-COU-CUC-CYP-" + "DEM-EEK-ESP-FIM-FRF-GHC-GRD-GWP-IEP-ITL-LTL-LUF-LVL-MGF-MRO-MTL-MXV-MZM-NLG-" - + "PTE-ROL-RUR-SDD-SIT-SKK-SRG-STD-TMM-TPE-TRL-VEF-UYI-USN-USS-VEB-VED-" + + "PTE-ROL-RUR-SDD-SIT-SLL-SKK-SRG-STD-TMM-TPE-TRL-VEF-UYI-USN-USS-VEB-VED-" + "XAG-XAU-XBA-XBB-XBC-XBD-XDR-XFO-XFU-XPD-XPT-XSU-XTS-XUA-XXX-" + "YUM-ZMK-ZWD-ZWN-ZWR"; diff --git a/test/jdk/java/util/Currency/tablea1.txt b/test/jdk/java/util/Currency/tablea1.txt index 7716863419f..62d71c8c94b 100644 --- a/test/jdk/java/util/Currency/tablea1.txt +++ b/test/jdk/java/util/Currency/tablea1.txt @@ -1,12 +1,12 @@ # # -# Amendments up until ISO 4217 AMENDMENT NUMBER 170 -# (As of 1 Oct 2021) +# Amendments up until ISO 4217 AMENDMENT NUMBER 171 +# (As of 16 Mar 2022) # # Version FILEVERSION=3 -DATAVERSION=170 +DATAVERSION=171 # ISO 4217 currency data AF AFN 971 2 @@ -218,7 +218,7 @@ RS RSD 941 2 CS CSD 891 2 #CS EUR 978 2 SC SCR 690 2 -SL SLL 694 2 +SL SLE 925 2 SG SGD 702 2 SK EUR 978 2 # MA 131 diff --git a/test/jdk/sun/text/resources/LocaleData b/test/jdk/sun/text/resources/LocaleData index ba176097825..50fa417ae6d 100644 --- a/test/jdk/sun/text/resources/LocaleData +++ b/test/jdk/sun/text/resources/LocaleData @@ -6448,6 +6448,7 @@ CurrencyNames//rsd=Serbian Dinar CurrencyNames//scr=Seychellois Rupee CurrencyNames//sdd=Sudanese Dinar (1992-2007) CurrencyNames//sit=Slovenian Tolar +CurrencyNames//sle=Sierra Leonean Leone CurrencyNames//sll=Sierra Leonean Leone CurrencyNames//srd=Surinamese Dollar CurrencyNames//srg=Surinamese Guilder diff --git a/test/jdk/sun/text/resources/LocaleDataTest.java b/test/jdk/sun/text/resources/LocaleDataTest.java index 1d2ddd03a82..51e88d72a2b 100644 --- a/test/jdk/sun/text/resources/LocaleDataTest.java +++ b/test/jdk/sun/text/resources/LocaleDataTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2022, 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 @@ -40,7 +40,7 @@ * 8145136 8145952 8164784 8037111 8081643 7037368 8178872 8185841 8190918 * 8187946 8195478 8181157 8179071 8193552 8202026 8204269 8202537 8208746 * 8209775 8221432 8227127 8230284 8231273 8233579 8234288 8250665 8255086 - * 8251317 8274658 + * 8251317 8274658 8283277 * @summary Verify locale data * @modules java.base/sun.util.resources * @modules jdk.localedata -- GitLab From 999da9bfc5be703141cdc07af455b4b6b2cc1aae Mon Sep 17 00:00:00 2001 From: Johannes Bechberger Date: Mon, 21 Mar 2022 15:49:59 +0000 Subject: [PATCH 302/340] 8282306: os::is_first_C_frame(frame*) crashes on invalid link access Reviewed-by: stuefe, mdoerr --- .../cpu/aarch64/frame_aarch64.inline.hpp | 6 +++-- src/hotspot/cpu/arm/frame_arm.inline.hpp | 6 ++++- src/hotspot/cpu/ppc/frame_ppc.inline.hpp | 4 +++ src/hotspot/cpu/s390/frame_s390.inline.hpp | 4 +++ src/hotspot/cpu/x86/frame_x86.inline.hpp | 7 ++++-- src/hotspot/cpu/zero/frame_zero.inline.hpp | 5 ++++ src/hotspot/share/runtime/frame.hpp | 4 +++ src/hotspot/share/runtime/os.cpp | 25 +++++++++---------- .../share/runtime/safefetch.inline.hpp | 10 ++++++++ src/hotspot/share/runtime/thread.cpp | 4 +-- test/hotspot/gtest/runtime/test_os.cpp | 11 ++++++++ 11 files changed, 66 insertions(+), 20 deletions(-) diff --git a/src/hotspot/cpu/aarch64/frame_aarch64.inline.hpp b/src/hotspot/cpu/aarch64/frame_aarch64.inline.hpp index b0fe436ca59..20b5b8e8662 100644 --- a/src/hotspot/cpu/aarch64/frame_aarch64.inline.hpp +++ b/src/hotspot/cpu/aarch64/frame_aarch64.inline.hpp @@ -148,10 +148,12 @@ inline intptr_t* frame::id(void) const { return unextended_sp(); } inline bool frame::is_older(intptr_t* id) const { assert(this->id() != NULL && id != NULL, "NULL frame id"); return this->id() > id ; } - - inline intptr_t* frame::link() const { return (intptr_t*) *(intptr_t **)addr_at(link_offset); } +inline intptr_t* frame::link_or_null() const { + intptr_t** ptr = (intptr_t **)addr_at(link_offset); + return os::is_readable_pointer(ptr) ? *ptr : NULL; +} inline intptr_t* frame::unextended_sp() const { return _unextended_sp; } diff --git a/src/hotspot/cpu/arm/frame_arm.inline.hpp b/src/hotspot/cpu/arm/frame_arm.inline.hpp index 835edd68493..773b6d06f7b 100644 --- a/src/hotspot/cpu/arm/frame_arm.inline.hpp +++ b/src/hotspot/cpu/arm/frame_arm.inline.hpp @@ -124,9 +124,13 @@ inline intptr_t* frame::id(void) const { return unextended_sp(); } inline bool frame::is_older(intptr_t* id) const { assert(this->id() != NULL && id != NULL, "NULL frame id"); return this->id() > id ; } - inline intptr_t* frame::link() const { return (intptr_t*) *(intptr_t **)addr_at(link_offset); } +inline intptr_t* frame::link_or_null() const { + intptr_t** ptr = (intptr_t **)addr_at(link_offset); + return os::is_readable_pointer(ptr) ? *ptr : NULL; +} + inline intptr_t* frame::unextended_sp() const { return _unextended_sp; } // Return address: diff --git a/src/hotspot/cpu/ppc/frame_ppc.inline.hpp b/src/hotspot/cpu/ppc/frame_ppc.inline.hpp index 705b4abefdb..239db8224c0 100644 --- a/src/hotspot/cpu/ppc/frame_ppc.inline.hpp +++ b/src/hotspot/cpu/ppc/frame_ppc.inline.hpp @@ -117,6 +117,10 @@ inline intptr_t* frame::link() const { return (intptr_t*)callers_abi()->callers_sp; } +inline intptr_t* frame::link_or_null() const { + return link(); +} + inline intptr_t* frame::real_fp() const { return fp(); } diff --git a/src/hotspot/cpu/s390/frame_s390.inline.hpp b/src/hotspot/cpu/s390/frame_s390.inline.hpp index d8a4395d8ca..5574e6384e2 100644 --- a/src/hotspot/cpu/s390/frame_s390.inline.hpp +++ b/src/hotspot/cpu/s390/frame_s390.inline.hpp @@ -155,6 +155,10 @@ inline intptr_t* frame::link() const { return (intptr_t*) callers_abi()->callers_sp; } +inline intptr_t* frame::link_or_null() const { + return link(); +} + inline intptr_t** frame::interpreter_frame_locals_addr() const { return (intptr_t**) &(ijava_state()->locals); } diff --git a/src/hotspot/cpu/x86/frame_x86.inline.hpp b/src/hotspot/cpu/x86/frame_x86.inline.hpp index 733a357d5fe..23072238e16 100644 --- a/src/hotspot/cpu/x86/frame_x86.inline.hpp +++ b/src/hotspot/cpu/x86/frame_x86.inline.hpp @@ -138,10 +138,13 @@ inline intptr_t* frame::id(void) const { return unextended_sp(); } inline bool frame::is_older(intptr_t* id) const { assert(this->id() != NULL && id != NULL, "NULL frame id"); return this->id() > id ; } - - inline intptr_t* frame::link() const { return (intptr_t*) *(intptr_t **)addr_at(link_offset); } +inline intptr_t* frame::link_or_null() const { + intptr_t** ptr = (intptr_t **)addr_at(link_offset); + return os::is_readable_pointer(ptr) ? *ptr : NULL; +} + inline intptr_t* frame::unextended_sp() const { return _unextended_sp; } // Return address: diff --git a/src/hotspot/cpu/zero/frame_zero.inline.hpp b/src/hotspot/cpu/zero/frame_zero.inline.hpp index 396e189a5db..dfca0e4bcb1 100644 --- a/src/hotspot/cpu/zero/frame_zero.inline.hpp +++ b/src/hotspot/cpu/zero/frame_zero.inline.hpp @@ -82,6 +82,11 @@ inline intptr_t* frame::link() const { return NULL; } +inline intptr_t* frame::link_or_null() const { + ShouldNotCallThis(); + return NULL; +} + inline interpreterState frame::get_interpreterState() const { return zero_interpreterframe()->interpreter_state(); } diff --git a/src/hotspot/share/runtime/frame.hpp b/src/hotspot/share/runtime/frame.hpp index e4eed4a1198..bc7d3d4775e 100644 --- a/src/hotspot/share/runtime/frame.hpp +++ b/src/hotspot/share/runtime/frame.hpp @@ -207,8 +207,12 @@ class frame { public: // Link (i.e., the pointer to the previous frame) + // might crash if the frame has no parent intptr_t* link() const; + // Link (i.e., the pointer to the previous frame) or null if the link cannot be accessed + intptr_t* link_or_null() const; + // Return address address sender_pc() const; diff --git a/src/hotspot/share/runtime/os.cpp b/src/hotspot/share/runtime/os.cpp index 6e2ee7654ea..9ac8a993556 100644 --- a/src/hotspot/share/runtime/os.cpp +++ b/src/hotspot/share/runtime/os.cpp @@ -1173,34 +1173,34 @@ void os::print_location(outputStream* st, intptr_t x, bool verbose) { st->print_cr(INTPTR_FORMAT " is an unknown value", p2i(addr)); } +bool is_pointer_bad(intptr_t* ptr) { + return !is_aligned(ptr, sizeof(uintptr_t)) || !os::is_readable_pointer(ptr); +} + // Looks like all platforms can use the same function to check if C // stack is walkable beyond current frame. +// Returns true if this is not the case, i.e. the frame is possibly +// the first C frame on the stack. bool os::is_first_C_frame(frame* fr) { #ifdef _WINDOWS return true; // native stack isn't walkable on windows this way. #endif - // Load up sp, fp, sender sp and sender fp, check for reasonable values. // Check usp first, because if that's bad the other accessors may fault // on some architectures. Ditto ufp second, etc. - uintptr_t fp_align_mask = (uintptr_t)(sizeof(address)-1); - // sp on amd can be 32 bit aligned. - uintptr_t sp_align_mask = (uintptr_t)(sizeof(int)-1); - uintptr_t usp = (uintptr_t)fr->sp(); - if ((usp & sp_align_mask) != 0) return true; + if (is_pointer_bad(fr->sp())) return true; uintptr_t ufp = (uintptr_t)fr->fp(); - if ((ufp & fp_align_mask) != 0) return true; + if (is_pointer_bad(fr->fp())) return true; uintptr_t old_sp = (uintptr_t)fr->sender_sp(); - if ((old_sp & sp_align_mask) != 0) return true; - if (old_sp == 0 || old_sp == (uintptr_t)-1) return true; + if ((uintptr_t)fr->sender_sp() == (uintptr_t)-1 || is_pointer_bad(fr->sender_sp())) return true; - uintptr_t old_fp = (uintptr_t)fr->link(); - if ((old_fp & fp_align_mask) != 0) return true; - if (old_fp == 0 || old_fp == (uintptr_t)-1 || old_fp == ufp) return true; + uintptr_t old_fp = (uintptr_t)fr->link_or_null(); + if (old_fp == 0 || old_fp == (uintptr_t)-1 || old_fp == ufp || + is_pointer_bad(fr->link_or_null())) return true; // stack grows downwards; if old_fp is below current fp or if the stack // frame is too large, either the stack is corrupted or fp is not saved @@ -1212,7 +1212,6 @@ bool os::is_first_C_frame(frame* fr) { return false; } - // Set up the boot classpath. char* os::format_boot_path(const char* format_string, diff --git a/src/hotspot/share/runtime/safefetch.inline.hpp b/src/hotspot/share/runtime/safefetch.inline.hpp index 79c833e4db6..cee0853573c 100644 --- a/src/hotspot/share/runtime/safefetch.inline.hpp +++ b/src/hotspot/share/runtime/safefetch.inline.hpp @@ -54,10 +54,20 @@ inline intptr_t SafeFetchN(intptr_t* adr, intptr_t errValue) { // returns true if SafeFetch32 and SafeFetchN can be used safely (stubroutines are already generated) inline bool CanUseSafeFetch32() { +#if defined (__APPLE__) && defined(AARCH64) + if (Thread::current_or_null_safe() == NULL) { // workaround for JDK-8282475 + return false; + } +#endif // __APPLE__ && AARCH64 return StubRoutines::SafeFetch32_stub() ? true : false; } inline bool CanUseSafeFetchN() { +#if defined (__APPLE__) && defined(AARCH64) + if (Thread::current_or_null_safe() == NULL) { + return false; + } +#endif // __APPLE__ && AARCH64 return StubRoutines::SafeFetchN_stub() ? true : false; } diff --git a/src/hotspot/share/runtime/thread.cpp b/src/hotspot/share/runtime/thread.cpp index 0ec50849f5a..eb6bce1fdbb 100644 --- a/src/hotspot/share/runtime/thread.cpp +++ b/src/hotspot/share/runtime/thread.cpp @@ -336,10 +336,10 @@ void Thread::call_run() { // Perform common initialization actions - register_thread_stack_with_NMT(); - MACOS_AARCH64_ONLY(this->init_wx()); + register_thread_stack_with_NMT(); + JFR_ONLY(Jfr::on_thread_start(this);) log_debug(os, thread)("Thread " UINTX_FORMAT " stack dimensions: " diff --git a/test/hotspot/gtest/runtime/test_os.cpp b/test/hotspot/gtest/runtime/test_os.cpp index 60bd02a42ee..0f78630d460 100644 --- a/test/hotspot/gtest/runtime/test_os.cpp +++ b/test/hotspot/gtest/runtime/test_os.cpp @@ -32,6 +32,7 @@ #include "utilities/ostream.hpp" #include "utilities/align.hpp" #include "unittest.hpp" +#include "runtime/frame.inline.hpp" static size_t small_page_size() { return os::vm_page_size(); @@ -865,3 +866,13 @@ TEST_VM(os, iso8601_time) { // Canary should still be intact EXPECT_EQ(buffer[os::iso8601_timestamp_size], 'X'); } + +TEST_VM(os, is_first_C_frame) { +#ifndef _WIN32 + frame invalid_frame; + EXPECT_TRUE(os::is_first_C_frame(&invalid_frame)); // the frame has zeroes for all values + + frame cur_frame = os::current_frame(); // this frame has to have a sender + EXPECT_FALSE(os::is_first_C_frame(&cur_frame)); +#endif // _WIN32 +} -- GitLab From 19d34bdf99e98a9ef614cb7f93c141e6c82bedcb Mon Sep 17 00:00:00 2001 From: Albert Mingkun Yang Date: Mon, 21 Mar 2022 16:20:20 +0000 Subject: [PATCH 303/340] 8281879: Serial: Merge CardGeneration into TenuredGeneration Reviewed-by: tschatzl, iwalulya --- .../share/gc/serial/tenuredGeneration.cpp | 283 +++++++++++++++- .../share/gc/serial/tenuredGeneration.hpp | 67 +++- .../gc/serial/tenuredGeneration.inline.hpp | 24 ++ .../share/gc/serial/vmStructs_serial.hpp | 2 +- .../share/gc/shared/cardGeneration.cpp | 318 ------------------ .../share/gc/shared/cardGeneration.hpp | 95 ------ .../share/gc/shared/cardGeneration.inline.hpp | 56 --- src/hotspot/share/gc/shared/generation.hpp | 3 +- src/hotspot/share/gc/shared/vmStructs_gc.hpp | 12 +- .../hotspot/gc/serial/TenuredGeneration.java | 2 +- .../jvm/hotspot/gc/shared/CardGeneration.java | 40 --- .../sun/jvm/hotspot/gc/shared/Generation.java | 5 +- .../sa/ClhsdbVmStructsDump.java | 2 +- .../jtreg/serviceability/sa/TestType.java | 1 - 14 files changed, 367 insertions(+), 543 deletions(-) delete mode 100644 src/hotspot/share/gc/shared/cardGeneration.cpp delete mode 100644 src/hotspot/share/gc/shared/cardGeneration.hpp delete mode 100644 src/hotspot/share/gc/shared/cardGeneration.inline.hpp delete mode 100644 src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/shared/CardGeneration.java diff --git a/src/hotspot/share/gc/serial/tenuredGeneration.cpp b/src/hotspot/share/gc/serial/tenuredGeneration.cpp index acf19426a95..08aede2880f 100644 --- a/src/hotspot/share/gc/serial/tenuredGeneration.cpp +++ b/src/hotspot/share/gc/serial/tenuredGeneration.cpp @@ -26,8 +26,8 @@ #include "gc/serial/genMarkSweep.hpp" #include "gc/serial/tenuredGeneration.inline.hpp" #include "gc/shared/blockOffsetTable.inline.hpp" -#include "gc/shared/cardGeneration.inline.hpp" #include "gc/shared/collectorCounters.hpp" +#include "gc/shared/gcLocker.hpp" #include "gc/shared/gcTimer.hpp" #include "gc/shared/gcTrace.hpp" #include "gc/shared/genCollectedHeap.hpp" @@ -40,13 +40,286 @@ #include "runtime/java.hpp" #include "utilities/macros.hpp" +bool TenuredGeneration::grow_by(size_t bytes) { + assert_correct_size_change_locking(); + bool result = _virtual_space.expand_by(bytes); + if (result) { + size_t new_word_size = + heap_word_size(_virtual_space.committed_size()); + MemRegion mr(space()->bottom(), new_word_size); + // Expand card table + GenCollectedHeap::heap()->rem_set()->resize_covered_region(mr); + // Expand shared block offset array + _bts->resize(new_word_size); + + // Fix for bug #4668531 + if (ZapUnusedHeapArea) { + MemRegion mangle_region(space()->end(), + (HeapWord*)_virtual_space.high()); + SpaceMangler::mangle_region(mangle_region); + } + + // Expand space -- also expands space's BOT + // (which uses (part of) shared array above) + space()->set_end((HeapWord*)_virtual_space.high()); + + // update the space and generation capacity counters + update_counters(); + + size_t new_mem_size = _virtual_space.committed_size(); + size_t old_mem_size = new_mem_size - bytes; + log_trace(gc, heap)("Expanding %s from " SIZE_FORMAT "K by " SIZE_FORMAT "K to " SIZE_FORMAT "K", + name(), old_mem_size/K, bytes/K, new_mem_size/K); + } + return result; +} + +bool TenuredGeneration::expand(size_t bytes, size_t expand_bytes) { + assert_locked_or_safepoint(Heap_lock); + if (bytes == 0) { + return true; // That's what grow_by(0) would return + } + size_t aligned_bytes = ReservedSpace::page_align_size_up(bytes); + if (aligned_bytes == 0){ + // The alignment caused the number of bytes to wrap. An expand_by(0) will + // return true with the implication that an expansion was done when it + // was not. A call to expand implies a best effort to expand by "bytes" + // but not a guarantee. Align down to give a best effort. This is likely + // the most that the generation can expand since it has some capacity to + // start with. + aligned_bytes = ReservedSpace::page_align_size_down(bytes); + } + size_t aligned_expand_bytes = ReservedSpace::page_align_size_up(expand_bytes); + bool success = false; + if (aligned_expand_bytes > aligned_bytes) { + success = grow_by(aligned_expand_bytes); + } + if (!success) { + success = grow_by(aligned_bytes); + } + if (!success) { + success = grow_to_reserved(); + } + if (success && GCLocker::is_active_and_needs_gc()) { + log_trace(gc, heap)("Garbage collection disabled, expanded heap instead"); + } + + return success; +} + +bool TenuredGeneration::grow_to_reserved() { + assert_correct_size_change_locking(); + bool success = true; + const size_t remaining_bytes = _virtual_space.uncommitted_size(); + if (remaining_bytes > 0) { + success = grow_by(remaining_bytes); + DEBUG_ONLY(if (!success) log_warning(gc)("grow to reserved failed");) + } + return success; +} + +void TenuredGeneration::shrink(size_t bytes) { + assert_correct_size_change_locking(); + + size_t size = ReservedSpace::page_align_size_down(bytes); + if (size == 0) { + return; + } + + // Shrink committed space + _virtual_space.shrink_by(size); + // Shrink space; this also shrinks the space's BOT + space()->set_end((HeapWord*) _virtual_space.high()); + size_t new_word_size = heap_word_size(space()->capacity()); + // Shrink the shared block offset array + _bts->resize(new_word_size); + MemRegion mr(space()->bottom(), new_word_size); + // Shrink the card table + GenCollectedHeap::heap()->rem_set()->resize_covered_region(mr); + + size_t new_mem_size = _virtual_space.committed_size(); + size_t old_mem_size = new_mem_size + size; + log_trace(gc, heap)("Shrinking %s from " SIZE_FORMAT "K to " SIZE_FORMAT "K", + name(), old_mem_size/K, new_mem_size/K); +} + +// Objects in this generation may have moved, invalidate this +// generation's cards. +void TenuredGeneration::invalidate_remembered_set() { + _rs->invalidate(used_region()); +} + +void TenuredGeneration::compute_new_size_inner() { + assert(_shrink_factor <= 100, "invalid shrink factor"); + size_t current_shrink_factor = _shrink_factor; + if (ShrinkHeapInSteps) { + // Always reset '_shrink_factor' if the heap is shrunk in steps. + // If we shrink the heap in this iteration, '_shrink_factor' will + // be recomputed based on the old value further down in this fuction. + _shrink_factor = 0; + } + + // We don't have floating point command-line arguments + // Note: argument processing ensures that MinHeapFreeRatio < 100. + const double minimum_free_percentage = MinHeapFreeRatio / 100.0; + const double maximum_used_percentage = 1.0 - minimum_free_percentage; + + // Compute some numbers about the state of the heap. + const size_t used_after_gc = used(); + const size_t capacity_after_gc = capacity(); + + const double min_tmp = used_after_gc / maximum_used_percentage; + size_t minimum_desired_capacity = (size_t)MIN2(min_tmp, double(max_uintx)); + // Don't shrink less than the initial generation size + minimum_desired_capacity = MAX2(minimum_desired_capacity, initial_size()); + assert(used_after_gc <= minimum_desired_capacity, "sanity check"); + + const size_t free_after_gc = free(); + const double free_percentage = ((double)free_after_gc) / capacity_after_gc; + log_trace(gc, heap)("TenuredGeneration::compute_new_size:"); + log_trace(gc, heap)(" minimum_free_percentage: %6.2f maximum_used_percentage: %6.2f", + minimum_free_percentage, + maximum_used_percentage); + log_trace(gc, heap)(" free_after_gc : %6.1fK used_after_gc : %6.1fK capacity_after_gc : %6.1fK", + free_after_gc / (double) K, + used_after_gc / (double) K, + capacity_after_gc / (double) K); + log_trace(gc, heap)(" free_percentage: %6.2f", free_percentage); + + if (capacity_after_gc < minimum_desired_capacity) { + // If we have less free space than we want then expand + size_t expand_bytes = minimum_desired_capacity - capacity_after_gc; + // Don't expand unless it's significant + if (expand_bytes >= _min_heap_delta_bytes) { + expand(expand_bytes, 0); // safe if expansion fails + } + log_trace(gc, heap)(" expanding: minimum_desired_capacity: %6.1fK expand_bytes: %6.1fK _min_heap_delta_bytes: %6.1fK", + minimum_desired_capacity / (double) K, + expand_bytes / (double) K, + _min_heap_delta_bytes / (double) K); + return; + } + + // No expansion, now see if we want to shrink + size_t shrink_bytes = 0; + // We would never want to shrink more than this + size_t max_shrink_bytes = capacity_after_gc - minimum_desired_capacity; + + if (MaxHeapFreeRatio < 100) { + const double maximum_free_percentage = MaxHeapFreeRatio / 100.0; + const double minimum_used_percentage = 1.0 - maximum_free_percentage; + const double max_tmp = used_after_gc / minimum_used_percentage; + size_t maximum_desired_capacity = (size_t)MIN2(max_tmp, double(max_uintx)); + maximum_desired_capacity = MAX2(maximum_desired_capacity, initial_size()); + log_trace(gc, heap)(" maximum_free_percentage: %6.2f minimum_used_percentage: %6.2f", + maximum_free_percentage, minimum_used_percentage); + log_trace(gc, heap)(" _capacity_at_prologue: %6.1fK minimum_desired_capacity: %6.1fK maximum_desired_capacity: %6.1fK", + _capacity_at_prologue / (double) K, + minimum_desired_capacity / (double) K, + maximum_desired_capacity / (double) K); + assert(minimum_desired_capacity <= maximum_desired_capacity, + "sanity check"); + + if (capacity_after_gc > maximum_desired_capacity) { + // Capacity too large, compute shrinking size + shrink_bytes = capacity_after_gc - maximum_desired_capacity; + if (ShrinkHeapInSteps) { + // If ShrinkHeapInSteps is true (the default), + // we don't want to shrink all the way back to initSize if people call + // System.gc(), because some programs do that between "phases" and then + // we'd just have to grow the heap up again for the next phase. So we + // damp the shrinking: 0% on the first call, 10% on the second call, 40% + // on the third call, and 100% by the fourth call. But if we recompute + // size without shrinking, it goes back to 0%. + shrink_bytes = shrink_bytes / 100 * current_shrink_factor; + if (current_shrink_factor == 0) { + _shrink_factor = 10; + } else { + _shrink_factor = MIN2(current_shrink_factor * 4, (size_t) 100); + } + } + assert(shrink_bytes <= max_shrink_bytes, "invalid shrink size"); + log_trace(gc, heap)(" shrinking: initSize: %.1fK maximum_desired_capacity: %.1fK", + initial_size() / (double) K, maximum_desired_capacity / (double) K); + log_trace(gc, heap)(" shrink_bytes: %.1fK current_shrink_factor: " SIZE_FORMAT " new shrink factor: " SIZE_FORMAT " _min_heap_delta_bytes: %.1fK", + shrink_bytes / (double) K, + current_shrink_factor, + _shrink_factor, + _min_heap_delta_bytes / (double) K); + } + } + + if (capacity_after_gc > _capacity_at_prologue) { + // We might have expanded for promotions, in which case we might want to + // take back that expansion if there's room after GC. That keeps us from + // stretching the heap with promotions when there's plenty of room. + size_t expansion_for_promotion = capacity_after_gc - _capacity_at_prologue; + expansion_for_promotion = MIN2(expansion_for_promotion, max_shrink_bytes); + // We have two shrinking computations, take the largest + shrink_bytes = MAX2(shrink_bytes, expansion_for_promotion); + assert(shrink_bytes <= max_shrink_bytes, "invalid shrink size"); + log_trace(gc, heap)(" aggressive shrinking: _capacity_at_prologue: %.1fK capacity_after_gc: %.1fK expansion_for_promotion: %.1fK shrink_bytes: %.1fK", + capacity_after_gc / (double) K, + _capacity_at_prologue / (double) K, + expansion_for_promotion / (double) K, + shrink_bytes / (double) K); + } + // Don't shrink unless it's significant + if (shrink_bytes >= _min_heap_delta_bytes) { + shrink(shrink_bytes); + } +} + +void TenuredGeneration::space_iterate(SpaceClosure* blk, + bool usedOnly) { + blk->do_space(space()); +} + +void TenuredGeneration::younger_refs_iterate(OopIterateClosure* blk) { + // Apply "cl->do_oop" to (the address of) (exactly) all the ref fields in + // "sp" that point into the young generation. + // The iteration is only over objects allocated at the start of the + // iterations; objects allocated as a result of applying the closure are + // not included. + + HeapWord* gen_boundary = reserved().start(); + _rs->younger_refs_in_space_iterate(space(), gen_boundary, blk); +} + TenuredGeneration::TenuredGeneration(ReservedSpace rs, size_t initial_byte_size, size_t min_byte_size, size_t max_byte_size, CardTableRS* remset) : - CardGeneration(rs, initial_byte_size, remset) + Generation(rs, initial_byte_size), _rs(remset), + _min_heap_delta_bytes(), _capacity_at_prologue(), + _used_at_prologue() { + // If we don't shrink the heap in steps, '_shrink_factor' is always 100%. + _shrink_factor = ShrinkHeapInSteps ? 0 : 100; + HeapWord* start = (HeapWord*)rs.base(); + size_t reserved_byte_size = rs.size(); + assert((uintptr_t(start) & 3) == 0, "bad alignment"); + assert((reserved_byte_size & 3) == 0, "bad alignment"); + MemRegion reserved_mr(start, heap_word_size(reserved_byte_size)); + _bts = new BlockOffsetSharedArray(reserved_mr, + heap_word_size(initial_byte_size)); + MemRegion committed_mr(start, heap_word_size(initial_byte_size)); + _rs->resize_covered_region(committed_mr); + + // Verify that the start and end of this generation is the start of a card. + // If this wasn't true, a single card could span more than on generation, + // which would cause problems when we commit/uncommit memory, and when we + // clear and dirty cards. + guarantee(_rs->is_aligned(reserved_mr.start()), "generation must be card aligned"); + if (reserved_mr.end() != GenCollectedHeap::heap()->reserved_region().end()) { + // Don't check at the very end of the heap as we'll assert that we're probing off + // the end if we try. + guarantee(_rs->is_aligned(reserved_mr.end()), "generation must be card aligned"); + } + _min_heap_delta_bytes = MinHeapDeltaBytes; + _capacity_at_prologue = initial_byte_size; + _used_at_prologue = 0; HeapWord* bottom = (HeapWord*) _virtual_space.low(); HeapWord* end = (HeapWord*) _virtual_space.high(); _the_space = new TenuredSpace(_bts, MemRegion(bottom, end)); @@ -114,7 +387,7 @@ void TenuredGeneration::compute_new_size() { const size_t used_after_gc = used(); const size_t capacity_after_gc = capacity(); - CardGeneration::compute_new_size(); + compute_new_size_inner(); assert(used() == used_after_gc && used_after_gc <= capacity(), "used: " SIZE_FORMAT " used_after_gc: " SIZE_FORMAT @@ -195,10 +468,6 @@ TenuredGeneration::expand_and_allocate(size_t word_size, bool is_tlab) { return _the_space->allocate(word_size); } -bool TenuredGeneration::expand(size_t bytes, size_t expand_bytes) { - return CardGeneration::expand(bytes, expand_bytes); -} - size_t TenuredGeneration::unsafe_max_alloc_nogc() const { return _the_space->free(); } diff --git a/src/hotspot/share/gc/serial/tenuredGeneration.hpp b/src/hotspot/share/gc/serial/tenuredGeneration.hpp index 410981de758..6f364a38f44 100644 --- a/src/hotspot/share/gc/serial/tenuredGeneration.hpp +++ b/src/hotspot/share/gc/serial/tenuredGeneration.hpp @@ -26,36 +26,85 @@ #define SHARE_GC_SERIAL_TENUREDGENERATION_HPP #include "gc/serial/cSpaceCounters.hpp" -#include "gc/shared/cardGeneration.hpp" +#include "gc/shared/generation.hpp" #include "gc/shared/gcStats.hpp" #include "gc/shared/generationCounters.hpp" #include "utilities/macros.hpp" +class BlockOffsetSharedArray; +class CardTableRS; +class CompactibleSpace; + // TenuredGeneration models the heap containing old (promoted/tenured) objects -// contained in a single contiguous space. -// +// contained in a single contiguous space. This generation is covered by a card +// table, and uses a card-size block-offset array to implement block_start. // Garbage collection is performed using mark-compact. -class TenuredGeneration: public CardGeneration { +class TenuredGeneration: public Generation { friend class VMStructs; // Abstractly, this is a subtype that gets access to protected fields. friend class VM_PopulateDumpSharedSpace; protected: + + // This is shared with other generations. + CardTableRS* _rs; + // This is local to this generation. + BlockOffsetSharedArray* _bts; + + // Current shrinking effect: this damps shrinking when the heap gets empty. + size_t _shrink_factor; + + size_t _min_heap_delta_bytes; // Minimum amount to expand. + + // Some statistics from before gc started. + // These are gathered in the gc_prologue (and should_collect) + // to control growing/shrinking policy in spite of promotions. + size_t _capacity_at_prologue; + size_t _used_at_prologue; + + void assert_correct_size_change_locking(); + ContiguousSpace* _the_space; // Actual space holding objects GenerationCounters* _gen_counters; CSpaceCounters* _space_counters; - // Allocation failure - virtual bool expand(size_t bytes, size_t expand_bytes); - // Accessing spaces ContiguousSpace* space() const { return _the_space; } - void assert_correct_size_change_locking(); + // Attempt to expand the generation by "bytes". Expand by at a + // minimum "expand_bytes". Return true if some amount (not + // necessarily the full "bytes") was done. + bool expand(size_t bytes, size_t expand_bytes); + + // Shrink generation with specified size + void shrink(size_t bytes); + void compute_new_size_inner(); public: + virtual void compute_new_size(); + + virtual void invalidate_remembered_set(); + + // Grow generation with specified size (returns false if unable to grow) + bool grow_by(size_t bytes); + // Grow generation to reserved size. + bool grow_to_reserved(); + + size_t capacity() const; + size_t used() const; + size_t free() const; + MemRegion used_region() const; + + void space_iterate(SpaceClosure* blk, bool usedOnly = false); + + void younger_refs_iterate(OopIterateClosure* blk); + + bool is_in(const void* p) const; + + CompactibleSpace* first_compaction_space() const; + TenuredGeneration(ReservedSpace rs, size_t initial_byte_size, size_t min_byte_size, @@ -104,8 +153,6 @@ class TenuredGeneration: public CardGeneration { size_t word_size, bool is_tlab); - virtual void compute_new_size(); - // Performance Counter support void update_counters(); diff --git a/src/hotspot/share/gc/serial/tenuredGeneration.inline.hpp b/src/hotspot/share/gc/serial/tenuredGeneration.inline.hpp index f79d31786e2..2e6a4ca56df 100644 --- a/src/hotspot/share/gc/serial/tenuredGeneration.inline.hpp +++ b/src/hotspot/share/gc/serial/tenuredGeneration.inline.hpp @@ -29,6 +29,30 @@ #include "gc/shared/space.inline.hpp" +inline size_t TenuredGeneration::capacity() const { + return space()->capacity(); +} + +inline size_t TenuredGeneration::used() const { + return space()->used(); +} + +inline size_t TenuredGeneration::free() const { + return space()->free(); +} + +inline MemRegion TenuredGeneration::used_region() const { + return space()->used_region(); +} + +inline bool TenuredGeneration::is_in(const void* p) const { + return space()->is_in(p); +} + +inline CompactibleSpace* TenuredGeneration::first_compaction_space() const { + return space(); +} + HeapWord* TenuredGeneration::allocate(size_t word_size, bool is_tlab) { assert(!is_tlab, "TenuredGeneration does not support TLAB allocation"); diff --git a/src/hotspot/share/gc/serial/vmStructs_serial.hpp b/src/hotspot/share/gc/serial/vmStructs_serial.hpp index 39905458d4c..0ba676706ab 100644 --- a/src/hotspot/share/gc/serial/vmStructs_serial.hpp +++ b/src/hotspot/share/gc/serial/vmStructs_serial.hpp @@ -45,7 +45,7 @@ declare_toplevel_type, \ declare_integer_type) \ declare_type(SerialHeap, GenCollectedHeap) \ - declare_type(TenuredGeneration, CardGeneration) \ + declare_type(TenuredGeneration, Generation) \ declare_type(TenuredSpace, OffsetTableContigSpace) \ \ declare_type(DefNewGeneration, Generation) \ diff --git a/src/hotspot/share/gc/shared/cardGeneration.cpp b/src/hotspot/share/gc/shared/cardGeneration.cpp deleted file mode 100644 index 523f65c8cc3..00000000000 --- a/src/hotspot/share/gc/shared/cardGeneration.cpp +++ /dev/null @@ -1,318 +0,0 @@ -/* - * Copyright (c) 2014, 2021, 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. - * - */ - -#include "precompiled.hpp" - -#include "gc/shared/blockOffsetTable.inline.hpp" -#include "gc/shared/cardGeneration.inline.hpp" -#include "gc/shared/cardTableRS.hpp" -#include "gc/shared/gcLocker.hpp" -#include "gc/shared/genCollectedHeap.hpp" -#include "gc/shared/genOopClosures.inline.hpp" -#include "gc/shared/generationSpec.hpp" -#include "gc/shared/space.inline.hpp" -#include "memory/iterator.hpp" -#include "memory/memRegion.hpp" -#include "logging/log.hpp" -#include "runtime/java.hpp" - -CardGeneration::CardGeneration(ReservedSpace rs, - size_t initial_byte_size, - CardTableRS* remset) : - Generation(rs, initial_byte_size), _rs(remset), - _min_heap_delta_bytes(), _capacity_at_prologue(), - _used_at_prologue() -{ - // If we don't shrink the heap in steps, '_shrink_factor' is always 100%. - _shrink_factor = ShrinkHeapInSteps ? 0 : 100; - HeapWord* start = (HeapWord*)rs.base(); - size_t reserved_byte_size = rs.size(); - assert((uintptr_t(start) & 3) == 0, "bad alignment"); - assert((reserved_byte_size & 3) == 0, "bad alignment"); - MemRegion reserved_mr(start, heap_word_size(reserved_byte_size)); - _bts = new BlockOffsetSharedArray(reserved_mr, - heap_word_size(initial_byte_size)); - MemRegion committed_mr(start, heap_word_size(initial_byte_size)); - _rs->resize_covered_region(committed_mr); - - // Verify that the start and end of this generation is the start of a card. - // If this wasn't true, a single card could span more than on generation, - // which would cause problems when we commit/uncommit memory, and when we - // clear and dirty cards. - guarantee(_rs->is_aligned(reserved_mr.start()), "generation must be card aligned"); - if (reserved_mr.end() != GenCollectedHeap::heap()->reserved_region().end()) { - // Don't check at the very end of the heap as we'll assert that we're probing off - // the end if we try. - guarantee(_rs->is_aligned(reserved_mr.end()), "generation must be card aligned"); - } - _min_heap_delta_bytes = MinHeapDeltaBytes; - _capacity_at_prologue = initial_byte_size; - _used_at_prologue = 0; -} - -bool CardGeneration::grow_by(size_t bytes) { - assert_correct_size_change_locking(); - bool result = _virtual_space.expand_by(bytes); - if (result) { - size_t new_word_size = - heap_word_size(_virtual_space.committed_size()); - MemRegion mr(space()->bottom(), new_word_size); - // Expand card table - GenCollectedHeap::heap()->rem_set()->resize_covered_region(mr); - // Expand shared block offset array - _bts->resize(new_word_size); - - // Fix for bug #4668531 - if (ZapUnusedHeapArea) { - MemRegion mangle_region(space()->end(), - (HeapWord*)_virtual_space.high()); - SpaceMangler::mangle_region(mangle_region); - } - - // Expand space -- also expands space's BOT - // (which uses (part of) shared array above) - space()->set_end((HeapWord*)_virtual_space.high()); - - // update the space and generation capacity counters - update_counters(); - - size_t new_mem_size = _virtual_space.committed_size(); - size_t old_mem_size = new_mem_size - bytes; - log_trace(gc, heap)("Expanding %s from " SIZE_FORMAT "K by " SIZE_FORMAT "K to " SIZE_FORMAT "K", - name(), old_mem_size/K, bytes/K, new_mem_size/K); - } - return result; -} - -bool CardGeneration::expand(size_t bytes, size_t expand_bytes) { - assert_locked_or_safepoint(Heap_lock); - if (bytes == 0) { - return true; // That's what grow_by(0) would return - } - size_t aligned_bytes = ReservedSpace::page_align_size_up(bytes); - if (aligned_bytes == 0){ - // The alignment caused the number of bytes to wrap. An expand_by(0) will - // return true with the implication that an expansion was done when it - // was not. A call to expand implies a best effort to expand by "bytes" - // but not a guarantee. Align down to give a best effort. This is likely - // the most that the generation can expand since it has some capacity to - // start with. - aligned_bytes = ReservedSpace::page_align_size_down(bytes); - } - size_t aligned_expand_bytes = ReservedSpace::page_align_size_up(expand_bytes); - bool success = false; - if (aligned_expand_bytes > aligned_bytes) { - success = grow_by(aligned_expand_bytes); - } - if (!success) { - success = grow_by(aligned_bytes); - } - if (!success) { - success = grow_to_reserved(); - } - if (success && GCLocker::is_active_and_needs_gc()) { - log_trace(gc, heap)("Garbage collection disabled, expanded heap instead"); - } - - return success; -} - -bool CardGeneration::grow_to_reserved() { - assert_correct_size_change_locking(); - bool success = true; - const size_t remaining_bytes = _virtual_space.uncommitted_size(); - if (remaining_bytes > 0) { - success = grow_by(remaining_bytes); - DEBUG_ONLY(if (!success) log_warning(gc)("grow to reserved failed");) - } - return success; -} - -void CardGeneration::shrink(size_t bytes) { - assert_correct_size_change_locking(); - - size_t size = ReservedSpace::page_align_size_down(bytes); - if (size == 0) { - return; - } - - // Shrink committed space - _virtual_space.shrink_by(size); - // Shrink space; this also shrinks the space's BOT - space()->set_end((HeapWord*) _virtual_space.high()); - size_t new_word_size = heap_word_size(space()->capacity()); - // Shrink the shared block offset array - _bts->resize(new_word_size); - MemRegion mr(space()->bottom(), new_word_size); - // Shrink the card table - GenCollectedHeap::heap()->rem_set()->resize_covered_region(mr); - - size_t new_mem_size = _virtual_space.committed_size(); - size_t old_mem_size = new_mem_size + size; - log_trace(gc, heap)("Shrinking %s from " SIZE_FORMAT "K to " SIZE_FORMAT "K", - name(), old_mem_size/K, new_mem_size/K); -} - -// Objects in this generation may have moved, invalidate this -// generation's cards. -void CardGeneration::invalidate_remembered_set() { - _rs->invalidate(used_region()); -} - -void CardGeneration::compute_new_size() { - assert(_shrink_factor <= 100, "invalid shrink factor"); - size_t current_shrink_factor = _shrink_factor; - if (ShrinkHeapInSteps) { - // Always reset '_shrink_factor' if the heap is shrunk in steps. - // If we shrink the heap in this iteration, '_shrink_factor' will - // be recomputed based on the old value further down in this fuction. - _shrink_factor = 0; - } - - // We don't have floating point command-line arguments - // Note: argument processing ensures that MinHeapFreeRatio < 100. - const double minimum_free_percentage = MinHeapFreeRatio / 100.0; - const double maximum_used_percentage = 1.0 - minimum_free_percentage; - - // Compute some numbers about the state of the heap. - const size_t used_after_gc = used(); - const size_t capacity_after_gc = capacity(); - - const double min_tmp = used_after_gc / maximum_used_percentage; - size_t minimum_desired_capacity = (size_t)MIN2(min_tmp, double(max_uintx)); - // Don't shrink less than the initial generation size - minimum_desired_capacity = MAX2(minimum_desired_capacity, initial_size()); - assert(used_after_gc <= minimum_desired_capacity, "sanity check"); - - const size_t free_after_gc = free(); - const double free_percentage = ((double)free_after_gc) / capacity_after_gc; - log_trace(gc, heap)("CardGeneration::compute_new_size:"); - log_trace(gc, heap)(" minimum_free_percentage: %6.2f maximum_used_percentage: %6.2f", - minimum_free_percentage, - maximum_used_percentage); - log_trace(gc, heap)(" free_after_gc : %6.1fK used_after_gc : %6.1fK capacity_after_gc : %6.1fK", - free_after_gc / (double) K, - used_after_gc / (double) K, - capacity_after_gc / (double) K); - log_trace(gc, heap)(" free_percentage: %6.2f", free_percentage); - - if (capacity_after_gc < minimum_desired_capacity) { - // If we have less free space than we want then expand - size_t expand_bytes = minimum_desired_capacity - capacity_after_gc; - // Don't expand unless it's significant - if (expand_bytes >= _min_heap_delta_bytes) { - expand(expand_bytes, 0); // safe if expansion fails - } - log_trace(gc, heap)(" expanding: minimum_desired_capacity: %6.1fK expand_bytes: %6.1fK _min_heap_delta_bytes: %6.1fK", - minimum_desired_capacity / (double) K, - expand_bytes / (double) K, - _min_heap_delta_bytes / (double) K); - return; - } - - // No expansion, now see if we want to shrink - size_t shrink_bytes = 0; - // We would never want to shrink more than this - size_t max_shrink_bytes = capacity_after_gc - minimum_desired_capacity; - - if (MaxHeapFreeRatio < 100) { - const double maximum_free_percentage = MaxHeapFreeRatio / 100.0; - const double minimum_used_percentage = 1.0 - maximum_free_percentage; - const double max_tmp = used_after_gc / minimum_used_percentage; - size_t maximum_desired_capacity = (size_t)MIN2(max_tmp, double(max_uintx)); - maximum_desired_capacity = MAX2(maximum_desired_capacity, initial_size()); - log_trace(gc, heap)(" maximum_free_percentage: %6.2f minimum_used_percentage: %6.2f", - maximum_free_percentage, minimum_used_percentage); - log_trace(gc, heap)(" _capacity_at_prologue: %6.1fK minimum_desired_capacity: %6.1fK maximum_desired_capacity: %6.1fK", - _capacity_at_prologue / (double) K, - minimum_desired_capacity / (double) K, - maximum_desired_capacity / (double) K); - assert(minimum_desired_capacity <= maximum_desired_capacity, - "sanity check"); - - if (capacity_after_gc > maximum_desired_capacity) { - // Capacity too large, compute shrinking size - shrink_bytes = capacity_after_gc - maximum_desired_capacity; - if (ShrinkHeapInSteps) { - // If ShrinkHeapInSteps is true (the default), - // we don't want to shrink all the way back to initSize if people call - // System.gc(), because some programs do that between "phases" and then - // we'd just have to grow the heap up again for the next phase. So we - // damp the shrinking: 0% on the first call, 10% on the second call, 40% - // on the third call, and 100% by the fourth call. But if we recompute - // size without shrinking, it goes back to 0%. - shrink_bytes = shrink_bytes / 100 * current_shrink_factor; - if (current_shrink_factor == 0) { - _shrink_factor = 10; - } else { - _shrink_factor = MIN2(current_shrink_factor * 4, (size_t) 100); - } - } - assert(shrink_bytes <= max_shrink_bytes, "invalid shrink size"); - log_trace(gc, heap)(" shrinking: initSize: %.1fK maximum_desired_capacity: %.1fK", - initial_size() / (double) K, maximum_desired_capacity / (double) K); - log_trace(gc, heap)(" shrink_bytes: %.1fK current_shrink_factor: " SIZE_FORMAT " new shrink factor: " SIZE_FORMAT " _min_heap_delta_bytes: %.1fK", - shrink_bytes / (double) K, - current_shrink_factor, - _shrink_factor, - _min_heap_delta_bytes / (double) K); - } - } - - if (capacity_after_gc > _capacity_at_prologue) { - // We might have expanded for promotions, in which case we might want to - // take back that expansion if there's room after GC. That keeps us from - // stretching the heap with promotions when there's plenty of room. - size_t expansion_for_promotion = capacity_after_gc - _capacity_at_prologue; - expansion_for_promotion = MIN2(expansion_for_promotion, max_shrink_bytes); - // We have two shrinking computations, take the largest - shrink_bytes = MAX2(shrink_bytes, expansion_for_promotion); - assert(shrink_bytes <= max_shrink_bytes, "invalid shrink size"); - log_trace(gc, heap)(" aggressive shrinking: _capacity_at_prologue: %.1fK capacity_after_gc: %.1fK expansion_for_promotion: %.1fK shrink_bytes: %.1fK", - capacity_after_gc / (double) K, - _capacity_at_prologue / (double) K, - expansion_for_promotion / (double) K, - shrink_bytes / (double) K); - } - // Don't shrink unless it's significant - if (shrink_bytes >= _min_heap_delta_bytes) { - shrink(shrink_bytes); - } -} - -void CardGeneration::space_iterate(SpaceClosure* blk, - bool usedOnly) { - blk->do_space(space()); -} - -void CardGeneration::younger_refs_iterate(OopIterateClosure* blk) { - // Apply "cl->do_oop" to (the address of) (exactly) all the ref fields in - // "sp" that point into the young generation. - // The iteration is only over objects allocated at the start of the - // iterations; objects allocated as a result of applying the closure are - // not included. - - HeapWord* gen_boundary = reserved().start(); - _rs->younger_refs_in_space_iterate(space(), gen_boundary, blk); -} diff --git a/src/hotspot/share/gc/shared/cardGeneration.hpp b/src/hotspot/share/gc/shared/cardGeneration.hpp deleted file mode 100644 index 084737a6146..00000000000 --- a/src/hotspot/share/gc/shared/cardGeneration.hpp +++ /dev/null @@ -1,95 +0,0 @@ -/* - * Copyright (c) 2014, 2019, 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. - * - */ - -#ifndef SHARE_GC_SHARED_CARDGENERATION_HPP -#define SHARE_GC_SHARED_CARDGENERATION_HPP - -// Class CardGeneration is a generation that is covered by a card table, -// and uses a card-size block-offset array to implement block_start. - -#include "gc/shared/generation.hpp" - -class BlockOffsetSharedArray; -class CardTableRS; -class CompactibleSpace; - -class CardGeneration: public Generation { - friend class VMStructs; - protected: - // This is shared with other generations. - CardTableRS* _rs; - // This is local to this generation. - BlockOffsetSharedArray* _bts; - - // Current shrinking effect: this damps shrinking when the heap gets empty. - size_t _shrink_factor; - - size_t _min_heap_delta_bytes; // Minimum amount to expand. - - // Some statistics from before gc started. - // These are gathered in the gc_prologue (and should_collect) - // to control growing/shrinking policy in spite of promotions. - size_t _capacity_at_prologue; - size_t _used_at_prologue; - - CardGeneration(ReservedSpace rs, size_t initial_byte_size, CardTableRS* remset); - - virtual void assert_correct_size_change_locking() = 0; - - virtual CompactibleSpace* space() const = 0; - - public: - - // Attempt to expand the generation by "bytes". Expand by at a - // minimum "expand_bytes". Return true if some amount (not - // necessarily the full "bytes") was done. - virtual bool expand(size_t bytes, size_t expand_bytes); - - // Shrink generation with specified size - virtual void shrink(size_t bytes); - - virtual void compute_new_size(); - - virtual void invalidate_remembered_set(); - - // Grow generation with specified size (returns false if unable to grow) - bool grow_by(size_t bytes); - // Grow generation to reserved size. - bool grow_to_reserved(); - - size_t capacity() const; - size_t used() const; - size_t free() const; - MemRegion used_region() const; - - void space_iterate(SpaceClosure* blk, bool usedOnly = false); - - void younger_refs_iterate(OopIterateClosure* blk); - - bool is_in(const void* p) const; - - CompactibleSpace* first_compaction_space() const; -}; - -#endif // SHARE_GC_SHARED_CARDGENERATION_HPP diff --git a/src/hotspot/share/gc/shared/cardGeneration.inline.hpp b/src/hotspot/share/gc/shared/cardGeneration.inline.hpp deleted file mode 100644 index bd8285af679..00000000000 --- a/src/hotspot/share/gc/shared/cardGeneration.inline.hpp +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2014, 2019, 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. - * - */ - -#ifndef SHARE_GC_SHARED_CARDGENERATION_INLINE_HPP -#define SHARE_GC_SHARED_CARDGENERATION_INLINE_HPP - -#include "gc/shared/cardGeneration.hpp" - -#include "gc/shared/space.hpp" - -inline size_t CardGeneration::capacity() const { - return space()->capacity(); -} - -inline size_t CardGeneration::used() const { - return space()->used(); -} - -inline size_t CardGeneration::free() const { - return space()->free(); -} - -inline MemRegion CardGeneration::used_region() const { - return space()->used_region(); -} - -inline bool CardGeneration::is_in(const void* p) const { - return space()->is_in(p); -} - -inline CompactibleSpace* CardGeneration::first_compaction_space() const { - return space(); -} - -#endif // SHARE_GC_SHARED_CARDGENERATION_INLINE_HPP diff --git a/src/hotspot/share/gc/shared/generation.hpp b/src/hotspot/share/gc/shared/generation.hpp index b9183ec2898..36740cc4039 100644 --- a/src/hotspot/share/gc/shared/generation.hpp +++ b/src/hotspot/share/gc/shared/generation.hpp @@ -41,8 +41,7 @@ // // Generation - abstract base class // - DefNewGeneration - allocation area (copy collected) -// - CardGeneration - abstract class adding offset array behavior -// - TenuredGeneration - tenured (old object) space (markSweepCompact) +// - TenuredGeneration - tenured (old object) space (markSweepCompact) // // The system configuration currently allowed is: // diff --git a/src/hotspot/share/gc/shared/vmStructs_gc.hpp b/src/hotspot/share/gc/shared/vmStructs_gc.hpp index f9b1c631123..d5cf2c15373 100644 --- a/src/hotspot/share/gc/shared/vmStructs_gc.hpp +++ b/src/hotspot/share/gc/shared/vmStructs_gc.hpp @@ -26,7 +26,6 @@ #define SHARE_GC_SHARED_VMSTRUCTS_GC_HPP #include "gc/shared/ageTable.hpp" -#include "gc/shared/cardGeneration.hpp" #include "gc/shared/cardTable.hpp" #include "gc/shared/cardTableRS.hpp" #include "gc/shared/collectedHeap.hpp" @@ -101,11 +100,11 @@ nonstatic_field(BlockOffsetArrayContigSpace, _next_offset_threshold, HeapWord*) \ nonstatic_field(BlockOffsetArrayContigSpace, _next_offset_index, size_t) \ \ - nonstatic_field(CardGeneration, _rs, CardTableRS*) \ - nonstatic_field(CardGeneration, _bts, BlockOffsetSharedArray*) \ - nonstatic_field(CardGeneration, _shrink_factor, size_t) \ - nonstatic_field(CardGeneration, _capacity_at_prologue, size_t) \ - nonstatic_field(CardGeneration, _used_at_prologue, size_t) \ + nonstatic_field(TenuredGeneration, _rs, CardTableRS*) \ + nonstatic_field(TenuredGeneration, _bts, BlockOffsetSharedArray*) \ + nonstatic_field(TenuredGeneration, _shrink_factor, size_t) \ + nonstatic_field(TenuredGeneration, _capacity_at_prologue, size_t) \ + nonstatic_field(TenuredGeneration, _used_at_prologue, size_t) \ \ nonstatic_field(CardTable, _whole_heap, const MemRegion) \ nonstatic_field(CardTable, _guard_index, const size_t) \ @@ -186,7 +185,6 @@ declare_toplevel_type(CollectedHeap) \ declare_type(GenCollectedHeap, CollectedHeap) \ declare_toplevel_type(Generation) \ - declare_type(CardGeneration, Generation) \ declare_toplevel_type(Space) \ declare_type(CompactibleSpace, Space) \ declare_type(ContiguousSpace, CompactibleSpace) \ diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/serial/TenuredGeneration.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/serial/TenuredGeneration.java index 6f121f963af..cc4f216efc2 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/serial/TenuredGeneration.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/serial/TenuredGeneration.java @@ -39,7 +39,7 @@ import sun.jvm.hotspot.utilities.Observer;

    Garbage collection is performed using mark-compact.

    */ -public class TenuredGeneration extends CardGeneration { +public class TenuredGeneration extends Generation { private static AddressField theSpaceField; static { diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/shared/CardGeneration.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/shared/CardGeneration.java deleted file mode 100644 index 3d96d33d81e..00000000000 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/shared/CardGeneration.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (c) 2000, 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 sun.jvm.hotspot.gc.shared; - -import sun.jvm.hotspot.debugger.*; - -/** Class CardGeneration is a generation that is covered by a card - table, and uses a card-size block-offset array to implement - block_start. */ - -public abstract class CardGeneration extends Generation { - public CardGeneration(Address addr) { - super(addr); - } - - // FIXME: not sure what I need to expose from here in order to have - // verification similar to that of the old RememberedSet -} diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/shared/Generation.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/shared/Generation.java index eeb099a11dc..5323d9cee4e 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/shared/Generation.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/shared/Generation.java @@ -38,10 +38,7 @@ import sun.jvm.hotspot.utilities.Observer;
    • Generation
        -
      • CardGeneration -
          -
        • TenuredGeneration -
        +
      • TenuredGeneration
      • DefNewGeneration
    diff --git a/test/hotspot/jtreg/serviceability/sa/ClhsdbVmStructsDump.java b/test/hotspot/jtreg/serviceability/sa/ClhsdbVmStructsDump.java index 680d9078d3b..050ec9c05d6 100644 --- a/test/hotspot/jtreg/serviceability/sa/ClhsdbVmStructsDump.java +++ b/test/hotspot/jtreg/serviceability/sa/ClhsdbVmStructsDump.java @@ -57,7 +57,7 @@ public class ClhsdbVmStructsDump { "field Klass _name Symbol*", "type ClassLoaderData* null", "field JavaThread _osthread OSThread*", - "type TenuredGeneration CardGeneration", + "type TenuredGeneration Generation", "type Universe null", "type ConstantPoolCache MetaspaceObj")); test.run(theApp.getPid(), cmds, expStrMap, null); diff --git a/test/hotspot/jtreg/serviceability/sa/TestType.java b/test/hotspot/jtreg/serviceability/sa/TestType.java index 1e4a9e56e57..4f71e42cd4e 100644 --- a/test/hotspot/jtreg/serviceability/sa/TestType.java +++ b/test/hotspot/jtreg/serviceability/sa/TestType.java @@ -62,7 +62,6 @@ public class TestType { "type ConstantPoolCache MetaspaceObj", "type ConstantPool Metadata", "type CompilerThread JavaThread", - "type CardGeneration Generation", "type ArrayKlass Klass", "type InstanceKlass Klass")); // String to check for in the output of "type InstanceKlass" -- GitLab From f4f87284cbbe95958d8c7d8adc0f5c5e260892ca Mon Sep 17 00:00:00 2001 From: Albert Mingkun Yang Date: Mon, 21 Mar 2022 16:21:30 +0000 Subject: [PATCH 304/340] 8283097: Parallel: Move filler object logic inside PSPromotionLAB::unallocate_object Reviewed-by: tschatzl, iwalulya --- src/hotspot/share/gc/parallel/psPromotionLAB.cpp | 9 +++++---- src/hotspot/share/gc/parallel/psPromotionLAB.hpp | 2 +- .../share/gc/parallel/psPromotionManager.inline.hpp | 11 +++-------- 3 files changed, 9 insertions(+), 13 deletions(-) diff --git a/src/hotspot/share/gc/parallel/psPromotionLAB.cpp b/src/hotspot/share/gc/parallel/psPromotionLAB.cpp index 312db67606a..bab79b25a13 100644 --- a/src/hotspot/share/gc/parallel/psPromotionLAB.cpp +++ b/src/hotspot/share/gc/parallel/psPromotionLAB.cpp @@ -85,18 +85,19 @@ void PSPromotionLAB::flush() { _state = flushed; } -bool PSPromotionLAB::unallocate_object(HeapWord* obj, size_t obj_size) { +void PSPromotionLAB::unallocate_object(HeapWord* obj, size_t obj_size) { assert(ParallelScavengeHeap::heap()->is_in(obj), "Object outside heap"); + // If the object is inside this LAB, we just bump-down the `top` pointer. + // Otherwise, we overwrite it with a filler object. if (contains(obj)) { HeapWord* object_end = obj + obj_size; assert(object_end == top(), "Not matching last allocation"); set_top(obj); - return true; + } else { + CollectedHeap::fill_with_object(obj, obj_size); } - - return false; } // Fill all remaining lab space with an unreachable object. diff --git a/src/hotspot/share/gc/parallel/psPromotionLAB.hpp b/src/hotspot/share/gc/parallel/psPromotionLAB.hpp index 239a1140a8a..7e8f8857dcd 100644 --- a/src/hotspot/share/gc/parallel/psPromotionLAB.hpp +++ b/src/hotspot/share/gc/parallel/psPromotionLAB.hpp @@ -72,7 +72,7 @@ class PSPromotionLAB : public CHeapObj { bool is_flushed() { return _state == flushed; } - bool unallocate_object(HeapWord* obj, size_t obj_size); + void unallocate_object(HeapWord* obj, size_t obj_size); // Returns a subregion containing all objects in this space. MemRegion used_region() { return MemRegion(bottom(), top()); } diff --git a/src/hotspot/share/gc/parallel/psPromotionManager.inline.hpp b/src/hotspot/share/gc/parallel/psPromotionManager.inline.hpp index b3f1c7297f4..1b7b00d9fba 100644 --- a/src/hotspot/share/gc/parallel/psPromotionManager.inline.hpp +++ b/src/hotspot/share/gc/parallel/psPromotionManager.inline.hpp @@ -290,15 +290,10 @@ inline oop PSPromotionManager::copy_unmarked_to_survivor_space(oop o, assert(o->is_forwarded(), "Object must be forwarded if the cas failed."); assert(o->forwardee() == forwardee, "invariant"); - // Try to deallocate the space. If it was directly allocated we cannot - // deallocate it, so we have to test. If the deallocation fails, - // overwrite with a filler object. if (new_obj_is_tenured) { - if (!_old_lab.unallocate_object(cast_from_oop(new_obj), new_obj_size)) { - CollectedHeap::fill_with_object(cast_from_oop(new_obj), new_obj_size); - } - } else if (!_young_lab.unallocate_object(cast_from_oop(new_obj), new_obj_size)) { - CollectedHeap::fill_with_object(cast_from_oop(new_obj), new_obj_size); + _old_lab.unallocate_object(cast_from_oop(new_obj), new_obj_size); + } else { + _young_lab.unallocate_object(cast_from_oop(new_obj), new_obj_size); } return forwardee; } -- GitLab From 14b9e80b8adcc0ab0634357f5a7c25f24fd6808c Mon Sep 17 00:00:00 2001 From: Joe Darcy Date: Mon, 21 Mar 2022 16:57:17 +0000 Subject: [PATCH 305/340] 8283415: Update java.lang.ref to use sealed classes Reviewed-by: kbarrett, alanb --- .../share/classes/java/lang/ref/FinalReference.java | 4 ++-- .../share/classes/java/lang/ref/PhantomReference.java | 4 ++-- src/java.base/share/classes/java/lang/ref/Reference.java | 5 +++-- src/java.base/share/classes/java/lang/ref/SoftReference.java | 4 ++-- src/java.base/share/classes/java/lang/ref/WeakReference.java | 4 ++-- 5 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/java.base/share/classes/java/lang/ref/FinalReference.java b/src/java.base/share/classes/java/lang/ref/FinalReference.java index 9175516d4d0..06af37df67c 100644 --- a/src/java.base/share/classes/java/lang/ref/FinalReference.java +++ b/src/java.base/share/classes/java/lang/ref/FinalReference.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2022, 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 @@ -28,7 +28,7 @@ package java.lang.ref; /** * Final references, used to implement finalization */ -class FinalReference extends Reference { +sealed class FinalReference extends Reference permits Finalizer { public FinalReference(T referent, ReferenceQueue q) { super(referent, q); diff --git a/src/java.base/share/classes/java/lang/ref/PhantomReference.java b/src/java.base/share/classes/java/lang/ref/PhantomReference.java index 2c1532b8eb2..fef3bc7c508 100644 --- a/src/java.base/share/classes/java/lang/ref/PhantomReference.java +++ b/src/java.base/share/classes/java/lang/ref/PhantomReference.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2022, 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 @@ -50,7 +50,7 @@ import jdk.internal.vm.annotation.IntrinsicCandidate; * @since 1.2 */ -public class PhantomReference extends Reference { +public non-sealed class PhantomReference extends Reference { /** * Returns this reference object's referent. Because the referent of a diff --git a/src/java.base/share/classes/java/lang/ref/Reference.java b/src/java.base/share/classes/java/lang/ref/Reference.java index 17d8c7b669c..777567085eb 100644 --- a/src/java.base/share/classes/java/lang/ref/Reference.java +++ b/src/java.base/share/classes/java/lang/ref/Reference.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -41,7 +41,8 @@ import jdk.internal.ref.Cleaner; * @since 1.2 */ -public abstract class Reference { +public abstract sealed class Reference + permits PhantomReference, SoftReference, WeakReference, FinalReference { /* The state of a Reference object is characterized by two attributes. It * may be either "active", "pending", or "inactive". It may also be diff --git a/src/java.base/share/classes/java/lang/ref/SoftReference.java b/src/java.base/share/classes/java/lang/ref/SoftReference.java index 8ce74a67d0a..a0cb75dcf50 100644 --- a/src/java.base/share/classes/java/lang/ref/SoftReference.java +++ b/src/java.base/share/classes/java/lang/ref/SoftReference.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2022, 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 @@ -61,7 +61,7 @@ package java.lang.ref; * @since 1.2 */ -public class SoftReference extends Reference { +public non-sealed class SoftReference extends Reference { /** * Timestamp clock, updated by the garbage collector diff --git a/src/java.base/share/classes/java/lang/ref/WeakReference.java b/src/java.base/share/classes/java/lang/ref/WeakReference.java index fdf2b5c9f02..1d1a01f3acd 100644 --- a/src/java.base/share/classes/java/lang/ref/WeakReference.java +++ b/src/java.base/share/classes/java/lang/ref/WeakReference.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -45,7 +45,7 @@ package java.lang.ref; * @since 1.2 */ -public class WeakReference extends Reference { +public non-sealed class WeakReference extends Reference { /** * Creates a new weak reference that refers to the given object. The new -- GitLab From f8878cb0cc436993ef1222bc13b00b923d91aad1 Mon Sep 17 00:00:00 2001 From: Magnus Ihse Bursie Date: Mon, 21 Mar 2022 21:34:09 +0000 Subject: [PATCH 306/340] 8257733: Move module-specific data from make to respective module Reviewed-by: jjg, weijun, naoto, erikj, prr, alanb, mchung --- make/ModuleWrapper.gmk | 4 +- make/ToolsJdk.gmk | 4 +- make/UpdateX11Wrappers.gmk | 4 +- .../tools/symbolgenerator/CreateSymbols.java | 9 ++-- make/modules/java.base/Gendata.gmk | 10 ++--- make/modules/java.base/Gensrc.gmk | 12 +++--- .../java.base/gendata/GendataBlockedCerts.gmk | 4 +- .../gendata/GendataBreakIterator.gmk | 4 +- .../gendata/GendataPublicSuffixList.gmk | 4 +- .../modules/java.base/gendata/GendataTZDB.gmk | 4 +- .../modules/java.base/gensrc/GensrcBuffer.gmk | 4 +- .../java.base/gensrc/GensrcCharacterData.gmk | 10 ++--- .../java.base/gensrc/GensrcCharsetCoder.gmk | 4 +- .../java.base/gensrc/GensrcEmojiData.gmk | 6 +-- .../java.base/gensrc/GensrcExceptions.gmk | 4 +- .../java.base/gensrc/GensrcLocaleData.gmk | 6 +-- .../gensrc/GensrcScopedMemoryAccess.gmk | 6 +-- .../java.base/gensrc/GensrcVarHandles.gmk | 4 +- .../gendata/GendataFontConfig.gmk | 39 ++++++++++-------- .../java.desktop/gensrc/GensrcIcons.gmk | 8 ++-- .../java.desktop/gensrc/GensrcSwing.gmk | 4 +- .../java.desktop/gensrc/GensrcX11Wrappers.gmk | 6 +-- make/modules/jdk.charsets/Gensrc.gmk | 6 +-- make/modules/jdk.compiler/Gendata.gmk | 6 +-- make/modules/jdk.javadoc/Gendata.gmk | 6 +-- make/modules/jdk.jdi/Gensrc.gmk | 9 ++-- make/modules/jdk.localedata/Gensrc.gmk | 4 +- make/scripts/generate-symbol-data.sh | 18 ++++---- .../java/lang}/CharacterData00.java.template | 0 .../java/lang}/CharacterData01.java.template | 0 .../java/lang}/CharacterData02.java.template | 0 .../java/lang}/CharacterData03.java.template | 0 .../java/lang}/CharacterData0E.java.template | 0 .../lang}/CharacterDataLatin1.java.template | 0 .../blockedcertsconverter/blocked.certs.pem | 0 .../java.base/share}/data/cacerts/README | 0 .../data/cacerts/actalisauthenticationrootca | 0 .../share}/data/cacerts/addtrustexternalca | 0 .../share}/data/cacerts/addtrustqualifiedca | 0 .../data/cacerts/affirmtrustcommercialca | 0 .../data/cacerts/affirmtrustnetworkingca | 0 .../share}/data/cacerts/affirmtrustpremiumca | 0 .../data/cacerts/affirmtrustpremiumeccca | 0 .../share}/data/cacerts/amazonrootca1 | 0 .../share}/data/cacerts/amazonrootca2 | 0 .../share}/data/cacerts/amazonrootca3 | 0 .../share}/data/cacerts/amazonrootca4 | 0 .../share}/data/cacerts/baltimorecybertrustca | 0 .../share}/data/cacerts/buypassclass2ca | 0 .../share}/data/cacerts/buypassclass3ca | 0 .../share}/data/cacerts/camerfirmachambersca | 0 .../data/cacerts/camerfirmachamberscommerceca | 0 .../data/cacerts/camerfirmachambersignca | 0 .../java.base/share}/data/cacerts/certumca | 0 .../data/cacerts/certumtrustednetworkca | 0 .../share}/data/cacerts/chunghwaepkirootca | 0 .../java.base/share}/data/cacerts/comodoaaaca | 0 .../java.base/share}/data/cacerts/comodoeccca | 0 .../java.base/share}/data/cacerts/comodorsaca | 0 .../share}/data/cacerts/digicertassuredidg2 | 0 .../share}/data/cacerts/digicertassuredidg3 | 0 .../data/cacerts/digicertassuredidrootca | 0 .../share}/data/cacerts/digicertglobalrootca | 0 .../share}/data/cacerts/digicertglobalrootg2 | 0 .../share}/data/cacerts/digicertglobalrootg3 | 0 .../cacerts/digicerthighassuranceevrootca | 0 .../share}/data/cacerts/digicerttrustedrootg4 | 0 .../share}/data/cacerts/dtrustclass3ca2 | 0 .../share}/data/cacerts/dtrustclass3ca2ev | 0 .../share}/data/cacerts/entrust2048ca | 0 .../java.base/share}/data/cacerts/entrustevca | 0 .../share}/data/cacerts/entrustrootcaec1 | 0 .../share}/data/cacerts/entrustrootcag2 | 0 .../share}/data/cacerts/entrustrootcag4 | 0 .../share}/data/cacerts/geotrustglobalca | 0 .../share}/data/cacerts/geotrustprimaryca | 0 .../share}/data/cacerts/geotrustprimarycag2 | 0 .../share}/data/cacerts/geotrustprimarycag3 | 0 .../share}/data/cacerts/geotrustuniversalca | 0 .../share}/data/cacerts/globalsignca | 0 .../share}/data/cacerts/globalsigneccrootcar4 | 0 .../share}/data/cacerts/globalsigneccrootcar5 | 0 .../share}/data/cacerts/globalsignr3ca | 0 .../share}/data/cacerts/globalsignrootcar6 | 0 .../share}/data/cacerts/godaddyclass2ca | 0 .../share}/data/cacerts/godaddyrootg2ca | 0 .../share}/data/cacerts/haricaeccrootca2015 | 0 .../share}/data/cacerts/haricarootca2015 | 0 .../share}/data/cacerts/identrustcommercial | 0 .../share}/data/cacerts/identrustpublicca | 0 .../share}/data/cacerts/letsencryptisrgx1 | 0 .../share}/data/cacerts/luxtrustglobalroot2ca | 0 .../share}/data/cacerts/luxtrustglobalrootca | 0 .../share}/data/cacerts/quovadisrootca | 0 .../share}/data/cacerts/quovadisrootca1g3 | 0 .../share}/data/cacerts/quovadisrootca2 | 0 .../share}/data/cacerts/quovadisrootca2g3 | 0 .../share}/data/cacerts/quovadisrootca3 | 0 .../share}/data/cacerts/quovadisrootca3g3 | 0 .../share}/data/cacerts/secomscrootca1 | 0 .../share}/data/cacerts/secomscrootca2 | 0 .../share}/data/cacerts/securetrustca | 0 .../share}/data/cacerts/sslrooteccca | 0 .../share}/data/cacerts/sslrootevrsaca | 0 .../share}/data/cacerts/sslrootrsaca | 0 .../share}/data/cacerts/starfieldclass2ca | 0 .../share}/data/cacerts/starfieldrootg2ca | 0 .../data/cacerts/starfieldservicesrootg2ca | 0 .../share}/data/cacerts/swisssigngoldg2ca | 0 .../share}/data/cacerts/swisssignplatinumg2ca | 0 .../share}/data/cacerts/swisssignsilverg2ca | 0 .../share}/data/cacerts/teliasonerarootcav1 | 0 .../share}/data/cacerts/thawteprimaryrootca | 0 .../share}/data/cacerts/thawteprimaryrootcag2 | 0 .../share}/data/cacerts/thawteprimaryrootcag3 | 0 .../data/cacerts/ttelesecglobalrootclass2ca | 0 .../data/cacerts/ttelesecglobalrootclass3ca | 0 .../share}/data/cacerts/usertrusteccca | 0 .../share}/data/cacerts/usertrustrsaca | 0 .../share}/data/cacerts/utnuserfirstobjectca | 0 .../share}/data/cacerts/verisignclass3g3ca | 0 .../share}/data/cacerts/verisignclass3g4ca | 0 .../share}/data/cacerts/verisignclass3g5ca | 0 .../data/cacerts/verisignuniversalrootca | 0 .../share}/data/cacerts/xrampglobalca | 0 .../data/currency/CurrencyData.properties | 0 .../data/lsrdata/language-subtag-registry.txt | 0 .../share}/data/publicsuffixlist/VERSION | 0 .../publicsuffixlist/public_suffix_list.dat | 0 .../java.base/share}/data/tzdata/VERSION | 0 .../java.base/share}/data/tzdata/africa | 0 .../java.base/share}/data/tzdata/antarctica | 0 .../java.base/share}/data/tzdata/asia | 0 .../java.base/share}/data/tzdata/australasia | 0 .../java.base/share}/data/tzdata/backward | 0 .../java.base/share}/data/tzdata/etcetera | 0 .../java.base/share}/data/tzdata/europe | 0 .../java.base/share}/data/tzdata/factory | 0 {make => src/java.base/share}/data/tzdata/gmt | 0 .../java.base/share}/data/tzdata/iso3166.tab | 0 .../share}/data/tzdata/jdk11_backward | 0 .../java.base/share}/data/tzdata/leapseconds | 0 .../java.base/share}/data/tzdata/northamerica | 0 .../java.base/share}/data/tzdata/solar87 | 0 .../java.base/share}/data/tzdata/solar88 | 0 .../java.base/share}/data/tzdata/solar89 | 0 .../java.base/share}/data/tzdata/southamerica | 0 .../java.base/share}/data/tzdata/zone.tab | 0 .../share}/data/unicodedata/Blocks.txt | 0 .../unicodedata/DerivedCoreProperties.txt | 0 .../data/unicodedata/NormalizationTest.txt | 0 .../share}/data/unicodedata/PropList.txt | 0 .../data/unicodedata/PropertyValueAliases.txt | 0 .../share}/data/unicodedata/ReadMe.txt | 0 .../share}/data/unicodedata/Scripts.txt | 0 .../share}/data/unicodedata/SpecialCasing.txt | 0 .../share}/data/unicodedata/UnicodeData.txt | 0 .../auxiliary/GraphemeBreakProperty.txt | 0 .../auxiliary/GraphemeBreakTest.txt | 0 .../data/unicodedata/emoji/emoji-data.txt | 0 .../aix/data/fontconfig/fontconfig.properties | 0 .../bsd/data/fontconfig/fontconfig.properties | 0 .../data/fontconfig/fontconfig.properties | 0 .../macosx}/data/macosxicons/JavaApp.icns | Bin .../share}/data/dtdbuilder/HTMLlat1.sgml | 0 .../share}/data/dtdbuilder/HTMLspecial.sgml | 0 .../share}/data/dtdbuilder/HTMLsymbol.sgml | 0 .../share}/data/dtdbuilder/html32.dtd | 0 .../share}/data/dtdbuilder/public.map | 0 .../unix}/data/x11wrappergen/sizes-32.txt | 0 .../unix}/data/x11wrappergen/sizes-64.txt | 0 .../unix}/data/x11wrappergen/xlibtypes.txt | 0 .../data/fontconfig/fontconfig.properties | 0 .../java.se/share}/data/jdwp/jdwp.spec | 0 .../jdk.compiler/share}/data/symbols/README | 0 .../share}/data/symbols/include.list | 0 .../data/symbols/java.activation-8.sym.txt | 0 .../data/symbols/java.activation-9.sym.txt | 0 .../data/symbols/java.activation-A.sym.txt | 0 .../data/symbols/java.activation-B.sym.txt | 0 .../share}/data/symbols/java.base-7.sym.txt | 0 .../share}/data/symbols/java.base-8.sym.txt | 0 .../share}/data/symbols/java.base-9.sym.txt | 0 .../share}/data/symbols/java.base-A.sym.txt | 0 .../share}/data/symbols/java.base-B.sym.txt | 0 .../share}/data/symbols/java.base-C.sym.txt | 0 .../share}/data/symbols/java.base-D.sym.txt | 0 .../share}/data/symbols/java.base-E.sym.txt | 0 .../share}/data/symbols/java.base-F.sym.txt | 0 .../share}/data/symbols/java.base-G.sym.txt | 0 .../share}/data/symbols/java.base-H.sym.txt | 0 .../share}/data/symbols/java.base-I.sym.txt | 0 .../data/symbols/java.compiler-7.sym.txt | 0 .../data/symbols/java.compiler-8.sym.txt | 0 .../data/symbols/java.compiler-9.sym.txt | 0 .../data/symbols/java.compiler-A.sym.txt | 0 .../data/symbols/java.compiler-B.sym.txt | 0 .../data/symbols/java.compiler-C.sym.txt | 0 .../data/symbols/java.compiler-D.sym.txt | 0 .../data/symbols/java.compiler-E.sym.txt | 0 .../data/symbols/java.compiler-F.sym.txt | 0 .../data/symbols/java.compiler-G.sym.txt | 0 .../data/symbols/java.compiler-H.sym.txt | 0 .../data/symbols/java.compiler-I.sym.txt | 0 .../share}/data/symbols/java.corba-8.sym.txt | 0 .../share}/data/symbols/java.corba-9.sym.txt | 0 .../share}/data/symbols/java.corba-A.sym.txt | 0 .../share}/data/symbols/java.corba-B.sym.txt | 0 .../data/symbols/java.datatransfer-7.sym.txt | 0 .../data/symbols/java.datatransfer-8.sym.txt | 0 .../data/symbols/java.datatransfer-9.sym.txt | 0 .../data/symbols/java.datatransfer-A.sym.txt | 0 .../data/symbols/java.datatransfer-B.sym.txt | 0 .../data/symbols/java.datatransfer-G.sym.txt | 0 .../data/symbols/java.datatransfer-H.sym.txt | 0 .../data/symbols/java.datatransfer-I.sym.txt | 0 .../data/symbols/java.desktop-7.sym.txt | 0 .../data/symbols/java.desktop-8.sym.txt | 0 .../data/symbols/java.desktop-9.sym.txt | 0 .../data/symbols/java.desktop-A.sym.txt | 0 .../data/symbols/java.desktop-B.sym.txt | 0 .../data/symbols/java.desktop-C.sym.txt | 0 .../data/symbols/java.desktop-D.sym.txt | 0 .../data/symbols/java.desktop-E.sym.txt | 0 .../data/symbols/java.desktop-F.sym.txt | 0 .../data/symbols/java.desktop-G.sym.txt | 0 .../data/symbols/java.desktop-H.sym.txt | 0 .../data/symbols/java.desktop-I.sym.txt | 0 .../data/symbols/java.instrument-8.sym.txt | 0 .../data/symbols/java.instrument-9.sym.txt | 0 .../data/symbols/java.instrument-A.sym.txt | 0 .../data/symbols/java.instrument-B.sym.txt | 0 .../data/symbols/java.instrument-G.sym.txt | 0 .../data/symbols/java.instrument-H.sym.txt | 0 .../data/symbols/java.instrument-I.sym.txt | 0 .../data/symbols/java.logging-7.sym.txt | 0 .../data/symbols/java.logging-8.sym.txt | 0 .../data/symbols/java.logging-9.sym.txt | 0 .../data/symbols/java.logging-A.sym.txt | 0 .../data/symbols/java.logging-B.sym.txt | 0 .../data/symbols/java.logging-G.sym.txt | 0 .../data/symbols/java.logging-H.sym.txt | 0 .../data/symbols/java.logging-I.sym.txt | 0 .../data/symbols/java.management-7.sym.txt | 0 .../data/symbols/java.management-8.sym.txt | 0 .../data/symbols/java.management-9.sym.txt | 0 .../data/symbols/java.management-A.sym.txt | 0 .../data/symbols/java.management-B.sym.txt | 0 .../data/symbols/java.management-D.sym.txt | 0 .../data/symbols/java.management-G.sym.txt | 0 .../data/symbols/java.management-H.sym.txt | 0 .../data/symbols/java.management-I.sym.txt | 0 .../symbols/java.management.rmi-8.sym.txt | 0 .../symbols/java.management.rmi-9.sym.txt | 0 .../symbols/java.management.rmi-A.sym.txt | 0 .../symbols/java.management.rmi-B.sym.txt | 0 .../symbols/java.management.rmi-D.sym.txt | 0 .../symbols/java.management.rmi-F.sym.txt | 0 .../symbols/java.management.rmi-G.sym.txt | 0 .../symbols/java.management.rmi-H.sym.txt | 0 .../symbols/java.management.rmi-I.sym.txt | 0 .../share}/data/symbols/java.naming-7.sym.txt | 0 .../share}/data/symbols/java.naming-8.sym.txt | 0 .../share}/data/symbols/java.naming-9.sym.txt | 0 .../share}/data/symbols/java.naming-A.sym.txt | 0 .../share}/data/symbols/java.naming-B.sym.txt | 0 .../share}/data/symbols/java.naming-C.sym.txt | 0 .../share}/data/symbols/java.naming-F.sym.txt | 0 .../share}/data/symbols/java.naming-G.sym.txt | 0 .../share}/data/symbols/java.naming-H.sym.txt | 0 .../share}/data/symbols/java.naming-I.sym.txt | 0 .../data/symbols/java.net.http-B.sym.txt | 0 .../data/symbols/java.net.http-D.sym.txt | 0 .../data/symbols/java.net.http-G.sym.txt | 0 .../data/symbols/java.net.http-I.sym.txt | 0 .../share}/data/symbols/java.prefs-7.sym.txt | 0 .../share}/data/symbols/java.prefs-8.sym.txt | 0 .../share}/data/symbols/java.prefs-9.sym.txt | 0 .../share}/data/symbols/java.prefs-A.sym.txt | 0 .../share}/data/symbols/java.prefs-B.sym.txt | 0 .../share}/data/symbols/java.rmi-7.sym.txt | 0 .../share}/data/symbols/java.rmi-8.sym.txt | 0 .../share}/data/symbols/java.rmi-9.sym.txt | 0 .../share}/data/symbols/java.rmi-A.sym.txt | 0 .../share}/data/symbols/java.rmi-B.sym.txt | 0 .../share}/data/symbols/java.rmi-C.sym.txt | 0 .../share}/data/symbols/java.rmi-F.sym.txt | 0 .../share}/data/symbols/java.rmi-G.sym.txt | 0 .../share}/data/symbols/java.rmi-H.sym.txt | 0 .../share}/data/symbols/java.rmi-I.sym.txt | 0 .../data/symbols/java.scripting-7.sym.txt | 0 .../data/symbols/java.scripting-8.sym.txt | 0 .../data/symbols/java.scripting-9.sym.txt | 0 .../data/symbols/java.scripting-A.sym.txt | 0 .../data/symbols/java.scripting-B.sym.txt | 0 .../data/symbols/java.scripting-G.sym.txt | 0 .../data/symbols/java.scripting-H.sym.txt | 0 .../data/symbols/java.scripting-I.sym.txt | 0 .../share}/data/symbols/java.se-9.sym.txt | 0 .../share}/data/symbols/java.se-A.sym.txt | 0 .../share}/data/symbols/java.se-B.sym.txt | 0 .../share}/data/symbols/java.se.ee-9.sym.txt | 0 .../share}/data/symbols/java.se.ee-A.sym.txt | 0 .../share}/data/symbols/java.se.ee-B.sym.txt | 0 .../data/symbols/java.security.jgss-7.sym.txt | 0 .../data/symbols/java.security.jgss-8.sym.txt | 0 .../data/symbols/java.security.jgss-9.sym.txt | 0 .../data/symbols/java.security.jgss-A.sym.txt | 0 .../data/symbols/java.security.jgss-B.sym.txt | 0 .../data/symbols/java.security.jgss-D.sym.txt | 0 .../data/symbols/java.security.jgss-G.sym.txt | 0 .../data/symbols/java.security.jgss-H.sym.txt | 0 .../data/symbols/java.security.jgss-I.sym.txt | 0 .../data/symbols/java.security.sasl-7.sym.txt | 0 .../data/symbols/java.security.sasl-8.sym.txt | 0 .../data/symbols/java.security.sasl-9.sym.txt | 0 .../data/symbols/java.security.sasl-A.sym.txt | 0 .../data/symbols/java.security.sasl-B.sym.txt | 0 .../data/symbols/java.security.sasl-G.sym.txt | 0 .../data/symbols/java.security.sasl-H.sym.txt | 0 .../data/symbols/java.security.sasl-I.sym.txt | 0 .../data/symbols/java.smartcardio-9.sym.txt | 0 .../data/symbols/java.smartcardio-A.sym.txt | 0 .../data/symbols/java.smartcardio-B.sym.txt | 0 .../data/symbols/java.smartcardio-G.sym.txt | 0 .../data/symbols/java.smartcardio-H.sym.txt | 0 .../data/symbols/java.smartcardio-I.sym.txt | 0 .../share}/data/symbols/java.sql-7.sym.txt | 0 .../share}/data/symbols/java.sql-8.sym.txt | 0 .../share}/data/symbols/java.sql-9.sym.txt | 0 .../share}/data/symbols/java.sql-A.sym.txt | 0 .../share}/data/symbols/java.sql-B.sym.txt | 0 .../share}/data/symbols/java.sql-G.sym.txt | 0 .../share}/data/symbols/java.sql-H.sym.txt | 0 .../share}/data/symbols/java.sql-I.sym.txt | 0 .../data/symbols/java.sql.rowset-7.sym.txt | 0 .../data/symbols/java.sql.rowset-8.sym.txt | 0 .../data/symbols/java.sql.rowset-9.sym.txt | 0 .../data/symbols/java.sql.rowset-A.sym.txt | 0 .../data/symbols/java.sql.rowset-B.sym.txt | 0 .../data/symbols/java.sql.rowset-G.sym.txt | 0 .../data/symbols/java.sql.rowset-H.sym.txt | 0 .../data/symbols/java.sql.rowset-I.sym.txt | 0 .../data/symbols/java.transaction-8.sym.txt | 0 .../data/symbols/java.transaction-9.sym.txt | 0 .../data/symbols/java.transaction-A.sym.txt | 0 .../data/symbols/java.transaction-B.sym.txt | 0 .../symbols/java.transaction.xa-B.sym.txt | 0 .../share}/data/symbols/java.xml-7.sym.txt | 0 .../share}/data/symbols/java.xml-8.sym.txt | 0 .../share}/data/symbols/java.xml-9.sym.txt | 0 .../share}/data/symbols/java.xml-A.sym.txt | 0 .../share}/data/symbols/java.xml-B.sym.txt | 0 .../share}/data/symbols/java.xml-C.sym.txt | 0 .../share}/data/symbols/java.xml-D.sym.txt | 0 .../share}/data/symbols/java.xml-E.sym.txt | 0 .../share}/data/symbols/java.xml-F.sym.txt | 0 .../share}/data/symbols/java.xml-G.sym.txt | 0 .../share}/data/symbols/java.xml-H.sym.txt | 0 .../share}/data/symbols/java.xml-I.sym.txt | 0 .../data/symbols/java.xml.bind-7.sym.txt | 0 .../data/symbols/java.xml.bind-8.sym.txt | 0 .../data/symbols/java.xml.bind-9.sym.txt | 0 .../data/symbols/java.xml.bind-A.sym.txt | 0 .../data/symbols/java.xml.bind-B.sym.txt | 0 .../data/symbols/java.xml.crypto-8.sym.txt | 0 .../data/symbols/java.xml.crypto-9.sym.txt | 0 .../data/symbols/java.xml.crypto-A.sym.txt | 0 .../data/symbols/java.xml.crypto-B.sym.txt | 0 .../data/symbols/java.xml.crypto-D.sym.txt | 0 .../data/symbols/java.xml.crypto-G.sym.txt | 0 .../data/symbols/java.xml.crypto-H.sym.txt | 0 .../data/symbols/java.xml.crypto-I.sym.txt | 0 .../share}/data/symbols/java.xml.ws-8.sym.txt | 0 .../share}/data/symbols/java.xml.ws-9.sym.txt | 0 .../share}/data/symbols/java.xml.ws-A.sym.txt | 0 .../share}/data/symbols/java.xml.ws-B.sym.txt | 0 .../symbols/java.xml.ws.annotation-7.sym.txt | 0 .../symbols/java.xml.ws.annotation-8.sym.txt | 0 .../symbols/java.xml.ws.annotation-9.sym.txt | 0 .../symbols/java.xml.ws.annotation-A.sym.txt | 0 .../symbols/java.xml.ws.annotation-B.sym.txt | 0 .../data/symbols/jdk.accessibility-9.sym.txt | 0 .../data/symbols/jdk.accessibility-A.sym.txt | 0 .../data/symbols/jdk.accessibility-B.sym.txt | 0 .../data/symbols/jdk.accessibility-G.sym.txt | 0 .../data/symbols/jdk.accessibility-H.sym.txt | 0 .../data/symbols/jdk.accessibility-I.sym.txt | 0 .../share}/data/symbols/jdk.attach-9.sym.txt | 0 .../share}/data/symbols/jdk.attach-A.sym.txt | 0 .../share}/data/symbols/jdk.attach-B.sym.txt | 0 .../share}/data/symbols/jdk.attach-G.sym.txt | 0 .../share}/data/symbols/jdk.attach-H.sym.txt | 0 .../share}/data/symbols/jdk.attach-I.sym.txt | 0 .../data/symbols/jdk.charsets-9.sym.txt | 0 .../data/symbols/jdk.charsets-A.sym.txt | 0 .../data/symbols/jdk.charsets-B.sym.txt | 0 .../data/symbols/jdk.compiler-9.sym.txt | 0 .../data/symbols/jdk.compiler-A.sym.txt | 0 .../data/symbols/jdk.compiler-B.sym.txt | 0 .../data/symbols/jdk.compiler-C.sym.txt | 0 .../data/symbols/jdk.compiler-D.sym.txt | 0 .../data/symbols/jdk.compiler-E.sym.txt | 0 .../data/symbols/jdk.compiler-F.sym.txt | 0 .../data/symbols/jdk.compiler-G.sym.txt | 0 .../data/symbols/jdk.compiler-H.sym.txt | 0 .../data/symbols/jdk.compiler-I.sym.txt | 0 .../symbols/jdk.crypto.cryptoki-9.sym.txt | 0 .../symbols/jdk.crypto.cryptoki-A.sym.txt | 0 .../symbols/jdk.crypto.cryptoki-B.sym.txt | 0 .../data/symbols/jdk.crypto.ec-9.sym.txt | 0 .../data/symbols/jdk.crypto.ec-A.sym.txt | 0 .../data/symbols/jdk.crypto.ec-B.sym.txt | 0 .../data/symbols/jdk.dynalink-9.sym.txt | 0 .../data/symbols/jdk.dynalink-A.sym.txt | 0 .../data/symbols/jdk.dynalink-B.sym.txt | 0 .../data/symbols/jdk.dynalink-G.sym.txt | 0 .../data/symbols/jdk.dynalink-H.sym.txt | 0 .../data/symbols/jdk.dynalink-I.sym.txt | 0 .../share}/data/symbols/jdk.editpad-9.sym.txt | 0 .../share}/data/symbols/jdk.editpad-A.sym.txt | 0 .../share}/data/symbols/jdk.editpad-B.sym.txt | 0 .../data/symbols/jdk.hotspot.agent-9.sym.txt | 0 .../data/symbols/jdk.hotspot.agent-A.sym.txt | 0 .../data/symbols/jdk.hotspot.agent-B.sym.txt | 0 .../data/symbols/jdk.httpserver-7.sym.txt | 0 .../data/symbols/jdk.httpserver-8.sym.txt | 0 .../data/symbols/jdk.httpserver-9.sym.txt | 0 .../data/symbols/jdk.httpserver-A.sym.txt | 0 .../data/symbols/jdk.httpserver-B.sym.txt | 0 .../data/symbols/jdk.httpserver-D.sym.txt | 0 .../data/symbols/jdk.httpserver-E.sym.txt | 0 .../data/symbols/jdk.httpserver-G.sym.txt | 0 .../data/symbols/jdk.httpserver-H.sym.txt | 0 .../data/symbols/jdk.httpserver-I.sym.txt | 0 .../symbols/jdk.incubator.foreign-E.sym.txt | 0 .../symbols/jdk.incubator.foreign-F.sym.txt | 0 .../symbols/jdk.incubator.foreign-G.sym.txt | 0 .../symbols/jdk.incubator.foreign-H.sym.txt | 0 .../symbols/jdk.incubator.foreign-I.sym.txt | 0 .../jdk.incubator.httpclient-9.sym.txt | 0 .../jdk.incubator.httpclient-A.sym.txt | 0 .../jdk.incubator.httpclient-B.sym.txt | 0 .../symbols/jdk.incubator.jpackage-E.sym.txt | 0 .../symbols/jdk.incubator.jpackage-G.sym.txt | 0 .../symbols/jdk.incubator.vector-G.sym.txt | 0 .../symbols/jdk.incubator.vector-H.sym.txt | 0 .../symbols/jdk.incubator.vector-I.sym.txt | 0 .../share}/data/symbols/jdk.jartool-9.sym.txt | 0 .../share}/data/symbols/jdk.jartool-A.sym.txt | 0 .../share}/data/symbols/jdk.jartool-B.sym.txt | 0 .../share}/data/symbols/jdk.jartool-D.sym.txt | 0 .../share}/data/symbols/jdk.jartool-F.sym.txt | 0 .../share}/data/symbols/jdk.jartool-G.sym.txt | 0 .../share}/data/symbols/jdk.jartool-H.sym.txt | 0 .../share}/data/symbols/jdk.jartool-I.sym.txt | 0 .../share}/data/symbols/jdk.javadoc-9.sym.txt | 0 .../share}/data/symbols/jdk.javadoc-A.sym.txt | 0 .../share}/data/symbols/jdk.javadoc-B.sym.txt | 0 .../share}/data/symbols/jdk.javadoc-D.sym.txt | 0 .../share}/data/symbols/jdk.javadoc-F.sym.txt | 0 .../share}/data/symbols/jdk.javadoc-G.sym.txt | 0 .../share}/data/symbols/jdk.javadoc-H.sym.txt | 0 .../share}/data/symbols/jdk.javadoc-I.sym.txt | 0 .../share}/data/symbols/jdk.jcmd-9.sym.txt | 0 .../share}/data/symbols/jdk.jcmd-A.sym.txt | 0 .../share}/data/symbols/jdk.jcmd-B.sym.txt | 0 .../data/symbols/jdk.jconsole-9.sym.txt | 0 .../data/symbols/jdk.jconsole-A.sym.txt | 0 .../data/symbols/jdk.jconsole-B.sym.txt | 0 .../data/symbols/jdk.jconsole-G.sym.txt | 0 .../data/symbols/jdk.jconsole-H.sym.txt | 0 .../data/symbols/jdk.jconsole-I.sym.txt | 0 .../share}/data/symbols/jdk.jdeps-9.sym.txt | 0 .../share}/data/symbols/jdk.jdeps-A.sym.txt | 0 .../share}/data/symbols/jdk.jdeps-B.sym.txt | 0 .../share}/data/symbols/jdk.jdi-9.sym.txt | 0 .../share}/data/symbols/jdk.jdi-A.sym.txt | 0 .../share}/data/symbols/jdk.jdi-B.sym.txt | 0 .../share}/data/symbols/jdk.jdi-F.sym.txt | 0 .../share}/data/symbols/jdk.jdi-G.sym.txt | 0 .../share}/data/symbols/jdk.jdi-H.sym.txt | 0 .../share}/data/symbols/jdk.jdi-I.sym.txt | 0 .../data/symbols/jdk.jdwp.agent-9.sym.txt | 0 .../data/symbols/jdk.jdwp.agent-A.sym.txt | 0 .../data/symbols/jdk.jdwp.agent-B.sym.txt | 0 .../share}/data/symbols/jdk.jfr-B.sym.txt | 0 .../share}/data/symbols/jdk.jfr-C.sym.txt | 0 .../share}/data/symbols/jdk.jfr-E.sym.txt | 0 .../share}/data/symbols/jdk.jfr-G.sym.txt | 0 .../share}/data/symbols/jdk.jfr-H.sym.txt | 0 .../share}/data/symbols/jdk.jlink-9.sym.txt | 0 .../share}/data/symbols/jdk.jlink-A.sym.txt | 0 .../share}/data/symbols/jdk.jlink-B.sym.txt | 0 .../share}/data/symbols/jdk.jlink-D.sym.txt | 0 .../share}/data/symbols/jdk.jlink-E.sym.txt | 0 .../share}/data/symbols/jdk.jlink-I.sym.txt | 0 .../data/symbols/jdk.jpackage-G.sym.txt | 0 .../share}/data/symbols/jdk.jshell-9.sym.txt | 0 .../share}/data/symbols/jdk.jshell-A.sym.txt | 0 .../share}/data/symbols/jdk.jshell-B.sym.txt | 0 .../share}/data/symbols/jdk.jshell-D.sym.txt | 0 .../share}/data/symbols/jdk.jshell-E.sym.txt | 0 .../share}/data/symbols/jdk.jshell-G.sym.txt | 0 .../share}/data/symbols/jdk.jshell-H.sym.txt | 0 .../share}/data/symbols/jdk.jshell-I.sym.txt | 0 .../data/symbols/jdk.jsobject-9.sym.txt | 0 .../data/symbols/jdk.jsobject-A.sym.txt | 0 .../data/symbols/jdk.jsobject-B.sym.txt | 0 .../data/symbols/jdk.jsobject-C.sym.txt | 0 .../data/symbols/jdk.jsobject-E.sym.txt | 0 .../data/symbols/jdk.jsobject-G.sym.txt | 0 .../data/symbols/jdk.jsobject-H.sym.txt | 0 .../data/symbols/jdk.jsobject-I.sym.txt | 0 .../share}/data/symbols/jdk.jstatd-9.sym.txt | 0 .../share}/data/symbols/jdk.jstatd-A.sym.txt | 0 .../share}/data/symbols/jdk.jstatd-B.sym.txt | 0 .../data/symbols/jdk.localedata-9.sym.txt | 0 .../data/symbols/jdk.localedata-A.sym.txt | 0 .../data/symbols/jdk.localedata-B.sym.txt | 0 .../data/symbols/jdk.management-7.sym.txt | 0 .../data/symbols/jdk.management-8.sym.txt | 0 .../data/symbols/jdk.management-9.sym.txt | 0 .../data/symbols/jdk.management-A.sym.txt | 0 .../data/symbols/jdk.management-B.sym.txt | 0 .../data/symbols/jdk.management-E.sym.txt | 0 .../data/symbols/jdk.management-G.sym.txt | 0 .../data/symbols/jdk.management-H.sym.txt | 0 .../data/symbols/jdk.management-I.sym.txt | 0 .../symbols/jdk.management.agent-9.sym.txt | 0 .../symbols/jdk.management.agent-A.sym.txt | 0 .../symbols/jdk.management.agent-B.sym.txt | 0 .../data/symbols/jdk.management.jfr-B.sym.txt | 0 .../data/symbols/jdk.management.jfr-G.sym.txt | 0 .../data/symbols/jdk.management.jfr-H.sym.txt | 0 .../data/symbols/jdk.management.jfr-I.sym.txt | 0 .../data/symbols/jdk.naming.dns-9.sym.txt | 0 .../data/symbols/jdk.naming.dns-A.sym.txt | 0 .../data/symbols/jdk.naming.dns-B.sym.txt | 0 .../data/symbols/jdk.naming.rmi-9.sym.txt | 0 .../data/symbols/jdk.naming.rmi-A.sym.txt | 0 .../data/symbols/jdk.naming.rmi-B.sym.txt | 0 .../share}/data/symbols/jdk.net-9.sym.txt | 0 .../share}/data/symbols/jdk.net-A.sym.txt | 0 .../share}/data/symbols/jdk.net-B.sym.txt | 0 .../share}/data/symbols/jdk.net-E.sym.txt | 0 .../share}/data/symbols/jdk.net-F.sym.txt | 0 .../share}/data/symbols/jdk.net-G.sym.txt | 0 .../share}/data/symbols/jdk.net-H.sym.txt | 0 .../share}/data/symbols/jdk.net-I.sym.txt | 0 .../data/symbols/jdk.nio.mapmode-F.sym.txt | 0 .../share}/data/symbols/jdk.pack-9.sym.txt | 0 .../share}/data/symbols/jdk.pack-A.sym.txt | 0 .../share}/data/symbols/jdk.pack-B.sym.txt | 0 .../share}/data/symbols/jdk.pack-E.sym.txt | 0 .../data/symbols/jdk.policytool-9.sym.txt | 0 .../data/symbols/jdk.policytool-A.sym.txt | 0 .../share}/data/symbols/jdk.rmic-9.sym.txt | 0 .../share}/data/symbols/jdk.rmic-A.sym.txt | 0 .../share}/data/symbols/jdk.rmic-B.sym.txt | 0 .../share}/data/symbols/jdk.rmic-F.sym.txt | 0 .../symbols/jdk.scripting.nashorn-7.sym.txt | 0 .../symbols/jdk.scripting.nashorn-8.sym.txt | 0 .../symbols/jdk.scripting.nashorn-9.sym.txt | 0 .../symbols/jdk.scripting.nashorn-A.sym.txt | 0 .../symbols/jdk.scripting.nashorn-B.sym.txt | 0 .../symbols/jdk.scripting.nashorn-F.sym.txt | 0 .../share}/data/symbols/jdk.sctp-7.sym.txt | 0 .../share}/data/symbols/jdk.sctp-8.sym.txt | 0 .../share}/data/symbols/jdk.sctp-9.sym.txt | 0 .../share}/data/symbols/jdk.sctp-A.sym.txt | 0 .../share}/data/symbols/jdk.sctp-B.sym.txt | 0 .../share}/data/symbols/jdk.sctp-G.sym.txt | 0 .../share}/data/symbols/jdk.sctp-H.sym.txt | 0 .../share}/data/symbols/jdk.sctp-I.sym.txt | 0 .../data/symbols/jdk.security.auth-7.sym.txt | 0 .../data/symbols/jdk.security.auth-8.sym.txt | 0 .../data/symbols/jdk.security.auth-9.sym.txt | 0 .../data/symbols/jdk.security.auth-A.sym.txt | 0 .../data/symbols/jdk.security.auth-B.sym.txt | 0 .../data/symbols/jdk.security.auth-G.sym.txt | 0 .../data/symbols/jdk.security.auth-H.sym.txt | 0 .../data/symbols/jdk.security.auth-I.sym.txt | 0 .../data/symbols/jdk.security.jgss-7.sym.txt | 0 .../data/symbols/jdk.security.jgss-8.sym.txt | 0 .../data/symbols/jdk.security.jgss-9.sym.txt | 0 .../data/symbols/jdk.security.jgss-A.sym.txt | 0 .../data/symbols/jdk.security.jgss-B.sym.txt | 0 .../data/symbols/jdk.security.jgss-G.sym.txt | 0 .../data/symbols/jdk.security.jgss-H.sym.txt | 0 .../data/symbols/jdk.security.jgss-I.sym.txt | 0 .../data/symbols/jdk.unsupported-9.sym.txt | 0 .../data/symbols/jdk.unsupported-A.sym.txt | 0 .../data/symbols/jdk.unsupported-B.sym.txt | 0 .../data/symbols/jdk.unsupported-C.sym.txt | 0 .../data/symbols/jdk.unsupported-F.sym.txt | 0 .../data/symbols/jdk.unsupported-G.sym.txt | 0 .../data/symbols/jdk.unsupported-H.sym.txt | 0 .../data/symbols/jdk.unsupported-I.sym.txt | 0 .../share}/data/symbols/jdk.xml.dom-9.sym.txt | 0 .../share}/data/symbols/jdk.xml.dom-A.sym.txt | 0 .../share}/data/symbols/jdk.xml.dom-B.sym.txt | 0 .../share}/data/symbols/jdk.xml.dom-G.sym.txt | 0 .../share}/data/symbols/jdk.xml.dom-H.sym.txt | 0 .../share}/data/symbols/jdk.xml.dom-I.sym.txt | 0 .../share}/data/symbols/jdk.zipfs-9.sym.txt | 0 .../share}/data/symbols/jdk.zipfs-A.sym.txt | 0 .../share}/data/symbols/jdk.zipfs-B.sym.txt | 0 .../jdk.compiler/share}/data/symbols/symbols | 0 test/jdk/java/security/misc/Versions.java | 4 +- test/jdk/java/util/Currency/CurrencyTest.java | 4 +- test/jdk/java/util/Locale/LSRDataTest.java | 10 ++--- .../lib/testlibrary/java/lang/UCDFiles.java | 9 ++-- test/jdk/sun/nio/cs/TestCharsetMapping.java | 4 +- test/jdk/sun/nio/cs/TestMS950.java | 2 +- .../sun/security/lib/CheckBlockedCerts.java | 4 +- .../sun/util/calendar/zi/TestZoneInfo310.java | 4 +- .../platform/CanHandleClassFilesTest.java | 2 +- .../tools/javac/sym/ElementStructureTest.java | 8 ++-- 619 files changed, 134 insertions(+), 126 deletions(-) rename {make/data/characterdata => src/java.base/share/classes/java/lang}/CharacterData00.java.template (100%) rename {make/data/characterdata => src/java.base/share/classes/java/lang}/CharacterData01.java.template (100%) rename {make/data/characterdata => src/java.base/share/classes/java/lang}/CharacterData02.java.template (100%) rename {make/data/characterdata => src/java.base/share/classes/java/lang}/CharacterData03.java.template (100%) rename {make/data/characterdata => src/java.base/share/classes/java/lang}/CharacterData0E.java.template (100%) rename {make/data/characterdata => src/java.base/share/classes/java/lang}/CharacterDataLatin1.java.template (100%) rename {make => src/java.base/share}/data/blockedcertsconverter/blocked.certs.pem (100%) rename {make => src/java.base/share}/data/cacerts/README (100%) rename {make => src/java.base/share}/data/cacerts/actalisauthenticationrootca (100%) rename {make => src/java.base/share}/data/cacerts/addtrustexternalca (100%) rename {make => src/java.base/share}/data/cacerts/addtrustqualifiedca (100%) rename {make => src/java.base/share}/data/cacerts/affirmtrustcommercialca (100%) rename {make => src/java.base/share}/data/cacerts/affirmtrustnetworkingca (100%) rename {make => src/java.base/share}/data/cacerts/affirmtrustpremiumca (100%) rename {make => src/java.base/share}/data/cacerts/affirmtrustpremiumeccca (100%) rename {make => src/java.base/share}/data/cacerts/amazonrootca1 (100%) rename {make => src/java.base/share}/data/cacerts/amazonrootca2 (100%) rename {make => src/java.base/share}/data/cacerts/amazonrootca3 (100%) rename {make => src/java.base/share}/data/cacerts/amazonrootca4 (100%) rename {make => src/java.base/share}/data/cacerts/baltimorecybertrustca (100%) rename {make => src/java.base/share}/data/cacerts/buypassclass2ca (100%) rename {make => src/java.base/share}/data/cacerts/buypassclass3ca (100%) rename {make => src/java.base/share}/data/cacerts/camerfirmachambersca (100%) rename {make => src/java.base/share}/data/cacerts/camerfirmachamberscommerceca (100%) rename {make => src/java.base/share}/data/cacerts/camerfirmachambersignca (100%) rename {make => src/java.base/share}/data/cacerts/certumca (100%) rename {make => src/java.base/share}/data/cacerts/certumtrustednetworkca (100%) rename {make => src/java.base/share}/data/cacerts/chunghwaepkirootca (100%) rename {make => src/java.base/share}/data/cacerts/comodoaaaca (100%) rename {make => src/java.base/share}/data/cacerts/comodoeccca (100%) rename {make => src/java.base/share}/data/cacerts/comodorsaca (100%) rename {make => src/java.base/share}/data/cacerts/digicertassuredidg2 (100%) rename {make => src/java.base/share}/data/cacerts/digicertassuredidg3 (100%) rename {make => src/java.base/share}/data/cacerts/digicertassuredidrootca (100%) rename {make => src/java.base/share}/data/cacerts/digicertglobalrootca (100%) rename {make => src/java.base/share}/data/cacerts/digicertglobalrootg2 (100%) rename {make => src/java.base/share}/data/cacerts/digicertglobalrootg3 (100%) rename {make => src/java.base/share}/data/cacerts/digicerthighassuranceevrootca (100%) rename {make => src/java.base/share}/data/cacerts/digicerttrustedrootg4 (100%) rename {make => src/java.base/share}/data/cacerts/dtrustclass3ca2 (100%) rename {make => src/java.base/share}/data/cacerts/dtrustclass3ca2ev (100%) rename {make => src/java.base/share}/data/cacerts/entrust2048ca (100%) rename {make => src/java.base/share}/data/cacerts/entrustevca (100%) rename {make => src/java.base/share}/data/cacerts/entrustrootcaec1 (100%) rename {make => src/java.base/share}/data/cacerts/entrustrootcag2 (100%) rename {make => src/java.base/share}/data/cacerts/entrustrootcag4 (100%) rename {make => src/java.base/share}/data/cacerts/geotrustglobalca (100%) rename {make => src/java.base/share}/data/cacerts/geotrustprimaryca (100%) rename {make => src/java.base/share}/data/cacerts/geotrustprimarycag2 (100%) rename {make => src/java.base/share}/data/cacerts/geotrustprimarycag3 (100%) rename {make => src/java.base/share}/data/cacerts/geotrustuniversalca (100%) rename {make => src/java.base/share}/data/cacerts/globalsignca (100%) rename {make => src/java.base/share}/data/cacerts/globalsigneccrootcar4 (100%) rename {make => src/java.base/share}/data/cacerts/globalsigneccrootcar5 (100%) rename {make => src/java.base/share}/data/cacerts/globalsignr3ca (100%) rename {make => src/java.base/share}/data/cacerts/globalsignrootcar6 (100%) rename {make => src/java.base/share}/data/cacerts/godaddyclass2ca (100%) rename {make => src/java.base/share}/data/cacerts/godaddyrootg2ca (100%) rename {make => src/java.base/share}/data/cacerts/haricaeccrootca2015 (100%) rename {make => src/java.base/share}/data/cacerts/haricarootca2015 (100%) rename {make => src/java.base/share}/data/cacerts/identrustcommercial (100%) rename {make => src/java.base/share}/data/cacerts/identrustpublicca (100%) rename {make => src/java.base/share}/data/cacerts/letsencryptisrgx1 (100%) rename {make => src/java.base/share}/data/cacerts/luxtrustglobalroot2ca (100%) rename {make => src/java.base/share}/data/cacerts/luxtrustglobalrootca (100%) rename {make => src/java.base/share}/data/cacerts/quovadisrootca (100%) rename {make => src/java.base/share}/data/cacerts/quovadisrootca1g3 (100%) rename {make => src/java.base/share}/data/cacerts/quovadisrootca2 (100%) rename {make => src/java.base/share}/data/cacerts/quovadisrootca2g3 (100%) rename {make => src/java.base/share}/data/cacerts/quovadisrootca3 (100%) rename {make => src/java.base/share}/data/cacerts/quovadisrootca3g3 (100%) rename {make => src/java.base/share}/data/cacerts/secomscrootca1 (100%) rename {make => src/java.base/share}/data/cacerts/secomscrootca2 (100%) rename {make => src/java.base/share}/data/cacerts/securetrustca (100%) rename {make => src/java.base/share}/data/cacerts/sslrooteccca (100%) rename {make => src/java.base/share}/data/cacerts/sslrootevrsaca (100%) rename {make => src/java.base/share}/data/cacerts/sslrootrsaca (100%) rename {make => src/java.base/share}/data/cacerts/starfieldclass2ca (100%) rename {make => src/java.base/share}/data/cacerts/starfieldrootg2ca (100%) rename {make => src/java.base/share}/data/cacerts/starfieldservicesrootg2ca (100%) rename {make => src/java.base/share}/data/cacerts/swisssigngoldg2ca (100%) rename {make => src/java.base/share}/data/cacerts/swisssignplatinumg2ca (100%) rename {make => src/java.base/share}/data/cacerts/swisssignsilverg2ca (100%) rename {make => src/java.base/share}/data/cacerts/teliasonerarootcav1 (100%) rename {make => src/java.base/share}/data/cacerts/thawteprimaryrootca (100%) rename {make => src/java.base/share}/data/cacerts/thawteprimaryrootcag2 (100%) rename {make => src/java.base/share}/data/cacerts/thawteprimaryrootcag3 (100%) rename {make => src/java.base/share}/data/cacerts/ttelesecglobalrootclass2ca (100%) rename {make => src/java.base/share}/data/cacerts/ttelesecglobalrootclass3ca (100%) rename {make => src/java.base/share}/data/cacerts/usertrusteccca (100%) rename {make => src/java.base/share}/data/cacerts/usertrustrsaca (100%) rename {make => src/java.base/share}/data/cacerts/utnuserfirstobjectca (100%) rename {make => src/java.base/share}/data/cacerts/verisignclass3g3ca (100%) rename {make => src/java.base/share}/data/cacerts/verisignclass3g4ca (100%) rename {make => src/java.base/share}/data/cacerts/verisignclass3g5ca (100%) rename {make => src/java.base/share}/data/cacerts/verisignuniversalrootca (100%) rename {make => src/java.base/share}/data/cacerts/xrampglobalca (100%) rename {make => src/java.base/share}/data/currency/CurrencyData.properties (100%) rename {make => src/java.base/share}/data/lsrdata/language-subtag-registry.txt (100%) rename {make => src/java.base/share}/data/publicsuffixlist/VERSION (100%) rename {make => src/java.base/share}/data/publicsuffixlist/public_suffix_list.dat (100%) rename {make => src/java.base/share}/data/tzdata/VERSION (100%) rename {make => src/java.base/share}/data/tzdata/africa (100%) rename {make => src/java.base/share}/data/tzdata/antarctica (100%) rename {make => src/java.base/share}/data/tzdata/asia (100%) rename {make => src/java.base/share}/data/tzdata/australasia (100%) rename {make => src/java.base/share}/data/tzdata/backward (100%) rename {make => src/java.base/share}/data/tzdata/etcetera (100%) rename {make => src/java.base/share}/data/tzdata/europe (100%) rename {make => src/java.base/share}/data/tzdata/factory (100%) rename {make => src/java.base/share}/data/tzdata/gmt (100%) rename {make => src/java.base/share}/data/tzdata/iso3166.tab (100%) rename {make => src/java.base/share}/data/tzdata/jdk11_backward (100%) rename {make => src/java.base/share}/data/tzdata/leapseconds (100%) rename {make => src/java.base/share}/data/tzdata/northamerica (100%) rename {make => src/java.base/share}/data/tzdata/solar87 (100%) rename {make => src/java.base/share}/data/tzdata/solar88 (100%) rename {make => src/java.base/share}/data/tzdata/solar89 (100%) rename {make => src/java.base/share}/data/tzdata/southamerica (100%) rename {make => src/java.base/share}/data/tzdata/zone.tab (100%) rename {make => src/java.base/share}/data/unicodedata/Blocks.txt (100%) rename {make => src/java.base/share}/data/unicodedata/DerivedCoreProperties.txt (100%) rename {make => src/java.base/share}/data/unicodedata/NormalizationTest.txt (100%) rename {make => src/java.base/share}/data/unicodedata/PropList.txt (100%) rename {make => src/java.base/share}/data/unicodedata/PropertyValueAliases.txt (100%) rename {make => src/java.base/share}/data/unicodedata/ReadMe.txt (100%) rename {make => src/java.base/share}/data/unicodedata/Scripts.txt (100%) rename {make => src/java.base/share}/data/unicodedata/SpecialCasing.txt (100%) rename {make => src/java.base/share}/data/unicodedata/UnicodeData.txt (100%) rename {make => src/java.base/share}/data/unicodedata/auxiliary/GraphemeBreakProperty.txt (100%) rename {make => src/java.base/share}/data/unicodedata/auxiliary/GraphemeBreakTest.txt (100%) rename {make => src/java.base/share}/data/unicodedata/emoji/emoji-data.txt (100%) rename make/data/fontconfig/aix.fontconfig.properties => src/java.desktop/aix/data/fontconfig/fontconfig.properties (100%) rename make/data/fontconfig/bsd.fontconfig.properties => src/java.desktop/bsd/data/fontconfig/fontconfig.properties (100%) rename make/data/fontconfig/macosx.fontconfig.properties => src/java.desktop/macosx/data/fontconfig/fontconfig.properties (100%) rename {make => src/java.desktop/macosx}/data/macosxicons/JavaApp.icns (100%) rename {make => src/java.desktop/share}/data/dtdbuilder/HTMLlat1.sgml (100%) rename {make => src/java.desktop/share}/data/dtdbuilder/HTMLspecial.sgml (100%) rename {make => src/java.desktop/share}/data/dtdbuilder/HTMLsymbol.sgml (100%) rename {make => src/java.desktop/share}/data/dtdbuilder/html32.dtd (100%) rename {make => src/java.desktop/share}/data/dtdbuilder/public.map (100%) rename {make => src/java.desktop/unix}/data/x11wrappergen/sizes-32.txt (100%) rename {make => src/java.desktop/unix}/data/x11wrappergen/sizes-64.txt (100%) rename {make => src/java.desktop/unix}/data/x11wrappergen/xlibtypes.txt (100%) rename make/data/fontconfig/windows.fontconfig.properties => src/java.desktop/windows/data/fontconfig/fontconfig.properties (100%) rename {make => src/java.se/share}/data/jdwp/jdwp.spec (100%) rename {make => src/jdk.compiler/share}/data/symbols/README (100%) rename {make => src/jdk.compiler/share}/data/symbols/include.list (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.activation-8.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.activation-9.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.activation-A.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.activation-B.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.base-7.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.base-8.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.base-9.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.base-A.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.base-B.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.base-C.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.base-D.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.base-E.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.base-F.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.base-G.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.base-H.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.base-I.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.compiler-7.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.compiler-8.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.compiler-9.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.compiler-A.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.compiler-B.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.compiler-C.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.compiler-D.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.compiler-E.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.compiler-F.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.compiler-G.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.compiler-H.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.compiler-I.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.corba-8.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.corba-9.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.corba-A.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.corba-B.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.datatransfer-7.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.datatransfer-8.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.datatransfer-9.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.datatransfer-A.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.datatransfer-B.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.datatransfer-G.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.datatransfer-H.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.datatransfer-I.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.desktop-7.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.desktop-8.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.desktop-9.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.desktop-A.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.desktop-B.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.desktop-C.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.desktop-D.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.desktop-E.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.desktop-F.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.desktop-G.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.desktop-H.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.desktop-I.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.instrument-8.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.instrument-9.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.instrument-A.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.instrument-B.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.instrument-G.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.instrument-H.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.instrument-I.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.logging-7.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.logging-8.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.logging-9.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.logging-A.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.logging-B.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.logging-G.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.logging-H.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.logging-I.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.management-7.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.management-8.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.management-9.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.management-A.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.management-B.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.management-D.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.management-G.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.management-H.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.management-I.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.management.rmi-8.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.management.rmi-9.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.management.rmi-A.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.management.rmi-B.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.management.rmi-D.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.management.rmi-F.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.management.rmi-G.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.management.rmi-H.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.management.rmi-I.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.naming-7.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.naming-8.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.naming-9.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.naming-A.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.naming-B.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.naming-C.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.naming-F.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.naming-G.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.naming-H.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.naming-I.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.net.http-B.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.net.http-D.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.net.http-G.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.net.http-I.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.prefs-7.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.prefs-8.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.prefs-9.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.prefs-A.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.prefs-B.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.rmi-7.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.rmi-8.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.rmi-9.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.rmi-A.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.rmi-B.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.rmi-C.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.rmi-F.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.rmi-G.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.rmi-H.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.rmi-I.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.scripting-7.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.scripting-8.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.scripting-9.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.scripting-A.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.scripting-B.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.scripting-G.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.scripting-H.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.scripting-I.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.se-9.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.se-A.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.se-B.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.se.ee-9.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.se.ee-A.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.se.ee-B.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.security.jgss-7.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.security.jgss-8.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.security.jgss-9.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.security.jgss-A.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.security.jgss-B.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.security.jgss-D.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.security.jgss-G.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.security.jgss-H.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.security.jgss-I.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.security.sasl-7.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.security.sasl-8.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.security.sasl-9.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.security.sasl-A.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.security.sasl-B.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.security.sasl-G.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.security.sasl-H.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.security.sasl-I.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.smartcardio-9.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.smartcardio-A.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.smartcardio-B.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.smartcardio-G.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.smartcardio-H.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.smartcardio-I.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.sql-7.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.sql-8.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.sql-9.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.sql-A.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.sql-B.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.sql-G.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.sql-H.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.sql-I.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.sql.rowset-7.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.sql.rowset-8.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.sql.rowset-9.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.sql.rowset-A.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.sql.rowset-B.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.sql.rowset-G.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.sql.rowset-H.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.sql.rowset-I.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.transaction-8.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.transaction-9.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.transaction-A.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.transaction-B.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.transaction.xa-B.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.xml-7.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.xml-8.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.xml-9.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.xml-A.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.xml-B.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.xml-C.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.xml-D.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.xml-E.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.xml-F.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.xml-G.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.xml-H.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.xml-I.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.xml.bind-7.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.xml.bind-8.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.xml.bind-9.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.xml.bind-A.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.xml.bind-B.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.xml.crypto-8.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.xml.crypto-9.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.xml.crypto-A.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.xml.crypto-B.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.xml.crypto-D.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.xml.crypto-G.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.xml.crypto-H.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.xml.crypto-I.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.xml.ws-8.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.xml.ws-9.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.xml.ws-A.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.xml.ws-B.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.xml.ws.annotation-7.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.xml.ws.annotation-8.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.xml.ws.annotation-9.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.xml.ws.annotation-A.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/java.xml.ws.annotation-B.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.accessibility-9.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.accessibility-A.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.accessibility-B.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.accessibility-G.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.accessibility-H.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.accessibility-I.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.attach-9.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.attach-A.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.attach-B.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.attach-G.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.attach-H.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.attach-I.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.charsets-9.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.charsets-A.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.charsets-B.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.compiler-9.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.compiler-A.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.compiler-B.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.compiler-C.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.compiler-D.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.compiler-E.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.compiler-F.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.compiler-G.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.compiler-H.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.compiler-I.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.crypto.cryptoki-9.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.crypto.cryptoki-A.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.crypto.cryptoki-B.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.crypto.ec-9.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.crypto.ec-A.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.crypto.ec-B.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.dynalink-9.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.dynalink-A.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.dynalink-B.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.dynalink-G.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.dynalink-H.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.dynalink-I.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.editpad-9.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.editpad-A.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.editpad-B.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.hotspot.agent-9.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.hotspot.agent-A.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.hotspot.agent-B.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.httpserver-7.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.httpserver-8.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.httpserver-9.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.httpserver-A.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.httpserver-B.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.httpserver-D.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.httpserver-E.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.httpserver-G.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.httpserver-H.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.httpserver-I.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.incubator.foreign-E.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.incubator.foreign-F.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.incubator.foreign-G.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.incubator.foreign-H.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.incubator.foreign-I.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.incubator.httpclient-9.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.incubator.httpclient-A.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.incubator.httpclient-B.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.incubator.jpackage-E.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.incubator.jpackage-G.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.incubator.vector-G.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.incubator.vector-H.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.incubator.vector-I.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.jartool-9.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.jartool-A.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.jartool-B.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.jartool-D.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.jartool-F.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.jartool-G.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.jartool-H.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.jartool-I.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.javadoc-9.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.javadoc-A.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.javadoc-B.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.javadoc-D.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.javadoc-F.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.javadoc-G.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.javadoc-H.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.javadoc-I.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.jcmd-9.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.jcmd-A.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.jcmd-B.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.jconsole-9.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.jconsole-A.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.jconsole-B.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.jconsole-G.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.jconsole-H.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.jconsole-I.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.jdeps-9.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.jdeps-A.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.jdeps-B.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.jdi-9.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.jdi-A.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.jdi-B.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.jdi-F.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.jdi-G.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.jdi-H.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.jdi-I.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.jdwp.agent-9.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.jdwp.agent-A.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.jdwp.agent-B.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.jfr-B.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.jfr-C.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.jfr-E.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.jfr-G.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.jfr-H.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.jlink-9.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.jlink-A.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.jlink-B.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.jlink-D.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.jlink-E.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.jlink-I.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.jpackage-G.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.jshell-9.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.jshell-A.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.jshell-B.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.jshell-D.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.jshell-E.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.jshell-G.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.jshell-H.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.jshell-I.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.jsobject-9.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.jsobject-A.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.jsobject-B.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.jsobject-C.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.jsobject-E.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.jsobject-G.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.jsobject-H.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.jsobject-I.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.jstatd-9.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.jstatd-A.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.jstatd-B.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.localedata-9.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.localedata-A.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.localedata-B.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.management-7.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.management-8.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.management-9.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.management-A.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.management-B.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.management-E.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.management-G.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.management-H.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.management-I.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.management.agent-9.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.management.agent-A.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.management.agent-B.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.management.jfr-B.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.management.jfr-G.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.management.jfr-H.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.management.jfr-I.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.naming.dns-9.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.naming.dns-A.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.naming.dns-B.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.naming.rmi-9.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.naming.rmi-A.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.naming.rmi-B.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.net-9.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.net-A.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.net-B.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.net-E.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.net-F.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.net-G.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.net-H.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.net-I.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.nio.mapmode-F.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.pack-9.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.pack-A.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.pack-B.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.pack-E.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.policytool-9.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.policytool-A.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.rmic-9.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.rmic-A.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.rmic-B.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.rmic-F.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.scripting.nashorn-7.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.scripting.nashorn-8.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.scripting.nashorn-9.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.scripting.nashorn-A.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.scripting.nashorn-B.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.scripting.nashorn-F.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.sctp-7.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.sctp-8.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.sctp-9.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.sctp-A.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.sctp-B.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.sctp-G.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.sctp-H.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.sctp-I.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.security.auth-7.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.security.auth-8.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.security.auth-9.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.security.auth-A.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.security.auth-B.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.security.auth-G.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.security.auth-H.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.security.auth-I.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.security.jgss-7.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.security.jgss-8.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.security.jgss-9.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.security.jgss-A.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.security.jgss-B.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.security.jgss-G.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.security.jgss-H.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.security.jgss-I.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.unsupported-9.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.unsupported-A.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.unsupported-B.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.unsupported-C.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.unsupported-F.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.unsupported-G.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.unsupported-H.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.unsupported-I.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.xml.dom-9.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.xml.dom-A.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.xml.dom-B.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.xml.dom-G.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.xml.dom-H.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.xml.dom-I.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.zipfs-9.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.zipfs-A.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/jdk.zipfs-B.sym.txt (100%) rename {make => src/jdk.compiler/share}/data/symbols/symbols (100%) diff --git a/make/ModuleWrapper.gmk b/make/ModuleWrapper.gmk index e4a8db24aa3..d83af819a9b 100644 --- a/make/ModuleWrapper.gmk +++ b/make/ModuleWrapper.gmk @@ -1,5 +1,5 @@ # -# Copyright (c) 2014, 2020, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2014, 2022, 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 @@ -35,6 +35,8 @@ default: all include $(SPEC) include MakeBase.gmk +MODULE_SRC := $(TOPDIR)/src/$(MODULE) + # All makefiles should add the targets to be built to this variable. TARGETS := diff --git a/make/ToolsJdk.gmk b/make/ToolsJdk.gmk index af9def3a415..9eef6969125 100644 --- a/make/ToolsJdk.gmk +++ b/make/ToolsJdk.gmk @@ -1,5 +1,5 @@ # -# Copyright (c) 2011, 2021, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2011, 2022, 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 @@ -53,7 +53,7 @@ TOOL_GENERATECHARACTER = $(JAVA_SMALL) -cp $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_cla TOOL_CHARACTERNAME = $(JAVA_SMALL) -cp $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes \ build.tools.generatecharacter.CharacterName -TOOL_DTDBUILDER = $(JAVA_SMALL) -Ddtd_home=$(TOPDIR)/make/data/dtdbuilder \ +TOOL_DTDBUILDER = $(JAVA_SMALL) -Ddtd_home=$(TOPDIR)/src/java.desktop/share/data/dtdbuilder \ -Djava.awt.headless=true \ -cp $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes build.tools.dtdbuilder.DTDBuilder diff --git a/make/UpdateX11Wrappers.gmk b/make/UpdateX11Wrappers.gmk index ad67966ec8a..3201b5f883f 100644 --- a/make/UpdateX11Wrappers.gmk +++ b/make/UpdateX11Wrappers.gmk @@ -1,5 +1,5 @@ # -# Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2012, 2022, 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 @@ -50,7 +50,7 @@ endif X11WRAPPERS_OUTPUT := $(SUPPORT_OUTPUTDIR)/x11wrappers GENERATOR_SOURCE_FILE := $(X11WRAPPERS_OUTPUT)/src/data_generator.c -GENSRC_X11WRAPPERS_DATADIR := $(TOPDIR)/make/data/x11wrappergen +GENSRC_X11WRAPPERS_DATADIR := $(TOPDIR)/src/java.desktop/unix/data/x11wrappergen WRAPPER_OUTPUT_FILE := $(GENSRC_X11WRAPPERS_DATADIR)/sizes-$(BITS).txt BITS := $(OPENJDK_TARGET_CPU_BITS) diff --git a/make/langtools/src/classes/build/tools/symbolgenerator/CreateSymbols.java b/make/langtools/src/classes/build/tools/symbolgenerator/CreateSymbols.java index ea700f0b660..41f600a817e 100644 --- a/make/langtools/src/classes/build/tools/symbolgenerator/CreateSymbols.java +++ b/make/langtools/src/classes/build/tools/symbolgenerator/CreateSymbols.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 2022, 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 @@ -156,7 +156,7 @@ import java.util.Optional; * A tool for processing the .sym.txt files. * * To add historical data for JDK N, N >= 11, do the following: - * * cd /make/data/symbols + * * cd /src/jdk.compiler/share/data/symbols * * /bin/java --add-exports jdk.jdeps/com.sun.tools.classfile=ALL-UNNAMED \ * --add-exports jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED \ * --add-exports jdk.compiler/com.sun.tools.javac.jvm=ALL-UNNAMED \ @@ -164,7 +164,7 @@ import java.util.Optional; * --add-modules jdk.jdeps \ * ../../../make/langtools/src/classes/build/tools/symbolgenerator/CreateSymbols.java \ * build-description-incremental symbols include.list - * * sanity-check the new and updates files in make/data/symbols and commit them + * * sanity-check the new and updates files in src/jdk.compiler/share/data/symbols and commit them * * The tools allows to: * * convert the .sym.txt into class/sig files for ct.sym @@ -212,7 +212,8 @@ import java.util.Optional; * To generate the .sym.txt files for OpenJDK 7 and 8: * /bin/java build.tools.symbolgenerator.Probe OpenJDK7.classes * /bin/java build.tools.symbolgenerator.Probe OpenJDK8.classes - * java build.tools.symbolgenerator.CreateSymbols build-description make/data/symbols $TOPDIR make/data/symbols/include.list + * java build.tools.symbolgenerator.CreateSymbols build-description src/jdk.compiler/share/data/symbols + * $TOPDIR src/jdk.compiler/share/data/symbols/include.list * 8 OpenJDK8.classes '' * 7 OpenJDK7.classes 8 * diff --git a/make/modules/java.base/Gendata.gmk b/make/modules/java.base/Gendata.gmk index 4b894eeae4a..9e5cfe2d0fc 100644 --- a/make/modules/java.base/Gendata.gmk +++ b/make/modules/java.base/Gendata.gmk @@ -1,5 +1,5 @@ # -# Copyright (c) 2011, 2021, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2011, 2022, 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 @@ -39,7 +39,7 @@ include gendata/GendataPublicSuffixList.gmk GENDATA_UNINAME := $(JDK_OUTPUTDIR)/modules/java.base/java/lang/uniName.dat -$(GENDATA_UNINAME): $(TOPDIR)/make/data/unicodedata/UnicodeData.txt $(BUILD_TOOLS_JDK) +$(GENDATA_UNINAME): $(MODULE_SRC)/share/data/unicodedata/UnicodeData.txt $(BUILD_TOOLS_JDK) $(call MakeDir, $(@D)) $(TOOL_CHARACTERNAME) $< $@ @@ -49,7 +49,7 @@ TARGETS += $(GENDATA_UNINAME) GENDATA_CURDATA := $(JDK_OUTPUTDIR)/modules/java.base/java/util/currency.data -$(GENDATA_CURDATA): $(TOPDIR)/make/data/currency/CurrencyData.properties $(BUILD_TOOLS_JDK) +$(GENDATA_CURDATA): $(MODULE_SRC)/share/data/currency/CurrencyData.properties $(BUILD_TOOLS_JDK) $(call MakeDir, $(@D)) $(RM) $@ $(TOOL_GENERATECURRENCYDATA) -o $@.tmp -i $< @@ -63,7 +63,7 @@ TARGETS += $(GENDATA_CURDATA) ifneq ($(CACERTS_SRC), ) GENDATA_CACERTS_SRC := $(CACERTS_SRC) else - GENDATA_CACERTS_SRC := $(TOPDIR)/make/data/cacerts/ + GENDATA_CACERTS_SRC := $(MODULE_SRC)/share/data/cacerts/ endif GENDATA_CACERTS := $(SUPPORT_OUTPUTDIR)/modules_libs/java.base/security/cacerts @@ -78,7 +78,7 @@ endif ################################################################################ -GENDATA_JAVA_SECURITY_SRC := $(TOPDIR)/src/java.base/share/conf/security/java.security +GENDATA_JAVA_SECURITY_SRC := $(MODULE_SRC)/share/conf/security/java.security GENDATA_JAVA_SECURITY := $(SUPPORT_OUTPUTDIR)/modules_conf/java.base/security/java.security ifeq ($(UNLIMITED_CRYPTO), true) diff --git a/make/modules/java.base/Gensrc.gmk b/make/modules/java.base/Gensrc.gmk index 9ea2d015d3b..9c9576bdd4a 100644 --- a/make/modules/java.base/Gensrc.gmk +++ b/make/modules/java.base/Gensrc.gmk @@ -1,5 +1,5 @@ # -# Copyright (c) 2011, 2020, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2011, 2022, 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 @@ -46,8 +46,8 @@ TARGETS += $(GENSRC_BASELOCALEDATA) CLDR_DATA_DIR := $(TOPDIR)/make/data/cldr/common GENSRC_DIR := $(SUPPORT_OUTPUTDIR)/gensrc/java.base CLDR_GEN_DONE := $(GENSRC_DIR)/_cldr-gensrc.marker -TZ_DATA_DIR := $(TOPDIR)/make/data/tzdata -ZONENAME_TEMPLATE := $(TOPDIR)/src/java.base/share/classes/java/time/format/ZoneName.java.template +TZ_DATA_DIR := $(MODULE_SRC)/share/data/tzdata +ZONENAME_TEMPLATE := $(MODULE_SRC)/share/classes/java/time/format/ZoneName.java.template $(CLDR_GEN_DONE): $(wildcard $(CLDR_DATA_DIR)/dtd/*.dtd) \ $(wildcard $(CLDR_DATA_DIR)/main/en*.xml) \ @@ -74,12 +74,12 @@ TARGETS += $(CLDR_GEN_DONE) include GensrcProperties.gmk $(eval $(call SetupCompileProperties, LIST_RESOURCE_BUNDLE, \ - SRC_DIRS := $(TOPDIR)/src/java.base/share/classes/sun/launcher/resources, \ + SRC_DIRS := $(MODULE_SRC)/share/classes/sun/launcher/resources, \ CLASS := ListResourceBundle, \ )) $(eval $(call SetupCompileProperties, SUN_UTIL, \ - SRC_DIRS := $(TOPDIR)/src/java.base/share/classes/sun/util/resources, \ + SRC_DIRS := $(MODULE_SRC)/share/classes/sun/util/resources, \ CLASS := sun.util.resources.LocaleNamesBundle, \ )) @@ -98,7 +98,7 @@ TARGETS += $(COPY_ZH_HK) GENSRC_LSREQUIVMAPS := $(SUPPORT_OUTPUTDIR)/gensrc/java.base/sun/util/locale/LocaleEquivalentMaps.java -$(GENSRC_LSREQUIVMAPS): $(TOPDIR)/make/data/lsrdata/language-subtag-registry.txt $(BUILD_TOOLS_JDK) +$(GENSRC_LSREQUIVMAPS): $(MODULE_SRC)/share/data/lsrdata/language-subtag-registry.txt $(BUILD_TOOLS_JDK) $(call MakeDir, $(@D)) $(TOOL_GENERATELSREQUIVMAPS) $< $@ $(COPYRIGHT_YEAR) diff --git a/make/modules/java.base/gendata/GendataBlockedCerts.gmk b/make/modules/java.base/gendata/GendataBlockedCerts.gmk index 65f75012a33..b6149b457cd 100644 --- a/make/modules/java.base/gendata/GendataBlockedCerts.gmk +++ b/make/modules/java.base/gendata/GendataBlockedCerts.gmk @@ -1,5 +1,5 @@ # -# Copyright (c) 2014, 2021, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2014, 2022, 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 @@ # questions. # -GENDATA_BLOCKED_CERTS_SRC += $(TOPDIR)/make/data/blockedcertsconverter/blocked.certs.pem +GENDATA_BLOCKED_CERTS_SRC += $(MODULE_SRC)/share/data/blockedcertsconverter/blocked.certs.pem GENDATA_BLOCKED_CERTS := $(SUPPORT_OUTPUTDIR)/modules_libs/$(MODULE)/security/blocked.certs $(GENDATA_BLOCKED_CERTS): $(BUILD_TOOLS_JDK) $(GENDATA_BLOCKED_CERTS_SRC) diff --git a/make/modules/java.base/gendata/GendataBreakIterator.gmk b/make/modules/java.base/gendata/GendataBreakIterator.gmk index d314253b4fe..857ce2b7c34 100644 --- a/make/modules/java.base/gendata/GendataBreakIterator.gmk +++ b/make/modules/java.base/gendata/GendataBreakIterator.gmk @@ -1,5 +1,5 @@ -# Copyright (c) 2011, 2020, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2011, 2022, 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 @@ -74,7 +74,7 @@ BREAK_ITERATOR_BOOTCLASSPATH := \ # Generate data resource files. # input -UNICODEDATA := $(TOPDIR)/make/data/unicodedata/UnicodeData.txt +UNICODEDATA := $(MODULE_SRC)/share/data/unicodedata/UnicodeData.txt # output BASE_DATA_PKG_DIR := $(JDK_OUTPUTDIR)/modules/java.base/sun/text/resources diff --git a/make/modules/java.base/gendata/GendataPublicSuffixList.gmk b/make/modules/java.base/gendata/GendataPublicSuffixList.gmk index 757098a619f..189fccf0c0d 100644 --- a/make/modules/java.base/gendata/GendataPublicSuffixList.gmk +++ b/make/modules/java.base/gendata/GendataPublicSuffixList.gmk @@ -1,5 +1,5 @@ # -# Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2017, 2022, 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 @@ -25,7 +25,7 @@ include $(SPEC) -GENDATA_PUBLICSUFFIXLIST_SRC += $(TOPDIR)/make/data/publicsuffixlist/public_suffix_list.dat +GENDATA_PUBLICSUFFIXLIST_SRC += $(MODULE_SRC)/share/data/publicsuffixlist/public_suffix_list.dat GENDATA_PUBLICSUFFIXLIST := $(SUPPORT_OUTPUTDIR)/modules_libs/$(MODULE)/security/public_suffix_list.dat $(GENDATA_PUBLICSUFFIXLIST): $(GENDATA_PUBLICSUFFIXLIST_SRC) $(BUILD_TOOLS_JDK) diff --git a/make/modules/java.base/gendata/GendataTZDB.gmk b/make/modules/java.base/gendata/GendataTZDB.gmk index 1352178694f..593ed8a8f11 100644 --- a/make/modules/java.base/gendata/GendataTZDB.gmk +++ b/make/modules/java.base/gendata/GendataTZDB.gmk @@ -1,5 +1,5 @@ # -# Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2012, 2022, 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 @@ -28,7 +28,7 @@ GENDATA_TZDB := # # Time zone data file creation # -TZDATA_DIR := $(TOPDIR)/make/data/tzdata +TZDATA_DIR := $(MODULE_SRC)/share/data/tzdata TZDATA_TZFILE := africa antarctica asia australasia europe northamerica southamerica backward etcetera gmt jdk11_backward TZDATA_TZFILES := $(addprefix $(TZDATA_DIR)/,$(TZDATA_TZFILE)) diff --git a/make/modules/java.base/gensrc/GensrcBuffer.gmk b/make/modules/java.base/gensrc/GensrcBuffer.gmk index 6ad432fb866..ce22230a8e1 100644 --- a/make/modules/java.base/gensrc/GensrcBuffer.gmk +++ b/make/modules/java.base/gensrc/GensrcBuffer.gmk @@ -1,5 +1,5 @@ # -# Copyright (c) 2011, 2020, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2011, 2022, 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 @@ -27,7 +27,7 @@ GENSRC_BUFFER := GENSRC_BUFFER_DST := $(SUPPORT_OUTPUTDIR)/gensrc/java.base/java/nio -GENSRC_BUFFER_SRC := $(TOPDIR)/src/java.base/share/classes/java/nio +GENSRC_BUFFER_SRC := $(MODULE_SRC)/share/classes/java/nio ### diff --git a/make/modules/java.base/gensrc/GensrcCharacterData.gmk b/make/modules/java.base/gensrc/GensrcCharacterData.gmk index eb938016506..115a28309a2 100644 --- a/make/modules/java.base/gensrc/GensrcCharacterData.gmk +++ b/make/modules/java.base/gensrc/GensrcCharacterData.gmk @@ -1,5 +1,5 @@ # -# Copyright (c) 2011, 2021, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2011, 2022, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -29,8 +29,8 @@ GENSRC_CHARACTERDATA := -CHARACTERDATA = $(TOPDIR)/make/data/characterdata -UNICODEDATA = $(TOPDIR)/make/data/unicodedata +CHARACTERDATA_TEMPLATES = $(MODULE_SRC)/share/classes/java/lang +UNICODEDATA = $(MODULE_SRC)/share/data/unicodedata ifneq ($(DEBUG_LEVEL), release) ifeq ($(ALLOW_ABSOLUTE_PATHS_IN_OUTPUT), true) @@ -40,11 +40,11 @@ endif define SetupCharacterData $(SUPPORT_OUTPUTDIR)/gensrc/java.base/java/lang/$1.java: \ - $(CHARACTERDATA)/$1.java.template + $(CHARACTERDATA_TEMPLATES)/$1.java.template $$(call LogInfo, Generating $1.java) $$(call MakeDir, $$(@D)) $(TOOL_GENERATECHARACTER) $2 $(DEBUG_OPTION) \ - -template $(CHARACTERDATA)/$1.java.template \ + -template $(CHARACTERDATA_TEMPLATES)/$1.java.template \ -spec $(UNICODEDATA)/UnicodeData.txt \ -specialcasing $(UNICODEDATA)/SpecialCasing.txt \ -proplist $(UNICODEDATA)/PropList.txt \ diff --git a/make/modules/java.base/gensrc/GensrcCharsetCoder.gmk b/make/modules/java.base/gensrc/GensrcCharsetCoder.gmk index 79fa54b19cc..2940ba42319 100644 --- a/make/modules/java.base/gensrc/GensrcCharsetCoder.gmk +++ b/make/modules/java.base/gensrc/GensrcCharsetCoder.gmk @@ -1,5 +1,5 @@ # -# Copyright (c) 2011, 2020, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2011, 2022, 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 @@ -27,7 +27,7 @@ GENSRC_CHARSETCODER := GENSRC_CHARSETCODER_DST := $(SUPPORT_OUTPUTDIR)/gensrc/java.base/java/nio/charset -GENSRC_CHARSETCODER_SRC := $(TOPDIR)/src/java.base/share/classes/java/nio +GENSRC_CHARSETCODER_SRC := $(MODULE_SRC)/share/classes/java/nio GENSRC_CHARSETCODER_TEMPLATE := $(GENSRC_CHARSETCODER_SRC)/charset/Charset-X-Coder.java.template diff --git a/make/modules/java.base/gensrc/GensrcEmojiData.gmk b/make/modules/java.base/gensrc/GensrcEmojiData.gmk index d92cb9354a3..1af03bcafe9 100644 --- a/make/modules/java.base/gensrc/GensrcEmojiData.gmk +++ b/make/modules/java.base/gensrc/GensrcEmojiData.gmk @@ -1,5 +1,5 @@ # -# Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2019, 2022, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -29,8 +29,8 @@ GENSRC_EMOJIDATA := $(SUPPORT_OUTPUTDIR)/gensrc/java.base/java/util/regex/EmojiData.java -EMOJIDATATEMP = $(TOPDIR)/src/java.base/share/classes/java/util/regex/EmojiData.java.template -UNICODEDATA = $(TOPDIR)/make/data/unicodedata +EMOJIDATATEMP = $(MODULE_SRC)/share/classes/java/util/regex/EmojiData.java.template +UNICODEDATA = $(MODULE_SRC)/share/data/unicodedata $(GENSRC_EMOJIDATA): $(BUILD_TOOLS_JDK) $(EMOJIDATATEMP) $(UNICODEDATA)/emoji/emoji-data.txt $(call LogInfo, Generating $@) diff --git a/make/modules/java.base/gensrc/GensrcExceptions.gmk b/make/modules/java.base/gensrc/GensrcExceptions.gmk index 37fed896560..1c4974b4a28 100644 --- a/make/modules/java.base/gensrc/GensrcExceptions.gmk +++ b/make/modules/java.base/gensrc/GensrcExceptions.gmk @@ -1,5 +1,5 @@ # -# Copyright (c) 2011, 2020, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2011, 2022, 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 @@ -27,7 +27,7 @@ GENSRC_EXCEPTIONS := GENSRC_EXCEPTIONS_DST := $(SUPPORT_OUTPUTDIR)/gensrc/java.base/java/nio -GENSRC_EXCEPTIONS_SRC := $(TOPDIR)/src/java.base/share/classes/java/nio +GENSRC_EXCEPTIONS_SRC := $(MODULE_SRC)/share/classes/java/nio GENSRC_EXCEPTIONS_CMD := $(TOPDIR)/make/scripts/genExceptions.sh GENSRC_EXCEPTIONS_SRC_DIRS := . charset channels diff --git a/make/modules/java.base/gensrc/GensrcLocaleData.gmk b/make/modules/java.base/gensrc/GensrcLocaleData.gmk index 1e28d91ab68..c04bab53175 100644 --- a/make/modules/java.base/gensrc/GensrcLocaleData.gmk +++ b/make/modules/java.base/gensrc/GensrcLocaleData.gmk @@ -1,5 +1,5 @@ # -# Copyright (c) 2011, 2020, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2011, 2022, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -29,8 +29,8 @@ # First go look for all locale files LOCALE_FILES := $(call FindFiles, \ - $(TOPDIR)/src/$(MODULE)/share/classes/sun/text/resources \ - $(TOPDIR)/src/$(MODULE)/share/classes/sun/util/resources, \ + $(MODULE_SRC)/share/classes/sun/text/resources \ + $(MODULE_SRC)/share/classes/sun/util/resources, \ FormatData_*.java FormatData_*.properties \ CollationData_*.java CollationData_*.properties \ TimeZoneNames_*.java TimeZoneNames_*.properties \ diff --git a/make/modules/java.base/gensrc/GensrcScopedMemoryAccess.gmk b/make/modules/java.base/gensrc/GensrcScopedMemoryAccess.gmk index b431acc14e1..54fea77571e 100644 --- a/make/modules/java.base/gensrc/GensrcScopedMemoryAccess.gmk +++ b/make/modules/java.base/gensrc/GensrcScopedMemoryAccess.gmk @@ -24,7 +24,7 @@ # SCOPED_MEMORY_ACCESS_GENSRC_DIR := $(SUPPORT_OUTPUTDIR)/gensrc/java.base/jdk/internal/misc -SCOPED_MEMORY_ACCESS_SRC_DIR := $(TOPDIR)/src/java.base/share/classes/jdk/internal/misc +SCOPED_MEMORY_ACCESS_SRC_DIR := $(MODULE_SRC)/share/classes/jdk/internal/misc SCOPED_MEMORY_ACCESS_TEMPLATE := $(SCOPED_MEMORY_ACCESS_SRC_DIR)/X-ScopedMemoryAccess.java.template SCOPED_MEMORY_ACCESS_BIN_TEMPLATE := $(SCOPED_MEMORY_ACCESS_SRC_DIR)/X-ScopedMemoryAccess-bin.java.template SCOPED_MEMORY_ACCESS_DEST := $(SCOPED_MEMORY_ACCESS_GENSRC_DIR)/ScopedMemoryAccess.java @@ -139,7 +139,7 @@ endef SCOPE_MEMORY_ACCESS_TYPES := Byte Short Char Int Long Float Double $(foreach t, $(SCOPE_MEMORY_ACCESS_TYPES), \ $(eval $(call GenerateScopedOp,BIN_$t,$t))) - + $(SCOPED_MEMORY_ACCESS_DEST): $(BUILD_TOOLS_JDK) $(SCOPED_MEMORY_ACCESS_TEMPLATE) $(SCOPED_MEMORY_ACCESS_BIN_TEMPLATE) $(call MakeDir, $(SCOPED_MEMORY_ACCESS_GENSRC_DIR)) $(CAT) $(SCOPED_MEMORY_ACCESS_TEMPLATE) > $(SCOPED_MEMORY_ACCESS_DEST) @@ -147,5 +147,5 @@ $(SCOPED_MEMORY_ACCESS_DEST): $(BUILD_TOOLS_JDK) $(SCOPED_MEMORY_ACCESS_TEMPLATE $(TOOL_SPP) -nel -K$(BIN_$t_type) -Dtype=$(BIN_$t_type) -DType=$(BIN_$t_Type) $(BIN_$t_ARGS) \ -i$(SCOPED_MEMORY_ACCESS_BIN_TEMPLATE) -o$(SCOPED_MEMORY_ACCESS_DEST) ;) $(PRINTF) "}\n" >> $(SCOPED_MEMORY_ACCESS_DEST) - + TARGETS += $(SCOPED_MEMORY_ACCESS_DEST) diff --git a/make/modules/java.base/gensrc/GensrcVarHandles.gmk b/make/modules/java.base/gensrc/GensrcVarHandles.gmk index 579488379c3..e1686834bf5 100644 --- a/make/modules/java.base/gensrc/GensrcVarHandles.gmk +++ b/make/modules/java.base/gensrc/GensrcVarHandles.gmk @@ -1,5 +1,5 @@ # -# Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2015, 2022, 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,7 @@ GENSRC_VARHANDLES := VARHANDLES_GENSRC_DIR := $(SUPPORT_OUTPUTDIR)/gensrc/java.base/java/lang/invoke -VARHANDLES_SRC_DIR := $(TOPDIR)/src/java.base/share/classes/java/lang/invoke +VARHANDLES_SRC_DIR := $(MODULE_SRC)/share/classes/java/lang/invoke ################################################################################ # Setup a rule for generating a VarHandle java class diff --git a/make/modules/java.desktop/gendata/GendataFontConfig.gmk b/make/modules/java.desktop/gendata/GendataFontConfig.gmk index 42e3f4b485f..92a64b986e1 100644 --- a/make/modules/java.desktop/gendata/GendataFontConfig.gmk +++ b/make/modules/java.desktop/gendata/GendataFontConfig.gmk @@ -1,5 +1,5 @@ # -# Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2011, 2022, 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,30 +23,35 @@ # questions. # -GENDATA_FONT_CONFIG_DST := $(SUPPORT_OUTPUTDIR)/modules_libs/$(MODULE) +FONTCONFIG_DATA_DIR := $(MODULE_SRC)/$(OPENJDK_TARGET_OS)/data/fontconfig +FONTCONFIG_SRC_FILE := $(FONTCONFIG_DATA_DIR)/fontconfig.properties -GENDATA_FONT_CONFIG_DATA_DIR ?= $(TOPDIR)/make/data/fontconfig +FONTCONFIG_DEST_DIR := $(SUPPORT_OUTPUTDIR)/modules_libs/$(MODULE) +FONTCONFIG_OUT_FILE := $(FONTCONFIG_DEST_DIR)/fontconfig.properties.src +FONTCONFIG_OUT_BIN_FILE := $(FONTCONFIG_DEST_DIR)/fontconfig.bfc -GENDATA_FONT_CONFIG_SRC_FILES := \ - $(wildcard $(GENDATA_FONT_CONFIG_DATA_DIR)/$(OPENJDK_TARGET_OS).*) +ifneq ($(findstring $(LOG_LEVEL), debug trace), ) + FONTCONFIG_VERBOSE_FLAG := -verbose +endif +# Not all OSes have a fontconfig file +ifneq ($(wildcard $(FONTCONFIG_SRC_FILE)), ) -$(GENDATA_FONT_CONFIG_DST)/%.src: \ - $(GENDATA_FONT_CONFIG_DATA_DIR)/$(OPENJDK_TARGET_OS).% + # Copy properties file as-is + $(FONTCONFIG_OUT_FILE): $(FONTCONFIG_SRC_FILE) + $(call LogInfo, Copying fontconfig.properties) $(call install-file) -$(GENDATA_FONT_CONFIG_DST)/%.bfc: \ - $(GENDATA_FONT_CONFIG_DATA_DIR)/$(OPENJDK_TARGET_OS).%.properties \ - $(BUILD_TOOLS_JDK) + TARGETS += $(FONTCONFIG_OUT_FILE) + + # Generate binary representation + $(FONTCONFIG_OUT_BIN_FILE): $(FONTCONFIG_SRC_FILE) $(BUILD_TOOLS_JDK) + $(call LogInfo, Compiling fontconfig.properties to binary) $(call MakeTargetDir) $(RM) $@ - $(TOOL_COMPILEFONTCONFIG) $< $@ + $(TOOL_COMPILEFONTCONFIG) $(FONTCONFIG_VERBOSE_FLAG) $< $@ $(CHMOD) 444 $@ + TARGETS += $(FONTCONFIG_OUT_BIN_FILE) -GENDATA_FONT_CONFIGS := $(patsubst $(GENDATA_FONT_CONFIG_DATA_DIR)/$(OPENJDK_TARGET_OS).%, \ - $(GENDATA_FONT_CONFIG_DST)/%.src, $(GENDATA_FONT_CONFIG_SRC_FILES)) -GENDATA_BFONT_CONFIGS := $(patsubst $(GENDATA_FONT_CONFIG_DATA_DIR)/$(OPENJDK_TARGET_OS).%.properties, \ - $(GENDATA_FONT_CONFIG_DST)/%.bfc, $(GENDATA_FONT_CONFIG_SRC_FILES)) - -TARGETS := $(GENDATA_FONT_CONFIGS) $(GENDATA_BFONT_CONFIGS) +endif diff --git a/make/modules/java.desktop/gensrc/GensrcIcons.gmk b/make/modules/java.desktop/gensrc/GensrcIcons.gmk index e0a6c107ecc..28434d3f4c1 100644 --- a/make/modules/java.desktop/gensrc/GensrcIcons.gmk +++ b/make/modules/java.desktop/gensrc/GensrcIcons.gmk @@ -1,5 +1,5 @@ # -# Copyright (c) 2011, 2020, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2011, 2022, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -29,7 +29,7 @@ GENSRC_AWT_ICONS_TMP := $(SUPPORT_OUTPUTDIR)/gensrc/java.desktop GENSRC_AWT_ICONS_DST := $(GENSRC_AWT_ICONS_TMP)/sun/awt/ # Allow this to be overridden from a custom makefile -X11_ICONS_PATH_PREFIX ?= $(TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE) +X11_ICONS_PATH_PREFIX ?= $(MODULE_SRC)/$(OPENJDK_TARGET_OS_TYPE) GENSRC_AWT_ICONS_SRC += \ $(X11_ICONS_PATH_PREFIX)/classes/sun/awt/X11/java-icon16.png \ @@ -38,7 +38,7 @@ GENSRC_AWT_ICONS_SRC += \ $(X11_ICONS_PATH_PREFIX)/classes/sun/awt/X11/java-icon48.png -AWT_ICONPATH := $(TOPDIR)/src/java.desktop/share/classes/sun/awt/resources +AWT_ICONPATH := $(MODULE_SRC)/share/classes/sun/awt/resources GENSRC_AWT_ICONS_SRC += \ $(AWT_ICONPATH)/security-icon-bw16.png \ @@ -111,7 +111,7 @@ ifeq ($(call isTargetOs, macosx), true) GENSRC_OSX_ICONS_DST := $(SUPPORT_OUTPUTDIR)/headers/java.desktop GENSRC_OSX_ICONS := $(GENSRC_OSX_ICONS_DST)/AWTIconData.h - GENSRC_OSX_ICONS_SRC ?= $(TOPDIR)/make/data/macosxicons/JavaApp.icns + GENSRC_OSX_ICONS_SRC ?= $(MODULE_SRC)/macosx/data/macosxicons/JavaApp.icns $(GENSRC_OSX_ICONS): $(GENSRC_OSX_ICONS_SRC) $(BUILD_TOOLS_JDK) diff --git a/make/modules/java.desktop/gensrc/GensrcSwing.gmk b/make/modules/java.desktop/gensrc/GensrcSwing.gmk index cfb50831d1b..abd428f3641 100644 --- a/make/modules/java.desktop/gensrc/GensrcSwing.gmk +++ b/make/modules/java.desktop/gensrc/GensrcSwing.gmk @@ -1,5 +1,5 @@ # -# Copyright (c) 2011, 2020, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2011, 2022, 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 @@ -28,7 +28,7 @@ # NIMBUS_PACKAGE = javax.swing.plaf NIMBUS_GENSRC_DIR = $(SUPPORT_OUTPUTDIR)/gensrc/java.desktop/javax/swing/plaf/nimbus -NIMBUS_SKIN_FILE = $(TOPDIR)/src/java.desktop/share/classes/javax/swing/plaf/nimbus/skin.laf +NIMBUS_SKIN_FILE = $(MODULE_SRC)/share/classes/javax/swing/plaf/nimbus/skin.laf $(SUPPORT_OUTPUTDIR)/gensrc/java.desktop/_the.generated_nimbus: $(NIMBUS_SKIN_FILE) $(BUILD_TOOLS_JDK) $(call LogInfo, Generating Nimbus source files) diff --git a/make/modules/java.desktop/gensrc/GensrcX11Wrappers.gmk b/make/modules/java.desktop/gensrc/GensrcX11Wrappers.gmk index d46328f8607..25402ad035a 100644 --- a/make/modules/java.desktop/gensrc/GensrcX11Wrappers.gmk +++ b/make/modules/java.desktop/gensrc/GensrcX11Wrappers.gmk @@ -1,5 +1,5 @@ # -# Copyright (c) 2012, 2020, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2012, 2022, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -24,13 +24,13 @@ # # Generate java sources using the X11 offsets that are precalculated in files -# make/data/x11wrappergen/sizes-
    .txt. +# src/java.desktop/unix/data/x11wrappergen/sizes-
    .txt. # Put the generated Java classes used to interface X11 from awt here. GENSRC_X11WRAPPERS_OUTPUTDIR := $(SUPPORT_OUTPUTDIR)/gensrc/java.desktop/sun/awt/X11 # The pre-calculated offset file are stored here: -GENSRC_X11WRAPPERS_DATADIR := $(TOPDIR)/make/data/x11wrappergen +GENSRC_X11WRAPPERS_DATADIR := $(MODULE_SRC)/unix/data/x11wrappergen GENSRC_X11WRAPPERS_DATA := $(GENSRC_X11WRAPPERS_DATADIR)/sizes-$(OPENJDK_TARGET_CPU_BITS).txt # Run the tool on the offset files to generate several Java classes used in awt. diff --git a/make/modules/jdk.charsets/Gensrc.gmk b/make/modules/jdk.charsets/Gensrc.gmk index ca9c1940941..1fac37b2c4b 100644 --- a/make/modules/jdk.charsets/Gensrc.gmk +++ b/make/modules/jdk.charsets/Gensrc.gmk @@ -1,5 +1,5 @@ # -# Copyright (c) 2011, 2020, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2011, 2022, 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 @@ -38,8 +38,8 @@ CHARSET_TEMPLATES := \ $(CHARSET_DATA_DIR)/SingleByte-X.java.template \ $(CHARSET_DATA_DIR)/DoubleByte-X.java.template CHARSET_EXTENDED_JAVA_TEMPLATES := \ - $(TOPDIR)/src/jdk.charsets/share/classes/sun/nio/cs/ext/ExtendedCharsets.java.template -CHARSET_EXTENDED_JAVA_DIR := $(TOPDIR)/src/jdk.charsets/share/classes/sun/nio/cs/ext + $(MODULE_SRC)/share/classes/sun/nio/cs/ext/ExtendedCharsets.java.template +CHARSET_EXTENDED_JAVA_DIR := $(MODULE_SRC)/share/classes/sun/nio/cs/ext CHARSET_STANDARD_OS := stdcs-$(OPENJDK_TARGET_OS) $(CHARSET_DONE_CS)-extcs: $(CHARSET_DATA_DIR)/charsets \ diff --git a/make/modules/jdk.compiler/Gendata.gmk b/make/modules/jdk.compiler/Gendata.gmk index 85815e5524b..5471fa1127c 100644 --- a/make/modules/jdk.compiler/Gendata.gmk +++ b/make/modules/jdk.compiler/Gendata.gmk @@ -1,5 +1,5 @@ # -# Copyright (c) 2015, 2021, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2015, 2022, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -41,7 +41,7 @@ CT_MODULES := $(DOCS_MODULES) # Get the complete module source path: CT_MODULESOURCEPATH := $(call GetModuleSrcPath) -CT_DATA_DESCRIPTION += $(TOPDIR)/make/data/symbols/symbols +CT_DATA_DESCRIPTION += $(MODULE_SRC)/share/data/symbols/symbols COMPILECREATESYMBOLS_ADD_EXPORTS := \ --add-exports java.base/jdk.internal.javac=java.compiler.interim,jdk.compiler.interim \ @@ -65,7 +65,7 @@ $(eval $(call SetupJavaCompilation, COMPILE_CREATE_SYMBOLS, \ $(SUPPORT_OUTPUTDIR)/symbols/ct.sym: \ $(COMPILE_CREATE_SYMBOLS) \ - $(wildcard $(TOPDIR)/make/data/symbols/*) \ + $(wildcard $(MODULE_SRC)/share/data/symbols/*) \ $(MODULE_INFOS) $(RM) -r $(@D) $(MKDIR) -p $(@D) diff --git a/make/modules/jdk.javadoc/Gendata.gmk b/make/modules/jdk.javadoc/Gendata.gmk index 50ef87545a4..69c93c29468 100644 --- a/make/modules/jdk.javadoc/Gendata.gmk +++ b/make/modules/jdk.javadoc/Gendata.gmk @@ -1,5 +1,5 @@ # -# Copyright (c) 2015, 2021, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2015, 2022, 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 @@ -39,7 +39,7 @@ JAVADOC_MODULES := $(DOCS_MODULES) # Get the complete module source path: JAVADOC_MODULESOURCEPATH := $(call GetModuleSrcPath) -CT_DATA_DESCRIPTION += $(TOPDIR)/make/data/symbols/symbols +CT_DATA_DESCRIPTION += $(TOPDIR)/src/jdk.compiler/share/data/symbols/symbols COMPILECREATESYMBOLS_ADD_EXPORTS := \ --add-exports java.base/jdk.internal=java.compiler.interim,jdk.compiler.interim \ @@ -68,7 +68,7 @@ ELEMENT_LISTS_DIR := $(JDK_JAVADOC_DIR)/$(ELEMENT_LISTS_PKG) $(JDK_JAVADOC_DIR)/_element_lists.marker: \ $(COMPILE_CREATE_SYMBOLS) \ - $(wildcard $(TOPDIR)/make/data/symbols/*) \ + $(wildcard $(TOPDIR)/src/jdk.compiler/share/data/symbols/*) \ $(MODULE_INFOS) $(call MakeTargetDir) $(call LogInfo, Creating javadoc element lists) diff --git a/make/modules/jdk.jdi/Gensrc.gmk b/make/modules/jdk.jdi/Gensrc.gmk index 5487e950921..7db06b5c958 100644 --- a/make/modules/jdk.jdi/Gensrc.gmk +++ b/make/modules/jdk.jdi/Gensrc.gmk @@ -1,5 +1,5 @@ # -# Copyright (c) 2011, 2020, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2011, 2022, 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,10 +26,11 @@ include GensrcCommonJdk.gmk ################################################################################ -# Translate the Java debugger wire protocol (jdwp.spec) file into a JDWP.java file -# and a JDWPCommands.h C-header file. +# Translate the Java debugger wire protocol (jdwp.spec) file into a front-end +# Java implementation (JDWP.java), a back-end C header file (JDWPCommands.h) and +# an HTML documentation file (jdwp-protocol.html). -JDWP_SPEC_FILE := $(TOPDIR)/make/data/jdwp/jdwp.spec +JDWP_SPEC_FILE := $(TOPDIR)/src/java.se/share/data/jdwp/jdwp.spec HEADER_FILE := $(SUPPORT_OUTPUTDIR)/headers/jdk.jdwp.agent/JDWPCommands.h JAVA_FILE := $(SUPPORT_OUTPUTDIR)/gensrc/jdk.jdi/com/sun/tools/jdi/JDWP.java HTML_FILE := $(SUPPORT_OUTPUTDIR)/gensrc/jdk.jdi/jdwp-protocol.html diff --git a/make/modules/jdk.localedata/Gensrc.gmk b/make/modules/jdk.localedata/Gensrc.gmk index 09f014e8607..233572c8a54 100644 --- a/make/modules/jdk.localedata/Gensrc.gmk +++ b/make/modules/jdk.localedata/Gensrc.gmk @@ -1,5 +1,5 @@ # -# Copyright (c) 2014, 2020, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2014, 2022, 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 @@ TARGETS += $(CLDR_GEN_DONE) include GensrcProperties.gmk $(eval $(call SetupCompileProperties, COMPILE_PROPERTIES, \ - SRC_DIRS := $(TOPDIR)/src/jdk.localedata/share/classes/sun/util/resources, \ + SRC_DIRS := $(MODULE_SRC)/share/classes/sun/util/resources, \ CLASS := sun.util.resources.LocaleNamesBundle, \ KEEP_ALL_TRANSLATIONS := true, \ )) diff --git a/make/scripts/generate-symbol-data.sh b/make/scripts/generate-symbol-data.sh index 56aa8016dd6..ee1d540715f 100644 --- a/make/scripts/generate-symbol-data.sh +++ b/make/scripts/generate-symbol-data.sh @@ -34,19 +34,19 @@ # - have a checkout the JDK to which the data should be added (or in which the data should be updated). # The checkout directory will be denoted as "${JDK_CHECKOUT}" in the further text. # The checkout must not have any local changes that could interfere with the new data. In particular, -# there must be absolutely no changed, new or removed files under the ${JDK_CHECKOUT}/make/data/symbols +# there must be absolutely no changed, new or removed files under the ${JDK_CHECKOUT}/src/jdk.compiler/share/data/symbols # directory. # - open a terminal program and run these commands: -# cd "${JDK_CHECKOUT}"/make/data/symbols +# cd "${JDK_CHECKOUT}"/src/jdk.compiler/share/data/symbols # bash ../../scripts/generate-symbol-data.sh "${JDK_N_INSTALL}" -# - this command will generate or update data for "--release N" into the ${JDK_CHECKOUT}/make/data/symbols +# - this command will generate or update data for "--release N" into the ${JDK_CHECKOUT}/src/jdk.compiler/share/data/symbols # directory, updating all registration necessary. If the goal was to update the data, and there are no -# new or changed files in the ${JDK_CHECKOUT}/make/data/symbols directory after running this script, +# new or changed files in the ${JDK_CHECKOUT}/src/jdk.compiler/share/data/symbols directory after running this script, # there were no relevant changes and no further action is necessary. Note that version for N > 9 are encoded # using capital letters, i.e. A represents version 10, B represents 11, and so on. The version numbers are in -# the names of the files in the ${JDK_CHECKOUT}/make/data/symbols directory, as well as in -# the ${JDK_CHECKOUT}/make/data/symbols/symbols file. -# - if there are any changed/new files in the ${JDK_CHECKOUT}/make/data/symbols directory after running this script, +# the names of the files in the ${JDK_CHECKOUT}/src/jdk.compiler/share/data/symbols directory, as well as in +# the ${JDK_CHECKOUT}/src/jdk.compiler/share/data/symbols/symbols file. +# - if there are any changed/new files in the ${JDK_CHECKOUT}/src/jdk.compiler/share/data/symbols directory after running this script, # then all the changes in this directory, including any new files, need to be sent for review and eventually pushed. # The commit message should specify which binary build was installed in the ${JDK_N_INSTALL} directory and also # include the SCM state that was used to build it, which can be found in ${JDK_N_INSTALL}/release, @@ -59,12 +59,12 @@ if [ "$1x" = "x" ] ; then fi; if [ ! -f symbols ] ; then - echo "Must run inside the make/data/symbols directory" >&2 + echo "Must run inside the src/jdk.compiler/share/data/symbols directory" >&2 exit 1 fi; if [ "`git status --porcelain=v1 .`x" != "x" ] ; then - echo "The make/data/symbols directory contains local changes!" >&2 + echo "The src/jdk.compiler/share/data/symbols directory contains local changes!" >&2 exit 1 fi; diff --git a/make/data/characterdata/CharacterData00.java.template b/src/java.base/share/classes/java/lang/CharacterData00.java.template similarity index 100% rename from make/data/characterdata/CharacterData00.java.template rename to src/java.base/share/classes/java/lang/CharacterData00.java.template diff --git a/make/data/characterdata/CharacterData01.java.template b/src/java.base/share/classes/java/lang/CharacterData01.java.template similarity index 100% rename from make/data/characterdata/CharacterData01.java.template rename to src/java.base/share/classes/java/lang/CharacterData01.java.template diff --git a/make/data/characterdata/CharacterData02.java.template b/src/java.base/share/classes/java/lang/CharacterData02.java.template similarity index 100% rename from make/data/characterdata/CharacterData02.java.template rename to src/java.base/share/classes/java/lang/CharacterData02.java.template diff --git a/make/data/characterdata/CharacterData03.java.template b/src/java.base/share/classes/java/lang/CharacterData03.java.template similarity index 100% rename from make/data/characterdata/CharacterData03.java.template rename to src/java.base/share/classes/java/lang/CharacterData03.java.template diff --git a/make/data/characterdata/CharacterData0E.java.template b/src/java.base/share/classes/java/lang/CharacterData0E.java.template similarity index 100% rename from make/data/characterdata/CharacterData0E.java.template rename to src/java.base/share/classes/java/lang/CharacterData0E.java.template diff --git a/make/data/characterdata/CharacterDataLatin1.java.template b/src/java.base/share/classes/java/lang/CharacterDataLatin1.java.template similarity index 100% rename from make/data/characterdata/CharacterDataLatin1.java.template rename to src/java.base/share/classes/java/lang/CharacterDataLatin1.java.template diff --git a/make/data/blockedcertsconverter/blocked.certs.pem b/src/java.base/share/data/blockedcertsconverter/blocked.certs.pem similarity index 100% rename from make/data/blockedcertsconverter/blocked.certs.pem rename to src/java.base/share/data/blockedcertsconverter/blocked.certs.pem diff --git a/make/data/cacerts/README b/src/java.base/share/data/cacerts/README similarity index 100% rename from make/data/cacerts/README rename to src/java.base/share/data/cacerts/README diff --git a/make/data/cacerts/actalisauthenticationrootca b/src/java.base/share/data/cacerts/actalisauthenticationrootca similarity index 100% rename from make/data/cacerts/actalisauthenticationrootca rename to src/java.base/share/data/cacerts/actalisauthenticationrootca diff --git a/make/data/cacerts/addtrustexternalca b/src/java.base/share/data/cacerts/addtrustexternalca similarity index 100% rename from make/data/cacerts/addtrustexternalca rename to src/java.base/share/data/cacerts/addtrustexternalca diff --git a/make/data/cacerts/addtrustqualifiedca b/src/java.base/share/data/cacerts/addtrustqualifiedca similarity index 100% rename from make/data/cacerts/addtrustqualifiedca rename to src/java.base/share/data/cacerts/addtrustqualifiedca diff --git a/make/data/cacerts/affirmtrustcommercialca b/src/java.base/share/data/cacerts/affirmtrustcommercialca similarity index 100% rename from make/data/cacerts/affirmtrustcommercialca rename to src/java.base/share/data/cacerts/affirmtrustcommercialca diff --git a/make/data/cacerts/affirmtrustnetworkingca b/src/java.base/share/data/cacerts/affirmtrustnetworkingca similarity index 100% rename from make/data/cacerts/affirmtrustnetworkingca rename to src/java.base/share/data/cacerts/affirmtrustnetworkingca diff --git a/make/data/cacerts/affirmtrustpremiumca b/src/java.base/share/data/cacerts/affirmtrustpremiumca similarity index 100% rename from make/data/cacerts/affirmtrustpremiumca rename to src/java.base/share/data/cacerts/affirmtrustpremiumca diff --git a/make/data/cacerts/affirmtrustpremiumeccca b/src/java.base/share/data/cacerts/affirmtrustpremiumeccca similarity index 100% rename from make/data/cacerts/affirmtrustpremiumeccca rename to src/java.base/share/data/cacerts/affirmtrustpremiumeccca diff --git a/make/data/cacerts/amazonrootca1 b/src/java.base/share/data/cacerts/amazonrootca1 similarity index 100% rename from make/data/cacerts/amazonrootca1 rename to src/java.base/share/data/cacerts/amazonrootca1 diff --git a/make/data/cacerts/amazonrootca2 b/src/java.base/share/data/cacerts/amazonrootca2 similarity index 100% rename from make/data/cacerts/amazonrootca2 rename to src/java.base/share/data/cacerts/amazonrootca2 diff --git a/make/data/cacerts/amazonrootca3 b/src/java.base/share/data/cacerts/amazonrootca3 similarity index 100% rename from make/data/cacerts/amazonrootca3 rename to src/java.base/share/data/cacerts/amazonrootca3 diff --git a/make/data/cacerts/amazonrootca4 b/src/java.base/share/data/cacerts/amazonrootca4 similarity index 100% rename from make/data/cacerts/amazonrootca4 rename to src/java.base/share/data/cacerts/amazonrootca4 diff --git a/make/data/cacerts/baltimorecybertrustca b/src/java.base/share/data/cacerts/baltimorecybertrustca similarity index 100% rename from make/data/cacerts/baltimorecybertrustca rename to src/java.base/share/data/cacerts/baltimorecybertrustca diff --git a/make/data/cacerts/buypassclass2ca b/src/java.base/share/data/cacerts/buypassclass2ca similarity index 100% rename from make/data/cacerts/buypassclass2ca rename to src/java.base/share/data/cacerts/buypassclass2ca diff --git a/make/data/cacerts/buypassclass3ca b/src/java.base/share/data/cacerts/buypassclass3ca similarity index 100% rename from make/data/cacerts/buypassclass3ca rename to src/java.base/share/data/cacerts/buypassclass3ca diff --git a/make/data/cacerts/camerfirmachambersca b/src/java.base/share/data/cacerts/camerfirmachambersca similarity index 100% rename from make/data/cacerts/camerfirmachambersca rename to src/java.base/share/data/cacerts/camerfirmachambersca diff --git a/make/data/cacerts/camerfirmachamberscommerceca b/src/java.base/share/data/cacerts/camerfirmachamberscommerceca similarity index 100% rename from make/data/cacerts/camerfirmachamberscommerceca rename to src/java.base/share/data/cacerts/camerfirmachamberscommerceca diff --git a/make/data/cacerts/camerfirmachambersignca b/src/java.base/share/data/cacerts/camerfirmachambersignca similarity index 100% rename from make/data/cacerts/camerfirmachambersignca rename to src/java.base/share/data/cacerts/camerfirmachambersignca diff --git a/make/data/cacerts/certumca b/src/java.base/share/data/cacerts/certumca similarity index 100% rename from make/data/cacerts/certumca rename to src/java.base/share/data/cacerts/certumca diff --git a/make/data/cacerts/certumtrustednetworkca b/src/java.base/share/data/cacerts/certumtrustednetworkca similarity index 100% rename from make/data/cacerts/certumtrustednetworkca rename to src/java.base/share/data/cacerts/certumtrustednetworkca diff --git a/make/data/cacerts/chunghwaepkirootca b/src/java.base/share/data/cacerts/chunghwaepkirootca similarity index 100% rename from make/data/cacerts/chunghwaepkirootca rename to src/java.base/share/data/cacerts/chunghwaepkirootca diff --git a/make/data/cacerts/comodoaaaca b/src/java.base/share/data/cacerts/comodoaaaca similarity index 100% rename from make/data/cacerts/comodoaaaca rename to src/java.base/share/data/cacerts/comodoaaaca diff --git a/make/data/cacerts/comodoeccca b/src/java.base/share/data/cacerts/comodoeccca similarity index 100% rename from make/data/cacerts/comodoeccca rename to src/java.base/share/data/cacerts/comodoeccca diff --git a/make/data/cacerts/comodorsaca b/src/java.base/share/data/cacerts/comodorsaca similarity index 100% rename from make/data/cacerts/comodorsaca rename to src/java.base/share/data/cacerts/comodorsaca diff --git a/make/data/cacerts/digicertassuredidg2 b/src/java.base/share/data/cacerts/digicertassuredidg2 similarity index 100% rename from make/data/cacerts/digicertassuredidg2 rename to src/java.base/share/data/cacerts/digicertassuredidg2 diff --git a/make/data/cacerts/digicertassuredidg3 b/src/java.base/share/data/cacerts/digicertassuredidg3 similarity index 100% rename from make/data/cacerts/digicertassuredidg3 rename to src/java.base/share/data/cacerts/digicertassuredidg3 diff --git a/make/data/cacerts/digicertassuredidrootca b/src/java.base/share/data/cacerts/digicertassuredidrootca similarity index 100% rename from make/data/cacerts/digicertassuredidrootca rename to src/java.base/share/data/cacerts/digicertassuredidrootca diff --git a/make/data/cacerts/digicertglobalrootca b/src/java.base/share/data/cacerts/digicertglobalrootca similarity index 100% rename from make/data/cacerts/digicertglobalrootca rename to src/java.base/share/data/cacerts/digicertglobalrootca diff --git a/make/data/cacerts/digicertglobalrootg2 b/src/java.base/share/data/cacerts/digicertglobalrootg2 similarity index 100% rename from make/data/cacerts/digicertglobalrootg2 rename to src/java.base/share/data/cacerts/digicertglobalrootg2 diff --git a/make/data/cacerts/digicertglobalrootg3 b/src/java.base/share/data/cacerts/digicertglobalrootg3 similarity index 100% rename from make/data/cacerts/digicertglobalrootg3 rename to src/java.base/share/data/cacerts/digicertglobalrootg3 diff --git a/make/data/cacerts/digicerthighassuranceevrootca b/src/java.base/share/data/cacerts/digicerthighassuranceevrootca similarity index 100% rename from make/data/cacerts/digicerthighassuranceevrootca rename to src/java.base/share/data/cacerts/digicerthighassuranceevrootca diff --git a/make/data/cacerts/digicerttrustedrootg4 b/src/java.base/share/data/cacerts/digicerttrustedrootg4 similarity index 100% rename from make/data/cacerts/digicerttrustedrootg4 rename to src/java.base/share/data/cacerts/digicerttrustedrootg4 diff --git a/make/data/cacerts/dtrustclass3ca2 b/src/java.base/share/data/cacerts/dtrustclass3ca2 similarity index 100% rename from make/data/cacerts/dtrustclass3ca2 rename to src/java.base/share/data/cacerts/dtrustclass3ca2 diff --git a/make/data/cacerts/dtrustclass3ca2ev b/src/java.base/share/data/cacerts/dtrustclass3ca2ev similarity index 100% rename from make/data/cacerts/dtrustclass3ca2ev rename to src/java.base/share/data/cacerts/dtrustclass3ca2ev diff --git a/make/data/cacerts/entrust2048ca b/src/java.base/share/data/cacerts/entrust2048ca similarity index 100% rename from make/data/cacerts/entrust2048ca rename to src/java.base/share/data/cacerts/entrust2048ca diff --git a/make/data/cacerts/entrustevca b/src/java.base/share/data/cacerts/entrustevca similarity index 100% rename from make/data/cacerts/entrustevca rename to src/java.base/share/data/cacerts/entrustevca diff --git a/make/data/cacerts/entrustrootcaec1 b/src/java.base/share/data/cacerts/entrustrootcaec1 similarity index 100% rename from make/data/cacerts/entrustrootcaec1 rename to src/java.base/share/data/cacerts/entrustrootcaec1 diff --git a/make/data/cacerts/entrustrootcag2 b/src/java.base/share/data/cacerts/entrustrootcag2 similarity index 100% rename from make/data/cacerts/entrustrootcag2 rename to src/java.base/share/data/cacerts/entrustrootcag2 diff --git a/make/data/cacerts/entrustrootcag4 b/src/java.base/share/data/cacerts/entrustrootcag4 similarity index 100% rename from make/data/cacerts/entrustrootcag4 rename to src/java.base/share/data/cacerts/entrustrootcag4 diff --git a/make/data/cacerts/geotrustglobalca b/src/java.base/share/data/cacerts/geotrustglobalca similarity index 100% rename from make/data/cacerts/geotrustglobalca rename to src/java.base/share/data/cacerts/geotrustglobalca diff --git a/make/data/cacerts/geotrustprimaryca b/src/java.base/share/data/cacerts/geotrustprimaryca similarity index 100% rename from make/data/cacerts/geotrustprimaryca rename to src/java.base/share/data/cacerts/geotrustprimaryca diff --git a/make/data/cacerts/geotrustprimarycag2 b/src/java.base/share/data/cacerts/geotrustprimarycag2 similarity index 100% rename from make/data/cacerts/geotrustprimarycag2 rename to src/java.base/share/data/cacerts/geotrustprimarycag2 diff --git a/make/data/cacerts/geotrustprimarycag3 b/src/java.base/share/data/cacerts/geotrustprimarycag3 similarity index 100% rename from make/data/cacerts/geotrustprimarycag3 rename to src/java.base/share/data/cacerts/geotrustprimarycag3 diff --git a/make/data/cacerts/geotrustuniversalca b/src/java.base/share/data/cacerts/geotrustuniversalca similarity index 100% rename from make/data/cacerts/geotrustuniversalca rename to src/java.base/share/data/cacerts/geotrustuniversalca diff --git a/make/data/cacerts/globalsignca b/src/java.base/share/data/cacerts/globalsignca similarity index 100% rename from make/data/cacerts/globalsignca rename to src/java.base/share/data/cacerts/globalsignca diff --git a/make/data/cacerts/globalsigneccrootcar4 b/src/java.base/share/data/cacerts/globalsigneccrootcar4 similarity index 100% rename from make/data/cacerts/globalsigneccrootcar4 rename to src/java.base/share/data/cacerts/globalsigneccrootcar4 diff --git a/make/data/cacerts/globalsigneccrootcar5 b/src/java.base/share/data/cacerts/globalsigneccrootcar5 similarity index 100% rename from make/data/cacerts/globalsigneccrootcar5 rename to src/java.base/share/data/cacerts/globalsigneccrootcar5 diff --git a/make/data/cacerts/globalsignr3ca b/src/java.base/share/data/cacerts/globalsignr3ca similarity index 100% rename from make/data/cacerts/globalsignr3ca rename to src/java.base/share/data/cacerts/globalsignr3ca diff --git a/make/data/cacerts/globalsignrootcar6 b/src/java.base/share/data/cacerts/globalsignrootcar6 similarity index 100% rename from make/data/cacerts/globalsignrootcar6 rename to src/java.base/share/data/cacerts/globalsignrootcar6 diff --git a/make/data/cacerts/godaddyclass2ca b/src/java.base/share/data/cacerts/godaddyclass2ca similarity index 100% rename from make/data/cacerts/godaddyclass2ca rename to src/java.base/share/data/cacerts/godaddyclass2ca diff --git a/make/data/cacerts/godaddyrootg2ca b/src/java.base/share/data/cacerts/godaddyrootg2ca similarity index 100% rename from make/data/cacerts/godaddyrootg2ca rename to src/java.base/share/data/cacerts/godaddyrootg2ca diff --git a/make/data/cacerts/haricaeccrootca2015 b/src/java.base/share/data/cacerts/haricaeccrootca2015 similarity index 100% rename from make/data/cacerts/haricaeccrootca2015 rename to src/java.base/share/data/cacerts/haricaeccrootca2015 diff --git a/make/data/cacerts/haricarootca2015 b/src/java.base/share/data/cacerts/haricarootca2015 similarity index 100% rename from make/data/cacerts/haricarootca2015 rename to src/java.base/share/data/cacerts/haricarootca2015 diff --git a/make/data/cacerts/identrustcommercial b/src/java.base/share/data/cacerts/identrustcommercial similarity index 100% rename from make/data/cacerts/identrustcommercial rename to src/java.base/share/data/cacerts/identrustcommercial diff --git a/make/data/cacerts/identrustpublicca b/src/java.base/share/data/cacerts/identrustpublicca similarity index 100% rename from make/data/cacerts/identrustpublicca rename to src/java.base/share/data/cacerts/identrustpublicca diff --git a/make/data/cacerts/letsencryptisrgx1 b/src/java.base/share/data/cacerts/letsencryptisrgx1 similarity index 100% rename from make/data/cacerts/letsencryptisrgx1 rename to src/java.base/share/data/cacerts/letsencryptisrgx1 diff --git a/make/data/cacerts/luxtrustglobalroot2ca b/src/java.base/share/data/cacerts/luxtrustglobalroot2ca similarity index 100% rename from make/data/cacerts/luxtrustglobalroot2ca rename to src/java.base/share/data/cacerts/luxtrustglobalroot2ca diff --git a/make/data/cacerts/luxtrustglobalrootca b/src/java.base/share/data/cacerts/luxtrustglobalrootca similarity index 100% rename from make/data/cacerts/luxtrustglobalrootca rename to src/java.base/share/data/cacerts/luxtrustglobalrootca diff --git a/make/data/cacerts/quovadisrootca b/src/java.base/share/data/cacerts/quovadisrootca similarity index 100% rename from make/data/cacerts/quovadisrootca rename to src/java.base/share/data/cacerts/quovadisrootca diff --git a/make/data/cacerts/quovadisrootca1g3 b/src/java.base/share/data/cacerts/quovadisrootca1g3 similarity index 100% rename from make/data/cacerts/quovadisrootca1g3 rename to src/java.base/share/data/cacerts/quovadisrootca1g3 diff --git a/make/data/cacerts/quovadisrootca2 b/src/java.base/share/data/cacerts/quovadisrootca2 similarity index 100% rename from make/data/cacerts/quovadisrootca2 rename to src/java.base/share/data/cacerts/quovadisrootca2 diff --git a/make/data/cacerts/quovadisrootca2g3 b/src/java.base/share/data/cacerts/quovadisrootca2g3 similarity index 100% rename from make/data/cacerts/quovadisrootca2g3 rename to src/java.base/share/data/cacerts/quovadisrootca2g3 diff --git a/make/data/cacerts/quovadisrootca3 b/src/java.base/share/data/cacerts/quovadisrootca3 similarity index 100% rename from make/data/cacerts/quovadisrootca3 rename to src/java.base/share/data/cacerts/quovadisrootca3 diff --git a/make/data/cacerts/quovadisrootca3g3 b/src/java.base/share/data/cacerts/quovadisrootca3g3 similarity index 100% rename from make/data/cacerts/quovadisrootca3g3 rename to src/java.base/share/data/cacerts/quovadisrootca3g3 diff --git a/make/data/cacerts/secomscrootca1 b/src/java.base/share/data/cacerts/secomscrootca1 similarity index 100% rename from make/data/cacerts/secomscrootca1 rename to src/java.base/share/data/cacerts/secomscrootca1 diff --git a/make/data/cacerts/secomscrootca2 b/src/java.base/share/data/cacerts/secomscrootca2 similarity index 100% rename from make/data/cacerts/secomscrootca2 rename to src/java.base/share/data/cacerts/secomscrootca2 diff --git a/make/data/cacerts/securetrustca b/src/java.base/share/data/cacerts/securetrustca similarity index 100% rename from make/data/cacerts/securetrustca rename to src/java.base/share/data/cacerts/securetrustca diff --git a/make/data/cacerts/sslrooteccca b/src/java.base/share/data/cacerts/sslrooteccca similarity index 100% rename from make/data/cacerts/sslrooteccca rename to src/java.base/share/data/cacerts/sslrooteccca diff --git a/make/data/cacerts/sslrootevrsaca b/src/java.base/share/data/cacerts/sslrootevrsaca similarity index 100% rename from make/data/cacerts/sslrootevrsaca rename to src/java.base/share/data/cacerts/sslrootevrsaca diff --git a/make/data/cacerts/sslrootrsaca b/src/java.base/share/data/cacerts/sslrootrsaca similarity index 100% rename from make/data/cacerts/sslrootrsaca rename to src/java.base/share/data/cacerts/sslrootrsaca diff --git a/make/data/cacerts/starfieldclass2ca b/src/java.base/share/data/cacerts/starfieldclass2ca similarity index 100% rename from make/data/cacerts/starfieldclass2ca rename to src/java.base/share/data/cacerts/starfieldclass2ca diff --git a/make/data/cacerts/starfieldrootg2ca b/src/java.base/share/data/cacerts/starfieldrootg2ca similarity index 100% rename from make/data/cacerts/starfieldrootg2ca rename to src/java.base/share/data/cacerts/starfieldrootg2ca diff --git a/make/data/cacerts/starfieldservicesrootg2ca b/src/java.base/share/data/cacerts/starfieldservicesrootg2ca similarity index 100% rename from make/data/cacerts/starfieldservicesrootg2ca rename to src/java.base/share/data/cacerts/starfieldservicesrootg2ca diff --git a/make/data/cacerts/swisssigngoldg2ca b/src/java.base/share/data/cacerts/swisssigngoldg2ca similarity index 100% rename from make/data/cacerts/swisssigngoldg2ca rename to src/java.base/share/data/cacerts/swisssigngoldg2ca diff --git a/make/data/cacerts/swisssignplatinumg2ca b/src/java.base/share/data/cacerts/swisssignplatinumg2ca similarity index 100% rename from make/data/cacerts/swisssignplatinumg2ca rename to src/java.base/share/data/cacerts/swisssignplatinumg2ca diff --git a/make/data/cacerts/swisssignsilverg2ca b/src/java.base/share/data/cacerts/swisssignsilverg2ca similarity index 100% rename from make/data/cacerts/swisssignsilverg2ca rename to src/java.base/share/data/cacerts/swisssignsilverg2ca diff --git a/make/data/cacerts/teliasonerarootcav1 b/src/java.base/share/data/cacerts/teliasonerarootcav1 similarity index 100% rename from make/data/cacerts/teliasonerarootcav1 rename to src/java.base/share/data/cacerts/teliasonerarootcav1 diff --git a/make/data/cacerts/thawteprimaryrootca b/src/java.base/share/data/cacerts/thawteprimaryrootca similarity index 100% rename from make/data/cacerts/thawteprimaryrootca rename to src/java.base/share/data/cacerts/thawteprimaryrootca diff --git a/make/data/cacerts/thawteprimaryrootcag2 b/src/java.base/share/data/cacerts/thawteprimaryrootcag2 similarity index 100% rename from make/data/cacerts/thawteprimaryrootcag2 rename to src/java.base/share/data/cacerts/thawteprimaryrootcag2 diff --git a/make/data/cacerts/thawteprimaryrootcag3 b/src/java.base/share/data/cacerts/thawteprimaryrootcag3 similarity index 100% rename from make/data/cacerts/thawteprimaryrootcag3 rename to src/java.base/share/data/cacerts/thawteprimaryrootcag3 diff --git a/make/data/cacerts/ttelesecglobalrootclass2ca b/src/java.base/share/data/cacerts/ttelesecglobalrootclass2ca similarity index 100% rename from make/data/cacerts/ttelesecglobalrootclass2ca rename to src/java.base/share/data/cacerts/ttelesecglobalrootclass2ca diff --git a/make/data/cacerts/ttelesecglobalrootclass3ca b/src/java.base/share/data/cacerts/ttelesecglobalrootclass3ca similarity index 100% rename from make/data/cacerts/ttelesecglobalrootclass3ca rename to src/java.base/share/data/cacerts/ttelesecglobalrootclass3ca diff --git a/make/data/cacerts/usertrusteccca b/src/java.base/share/data/cacerts/usertrusteccca similarity index 100% rename from make/data/cacerts/usertrusteccca rename to src/java.base/share/data/cacerts/usertrusteccca diff --git a/make/data/cacerts/usertrustrsaca b/src/java.base/share/data/cacerts/usertrustrsaca similarity index 100% rename from make/data/cacerts/usertrustrsaca rename to src/java.base/share/data/cacerts/usertrustrsaca diff --git a/make/data/cacerts/utnuserfirstobjectca b/src/java.base/share/data/cacerts/utnuserfirstobjectca similarity index 100% rename from make/data/cacerts/utnuserfirstobjectca rename to src/java.base/share/data/cacerts/utnuserfirstobjectca diff --git a/make/data/cacerts/verisignclass3g3ca b/src/java.base/share/data/cacerts/verisignclass3g3ca similarity index 100% rename from make/data/cacerts/verisignclass3g3ca rename to src/java.base/share/data/cacerts/verisignclass3g3ca diff --git a/make/data/cacerts/verisignclass3g4ca b/src/java.base/share/data/cacerts/verisignclass3g4ca similarity index 100% rename from make/data/cacerts/verisignclass3g4ca rename to src/java.base/share/data/cacerts/verisignclass3g4ca diff --git a/make/data/cacerts/verisignclass3g5ca b/src/java.base/share/data/cacerts/verisignclass3g5ca similarity index 100% rename from make/data/cacerts/verisignclass3g5ca rename to src/java.base/share/data/cacerts/verisignclass3g5ca diff --git a/make/data/cacerts/verisignuniversalrootca b/src/java.base/share/data/cacerts/verisignuniversalrootca similarity index 100% rename from make/data/cacerts/verisignuniversalrootca rename to src/java.base/share/data/cacerts/verisignuniversalrootca diff --git a/make/data/cacerts/xrampglobalca b/src/java.base/share/data/cacerts/xrampglobalca similarity index 100% rename from make/data/cacerts/xrampglobalca rename to src/java.base/share/data/cacerts/xrampglobalca diff --git a/make/data/currency/CurrencyData.properties b/src/java.base/share/data/currency/CurrencyData.properties similarity index 100% rename from make/data/currency/CurrencyData.properties rename to src/java.base/share/data/currency/CurrencyData.properties diff --git a/make/data/lsrdata/language-subtag-registry.txt b/src/java.base/share/data/lsrdata/language-subtag-registry.txt similarity index 100% rename from make/data/lsrdata/language-subtag-registry.txt rename to src/java.base/share/data/lsrdata/language-subtag-registry.txt diff --git a/make/data/publicsuffixlist/VERSION b/src/java.base/share/data/publicsuffixlist/VERSION similarity index 100% rename from make/data/publicsuffixlist/VERSION rename to src/java.base/share/data/publicsuffixlist/VERSION diff --git a/make/data/publicsuffixlist/public_suffix_list.dat b/src/java.base/share/data/publicsuffixlist/public_suffix_list.dat similarity index 100% rename from make/data/publicsuffixlist/public_suffix_list.dat rename to src/java.base/share/data/publicsuffixlist/public_suffix_list.dat diff --git a/make/data/tzdata/VERSION b/src/java.base/share/data/tzdata/VERSION similarity index 100% rename from make/data/tzdata/VERSION rename to src/java.base/share/data/tzdata/VERSION diff --git a/make/data/tzdata/africa b/src/java.base/share/data/tzdata/africa similarity index 100% rename from make/data/tzdata/africa rename to src/java.base/share/data/tzdata/africa diff --git a/make/data/tzdata/antarctica b/src/java.base/share/data/tzdata/antarctica similarity index 100% rename from make/data/tzdata/antarctica rename to src/java.base/share/data/tzdata/antarctica diff --git a/make/data/tzdata/asia b/src/java.base/share/data/tzdata/asia similarity index 100% rename from make/data/tzdata/asia rename to src/java.base/share/data/tzdata/asia diff --git a/make/data/tzdata/australasia b/src/java.base/share/data/tzdata/australasia similarity index 100% rename from make/data/tzdata/australasia rename to src/java.base/share/data/tzdata/australasia diff --git a/make/data/tzdata/backward b/src/java.base/share/data/tzdata/backward similarity index 100% rename from make/data/tzdata/backward rename to src/java.base/share/data/tzdata/backward diff --git a/make/data/tzdata/etcetera b/src/java.base/share/data/tzdata/etcetera similarity index 100% rename from make/data/tzdata/etcetera rename to src/java.base/share/data/tzdata/etcetera diff --git a/make/data/tzdata/europe b/src/java.base/share/data/tzdata/europe similarity index 100% rename from make/data/tzdata/europe rename to src/java.base/share/data/tzdata/europe diff --git a/make/data/tzdata/factory b/src/java.base/share/data/tzdata/factory similarity index 100% rename from make/data/tzdata/factory rename to src/java.base/share/data/tzdata/factory diff --git a/make/data/tzdata/gmt b/src/java.base/share/data/tzdata/gmt similarity index 100% rename from make/data/tzdata/gmt rename to src/java.base/share/data/tzdata/gmt diff --git a/make/data/tzdata/iso3166.tab b/src/java.base/share/data/tzdata/iso3166.tab similarity index 100% rename from make/data/tzdata/iso3166.tab rename to src/java.base/share/data/tzdata/iso3166.tab diff --git a/make/data/tzdata/jdk11_backward b/src/java.base/share/data/tzdata/jdk11_backward similarity index 100% rename from make/data/tzdata/jdk11_backward rename to src/java.base/share/data/tzdata/jdk11_backward diff --git a/make/data/tzdata/leapseconds b/src/java.base/share/data/tzdata/leapseconds similarity index 100% rename from make/data/tzdata/leapseconds rename to src/java.base/share/data/tzdata/leapseconds diff --git a/make/data/tzdata/northamerica b/src/java.base/share/data/tzdata/northamerica similarity index 100% rename from make/data/tzdata/northamerica rename to src/java.base/share/data/tzdata/northamerica diff --git a/make/data/tzdata/solar87 b/src/java.base/share/data/tzdata/solar87 similarity index 100% rename from make/data/tzdata/solar87 rename to src/java.base/share/data/tzdata/solar87 diff --git a/make/data/tzdata/solar88 b/src/java.base/share/data/tzdata/solar88 similarity index 100% rename from make/data/tzdata/solar88 rename to src/java.base/share/data/tzdata/solar88 diff --git a/make/data/tzdata/solar89 b/src/java.base/share/data/tzdata/solar89 similarity index 100% rename from make/data/tzdata/solar89 rename to src/java.base/share/data/tzdata/solar89 diff --git a/make/data/tzdata/southamerica b/src/java.base/share/data/tzdata/southamerica similarity index 100% rename from make/data/tzdata/southamerica rename to src/java.base/share/data/tzdata/southamerica diff --git a/make/data/tzdata/zone.tab b/src/java.base/share/data/tzdata/zone.tab similarity index 100% rename from make/data/tzdata/zone.tab rename to src/java.base/share/data/tzdata/zone.tab diff --git a/make/data/unicodedata/Blocks.txt b/src/java.base/share/data/unicodedata/Blocks.txt similarity index 100% rename from make/data/unicodedata/Blocks.txt rename to src/java.base/share/data/unicodedata/Blocks.txt diff --git a/make/data/unicodedata/DerivedCoreProperties.txt b/src/java.base/share/data/unicodedata/DerivedCoreProperties.txt similarity index 100% rename from make/data/unicodedata/DerivedCoreProperties.txt rename to src/java.base/share/data/unicodedata/DerivedCoreProperties.txt diff --git a/make/data/unicodedata/NormalizationTest.txt b/src/java.base/share/data/unicodedata/NormalizationTest.txt similarity index 100% rename from make/data/unicodedata/NormalizationTest.txt rename to src/java.base/share/data/unicodedata/NormalizationTest.txt diff --git a/make/data/unicodedata/PropList.txt b/src/java.base/share/data/unicodedata/PropList.txt similarity index 100% rename from make/data/unicodedata/PropList.txt rename to src/java.base/share/data/unicodedata/PropList.txt diff --git a/make/data/unicodedata/PropertyValueAliases.txt b/src/java.base/share/data/unicodedata/PropertyValueAliases.txt similarity index 100% rename from make/data/unicodedata/PropertyValueAliases.txt rename to src/java.base/share/data/unicodedata/PropertyValueAliases.txt diff --git a/make/data/unicodedata/ReadMe.txt b/src/java.base/share/data/unicodedata/ReadMe.txt similarity index 100% rename from make/data/unicodedata/ReadMe.txt rename to src/java.base/share/data/unicodedata/ReadMe.txt diff --git a/make/data/unicodedata/Scripts.txt b/src/java.base/share/data/unicodedata/Scripts.txt similarity index 100% rename from make/data/unicodedata/Scripts.txt rename to src/java.base/share/data/unicodedata/Scripts.txt diff --git a/make/data/unicodedata/SpecialCasing.txt b/src/java.base/share/data/unicodedata/SpecialCasing.txt similarity index 100% rename from make/data/unicodedata/SpecialCasing.txt rename to src/java.base/share/data/unicodedata/SpecialCasing.txt diff --git a/make/data/unicodedata/UnicodeData.txt b/src/java.base/share/data/unicodedata/UnicodeData.txt similarity index 100% rename from make/data/unicodedata/UnicodeData.txt rename to src/java.base/share/data/unicodedata/UnicodeData.txt diff --git a/make/data/unicodedata/auxiliary/GraphemeBreakProperty.txt b/src/java.base/share/data/unicodedata/auxiliary/GraphemeBreakProperty.txt similarity index 100% rename from make/data/unicodedata/auxiliary/GraphemeBreakProperty.txt rename to src/java.base/share/data/unicodedata/auxiliary/GraphemeBreakProperty.txt diff --git a/make/data/unicodedata/auxiliary/GraphemeBreakTest.txt b/src/java.base/share/data/unicodedata/auxiliary/GraphemeBreakTest.txt similarity index 100% rename from make/data/unicodedata/auxiliary/GraphemeBreakTest.txt rename to src/java.base/share/data/unicodedata/auxiliary/GraphemeBreakTest.txt diff --git a/make/data/unicodedata/emoji/emoji-data.txt b/src/java.base/share/data/unicodedata/emoji/emoji-data.txt similarity index 100% rename from make/data/unicodedata/emoji/emoji-data.txt rename to src/java.base/share/data/unicodedata/emoji/emoji-data.txt diff --git a/make/data/fontconfig/aix.fontconfig.properties b/src/java.desktop/aix/data/fontconfig/fontconfig.properties similarity index 100% rename from make/data/fontconfig/aix.fontconfig.properties rename to src/java.desktop/aix/data/fontconfig/fontconfig.properties diff --git a/make/data/fontconfig/bsd.fontconfig.properties b/src/java.desktop/bsd/data/fontconfig/fontconfig.properties similarity index 100% rename from make/data/fontconfig/bsd.fontconfig.properties rename to src/java.desktop/bsd/data/fontconfig/fontconfig.properties diff --git a/make/data/fontconfig/macosx.fontconfig.properties b/src/java.desktop/macosx/data/fontconfig/fontconfig.properties similarity index 100% rename from make/data/fontconfig/macosx.fontconfig.properties rename to src/java.desktop/macosx/data/fontconfig/fontconfig.properties diff --git a/make/data/macosxicons/JavaApp.icns b/src/java.desktop/macosx/data/macosxicons/JavaApp.icns similarity index 100% rename from make/data/macosxicons/JavaApp.icns rename to src/java.desktop/macosx/data/macosxicons/JavaApp.icns diff --git a/make/data/dtdbuilder/HTMLlat1.sgml b/src/java.desktop/share/data/dtdbuilder/HTMLlat1.sgml similarity index 100% rename from make/data/dtdbuilder/HTMLlat1.sgml rename to src/java.desktop/share/data/dtdbuilder/HTMLlat1.sgml diff --git a/make/data/dtdbuilder/HTMLspecial.sgml b/src/java.desktop/share/data/dtdbuilder/HTMLspecial.sgml similarity index 100% rename from make/data/dtdbuilder/HTMLspecial.sgml rename to src/java.desktop/share/data/dtdbuilder/HTMLspecial.sgml diff --git a/make/data/dtdbuilder/HTMLsymbol.sgml b/src/java.desktop/share/data/dtdbuilder/HTMLsymbol.sgml similarity index 100% rename from make/data/dtdbuilder/HTMLsymbol.sgml rename to src/java.desktop/share/data/dtdbuilder/HTMLsymbol.sgml diff --git a/make/data/dtdbuilder/html32.dtd b/src/java.desktop/share/data/dtdbuilder/html32.dtd similarity index 100% rename from make/data/dtdbuilder/html32.dtd rename to src/java.desktop/share/data/dtdbuilder/html32.dtd diff --git a/make/data/dtdbuilder/public.map b/src/java.desktop/share/data/dtdbuilder/public.map similarity index 100% rename from make/data/dtdbuilder/public.map rename to src/java.desktop/share/data/dtdbuilder/public.map diff --git a/make/data/x11wrappergen/sizes-32.txt b/src/java.desktop/unix/data/x11wrappergen/sizes-32.txt similarity index 100% rename from make/data/x11wrappergen/sizes-32.txt rename to src/java.desktop/unix/data/x11wrappergen/sizes-32.txt diff --git a/make/data/x11wrappergen/sizes-64.txt b/src/java.desktop/unix/data/x11wrappergen/sizes-64.txt similarity index 100% rename from make/data/x11wrappergen/sizes-64.txt rename to src/java.desktop/unix/data/x11wrappergen/sizes-64.txt diff --git a/make/data/x11wrappergen/xlibtypes.txt b/src/java.desktop/unix/data/x11wrappergen/xlibtypes.txt similarity index 100% rename from make/data/x11wrappergen/xlibtypes.txt rename to src/java.desktop/unix/data/x11wrappergen/xlibtypes.txt diff --git a/make/data/fontconfig/windows.fontconfig.properties b/src/java.desktop/windows/data/fontconfig/fontconfig.properties similarity index 100% rename from make/data/fontconfig/windows.fontconfig.properties rename to src/java.desktop/windows/data/fontconfig/fontconfig.properties diff --git a/make/data/jdwp/jdwp.spec b/src/java.se/share/data/jdwp/jdwp.spec similarity index 100% rename from make/data/jdwp/jdwp.spec rename to src/java.se/share/data/jdwp/jdwp.spec diff --git a/make/data/symbols/README b/src/jdk.compiler/share/data/symbols/README similarity index 100% rename from make/data/symbols/README rename to src/jdk.compiler/share/data/symbols/README diff --git a/make/data/symbols/include.list b/src/jdk.compiler/share/data/symbols/include.list similarity index 100% rename from make/data/symbols/include.list rename to src/jdk.compiler/share/data/symbols/include.list diff --git a/make/data/symbols/java.activation-8.sym.txt b/src/jdk.compiler/share/data/symbols/java.activation-8.sym.txt similarity index 100% rename from make/data/symbols/java.activation-8.sym.txt rename to src/jdk.compiler/share/data/symbols/java.activation-8.sym.txt diff --git a/make/data/symbols/java.activation-9.sym.txt b/src/jdk.compiler/share/data/symbols/java.activation-9.sym.txt similarity index 100% rename from make/data/symbols/java.activation-9.sym.txt rename to src/jdk.compiler/share/data/symbols/java.activation-9.sym.txt diff --git a/make/data/symbols/java.activation-A.sym.txt b/src/jdk.compiler/share/data/symbols/java.activation-A.sym.txt similarity index 100% rename from make/data/symbols/java.activation-A.sym.txt rename to src/jdk.compiler/share/data/symbols/java.activation-A.sym.txt diff --git a/make/data/symbols/java.activation-B.sym.txt b/src/jdk.compiler/share/data/symbols/java.activation-B.sym.txt similarity index 100% rename from make/data/symbols/java.activation-B.sym.txt rename to src/jdk.compiler/share/data/symbols/java.activation-B.sym.txt diff --git a/make/data/symbols/java.base-7.sym.txt b/src/jdk.compiler/share/data/symbols/java.base-7.sym.txt similarity index 100% rename from make/data/symbols/java.base-7.sym.txt rename to src/jdk.compiler/share/data/symbols/java.base-7.sym.txt diff --git a/make/data/symbols/java.base-8.sym.txt b/src/jdk.compiler/share/data/symbols/java.base-8.sym.txt similarity index 100% rename from make/data/symbols/java.base-8.sym.txt rename to src/jdk.compiler/share/data/symbols/java.base-8.sym.txt diff --git a/make/data/symbols/java.base-9.sym.txt b/src/jdk.compiler/share/data/symbols/java.base-9.sym.txt similarity index 100% rename from make/data/symbols/java.base-9.sym.txt rename to src/jdk.compiler/share/data/symbols/java.base-9.sym.txt diff --git a/make/data/symbols/java.base-A.sym.txt b/src/jdk.compiler/share/data/symbols/java.base-A.sym.txt similarity index 100% rename from make/data/symbols/java.base-A.sym.txt rename to src/jdk.compiler/share/data/symbols/java.base-A.sym.txt diff --git a/make/data/symbols/java.base-B.sym.txt b/src/jdk.compiler/share/data/symbols/java.base-B.sym.txt similarity index 100% rename from make/data/symbols/java.base-B.sym.txt rename to src/jdk.compiler/share/data/symbols/java.base-B.sym.txt diff --git a/make/data/symbols/java.base-C.sym.txt b/src/jdk.compiler/share/data/symbols/java.base-C.sym.txt similarity index 100% rename from make/data/symbols/java.base-C.sym.txt rename to src/jdk.compiler/share/data/symbols/java.base-C.sym.txt diff --git a/make/data/symbols/java.base-D.sym.txt b/src/jdk.compiler/share/data/symbols/java.base-D.sym.txt similarity index 100% rename from make/data/symbols/java.base-D.sym.txt rename to src/jdk.compiler/share/data/symbols/java.base-D.sym.txt diff --git a/make/data/symbols/java.base-E.sym.txt b/src/jdk.compiler/share/data/symbols/java.base-E.sym.txt similarity index 100% rename from make/data/symbols/java.base-E.sym.txt rename to src/jdk.compiler/share/data/symbols/java.base-E.sym.txt diff --git a/make/data/symbols/java.base-F.sym.txt b/src/jdk.compiler/share/data/symbols/java.base-F.sym.txt similarity index 100% rename from make/data/symbols/java.base-F.sym.txt rename to src/jdk.compiler/share/data/symbols/java.base-F.sym.txt diff --git a/make/data/symbols/java.base-G.sym.txt b/src/jdk.compiler/share/data/symbols/java.base-G.sym.txt similarity index 100% rename from make/data/symbols/java.base-G.sym.txt rename to src/jdk.compiler/share/data/symbols/java.base-G.sym.txt diff --git a/make/data/symbols/java.base-H.sym.txt b/src/jdk.compiler/share/data/symbols/java.base-H.sym.txt similarity index 100% rename from make/data/symbols/java.base-H.sym.txt rename to src/jdk.compiler/share/data/symbols/java.base-H.sym.txt diff --git a/make/data/symbols/java.base-I.sym.txt b/src/jdk.compiler/share/data/symbols/java.base-I.sym.txt similarity index 100% rename from make/data/symbols/java.base-I.sym.txt rename to src/jdk.compiler/share/data/symbols/java.base-I.sym.txt diff --git a/make/data/symbols/java.compiler-7.sym.txt b/src/jdk.compiler/share/data/symbols/java.compiler-7.sym.txt similarity index 100% rename from make/data/symbols/java.compiler-7.sym.txt rename to src/jdk.compiler/share/data/symbols/java.compiler-7.sym.txt diff --git a/make/data/symbols/java.compiler-8.sym.txt b/src/jdk.compiler/share/data/symbols/java.compiler-8.sym.txt similarity index 100% rename from make/data/symbols/java.compiler-8.sym.txt rename to src/jdk.compiler/share/data/symbols/java.compiler-8.sym.txt diff --git a/make/data/symbols/java.compiler-9.sym.txt b/src/jdk.compiler/share/data/symbols/java.compiler-9.sym.txt similarity index 100% rename from make/data/symbols/java.compiler-9.sym.txt rename to src/jdk.compiler/share/data/symbols/java.compiler-9.sym.txt diff --git a/make/data/symbols/java.compiler-A.sym.txt b/src/jdk.compiler/share/data/symbols/java.compiler-A.sym.txt similarity index 100% rename from make/data/symbols/java.compiler-A.sym.txt rename to src/jdk.compiler/share/data/symbols/java.compiler-A.sym.txt diff --git a/make/data/symbols/java.compiler-B.sym.txt b/src/jdk.compiler/share/data/symbols/java.compiler-B.sym.txt similarity index 100% rename from make/data/symbols/java.compiler-B.sym.txt rename to src/jdk.compiler/share/data/symbols/java.compiler-B.sym.txt diff --git a/make/data/symbols/java.compiler-C.sym.txt b/src/jdk.compiler/share/data/symbols/java.compiler-C.sym.txt similarity index 100% rename from make/data/symbols/java.compiler-C.sym.txt rename to src/jdk.compiler/share/data/symbols/java.compiler-C.sym.txt diff --git a/make/data/symbols/java.compiler-D.sym.txt b/src/jdk.compiler/share/data/symbols/java.compiler-D.sym.txt similarity index 100% rename from make/data/symbols/java.compiler-D.sym.txt rename to src/jdk.compiler/share/data/symbols/java.compiler-D.sym.txt diff --git a/make/data/symbols/java.compiler-E.sym.txt b/src/jdk.compiler/share/data/symbols/java.compiler-E.sym.txt similarity index 100% rename from make/data/symbols/java.compiler-E.sym.txt rename to src/jdk.compiler/share/data/symbols/java.compiler-E.sym.txt diff --git a/make/data/symbols/java.compiler-F.sym.txt b/src/jdk.compiler/share/data/symbols/java.compiler-F.sym.txt similarity index 100% rename from make/data/symbols/java.compiler-F.sym.txt rename to src/jdk.compiler/share/data/symbols/java.compiler-F.sym.txt diff --git a/make/data/symbols/java.compiler-G.sym.txt b/src/jdk.compiler/share/data/symbols/java.compiler-G.sym.txt similarity index 100% rename from make/data/symbols/java.compiler-G.sym.txt rename to src/jdk.compiler/share/data/symbols/java.compiler-G.sym.txt diff --git a/make/data/symbols/java.compiler-H.sym.txt b/src/jdk.compiler/share/data/symbols/java.compiler-H.sym.txt similarity index 100% rename from make/data/symbols/java.compiler-H.sym.txt rename to src/jdk.compiler/share/data/symbols/java.compiler-H.sym.txt diff --git a/make/data/symbols/java.compiler-I.sym.txt b/src/jdk.compiler/share/data/symbols/java.compiler-I.sym.txt similarity index 100% rename from make/data/symbols/java.compiler-I.sym.txt rename to src/jdk.compiler/share/data/symbols/java.compiler-I.sym.txt diff --git a/make/data/symbols/java.corba-8.sym.txt b/src/jdk.compiler/share/data/symbols/java.corba-8.sym.txt similarity index 100% rename from make/data/symbols/java.corba-8.sym.txt rename to src/jdk.compiler/share/data/symbols/java.corba-8.sym.txt diff --git a/make/data/symbols/java.corba-9.sym.txt b/src/jdk.compiler/share/data/symbols/java.corba-9.sym.txt similarity index 100% rename from make/data/symbols/java.corba-9.sym.txt rename to src/jdk.compiler/share/data/symbols/java.corba-9.sym.txt diff --git a/make/data/symbols/java.corba-A.sym.txt b/src/jdk.compiler/share/data/symbols/java.corba-A.sym.txt similarity index 100% rename from make/data/symbols/java.corba-A.sym.txt rename to src/jdk.compiler/share/data/symbols/java.corba-A.sym.txt diff --git a/make/data/symbols/java.corba-B.sym.txt b/src/jdk.compiler/share/data/symbols/java.corba-B.sym.txt similarity index 100% rename from make/data/symbols/java.corba-B.sym.txt rename to src/jdk.compiler/share/data/symbols/java.corba-B.sym.txt diff --git a/make/data/symbols/java.datatransfer-7.sym.txt b/src/jdk.compiler/share/data/symbols/java.datatransfer-7.sym.txt similarity index 100% rename from make/data/symbols/java.datatransfer-7.sym.txt rename to src/jdk.compiler/share/data/symbols/java.datatransfer-7.sym.txt diff --git a/make/data/symbols/java.datatransfer-8.sym.txt b/src/jdk.compiler/share/data/symbols/java.datatransfer-8.sym.txt similarity index 100% rename from make/data/symbols/java.datatransfer-8.sym.txt rename to src/jdk.compiler/share/data/symbols/java.datatransfer-8.sym.txt diff --git a/make/data/symbols/java.datatransfer-9.sym.txt b/src/jdk.compiler/share/data/symbols/java.datatransfer-9.sym.txt similarity index 100% rename from make/data/symbols/java.datatransfer-9.sym.txt rename to src/jdk.compiler/share/data/symbols/java.datatransfer-9.sym.txt diff --git a/make/data/symbols/java.datatransfer-A.sym.txt b/src/jdk.compiler/share/data/symbols/java.datatransfer-A.sym.txt similarity index 100% rename from make/data/symbols/java.datatransfer-A.sym.txt rename to src/jdk.compiler/share/data/symbols/java.datatransfer-A.sym.txt diff --git a/make/data/symbols/java.datatransfer-B.sym.txt b/src/jdk.compiler/share/data/symbols/java.datatransfer-B.sym.txt similarity index 100% rename from make/data/symbols/java.datatransfer-B.sym.txt rename to src/jdk.compiler/share/data/symbols/java.datatransfer-B.sym.txt diff --git a/make/data/symbols/java.datatransfer-G.sym.txt b/src/jdk.compiler/share/data/symbols/java.datatransfer-G.sym.txt similarity index 100% rename from make/data/symbols/java.datatransfer-G.sym.txt rename to src/jdk.compiler/share/data/symbols/java.datatransfer-G.sym.txt diff --git a/make/data/symbols/java.datatransfer-H.sym.txt b/src/jdk.compiler/share/data/symbols/java.datatransfer-H.sym.txt similarity index 100% rename from make/data/symbols/java.datatransfer-H.sym.txt rename to src/jdk.compiler/share/data/symbols/java.datatransfer-H.sym.txt diff --git a/make/data/symbols/java.datatransfer-I.sym.txt b/src/jdk.compiler/share/data/symbols/java.datatransfer-I.sym.txt similarity index 100% rename from make/data/symbols/java.datatransfer-I.sym.txt rename to src/jdk.compiler/share/data/symbols/java.datatransfer-I.sym.txt diff --git a/make/data/symbols/java.desktop-7.sym.txt b/src/jdk.compiler/share/data/symbols/java.desktop-7.sym.txt similarity index 100% rename from make/data/symbols/java.desktop-7.sym.txt rename to src/jdk.compiler/share/data/symbols/java.desktop-7.sym.txt diff --git a/make/data/symbols/java.desktop-8.sym.txt b/src/jdk.compiler/share/data/symbols/java.desktop-8.sym.txt similarity index 100% rename from make/data/symbols/java.desktop-8.sym.txt rename to src/jdk.compiler/share/data/symbols/java.desktop-8.sym.txt diff --git a/make/data/symbols/java.desktop-9.sym.txt b/src/jdk.compiler/share/data/symbols/java.desktop-9.sym.txt similarity index 100% rename from make/data/symbols/java.desktop-9.sym.txt rename to src/jdk.compiler/share/data/symbols/java.desktop-9.sym.txt diff --git a/make/data/symbols/java.desktop-A.sym.txt b/src/jdk.compiler/share/data/symbols/java.desktop-A.sym.txt similarity index 100% rename from make/data/symbols/java.desktop-A.sym.txt rename to src/jdk.compiler/share/data/symbols/java.desktop-A.sym.txt diff --git a/make/data/symbols/java.desktop-B.sym.txt b/src/jdk.compiler/share/data/symbols/java.desktop-B.sym.txt similarity index 100% rename from make/data/symbols/java.desktop-B.sym.txt rename to src/jdk.compiler/share/data/symbols/java.desktop-B.sym.txt diff --git a/make/data/symbols/java.desktop-C.sym.txt b/src/jdk.compiler/share/data/symbols/java.desktop-C.sym.txt similarity index 100% rename from make/data/symbols/java.desktop-C.sym.txt rename to src/jdk.compiler/share/data/symbols/java.desktop-C.sym.txt diff --git a/make/data/symbols/java.desktop-D.sym.txt b/src/jdk.compiler/share/data/symbols/java.desktop-D.sym.txt similarity index 100% rename from make/data/symbols/java.desktop-D.sym.txt rename to src/jdk.compiler/share/data/symbols/java.desktop-D.sym.txt diff --git a/make/data/symbols/java.desktop-E.sym.txt b/src/jdk.compiler/share/data/symbols/java.desktop-E.sym.txt similarity index 100% rename from make/data/symbols/java.desktop-E.sym.txt rename to src/jdk.compiler/share/data/symbols/java.desktop-E.sym.txt diff --git a/make/data/symbols/java.desktop-F.sym.txt b/src/jdk.compiler/share/data/symbols/java.desktop-F.sym.txt similarity index 100% rename from make/data/symbols/java.desktop-F.sym.txt rename to src/jdk.compiler/share/data/symbols/java.desktop-F.sym.txt diff --git a/make/data/symbols/java.desktop-G.sym.txt b/src/jdk.compiler/share/data/symbols/java.desktop-G.sym.txt similarity index 100% rename from make/data/symbols/java.desktop-G.sym.txt rename to src/jdk.compiler/share/data/symbols/java.desktop-G.sym.txt diff --git a/make/data/symbols/java.desktop-H.sym.txt b/src/jdk.compiler/share/data/symbols/java.desktop-H.sym.txt similarity index 100% rename from make/data/symbols/java.desktop-H.sym.txt rename to src/jdk.compiler/share/data/symbols/java.desktop-H.sym.txt diff --git a/make/data/symbols/java.desktop-I.sym.txt b/src/jdk.compiler/share/data/symbols/java.desktop-I.sym.txt similarity index 100% rename from make/data/symbols/java.desktop-I.sym.txt rename to src/jdk.compiler/share/data/symbols/java.desktop-I.sym.txt diff --git a/make/data/symbols/java.instrument-8.sym.txt b/src/jdk.compiler/share/data/symbols/java.instrument-8.sym.txt similarity index 100% rename from make/data/symbols/java.instrument-8.sym.txt rename to src/jdk.compiler/share/data/symbols/java.instrument-8.sym.txt diff --git a/make/data/symbols/java.instrument-9.sym.txt b/src/jdk.compiler/share/data/symbols/java.instrument-9.sym.txt similarity index 100% rename from make/data/symbols/java.instrument-9.sym.txt rename to src/jdk.compiler/share/data/symbols/java.instrument-9.sym.txt diff --git a/make/data/symbols/java.instrument-A.sym.txt b/src/jdk.compiler/share/data/symbols/java.instrument-A.sym.txt similarity index 100% rename from make/data/symbols/java.instrument-A.sym.txt rename to src/jdk.compiler/share/data/symbols/java.instrument-A.sym.txt diff --git a/make/data/symbols/java.instrument-B.sym.txt b/src/jdk.compiler/share/data/symbols/java.instrument-B.sym.txt similarity index 100% rename from make/data/symbols/java.instrument-B.sym.txt rename to src/jdk.compiler/share/data/symbols/java.instrument-B.sym.txt diff --git a/make/data/symbols/java.instrument-G.sym.txt b/src/jdk.compiler/share/data/symbols/java.instrument-G.sym.txt similarity index 100% rename from make/data/symbols/java.instrument-G.sym.txt rename to src/jdk.compiler/share/data/symbols/java.instrument-G.sym.txt diff --git a/make/data/symbols/java.instrument-H.sym.txt b/src/jdk.compiler/share/data/symbols/java.instrument-H.sym.txt similarity index 100% rename from make/data/symbols/java.instrument-H.sym.txt rename to src/jdk.compiler/share/data/symbols/java.instrument-H.sym.txt diff --git a/make/data/symbols/java.instrument-I.sym.txt b/src/jdk.compiler/share/data/symbols/java.instrument-I.sym.txt similarity index 100% rename from make/data/symbols/java.instrument-I.sym.txt rename to src/jdk.compiler/share/data/symbols/java.instrument-I.sym.txt diff --git a/make/data/symbols/java.logging-7.sym.txt b/src/jdk.compiler/share/data/symbols/java.logging-7.sym.txt similarity index 100% rename from make/data/symbols/java.logging-7.sym.txt rename to src/jdk.compiler/share/data/symbols/java.logging-7.sym.txt diff --git a/make/data/symbols/java.logging-8.sym.txt b/src/jdk.compiler/share/data/symbols/java.logging-8.sym.txt similarity index 100% rename from make/data/symbols/java.logging-8.sym.txt rename to src/jdk.compiler/share/data/symbols/java.logging-8.sym.txt diff --git a/make/data/symbols/java.logging-9.sym.txt b/src/jdk.compiler/share/data/symbols/java.logging-9.sym.txt similarity index 100% rename from make/data/symbols/java.logging-9.sym.txt rename to src/jdk.compiler/share/data/symbols/java.logging-9.sym.txt diff --git a/make/data/symbols/java.logging-A.sym.txt b/src/jdk.compiler/share/data/symbols/java.logging-A.sym.txt similarity index 100% rename from make/data/symbols/java.logging-A.sym.txt rename to src/jdk.compiler/share/data/symbols/java.logging-A.sym.txt diff --git a/make/data/symbols/java.logging-B.sym.txt b/src/jdk.compiler/share/data/symbols/java.logging-B.sym.txt similarity index 100% rename from make/data/symbols/java.logging-B.sym.txt rename to src/jdk.compiler/share/data/symbols/java.logging-B.sym.txt diff --git a/make/data/symbols/java.logging-G.sym.txt b/src/jdk.compiler/share/data/symbols/java.logging-G.sym.txt similarity index 100% rename from make/data/symbols/java.logging-G.sym.txt rename to src/jdk.compiler/share/data/symbols/java.logging-G.sym.txt diff --git a/make/data/symbols/java.logging-H.sym.txt b/src/jdk.compiler/share/data/symbols/java.logging-H.sym.txt similarity index 100% rename from make/data/symbols/java.logging-H.sym.txt rename to src/jdk.compiler/share/data/symbols/java.logging-H.sym.txt diff --git a/make/data/symbols/java.logging-I.sym.txt b/src/jdk.compiler/share/data/symbols/java.logging-I.sym.txt similarity index 100% rename from make/data/symbols/java.logging-I.sym.txt rename to src/jdk.compiler/share/data/symbols/java.logging-I.sym.txt diff --git a/make/data/symbols/java.management-7.sym.txt b/src/jdk.compiler/share/data/symbols/java.management-7.sym.txt similarity index 100% rename from make/data/symbols/java.management-7.sym.txt rename to src/jdk.compiler/share/data/symbols/java.management-7.sym.txt diff --git a/make/data/symbols/java.management-8.sym.txt b/src/jdk.compiler/share/data/symbols/java.management-8.sym.txt similarity index 100% rename from make/data/symbols/java.management-8.sym.txt rename to src/jdk.compiler/share/data/symbols/java.management-8.sym.txt diff --git a/make/data/symbols/java.management-9.sym.txt b/src/jdk.compiler/share/data/symbols/java.management-9.sym.txt similarity index 100% rename from make/data/symbols/java.management-9.sym.txt rename to src/jdk.compiler/share/data/symbols/java.management-9.sym.txt diff --git a/make/data/symbols/java.management-A.sym.txt b/src/jdk.compiler/share/data/symbols/java.management-A.sym.txt similarity index 100% rename from make/data/symbols/java.management-A.sym.txt rename to src/jdk.compiler/share/data/symbols/java.management-A.sym.txt diff --git a/make/data/symbols/java.management-B.sym.txt b/src/jdk.compiler/share/data/symbols/java.management-B.sym.txt similarity index 100% rename from make/data/symbols/java.management-B.sym.txt rename to src/jdk.compiler/share/data/symbols/java.management-B.sym.txt diff --git a/make/data/symbols/java.management-D.sym.txt b/src/jdk.compiler/share/data/symbols/java.management-D.sym.txt similarity index 100% rename from make/data/symbols/java.management-D.sym.txt rename to src/jdk.compiler/share/data/symbols/java.management-D.sym.txt diff --git a/make/data/symbols/java.management-G.sym.txt b/src/jdk.compiler/share/data/symbols/java.management-G.sym.txt similarity index 100% rename from make/data/symbols/java.management-G.sym.txt rename to src/jdk.compiler/share/data/symbols/java.management-G.sym.txt diff --git a/make/data/symbols/java.management-H.sym.txt b/src/jdk.compiler/share/data/symbols/java.management-H.sym.txt similarity index 100% rename from make/data/symbols/java.management-H.sym.txt rename to src/jdk.compiler/share/data/symbols/java.management-H.sym.txt diff --git a/make/data/symbols/java.management-I.sym.txt b/src/jdk.compiler/share/data/symbols/java.management-I.sym.txt similarity index 100% rename from make/data/symbols/java.management-I.sym.txt rename to src/jdk.compiler/share/data/symbols/java.management-I.sym.txt diff --git a/make/data/symbols/java.management.rmi-8.sym.txt b/src/jdk.compiler/share/data/symbols/java.management.rmi-8.sym.txt similarity index 100% rename from make/data/symbols/java.management.rmi-8.sym.txt rename to src/jdk.compiler/share/data/symbols/java.management.rmi-8.sym.txt diff --git a/make/data/symbols/java.management.rmi-9.sym.txt b/src/jdk.compiler/share/data/symbols/java.management.rmi-9.sym.txt similarity index 100% rename from make/data/symbols/java.management.rmi-9.sym.txt rename to src/jdk.compiler/share/data/symbols/java.management.rmi-9.sym.txt diff --git a/make/data/symbols/java.management.rmi-A.sym.txt b/src/jdk.compiler/share/data/symbols/java.management.rmi-A.sym.txt similarity index 100% rename from make/data/symbols/java.management.rmi-A.sym.txt rename to src/jdk.compiler/share/data/symbols/java.management.rmi-A.sym.txt diff --git a/make/data/symbols/java.management.rmi-B.sym.txt b/src/jdk.compiler/share/data/symbols/java.management.rmi-B.sym.txt similarity index 100% rename from make/data/symbols/java.management.rmi-B.sym.txt rename to src/jdk.compiler/share/data/symbols/java.management.rmi-B.sym.txt diff --git a/make/data/symbols/java.management.rmi-D.sym.txt b/src/jdk.compiler/share/data/symbols/java.management.rmi-D.sym.txt similarity index 100% rename from make/data/symbols/java.management.rmi-D.sym.txt rename to src/jdk.compiler/share/data/symbols/java.management.rmi-D.sym.txt diff --git a/make/data/symbols/java.management.rmi-F.sym.txt b/src/jdk.compiler/share/data/symbols/java.management.rmi-F.sym.txt similarity index 100% rename from make/data/symbols/java.management.rmi-F.sym.txt rename to src/jdk.compiler/share/data/symbols/java.management.rmi-F.sym.txt diff --git a/make/data/symbols/java.management.rmi-G.sym.txt b/src/jdk.compiler/share/data/symbols/java.management.rmi-G.sym.txt similarity index 100% rename from make/data/symbols/java.management.rmi-G.sym.txt rename to src/jdk.compiler/share/data/symbols/java.management.rmi-G.sym.txt diff --git a/make/data/symbols/java.management.rmi-H.sym.txt b/src/jdk.compiler/share/data/symbols/java.management.rmi-H.sym.txt similarity index 100% rename from make/data/symbols/java.management.rmi-H.sym.txt rename to src/jdk.compiler/share/data/symbols/java.management.rmi-H.sym.txt diff --git a/make/data/symbols/java.management.rmi-I.sym.txt b/src/jdk.compiler/share/data/symbols/java.management.rmi-I.sym.txt similarity index 100% rename from make/data/symbols/java.management.rmi-I.sym.txt rename to src/jdk.compiler/share/data/symbols/java.management.rmi-I.sym.txt diff --git a/make/data/symbols/java.naming-7.sym.txt b/src/jdk.compiler/share/data/symbols/java.naming-7.sym.txt similarity index 100% rename from make/data/symbols/java.naming-7.sym.txt rename to src/jdk.compiler/share/data/symbols/java.naming-7.sym.txt diff --git a/make/data/symbols/java.naming-8.sym.txt b/src/jdk.compiler/share/data/symbols/java.naming-8.sym.txt similarity index 100% rename from make/data/symbols/java.naming-8.sym.txt rename to src/jdk.compiler/share/data/symbols/java.naming-8.sym.txt diff --git a/make/data/symbols/java.naming-9.sym.txt b/src/jdk.compiler/share/data/symbols/java.naming-9.sym.txt similarity index 100% rename from make/data/symbols/java.naming-9.sym.txt rename to src/jdk.compiler/share/data/symbols/java.naming-9.sym.txt diff --git a/make/data/symbols/java.naming-A.sym.txt b/src/jdk.compiler/share/data/symbols/java.naming-A.sym.txt similarity index 100% rename from make/data/symbols/java.naming-A.sym.txt rename to src/jdk.compiler/share/data/symbols/java.naming-A.sym.txt diff --git a/make/data/symbols/java.naming-B.sym.txt b/src/jdk.compiler/share/data/symbols/java.naming-B.sym.txt similarity index 100% rename from make/data/symbols/java.naming-B.sym.txt rename to src/jdk.compiler/share/data/symbols/java.naming-B.sym.txt diff --git a/make/data/symbols/java.naming-C.sym.txt b/src/jdk.compiler/share/data/symbols/java.naming-C.sym.txt similarity index 100% rename from make/data/symbols/java.naming-C.sym.txt rename to src/jdk.compiler/share/data/symbols/java.naming-C.sym.txt diff --git a/make/data/symbols/java.naming-F.sym.txt b/src/jdk.compiler/share/data/symbols/java.naming-F.sym.txt similarity index 100% rename from make/data/symbols/java.naming-F.sym.txt rename to src/jdk.compiler/share/data/symbols/java.naming-F.sym.txt diff --git a/make/data/symbols/java.naming-G.sym.txt b/src/jdk.compiler/share/data/symbols/java.naming-G.sym.txt similarity index 100% rename from make/data/symbols/java.naming-G.sym.txt rename to src/jdk.compiler/share/data/symbols/java.naming-G.sym.txt diff --git a/make/data/symbols/java.naming-H.sym.txt b/src/jdk.compiler/share/data/symbols/java.naming-H.sym.txt similarity index 100% rename from make/data/symbols/java.naming-H.sym.txt rename to src/jdk.compiler/share/data/symbols/java.naming-H.sym.txt diff --git a/make/data/symbols/java.naming-I.sym.txt b/src/jdk.compiler/share/data/symbols/java.naming-I.sym.txt similarity index 100% rename from make/data/symbols/java.naming-I.sym.txt rename to src/jdk.compiler/share/data/symbols/java.naming-I.sym.txt diff --git a/make/data/symbols/java.net.http-B.sym.txt b/src/jdk.compiler/share/data/symbols/java.net.http-B.sym.txt similarity index 100% rename from make/data/symbols/java.net.http-B.sym.txt rename to src/jdk.compiler/share/data/symbols/java.net.http-B.sym.txt diff --git a/make/data/symbols/java.net.http-D.sym.txt b/src/jdk.compiler/share/data/symbols/java.net.http-D.sym.txt similarity index 100% rename from make/data/symbols/java.net.http-D.sym.txt rename to src/jdk.compiler/share/data/symbols/java.net.http-D.sym.txt diff --git a/make/data/symbols/java.net.http-G.sym.txt b/src/jdk.compiler/share/data/symbols/java.net.http-G.sym.txt similarity index 100% rename from make/data/symbols/java.net.http-G.sym.txt rename to src/jdk.compiler/share/data/symbols/java.net.http-G.sym.txt diff --git a/make/data/symbols/java.net.http-I.sym.txt b/src/jdk.compiler/share/data/symbols/java.net.http-I.sym.txt similarity index 100% rename from make/data/symbols/java.net.http-I.sym.txt rename to src/jdk.compiler/share/data/symbols/java.net.http-I.sym.txt diff --git a/make/data/symbols/java.prefs-7.sym.txt b/src/jdk.compiler/share/data/symbols/java.prefs-7.sym.txt similarity index 100% rename from make/data/symbols/java.prefs-7.sym.txt rename to src/jdk.compiler/share/data/symbols/java.prefs-7.sym.txt diff --git a/make/data/symbols/java.prefs-8.sym.txt b/src/jdk.compiler/share/data/symbols/java.prefs-8.sym.txt similarity index 100% rename from make/data/symbols/java.prefs-8.sym.txt rename to src/jdk.compiler/share/data/symbols/java.prefs-8.sym.txt diff --git a/make/data/symbols/java.prefs-9.sym.txt b/src/jdk.compiler/share/data/symbols/java.prefs-9.sym.txt similarity index 100% rename from make/data/symbols/java.prefs-9.sym.txt rename to src/jdk.compiler/share/data/symbols/java.prefs-9.sym.txt diff --git a/make/data/symbols/java.prefs-A.sym.txt b/src/jdk.compiler/share/data/symbols/java.prefs-A.sym.txt similarity index 100% rename from make/data/symbols/java.prefs-A.sym.txt rename to src/jdk.compiler/share/data/symbols/java.prefs-A.sym.txt diff --git a/make/data/symbols/java.prefs-B.sym.txt b/src/jdk.compiler/share/data/symbols/java.prefs-B.sym.txt similarity index 100% rename from make/data/symbols/java.prefs-B.sym.txt rename to src/jdk.compiler/share/data/symbols/java.prefs-B.sym.txt diff --git a/make/data/symbols/java.rmi-7.sym.txt b/src/jdk.compiler/share/data/symbols/java.rmi-7.sym.txt similarity index 100% rename from make/data/symbols/java.rmi-7.sym.txt rename to src/jdk.compiler/share/data/symbols/java.rmi-7.sym.txt diff --git a/make/data/symbols/java.rmi-8.sym.txt b/src/jdk.compiler/share/data/symbols/java.rmi-8.sym.txt similarity index 100% rename from make/data/symbols/java.rmi-8.sym.txt rename to src/jdk.compiler/share/data/symbols/java.rmi-8.sym.txt diff --git a/make/data/symbols/java.rmi-9.sym.txt b/src/jdk.compiler/share/data/symbols/java.rmi-9.sym.txt similarity index 100% rename from make/data/symbols/java.rmi-9.sym.txt rename to src/jdk.compiler/share/data/symbols/java.rmi-9.sym.txt diff --git a/make/data/symbols/java.rmi-A.sym.txt b/src/jdk.compiler/share/data/symbols/java.rmi-A.sym.txt similarity index 100% rename from make/data/symbols/java.rmi-A.sym.txt rename to src/jdk.compiler/share/data/symbols/java.rmi-A.sym.txt diff --git a/make/data/symbols/java.rmi-B.sym.txt b/src/jdk.compiler/share/data/symbols/java.rmi-B.sym.txt similarity index 100% rename from make/data/symbols/java.rmi-B.sym.txt rename to src/jdk.compiler/share/data/symbols/java.rmi-B.sym.txt diff --git a/make/data/symbols/java.rmi-C.sym.txt b/src/jdk.compiler/share/data/symbols/java.rmi-C.sym.txt similarity index 100% rename from make/data/symbols/java.rmi-C.sym.txt rename to src/jdk.compiler/share/data/symbols/java.rmi-C.sym.txt diff --git a/make/data/symbols/java.rmi-F.sym.txt b/src/jdk.compiler/share/data/symbols/java.rmi-F.sym.txt similarity index 100% rename from make/data/symbols/java.rmi-F.sym.txt rename to src/jdk.compiler/share/data/symbols/java.rmi-F.sym.txt diff --git a/make/data/symbols/java.rmi-G.sym.txt b/src/jdk.compiler/share/data/symbols/java.rmi-G.sym.txt similarity index 100% rename from make/data/symbols/java.rmi-G.sym.txt rename to src/jdk.compiler/share/data/symbols/java.rmi-G.sym.txt diff --git a/make/data/symbols/java.rmi-H.sym.txt b/src/jdk.compiler/share/data/symbols/java.rmi-H.sym.txt similarity index 100% rename from make/data/symbols/java.rmi-H.sym.txt rename to src/jdk.compiler/share/data/symbols/java.rmi-H.sym.txt diff --git a/make/data/symbols/java.rmi-I.sym.txt b/src/jdk.compiler/share/data/symbols/java.rmi-I.sym.txt similarity index 100% rename from make/data/symbols/java.rmi-I.sym.txt rename to src/jdk.compiler/share/data/symbols/java.rmi-I.sym.txt diff --git a/make/data/symbols/java.scripting-7.sym.txt b/src/jdk.compiler/share/data/symbols/java.scripting-7.sym.txt similarity index 100% rename from make/data/symbols/java.scripting-7.sym.txt rename to src/jdk.compiler/share/data/symbols/java.scripting-7.sym.txt diff --git a/make/data/symbols/java.scripting-8.sym.txt b/src/jdk.compiler/share/data/symbols/java.scripting-8.sym.txt similarity index 100% rename from make/data/symbols/java.scripting-8.sym.txt rename to src/jdk.compiler/share/data/symbols/java.scripting-8.sym.txt diff --git a/make/data/symbols/java.scripting-9.sym.txt b/src/jdk.compiler/share/data/symbols/java.scripting-9.sym.txt similarity index 100% rename from make/data/symbols/java.scripting-9.sym.txt rename to src/jdk.compiler/share/data/symbols/java.scripting-9.sym.txt diff --git a/make/data/symbols/java.scripting-A.sym.txt b/src/jdk.compiler/share/data/symbols/java.scripting-A.sym.txt similarity index 100% rename from make/data/symbols/java.scripting-A.sym.txt rename to src/jdk.compiler/share/data/symbols/java.scripting-A.sym.txt diff --git a/make/data/symbols/java.scripting-B.sym.txt b/src/jdk.compiler/share/data/symbols/java.scripting-B.sym.txt similarity index 100% rename from make/data/symbols/java.scripting-B.sym.txt rename to src/jdk.compiler/share/data/symbols/java.scripting-B.sym.txt diff --git a/make/data/symbols/java.scripting-G.sym.txt b/src/jdk.compiler/share/data/symbols/java.scripting-G.sym.txt similarity index 100% rename from make/data/symbols/java.scripting-G.sym.txt rename to src/jdk.compiler/share/data/symbols/java.scripting-G.sym.txt diff --git a/make/data/symbols/java.scripting-H.sym.txt b/src/jdk.compiler/share/data/symbols/java.scripting-H.sym.txt similarity index 100% rename from make/data/symbols/java.scripting-H.sym.txt rename to src/jdk.compiler/share/data/symbols/java.scripting-H.sym.txt diff --git a/make/data/symbols/java.scripting-I.sym.txt b/src/jdk.compiler/share/data/symbols/java.scripting-I.sym.txt similarity index 100% rename from make/data/symbols/java.scripting-I.sym.txt rename to src/jdk.compiler/share/data/symbols/java.scripting-I.sym.txt diff --git a/make/data/symbols/java.se-9.sym.txt b/src/jdk.compiler/share/data/symbols/java.se-9.sym.txt similarity index 100% rename from make/data/symbols/java.se-9.sym.txt rename to src/jdk.compiler/share/data/symbols/java.se-9.sym.txt diff --git a/make/data/symbols/java.se-A.sym.txt b/src/jdk.compiler/share/data/symbols/java.se-A.sym.txt similarity index 100% rename from make/data/symbols/java.se-A.sym.txt rename to src/jdk.compiler/share/data/symbols/java.se-A.sym.txt diff --git a/make/data/symbols/java.se-B.sym.txt b/src/jdk.compiler/share/data/symbols/java.se-B.sym.txt similarity index 100% rename from make/data/symbols/java.se-B.sym.txt rename to src/jdk.compiler/share/data/symbols/java.se-B.sym.txt diff --git a/make/data/symbols/java.se.ee-9.sym.txt b/src/jdk.compiler/share/data/symbols/java.se.ee-9.sym.txt similarity index 100% rename from make/data/symbols/java.se.ee-9.sym.txt rename to src/jdk.compiler/share/data/symbols/java.se.ee-9.sym.txt diff --git a/make/data/symbols/java.se.ee-A.sym.txt b/src/jdk.compiler/share/data/symbols/java.se.ee-A.sym.txt similarity index 100% rename from make/data/symbols/java.se.ee-A.sym.txt rename to src/jdk.compiler/share/data/symbols/java.se.ee-A.sym.txt diff --git a/make/data/symbols/java.se.ee-B.sym.txt b/src/jdk.compiler/share/data/symbols/java.se.ee-B.sym.txt similarity index 100% rename from make/data/symbols/java.se.ee-B.sym.txt rename to src/jdk.compiler/share/data/symbols/java.se.ee-B.sym.txt diff --git a/make/data/symbols/java.security.jgss-7.sym.txt b/src/jdk.compiler/share/data/symbols/java.security.jgss-7.sym.txt similarity index 100% rename from make/data/symbols/java.security.jgss-7.sym.txt rename to src/jdk.compiler/share/data/symbols/java.security.jgss-7.sym.txt diff --git a/make/data/symbols/java.security.jgss-8.sym.txt b/src/jdk.compiler/share/data/symbols/java.security.jgss-8.sym.txt similarity index 100% rename from make/data/symbols/java.security.jgss-8.sym.txt rename to src/jdk.compiler/share/data/symbols/java.security.jgss-8.sym.txt diff --git a/make/data/symbols/java.security.jgss-9.sym.txt b/src/jdk.compiler/share/data/symbols/java.security.jgss-9.sym.txt similarity index 100% rename from make/data/symbols/java.security.jgss-9.sym.txt rename to src/jdk.compiler/share/data/symbols/java.security.jgss-9.sym.txt diff --git a/make/data/symbols/java.security.jgss-A.sym.txt b/src/jdk.compiler/share/data/symbols/java.security.jgss-A.sym.txt similarity index 100% rename from make/data/symbols/java.security.jgss-A.sym.txt rename to src/jdk.compiler/share/data/symbols/java.security.jgss-A.sym.txt diff --git a/make/data/symbols/java.security.jgss-B.sym.txt b/src/jdk.compiler/share/data/symbols/java.security.jgss-B.sym.txt similarity index 100% rename from make/data/symbols/java.security.jgss-B.sym.txt rename to src/jdk.compiler/share/data/symbols/java.security.jgss-B.sym.txt diff --git a/make/data/symbols/java.security.jgss-D.sym.txt b/src/jdk.compiler/share/data/symbols/java.security.jgss-D.sym.txt similarity index 100% rename from make/data/symbols/java.security.jgss-D.sym.txt rename to src/jdk.compiler/share/data/symbols/java.security.jgss-D.sym.txt diff --git a/make/data/symbols/java.security.jgss-G.sym.txt b/src/jdk.compiler/share/data/symbols/java.security.jgss-G.sym.txt similarity index 100% rename from make/data/symbols/java.security.jgss-G.sym.txt rename to src/jdk.compiler/share/data/symbols/java.security.jgss-G.sym.txt diff --git a/make/data/symbols/java.security.jgss-H.sym.txt b/src/jdk.compiler/share/data/symbols/java.security.jgss-H.sym.txt similarity index 100% rename from make/data/symbols/java.security.jgss-H.sym.txt rename to src/jdk.compiler/share/data/symbols/java.security.jgss-H.sym.txt diff --git a/make/data/symbols/java.security.jgss-I.sym.txt b/src/jdk.compiler/share/data/symbols/java.security.jgss-I.sym.txt similarity index 100% rename from make/data/symbols/java.security.jgss-I.sym.txt rename to src/jdk.compiler/share/data/symbols/java.security.jgss-I.sym.txt diff --git a/make/data/symbols/java.security.sasl-7.sym.txt b/src/jdk.compiler/share/data/symbols/java.security.sasl-7.sym.txt similarity index 100% rename from make/data/symbols/java.security.sasl-7.sym.txt rename to src/jdk.compiler/share/data/symbols/java.security.sasl-7.sym.txt diff --git a/make/data/symbols/java.security.sasl-8.sym.txt b/src/jdk.compiler/share/data/symbols/java.security.sasl-8.sym.txt similarity index 100% rename from make/data/symbols/java.security.sasl-8.sym.txt rename to src/jdk.compiler/share/data/symbols/java.security.sasl-8.sym.txt diff --git a/make/data/symbols/java.security.sasl-9.sym.txt b/src/jdk.compiler/share/data/symbols/java.security.sasl-9.sym.txt similarity index 100% rename from make/data/symbols/java.security.sasl-9.sym.txt rename to src/jdk.compiler/share/data/symbols/java.security.sasl-9.sym.txt diff --git a/make/data/symbols/java.security.sasl-A.sym.txt b/src/jdk.compiler/share/data/symbols/java.security.sasl-A.sym.txt similarity index 100% rename from make/data/symbols/java.security.sasl-A.sym.txt rename to src/jdk.compiler/share/data/symbols/java.security.sasl-A.sym.txt diff --git a/make/data/symbols/java.security.sasl-B.sym.txt b/src/jdk.compiler/share/data/symbols/java.security.sasl-B.sym.txt similarity index 100% rename from make/data/symbols/java.security.sasl-B.sym.txt rename to src/jdk.compiler/share/data/symbols/java.security.sasl-B.sym.txt diff --git a/make/data/symbols/java.security.sasl-G.sym.txt b/src/jdk.compiler/share/data/symbols/java.security.sasl-G.sym.txt similarity index 100% rename from make/data/symbols/java.security.sasl-G.sym.txt rename to src/jdk.compiler/share/data/symbols/java.security.sasl-G.sym.txt diff --git a/make/data/symbols/java.security.sasl-H.sym.txt b/src/jdk.compiler/share/data/symbols/java.security.sasl-H.sym.txt similarity index 100% rename from make/data/symbols/java.security.sasl-H.sym.txt rename to src/jdk.compiler/share/data/symbols/java.security.sasl-H.sym.txt diff --git a/make/data/symbols/java.security.sasl-I.sym.txt b/src/jdk.compiler/share/data/symbols/java.security.sasl-I.sym.txt similarity index 100% rename from make/data/symbols/java.security.sasl-I.sym.txt rename to src/jdk.compiler/share/data/symbols/java.security.sasl-I.sym.txt diff --git a/make/data/symbols/java.smartcardio-9.sym.txt b/src/jdk.compiler/share/data/symbols/java.smartcardio-9.sym.txt similarity index 100% rename from make/data/symbols/java.smartcardio-9.sym.txt rename to src/jdk.compiler/share/data/symbols/java.smartcardio-9.sym.txt diff --git a/make/data/symbols/java.smartcardio-A.sym.txt b/src/jdk.compiler/share/data/symbols/java.smartcardio-A.sym.txt similarity index 100% rename from make/data/symbols/java.smartcardio-A.sym.txt rename to src/jdk.compiler/share/data/symbols/java.smartcardio-A.sym.txt diff --git a/make/data/symbols/java.smartcardio-B.sym.txt b/src/jdk.compiler/share/data/symbols/java.smartcardio-B.sym.txt similarity index 100% rename from make/data/symbols/java.smartcardio-B.sym.txt rename to src/jdk.compiler/share/data/symbols/java.smartcardio-B.sym.txt diff --git a/make/data/symbols/java.smartcardio-G.sym.txt b/src/jdk.compiler/share/data/symbols/java.smartcardio-G.sym.txt similarity index 100% rename from make/data/symbols/java.smartcardio-G.sym.txt rename to src/jdk.compiler/share/data/symbols/java.smartcardio-G.sym.txt diff --git a/make/data/symbols/java.smartcardio-H.sym.txt b/src/jdk.compiler/share/data/symbols/java.smartcardio-H.sym.txt similarity index 100% rename from make/data/symbols/java.smartcardio-H.sym.txt rename to src/jdk.compiler/share/data/symbols/java.smartcardio-H.sym.txt diff --git a/make/data/symbols/java.smartcardio-I.sym.txt b/src/jdk.compiler/share/data/symbols/java.smartcardio-I.sym.txt similarity index 100% rename from make/data/symbols/java.smartcardio-I.sym.txt rename to src/jdk.compiler/share/data/symbols/java.smartcardio-I.sym.txt diff --git a/make/data/symbols/java.sql-7.sym.txt b/src/jdk.compiler/share/data/symbols/java.sql-7.sym.txt similarity index 100% rename from make/data/symbols/java.sql-7.sym.txt rename to src/jdk.compiler/share/data/symbols/java.sql-7.sym.txt diff --git a/make/data/symbols/java.sql-8.sym.txt b/src/jdk.compiler/share/data/symbols/java.sql-8.sym.txt similarity index 100% rename from make/data/symbols/java.sql-8.sym.txt rename to src/jdk.compiler/share/data/symbols/java.sql-8.sym.txt diff --git a/make/data/symbols/java.sql-9.sym.txt b/src/jdk.compiler/share/data/symbols/java.sql-9.sym.txt similarity index 100% rename from make/data/symbols/java.sql-9.sym.txt rename to src/jdk.compiler/share/data/symbols/java.sql-9.sym.txt diff --git a/make/data/symbols/java.sql-A.sym.txt b/src/jdk.compiler/share/data/symbols/java.sql-A.sym.txt similarity index 100% rename from make/data/symbols/java.sql-A.sym.txt rename to src/jdk.compiler/share/data/symbols/java.sql-A.sym.txt diff --git a/make/data/symbols/java.sql-B.sym.txt b/src/jdk.compiler/share/data/symbols/java.sql-B.sym.txt similarity index 100% rename from make/data/symbols/java.sql-B.sym.txt rename to src/jdk.compiler/share/data/symbols/java.sql-B.sym.txt diff --git a/make/data/symbols/java.sql-G.sym.txt b/src/jdk.compiler/share/data/symbols/java.sql-G.sym.txt similarity index 100% rename from make/data/symbols/java.sql-G.sym.txt rename to src/jdk.compiler/share/data/symbols/java.sql-G.sym.txt diff --git a/make/data/symbols/java.sql-H.sym.txt b/src/jdk.compiler/share/data/symbols/java.sql-H.sym.txt similarity index 100% rename from make/data/symbols/java.sql-H.sym.txt rename to src/jdk.compiler/share/data/symbols/java.sql-H.sym.txt diff --git a/make/data/symbols/java.sql-I.sym.txt b/src/jdk.compiler/share/data/symbols/java.sql-I.sym.txt similarity index 100% rename from make/data/symbols/java.sql-I.sym.txt rename to src/jdk.compiler/share/data/symbols/java.sql-I.sym.txt diff --git a/make/data/symbols/java.sql.rowset-7.sym.txt b/src/jdk.compiler/share/data/symbols/java.sql.rowset-7.sym.txt similarity index 100% rename from make/data/symbols/java.sql.rowset-7.sym.txt rename to src/jdk.compiler/share/data/symbols/java.sql.rowset-7.sym.txt diff --git a/make/data/symbols/java.sql.rowset-8.sym.txt b/src/jdk.compiler/share/data/symbols/java.sql.rowset-8.sym.txt similarity index 100% rename from make/data/symbols/java.sql.rowset-8.sym.txt rename to src/jdk.compiler/share/data/symbols/java.sql.rowset-8.sym.txt diff --git a/make/data/symbols/java.sql.rowset-9.sym.txt b/src/jdk.compiler/share/data/symbols/java.sql.rowset-9.sym.txt similarity index 100% rename from make/data/symbols/java.sql.rowset-9.sym.txt rename to src/jdk.compiler/share/data/symbols/java.sql.rowset-9.sym.txt diff --git a/make/data/symbols/java.sql.rowset-A.sym.txt b/src/jdk.compiler/share/data/symbols/java.sql.rowset-A.sym.txt similarity index 100% rename from make/data/symbols/java.sql.rowset-A.sym.txt rename to src/jdk.compiler/share/data/symbols/java.sql.rowset-A.sym.txt diff --git a/make/data/symbols/java.sql.rowset-B.sym.txt b/src/jdk.compiler/share/data/symbols/java.sql.rowset-B.sym.txt similarity index 100% rename from make/data/symbols/java.sql.rowset-B.sym.txt rename to src/jdk.compiler/share/data/symbols/java.sql.rowset-B.sym.txt diff --git a/make/data/symbols/java.sql.rowset-G.sym.txt b/src/jdk.compiler/share/data/symbols/java.sql.rowset-G.sym.txt similarity index 100% rename from make/data/symbols/java.sql.rowset-G.sym.txt rename to src/jdk.compiler/share/data/symbols/java.sql.rowset-G.sym.txt diff --git a/make/data/symbols/java.sql.rowset-H.sym.txt b/src/jdk.compiler/share/data/symbols/java.sql.rowset-H.sym.txt similarity index 100% rename from make/data/symbols/java.sql.rowset-H.sym.txt rename to src/jdk.compiler/share/data/symbols/java.sql.rowset-H.sym.txt diff --git a/make/data/symbols/java.sql.rowset-I.sym.txt b/src/jdk.compiler/share/data/symbols/java.sql.rowset-I.sym.txt similarity index 100% rename from make/data/symbols/java.sql.rowset-I.sym.txt rename to src/jdk.compiler/share/data/symbols/java.sql.rowset-I.sym.txt diff --git a/make/data/symbols/java.transaction-8.sym.txt b/src/jdk.compiler/share/data/symbols/java.transaction-8.sym.txt similarity index 100% rename from make/data/symbols/java.transaction-8.sym.txt rename to src/jdk.compiler/share/data/symbols/java.transaction-8.sym.txt diff --git a/make/data/symbols/java.transaction-9.sym.txt b/src/jdk.compiler/share/data/symbols/java.transaction-9.sym.txt similarity index 100% rename from make/data/symbols/java.transaction-9.sym.txt rename to src/jdk.compiler/share/data/symbols/java.transaction-9.sym.txt diff --git a/make/data/symbols/java.transaction-A.sym.txt b/src/jdk.compiler/share/data/symbols/java.transaction-A.sym.txt similarity index 100% rename from make/data/symbols/java.transaction-A.sym.txt rename to src/jdk.compiler/share/data/symbols/java.transaction-A.sym.txt diff --git a/make/data/symbols/java.transaction-B.sym.txt b/src/jdk.compiler/share/data/symbols/java.transaction-B.sym.txt similarity index 100% rename from make/data/symbols/java.transaction-B.sym.txt rename to src/jdk.compiler/share/data/symbols/java.transaction-B.sym.txt diff --git a/make/data/symbols/java.transaction.xa-B.sym.txt b/src/jdk.compiler/share/data/symbols/java.transaction.xa-B.sym.txt similarity index 100% rename from make/data/symbols/java.transaction.xa-B.sym.txt rename to src/jdk.compiler/share/data/symbols/java.transaction.xa-B.sym.txt diff --git a/make/data/symbols/java.xml-7.sym.txt b/src/jdk.compiler/share/data/symbols/java.xml-7.sym.txt similarity index 100% rename from make/data/symbols/java.xml-7.sym.txt rename to src/jdk.compiler/share/data/symbols/java.xml-7.sym.txt diff --git a/make/data/symbols/java.xml-8.sym.txt b/src/jdk.compiler/share/data/symbols/java.xml-8.sym.txt similarity index 100% rename from make/data/symbols/java.xml-8.sym.txt rename to src/jdk.compiler/share/data/symbols/java.xml-8.sym.txt diff --git a/make/data/symbols/java.xml-9.sym.txt b/src/jdk.compiler/share/data/symbols/java.xml-9.sym.txt similarity index 100% rename from make/data/symbols/java.xml-9.sym.txt rename to src/jdk.compiler/share/data/symbols/java.xml-9.sym.txt diff --git a/make/data/symbols/java.xml-A.sym.txt b/src/jdk.compiler/share/data/symbols/java.xml-A.sym.txt similarity index 100% rename from make/data/symbols/java.xml-A.sym.txt rename to src/jdk.compiler/share/data/symbols/java.xml-A.sym.txt diff --git a/make/data/symbols/java.xml-B.sym.txt b/src/jdk.compiler/share/data/symbols/java.xml-B.sym.txt similarity index 100% rename from make/data/symbols/java.xml-B.sym.txt rename to src/jdk.compiler/share/data/symbols/java.xml-B.sym.txt diff --git a/make/data/symbols/java.xml-C.sym.txt b/src/jdk.compiler/share/data/symbols/java.xml-C.sym.txt similarity index 100% rename from make/data/symbols/java.xml-C.sym.txt rename to src/jdk.compiler/share/data/symbols/java.xml-C.sym.txt diff --git a/make/data/symbols/java.xml-D.sym.txt b/src/jdk.compiler/share/data/symbols/java.xml-D.sym.txt similarity index 100% rename from make/data/symbols/java.xml-D.sym.txt rename to src/jdk.compiler/share/data/symbols/java.xml-D.sym.txt diff --git a/make/data/symbols/java.xml-E.sym.txt b/src/jdk.compiler/share/data/symbols/java.xml-E.sym.txt similarity index 100% rename from make/data/symbols/java.xml-E.sym.txt rename to src/jdk.compiler/share/data/symbols/java.xml-E.sym.txt diff --git a/make/data/symbols/java.xml-F.sym.txt b/src/jdk.compiler/share/data/symbols/java.xml-F.sym.txt similarity index 100% rename from make/data/symbols/java.xml-F.sym.txt rename to src/jdk.compiler/share/data/symbols/java.xml-F.sym.txt diff --git a/make/data/symbols/java.xml-G.sym.txt b/src/jdk.compiler/share/data/symbols/java.xml-G.sym.txt similarity index 100% rename from make/data/symbols/java.xml-G.sym.txt rename to src/jdk.compiler/share/data/symbols/java.xml-G.sym.txt diff --git a/make/data/symbols/java.xml-H.sym.txt b/src/jdk.compiler/share/data/symbols/java.xml-H.sym.txt similarity index 100% rename from make/data/symbols/java.xml-H.sym.txt rename to src/jdk.compiler/share/data/symbols/java.xml-H.sym.txt diff --git a/make/data/symbols/java.xml-I.sym.txt b/src/jdk.compiler/share/data/symbols/java.xml-I.sym.txt similarity index 100% rename from make/data/symbols/java.xml-I.sym.txt rename to src/jdk.compiler/share/data/symbols/java.xml-I.sym.txt diff --git a/make/data/symbols/java.xml.bind-7.sym.txt b/src/jdk.compiler/share/data/symbols/java.xml.bind-7.sym.txt similarity index 100% rename from make/data/symbols/java.xml.bind-7.sym.txt rename to src/jdk.compiler/share/data/symbols/java.xml.bind-7.sym.txt diff --git a/make/data/symbols/java.xml.bind-8.sym.txt b/src/jdk.compiler/share/data/symbols/java.xml.bind-8.sym.txt similarity index 100% rename from make/data/symbols/java.xml.bind-8.sym.txt rename to src/jdk.compiler/share/data/symbols/java.xml.bind-8.sym.txt diff --git a/make/data/symbols/java.xml.bind-9.sym.txt b/src/jdk.compiler/share/data/symbols/java.xml.bind-9.sym.txt similarity index 100% rename from make/data/symbols/java.xml.bind-9.sym.txt rename to src/jdk.compiler/share/data/symbols/java.xml.bind-9.sym.txt diff --git a/make/data/symbols/java.xml.bind-A.sym.txt b/src/jdk.compiler/share/data/symbols/java.xml.bind-A.sym.txt similarity index 100% rename from make/data/symbols/java.xml.bind-A.sym.txt rename to src/jdk.compiler/share/data/symbols/java.xml.bind-A.sym.txt diff --git a/make/data/symbols/java.xml.bind-B.sym.txt b/src/jdk.compiler/share/data/symbols/java.xml.bind-B.sym.txt similarity index 100% rename from make/data/symbols/java.xml.bind-B.sym.txt rename to src/jdk.compiler/share/data/symbols/java.xml.bind-B.sym.txt diff --git a/make/data/symbols/java.xml.crypto-8.sym.txt b/src/jdk.compiler/share/data/symbols/java.xml.crypto-8.sym.txt similarity index 100% rename from make/data/symbols/java.xml.crypto-8.sym.txt rename to src/jdk.compiler/share/data/symbols/java.xml.crypto-8.sym.txt diff --git a/make/data/symbols/java.xml.crypto-9.sym.txt b/src/jdk.compiler/share/data/symbols/java.xml.crypto-9.sym.txt similarity index 100% rename from make/data/symbols/java.xml.crypto-9.sym.txt rename to src/jdk.compiler/share/data/symbols/java.xml.crypto-9.sym.txt diff --git a/make/data/symbols/java.xml.crypto-A.sym.txt b/src/jdk.compiler/share/data/symbols/java.xml.crypto-A.sym.txt similarity index 100% rename from make/data/symbols/java.xml.crypto-A.sym.txt rename to src/jdk.compiler/share/data/symbols/java.xml.crypto-A.sym.txt diff --git a/make/data/symbols/java.xml.crypto-B.sym.txt b/src/jdk.compiler/share/data/symbols/java.xml.crypto-B.sym.txt similarity index 100% rename from make/data/symbols/java.xml.crypto-B.sym.txt rename to src/jdk.compiler/share/data/symbols/java.xml.crypto-B.sym.txt diff --git a/make/data/symbols/java.xml.crypto-D.sym.txt b/src/jdk.compiler/share/data/symbols/java.xml.crypto-D.sym.txt similarity index 100% rename from make/data/symbols/java.xml.crypto-D.sym.txt rename to src/jdk.compiler/share/data/symbols/java.xml.crypto-D.sym.txt diff --git a/make/data/symbols/java.xml.crypto-G.sym.txt b/src/jdk.compiler/share/data/symbols/java.xml.crypto-G.sym.txt similarity index 100% rename from make/data/symbols/java.xml.crypto-G.sym.txt rename to src/jdk.compiler/share/data/symbols/java.xml.crypto-G.sym.txt diff --git a/make/data/symbols/java.xml.crypto-H.sym.txt b/src/jdk.compiler/share/data/symbols/java.xml.crypto-H.sym.txt similarity index 100% rename from make/data/symbols/java.xml.crypto-H.sym.txt rename to src/jdk.compiler/share/data/symbols/java.xml.crypto-H.sym.txt diff --git a/make/data/symbols/java.xml.crypto-I.sym.txt b/src/jdk.compiler/share/data/symbols/java.xml.crypto-I.sym.txt similarity index 100% rename from make/data/symbols/java.xml.crypto-I.sym.txt rename to src/jdk.compiler/share/data/symbols/java.xml.crypto-I.sym.txt diff --git a/make/data/symbols/java.xml.ws-8.sym.txt b/src/jdk.compiler/share/data/symbols/java.xml.ws-8.sym.txt similarity index 100% rename from make/data/symbols/java.xml.ws-8.sym.txt rename to src/jdk.compiler/share/data/symbols/java.xml.ws-8.sym.txt diff --git a/make/data/symbols/java.xml.ws-9.sym.txt b/src/jdk.compiler/share/data/symbols/java.xml.ws-9.sym.txt similarity index 100% rename from make/data/symbols/java.xml.ws-9.sym.txt rename to src/jdk.compiler/share/data/symbols/java.xml.ws-9.sym.txt diff --git a/make/data/symbols/java.xml.ws-A.sym.txt b/src/jdk.compiler/share/data/symbols/java.xml.ws-A.sym.txt similarity index 100% rename from make/data/symbols/java.xml.ws-A.sym.txt rename to src/jdk.compiler/share/data/symbols/java.xml.ws-A.sym.txt diff --git a/make/data/symbols/java.xml.ws-B.sym.txt b/src/jdk.compiler/share/data/symbols/java.xml.ws-B.sym.txt similarity index 100% rename from make/data/symbols/java.xml.ws-B.sym.txt rename to src/jdk.compiler/share/data/symbols/java.xml.ws-B.sym.txt diff --git a/make/data/symbols/java.xml.ws.annotation-7.sym.txt b/src/jdk.compiler/share/data/symbols/java.xml.ws.annotation-7.sym.txt similarity index 100% rename from make/data/symbols/java.xml.ws.annotation-7.sym.txt rename to src/jdk.compiler/share/data/symbols/java.xml.ws.annotation-7.sym.txt diff --git a/make/data/symbols/java.xml.ws.annotation-8.sym.txt b/src/jdk.compiler/share/data/symbols/java.xml.ws.annotation-8.sym.txt similarity index 100% rename from make/data/symbols/java.xml.ws.annotation-8.sym.txt rename to src/jdk.compiler/share/data/symbols/java.xml.ws.annotation-8.sym.txt diff --git a/make/data/symbols/java.xml.ws.annotation-9.sym.txt b/src/jdk.compiler/share/data/symbols/java.xml.ws.annotation-9.sym.txt similarity index 100% rename from make/data/symbols/java.xml.ws.annotation-9.sym.txt rename to src/jdk.compiler/share/data/symbols/java.xml.ws.annotation-9.sym.txt diff --git a/make/data/symbols/java.xml.ws.annotation-A.sym.txt b/src/jdk.compiler/share/data/symbols/java.xml.ws.annotation-A.sym.txt similarity index 100% rename from make/data/symbols/java.xml.ws.annotation-A.sym.txt rename to src/jdk.compiler/share/data/symbols/java.xml.ws.annotation-A.sym.txt diff --git a/make/data/symbols/java.xml.ws.annotation-B.sym.txt b/src/jdk.compiler/share/data/symbols/java.xml.ws.annotation-B.sym.txt similarity index 100% rename from make/data/symbols/java.xml.ws.annotation-B.sym.txt rename to src/jdk.compiler/share/data/symbols/java.xml.ws.annotation-B.sym.txt diff --git a/make/data/symbols/jdk.accessibility-9.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.accessibility-9.sym.txt similarity index 100% rename from make/data/symbols/jdk.accessibility-9.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.accessibility-9.sym.txt diff --git a/make/data/symbols/jdk.accessibility-A.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.accessibility-A.sym.txt similarity index 100% rename from make/data/symbols/jdk.accessibility-A.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.accessibility-A.sym.txt diff --git a/make/data/symbols/jdk.accessibility-B.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.accessibility-B.sym.txt similarity index 100% rename from make/data/symbols/jdk.accessibility-B.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.accessibility-B.sym.txt diff --git a/make/data/symbols/jdk.accessibility-G.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.accessibility-G.sym.txt similarity index 100% rename from make/data/symbols/jdk.accessibility-G.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.accessibility-G.sym.txt diff --git a/make/data/symbols/jdk.accessibility-H.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.accessibility-H.sym.txt similarity index 100% rename from make/data/symbols/jdk.accessibility-H.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.accessibility-H.sym.txt diff --git a/make/data/symbols/jdk.accessibility-I.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.accessibility-I.sym.txt similarity index 100% rename from make/data/symbols/jdk.accessibility-I.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.accessibility-I.sym.txt diff --git a/make/data/symbols/jdk.attach-9.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.attach-9.sym.txt similarity index 100% rename from make/data/symbols/jdk.attach-9.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.attach-9.sym.txt diff --git a/make/data/symbols/jdk.attach-A.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.attach-A.sym.txt similarity index 100% rename from make/data/symbols/jdk.attach-A.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.attach-A.sym.txt diff --git a/make/data/symbols/jdk.attach-B.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.attach-B.sym.txt similarity index 100% rename from make/data/symbols/jdk.attach-B.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.attach-B.sym.txt diff --git a/make/data/symbols/jdk.attach-G.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.attach-G.sym.txt similarity index 100% rename from make/data/symbols/jdk.attach-G.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.attach-G.sym.txt diff --git a/make/data/symbols/jdk.attach-H.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.attach-H.sym.txt similarity index 100% rename from make/data/symbols/jdk.attach-H.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.attach-H.sym.txt diff --git a/make/data/symbols/jdk.attach-I.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.attach-I.sym.txt similarity index 100% rename from make/data/symbols/jdk.attach-I.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.attach-I.sym.txt diff --git a/make/data/symbols/jdk.charsets-9.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.charsets-9.sym.txt similarity index 100% rename from make/data/symbols/jdk.charsets-9.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.charsets-9.sym.txt diff --git a/make/data/symbols/jdk.charsets-A.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.charsets-A.sym.txt similarity index 100% rename from make/data/symbols/jdk.charsets-A.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.charsets-A.sym.txt diff --git a/make/data/symbols/jdk.charsets-B.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.charsets-B.sym.txt similarity index 100% rename from make/data/symbols/jdk.charsets-B.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.charsets-B.sym.txt diff --git a/make/data/symbols/jdk.compiler-9.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.compiler-9.sym.txt similarity index 100% rename from make/data/symbols/jdk.compiler-9.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.compiler-9.sym.txt diff --git a/make/data/symbols/jdk.compiler-A.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.compiler-A.sym.txt similarity index 100% rename from make/data/symbols/jdk.compiler-A.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.compiler-A.sym.txt diff --git a/make/data/symbols/jdk.compiler-B.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.compiler-B.sym.txt similarity index 100% rename from make/data/symbols/jdk.compiler-B.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.compiler-B.sym.txt diff --git a/make/data/symbols/jdk.compiler-C.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.compiler-C.sym.txt similarity index 100% rename from make/data/symbols/jdk.compiler-C.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.compiler-C.sym.txt diff --git a/make/data/symbols/jdk.compiler-D.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.compiler-D.sym.txt similarity index 100% rename from make/data/symbols/jdk.compiler-D.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.compiler-D.sym.txt diff --git a/make/data/symbols/jdk.compiler-E.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.compiler-E.sym.txt similarity index 100% rename from make/data/symbols/jdk.compiler-E.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.compiler-E.sym.txt diff --git a/make/data/symbols/jdk.compiler-F.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.compiler-F.sym.txt similarity index 100% rename from make/data/symbols/jdk.compiler-F.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.compiler-F.sym.txt diff --git a/make/data/symbols/jdk.compiler-G.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.compiler-G.sym.txt similarity index 100% rename from make/data/symbols/jdk.compiler-G.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.compiler-G.sym.txt diff --git a/make/data/symbols/jdk.compiler-H.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.compiler-H.sym.txt similarity index 100% rename from make/data/symbols/jdk.compiler-H.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.compiler-H.sym.txt diff --git a/make/data/symbols/jdk.compiler-I.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.compiler-I.sym.txt similarity index 100% rename from make/data/symbols/jdk.compiler-I.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.compiler-I.sym.txt diff --git a/make/data/symbols/jdk.crypto.cryptoki-9.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.crypto.cryptoki-9.sym.txt similarity index 100% rename from make/data/symbols/jdk.crypto.cryptoki-9.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.crypto.cryptoki-9.sym.txt diff --git a/make/data/symbols/jdk.crypto.cryptoki-A.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.crypto.cryptoki-A.sym.txt similarity index 100% rename from make/data/symbols/jdk.crypto.cryptoki-A.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.crypto.cryptoki-A.sym.txt diff --git a/make/data/symbols/jdk.crypto.cryptoki-B.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.crypto.cryptoki-B.sym.txt similarity index 100% rename from make/data/symbols/jdk.crypto.cryptoki-B.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.crypto.cryptoki-B.sym.txt diff --git a/make/data/symbols/jdk.crypto.ec-9.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.crypto.ec-9.sym.txt similarity index 100% rename from make/data/symbols/jdk.crypto.ec-9.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.crypto.ec-9.sym.txt diff --git a/make/data/symbols/jdk.crypto.ec-A.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.crypto.ec-A.sym.txt similarity index 100% rename from make/data/symbols/jdk.crypto.ec-A.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.crypto.ec-A.sym.txt diff --git a/make/data/symbols/jdk.crypto.ec-B.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.crypto.ec-B.sym.txt similarity index 100% rename from make/data/symbols/jdk.crypto.ec-B.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.crypto.ec-B.sym.txt diff --git a/make/data/symbols/jdk.dynalink-9.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.dynalink-9.sym.txt similarity index 100% rename from make/data/symbols/jdk.dynalink-9.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.dynalink-9.sym.txt diff --git a/make/data/symbols/jdk.dynalink-A.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.dynalink-A.sym.txt similarity index 100% rename from make/data/symbols/jdk.dynalink-A.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.dynalink-A.sym.txt diff --git a/make/data/symbols/jdk.dynalink-B.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.dynalink-B.sym.txt similarity index 100% rename from make/data/symbols/jdk.dynalink-B.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.dynalink-B.sym.txt diff --git a/make/data/symbols/jdk.dynalink-G.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.dynalink-G.sym.txt similarity index 100% rename from make/data/symbols/jdk.dynalink-G.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.dynalink-G.sym.txt diff --git a/make/data/symbols/jdk.dynalink-H.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.dynalink-H.sym.txt similarity index 100% rename from make/data/symbols/jdk.dynalink-H.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.dynalink-H.sym.txt diff --git a/make/data/symbols/jdk.dynalink-I.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.dynalink-I.sym.txt similarity index 100% rename from make/data/symbols/jdk.dynalink-I.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.dynalink-I.sym.txt diff --git a/make/data/symbols/jdk.editpad-9.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.editpad-9.sym.txt similarity index 100% rename from make/data/symbols/jdk.editpad-9.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.editpad-9.sym.txt diff --git a/make/data/symbols/jdk.editpad-A.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.editpad-A.sym.txt similarity index 100% rename from make/data/symbols/jdk.editpad-A.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.editpad-A.sym.txt diff --git a/make/data/symbols/jdk.editpad-B.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.editpad-B.sym.txt similarity index 100% rename from make/data/symbols/jdk.editpad-B.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.editpad-B.sym.txt diff --git a/make/data/symbols/jdk.hotspot.agent-9.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.hotspot.agent-9.sym.txt similarity index 100% rename from make/data/symbols/jdk.hotspot.agent-9.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.hotspot.agent-9.sym.txt diff --git a/make/data/symbols/jdk.hotspot.agent-A.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.hotspot.agent-A.sym.txt similarity index 100% rename from make/data/symbols/jdk.hotspot.agent-A.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.hotspot.agent-A.sym.txt diff --git a/make/data/symbols/jdk.hotspot.agent-B.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.hotspot.agent-B.sym.txt similarity index 100% rename from make/data/symbols/jdk.hotspot.agent-B.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.hotspot.agent-B.sym.txt diff --git a/make/data/symbols/jdk.httpserver-7.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.httpserver-7.sym.txt similarity index 100% rename from make/data/symbols/jdk.httpserver-7.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.httpserver-7.sym.txt diff --git a/make/data/symbols/jdk.httpserver-8.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.httpserver-8.sym.txt similarity index 100% rename from make/data/symbols/jdk.httpserver-8.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.httpserver-8.sym.txt diff --git a/make/data/symbols/jdk.httpserver-9.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.httpserver-9.sym.txt similarity index 100% rename from make/data/symbols/jdk.httpserver-9.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.httpserver-9.sym.txt diff --git a/make/data/symbols/jdk.httpserver-A.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.httpserver-A.sym.txt similarity index 100% rename from make/data/symbols/jdk.httpserver-A.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.httpserver-A.sym.txt diff --git a/make/data/symbols/jdk.httpserver-B.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.httpserver-B.sym.txt similarity index 100% rename from make/data/symbols/jdk.httpserver-B.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.httpserver-B.sym.txt diff --git a/make/data/symbols/jdk.httpserver-D.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.httpserver-D.sym.txt similarity index 100% rename from make/data/symbols/jdk.httpserver-D.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.httpserver-D.sym.txt diff --git a/make/data/symbols/jdk.httpserver-E.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.httpserver-E.sym.txt similarity index 100% rename from make/data/symbols/jdk.httpserver-E.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.httpserver-E.sym.txt diff --git a/make/data/symbols/jdk.httpserver-G.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.httpserver-G.sym.txt similarity index 100% rename from make/data/symbols/jdk.httpserver-G.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.httpserver-G.sym.txt diff --git a/make/data/symbols/jdk.httpserver-H.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.httpserver-H.sym.txt similarity index 100% rename from make/data/symbols/jdk.httpserver-H.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.httpserver-H.sym.txt diff --git a/make/data/symbols/jdk.httpserver-I.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.httpserver-I.sym.txt similarity index 100% rename from make/data/symbols/jdk.httpserver-I.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.httpserver-I.sym.txt diff --git a/make/data/symbols/jdk.incubator.foreign-E.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.incubator.foreign-E.sym.txt similarity index 100% rename from make/data/symbols/jdk.incubator.foreign-E.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.incubator.foreign-E.sym.txt diff --git a/make/data/symbols/jdk.incubator.foreign-F.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.incubator.foreign-F.sym.txt similarity index 100% rename from make/data/symbols/jdk.incubator.foreign-F.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.incubator.foreign-F.sym.txt diff --git a/make/data/symbols/jdk.incubator.foreign-G.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.incubator.foreign-G.sym.txt similarity index 100% rename from make/data/symbols/jdk.incubator.foreign-G.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.incubator.foreign-G.sym.txt diff --git a/make/data/symbols/jdk.incubator.foreign-H.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.incubator.foreign-H.sym.txt similarity index 100% rename from make/data/symbols/jdk.incubator.foreign-H.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.incubator.foreign-H.sym.txt diff --git a/make/data/symbols/jdk.incubator.foreign-I.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.incubator.foreign-I.sym.txt similarity index 100% rename from make/data/symbols/jdk.incubator.foreign-I.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.incubator.foreign-I.sym.txt diff --git a/make/data/symbols/jdk.incubator.httpclient-9.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.incubator.httpclient-9.sym.txt similarity index 100% rename from make/data/symbols/jdk.incubator.httpclient-9.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.incubator.httpclient-9.sym.txt diff --git a/make/data/symbols/jdk.incubator.httpclient-A.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.incubator.httpclient-A.sym.txt similarity index 100% rename from make/data/symbols/jdk.incubator.httpclient-A.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.incubator.httpclient-A.sym.txt diff --git a/make/data/symbols/jdk.incubator.httpclient-B.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.incubator.httpclient-B.sym.txt similarity index 100% rename from make/data/symbols/jdk.incubator.httpclient-B.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.incubator.httpclient-B.sym.txt diff --git a/make/data/symbols/jdk.incubator.jpackage-E.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.incubator.jpackage-E.sym.txt similarity index 100% rename from make/data/symbols/jdk.incubator.jpackage-E.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.incubator.jpackage-E.sym.txt diff --git a/make/data/symbols/jdk.incubator.jpackage-G.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.incubator.jpackage-G.sym.txt similarity index 100% rename from make/data/symbols/jdk.incubator.jpackage-G.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.incubator.jpackage-G.sym.txt diff --git a/make/data/symbols/jdk.incubator.vector-G.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.incubator.vector-G.sym.txt similarity index 100% rename from make/data/symbols/jdk.incubator.vector-G.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.incubator.vector-G.sym.txt diff --git a/make/data/symbols/jdk.incubator.vector-H.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.incubator.vector-H.sym.txt similarity index 100% rename from make/data/symbols/jdk.incubator.vector-H.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.incubator.vector-H.sym.txt diff --git a/make/data/symbols/jdk.incubator.vector-I.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.incubator.vector-I.sym.txt similarity index 100% rename from make/data/symbols/jdk.incubator.vector-I.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.incubator.vector-I.sym.txt diff --git a/make/data/symbols/jdk.jartool-9.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.jartool-9.sym.txt similarity index 100% rename from make/data/symbols/jdk.jartool-9.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.jartool-9.sym.txt diff --git a/make/data/symbols/jdk.jartool-A.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.jartool-A.sym.txt similarity index 100% rename from make/data/symbols/jdk.jartool-A.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.jartool-A.sym.txt diff --git a/make/data/symbols/jdk.jartool-B.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.jartool-B.sym.txt similarity index 100% rename from make/data/symbols/jdk.jartool-B.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.jartool-B.sym.txt diff --git a/make/data/symbols/jdk.jartool-D.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.jartool-D.sym.txt similarity index 100% rename from make/data/symbols/jdk.jartool-D.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.jartool-D.sym.txt diff --git a/make/data/symbols/jdk.jartool-F.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.jartool-F.sym.txt similarity index 100% rename from make/data/symbols/jdk.jartool-F.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.jartool-F.sym.txt diff --git a/make/data/symbols/jdk.jartool-G.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.jartool-G.sym.txt similarity index 100% rename from make/data/symbols/jdk.jartool-G.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.jartool-G.sym.txt diff --git a/make/data/symbols/jdk.jartool-H.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.jartool-H.sym.txt similarity index 100% rename from make/data/symbols/jdk.jartool-H.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.jartool-H.sym.txt diff --git a/make/data/symbols/jdk.jartool-I.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.jartool-I.sym.txt similarity index 100% rename from make/data/symbols/jdk.jartool-I.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.jartool-I.sym.txt diff --git a/make/data/symbols/jdk.javadoc-9.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.javadoc-9.sym.txt similarity index 100% rename from make/data/symbols/jdk.javadoc-9.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.javadoc-9.sym.txt diff --git a/make/data/symbols/jdk.javadoc-A.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.javadoc-A.sym.txt similarity index 100% rename from make/data/symbols/jdk.javadoc-A.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.javadoc-A.sym.txt diff --git a/make/data/symbols/jdk.javadoc-B.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.javadoc-B.sym.txt similarity index 100% rename from make/data/symbols/jdk.javadoc-B.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.javadoc-B.sym.txt diff --git a/make/data/symbols/jdk.javadoc-D.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.javadoc-D.sym.txt similarity index 100% rename from make/data/symbols/jdk.javadoc-D.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.javadoc-D.sym.txt diff --git a/make/data/symbols/jdk.javadoc-F.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.javadoc-F.sym.txt similarity index 100% rename from make/data/symbols/jdk.javadoc-F.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.javadoc-F.sym.txt diff --git a/make/data/symbols/jdk.javadoc-G.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.javadoc-G.sym.txt similarity index 100% rename from make/data/symbols/jdk.javadoc-G.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.javadoc-G.sym.txt diff --git a/make/data/symbols/jdk.javadoc-H.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.javadoc-H.sym.txt similarity index 100% rename from make/data/symbols/jdk.javadoc-H.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.javadoc-H.sym.txt diff --git a/make/data/symbols/jdk.javadoc-I.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.javadoc-I.sym.txt similarity index 100% rename from make/data/symbols/jdk.javadoc-I.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.javadoc-I.sym.txt diff --git a/make/data/symbols/jdk.jcmd-9.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.jcmd-9.sym.txt similarity index 100% rename from make/data/symbols/jdk.jcmd-9.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.jcmd-9.sym.txt diff --git a/make/data/symbols/jdk.jcmd-A.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.jcmd-A.sym.txt similarity index 100% rename from make/data/symbols/jdk.jcmd-A.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.jcmd-A.sym.txt diff --git a/make/data/symbols/jdk.jcmd-B.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.jcmd-B.sym.txt similarity index 100% rename from make/data/symbols/jdk.jcmd-B.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.jcmd-B.sym.txt diff --git a/make/data/symbols/jdk.jconsole-9.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.jconsole-9.sym.txt similarity index 100% rename from make/data/symbols/jdk.jconsole-9.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.jconsole-9.sym.txt diff --git a/make/data/symbols/jdk.jconsole-A.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.jconsole-A.sym.txt similarity index 100% rename from make/data/symbols/jdk.jconsole-A.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.jconsole-A.sym.txt diff --git a/make/data/symbols/jdk.jconsole-B.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.jconsole-B.sym.txt similarity index 100% rename from make/data/symbols/jdk.jconsole-B.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.jconsole-B.sym.txt diff --git a/make/data/symbols/jdk.jconsole-G.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.jconsole-G.sym.txt similarity index 100% rename from make/data/symbols/jdk.jconsole-G.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.jconsole-G.sym.txt diff --git a/make/data/symbols/jdk.jconsole-H.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.jconsole-H.sym.txt similarity index 100% rename from make/data/symbols/jdk.jconsole-H.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.jconsole-H.sym.txt diff --git a/make/data/symbols/jdk.jconsole-I.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.jconsole-I.sym.txt similarity index 100% rename from make/data/symbols/jdk.jconsole-I.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.jconsole-I.sym.txt diff --git a/make/data/symbols/jdk.jdeps-9.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.jdeps-9.sym.txt similarity index 100% rename from make/data/symbols/jdk.jdeps-9.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.jdeps-9.sym.txt diff --git a/make/data/symbols/jdk.jdeps-A.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.jdeps-A.sym.txt similarity index 100% rename from make/data/symbols/jdk.jdeps-A.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.jdeps-A.sym.txt diff --git a/make/data/symbols/jdk.jdeps-B.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.jdeps-B.sym.txt similarity index 100% rename from make/data/symbols/jdk.jdeps-B.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.jdeps-B.sym.txt diff --git a/make/data/symbols/jdk.jdi-9.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.jdi-9.sym.txt similarity index 100% rename from make/data/symbols/jdk.jdi-9.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.jdi-9.sym.txt diff --git a/make/data/symbols/jdk.jdi-A.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.jdi-A.sym.txt similarity index 100% rename from make/data/symbols/jdk.jdi-A.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.jdi-A.sym.txt diff --git a/make/data/symbols/jdk.jdi-B.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.jdi-B.sym.txt similarity index 100% rename from make/data/symbols/jdk.jdi-B.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.jdi-B.sym.txt diff --git a/make/data/symbols/jdk.jdi-F.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.jdi-F.sym.txt similarity index 100% rename from make/data/symbols/jdk.jdi-F.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.jdi-F.sym.txt diff --git a/make/data/symbols/jdk.jdi-G.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.jdi-G.sym.txt similarity index 100% rename from make/data/symbols/jdk.jdi-G.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.jdi-G.sym.txt diff --git a/make/data/symbols/jdk.jdi-H.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.jdi-H.sym.txt similarity index 100% rename from make/data/symbols/jdk.jdi-H.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.jdi-H.sym.txt diff --git a/make/data/symbols/jdk.jdi-I.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.jdi-I.sym.txt similarity index 100% rename from make/data/symbols/jdk.jdi-I.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.jdi-I.sym.txt diff --git a/make/data/symbols/jdk.jdwp.agent-9.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.jdwp.agent-9.sym.txt similarity index 100% rename from make/data/symbols/jdk.jdwp.agent-9.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.jdwp.agent-9.sym.txt diff --git a/make/data/symbols/jdk.jdwp.agent-A.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.jdwp.agent-A.sym.txt similarity index 100% rename from make/data/symbols/jdk.jdwp.agent-A.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.jdwp.agent-A.sym.txt diff --git a/make/data/symbols/jdk.jdwp.agent-B.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.jdwp.agent-B.sym.txt similarity index 100% rename from make/data/symbols/jdk.jdwp.agent-B.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.jdwp.agent-B.sym.txt diff --git a/make/data/symbols/jdk.jfr-B.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.jfr-B.sym.txt similarity index 100% rename from make/data/symbols/jdk.jfr-B.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.jfr-B.sym.txt diff --git a/make/data/symbols/jdk.jfr-C.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.jfr-C.sym.txt similarity index 100% rename from make/data/symbols/jdk.jfr-C.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.jfr-C.sym.txt diff --git a/make/data/symbols/jdk.jfr-E.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.jfr-E.sym.txt similarity index 100% rename from make/data/symbols/jdk.jfr-E.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.jfr-E.sym.txt diff --git a/make/data/symbols/jdk.jfr-G.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.jfr-G.sym.txt similarity index 100% rename from make/data/symbols/jdk.jfr-G.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.jfr-G.sym.txt diff --git a/make/data/symbols/jdk.jfr-H.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.jfr-H.sym.txt similarity index 100% rename from make/data/symbols/jdk.jfr-H.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.jfr-H.sym.txt diff --git a/make/data/symbols/jdk.jlink-9.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.jlink-9.sym.txt similarity index 100% rename from make/data/symbols/jdk.jlink-9.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.jlink-9.sym.txt diff --git a/make/data/symbols/jdk.jlink-A.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.jlink-A.sym.txt similarity index 100% rename from make/data/symbols/jdk.jlink-A.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.jlink-A.sym.txt diff --git a/make/data/symbols/jdk.jlink-B.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.jlink-B.sym.txt similarity index 100% rename from make/data/symbols/jdk.jlink-B.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.jlink-B.sym.txt diff --git a/make/data/symbols/jdk.jlink-D.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.jlink-D.sym.txt similarity index 100% rename from make/data/symbols/jdk.jlink-D.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.jlink-D.sym.txt diff --git a/make/data/symbols/jdk.jlink-E.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.jlink-E.sym.txt similarity index 100% rename from make/data/symbols/jdk.jlink-E.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.jlink-E.sym.txt diff --git a/make/data/symbols/jdk.jlink-I.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.jlink-I.sym.txt similarity index 100% rename from make/data/symbols/jdk.jlink-I.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.jlink-I.sym.txt diff --git a/make/data/symbols/jdk.jpackage-G.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.jpackage-G.sym.txt similarity index 100% rename from make/data/symbols/jdk.jpackage-G.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.jpackage-G.sym.txt diff --git a/make/data/symbols/jdk.jshell-9.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.jshell-9.sym.txt similarity index 100% rename from make/data/symbols/jdk.jshell-9.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.jshell-9.sym.txt diff --git a/make/data/symbols/jdk.jshell-A.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.jshell-A.sym.txt similarity index 100% rename from make/data/symbols/jdk.jshell-A.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.jshell-A.sym.txt diff --git a/make/data/symbols/jdk.jshell-B.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.jshell-B.sym.txt similarity index 100% rename from make/data/symbols/jdk.jshell-B.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.jshell-B.sym.txt diff --git a/make/data/symbols/jdk.jshell-D.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.jshell-D.sym.txt similarity index 100% rename from make/data/symbols/jdk.jshell-D.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.jshell-D.sym.txt diff --git a/make/data/symbols/jdk.jshell-E.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.jshell-E.sym.txt similarity index 100% rename from make/data/symbols/jdk.jshell-E.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.jshell-E.sym.txt diff --git a/make/data/symbols/jdk.jshell-G.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.jshell-G.sym.txt similarity index 100% rename from make/data/symbols/jdk.jshell-G.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.jshell-G.sym.txt diff --git a/make/data/symbols/jdk.jshell-H.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.jshell-H.sym.txt similarity index 100% rename from make/data/symbols/jdk.jshell-H.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.jshell-H.sym.txt diff --git a/make/data/symbols/jdk.jshell-I.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.jshell-I.sym.txt similarity index 100% rename from make/data/symbols/jdk.jshell-I.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.jshell-I.sym.txt diff --git a/make/data/symbols/jdk.jsobject-9.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.jsobject-9.sym.txt similarity index 100% rename from make/data/symbols/jdk.jsobject-9.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.jsobject-9.sym.txt diff --git a/make/data/symbols/jdk.jsobject-A.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.jsobject-A.sym.txt similarity index 100% rename from make/data/symbols/jdk.jsobject-A.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.jsobject-A.sym.txt diff --git a/make/data/symbols/jdk.jsobject-B.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.jsobject-B.sym.txt similarity index 100% rename from make/data/symbols/jdk.jsobject-B.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.jsobject-B.sym.txt diff --git a/make/data/symbols/jdk.jsobject-C.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.jsobject-C.sym.txt similarity index 100% rename from make/data/symbols/jdk.jsobject-C.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.jsobject-C.sym.txt diff --git a/make/data/symbols/jdk.jsobject-E.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.jsobject-E.sym.txt similarity index 100% rename from make/data/symbols/jdk.jsobject-E.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.jsobject-E.sym.txt diff --git a/make/data/symbols/jdk.jsobject-G.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.jsobject-G.sym.txt similarity index 100% rename from make/data/symbols/jdk.jsobject-G.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.jsobject-G.sym.txt diff --git a/make/data/symbols/jdk.jsobject-H.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.jsobject-H.sym.txt similarity index 100% rename from make/data/symbols/jdk.jsobject-H.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.jsobject-H.sym.txt diff --git a/make/data/symbols/jdk.jsobject-I.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.jsobject-I.sym.txt similarity index 100% rename from make/data/symbols/jdk.jsobject-I.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.jsobject-I.sym.txt diff --git a/make/data/symbols/jdk.jstatd-9.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.jstatd-9.sym.txt similarity index 100% rename from make/data/symbols/jdk.jstatd-9.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.jstatd-9.sym.txt diff --git a/make/data/symbols/jdk.jstatd-A.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.jstatd-A.sym.txt similarity index 100% rename from make/data/symbols/jdk.jstatd-A.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.jstatd-A.sym.txt diff --git a/make/data/symbols/jdk.jstatd-B.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.jstatd-B.sym.txt similarity index 100% rename from make/data/symbols/jdk.jstatd-B.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.jstatd-B.sym.txt diff --git a/make/data/symbols/jdk.localedata-9.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.localedata-9.sym.txt similarity index 100% rename from make/data/symbols/jdk.localedata-9.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.localedata-9.sym.txt diff --git a/make/data/symbols/jdk.localedata-A.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.localedata-A.sym.txt similarity index 100% rename from make/data/symbols/jdk.localedata-A.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.localedata-A.sym.txt diff --git a/make/data/symbols/jdk.localedata-B.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.localedata-B.sym.txt similarity index 100% rename from make/data/symbols/jdk.localedata-B.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.localedata-B.sym.txt diff --git a/make/data/symbols/jdk.management-7.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.management-7.sym.txt similarity index 100% rename from make/data/symbols/jdk.management-7.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.management-7.sym.txt diff --git a/make/data/symbols/jdk.management-8.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.management-8.sym.txt similarity index 100% rename from make/data/symbols/jdk.management-8.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.management-8.sym.txt diff --git a/make/data/symbols/jdk.management-9.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.management-9.sym.txt similarity index 100% rename from make/data/symbols/jdk.management-9.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.management-9.sym.txt diff --git a/make/data/symbols/jdk.management-A.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.management-A.sym.txt similarity index 100% rename from make/data/symbols/jdk.management-A.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.management-A.sym.txt diff --git a/make/data/symbols/jdk.management-B.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.management-B.sym.txt similarity index 100% rename from make/data/symbols/jdk.management-B.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.management-B.sym.txt diff --git a/make/data/symbols/jdk.management-E.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.management-E.sym.txt similarity index 100% rename from make/data/symbols/jdk.management-E.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.management-E.sym.txt diff --git a/make/data/symbols/jdk.management-G.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.management-G.sym.txt similarity index 100% rename from make/data/symbols/jdk.management-G.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.management-G.sym.txt diff --git a/make/data/symbols/jdk.management-H.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.management-H.sym.txt similarity index 100% rename from make/data/symbols/jdk.management-H.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.management-H.sym.txt diff --git a/make/data/symbols/jdk.management-I.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.management-I.sym.txt similarity index 100% rename from make/data/symbols/jdk.management-I.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.management-I.sym.txt diff --git a/make/data/symbols/jdk.management.agent-9.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.management.agent-9.sym.txt similarity index 100% rename from make/data/symbols/jdk.management.agent-9.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.management.agent-9.sym.txt diff --git a/make/data/symbols/jdk.management.agent-A.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.management.agent-A.sym.txt similarity index 100% rename from make/data/symbols/jdk.management.agent-A.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.management.agent-A.sym.txt diff --git a/make/data/symbols/jdk.management.agent-B.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.management.agent-B.sym.txt similarity index 100% rename from make/data/symbols/jdk.management.agent-B.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.management.agent-B.sym.txt diff --git a/make/data/symbols/jdk.management.jfr-B.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.management.jfr-B.sym.txt similarity index 100% rename from make/data/symbols/jdk.management.jfr-B.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.management.jfr-B.sym.txt diff --git a/make/data/symbols/jdk.management.jfr-G.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.management.jfr-G.sym.txt similarity index 100% rename from make/data/symbols/jdk.management.jfr-G.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.management.jfr-G.sym.txt diff --git a/make/data/symbols/jdk.management.jfr-H.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.management.jfr-H.sym.txt similarity index 100% rename from make/data/symbols/jdk.management.jfr-H.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.management.jfr-H.sym.txt diff --git a/make/data/symbols/jdk.management.jfr-I.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.management.jfr-I.sym.txt similarity index 100% rename from make/data/symbols/jdk.management.jfr-I.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.management.jfr-I.sym.txt diff --git a/make/data/symbols/jdk.naming.dns-9.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.naming.dns-9.sym.txt similarity index 100% rename from make/data/symbols/jdk.naming.dns-9.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.naming.dns-9.sym.txt diff --git a/make/data/symbols/jdk.naming.dns-A.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.naming.dns-A.sym.txt similarity index 100% rename from make/data/symbols/jdk.naming.dns-A.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.naming.dns-A.sym.txt diff --git a/make/data/symbols/jdk.naming.dns-B.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.naming.dns-B.sym.txt similarity index 100% rename from make/data/symbols/jdk.naming.dns-B.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.naming.dns-B.sym.txt diff --git a/make/data/symbols/jdk.naming.rmi-9.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.naming.rmi-9.sym.txt similarity index 100% rename from make/data/symbols/jdk.naming.rmi-9.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.naming.rmi-9.sym.txt diff --git a/make/data/symbols/jdk.naming.rmi-A.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.naming.rmi-A.sym.txt similarity index 100% rename from make/data/symbols/jdk.naming.rmi-A.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.naming.rmi-A.sym.txt diff --git a/make/data/symbols/jdk.naming.rmi-B.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.naming.rmi-B.sym.txt similarity index 100% rename from make/data/symbols/jdk.naming.rmi-B.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.naming.rmi-B.sym.txt diff --git a/make/data/symbols/jdk.net-9.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.net-9.sym.txt similarity index 100% rename from make/data/symbols/jdk.net-9.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.net-9.sym.txt diff --git a/make/data/symbols/jdk.net-A.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.net-A.sym.txt similarity index 100% rename from make/data/symbols/jdk.net-A.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.net-A.sym.txt diff --git a/make/data/symbols/jdk.net-B.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.net-B.sym.txt similarity index 100% rename from make/data/symbols/jdk.net-B.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.net-B.sym.txt diff --git a/make/data/symbols/jdk.net-E.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.net-E.sym.txt similarity index 100% rename from make/data/symbols/jdk.net-E.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.net-E.sym.txt diff --git a/make/data/symbols/jdk.net-F.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.net-F.sym.txt similarity index 100% rename from make/data/symbols/jdk.net-F.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.net-F.sym.txt diff --git a/make/data/symbols/jdk.net-G.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.net-G.sym.txt similarity index 100% rename from make/data/symbols/jdk.net-G.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.net-G.sym.txt diff --git a/make/data/symbols/jdk.net-H.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.net-H.sym.txt similarity index 100% rename from make/data/symbols/jdk.net-H.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.net-H.sym.txt diff --git a/make/data/symbols/jdk.net-I.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.net-I.sym.txt similarity index 100% rename from make/data/symbols/jdk.net-I.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.net-I.sym.txt diff --git a/make/data/symbols/jdk.nio.mapmode-F.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.nio.mapmode-F.sym.txt similarity index 100% rename from make/data/symbols/jdk.nio.mapmode-F.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.nio.mapmode-F.sym.txt diff --git a/make/data/symbols/jdk.pack-9.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.pack-9.sym.txt similarity index 100% rename from make/data/symbols/jdk.pack-9.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.pack-9.sym.txt diff --git a/make/data/symbols/jdk.pack-A.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.pack-A.sym.txt similarity index 100% rename from make/data/symbols/jdk.pack-A.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.pack-A.sym.txt diff --git a/make/data/symbols/jdk.pack-B.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.pack-B.sym.txt similarity index 100% rename from make/data/symbols/jdk.pack-B.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.pack-B.sym.txt diff --git a/make/data/symbols/jdk.pack-E.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.pack-E.sym.txt similarity index 100% rename from make/data/symbols/jdk.pack-E.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.pack-E.sym.txt diff --git a/make/data/symbols/jdk.policytool-9.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.policytool-9.sym.txt similarity index 100% rename from make/data/symbols/jdk.policytool-9.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.policytool-9.sym.txt diff --git a/make/data/symbols/jdk.policytool-A.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.policytool-A.sym.txt similarity index 100% rename from make/data/symbols/jdk.policytool-A.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.policytool-A.sym.txt diff --git a/make/data/symbols/jdk.rmic-9.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.rmic-9.sym.txt similarity index 100% rename from make/data/symbols/jdk.rmic-9.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.rmic-9.sym.txt diff --git a/make/data/symbols/jdk.rmic-A.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.rmic-A.sym.txt similarity index 100% rename from make/data/symbols/jdk.rmic-A.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.rmic-A.sym.txt diff --git a/make/data/symbols/jdk.rmic-B.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.rmic-B.sym.txt similarity index 100% rename from make/data/symbols/jdk.rmic-B.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.rmic-B.sym.txt diff --git a/make/data/symbols/jdk.rmic-F.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.rmic-F.sym.txt similarity index 100% rename from make/data/symbols/jdk.rmic-F.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.rmic-F.sym.txt diff --git a/make/data/symbols/jdk.scripting.nashorn-7.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.scripting.nashorn-7.sym.txt similarity index 100% rename from make/data/symbols/jdk.scripting.nashorn-7.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.scripting.nashorn-7.sym.txt diff --git a/make/data/symbols/jdk.scripting.nashorn-8.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.scripting.nashorn-8.sym.txt similarity index 100% rename from make/data/symbols/jdk.scripting.nashorn-8.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.scripting.nashorn-8.sym.txt diff --git a/make/data/symbols/jdk.scripting.nashorn-9.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.scripting.nashorn-9.sym.txt similarity index 100% rename from make/data/symbols/jdk.scripting.nashorn-9.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.scripting.nashorn-9.sym.txt diff --git a/make/data/symbols/jdk.scripting.nashorn-A.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.scripting.nashorn-A.sym.txt similarity index 100% rename from make/data/symbols/jdk.scripting.nashorn-A.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.scripting.nashorn-A.sym.txt diff --git a/make/data/symbols/jdk.scripting.nashorn-B.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.scripting.nashorn-B.sym.txt similarity index 100% rename from make/data/symbols/jdk.scripting.nashorn-B.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.scripting.nashorn-B.sym.txt diff --git a/make/data/symbols/jdk.scripting.nashorn-F.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.scripting.nashorn-F.sym.txt similarity index 100% rename from make/data/symbols/jdk.scripting.nashorn-F.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.scripting.nashorn-F.sym.txt diff --git a/make/data/symbols/jdk.sctp-7.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.sctp-7.sym.txt similarity index 100% rename from make/data/symbols/jdk.sctp-7.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.sctp-7.sym.txt diff --git a/make/data/symbols/jdk.sctp-8.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.sctp-8.sym.txt similarity index 100% rename from make/data/symbols/jdk.sctp-8.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.sctp-8.sym.txt diff --git a/make/data/symbols/jdk.sctp-9.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.sctp-9.sym.txt similarity index 100% rename from make/data/symbols/jdk.sctp-9.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.sctp-9.sym.txt diff --git a/make/data/symbols/jdk.sctp-A.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.sctp-A.sym.txt similarity index 100% rename from make/data/symbols/jdk.sctp-A.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.sctp-A.sym.txt diff --git a/make/data/symbols/jdk.sctp-B.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.sctp-B.sym.txt similarity index 100% rename from make/data/symbols/jdk.sctp-B.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.sctp-B.sym.txt diff --git a/make/data/symbols/jdk.sctp-G.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.sctp-G.sym.txt similarity index 100% rename from make/data/symbols/jdk.sctp-G.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.sctp-G.sym.txt diff --git a/make/data/symbols/jdk.sctp-H.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.sctp-H.sym.txt similarity index 100% rename from make/data/symbols/jdk.sctp-H.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.sctp-H.sym.txt diff --git a/make/data/symbols/jdk.sctp-I.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.sctp-I.sym.txt similarity index 100% rename from make/data/symbols/jdk.sctp-I.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.sctp-I.sym.txt diff --git a/make/data/symbols/jdk.security.auth-7.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.security.auth-7.sym.txt similarity index 100% rename from make/data/symbols/jdk.security.auth-7.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.security.auth-7.sym.txt diff --git a/make/data/symbols/jdk.security.auth-8.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.security.auth-8.sym.txt similarity index 100% rename from make/data/symbols/jdk.security.auth-8.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.security.auth-8.sym.txt diff --git a/make/data/symbols/jdk.security.auth-9.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.security.auth-9.sym.txt similarity index 100% rename from make/data/symbols/jdk.security.auth-9.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.security.auth-9.sym.txt diff --git a/make/data/symbols/jdk.security.auth-A.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.security.auth-A.sym.txt similarity index 100% rename from make/data/symbols/jdk.security.auth-A.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.security.auth-A.sym.txt diff --git a/make/data/symbols/jdk.security.auth-B.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.security.auth-B.sym.txt similarity index 100% rename from make/data/symbols/jdk.security.auth-B.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.security.auth-B.sym.txt diff --git a/make/data/symbols/jdk.security.auth-G.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.security.auth-G.sym.txt similarity index 100% rename from make/data/symbols/jdk.security.auth-G.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.security.auth-G.sym.txt diff --git a/make/data/symbols/jdk.security.auth-H.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.security.auth-H.sym.txt similarity index 100% rename from make/data/symbols/jdk.security.auth-H.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.security.auth-H.sym.txt diff --git a/make/data/symbols/jdk.security.auth-I.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.security.auth-I.sym.txt similarity index 100% rename from make/data/symbols/jdk.security.auth-I.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.security.auth-I.sym.txt diff --git a/make/data/symbols/jdk.security.jgss-7.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.security.jgss-7.sym.txt similarity index 100% rename from make/data/symbols/jdk.security.jgss-7.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.security.jgss-7.sym.txt diff --git a/make/data/symbols/jdk.security.jgss-8.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.security.jgss-8.sym.txt similarity index 100% rename from make/data/symbols/jdk.security.jgss-8.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.security.jgss-8.sym.txt diff --git a/make/data/symbols/jdk.security.jgss-9.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.security.jgss-9.sym.txt similarity index 100% rename from make/data/symbols/jdk.security.jgss-9.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.security.jgss-9.sym.txt diff --git a/make/data/symbols/jdk.security.jgss-A.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.security.jgss-A.sym.txt similarity index 100% rename from make/data/symbols/jdk.security.jgss-A.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.security.jgss-A.sym.txt diff --git a/make/data/symbols/jdk.security.jgss-B.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.security.jgss-B.sym.txt similarity index 100% rename from make/data/symbols/jdk.security.jgss-B.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.security.jgss-B.sym.txt diff --git a/make/data/symbols/jdk.security.jgss-G.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.security.jgss-G.sym.txt similarity index 100% rename from make/data/symbols/jdk.security.jgss-G.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.security.jgss-G.sym.txt diff --git a/make/data/symbols/jdk.security.jgss-H.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.security.jgss-H.sym.txt similarity index 100% rename from make/data/symbols/jdk.security.jgss-H.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.security.jgss-H.sym.txt diff --git a/make/data/symbols/jdk.security.jgss-I.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.security.jgss-I.sym.txt similarity index 100% rename from make/data/symbols/jdk.security.jgss-I.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.security.jgss-I.sym.txt diff --git a/make/data/symbols/jdk.unsupported-9.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.unsupported-9.sym.txt similarity index 100% rename from make/data/symbols/jdk.unsupported-9.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.unsupported-9.sym.txt diff --git a/make/data/symbols/jdk.unsupported-A.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.unsupported-A.sym.txt similarity index 100% rename from make/data/symbols/jdk.unsupported-A.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.unsupported-A.sym.txt diff --git a/make/data/symbols/jdk.unsupported-B.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.unsupported-B.sym.txt similarity index 100% rename from make/data/symbols/jdk.unsupported-B.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.unsupported-B.sym.txt diff --git a/make/data/symbols/jdk.unsupported-C.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.unsupported-C.sym.txt similarity index 100% rename from make/data/symbols/jdk.unsupported-C.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.unsupported-C.sym.txt diff --git a/make/data/symbols/jdk.unsupported-F.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.unsupported-F.sym.txt similarity index 100% rename from make/data/symbols/jdk.unsupported-F.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.unsupported-F.sym.txt diff --git a/make/data/symbols/jdk.unsupported-G.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.unsupported-G.sym.txt similarity index 100% rename from make/data/symbols/jdk.unsupported-G.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.unsupported-G.sym.txt diff --git a/make/data/symbols/jdk.unsupported-H.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.unsupported-H.sym.txt similarity index 100% rename from make/data/symbols/jdk.unsupported-H.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.unsupported-H.sym.txt diff --git a/make/data/symbols/jdk.unsupported-I.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.unsupported-I.sym.txt similarity index 100% rename from make/data/symbols/jdk.unsupported-I.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.unsupported-I.sym.txt diff --git a/make/data/symbols/jdk.xml.dom-9.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.xml.dom-9.sym.txt similarity index 100% rename from make/data/symbols/jdk.xml.dom-9.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.xml.dom-9.sym.txt diff --git a/make/data/symbols/jdk.xml.dom-A.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.xml.dom-A.sym.txt similarity index 100% rename from make/data/symbols/jdk.xml.dom-A.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.xml.dom-A.sym.txt diff --git a/make/data/symbols/jdk.xml.dom-B.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.xml.dom-B.sym.txt similarity index 100% rename from make/data/symbols/jdk.xml.dom-B.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.xml.dom-B.sym.txt diff --git a/make/data/symbols/jdk.xml.dom-G.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.xml.dom-G.sym.txt similarity index 100% rename from make/data/symbols/jdk.xml.dom-G.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.xml.dom-G.sym.txt diff --git a/make/data/symbols/jdk.xml.dom-H.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.xml.dom-H.sym.txt similarity index 100% rename from make/data/symbols/jdk.xml.dom-H.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.xml.dom-H.sym.txt diff --git a/make/data/symbols/jdk.xml.dom-I.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.xml.dom-I.sym.txt similarity index 100% rename from make/data/symbols/jdk.xml.dom-I.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.xml.dom-I.sym.txt diff --git a/make/data/symbols/jdk.zipfs-9.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.zipfs-9.sym.txt similarity index 100% rename from make/data/symbols/jdk.zipfs-9.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.zipfs-9.sym.txt diff --git a/make/data/symbols/jdk.zipfs-A.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.zipfs-A.sym.txt similarity index 100% rename from make/data/symbols/jdk.zipfs-A.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.zipfs-A.sym.txt diff --git a/make/data/symbols/jdk.zipfs-B.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.zipfs-B.sym.txt similarity index 100% rename from make/data/symbols/jdk.zipfs-B.sym.txt rename to src/jdk.compiler/share/data/symbols/jdk.zipfs-B.sym.txt diff --git a/make/data/symbols/symbols b/src/jdk.compiler/share/data/symbols/symbols similarity index 100% rename from make/data/symbols/symbols rename to src/jdk.compiler/share/data/symbols/symbols diff --git a/test/jdk/java/security/misc/Versions.java b/test/jdk/java/security/misc/Versions.java index 6c14b2bc212..ebfe9a13a88 100644 --- a/test/jdk/java/security/misc/Versions.java +++ b/test/jdk/java/security/misc/Versions.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2022, 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 @@ -51,7 +51,7 @@ public class Versions { "src/java.xml.crypto/share/legal/santuario.md", Pattern.compile("## Apache Santuario v(?\\S+)"), "java.xml.crypto/santuario.md"}, - {"make/data/publicsuffixlist/VERSION", + {"src/java.base/share/data/publicsuffixlist/VERSION", Pattern.compile("list/(?[0-9a-f]+)/public_suffix_list.dat"), "src/java.base/share/legal/public_suffix.md", Pattern.compile("list/(?[0-9a-f]+)/public_suffix_list.dat"), diff --git a/test/jdk/java/util/Currency/CurrencyTest.java b/test/jdk/java/util/Currency/CurrencyTest.java index ad7c596485b..f82b032e2f8 100644 --- a/test/jdk/java/util/Currency/CurrencyTest.java +++ b/test/jdk/java/util/Currency/CurrencyTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2022, 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 @@ -139,7 +139,7 @@ public class CurrencyTest { /* * check currency changes - * In current implementation, there is no data of old currency and transition date at jdk/make/data/currency/CurrencyData.properties. + * In current implementation, there is no data of old currency and transition date at jdk/src/java.base/share/data/currency/CurrencyData.properties. * So, all the switch data arrays are empty. In the future, if data of old currency and transition date are necessary for any country, the * arrays here can be updated so that the program can check the currency switch. */ diff --git a/test/jdk/java/util/Locale/LSRDataTest.java b/test/jdk/java/util/Locale/LSRDataTest.java index 81edf48b9b0..f32642981b5 100644 --- a/test/jdk/java/util/Locale/LSRDataTest.java +++ b/test/jdk/java/util/Locale/LSRDataTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2022, 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 @@ -52,11 +52,11 @@ public class LSRDataTest { private static final Map> multiLangEquivsMap = new HashMap<>(); private static final Map regionVariantEquivMap = new HashMap<>(); - // path to the lsr file from the make folder, this test relies on the - // relative path to the file in the make folder, considering - // test and make will always exist in the same jdk layout + // path to the lsr file from the data folder, this test relies on the + // relative path to the file in the data folder, considering + // test and src/.../data will always exist in the same jdk layout private static final String LSR_FILE_PATH = System.getProperty("test.src", ".") - + "/../../../../../make/data/lsrdata/language-subtag-registry.txt"; + + "/../../../../../src/java.base/share/data/lsrdata/language-subtag-registry.txt"; public static void main(String[] args) throws IOException { diff --git a/test/jdk/lib/testlibrary/java/lang/UCDFiles.java b/test/jdk/lib/testlibrary/java/lang/UCDFiles.java index 10c6243f615..83054c5c0fb 100644 --- a/test/jdk/lib/testlibrary/java/lang/UCDFiles.java +++ b/test/jdk/lib/testlibrary/java/lang/UCDFiles.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2022, 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,16 +23,15 @@ /** * Holds the file paths to the Unicode Character Database source files. - * Paths to the source files in the "make" directory are relative, and - * subject to change due to future repository structure re-org. + * Paths to the source files in the "data" directory are relative. */ import java.nio.file.Path; import java.nio.file.Paths; public class UCDFiles { - public static Path UCD_DIR = Paths.get( - System.getProperty("test.root"), "..", "..", "make", "data", "unicodedata"); + public static Path UCD_DIR = Paths.get(System.getProperty("test.root"), + "../../src/java.base/share/data/unicodedata"); public static Path BLOCKS = UCD_DIR.resolve("Blocks.txt"); diff --git a/test/jdk/sun/nio/cs/TestCharsetMapping.java b/test/jdk/sun/nio/cs/TestCharsetMapping.java index 63eeba1774e..c7bd101aa42 100644 --- a/test/jdk/sun/nio/cs/TestCharsetMapping.java +++ b/test/jdk/sun/nio/cs/TestCharsetMapping.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2022, 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 @@ -569,7 +569,7 @@ public class TestCharsetMapping { public static void main(String args[]) throws Exception { Path dir = Paths.get(System.getProperty("test.src", ".") + - "/../../../../make/data/charsetmapping"); + "/../../../../src/java.base/share/data/charsetmapping"); if (!Files.exists(dir)) { // not inside jdk repo, no mappings, exit silently log.println("Nothing done, not in a jdk repo: "); diff --git a/test/jdk/sun/nio/cs/TestMS950.java b/test/jdk/sun/nio/cs/TestMS950.java index 6d567e07751..36820f381a0 100644 --- a/test/jdk/sun/nio/cs/TestMS950.java +++ b/test/jdk/sun/nio/cs/TestMS950.java @@ -33,7 +33,7 @@ import java.nio.ByteBuffer; import java.util.Arrays; public class TestMS950 { - // Data is listed from make/data/charsetmapping/MS950.map + // Data is listed from src/java.base/share/data/charsetmapping/MS950.map private final static String[] MS950B2C = new String[] { "0xF9FA 0x256D", "0xF9FB 0x256E", diff --git a/test/jdk/sun/security/lib/CheckBlockedCerts.java b/test/jdk/sun/security/lib/CheckBlockedCerts.java index e5561bf15b8..5afbf4b610b 100644 --- a/test/jdk/sun/security/lib/CheckBlockedCerts.java +++ b/test/jdk/sun/security/lib/CheckBlockedCerts.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2022, 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 @@ -61,7 +61,7 @@ public class CheckBlockedCerts { // Assumes the full src is available File blockedCertsFile = new File(System.getProperty("test.src"), - "../../../../../make/data/blockedcertsconverter/blocked.certs.pem"); + "../../../../../src/java.base/share/data/blockedcertsconverter/blocked.certs.pem"); CertificateFactory cf = CertificateFactory.getInstance("X.509"); try (FileInputStream fis = new FileInputStream(blockedCertsFile)) { diff --git a/test/jdk/sun/util/calendar/zi/TestZoneInfo310.java b/test/jdk/sun/util/calendar/zi/TestZoneInfo310.java index 7b50c342a0d..ef6405860f5 100644 --- a/test/jdk/sun/util/calendar/zi/TestZoneInfo310.java +++ b/test/jdk/sun/util/calendar/zi/TestZoneInfo310.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2022, 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 @@ -47,7 +47,7 @@ public class TestZoneInfo310 { String TESTDIR = System.getProperty("test.dir", "."); Path tzdir = Paths.get(System.getProperty("test.root"), - "..", "..", "make", "data", "tzdata"); + "../../src/java.base/share/data/tzdata"); String tzfiles = "africa antarctica asia australasia europe northamerica southamerica backward etcetera gmt"; Path jdk_tzdir = Paths.get(System.getProperty("test.src"), "tzdata_jdk"); String jdk_tzfiles = "jdk11_backward"; diff --git a/test/langtools/tools/javac/platform/CanHandleClassFilesTest.java b/test/langtools/tools/javac/platform/CanHandleClassFilesTest.java index 8afdf54f40d..ae4f525e4ee 100644 --- a/test/langtools/tools/javac/platform/CanHandleClassFilesTest.java +++ b/test/langtools/tools/javac/platform/CanHandleClassFilesTest.java @@ -64,7 +64,7 @@ public class CanHandleClassFilesTest { Path test = d.resolve("make/langtools/src/classes/build/tools/symbolgenerator/CreateSymbols.java"); if (Files.exists(test)) { createSymbols = test; - includeList = d.resolve("make/data/symbols/include.list"); + includeList = d.resolve("src/jdk.compiler/share/data/symbols/include.list"); break; } } diff --git a/test/langtools/tools/javac/sym/ElementStructureTest.java b/test/langtools/tools/javac/sym/ElementStructureTest.java index db5ae5f4582..791785b2452 100644 --- a/test/langtools/tools/javac/sym/ElementStructureTest.java +++ b/test/langtools/tools/javac/sym/ElementStructureTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2022, 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 @@ -104,7 +104,7 @@ import toolbox.ToolBox; /**To generate the hash values for version N, invoke this class like: * - * java ElementStructureTest generate-hashes $LANGTOOLS_DIR/make/data/symbols/include.list ( N)+ + * java ElementStructureTest generate-hashes $LANGTOOLS_DIR/src/jdk.compiler/share/data/symbols/include.list ( N)+ * * Where is the file produced by make/src/classes/build/tools/symbolgenerator/Probe.java. * So, to produce hashes for 6, 7 and 8, this command can be used: @@ -113,11 +113,11 @@ import toolbox.ToolBox; * * To inspect differences between the actual and expected output for version N, invoke this class like: * - * java ElementStructureTest generate-output $LANGTOOLS_DIR/make/data/symbols/include.list ( N )+ + * java ElementStructureTest generate-output $LANGTOOLS_DIR/src/jdk.compiler/share/data/symbols/include.list ( N )+ * * For example, to get the actual and expected output for 6 in /tmp/actual and /tmp/expected, respectively: * - * java ElementStructureTest generate-output $LANGTOOLS_DIR/make/data/symbols/include.list classes-6 6 /tmp/actual /tmp/expected + * java ElementStructureTest generate-output $LANGTOOLS_DIR/src/jdk.compiler/share/data/symbols/include.list classes-6 6 /tmp/actual /tmp/expected */ public class ElementStructureTest { -- GitLab From f3dc0c88ea00a3745f5f105404e0788a0f616407 Mon Sep 17 00:00:00 2001 From: David Holmes Date: Tue, 22 Mar 2022 01:12:29 +0000 Subject: [PATCH 307/340] 8282721: HotSpot Style Guide should allow considered use of C++ thread_local Reviewed-by: kbarrett, jrose, dcubed, stuefe, mdoerr, kvn --- doc/hotspot-style.html | 6 +++--- doc/hotspot-style.md | 34 +++++++++++++++++++++------------- 2 files changed, 24 insertions(+), 16 deletions(-) diff --git a/doc/hotspot-style.html b/doc/hotspot-style.html index 453b9fbc14b..c93b941c988 100644 --- a/doc/hotspot-style.html +++ b/doc/hotspot-style.html @@ -210,7 +210,7 @@ while ( test_foo(args...) ) { // No, excess spaces around controlRationale: Other than to implement exceptions (which HotSpot doesn't use), most potential uses of RTTI are better done via virtual functions. Some of the remainder can be replaced by bespoke mechanisms. The cost of the additional runtime data structures needed to support RTTI are deemed not worthwhile, given the alternatives.

    Memory Allocation

    Do not use the standard global allocation and deallocation functions (operator new and related functions). Use of these functions by HotSpot code is disabled for some platforms.

    -

    Rationale: HotSpot often uses "resource" or "arena" allocation. Even where heap allocation is used, the standard global functions are avoided in favor of wrappers around malloc and free that support the VM's Native Memory Tracking (NMT) feature.

    +

    Rationale: HotSpot often uses "resource" or "arena" allocation. Even where heap allocation is used, the standard global functions are avoided in favor of wrappers around malloc and free that support the VM's Native Memory Tracking (NMT) feature. Typically, uses of the global operator new are inadvertent and therefore often associated with memory leaks.

    Native memory allocation failures are often treated as non-recoverable. The place where "out of memory" is (first) detected may be an innocent bystander, unrelated to the actual culprit.

    Class Inheritance

    Use public single inheritance.

    @@ -270,8 +270,8 @@ while ( test_foo(args...) ) { // No, excess spaces around controlThe underlying type of a scoped-enum should also be specified explicitly if conversions may be applied to values of that type.

    Due to bugs in certain (very old) compilers, there is widespread use of enums and avoidance of in-class initialization of static integral constant members. Compilers having such bugs are no longer supported. Except where an enum is semantically appropriate, new code should use integral constants.

    thread_local

    -

    Do not use thread_local (n2659); instead, use the HotSpot macro THREAD_LOCAL. The initializer must be a constant expression.

    -

    As was discussed in the review for JDK-8230877, thread_local allows dynamic initialization and destruction semantics. However, that support requires a run-time penalty for references to non-function-local thread_local variables defined in a different translation unit, even if they don't need dynamic initialization. Dynamic initialization and destruction of namespace-scoped thread local variables also has the same ordering problems as for ordinary namespace-scoped variables.

    +

    Avoid use of thread_local (n2659); and instead, use the HotSpot macro THREAD_LOCAL, for which the initializer must be a constant expression. When thread_local must be used, use the Hotspot macro APPROVED_CPP_THREAD_LOCAL to indicate that the use has been given appropriate consideration.

    +

    As was discussed in the review for JDK-8230877, thread_local allows dynamic initialization and destruction semantics. However, that support requires a run-time penalty for references to non-function-local thread_local variables defined in a different translation unit, even if they don't need dynamic initialization. Dynamic initialization and destruction of non-local thread_local variables also has the same ordering problems as for ordinary non-local variables. So we avoid use of thread_local in general, limiting its use to only those cases where dynamic initialization or destruction are essential. See JDK-8282469 for further discussion.

    nullptr

    Prefer nullptr (n2431) to NULL. Don't use (constexpr or literal) 0 for pointers.

    For historical reasons there are widespread uses of both NULL and of integer 0 as a pointer value.

    diff --git a/doc/hotspot-style.md b/doc/hotspot-style.md index 84cb22a1bda..89d9684672d 100644 --- a/doc/hotspot-style.md +++ b/doc/hotspot-style.md @@ -471,7 +471,9 @@ code is disabled for some platforms. Rationale: HotSpot often uses "resource" or "arena" allocation. Even where heap allocation is used, the standard global functions are avoided in favor of wrappers around malloc and free that support the -VM's Native Memory Tracking (NMT) feature. +VM's Native Memory Tracking (NMT) feature. Typically, uses of the global +operator new are inadvertent and therefore often associated with memory +leaks. Native memory allocation failures are often treated as non-recoverable. The place where "out of memory" is (first) detected may be an innocent @@ -631,7 +633,7 @@ Here are a few closely related example bugs:
    ### enum Where appropriate, _scoped-enums_ should be used. -([n2347](http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2347.pdf)) +([n2347](http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2347.pdf)) Use of _unscoped-enums_ is permitted, though ordinary constants may be preferable when the automatic initializer feature isn't used. @@ -651,10 +653,12 @@ integral constants. ### thread_local -Do not use `thread_local` +Avoid use of `thread_local` ([n2659](http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2659.htm)); -instead, use the HotSpot macro `THREAD_LOCAL`. The initializer must -be a constant expression. +and instead, use the HotSpot macro `THREAD_LOCAL`, for which the initializer must +be a constant expression. When `thread_local` must be used, use the Hotspot macro +`APPROVED_CPP_THREAD_LOCAL` to indicate that the use has been given appropriate +consideration. As was discussed in the review for [JDK-8230877](https://mail.openjdk.java.net/pipermail/hotspot-dev/2019-September/039487.html), @@ -663,14 +667,18 @@ semantics. However, that support requires a run-time penalty for references to non-function-local `thread_local` variables defined in a different translation unit, even if they don't need dynamic initialization. Dynamic initialization and destruction of -namespace-scoped thread local variables also has the same ordering -problems as for ordinary namespace-scoped variables. +non-local `thread_local` variables also has the same ordering +problems as for ordinary non-local variables. So we avoid use of +`thread_local` in general, limiting its use to only those cases where dynamic +initialization or destruction are essential. See +[JDK-8282469](https://bugs.openjdk.java.net/browse/JDK-8282469) +for further discussion. ### nullptr Prefer `nullptr` ([n2431](http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2431.pdf)) -to `NULL`. Don't use (constexpr or literal) 0 for pointers. +to `NULL`. Don't use (constexpr or literal) 0 for pointers. For historical reasons there are widespread uses of both `NULL` and of integer 0 as a pointer value. @@ -939,7 +947,7 @@ References: * Generalized lambda capture (init-capture) ([N3648]) * Generic (polymorphic) lambda expressions ([N3649]) -[n2657]: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2657.htm +[n2657]: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2657.htm [n2927]: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2009/n2927.pdf [N3648]: https://isocpp.org/files/papers/N3648.html [N3649]: https://isocpp.org/files/papers/N3649.html @@ -980,7 +988,7 @@ References from C++23 ### Additional Permitted Features * `constexpr` -([n2235](http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2235.pdf)) +([n2235](http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2235.pdf)) ([n3652](https://isocpp.org/files/papers/N3652.html)) * Sized deallocation @@ -1087,14 +1095,14 @@ in HotSpot code because of the "no implicit boolean" guideline.) * Avoid covariant return types. -* Avoid `goto` statements. +* Avoid `goto` statements. ### Undecided Features This list is incomplete; it serves to explicitly call out some features that have not yet been discussed. -* Trailing return type syntax for functions +* Trailing return type syntax for functions ([n2541](http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2541.htm)) * Variable templates @@ -1108,7 +1116,7 @@ features that have not yet been discussed. * Rvalue references and move semantics -[ADL]: https://en.cppreference.com/w/cpp/language/adl +[ADL]: https://en.cppreference.com/w/cpp/language/adl "Argument Dependent Lookup" [ODR]: https://en.cppreference.com/w/cpp/language/definition -- GitLab From 81d63734bc2e2a18063cb6afbc53f8813a0ba880 Mon Sep 17 00:00:00 2001 From: David Holmes Date: Tue, 22 Mar 2022 01:20:31 +0000 Subject: [PATCH 308/340] 8282469: Allow considered use of C++ thread_local in Hotspot Reviewed-by: kbarrett, dcubed --- src/hotspot/share/memory/operator_new.cpp | 100 ------------------ .../share/utilities/globalDefinitions.hpp | 4 + 2 files changed, 4 insertions(+), 100 deletions(-) delete mode 100644 src/hotspot/share/memory/operator_new.cpp diff --git a/src/hotspot/share/memory/operator_new.cpp b/src/hotspot/share/memory/operator_new.cpp deleted file mode 100644 index 357e26f9c88..00000000000 --- a/src/hotspot/share/memory/operator_new.cpp +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Copyright (c) 1997, 2021, 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. - * - */ - -#include "precompiled.hpp" -#include "utilities/debug.hpp" - -#include - -//-------------------------------------------------------------------------------------- -// Non-product code - -#ifndef PRODUCT -// The global operator new should never be called since it will usually indicate -// a memory leak. Use CHeapObj as the base class of such objects to make it explicit -// that they're allocated on the C heap. -// Commented out in product version to avoid conflicts with third-party C++ native code. -// -// In C++98/03 the throwing new operators are defined with the following signature: -// -// void* operator new(std::size_tsize) throw(std::bad_alloc); -// void* operator new[](std::size_tsize) throw(std::bad_alloc); -// -// while all the other (non-throwing) new and delete operators are defined with an empty -// throw clause (i.e. "operator delete(void* p) throw()") which means that they do not -// throw any exceptions (see section 18.4 of the C++ standard). -// -// In the new C++11/14 standard, the signature of the throwing new operators was changed -// by completely omitting the throw clause (which effectively means they could throw any -// exception) while all the other new/delete operators where changed to have a 'nothrow' -// clause instead of an empty throw clause. -// -// Unfortunately, the support for exception specifications among C++ compilers is still -// very fragile. While some more strict compilers like AIX xlC or HP aCC reject to -// override the default throwing new operator with a user operator with an empty throw() -// clause, the MS Visual C++ compiler warns for every non-empty throw clause like -// throw(std::bad_alloc) that it will ignore the exception specification. The following -// operator definitions have been checked to correctly work with all currently supported -// compilers and they should be upwards compatible with C++11/14. Therefore -// PLEASE BE CAREFUL if you change the signature of the following operators! - -static void * zero = (void *) 0; - -void* operator new(size_t size) /* throw(std::bad_alloc) */ { - fatal("Should not call global operator new"); - return zero; -} - -void* operator new [](size_t size) /* throw(std::bad_alloc) */ { - fatal("Should not call global operator new[]"); - return zero; -} - -void* operator new(size_t size, const std::nothrow_t& nothrow_constant) throw() { - fatal("Should not call global operator new"); - return 0; -} - -void* operator new [](size_t size, std::nothrow_t& nothrow_constant) throw() { - fatal("Should not call global operator new[]"); - return 0; -} - -void operator delete(void* p) throw() { - fatal("Should not call global delete"); -} - -void operator delete [](void* p) throw() { - fatal("Should not call global delete []"); -} - -void operator delete(void* p, size_t size) throw() { - fatal("Should not call global sized delete"); -} - -void operator delete [](void* p, size_t size) throw() { - fatal("Should not call global sized delete []"); -} - -#endif // Non-product diff --git a/src/hotspot/share/utilities/globalDefinitions.hpp b/src/hotspot/share/utilities/globalDefinitions.hpp index 1b0b90e70fc..fdd3db8875a 100644 --- a/src/hotspot/share/utilities/globalDefinitions.hpp +++ b/src/hotspot/share/utilities/globalDefinitions.hpp @@ -1219,5 +1219,9 @@ template bool primitive_equals(const K& k0, const K& k1) { return k0 == k1; } +//---------------------------------------------------------------------------------------------------- + +// Allow use of C++ thread_local when approved - see JDK-8282469. +#define APPROVED_CPP_THREAD_LOCAL thread_local #endif // SHARE_UTILITIES_GLOBALDEFINITIONS_HPP -- GitLab From 849b19523a666bd2ec110876bfd5679b20be77f4 Mon Sep 17 00:00:00 2001 From: Manukumar V S Date: Tue, 22 Mar 2022 01:28:06 +0000 Subject: [PATCH 309/340] 8282937: Write a regression test for JDK-4820080 Reviewed-by: serb --- .../4820080/JSplitPaneDragColorTest.java | 205 ++++++++++++++++++ 1 file changed, 205 insertions(+) create mode 100644 test/jdk/javax/swing/JSplitPane/4820080/JSplitPaneDragColorTest.java diff --git a/test/jdk/javax/swing/JSplitPane/4820080/JSplitPaneDragColorTest.java b/test/jdk/javax/swing/JSplitPane/4820080/JSplitPaneDragColorTest.java new file mode 100644 index 00000000000..7e107f1265c --- /dev/null +++ b/test/jdk/javax/swing/JSplitPane/4820080/JSplitPaneDragColorTest.java @@ -0,0 +1,205 @@ +/* + * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Dimension; +import java.awt.Point; +import java.awt.Rectangle; +import java.awt.Robot; +import java.awt.Toolkit; +import java.awt.event.InputEvent; +import java.io.File; +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.concurrent.atomic.AtomicBoolean; +import java.util.concurrent.atomic.AtomicReference; +import java.util.stream.Collectors; +import javax.imageio.ImageIO; +import javax.swing.JFrame; +import javax.swing.JLabel; +import javax.swing.JSplitPane; +import javax.swing.SwingUtilities; +import javax.swing.UIManager; +import javax.swing.UIManager.LookAndFeelInfo; +import javax.swing.UnsupportedLookAndFeelException; + +import static javax.swing.UIManager.getInstalledLookAndFeels; + +/* + * @test + * @key headful + * @bug 4820080 + * @summary This test confirms that the Drag color of JSplitPane divider should + * be the user specified one(Red here). + * @run main JSplitPaneDragColorTest + */ +public class JSplitPaneDragColorTest { + + // Tolerance is set inorder to negate small differences in pixel color values, + // especially in Mac machines. + private final static int COLOR_TOLERANCE = 9; + private static final Color EXPECTED_DRAG_COLOR = Color.RED; + private static JFrame frame; + private static JSplitPane pane; + private static Robot robot; + + public static void main(String[] args) throws Exception { + + robot = new Robot(); + robot.setAutoWaitForIdle(true); + robot.setAutoDelay(200); + // Skipping NimbusLookAndFeel & GTKLookAndFeel, + // as both are not supported for this feature - JDK-8075914, JDK-8075608 + List lafs = Arrays.stream(getInstalledLookAndFeels()) + .filter(laf -> !(laf.getName().contains("GTK") + || laf.getName().contains("Nimbus"))) + .map(LookAndFeelInfo::getClassName) + .collect(Collectors.toList()); + for (final String laf : lafs) { + try { + AtomicBoolean lafSetSuccess = new AtomicBoolean(false); + SwingUtilities.invokeAndWait(() -> { + lafSetSuccess.set(setLookAndFeel(laf)); + if (lafSetSuccess.get()) { + createUI(); + } + }); + if (!lafSetSuccess.get()) { + continue; + } + robot.waitForIdle(); + + Rectangle dividerRect = getDividerRect(); + + // Mouse click and right drag split pane divider + robot.mouseMove(dividerRect.x + 5, dividerRect.y + 36); + robot.mousePress(InputEvent.BUTTON1_DOWN_MASK); + robot.mouseMove(dividerRect.x + 15, dividerRect.y + 36); + robot.mouseMove(dividerRect.x + 5, dividerRect.y + 36); + + // Get the color of one of the pixels of the splitpane divider + // after the drag has started. Ideally it should be the + // SplitPaneDivider.draggingColor set by user, otherwise the test fails + final Color actualDragColor = robot.getPixelColor(dividerRect.x + 2, + dividerRect.y + 2); + if (checkDragColor(actualDragColor)) { + System.out.println("Test passed in " + laf); + } else { + System.out.print("Expected pixel color = "); + System.out.printf("%X", EXPECTED_DRAG_COLOR.getRGB()); + System.out.print(", but actual color = "); + System.out.printf("%X", actualDragColor.getRGB()); + System.out.println(); + captureScreen(); + throw new RuntimeException("Test failed, drag color is wrong in " + + laf); + } + } finally { + robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); + SwingUtilities.invokeAndWait(JSplitPaneDragColorTest::disposeFrame); + } + } + } + + private static boolean checkDragColor(Color actualDragColor) { + int actualRed = actualDragColor.getRed(); + int actualGreen = actualDragColor.getGreen(); + int actualBlue = actualDragColor.getBlue(); + int expectedRed = EXPECTED_DRAG_COLOR.getRed(); + int expectedGreen = EXPECTED_DRAG_COLOR.getGreen(); + int expectedBlue = EXPECTED_DRAG_COLOR.getBlue(); + + final double tolerance = Math.sqrt( + (actualRed - expectedRed) * (actualRed - expectedRed) + + (actualGreen - expectedGreen) * (actualGreen - expectedGreen) + + (actualBlue - expectedBlue) * (actualBlue - expectedBlue)); + return (tolerance <= COLOR_TOLERANCE); + } + + private static Rectangle getDividerRect() { + final AtomicReference rect = new AtomicReference<>(); + SwingUtilities.invokeLater(() -> { + javax.swing.plaf.basic.BasicSplitPaneUI ui = + (javax.swing.plaf.basic.BasicSplitPaneUI) pane.getUI(); + + javax.swing.plaf.basic.BasicSplitPaneDivider divider = ui.getDivider(); + Point dividerLoc = divider.getLocationOnScreen(); + rect.set(new Rectangle(dividerLoc.x, dividerLoc.y, divider.getWidth(), + divider.getHeight())); + }); + robot.waitForIdle(); + return rect.get(); + } + + private static void captureScreen() { + Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); + try { + ImageIO.write( + robot.createScreenCapture(new Rectangle(0, 0, + screenSize.width, + screenSize.height)), + "png", + new File("screen1.png") + ); + } catch (IOException ignore) { + } + } + + private static void createUI() { + frame = new JFrame(); + UIManager.put("SplitPaneDivider.draggingColor", EXPECTED_DRAG_COLOR); + JLabel l1 = new JLabel("LEFT LABEL", JLabel.CENTER); + JLabel l2 = new JLabel("RIGHT LABEL", JLabel.CENTER); + pane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, l1, l2); + frame.setSize(400, 400); + pane.setDividerSize(15); + pane.setDividerLocation(frame.getSize().width / 2); + frame.getContentPane().add(pane, BorderLayout.CENTER); + frame.setLocationRelativeTo(null); + frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); + frame.setVisible(true); + } + + private static boolean setLookAndFeel(String lafName) { + try { + UIManager.setLookAndFeel(lafName); + } catch (UnsupportedLookAndFeelException ignored) { + System.out.println("Ignoring Unsupported L&F: " + lafName); + return false; + } catch (ClassNotFoundException | InstantiationException + | IllegalAccessException e) { + throw new RuntimeException(e); + } + return true; + } + + private static void disposeFrame() { + if (frame != null) { + frame.dispose(); + frame = null; + } + } + +} -- GitLab From 37fc77ef60dd97c4acc468ecfeb6753132974720 Mon Sep 17 00:00:00 2001 From: Kevin Walls Date: Tue, 22 Mar 2022 07:54:41 +0000 Subject: [PATCH 310/340] 8283092: JMX subclass permission check redundant with strong encapsulation Reviewed-by: dfuchs, mchung --- .../lang/management/ManagementFactory.java | 3 +- .../management/spi/PlatformMBeanProvider.java | 18 +-- .../jdk/internal/agent/spi/AgentProvider.java | 19 +--- ...PlatformMBeanProviderConstructorCheck.java | 103 ++++++++++-------- 4 files changed, 63 insertions(+), 80 deletions(-) diff --git a/src/java.management/share/classes/java/lang/management/ManagementFactory.java b/src/java.management/share/classes/java/lang/management/ManagementFactory.java index 13db85d0f09..375f0ebb719 100644 --- a/src/java.management/share/classes/java/lang/management/ManagementFactory.java +++ b/src/java.management/share/classes/java/lang/management/ManagementFactory.java @@ -936,8 +936,7 @@ public class ManagementFactory { all.add(new DefaultPlatformMBeanProvider()); return all; } - }, null, new FilePermission("<>", "read"), - new RuntimePermission("sun.management.spi.PlatformMBeanProvider.subclass")); + }, null, new FilePermission("<>", "read")); // load all platform components into a map var map = new HashMap>(); diff --git a/src/java.management/share/classes/sun/management/spi/PlatformMBeanProvider.java b/src/java.management/share/classes/sun/management/spi/PlatformMBeanProvider.java index 93779f0a811..12472cabfcc 100644 --- a/src/java.management/share/classes/sun/management/spi/PlatformMBeanProvider.java +++ b/src/java.management/share/classes/sun/management/spi/PlatformMBeanProvider.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2022, 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 @@ -203,15 +203,8 @@ public abstract class PlatformMBeanProvider { /** * Instantiates a new PlatformMBeanProvider. - * - * @throws SecurityException if the subclass (and calling code) does not - * have {@code RuntimePermission("sun.management.spi.PlatformMBeanProvider.subclass")} */ protected PlatformMBeanProvider () { - this(checkSubclassPermission()); - } - - private PlatformMBeanProvider(Void unused) { } /** @@ -222,13 +215,4 @@ public abstract class PlatformMBeanProvider { * MBeans provided by this provider. */ public abstract List> getPlatformComponentList(); - - private static Void checkSubclassPermission() { - @SuppressWarnings("removal") - SecurityManager sm = System.getSecurityManager(); - if (sm != null) { - sm.checkPermission(new RuntimePermission(PlatformMBeanProvider.class.getName()+".subclass")); - } - return null; - } } diff --git a/src/jdk.management.agent/share/classes/jdk/internal/agent/spi/AgentProvider.java b/src/jdk.management.agent/share/classes/jdk/internal/agent/spi/AgentProvider.java index ea42d597486..395961cad96 100644 --- a/src/jdk.management.agent/share/classes/jdk/internal/agent/spi/AgentProvider.java +++ b/src/jdk.management.agent/share/classes/jdk/internal/agent/spi/AgentProvider.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2022, 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 @@ -33,25 +33,8 @@ public abstract class AgentProvider { /** * Instantiates a new AgentProvider. - * - * @throws SecurityException if the subclass (and calling code) does not - * have - * {@code RuntimePermission("sun.management.spi.AgentProvider.subclass")} */ protected AgentProvider() { - this(checkSubclassPermission()); - } - - private AgentProvider(Void unused) { - } - - private static Void checkSubclassPermission() { - @SuppressWarnings("removal") - SecurityManager sm = System.getSecurityManager(); - if (sm != null) { - sm.checkPermission(new RuntimePermission(AgentProvider.class.getName() + ".subclass")); - } - return null; } /** diff --git a/test/jdk/sun/management/PlatformMBeanProviderConstructorCheck.java b/test/jdk/sun/management/PlatformMBeanProviderConstructorCheck.java index b7b4edc8c98..16fee912a7c 100644 --- a/test/jdk/sun/management/PlatformMBeanProviderConstructorCheck.java +++ b/test/jdk/sun/management/PlatformMBeanProviderConstructorCheck.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2022, 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 @@ -21,63 +21,79 @@ * questions. */ -import java.security.AccessControlException; -import java.security.Permission; -import java.security.Policy; -import java.security.ProtectionDomain; +import java.lang.management.ManagementFactory; +import java.lang.management.RuntimeMXBean; import java.util.List; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; + +import static jdk.test.lib.Asserts.*; + /* * @test - * @bug 8042901 - * @summary Check permission for PlatformMBeanProvider Constructor + * @library /test/lib + * @build jdk.test.lib.Asserts + * @bug 8042901 8283092 + * @summary Check encapsulation of PlatformMBeanProvider Constructor * @modules java.management/sun.management.spi - * @author Shanliang Jiang - * @run main/othervm -Djava.security.manager=allow PlatformMBeanProviderConstructorCheck + * @run main PlatformMBeanProviderConstructorCheck */ public class PlatformMBeanProviderConstructorCheck { - public static void main(String[] args) throws Exception { - Policy origPolicy = Policy.getPolicy(); - SecurityManager origSM = System.getSecurityManager(); - try { - System.out.println("---PlatformMBeanProviderConstructorCheck starting..."); - Policy.setPolicy(new MyPolicy()); - System.setSecurityManager(new SecurityManager()); + /** + * jtreg invokes this test with module arguments that permit compilation + * of the MyProvider class, which extends PlatformMBeanProvider. + * First check we can invoke that class, then re-invoke ourself without + * those module arguments, and expect a failure calling MyProvider. + */ + public static void main(String[] args) throws Exception { + System.out.println("---PlatformMBeanProviderConstructorCheck:"); + boolean expectedFail = false; - System.out.println("---PlatformMBeanProviderConstructorCheck Testing without permission..."); - try { - new MyProvider(); - throw new RuntimeException("Does not get expected AccessControlException!"); - } catch (AccessControlException ace) { - System.out.println("---PlatformMBeanProviderConstructorCheck got the expected exception: " - + ace); + // Recognise argument to signify we were re-invoked, and MyProvider should fail: + if (args.length == 1) { + if (args[0].equals("--nomoduleargs")) { + expectedFail = true; + verifyNoModuleArguments(); + } else { + throw new RuntimeException("unknown argument: '" + args[0] + "'"); } - - System.out.println("---PlatformMBeanProviderConstructorCheck Testing with permission..."); - MyPolicy.allowed = true; + } + System.out.println("---PlatformMBeanProviderConstructorCheck: invoke MyProvider with expectedFail = " + expectedFail); + Throwable e = null; + try { new MyProvider(); - - System.out.println("---PlatformMBeanProviderConstructorCheck PASSED!"); - } finally { - System.setSecurityManager(origSM); - Policy.setPolicy(origPolicy); + } catch (IllegalAccessError iae) { + System.out.println("---PlatformMBeanProviderConstructorCheck got exception: " + iae); + e = iae; } - } - private static class MyPolicy extends Policy { - private static String permName = "sun.management.spi.PlatformMBeanProvider.subclass"; - private static boolean allowed = false; + if (!expectedFail) { + // This was the first invocation, should have worked OK: + assertNull(e); + System.out.println("---PlatformMBeanProviderConstructorCheck PASSED (1) (expectedFail = " + expectedFail + ")"); - @Override - public boolean implies(ProtectionDomain domain, Permission permission) { - if (permName.equals(permission.getName())) { - System.out.println("---MyPolicy-implies checks permission for " - +permName+" and returns "+allowed); + // Re-invoke this test to check failure: + System.out.println("---PlatformMBeanProviderConstructorCheck: re-invoke without --add-modules or --add-exports"); + OutputAnalyzer output = ProcessTools.executeTestJava("PlatformMBeanProviderConstructorCheck", "--nomoduleargs"); + output.reportDiagnosticSummary(); + output.shouldContain("java.lang.IllegalAccessError: superclass access check failed:"); + output.shouldContain(" module java.management does not export sun.management.spi to "); + output.shouldNotContain("MyProvider constructor."); + } else { + // This was the re-invocation without module access, should fail: + assertNotNull(e); + System.out.println("---PlatformMBeanProviderConstructorCheck PASSED (2) (expectedFail = " + expectedFail + ")"); + } + } - return allowed; - } else { - return true; + private static void verifyNoModuleArguments() { + RuntimeMXBean mxbean = ManagementFactory.getRuntimeMXBean(); + for (String s : mxbean.getInputArguments()) { + if (s.startsWith("--add-modules") || s.startsWith("--add-exports")) { + System.out.println("arg: " + s); + throw new RuntimeException("argument list contains: " + s); } } } @@ -85,6 +101,7 @@ public class PlatformMBeanProviderConstructorCheck { private static class MyProvider extends sun.management.spi.PlatformMBeanProvider { @Override public List> getPlatformComponentList() { + System.out.println("MyProvider constructor."); return null; } } -- GitLab From a6fd0b21ddc1575366eed8d47191f6b14b2d7cb6 Mon Sep 17 00:00:00 2001 From: Srinivas Mandalika Date: Tue, 22 Mar 2022 09:20:12 +0000 Subject: [PATCH 311/340] 8283087: Create a test or JDK-4715503 Reviewed-by: serb --- ...ssibleJTableCellBoundingRectangleTest.java | 91 +++++++++++++++++++ 1 file changed, 91 insertions(+) create mode 100644 test/jdk/javax/accessibility/4715503/AccessibleJTableCellBoundingRectangleTest.java diff --git a/test/jdk/javax/accessibility/4715503/AccessibleJTableCellBoundingRectangleTest.java b/test/jdk/javax/accessibility/4715503/AccessibleJTableCellBoundingRectangleTest.java new file mode 100644 index 00000000000..716925a51e6 --- /dev/null +++ b/test/jdk/javax/accessibility/4715503/AccessibleJTableCellBoundingRectangleTest.java @@ -0,0 +1,91 @@ +/* + * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @key headful + * @bug 4715503 + * @summary AccessibleTable cannot get the Bounding Rectangle of Table Header Cells. + * @run main AccessibleJTableCellBoundingRectangleTest + */ + +import java.awt.Rectangle; +import java.awt.Robot; + +import javax.swing.JFrame; +import javax.swing.JTable; +import javax.swing.SwingUtilities; + +public class AccessibleJTableCellBoundingRectangleTest { + private static JTable jTable; + private static JFrame jFrame; + + private static Object[][] rowData = { { "01", "02", "03", "04", "05" }, + { "11", "12", "13", "14", "15" }, { "21", "22", "23", "24", "25" }, + { "31", "32", "33", "34", "35" }, { "41", "42", "43", "44", "45" } }; + + private static Object[] colNames = { "1", "2", "3", "4", "5" }; + + private static void doTest() throws Exception { + try { + SwingUtilities.invokeAndWait(() -> createGUI()); + Robot robot = new Robot(); + robot.setAutoDelay(500); + robot.waitForIdle(); + + for (int i = 0; i <= colNames.length - 1; i++) { + try { + Rectangle bounds = + jTable.getTableHeader().getAccessibleContext().getAccessibleChild(i) + .getAccessibleContext().getAccessibleComponent().getBounds(); + + if (bounds != null) { + System.out.println("Column " + i + " Bounds: " + bounds); + } else { + throw new RuntimeException( + "Bounding Rectangles getting bounding rectangle for table header cells is null"); + } + } catch (Exception e) { + throw new RuntimeException("Bounding Rectangles getting bounding rectangle for " + + "table header cells threw an exception:\n" + e); + } + } + } finally { + SwingUtilities.invokeAndWait(() -> jFrame.dispose()); + } + } + + private static void createGUI() { + jTable = new JTable(rowData, colNames); + jFrame = new JFrame(); + jFrame.setBounds(100, 100, 300, 300); + jFrame.getContentPane().add(jTable); + jFrame.setVisible(true); + } + + public static void main(String args[]) throws Exception { + doTest(); + System.out.println("Test Passed"); + } +} + -- GitLab From 85628a871df3fdeec1b422d1c01c222abe45d0a8 Mon Sep 17 00:00:00 2001 From: Roland Westrelin Date: Tue, 22 Mar 2022 10:34:33 +0000 Subject: [PATCH 312/340] 8282592: C2: assert(false) failed: graph should be schedulable Reviewed-by: chagedorn, thartmann --- src/hotspot/share/opto/loopTransform.cpp | 6 ++ src/hotspot/share/opto/loopopts.cpp | 2 + .../c2/irTests/TestSkeletonPredicates.java | 78 +++++++++++++++++++ 3 files changed, 86 insertions(+) create mode 100644 test/hotspot/jtreg/compiler/c2/irTests/TestSkeletonPredicates.java diff --git a/src/hotspot/share/opto/loopTransform.cpp b/src/hotspot/share/opto/loopTransform.cpp index 4257b0fd6e5..dc9c2064ed9 100644 --- a/src/hotspot/share/opto/loopTransform.cpp +++ b/src/hotspot/share/opto/loopTransform.cpp @@ -1954,6 +1954,12 @@ bool IdealLoopTree::is_invariant(Node* n) const { } void PhaseIdealLoop::update_main_loop_skeleton_predicates(Node* ctrl, CountedLoopNode* loop_head, Node* init, int stride_con) { + if (init->Opcode() == Op_CastII) { + // skip over the cast added by PhaseIdealLoop::cast_incr_before_loop() when pre/post/main loops are created because + // it can get in the way of type propagation + assert(((CastIINode*)init)->carry_dependency() && loop_head->skip_predicates() == init->in(0), "casted iv phi from pre loop expected"); + init = init->in(1); + } // Search for skeleton predicates and update them according to the new stride Node* entry = ctrl; Node* prev_proj = ctrl; diff --git a/src/hotspot/share/opto/loopopts.cpp b/src/hotspot/share/opto/loopopts.cpp index a7c82ad2ee1..dc9cddfdabf 100644 --- a/src/hotspot/share/opto/loopopts.cpp +++ b/src/hotspot/share/opto/loopopts.cpp @@ -3828,6 +3828,8 @@ void PhaseIdealLoop::reorg_offsets(IdealLoopTree *loop) { set_ctrl(neg_stride, C->root()); Node *post = new AddINode(opaq, neg_stride); register_new_node(post, c); + post = new CastIINode(post, phi->bottom_type()); // preserve the iv phi's type + register_new_node(post, c); _igvn.rehash_node_delayed(use); for (uint j = 1; j < use->req(); j++) { if (use->in(j) == phi) diff --git a/test/hotspot/jtreg/compiler/c2/irTests/TestSkeletonPredicates.java b/test/hotspot/jtreg/compiler/c2/irTests/TestSkeletonPredicates.java new file mode 100644 index 00000000000..79bcd16cfb2 --- /dev/null +++ b/test/hotspot/jtreg/compiler/c2/irTests/TestSkeletonPredicates.java @@ -0,0 +1,78 @@ +/* + * Copyright (c) 2022, Red Hat, Inc. 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 compiler.c2.irTests; + +import compiler.lib.ir_framework.*; +import jdk.test.lib.Utils; +import java.util.Random; + +/* + * @test + * @bug 8278228 + * @summary C2: Improve identical back-to-back if elimination + * @library /test/lib / + * @run driver compiler.c2.irTests.TestSkeletonPredicates + */ + +public class TestSkeletonPredicates { + public static void main(String[] args) { + TestFramework.runWithFlags("-XX:-UseLoopPredicate", "-XX:LoopUnrollLimit=240", "-XX:+StressIGVN", "-XX:StressSeed=255527877"); + TestFramework.runWithFlags("-XX:-UseLoopPredicate", "-XX:LoopUnrollLimit=240", "-XX:+StressIGVN"); + } + + static volatile int barrier; + + @ForceInline + static boolean test1_helper(int start, int stop, double[] array1, double[] array2) { + for (int i = start; i < stop; i++) { + if ((i % 2) == 0) { + array1[i] = 42.42; + } else { + barrier = 0x42; + } + } + return false; + } + + @Test + @IR(counts = { IRNode.COUNTEDLOOP, "3" }) + static double[] test1(int stop, double[] array2) { + double[] array1 = null; + array1 = new double[10]; + for (int j = 0; j < stop; j++) { + if (test1_helper(8, j, array1, array2)) { + return null; + } + } + return array1; + } + + @Run(test = "test1") + void test1_runner() { + double[] array2 = new double[10]; + double[] array3 = new double[1000]; + test1_helper(1, 1000, array3, array3); + test1(11, array3); + } +} -- GitLab From c0f984e5fbba7b44fa7b0a4309896ef9ccb4e666 Mon Sep 17 00:00:00 2001 From: Zhengyu Gu Date: Tue, 22 Mar 2022 13:30:26 +0000 Subject: [PATCH 313/340] 8283456: Make CompiledICHolder::live_count/live_not_claimed_count debug only Reviewed-by: dholmes --- src/hotspot/share/oops/compiledICHolder.cpp | 5 +++-- src/hotspot/share/oops/compiledICHolder.hpp | 6 +++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/hotspot/share/oops/compiledICHolder.cpp b/src/hotspot/share/oops/compiledICHolder.cpp index a285998a236..c6ca6be2030 100644 --- a/src/hotspot/share/oops/compiledICHolder.cpp +++ b/src/hotspot/share/oops/compiledICHolder.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2022, 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,9 +26,10 @@ #include "oops/compiledICHolder.hpp" #include "runtime/atomic.hpp" +#ifdef ASSERT volatile int CompiledICHolder::_live_count; volatile int CompiledICHolder::_live_not_claimed_count; - +#endif CompiledICHolder::CompiledICHolder(Metadata* metadata, Klass* klass, bool is_method) : _holder_metadata(metadata), _holder_klass(klass), _is_metadata_method(is_method) { diff --git a/src/hotspot/share/oops/compiledICHolder.hpp b/src/hotspot/share/oops/compiledICHolder.hpp index b3d0c8715bf..5ddcf07d9ce 100644 --- a/src/hotspot/share/oops/compiledICHolder.hpp +++ b/src/hotspot/share/oops/compiledICHolder.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2022, 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 @@ -44,9 +44,11 @@ class CompiledICHolder : public CHeapObj { friend class VMStructs; private: +#ifdef ASSERT static volatile int _live_count; // allocated static volatile int _live_not_claimed_count; // allocated but not yet in use so not // reachable by iterating over nmethods +#endif Metadata* _holder_metadata; Klass* _holder_klass; // to avoid name conflict with oopDesc::_klass @@ -58,8 +60,10 @@ class CompiledICHolder : public CHeapObj { CompiledICHolder(Metadata* metadata, Klass* klass, bool is_method = true); ~CompiledICHolder() NOT_DEBUG_RETURN; +#ifdef ASSERT static int live_count() { return _live_count; } static int live_not_claimed_count() { return _live_not_claimed_count; } +#endif // accessors Klass* holder_klass() const { return _holder_klass; } -- GitLab From fabde3b7b8ed5e576febe8138c14696ccdf636d5 Mon Sep 17 00:00:00 2001 From: Roland Westrelin Date: Tue, 22 Mar 2022 14:06:49 +0000 Subject: [PATCH 314/340] 8283451: C2: assert(_base == Long) failed: Not a Long Reviewed-by: thartmann, chagedorn --- src/hotspot/share/opto/phaseX.cpp | 4 +- .../jtreg/compiler/c2/TestModDivTopInput.java | 78 +++++++++++++++++++ 2 files changed, 80 insertions(+), 2 deletions(-) create mode 100644 test/hotspot/jtreg/compiler/c2/TestModDivTopInput.java diff --git a/src/hotspot/share/opto/phaseX.cpp b/src/hotspot/share/opto/phaseX.cpp index 0589d1eab0c..9df9a18dbf7 100644 --- a/src/hotspot/share/opto/phaseX.cpp +++ b/src/hotspot/share/opto/phaseX.cpp @@ -1691,7 +1691,7 @@ bool PhaseIterGVN::no_dependent_zero_check(Node* n) const { case Op_DivI: case Op_ModI: { // Type of divisor includes 0? - if (n->in(2)->is_top()) { + if (type(n->in(2)) == Type::TOP) { // 'n' is dead. Treat as if zero check is still there to avoid any further optimizations. return false; } @@ -1701,7 +1701,7 @@ bool PhaseIterGVN::no_dependent_zero_check(Node* n) const { case Op_DivL: case Op_ModL: { // Type of divisor includes 0? - if (n->in(2)->is_top()) { + if (type(n->in(2)) == Type::TOP) { // 'n' is dead. Treat as if zero check is still there to avoid any further optimizations. return false; } diff --git a/test/hotspot/jtreg/compiler/c2/TestModDivTopInput.java b/test/hotspot/jtreg/compiler/c2/TestModDivTopInput.java new file mode 100644 index 00000000000..9e4ba1dd6f0 --- /dev/null +++ b/test/hotspot/jtreg/compiler/c2/TestModDivTopInput.java @@ -0,0 +1,78 @@ +/* + * Copyright (c) 2022, Red Hat, Inc. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 8283451 + * @summary C2: assert(_base == Long) failed: Not a Long + * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+StressLCM -XX:+StressGCM -XX:+StressCCP -XX:+StressIGVN + * -Xcomp -XX:CompileOnly=TestModDivTopInput -XX:-TieredCompilation -XX:StressSeed=87628618 TestModDivTopInput + * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+StressLCM -XX:+StressGCM -XX:+StressCCP -XX:+StressIGVN + * -Xcomp -XX:CompileOnly=TestModDivTopInput -XX:-TieredCompilation TestModDivTopInput + */ + +public class TestModDivTopInput { + + public static final int N = 400; + + public static float fFld=-2.447F; + public long lFld=-189L; + + public void mainTest(String[] strArr1) { + + int i18, i20=-14, i21, iArr2[]=new int[N]; + boolean b2=true; + double d2; + long l; + + init(iArr2, -13265); + + for (i18 = 13; i18 < 315; ++i18) { + if (b2) continue; + for (d2 = 5; d2 < 83; d2++) { + } + for (i21 = 4; i21 < 83; i21++) { + for (l = 1; 2 > l; l++) { + } + b2 = b2; + lFld %= (i20 | 1); + i20 = (int)fFld; + i20 += (int)d2; + } + } + } + + public static void main(String[] strArr) { + TestModDivTopInput _instance = new TestModDivTopInput(); + for (int i = 0; i < 10; i++ ) { + _instance.mainTest(strArr); + } + } + + static void init(int[] arr, int v) { + for (int i = 0; i < arr.length; i++) { + arr[i] = v; + } + } + +} -- GitLab From 557ff4b3558f95723ebaff680b8524b0cb979559 Mon Sep 17 00:00:00 2001 From: Jim Laskey Date: Tue, 22 Mar 2022 15:32:46 +0000 Subject: [PATCH 315/340] 8282625: Formatter caches Locale/DecimalFormatSymbols poorly Reviewed-by: naoto, rriggs, jpai --- .../java/text/DecimalFormatSymbols.java | 11 ++- .../share/classes/java/util/Formatter.java | 78 +++++++++---------- .../IntlTestDecimalFormatSymbols.java | 11 ++- 3 files changed, 58 insertions(+), 42 deletions(-) diff --git a/src/java.base/share/classes/java/text/DecimalFormatSymbols.java b/src/java.base/share/classes/java/text/DecimalFormatSymbols.java index 11fd24573ef..795e087a351 100644 --- a/src/java.base/share/classes/java/text/DecimalFormatSymbols.java +++ b/src/java.base/share/classes/java/text/DecimalFormatSymbols.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2022, 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 @@ -188,6 +188,15 @@ public class DecimalFormatSymbols implements Cloneable, Serializable { return dfsyms; } + /** + * {@return locale used to create this instance} + * + * @since 19 + */ + public Locale getLocale() { + return locale; + } + /** * Gets the character used for zero. Different for Arabic, etc. * diff --git a/src/java.base/share/classes/java/util/Formatter.java b/src/java.base/share/classes/java/util/Formatter.java index 65f67656087..5c5859c767d 100644 --- a/src/java.base/share/classes/java/util/Formatter.java +++ b/src/java.base/share/classes/java/util/Formatter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2022, 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 @@ -2008,15 +2008,41 @@ import sun.util.locale.provider.ResourceBundleBasedAdapter; * @since 1.5 */ public final class Formatter implements Closeable, Flushable { + // Caching DecimalFormatSymbols. Non-volatile to avoid thread slamming. + private static DecimalFormatSymbols DFS = null; + private static DecimalFormatSymbols getDecimalFormatSymbols(Locale locale) { + // Capture local copy to avoid thread race. + DecimalFormatSymbols dfs = DFS; + if (dfs != null && dfs.getLocale().equals(locale)) { + return dfs; + } + // Fetch a new local instance of DecimalFormatSymbols. Note that DFS are mutable + // and this instance is reserved for Formatter. + dfs = DecimalFormatSymbols.getInstance(locale); + // Non-volatile here is acceptable heuristic. + DFS = dfs; + return dfs; + } + + // Use zero from cached DecimalFormatSymbols. + private static char getZero(Locale locale) { + return locale == null ? '0' : getDecimalFormatSymbols(locale).getZeroDigit(); + } + + // Use decimal separator from cached DecimalFormatSymbols. + private static char getDecimalSeparator(Locale locale) { + return locale == null ? '.' : getDecimalFormatSymbols(locale).getDecimalSeparator(); + } + + // Use grouping separator from cached DecimalFormatSymbols. + private static char getGroupingSeparator(Locale locale) { + return locale == null ? ',' : getDecimalFormatSymbols(locale).getGroupingSeparator(); + } + private Appendable a; private final Locale l; - private IOException lastException; - // Non-character value used to mark zero as uninitialized - private static final char ZERO_SENTINEL = '\uFFFE'; - private char zero = ZERO_SENTINEL; - /** * Returns a charset object for the given charset name. * @throws NullPointerException is csn is null @@ -2523,20 +2549,6 @@ public final class Formatter implements Closeable, Flushable { this(l, new BufferedWriter(new OutputStreamWriter(os, charset))); } - private char zero() { - char zero = this.zero; - if (zero == ZERO_SENTINEL) { - if ((l != null) && !l.equals(Locale.US)) { - DecimalFormatSymbols dfs = DecimalFormatSymbols.getInstance(l); - zero = dfs.getZeroDigit(); - } else { - zero = '0'; - } - this.zero = zero; - } - return zero; - } - /** * Returns the locale set by the construction of this formatter. * @@ -4498,14 +4510,6 @@ public final class Formatter implements Closeable, Flushable { throw new IllegalFormatConversionException(c, arg.getClass()); } - private char getZero(Formatter fmt, Locale l) { - if ((l != null) && !l.equals(fmt.locale())) { - DecimalFormatSymbols dfs = DecimalFormatSymbols.getInstance(l); - return dfs.getZeroDigit(); - } - return fmt.zero(); - } - private StringBuilder localizedMagnitude(Formatter fmt, StringBuilder sb, long value, int flags, int width, Locale l) { return localizedMagnitude(fmt, sb, Long.toString(value, 10), 0, flags, width, l); @@ -4519,7 +4523,7 @@ public final class Formatter implements Closeable, Flushable { } int begin = sb.length(); - char zero = getZero(fmt, l); + char zero = getZero(l); // determine localized grouping separator and size char grpSep = '\0'; @@ -4536,21 +4540,15 @@ public final class Formatter implements Closeable, Flushable { } if (dot < len) { - if (l == null || l.equals(Locale.US)) { - decSep = '.'; - } else { - DecimalFormatSymbols dfs = DecimalFormatSymbols.getInstance(l); - decSep = dfs.getDecimalSeparator(); - } + decSep = getDecimalSeparator(l); } if (Flags.contains(f, Flags.GROUP)) { + grpSep = getGroupingSeparator(l); + if (l == null || l.equals(Locale.US)) { - grpSep = ','; grpSize = 3; } else { - DecimalFormatSymbols dfs = DecimalFormatSymbols.getInstance(l); - grpSep = dfs.getGroupingSeparator(); DecimalFormat df = null; NumberFormat nf = NumberFormat.getNumberInstance(l); if (nf instanceof DecimalFormat) { @@ -4567,7 +4565,7 @@ public final class Formatter implements Closeable, Flushable { } String[] all = adapter.getLocaleResources(l) .getNumberPatterns(); - df = new DecimalFormat(all[0], dfs); + df = new DecimalFormat(all[0], getDecimalFormatSymbols(l)); } grpSize = df.getGroupingSize(); // Some locales do not use grouping (the number @@ -4612,7 +4610,7 @@ public final class Formatter implements Closeable, Flushable { // group separators is added for any locale. private void localizedMagnitudeExp(Formatter fmt, StringBuilder sb, char[] value, final int offset, Locale l) { - char zero = getZero(fmt, l); + char zero = getZero(l); int len = value.length; for (int j = offset; j < len; j++) { diff --git a/test/jdk/java/text/Format/NumberFormat/IntlTestDecimalFormatSymbols.java b/test/jdk/java/text/Format/NumberFormat/IntlTestDecimalFormatSymbols.java index cd19fee1e35..30905ee46f1 100644 --- a/test/jdk/java/text/Format/NumberFormat/IntlTestDecimalFormatSymbols.java +++ b/test/jdk/java/text/Format/NumberFormat/IntlTestDecimalFormatSymbols.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2022, 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,6 +23,7 @@ /* * @test + * @bug 8282625 * @library /java/text/testlib * @summary test International Decimal Format Symbols */ @@ -60,6 +61,14 @@ public class IntlTestDecimalFormatSymbols extends IntlTest // just do some VERY basic tests to make sure that get/set work + if (!fr.getLocale().equals(Locale.FRENCH)) { + errln("ERROR: French DecimalFormatSymbols not Locale.FRENCH"); + } + + if (!en.getLocale().equals(Locale.ENGLISH)) { + errln("ERROR: English DecimalFormatSymbols not Locale.ENGLISH"); + } + char zero = en.getZeroDigit(); fr.setZeroDigit(zero); if(fr.getZeroDigit() != en.getZeroDigit()) { -- GitLab From d29c7e740d51cb50a1aa0a941a5b460782f8da68 Mon Sep 17 00:00:00 2001 From: Emanuel Peter Date: Tue, 22 Mar 2022 16:23:23 +0000 Subject: [PATCH 316/340] 8282590: C2: assert(addp->is_AddP() && addp->outcnt() > 0) failed: Don't process dead nodes Reviewed-by: thartmann, chagedorn --- src/hotspot/share/opto/arraycopynode.cpp | 27 ++++++++++++++----- src/hotspot/share/opto/subtypenode.cpp | 4 +-- .../arraycopy/TestArrayCopyAsLoadsStores.java | 13 +++++++++ 3 files changed, 35 insertions(+), 9 deletions(-) diff --git a/src/hotspot/share/opto/arraycopynode.cpp b/src/hotspot/share/opto/arraycopynode.cpp index 11560f6419b..b0f30703f91 100644 --- a/src/hotspot/share/opto/arraycopynode.cpp +++ b/src/hotspot/share/opto/arraycopynode.cpp @@ -189,9 +189,8 @@ Node* ArrayCopyNode::try_clone_instance(PhaseGVN *phase, bool can_reshape, int c } MergeMemNode* mem = phase->transform(MergeMemNode::make(in_mem))->as_MergeMem(); - PhaseIterGVN* igvn = phase->is_IterGVN(); - if (igvn != NULL) { - igvn->_worklist.push(mem); + if (can_reshape) { + phase->is_IterGVN()->_worklist.push(mem); } if (!inst_src->klass_is_exact()) { @@ -294,9 +293,17 @@ bool ArrayCopyNode::prepare_array_copy(PhaseGVN *phase, bool can_reshape, uint header = arrayOopDesc::base_offset_in_bytes(dest_elem); src_offset = Compile::conv_I2X_index(phase, src_offset, ary_src->size()); + if (src_offset->is_top()) { + // Offset is out of bounds (the ArrayCopyNode will be removed) + return false; + } dest_offset = Compile::conv_I2X_index(phase, dest_offset, ary_dest->size()); - if (src_offset->is_top() || dest_offset->is_top()) { + if (dest_offset->is_top()) { // Offset is out of bounds (the ArrayCopyNode will be removed) + if (can_reshape) { + // record src_offset, so it can be deleted later (if it is dead) + phase->is_IterGVN()->_worklist.push(src_offset); + } return false; } @@ -316,9 +323,6 @@ bool ArrayCopyNode::prepare_array_copy(PhaseGVN *phase, bool can_reshape, disjoint_bases = true; - adr_src = phase->transform(new AddPNode(base_src, base_src, src_offset)); - adr_dest = phase->transform(new AddPNode(base_dest, base_dest, dest_offset)); - BasicType elem = ary_src->klass()->as_array_klass()->element_type()->basic_type(); if (is_reference_type(elem)) { elem = T_OBJECT; @@ -329,6 +333,9 @@ bool ArrayCopyNode::prepare_array_copy(PhaseGVN *phase, bool can_reshape, return false; } + adr_src = phase->transform(new AddPNode(base_src, base_src, src_offset)); + adr_dest = phase->transform(new AddPNode(base_dest, base_dest, dest_offset)); + // The address is offseted to an aligned address where a raw copy would start. // If the clone copy is decomposed into load-stores - the address is adjusted to // point at where the array starts. @@ -566,6 +573,8 @@ Node *ArrayCopyNode::Ideal(PhaseGVN *phase, bool can_reshape) { if (!prepare_array_copy(phase, can_reshape, adr_src, base_src, adr_dest, base_dest, copy_type, value_type, disjoint_bases)) { + assert(adr_src == NULL, "no node can be left behind"); + assert(adr_dest == NULL, "no node can be left behind"); return NULL; } @@ -629,6 +638,10 @@ Node *ArrayCopyNode::Ideal(PhaseGVN *phase, bool can_reshape) { } if (!finish_transform(phase, can_reshape, ctl, mem)) { + if (can_reshape) { + // put in worklist, so that if it happens to be dead it is removed + phase->is_IterGVN()->_worklist.push(mem); + } return NULL; } diff --git a/src/hotspot/share/opto/subtypenode.cpp b/src/hotspot/share/opto/subtypenode.cpp index 10604cfebcc..c90b74b7d22 100644 --- a/src/hotspot/share/opto/subtypenode.cpp +++ b/src/hotspot/share/opto/subtypenode.cpp @@ -135,7 +135,7 @@ Node *SubTypeCheckNode::Ideal(PhaseGVN* phase, bool can_reshape) { Node* obj = AddPNode::Ideal_base_and_offset(addr, phase, con); if (con == oopDesc::klass_offset_in_bytes() && obj != NULL) { assert(is_oop(phase, obj), "only for oop input"); - set_req(ObjOrSubKlass, obj); + set_req_X(ObjOrSubKlass, obj, phase); return this; } } @@ -144,7 +144,7 @@ Node *SubTypeCheckNode::Ideal(PhaseGVN* phase, bool can_reshape) { Node* allocated_klass = AllocateNode::Ideal_klass(obj_or_subklass, phase); if (allocated_klass != NULL) { assert(is_oop(phase, obj_or_subklass), "only for oop input"); - set_req(ObjOrSubKlass, allocated_klass); + set_req_X(ObjOrSubKlass, allocated_klass, phase); return this; } diff --git a/test/hotspot/jtreg/compiler/arraycopy/TestArrayCopyAsLoadsStores.java b/test/hotspot/jtreg/compiler/arraycopy/TestArrayCopyAsLoadsStores.java index 4c4c38848d8..103e99fefef 100644 --- a/test/hotspot/jtreg/compiler/arraycopy/TestArrayCopyAsLoadsStores.java +++ b/test/hotspot/jtreg/compiler/arraycopy/TestArrayCopyAsLoadsStores.java @@ -38,6 +38,19 @@ * compiler.arraycopy.TestArrayCopyAsLoadsStores */ +/* + * @test + * @bug 8282590 + * @library / + * + * @run main/othervm -ea -XX:-BackgroundCompilation -XX:-UseOnStackReplacement + * -XX:CompileCommand=dontinline,compiler.arraycopy.TestArrayCopyAsLoadsStores::m* + * -XX:TypeProfileLevel=200 + * -XX:+IgnoreUnrecognizedVMOptions -XX:+StressArrayCopyMacroNode + * -XX:-TieredCompilation -XX:+StressReflectiveCode -XX:-ReduceInitialCardMarks + * compiler.arraycopy.TestArrayCopyAsLoadsStores + */ + package compiler.arraycopy; import java.util.Arrays; -- GitLab From f7d21c3523d87584b62a1143bfe52d067cf77519 Mon Sep 17 00:00:00 2001 From: Joe Darcy Date: Tue, 22 Mar 2022 16:26:23 +0000 Subject: [PATCH 317/340] 8283480: Make AbstractStringBuilder sealed Reviewed-by: jjg, rriggs, jlaskey, dfuchs --- .../share/classes/java/lang/AbstractStringBuilder.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/java.base/share/classes/java/lang/AbstractStringBuilder.java b/src/java.base/share/classes/java/lang/AbstractStringBuilder.java index cf83c825d38..fed3a6f9178 100644 --- a/src/java.base/share/classes/java/lang/AbstractStringBuilder.java +++ b/src/java.base/share/classes/java/lang/AbstractStringBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2022, 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 @@ -56,7 +56,8 @@ import static java.lang.String.checkOffset; * @author Ulf Zibis * @since 1.5 */ -abstract class AbstractStringBuilder implements Appendable, CharSequence { +abstract sealed class AbstractStringBuilder implements Appendable, CharSequence + permits StringBuilder, StringBuffer { /** * The value is used for character storage. */ -- GitLab From 33eb89dfeb4a43e1ad2c3dd657ec3b6ee7abbb3a Mon Sep 17 00:00:00 2001 From: Phil Race Date: Tue, 22 Mar 2022 21:48:42 +0000 Subject: [PATCH 318/340] 8283457: [macos] libpng build failures with Xcode13.3 Reviewed-by: erikj --- make/modules/java.desktop/lib/Awt2dLibraries.gmk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/make/modules/java.desktop/lib/Awt2dLibraries.gmk b/make/modules/java.desktop/lib/Awt2dLibraries.gmk index a0c40825546..3cf8ca8a820 100644 --- a/make/modules/java.desktop/lib/Awt2dLibraries.gmk +++ b/make/modules/java.desktop/lib/Awt2dLibraries.gmk @@ -742,7 +742,7 @@ ifeq ($(ENABLE_HEADLESS_ONLY), false) maybe-uninitialized shift-negative-value implicit-fallthrough \ unused-function, \ DISABLED_WARNINGS_clang := incompatible-pointer-types sign-compare \ - deprecated-declarations, \ + deprecated-declarations null-pointer-subtraction, \ DISABLED_WARNINGS_microsoft := 4018 4244 4267, \ LDFLAGS := $(LDFLAGS_JDKLIB) \ $(call SET_SHARED_LIBRARY_ORIGIN), \ -- GitLab From 8cc12350294c202ae4050471587b95135a9f6ac6 Mon Sep 17 00:00:00 2001 From: David Holmes Date: Wed, 23 Mar 2022 00:06:53 +0000 Subject: [PATCH 319/340] 8282952: Thread::exit should be immune to Thread.stop Reviewed-by: dcubed, pchilanomate, alanb --- src/hotspot/share/runtime/thread.cpp | 36 ++++++++++++--------- src/hotspot/share/runtime/thread.hpp | 17 +++++++--- src/hotspot/share/runtime/thread.inline.hpp | 13 +++++++- 3 files changed, 45 insertions(+), 21 deletions(-) diff --git a/src/hotspot/share/runtime/thread.cpp b/src/hotspot/share/runtime/thread.cpp index eb6bce1fdbb..c1e327d40a5 100644 --- a/src/hotspot/share/runtime/thread.cpp +++ b/src/hotspot/share/runtime/thread.cpp @@ -1373,23 +1373,24 @@ void JavaThread::exit(bool destroy_vm, ExitType exit_type) { } } - // Call Thread.exit(). We try 3 times in case we got another Thread.stop during - // the execution of the method. If that is not enough, then we don't really care. Thread.stop - // is deprecated anyhow. if (!is_Compiler_thread()) { - int count = 3; - while (java_lang_Thread::threadGroup(threadObj()) != NULL && (count-- > 0)) { - EXCEPTION_MARK; - JavaValue result(T_VOID); - Klass* thread_klass = vmClasses::Thread_klass(); - JavaCalls::call_virtual(&result, - threadObj, thread_klass, - vmSymbols::exit_method_name(), - vmSymbols::void_method_signature(), - THREAD); - CLEAR_PENDING_EXCEPTION; - } + // We have finished executing user-defined Java code and now have to do the + // implementation specific clean-up by calling Thread.exit(). We prevent any + // asynchronous exceptions from being delivered while in Thread.exit() + // to ensure the clean-up is not corrupted. + NoAsyncExceptionDeliveryMark _no_async(this); + + EXCEPTION_MARK; + JavaValue result(T_VOID); + Klass* thread_klass = vmClasses::Thread_klass(); + JavaCalls::call_virtual(&result, + threadObj, thread_klass, + vmSymbols::exit_method_name(), + vmSymbols::void_method_signature(), + THREAD); + CLEAR_PENDING_EXCEPTION; } + // notify JVMTI if (JvmtiExport::should_post_thread_life()) { JvmtiExport::post_thread_end(this); @@ -1592,7 +1593,7 @@ void JavaThread::check_and_handle_async_exceptions() { // If we are at a polling page safepoint (not a poll return) // then we must defer async exception because live registers // will be clobbered by the exception path. Poll return is - // ok because the call we a returning from already collides + // ok because the call we are returning from already collides // with exception handling registers and so there is no issue. // (The exception handling path kills call result registers but // this is ok since the exception kills the result anyway). @@ -1613,6 +1614,9 @@ void JavaThread::check_and_handle_async_exceptions() { } if (!clear_async_exception_condition()) { + if ((_suspend_flags & _async_delivery_disabled) != 0) { + log_info(exceptions)("Async exception delivery is disabled"); + } return; } diff --git a/src/hotspot/share/runtime/thread.hpp b/src/hotspot/share/runtime/thread.hpp index 0d56f3dc682..4256a44c39c 100644 --- a/src/hotspot/share/runtime/thread.hpp +++ b/src/hotspot/share/runtime/thread.hpp @@ -785,9 +785,10 @@ class JavaThread: public Thread { enum SuspendFlags { // NOTE: avoid using the sign-bit as cc generates different test code // when the sign-bit is used, and sometimes incorrectly - see CR 6398077 - _has_async_exception = 0x00000001U, // there is a pending async exception - _trace_flag = 0x00000004U, // call tracing backend - _obj_deopt = 0x00000008U // suspend for object reallocation and relocking for JVMTI agent + _has_async_exception = 0x00000001U, // there is a pending async exception + _async_delivery_disabled = 0x00000002U, // async exception delivery is disabled + _trace_flag = 0x00000004U, // call tracing backend + _obj_deopt = 0x00000008U // suspend for object reallocation and relocking for JVMTI agent }; // various suspension related flags - atomically updated @@ -815,7 +816,8 @@ class JavaThread: public Thread { inline bool clear_async_exception_condition(); public: bool has_async_exception_condition() { - return (_suspend_flags & _has_async_exception) != 0; + return (_suspend_flags & _has_async_exception) != 0 && + (_suspend_flags & _async_delivery_disabled) == 0; } inline void set_pending_async_exception(oop e); inline void set_pending_unsafe_access_error(); @@ -823,6 +825,13 @@ class JavaThread: public Thread { void send_thread_stop(oop throwable); void check_and_handle_async_exceptions(); + class NoAsyncExceptionDeliveryMark : public StackObj { + friend JavaThread; + JavaThread *_target; + inline NoAsyncExceptionDeliveryMark(JavaThread *t); + inline ~NoAsyncExceptionDeliveryMark(); + }; + // Safepoint support public: // Expose _thread_state for SafeFetchInt() volatile JavaThreadState _thread_state; diff --git a/src/hotspot/share/runtime/thread.inline.hpp b/src/hotspot/share/runtime/thread.inline.hpp index 7d27a3bf257..cdb8d9abb23 100644 --- a/src/hotspot/share/runtime/thread.inline.hpp +++ b/src/hotspot/share/runtime/thread.inline.hpp @@ -124,7 +124,9 @@ inline void JavaThread::clear_obj_deopt_flag() { inline bool JavaThread::clear_async_exception_condition() { bool ret = has_async_exception_condition(); - clear_suspend_flag(_has_async_exception); + if (ret) { + clear_suspend_flag(_has_async_exception); + } return ret; } @@ -138,6 +140,15 @@ inline void JavaThread::set_pending_unsafe_access_error() { DEBUG_ONLY(_is_unsafe_access_error = true); } + +inline JavaThread::NoAsyncExceptionDeliveryMark::NoAsyncExceptionDeliveryMark(JavaThread *t) : _target(t) { + assert((_target->_suspend_flags & _async_delivery_disabled) == 0, "Nesting is not supported"); + _target->set_suspend_flag(_async_delivery_disabled); +} +inline JavaThread::NoAsyncExceptionDeliveryMark::~NoAsyncExceptionDeliveryMark() { + _target->clear_suspend_flag(_async_delivery_disabled); +} + inline JavaThreadState JavaThread::thread_state() const { #if defined(PPC64) || defined (AARCH64) // Use membars when accessing volatile _thread_state. See -- GitLab From 6ea996c20591cafa9673d9c697437ce2c48e4616 Mon Sep 17 00:00:00 2001 From: Ichiroh Takiguchi Date: Wed, 23 Mar 2022 01:39:20 +0000 Subject: [PATCH 320/340] 8282422: JTable.print() failed with UnsupportedCharsetException on AIX ko_KR locale Reviewed-by: prr, serb --- .../share/classes/sun/awt/FontConfiguration.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/java.desktop/share/classes/sun/awt/FontConfiguration.java b/src/java.desktop/share/classes/sun/awt/FontConfiguration.java index e2e7ab3e5ae..45035042992 100644 --- a/src/java.desktop/share/classes/sun/awt/FontConfiguration.java +++ b/src/java.desktop/share/classes/sun/awt/FontConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2022, 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 @@ -960,7 +960,9 @@ public abstract class FontConfiguration { return fc.newEncoder(); } - if (!charsetName.startsWith("sun.awt.") && !charsetName.equals("default")) { + if (!charsetName.startsWith("sun.awt.") && + !charsetName.equals("default") && + !charsetName.startsWith("sun.font.")) { fc = Charset.forName(charsetName); } else { @SuppressWarnings("removal") -- GitLab From b035fda459284fa130bf936743a8579a6888160b Mon Sep 17 00:00:00 2001 From: Thomas Stuefe Date: Wed, 23 Mar 2022 06:06:51 +0000 Subject: [PATCH 321/340] 8283497: [windows] print TMP and TEMP in hs_err and VM.info Reviewed-by: ysuenaga, dholmes --- src/hotspot/share/utilities/vmError.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hotspot/share/utilities/vmError.cpp b/src/hotspot/share/utilities/vmError.cpp index 89b4645fa45..984c57a13ec 100644 --- a/src/hotspot/share/utilities/vmError.cpp +++ b/src/hotspot/share/utilities/vmError.cpp @@ -115,7 +115,7 @@ static const char* env_list[] = { "DYLD_INSERT_LIBRARIES", // defined on Windows - "OS", "PROCESSOR_IDENTIFIER", "_ALT_JAVA_HOME_DIR", + "OS", "PROCESSOR_IDENTIFIER", "_ALT_JAVA_HOME_DIR", "TMP", "TEMP", (const char *)0 }; -- GitLab From 82e1a1cf8bafddfa2ecf11c2ce88ed4eaa091757 Mon Sep 17 00:00:00 2001 From: Aleksey Shipilev Date: Wed, 23 Mar 2022 06:30:19 +0000 Subject: [PATCH 322/340] 8283257: x86: Clean up invocation/branch counter updates code Reviewed-by: redestad, kvn --- src/hotspot/cpu/x86/interp_masm_x86.cpp | 19 +++++++++---------- src/hotspot/cpu/x86/interp_masm_x86.hpp | 6 ++---- .../x86/templateInterpreterGenerator_x86.cpp | 6 ++---- src/hotspot/cpu/x86/templateTable_x86.cpp | 7 +++---- 4 files changed, 16 insertions(+), 22 deletions(-) diff --git a/src/hotspot/cpu/x86/interp_masm_x86.cpp b/src/hotspot/cpu/x86/interp_masm_x86.cpp index bf8b94a6319..34d4178b8da 100644 --- a/src/hotspot/cpu/x86/interp_masm_x86.cpp +++ b/src/hotspot/cpu/x86/interp_masm_x86.cpp @@ -1972,19 +1972,18 @@ void InterpreterMacroAssembler::verify_FPU(int stack_depth, TosState state) { #endif } -// Jump if ((*counter_addr += increment) & mask) satisfies the condition. -void InterpreterMacroAssembler::increment_mask_and_jump(Address counter_addr, - int increment, Address mask, - Register scratch, bool preloaded, - Condition cond, Label* where) { - if (!preloaded) { - movl(scratch, counter_addr); - } - incrementl(scratch, increment); +// Jump if ((*counter_addr += increment) & mask) == 0 +void InterpreterMacroAssembler::increment_mask_and_jump(Address counter_addr, Address mask, + Register scratch, Label* where) { + // This update is actually not atomic and can lose a number of updates + // under heavy contention, but the alternative of using the (contended) + // atomic update here penalizes profiling paths too much. + movl(scratch, counter_addr); + incrementl(scratch, InvocationCounter::count_increment); movl(counter_addr, scratch); andl(scratch, mask); if (where != NULL) { - jcc(cond, *where); + jcc(Assembler::zero, *where); } } diff --git a/src/hotspot/cpu/x86/interp_masm_x86.hpp b/src/hotspot/cpu/x86/interp_masm_x86.hpp index 0aecb6b4a25..a94f35426b8 100644 --- a/src/hotspot/cpu/x86/interp_masm_x86.hpp +++ b/src/hotspot/cpu/x86/interp_masm_x86.hpp @@ -248,10 +248,8 @@ class InterpreterMacroAssembler: public MacroAssembler { bool decrement = false); void increment_mdp_data_at(Register mdp_in, Register reg, int constant, bool decrement = false); - void increment_mask_and_jump(Address counter_addr, - int increment, Address mask, - Register scratch, bool preloaded, - Condition cond, Label* where); + void increment_mask_and_jump(Address counter_addr, Address mask, + Register scratch, Label* where); void set_mdp_flag_at(Register mdp_in, int flag_constant); void test_mdp_data_at(Register mdp_in, int offset, Register value, Register test_value_out, diff --git a/src/hotspot/cpu/x86/templateInterpreterGenerator_x86.cpp b/src/hotspot/cpu/x86/templateInterpreterGenerator_x86.cpp index 7177d7ca34c..7b14aff6f1f 100644 --- a/src/hotspot/cpu/x86/templateInterpreterGenerator_x86.cpp +++ b/src/hotspot/cpu/x86/templateInterpreterGenerator_x86.cpp @@ -388,7 +388,6 @@ address TemplateInterpreterGenerator::generate_safept_entry_for( void TemplateInterpreterGenerator::generate_counter_incr(Label* overflow) { Label done; // Note: In tiered we increment either counters in Method* or in MDO depending if we're profiling or not. - int increment = InvocationCounter::count_increment; Label no_mdo; if (ProfileInterpreter) { // Are we profiling? @@ -399,7 +398,7 @@ void TemplateInterpreterGenerator::generate_counter_incr(Label* overflow) { const Address mdo_invocation_counter(rax, in_bytes(MethodData::invocation_counter_offset()) + in_bytes(InvocationCounter::counter_offset())); const Address mask(rax, in_bytes(MethodData::invoke_mask_offset())); - __ increment_mask_and_jump(mdo_invocation_counter, increment, mask, rcx, false, Assembler::zero, overflow); + __ increment_mask_and_jump(mdo_invocation_counter, mask, rcx, overflow); __ jmp(done); } __ bind(no_mdo); @@ -409,8 +408,7 @@ void TemplateInterpreterGenerator::generate_counter_incr(Label* overflow) { InvocationCounter::counter_offset()); __ get_method_counters(rbx, rax, done); const Address mask(rax, in_bytes(MethodCounters::invoke_mask_offset())); - __ increment_mask_and_jump(invocation_counter, increment, mask, rcx, - false, Assembler::zero, overflow); + __ increment_mask_and_jump(invocation_counter, mask, rcx, overflow); __ bind(done); } diff --git a/src/hotspot/cpu/x86/templateTable_x86.cpp b/src/hotspot/cpu/x86/templateTable_x86.cpp index cadc71916db..531ff7956b4 100644 --- a/src/hotspot/cpu/x86/templateTable_x86.cpp +++ b/src/hotspot/cpu/x86/templateTable_x86.cpp @@ -2197,7 +2197,6 @@ void TemplateTable::branch(bool is_jsr, bool is_wide) { __ bind(has_counters); Label no_mdo; - int increment = InvocationCounter::count_increment; if (ProfileInterpreter) { // Are we profiling? __ movptr(rbx, Address(rcx, in_bytes(Method::method_data_offset()))); @@ -2207,7 +2206,7 @@ void TemplateTable::branch(bool is_jsr, bool is_wide) { const Address mdo_backedge_counter(rbx, in_bytes(MethodData::backedge_counter_offset()) + in_bytes(InvocationCounter::counter_offset())); const Address mask(rbx, in_bytes(MethodData::backedge_mask_offset())); - __ increment_mask_and_jump(mdo_backedge_counter, increment, mask, rax, false, Assembler::zero, + __ increment_mask_and_jump(mdo_backedge_counter, mask, rax, UseOnStackReplacement ? &backedge_counter_overflow : NULL); __ jmp(dispatch); } @@ -2215,8 +2214,8 @@ void TemplateTable::branch(bool is_jsr, bool is_wide) { // Increment backedge counter in MethodCounters* __ movptr(rcx, Address(rcx, Method::method_counters_offset())); const Address mask(rcx, in_bytes(MethodCounters::backedge_mask_offset())); - __ increment_mask_and_jump(Address(rcx, be_offset), increment, mask, - rax, false, Assembler::zero, UseOnStackReplacement ? &backedge_counter_overflow : NULL); + __ increment_mask_and_jump(Address(rcx, be_offset), mask, rax, + UseOnStackReplacement ? &backedge_counter_overflow : NULL); __ bind(dispatch); } -- GitLab From 1443f6b9191c127abdae38cadb1a44af3c652f1d Mon Sep 17 00:00:00 2001 From: Aleksey Shipilev Date: Wed, 23 Mar 2022 06:31:36 +0000 Subject: [PATCH 323/340] 8283199: Linux os::cpu_microcode_revision() stalls cold startup Reviewed-by: dholmes, redestad, stuefe --- src/hotspot/os_cpu/linux_x86/os_linux_x86.cpp | 22 ++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/src/hotspot/os_cpu/linux_x86/os_linux_x86.cpp b/src/hotspot/os_cpu/linux_x86/os_linux_x86.cpp index 5e346efee54..c6b945fdd79 100644 --- a/src/hotspot/os_cpu/linux_x86/os_linux_x86.cpp +++ b/src/hotspot/os_cpu/linux_x86/os_linux_x86.cpp @@ -459,11 +459,26 @@ bool os::supports_sse() { } juint os::cpu_microcode_revision() { + // Note: this code runs on startup, and therefore should not be slow, + // see JDK-8283200. + juint result = 0; - char data[2048] = {0}; // lines should fit in 2K buf - size_t len = sizeof(data); - FILE *fp = os::fopen("/proc/cpuinfo", "r"); + + // Attempt 1 (faster): Read the microcode version off the sysfs. + FILE *fp = os::fopen("/sys/devices/system/cpu/cpu0/microcode/version", "r"); + if (fp) { + int read = fscanf(fp, "%x", &result); + fclose(fp); + if (read > 0) { + return result; + } + } + + // Attempt 2 (slower): Read the microcode version off the procfs. + fp = os::fopen("/proc/cpuinfo", "r"); if (fp) { + char data[2048] = {0}; // lines should fit in 2K buf + size_t len = sizeof(data); while (!feof(fp)) { if (fgets(data, len, fp)) { if (strstr(data, "microcode") != NULL) { @@ -475,6 +490,7 @@ juint os::cpu_microcode_revision() { } fclose(fp); } + return result; } -- GitLab From 86015e15a5105a779ee065cca64479c8d4fbc074 Mon Sep 17 00:00:00 2001 From: Sibabrata Sahoo Date: Wed, 23 Mar 2022 06:45:37 +0000 Subject: [PATCH 324/340] 8282293: Domain value for system property jdk.https.negotiate.cbt should be case-insensitive Reviewed-by: weijun, rhalade --- .../https/AbstractDelegateHttpsURLConnection.java | 5 +++-- test/jdk/sun/security/krb5/auto/HttpsCB.java | 9 ++++++++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/java.base/share/classes/sun/net/www/protocol/https/AbstractDelegateHttpsURLConnection.java b/src/java.base/share/classes/sun/net/www/protocol/https/AbstractDelegateHttpsURLConnection.java index 7ed4381dda6..ff54e474b8e 100644 --- a/src/java.base/share/classes/sun/net/www/protocol/https/AbstractDelegateHttpsURLConnection.java +++ b/src/java.base/share/classes/sun/net/www/protocol/https/AbstractDelegateHttpsURLConnection.java @@ -332,10 +332,11 @@ public abstract class AbstractDelegateHttpsURLConnection extends if (prop.startsWith("domain:")) { String[] domains = prop.substring(7).split(","); for (String domain : domains) { - if (target.equals(domain)) { + if (target.equalsIgnoreCase(domain)) { return true; } - if (domain.startsWith("*.") && target.endsWith(domain.substring(1))) { + if (domain.startsWith("*.") && target.regionMatches( + true, target.length() - domain.length() + 1, domain, 1, domain.length() - 1)) { return true; } } diff --git a/test/jdk/sun/security/krb5/auto/HttpsCB.java b/test/jdk/sun/security/krb5/auto/HttpsCB.java index a65aa5d0241..1f9f0de33ac 100644 --- a/test/jdk/sun/security/krb5/auto/HttpsCB.java +++ b/test/jdk/sun/security/krb5/auto/HttpsCB.java @@ -23,7 +23,7 @@ /* * @test - * @bug 8279842 + * @bug 8279842 8282293 * @modules java.base/sun.security.util * java.security.jgss/sun.security.jgss * java.security.jgss/sun.security.jgss.krb5 @@ -52,7 +52,13 @@ * @run main/othervm -Djdk.net.hosts.file=TestHosts * -Djdk.https.negotiate.cbt=domain:host.web.domain HttpsCB true true * @run main/othervm -Djdk.net.hosts.file=TestHosts + * -Djdk.https.negotiate.cbt=domain:HOST.WEB.DOMAIN HttpsCB true true + * @run main/othervm -Djdk.net.hosts.file=TestHosts * -Djdk.https.negotiate.cbt=domain:*.web.domain HttpsCB true true + * @run main/othervm -Djdk.net.hosts.file=TestHosts + * -Djdk.https.negotiate.cbt=domain:*.WEB.Domain HttpsCB true true + * @run main/othervm -Djdk.net.hosts.file=TestHosts + * -Djdk.https.negotiate.cbt=domain:*.Invalid,*.WEB.Domain HttpsCB true true */ import com.sun.net.httpserver.Headers; @@ -198,6 +204,7 @@ public class HttpsCB { conn.getInputStream())); return reader.readLine().equals(CONTENT); } catch (IOException e) { + e.printStackTrace(System.out); return false; } } -- GitLab From 58487ddc170f73123668f29c99097b16ba84aa9b Mon Sep 17 00:00:00 2001 From: Thomas Stuefe Date: Wed, 23 Mar 2022 06:46:55 +0000 Subject: [PATCH 325/340] 8283249: CompressedClassPointers.java fails on ppc with 'Narrow klass shift: 0' missing Reviewed-by: iklam --- .../runtime/CompressedOops/CompressedClassPointers.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/hotspot/jtreg/runtime/CompressedOops/CompressedClassPointers.java b/test/hotspot/jtreg/runtime/CompressedOops/CompressedClassPointers.java index c46b32b220d..8e2033e7329 100644 --- a/test/hotspot/jtreg/runtime/CompressedOops/CompressedClassPointers.java +++ b/test/hotspot/jtreg/runtime/CompressedOops/CompressedClassPointers.java @@ -224,8 +224,8 @@ public class CompressedClassPointers { "-XX:+VerifyBeforeGC", "-version"); OutputAnalyzer output = new OutputAnalyzer(pb.start()); output.shouldContain("Narrow klass base: 0x0000000000000000"); - if (!Platform.isAArch64()) { - // Currently relax this test for Aarch64. + if (!Platform.isAArch64() && !Platform.isPPC()) { + // Currently relax this test for Aarch64 and ppc. output.shouldContain("Narrow klass shift: 0"); } output.shouldHaveExitValue(0); @@ -244,8 +244,8 @@ public class CompressedClassPointers { "-XX:+VerifyBeforeGC", "-version"); OutputAnalyzer output = new OutputAnalyzer(pb.start()); output.shouldContain("Narrow klass base: 0x0000000000000000"); - if (!Platform.isAArch64()) { - // Currently relax this test for Aarch64. + if (!Platform.isAArch64() && !Platform.isPPC()) { + // Currently relax this test for Aarch64 and ppc. output.shouldContain("Narrow klass shift: 0"); } output.shouldHaveExitValue(0); -- GitLab From 026b85303c01326bc49a1105a89853d7641fcd50 Mon Sep 17 00:00:00 2001 From: Jie Fu Date: Wed, 23 Mar 2022 08:48:17 +0000 Subject: [PATCH 326/340] 8283298: Make CodeCacheSegmentSize a product flag Reviewed-by: dlong, kvn --- src/hotspot/share/interpreter/templateInterpreter.cpp | 8 ++++++-- src/hotspot/share/prims/methodHandles.cpp | 8 ++++++-- src/hotspot/share/runtime/globals.hpp | 2 +- .../jtreg/compiler/arguments/TestCodeEntryAlignment.java | 1 - 4 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/hotspot/share/interpreter/templateInterpreter.cpp b/src/hotspot/share/interpreter/templateInterpreter.cpp index 732c12532f7..322a21b6aa7 100644 --- a/src/hotspot/share/interpreter/templateInterpreter.cpp +++ b/src/hotspot/share/interpreter/templateInterpreter.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2022, 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 @@ -47,7 +47,11 @@ void TemplateInterpreter::initialize_stub() { // allocate interpreter int code_size = InterpreterCodeSize; NOT_PRODUCT(code_size *= 4;) // debug uses extra interpreter code space - _code = new StubQueue(new InterpreterCodeletInterface, code_size, NULL, + // 270+ interpreter codelets are generated and each of them is required to be aligned to + // CodeEntryAlignment twice. So we need additional size due to alignment. + int max_aligned_codelets = 280; + int max_aligned_bytes = max_aligned_codelets * CodeEntryAlignment * 2; + _code = new StubQueue(new InterpreterCodeletInterface, code_size + max_aligned_bytes, NULL, "Interpreter"); } diff --git a/src/hotspot/share/prims/methodHandles.cpp b/src/hotspot/share/prims/methodHandles.cpp index 5ae35e34a8c..cb66076eeca 100644 --- a/src/hotspot/share/prims/methodHandles.cpp +++ b/src/hotspot/share/prims/methodHandles.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2022, 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 @@ -89,7 +89,11 @@ void MethodHandles::generate_adapters() { ResourceMark rm; TraceTime timer("MethodHandles adapters generation", TRACETIME_LOG(Info, startuptime)); - _adapter_code = MethodHandlesAdapterBlob::create(adapter_code_size); + // The adapter entry is required to be aligned to CodeEntryAlignment. + // So we need additional bytes due to alignment. + int adapter_num = (int)Interpreter::method_handle_invoke_LAST - (int)Interpreter::method_handle_invoke_FIRST + 1; + int max_aligned_bytes = adapter_num * CodeEntryAlignment; + _adapter_code = MethodHandlesAdapterBlob::create(adapter_code_size + max_aligned_bytes); CodeBuffer code(_adapter_code); MethodHandlesAdapterGenerator g(&code); g.generate(); diff --git a/src/hotspot/share/runtime/globals.hpp b/src/hotspot/share/runtime/globals.hpp index 7dd589b58c5..0ab10a117f1 100644 --- a/src/hotspot/share/runtime/globals.hpp +++ b/src/hotspot/share/runtime/globals.hpp @@ -1522,7 +1522,7 @@ const intx ObjectAlignmentInBytes = 8; "Stack space (bytes) required for JVM_InvokeMethod to complete") \ \ /* code cache parameters */ \ - develop_pd(uintx, CodeCacheSegmentSize, \ + product_pd(uintx, CodeCacheSegmentSize, EXPERIMENTAL, \ "Code cache segment size (in bytes) - smallest unit of " \ "allocation") \ range(1, 1024) \ diff --git a/test/hotspot/jtreg/compiler/arguments/TestCodeEntryAlignment.java b/test/hotspot/jtreg/compiler/arguments/TestCodeEntryAlignment.java index 0ea1aee6bd6..15a60382245 100644 --- a/test/hotspot/jtreg/compiler/arguments/TestCodeEntryAlignment.java +++ b/test/hotspot/jtreg/compiler/arguments/TestCodeEntryAlignment.java @@ -27,7 +27,6 @@ * @library /test/lib / * @bug 8281467 * @requires vm.flagless - * @requires vm.debug * @requires os.arch=="amd64" | os.arch=="x86_64" * * @summary Test large CodeEntryAlignments are accepted -- GitLab From d8c55725e0f85e21c16bb81e3f1a9bcfacc59f87 Mon Sep 17 00:00:00 2001 From: Quan Anh Mai Date: Wed, 23 Mar 2022 09:45:23 +0000 Subject: [PATCH 327/340] 8282204: Use lea instructions for arithmetic operations on x86_64 Reviewed-by: jiefu, sviswanathan, thartmann --- src/hotspot/cpu/x86/assembler_x86.cpp | 3 - src/hotspot/cpu/x86/vm_version_x86.hpp | 19 ++ src/hotspot/cpu/x86/x86_64.ad | 164 +++++++++++++++--- .../bench/vm/compiler/LeaInstruction.java | 122 +++++++++++++ 4 files changed, 282 insertions(+), 26 deletions(-) create mode 100644 test/micro/org/openjdk/bench/vm/compiler/LeaInstruction.java diff --git a/src/hotspot/cpu/x86/assembler_x86.cpp b/src/hotspot/cpu/x86/assembler_x86.cpp index e287512b93c..3505e081d38 100644 --- a/src/hotspot/cpu/x86/assembler_x86.cpp +++ b/src/hotspot/cpu/x86/assembler_x86.cpp @@ -2410,10 +2410,7 @@ void Assembler::ldmxcsr( Address src) { void Assembler::leal(Register dst, Address src) { InstructionMark im(this); -#ifdef _LP64 - emit_int8(0x67); // addr32 prefix(src, dst); -#endif // LP64 emit_int8((unsigned char)0x8D); emit_operand(dst, src); } diff --git a/src/hotspot/cpu/x86/vm_version_x86.hpp b/src/hotspot/cpu/x86/vm_version_x86.hpp index 2fd1bbc9617..2f4e31b4708 100644 --- a/src/hotspot/cpu/x86/vm_version_x86.hpp +++ b/src/hotspot/cpu/x86/vm_version_x86.hpp @@ -1044,6 +1044,25 @@ public: static bool supports_clflushopt() { return ((_features & CPU_FLUSHOPT) != 0); } static bool supports_clwb() { return ((_features & CPU_CLWB) != 0); } + // Old CPUs perform lea on AGU which causes additional latency transfering the + // value from/to ALU for other operations + static bool supports_fast_2op_lea() { + return (is_intel() && supports_avx()) || // Sandy Bridge and above + (is_amd() && supports_avx()); // Jaguar and Bulldozer and above + } + + // Pre Icelake Intels suffer inefficiency regarding 3-operand lea, which contains + // all of base register, index register and displacement immediate, with 3 latency. + // Note that when the address contains no displacement but the base register is + // rbp or r13, the machine code must contain a zero displacement immediate, + // effectively transform a 2-operand lea into a 3-operand lea. This can be + // replaced by add-add or lea-add + static bool supports_fast_3op_lea() { + return supports_fast_2op_lea() && + ((is_intel() && supports_clwb() && !is_intel_skylake()) || // Icelake and above + is_amd()); + } + #ifdef __APPLE__ // Is the CPU running emulated (for example macOS Rosetta running x86_64 code on M1 ARM (aarch64) static bool is_cpu_emulated(); diff --git a/src/hotspot/cpu/x86/x86_64.ad b/src/hotspot/cpu/x86/x86_64.ad index 3eed117ece8..09ff7075994 100644 --- a/src/hotspot/cpu/x86/x86_64.ad +++ b/src/hotspot/cpu/x86/x86_64.ad @@ -1,5 +1,5 @@ // -// Copyright (c) 2003, 2021, Oracle and/or its affiliates. All rights reserved. +// Copyright (c) 2003, 2022, 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 @@ -241,6 +241,11 @@ reg_class long_no_rcx_reg %{ return _LONG_NO_RCX_REG_mask; %} +// Class for all long registers (excluding RBP and R13) +reg_class long_no_rbp_r13_reg %{ + return _LONG_NO_RBP_R13_REG_mask; +%} + // Class for all int registers (excluding RSP) reg_class int_reg %{ return _INT_REG_mask; @@ -256,6 +261,11 @@ reg_class int_no_rcx_reg %{ return _INT_NO_RCX_REG_mask; %} +// Class for all int registers (excluding RBP and R13) +reg_class int_no_rbp_r13_reg %{ + return _INT_NO_RBP_R13_REG_mask; +%} + // Singleton class for RAX pointer register reg_class ptr_rax_reg(RAX, RAX_H); @@ -319,9 +329,11 @@ extern RegMask _PTR_NO_RAX_RBX_REG_mask; extern RegMask _LONG_REG_mask; extern RegMask _LONG_NO_RAX_RDX_REG_mask; extern RegMask _LONG_NO_RCX_REG_mask; +extern RegMask _LONG_NO_RBP_R13_REG_mask; extern RegMask _INT_REG_mask; extern RegMask _INT_NO_RAX_RDX_REG_mask; extern RegMask _INT_NO_RCX_REG_mask; +extern RegMask _INT_NO_RBP_R13_REG_mask; extern RegMask _FLOAT_REG_mask; extern RegMask _STACK_OR_PTR_REG_mask; @@ -348,9 +360,11 @@ RegMask _PTR_NO_RAX_RBX_REG_mask; RegMask _LONG_REG_mask; RegMask _LONG_NO_RAX_RDX_REG_mask; RegMask _LONG_NO_RCX_REG_mask; +RegMask _LONG_NO_RBP_R13_REG_mask; RegMask _INT_REG_mask; RegMask _INT_NO_RAX_RDX_REG_mask; RegMask _INT_NO_RCX_REG_mask; +RegMask _INT_NO_RBP_R13_REG_mask; RegMask _FLOAT_REG_mask; RegMask _STACK_OR_PTR_REG_mask; RegMask _STACK_OR_LONG_REG_mask; @@ -409,6 +423,12 @@ void reg_mask_init() { _LONG_NO_RCX_REG_mask.Remove(OptoReg::as_OptoReg(rcx->as_VMReg())); _LONG_NO_RCX_REG_mask.Remove(OptoReg::as_OptoReg(rcx->as_VMReg()->next())); + _LONG_NO_RBP_R13_REG_mask = _LONG_REG_mask; + _LONG_NO_RBP_R13_REG_mask.Remove(OptoReg::as_OptoReg(rbp->as_VMReg())); + _LONG_NO_RBP_R13_REG_mask.Remove(OptoReg::as_OptoReg(rbp->as_VMReg()->next())); + _LONG_NO_RBP_R13_REG_mask.Remove(OptoReg::as_OptoReg(r13->as_VMReg())); + _LONG_NO_RBP_R13_REG_mask.Remove(OptoReg::as_OptoReg(r13->as_VMReg()->next())); + _INT_REG_mask = _ALL_INT_REG_mask; if (PreserveFramePointer) { _INT_REG_mask.Remove(OptoReg::as_OptoReg(rbp->as_VMReg())); @@ -427,6 +447,10 @@ void reg_mask_init() { _INT_NO_RCX_REG_mask = _INT_REG_mask; _INT_NO_RCX_REG_mask.Remove(OptoReg::as_OptoReg(rcx->as_VMReg())); + _INT_NO_RBP_R13_REG_mask = _INT_REG_mask; + _INT_NO_RBP_R13_REG_mask.Remove(OptoReg::as_OptoReg(rbp->as_VMReg())); + _INT_NO_RBP_R13_REG_mask.Remove(OptoReg::as_OptoReg(r13->as_VMReg())); + // _FLOAT_REG_LEGACY_mask/_FLOAT_REG_EVEX_mask is generated by adlc // from the float_reg_legacy/float_reg_evex register class. _FLOAT_REG_mask = VM_Version::supports_evex() ? _FLOAT_REG_EVEX_mask : _FLOAT_REG_LEGACY_mask; @@ -3491,6 +3515,21 @@ operand no_rax_rdx_RegI() interface(REG_INTER); %} +operand no_rbp_r13_RegI() +%{ + constraint(ALLOC_IN_RC(int_no_rbp_r13_reg)); + match(RegI); + match(rRegI); + match(rax_RegI); + match(rbx_RegI); + match(rcx_RegI); + match(rdx_RegI); + match(rdi_RegI); + + format %{ %} + interface(REG_INTER); +%} + // Pointer Register operand any_RegP() %{ @@ -3718,6 +3757,19 @@ operand rdx_RegL() interface(REG_INTER); %} +operand no_rbp_r13_RegL() +%{ + constraint(ALLOC_IN_RC(long_no_rbp_r13_reg)); + match(RegL); + match(rRegL); + match(rax_RegL); + match(rcx_RegL); + match(rdx_RegL); + + format %{ %} + interface(REG_INTER); +%} + // Flags register, used as output of compare instructions operand rFlagsReg() %{ @@ -7443,14 +7495,53 @@ instruct decI_mem(memory dst, immI_M1 src, rFlagsReg cr) ins_pipe(ialu_mem_imm); %} -instruct leaI_rReg_immI(rRegI dst, rRegI src0, immI src1) +instruct leaI_rReg_immI2_immI(rRegI dst, rRegI index, immI2 scale, immI disp) %{ - match(Set dst (AddI src0 src1)); + predicate(VM_Version::supports_fast_2op_lea()); + match(Set dst (AddI (LShiftI index scale) disp)); - ins_cost(110); - format %{ "addr32 leal $dst, [$src0 + $src1]\t# int" %} + format %{ "leal $dst, [$index << $scale + $disp]\t# int" %} + ins_encode %{ + Address::ScaleFactor scale = static_cast($scale$$constant); + __ leal($dst$$Register, Address(noreg, $index$$Register, scale, $disp$$constant)); + %} + ins_pipe(ialu_reg_reg); +%} + +instruct leaI_rReg_rReg_immI(rRegI dst, rRegI base, rRegI index, immI disp) +%{ + predicate(VM_Version::supports_fast_3op_lea()); + match(Set dst (AddI (AddI base index) disp)); + + format %{ "leal $dst, [$base + $index + $disp]\t# int" %} ins_encode %{ - __ leal($dst$$Register, Address($src0$$Register, $src1$$constant)); + __ leal($dst$$Register, Address($base$$Register, $index$$Register, Address::times_1, $disp$$constant)); + %} + ins_pipe(ialu_reg_reg); +%} + +instruct leaI_rReg_rReg_immI2(rRegI dst, no_rbp_r13_RegI base, rRegI index, immI2 scale) +%{ + predicate(VM_Version::supports_fast_2op_lea()); + match(Set dst (AddI base (LShiftI index scale))); + + format %{ "leal $dst, [$base + $index << $scale]\t# int" %} + ins_encode %{ + Address::ScaleFactor scale = static_cast($scale$$constant); + __ leal($dst$$Register, Address($base$$Register, $index$$Register, scale)); + %} + ins_pipe(ialu_reg_reg); +%} + +instruct leaI_rReg_rReg_immI2_immI(rRegI dst, rRegI base, rRegI index, immI2 scale, immI disp) +%{ + predicate(VM_Version::supports_fast_3op_lea()); + match(Set dst (AddI (AddI base (LShiftI index scale)) disp)); + + format %{ "leal $dst, [$base + $index << $scale + $disp]\t# int" %} + ins_encode %{ + Address::ScaleFactor scale = static_cast($scale$$constant); + __ leal($dst$$Register, Address($base$$Register, $index$$Register, scale, $disp$$constant)); %} ins_pipe(ialu_reg_reg); %} @@ -7574,14 +7665,53 @@ instruct decL_mem(memory dst, immL_M1 src, rFlagsReg cr) ins_pipe(ialu_mem_imm); %} -instruct leaL_rReg_immL(rRegL dst, rRegL src0, immL32 src1) +instruct leaL_rReg_immI2_immL32(rRegL dst, rRegL index, immI2 scale, immL32 disp) %{ - match(Set dst (AddL src0 src1)); + predicate(VM_Version::supports_fast_2op_lea()); + match(Set dst (AddL (LShiftL index scale) disp)); - ins_cost(110); - format %{ "leaq $dst, [$src0 + $src1]\t# long" %} + format %{ "leaq $dst, [$index << $scale + $disp]\t# long" %} + ins_encode %{ + Address::ScaleFactor scale = static_cast($scale$$constant); + __ leaq($dst$$Register, Address(noreg, $index$$Register, scale, $disp$$constant)); + %} + ins_pipe(ialu_reg_reg); +%} + +instruct leaL_rReg_rReg_immL32(rRegL dst, rRegL base, rRegL index, immL32 disp) +%{ + predicate(VM_Version::supports_fast_3op_lea()); + match(Set dst (AddL (AddL base index) disp)); + + format %{ "leaq $dst, [$base + $index + $disp]\t# long" %} + ins_encode %{ + __ leaq($dst$$Register, Address($base$$Register, $index$$Register, Address::times_1, $disp$$constant)); + %} + ins_pipe(ialu_reg_reg); +%} + +instruct leaL_rReg_rReg_immI2(rRegL dst, no_rbp_r13_RegL base, rRegL index, immI2 scale) +%{ + predicate(VM_Version::supports_fast_2op_lea()); + match(Set dst (AddL base (LShiftL index scale))); + + format %{ "leaq $dst, [$base + $index << $scale]\t# long" %} + ins_encode %{ + Address::ScaleFactor scale = static_cast($scale$$constant); + __ leaq($dst$$Register, Address($base$$Register, $index$$Register, scale)); + %} + ins_pipe(ialu_reg_reg); +%} + +instruct leaL_rReg_rReg_immI2_immL32(rRegL dst, rRegL base, rRegL index, immI2 scale, immL32 disp) +%{ + predicate(VM_Version::supports_fast_3op_lea()); + match(Set dst (AddL (AddL base (LShiftL index scale)) disp)); + + format %{ "leaq $dst, [$base + $index << $scale + $disp]\t# long" %} ins_encode %{ - __ leaq($dst$$Register, Address($src0$$Register, $src1$$constant)); + Address::ScaleFactor scale = static_cast($scale$$constant); + __ leaq($dst$$Register, Address($base$$Register, $index$$Register, scale, $disp$$constant)); %} ins_pipe(ialu_reg_reg); %} @@ -7612,18 +7742,6 @@ instruct addP_rReg_imm(rRegP dst, immL32 src, rFlagsReg cr) // XXX addP mem ops ???? -instruct leaP_rReg_imm(rRegP dst, rRegP src0, immL32 src1) -%{ - match(Set dst (AddP src0 src1)); - - ins_cost(110); - format %{ "leaq $dst, [$src0 + $src1]\t# ptr" %} - ins_encode %{ - __ leaq($dst$$Register, Address($src0$$Register, $src1$$constant)); - %} - ins_pipe(ialu_reg_reg); -%} - instruct checkCastPP(rRegP dst) %{ match(Set dst (CheckCastPP dst)); diff --git a/test/micro/org/openjdk/bench/vm/compiler/LeaInstruction.java b/test/micro/org/openjdk/bench/vm/compiler/LeaInstruction.java new file mode 100644 index 00000000000..02b10d7ddf7 --- /dev/null +++ b/test/micro/org/openjdk/bench/vm/compiler/LeaInstruction.java @@ -0,0 +1,122 @@ +/* + * Copyright (c) 2022, 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 org.openjdk.bench.vm.compiler; + +import org.openjdk.jmh.annotations.*; +import org.openjdk.jmh.infra.Blackhole; + +import java.util.concurrent.TimeUnit; + +@BenchmarkMode(Mode.AverageTime) +@OutputTimeUnit(TimeUnit.NANOSECONDS) +@Fork(value = 1, jvmArgsAppend = {"-XX:LoopUnrollLimit=1"}) +@State(Scope.Thread) +public class LeaInstruction { + static final int ITERATION = 1000; + + int x, y; + + @Benchmark + public void IS_D_int(Blackhole bh) { + int x = this.x; + for (int i = 0; i < ITERATION; i++) { + x = x * 4 + 10; + } + bh.consume(x); + } + + @Benchmark + public void B_I_D_int(Blackhole bh) { + int x = this.x, y = this.y; + for (int i = 0; i < ITERATION; i++) { + x = x + y + 10; + y = x + y + 20; + } + bh.consume(x); + bh.consume(y); + } + + @Benchmark + public void B_IS_int(Blackhole bh) { + int x = this.x, y = this.y; + for (int i = 0; i < ITERATION; i++) { + x = x + y * 4; + y = x + y * 8; + } + bh.consume(x); + bh.consume(y); + } + + @Benchmark + public void B_IS_D_int(Blackhole bh) { + int x = this.x, y = this.y; + for (int i = 0; i < ITERATION; i++) { + x = x + y * 4 + 10; + y = x + y * 8 + 20; + } + bh.consume(x); + bh.consume(y); + } + + @Benchmark + public void IS_D_long(Blackhole bh) { + long x = this.x; + for (int i = 0; i < ITERATION; i++) { + x = x * 4 + 10; + } + bh.consume(x); + } + + @Benchmark + public void B_I_D_long(Blackhole bh) { + long x = this.x, y = this.y; + for (int i = 0; i < ITERATION; i++) { + x = x + y + 10; + y = x + y + 20; + } + bh.consume(x); + bh.consume(y); + } + + @Benchmark + public void B_IS_long(Blackhole bh) { + long x = this.x, y = this.y; + for (int i = 0; i < ITERATION; i++) { + x = x + y * 4; + y = x + y * 8; + } + bh.consume(x); + bh.consume(y); + } + + @Benchmark + public void B_IS_D_long(Blackhole bh) { + long x = this.x, y = this.y; + for (int i = 0; i < ITERATION; i++) { + x = x + y * 4 + 10; + y = x + y * 8 + 20; + } + bh.consume(x); + bh.consume(y); + } +} -- GitLab From 91fab6ad59d2a4baf58802fc6e6039af3dd8d578 Mon Sep 17 00:00:00 2001 From: Jaikiran Pai Date: Wed, 23 Mar 2022 09:47:44 +0000 Subject: [PATCH 328/340] 8283411: InflaterInputStream holds on to a temporary byte array of 512 bytes Reviewed-by: lancea, vtewari, alanb --- .../share/classes/java/util/zip/InflaterInputStream.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/java.base/share/classes/java/util/zip/InflaterInputStream.java b/src/java.base/share/classes/java/util/zip/InflaterInputStream.java index e17f561224f..a87f78b3838 100644 --- a/src/java.base/share/classes/java/util/zip/InflaterInputStream.java +++ b/src/java.base/share/classes/java/util/zip/InflaterInputStream.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2022, 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 @@ -189,8 +189,6 @@ public class InflaterInputStream extends FilterInputStream { } } - private byte[] b = new byte[512]; - /** * Skips specified number of bytes of uncompressed data. * @param n the number of bytes to skip @@ -205,6 +203,7 @@ public class InflaterInputStream extends FilterInputStream { ensureOpen(); int max = (int)Math.min(n, Integer.MAX_VALUE); int total = 0; + byte[] b = new byte[Math.min(max, 512)]; while (total < max) { int len = max - total; if (len > b.length) { -- GitLab From 6ed0ba2f8a2af58c45a6b7be684ef30d15af6ead Mon Sep 17 00:00:00 2001 From: Vicente Romero Date: Wed, 23 Mar 2022 10:34:09 +0000 Subject: [PATCH 329/340] 8283543: indentation error at com.sun.tools.javac.comp.Enter::visitTopLevel Reviewed-by: darcy, iris --- .../share/classes/com/sun/tools/javac/comp/Enter.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Enter.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Enter.java index 5cf8c5d5387..dbb4f1a46a4 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Enter.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Enter.java @@ -377,7 +377,7 @@ public class Enter extends JCTree.Visitor { ClassSymbol c = syms.enterClass(tree.modle, name, tree.packge); c.flatname = names.fromString(tree.packge + "." + name); c.classfile = c.sourcefile = tree.sourcefile; - c.completer = Completer.NULL_COMPLETER; + c.completer = Completer.NULL_COMPLETER; c.members_field = WriteableScope.create(c); tree.packge.package_info = c; tree.packge.sourcefile = tree.sourcefile; -- GitLab From 61d7d868db030d878f4a1c4467075e8d4e116a6e Mon Sep 17 00:00:00 2001 From: Kevin Walls Date: Wed, 23 Mar 2022 11:03:25 +0000 Subject: [PATCH 330/340] 8283254: Remove redundant class jdk/internal/agent/spi/AgentProvider Reviewed-by: mchung, redestad, dfuchs --- .../classes/jdk/internal/agent/Agent.java | 1 - .../jdk/internal/agent/spi/AgentProvider.java | 76 ------------------- .../share/classes/module-info.java | 4 +- 3 files changed, 1 insertion(+), 80 deletions(-) delete mode 100644 src/jdk.management.agent/share/classes/jdk/internal/agent/spi/AgentProvider.java diff --git a/src/jdk.management.agent/share/classes/jdk/internal/agent/Agent.java b/src/jdk.management.agent/share/classes/jdk/internal/agent/Agent.java index 2d261bfb3a7..175c736e420 100644 --- a/src/jdk.management.agent/share/classes/jdk/internal/agent/Agent.java +++ b/src/jdk.management.agent/share/classes/jdk/internal/agent/Agent.java @@ -51,7 +51,6 @@ import javax.management.remote.JMXConnectorServer; import javax.management.remote.JMXServiceURL; import static jdk.internal.agent.AgentConfigurationError.*; -import jdk.internal.agent.spi.AgentProvider; import jdk.internal.vm.VMSupport; import sun.management.jdp.JdpController; import sun.management.jdp.JdpException; diff --git a/src/jdk.management.agent/share/classes/jdk/internal/agent/spi/AgentProvider.java b/src/jdk.management.agent/share/classes/jdk/internal/agent/spi/AgentProvider.java deleted file mode 100644 index 395961cad96..00000000000 --- a/src/jdk.management.agent/share/classes/jdk/internal/agent/spi/AgentProvider.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright (c) 2016, 2022, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package jdk.internal.agent.spi; - -import java.util.Properties; - -/** - * Service interface for management agent - */ -public abstract class AgentProvider { - - /** - * Instantiates a new AgentProvider. - */ - protected AgentProvider() { - } - - /** - * Gets the name of the agent provider. - * - * @return name of agent provider - */ - public abstract String getName(); - - /** - * Initializes and starts the agent. - * - * @throws IllegalStateException if this agent has already been started. - */ - public abstract void startAgent(); - - /** - * Initializes and starts the agent at given port and with given properties - * - * @param props environment variables for agent - * - * @throws IllegalStateException if this agent has already been started. - */ - public abstract void startAgent(Properties props); - - /** - * Checks if agent is started and not terminated. - * - * @return true if agent is running, false otherwise. - */ - public abstract boolean isActive(); - - /** - * Stops this agent. - * - * @throws IllegalStateException if this agent is not started. - */ - public abstract void stopAgent(); -} diff --git a/src/jdk.management.agent/share/classes/module-info.java b/src/jdk.management.agent/share/classes/module-info.java index 921744822b6..9688e22b9f9 100644 --- a/src/jdk.management.agent/share/classes/module-info.java +++ b/src/jdk.management.agent/share/classes/module-info.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2022, 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 @@ -39,6 +39,4 @@ module jdk.management.agent { requires java.management.rmi; exports jdk.internal.agent to jdk.jconsole; - - uses jdk.internal.agent.spi.AgentProvider; } -- GitLab From 78ef2fdef68c5161c8875296e9479026ac89743a Mon Sep 17 00:00:00 2001 From: Thomas Stuefe Date: Wed, 23 Mar 2022 12:55:28 +0000 Subject: [PATCH 331/340] 8283562: JDK-8282306 breaks gtests on zero Reviewed-by: shade --- test/hotspot/gtest/runtime/test_os.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/hotspot/gtest/runtime/test_os.cpp b/test/hotspot/gtest/runtime/test_os.cpp index 0f78630d460..270710e94c0 100644 --- a/test/hotspot/gtest/runtime/test_os.cpp +++ b/test/hotspot/gtest/runtime/test_os.cpp @@ -868,7 +868,7 @@ TEST_VM(os, iso8601_time) { } TEST_VM(os, is_first_C_frame) { -#ifndef _WIN32 +#if !defined(_WIN32) && !defined(ZERO) frame invalid_frame; EXPECT_TRUE(os::is_first_C_frame(&invalid_frame)); // the frame has zeroes for all values -- GitLab From dc45b0ac58f46e2e46b3302a7e1d81888726f6f4 Mon Sep 17 00:00:00 2001 From: Albert Mingkun Yang Date: Wed, 23 Mar 2022 14:09:01 +0000 Subject: [PATCH 332/340] 8283513: Parallel: Skip the card marking in PSRootsClosure Reviewed-by: tschatzl, iwalulya --- src/hotspot/share/gc/parallel/psClosure.inline.hpp | 9 ++++++--- .../gc/parallel/psPromotionManager.inline.hpp | 14 ++++---------- src/hotspot/share/gc/parallel/psScavenge.hpp | 4 ++++ 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/src/hotspot/share/gc/parallel/psClosure.inline.hpp b/src/hotspot/share/gc/parallel/psClosure.inline.hpp index cd78583bb80..3499b179f46 100644 --- a/src/hotspot/share/gc/parallel/psClosure.inline.hpp +++ b/src/hotspot/share/gc/parallel/psClosure.inline.hpp @@ -60,9 +60,12 @@ private: PSPromotionManager* _promotion_manager; template void do_oop_work(T *p) { - if (PSScavenge::should_scavenge(p)) { - // We never card mark roots, maybe call a func without test? - _promotion_manager->copy_and_push_safe_barrier(p); + assert(!ParallelScavengeHeap::heap()->is_in_reserved(p), "roots should be outside of heap"); + oop o = RawAccess<>::oop_load(p); + if (PSScavenge::is_obj_in_young(o)) { + assert(!PSScavenge::is_obj_in_to_space(o), "Revisiting roots?"); + oop new_obj = _promotion_manager->copy_to_survivor_space(o); + RawAccess::oop_store(p, new_obj); } } public: diff --git a/src/hotspot/share/gc/parallel/psPromotionManager.inline.hpp b/src/hotspot/share/gc/parallel/psPromotionManager.inline.hpp index 1b7b00d9fba..64ee5f286b5 100644 --- a/src/hotspot/share/gc/parallel/psPromotionManager.inline.hpp +++ b/src/hotspot/share/gc/parallel/psPromotionManager.inline.hpp @@ -300,24 +300,18 @@ inline oop PSPromotionManager::copy_unmarked_to_survivor_space(oop o, } // Attempt to "claim" oop at p via CAS, push the new obj if successful -// This version tests the oop* to make sure it is within the heap before -// attempting marking. template inline void PSPromotionManager::copy_and_push_safe_barrier(T* p) { + assert(ParallelScavengeHeap::heap()->is_in_reserved(p), "precondition"); assert(should_scavenge(p, true), "revisiting object?"); oop o = RawAccess::oop_load(p); oop new_obj = copy_to_survivor_space(o); RawAccess::oop_store(p, new_obj); - // We cannot mark without test, as some code passes us pointers - // that are outside the heap. These pointers are either from roots - // or from metadata. - if ((!PSScavenge::is_obj_in_young((HeapWord*)p)) && - ParallelScavengeHeap::heap()->is_in_reserved(p)) { - if (PSScavenge::is_obj_in_young(new_obj)) { - PSScavenge::card_table()->inline_write_ref_field_gc(p, new_obj); - } + if (!PSScavenge::is_obj_in_young((HeapWord*)p) && + PSScavenge::is_obj_in_young(new_obj)) { + PSScavenge::card_table()->inline_write_ref_field_gc(p, new_obj); } } diff --git a/src/hotspot/share/gc/parallel/psScavenge.hpp b/src/hotspot/share/gc/parallel/psScavenge.hpp index c575e8a3f2c..01bc154e552 100644 --- a/src/hotspot/share/gc/parallel/psScavenge.hpp +++ b/src/hotspot/share/gc/parallel/psScavenge.hpp @@ -135,6 +135,10 @@ class PSScavenge: AllStatic { inline static bool is_obj_in_young(HeapWord* o) { return o >= _young_generation_boundary; } + + static bool is_obj_in_to_space(oop o) { + return ParallelScavengeHeap::young_gen()->to_space()->contains(o); + } }; #endif // SHARE_GC_PARALLEL_PSSCAVENGE_HPP -- GitLab From 2b291d837ebfd9d0a61f26541107c6a5f1d43773 Mon Sep 17 00:00:00 2001 From: Aleksei Efimov Date: Wed, 23 Mar 2022 14:57:36 +0000 Subject: [PATCH 333/340] 8282536: java.net.InetAddress should be a sealed class Reviewed-by: dfuchs, jpai, rriggs, michaelm --- .../share/classes/java/net/Inet6Address.java | 6 +---- .../share/classes/java/net/InetAddress.java | 24 ++++--------------- 2 files changed, 5 insertions(+), 25 deletions(-) diff --git a/src/java.base/share/classes/java/net/Inet6Address.java b/src/java.base/share/classes/java/net/Inet6Address.java index 751623536e7..325765ff3b6 100644 --- a/src/java.base/share/classes/java/net/Inet6Address.java +++ b/src/java.base/share/classes/java/net/Inet6Address.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2022, 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 @@ -593,10 +593,6 @@ class Inet6Address extends InetAddress { throws IOException, ClassNotFoundException { NetworkInterface scope_ifname = null; - if (getClass().getClassLoader() != null) { - throw new SecurityException ("invalid address type"); - } - ObjectInputStream.GetField gf = s.readFields(); byte[] ipaddress = (byte[])gf.get("ipaddress", new byte[0]); int scope_id = gf.get("scope_id", -1); diff --git a/src/java.base/share/classes/java/net/InetAddress.java b/src/java.base/share/classes/java/net/InetAddress.java index 3875216768b..3bad2755978 100644 --- a/src/java.base/share/classes/java/net/InetAddress.java +++ b/src/java.base/share/classes/java/net/InetAddress.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1995, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1995, 2022, 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 @@ -44,6 +44,7 @@ import java.io.ObjectInputStream; import java.io.ObjectInputStream.GetField; import java.io.ObjectOutputStream; import java.io.ObjectOutputStream.PutField; +import java.io.Serializable; import java.lang.annotation.Native; import java.util.ServiceLoader; import java.util.concurrent.ConcurrentHashMap; @@ -223,7 +224,7 @@ import static java.net.spi.InetAddressResolver.LookupPolicy.IPV6_FIRST; * @see java.net.InetAddress#getLocalHost() * @since 1.0 */ -public class InetAddress implements java.io.Serializable { +public sealed class InetAddress implements Serializable permits Inet4Address, Inet6Address { /** * Specify the address family: Internet Protocol, Version 4 @@ -1769,16 +1770,6 @@ public class InetAddress implements java.io.Serializable { return impl.anyLocalAddress(); } - /** - * Initializes an empty InetAddress. - */ - @java.io.Serial - private void readObjectNoData () { - if (getClass().getClassLoader() != null) { - throw new SecurityException ("invalid address type"); - } - } - private static final jdk.internal.misc.Unsafe UNSAFE = jdk.internal.misc.Unsafe.getUnsafe(); private static final long FIELDS_OFFSET @@ -1794,9 +1785,6 @@ public class InetAddress implements java.io.Serializable { @java.io.Serial private void readObject (ObjectInputStream s) throws IOException, ClassNotFoundException { - if (getClass().getClassLoader() != null) { - throw new SecurityException ("invalid address type"); - } GetField gf = s.readFields(); String host = (String)gf.get("hostName", null); int address = gf.get("address", 0); @@ -1830,11 +1818,7 @@ public class InetAddress implements java.io.Serializable { * @throws IOException if an I/O error occurs */ @java.io.Serial - private void writeObject (ObjectOutputStream s) throws - IOException { - if (getClass().getClassLoader() != null) { - throw new SecurityException ("invalid address type"); - } + private void writeObject (ObjectOutputStream s) throws IOException { PutField pf = s.putFields(); pf.put("hostName", holder().getHostName()); pf.put("address", holder().getAddress()); -- GitLab From a77160065bb6f62314711514f7694fe50f0dc35b Mon Sep 17 00:00:00 2001 From: Severin Gehwolf Date: Wed, 23 Mar 2022 15:00:05 +0000 Subject: [PATCH 334/340] 8283279: [Testbug] Improve TestGetSwapSpaceSize Reviewed-by: jiefu --- .../platform/docker/GetFreeSwapSpaceSize.java | 28 ++++++++++++++++--- .../docker/TestGetFreeSwapSpaceSize.java | 11 ++++---- 2 files changed, 30 insertions(+), 9 deletions(-) diff --git a/test/jdk/jdk/internal/platform/docker/GetFreeSwapSpaceSize.java b/test/jdk/jdk/internal/platform/docker/GetFreeSwapSpaceSize.java index efb6a39e479..92b8cf282b7 100644 --- a/test/jdk/jdk/internal/platform/docker/GetFreeSwapSpaceSize.java +++ b/test/jdk/jdk/internal/platform/docker/GetFreeSwapSpaceSize.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020 THL A29 Limited, a Tencent company. All rights reserved. + * Copyright (C) 2020, 2022 THL A29 Limited, a Tencent company. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,16 +24,36 @@ import com.sun.management.OperatingSystemMXBean; import java.lang.management.ManagementFactory; +// Usage: +// GetFreeSwapSpaceSize public class GetFreeSwapSpaceSize { public static void main(String[] args) { - System.out.println("TestGetFreeSwapSpaceSize"); + if (args.length != 4) { + throw new RuntimeException("Unexpected arguments. Expected 4, got " + args.length); + } + String memoryAlloc = args[0]; + long expectedMemory = Long.parseLong(args[1]); + String memorySwapAlloc = args[2]; + long expectedSwap = Long.parseLong(args[3]); + System.out.println("TestGetFreeSwapSpaceSize (memory=" + memoryAlloc + ", memorySwap=" + memorySwapAlloc + ")"); + if (expectedSwap != 0) { + throw new RuntimeException("Precondition of test not met: Expected swap size of 0, got: " + expectedSwap); + } OperatingSystemMXBean osBean = (OperatingSystemMXBean) ManagementFactory.getOperatingSystemMXBean(); + long osBeanTotalSwap = osBean.getTotalSwapSpaceSize(); + // Premise of this test is to test on a system where --memory and --memory-swap are set to + // the same amount via the container engine (i.e. no swap). In that case the OSBean must + // not report negative values for free swap space. Assert this precondition. + if (osBeanTotalSwap != expectedSwap) { + throw new RuntimeException("OperatingSystemMXBean.getTotalSwapSpaceSize() reported " + osBeanTotalSwap + " expected " + expectedSwap); + } + System.out.println("TestGetFreeSwapSpaceSize precondition met, osBeanTotalSwap = " + expectedSwap + ". Running test... "); for (int i = 0; i < 100; i++) { long size = osBean.getFreeSwapSpaceSize(); if (size < 0) { - System.out.println("Error: getFreeSwapSpaceSize returns " + size); - System.exit(-1); + throw new RuntimeException("Test failed! getFreeSwapSpaceSize returns " + size); } } + System.out.println("TestGetFreeSwapSpaceSize PASSED." ); } } diff --git a/test/jdk/jdk/internal/platform/docker/TestGetFreeSwapSpaceSize.java b/test/jdk/jdk/internal/platform/docker/TestGetFreeSwapSpaceSize.java index 319c55ab518..92f3364da10 100644 --- a/test/jdk/jdk/internal/platform/docker/TestGetFreeSwapSpaceSize.java +++ b/test/jdk/jdk/internal/platform/docker/TestGetFreeSwapSpaceSize.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020 THL A29 Limited, a Tencent company. All rights reserved. + * Copyright (C) 2020, 2022 THL A29 Limited, a Tencent company. 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 @@ -36,7 +36,7 @@ import jdk.test.lib.containers.docker.DockerTestUtils; import jdk.test.lib.process.OutputAnalyzer; public class TestGetFreeSwapSpaceSize { - private static final String imageName = Common.imageName("memory"); + private static final String imageName = Common.imageName("osbeanSwapSpace"); public static void main(String[] args) throws Exception { if (!DockerTestUtils.canTestDocker()) { @@ -58,17 +58,18 @@ public class TestGetFreeSwapSpaceSize { } private static void testGetFreeSwapSpaceSize(String memoryAllocation, String expectedMemory, - String swapAllocation, String expectedSwap) throws Exception { + String memorySwapAllocation, String expectedSwap) throws Exception { Common.logNewTestCase("TestGetFreeSwapSpaceSize"); DockerRunOptions opts = Common.newOpts(imageName, "GetFreeSwapSpaceSize") + .addClassOptions(memoryAllocation, expectedMemory, memorySwapAllocation, expectedSwap) .addDockerOpts( "--memory", memoryAllocation, - "--memory-swap", swapAllocation + "--memory-swap", memorySwapAllocation ); OutputAnalyzer out = DockerTestUtils.dockerRunJava(opts); out.shouldHaveExitValue(0) - .shouldContain("TestGetFreeSwapSpaceSize"); + .shouldContain("TestGetFreeSwapSpaceSize PASSED."); } } -- GitLab From 3e73a0b726a97df0a4e92f9cf917429346090f45 Mon Sep 17 00:00:00 2001 From: liach Date: Wed, 23 Mar 2022 16:43:06 +0000 Subject: [PATCH 335/340] 8283237: CallSite should be a sealed class Reviewed-by: jkuhn, mchung --- .../share/classes/java/lang/invoke/CallSite.java | 8 ++++---- .../share/classes/java/lang/invoke/ConstantCallSite.java | 4 ++-- .../share/classes/java/lang/invoke/MutableCallSite.java | 4 ++-- .../share/classes/java/lang/invoke/VolatileCallSite.java | 4 ++-- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/java.base/share/classes/java/lang/invoke/CallSite.java b/src/java.base/share/classes/java/lang/invoke/CallSite.java index e159e235f30..ec002e1fc46 100644 --- a/src/java.base/share/classes/java/lang/invoke/CallSite.java +++ b/src/java.base/share/classes/java/lang/invoke/CallSite.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2022, 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 @@ -40,9 +40,9 @@ import jdk.internal.vm.annotation.Stable; * In any case, it may be invoked through an associated method handle * called its {@linkplain #dynamicInvoker dynamic invoker}. *

    - * {@code CallSite} is an abstract class which does not allow + * {@code CallSite} is an abstract sealed class which does not allow * direct subclassing by users. It has three immediate, - * concrete subclasses that may be either instantiated or subclassed. + * concrete non-sealed subclasses that may be either instantiated or subclassed. *

      *
    • If a mutable target is not required, an {@code invokedynamic} instruction * may be permanently bound by means of a {@linkplain ConstantCallSite constant call site}. @@ -85,7 +85,7 @@ private static CallSite bootstrapDynamic(MethodHandles.Lookup caller, String nam * @since 1.7 */ public -abstract class CallSite { +abstract sealed class CallSite permits ConstantCallSite, MutableCallSite, VolatileCallSite { // The actual payload of this call site. // Can be modified using {@link MethodHandleNatives#setCallSiteTargetNormal} or {@link MethodHandleNatives#setCallSiteTargetVolatile}. diff --git a/src/java.base/share/classes/java/lang/invoke/ConstantCallSite.java b/src/java.base/share/classes/java/lang/invoke/ConstantCallSite.java index e2e3f478a3c..29e557ad141 100644 --- a/src/java.base/share/classes/java/lang/invoke/ConstantCallSite.java +++ b/src/java.base/share/classes/java/lang/invoke/ConstantCallSite.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2022, 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 @@ -35,7 +35,7 @@ import jdk.internal.vm.annotation.Stable; * @author John Rose, JSR 292 EG * @since 1.7 */ -public class ConstantCallSite extends CallSite { +public non-sealed class ConstantCallSite extends CallSite { private static final Unsafe UNSAFE = Unsafe.getUnsafe(); @Stable // should NOT be constant folded during instance initialization (isFrozen == false) diff --git a/src/java.base/share/classes/java/lang/invoke/MutableCallSite.java b/src/java.base/share/classes/java/lang/invoke/MutableCallSite.java index c16483d02ae..50ba77d8f96 100644 --- a/src/java.base/share/classes/java/lang/invoke/MutableCallSite.java +++ b/src/java.base/share/classes/java/lang/invoke/MutableCallSite.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2022, 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 @@ -83,7 +83,7 @@ assertEquals("Wilma, dear?", (String) worker2.invokeExact()); * @author John Rose, JSR 292 EG * @since 1.7 */ -public class MutableCallSite extends CallSite { +public non-sealed class MutableCallSite extends CallSite { /** * Creates a blank call site object with the given method type. * The initial target is set to a method handle of the given type diff --git a/src/java.base/share/classes/java/lang/invoke/VolatileCallSite.java b/src/java.base/share/classes/java/lang/invoke/VolatileCallSite.java index 742fa23737d..faf10fd79f4 100644 --- a/src/java.base/share/classes/java/lang/invoke/VolatileCallSite.java +++ b/src/java.base/share/classes/java/lang/invoke/VolatileCallSite.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2022, 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 @@ -42,7 +42,7 @@ package java.lang.invoke; * @author John Rose, JSR 292 EG * @since 1.7 */ -public class VolatileCallSite extends CallSite { +public non-sealed class VolatileCallSite extends CallSite { /** * Creates a call site with a volatile binding to its target. * The initial target is set to a method handle -- GitLab From f01773956fbc092b00c18392735a020ca05257ed Mon Sep 17 00:00:00 2001 From: Alex Menkov Date: Wed, 23 Mar 2022 18:31:34 +0000 Subject: [PATCH 336/340] 8282241: Invalid generic signature for redefined classes Reviewed-by: coleenp, sspitsyn --- .../share/prims/jvmtiRedefineClasses.cpp | 19 +- .../RedefineGenericSignatureTest.java | 196 ++++++++++++++++++ 2 files changed, 205 insertions(+), 10 deletions(-) create mode 100644 test/hotspot/jtreg/serviceability/jvmti/RedefineClasses/RedefineGenericSignatureTest.java diff --git a/src/hotspot/share/prims/jvmtiRedefineClasses.cpp b/src/hotspot/share/prims/jvmtiRedefineClasses.cpp index 586c0679177..e8ba72cbc0e 100644 --- a/src/hotspot/share/prims/jvmtiRedefineClasses.cpp +++ b/src/hotspot/share/prims/jvmtiRedefineClasses.cpp @@ -1856,14 +1856,15 @@ jvmtiError VM_RedefineClasses::merge_cp_and_rewrite( if (old_cp->has_dynamic_constant()) { scratch_cp->set_has_dynamic_constant(); } - // Copy attributes from scratch_cp to merge_cp - merge_cp->copy_fields(scratch_cp()); log_info(redefine, class, constantpool)("merge_cp_len=%d, index_map_len=%d", merge_cp_length, _index_map_count); if (_index_map_count == 0) { // there is nothing to map between the new and merged constant pools + // Copy attributes from scratch_cp to merge_cp + merge_cp->copy_fields(scratch_cp()); + if (old_cp->length() == scratch_cp->length()) { // The old and new constant pools are the same length and the // index map is empty. This means that the three constant pools @@ -1917,6 +1918,9 @@ jvmtiError VM_RedefineClasses::merge_cp_and_rewrite( return JVMTI_ERROR_INTERNAL; } + // Copy attributes from scratch_cp to merge_cp (should be done after rewrite_cp_refs()) + merge_cp->copy_fields(scratch_cp()); + // Replace the new constant pool with a shrunken copy of the // merged constant pool so now the rewritten bytecodes have // valid references; the previous new constant pool will get @@ -3492,10 +3496,9 @@ void VM_RedefineClasses::rewrite_cp_refs_in_verification_type_info( } // end rewrite_cp_refs_in_verification_type_info() -// Change the constant pool associated with klass scratch_class to -// scratch_cp. If shrink is true, then scratch_cp_length elements -// are copied from scratch_cp to a smaller constant pool and the -// smaller constant pool is associated with scratch_class. +// Change the constant pool associated with klass scratch_class to scratch_cp. +// scratch_cp_length elements are copied from scratch_cp to a smaller constant pool +// and the smaller constant pool is associated with scratch_class. void VM_RedefineClasses::set_new_constant_pool( ClassLoaderData* loader_data, InstanceKlass* scratch_class, constantPoolHandle scratch_cp, @@ -4357,10 +4360,6 @@ void VM_RedefineClasses::redefine_single_class(Thread* current, jclass the_jclas // Leave arrays of jmethodIDs and itable index cache unchanged - // Copy the "source file name" attribute from new class version - the_class->set_source_file_name_index( - scratch_class->source_file_name_index()); - // Copy the "source debug extension" attribute from new class version the_class->set_source_debug_extension( scratch_class->source_debug_extension(), diff --git a/test/hotspot/jtreg/serviceability/jvmti/RedefineClasses/RedefineGenericSignatureTest.java b/test/hotspot/jtreg/serviceability/jvmti/RedefineClasses/RedefineGenericSignatureTest.java new file mode 100644 index 00000000000..b16120037e2 --- /dev/null +++ b/test/hotspot/jtreg/serviceability/jvmti/RedefineClasses/RedefineGenericSignatureTest.java @@ -0,0 +1,196 @@ +/* + * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 8282241 + * @summary Verifies class redefinition correctly updates generic_signature and source_file_name attributes + * @requires vm.jvmti + * @modules java.base/jdk.internal.org.objectweb.asm + * java.instrument + * @library /test/lib + * @run compile -g RedefineGenericSignatureTest.java + * @run main RedefineClassHelper + * @run main/othervm -javaagent:redefineagent.jar --add-opens=java.base/java.lang=ALL-UNNAMED RedefineGenericSignatureTest + */ + +import java.io.File; +import java.io.FileOutputStream; +import java.lang.invoke.MethodHandle; +import java.lang.invoke.MethodHandles; +import java.lang.invoke.MethodType; +import java.lang.reflect.Type; +import java.nio.file.Files; +import java.util.List; + +import jdk.internal.org.objectweb.asm.ClassReader; +import jdk.internal.org.objectweb.asm.ClassVisitor; +import jdk.internal.org.objectweb.asm.ClassWriter; +import jdk.internal.org.objectweb.asm.Opcodes; +import jdk.test.lib.Asserts; +import jdk.test.lib.JDKToolLauncher; +import jdk.test.lib.compiler.InMemoryJavaCompiler; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; + +class GenericSignatureTester { + public GenericSignatureTarget> method1() { + return null; + } +} + +class GenericSignatureTarget> { + public GenericSignatureTarget foo() { return null; } + public static void throwException() { throw new RuntimeException(); } +} + +public class RedefineGenericSignatureTest { + private static final String newTargetClassSource = + "class GenericSignatureTarget {\n" + + " public GenericSignatureTarget foo() { return null; }\n" + + " public static void throwException() { throw new RuntimeException(); }\n" + + "}\n"; + + public static void main (String[] args) throws Throwable { + RedefineGenericSignatureTest test = new RedefineGenericSignatureTest(); + test.runTest(); + } + + private final static String sourceFileName = "RedefineGenericSignatureTest.java"; + private final static String sourceFileNameNew = "RedefineGenericSignatureTestNew.java"; + // expected signature of GenericSignatureTester.method1 return type + private final static String expectedRetType = "GenericSignatureTarget>"; + // expected generic signature of the original GenericSignatureTarget + private final static String expectedSigOld = ";>Ljava/lang/Object;"; + // expected generic signature of the redefined GenericSignatureTarget + private final static String expectedSigNew = "Ljava/lang/Object;"; + + private static void log(Object o) { + System.out.println(o); + } + + private String getTargetGenSig() throws Throwable { + MethodHandles.Lookup lookup = MethodHandles.lookup(); + MethodHandles.Lookup classLookup = MethodHandles.privateLookupIn(Class.class, lookup); + MethodHandle getGenericSignature0 = classLookup.findVirtual( + Class.class, "getGenericSignature0", MethodType.methodType(String.class)); + Object genericSignature = getGenericSignature0.invoke(GenericSignatureTarget.class); + return String.valueOf(genericSignature); + } + + private String getTesterRetType() throws Throwable { + Type type = GenericSignatureTester.class.getDeclaredMethod("method1").getGenericReturnType(); + return String.valueOf(type); + } + + private String getTargetSourceFilename() { + try { + GenericSignatureTarget.throwException(); + } catch (RuntimeException ex) { + return ex.getStackTrace()[0].getFileName(); + } + return "Cannot get source file name"; + } + + // Prints dissassembled class bytes. + private void printDisassembled(String description, Class cls, byte[] bytes) throws Exception { + log(description + " -------------------"); + + File f = new File(cls.getSimpleName()+".class"); + try (FileOutputStream fos = new FileOutputStream(f)) { + fos.write(bytes); + } + JDKToolLauncher javap = JDKToolLauncher.create("javap") + .addToolArg("-verbose") + .addToolArg("-p") // Shows all classes and members. + //.addToolArg("-c") // Prints out disassembled code + .addToolArg("-s") // Prints internal type signatures. + .addToolArg(f.toString()); + ProcessBuilder pb = new ProcessBuilder(javap.getCommand()); + OutputAnalyzer out = ProcessTools.executeProcess(pb); + out.shouldHaveExitValue(0); + try { + Files.delete(f.toPath()); + } catch (Exception ex) { + // ignore + } + out.asLines().forEach(s -> log(s)); + log("=========================================="); + Files.deleteIfExists(f.toPath()); + } + + private byte[] getNewClassBytes() { + byte[] bytecode = InMemoryJavaCompiler.compile(GenericSignatureTarget.class.getName(), newTargetClassSource, "-g"); + + ClassWriter cw = new ClassWriter(0); + ClassReader cr = new ClassReader(bytecode); + cr.accept(new ClassVisitor(Opcodes.ASM7, cw) { + private boolean sourceSet = false; + @Override + public void visitSource(String source, String debug) { + sourceSet = true; + log("Changing source: \"" + source + "\" -> \"" + sourceFileNameNew + "\""); + super.visitSource(sourceFileNameNew, debug); + } + + @Override + public void visitEnd() { + if (!sourceSet) { + log("Set source: \"" + sourceFileNameNew + "\""); + super.visitSource(sourceFileNameNew, null); + } + super.visitEnd(); + } + }, 0); + return cw.toByteArray(); + } + + private void runTest() throws Throwable { + Class targetClass = GenericSignatureTarget.class; + + String oldSig = getTargetGenSig(); + log("old target class sig: \"" + oldSig + "\""); + + byte[] oldClassBytes = targetClass.getResourceAsStream(targetClass.getName() + ".class").readAllBytes(); + printDisassembled("Old " + targetClass.getName(), targetClass, oldClassBytes); + + log("Redefining " + targetClass.getName() + " class"); + byte[] newClassBytes = getNewClassBytes(); + printDisassembled("New " + targetClass.getName(), targetClass, newClassBytes); + RedefineClassHelper.redefineClass(targetClass, newClassBytes); + + String newSig = getTargetGenSig(); + log("new target class sig: \"" + newSig + "\""); + + String newRetType = getTesterRetType(); + log("new tester ret type: \"" + newRetType + "\""); + + String newSrcFileName = getTargetSourceFilename(); + log("new source file name: \"" + newSrcFileName + "\""); + + Asserts.assertStringsEqual(expectedSigOld, oldSig, "wrong old generic signature"); + Asserts.assertStringsEqual(expectedSigNew, newSig, "wrong new generic signature"); + Asserts.assertStringsEqual(expectedRetType, newRetType, "wrong ret type"); + Asserts.assertStringsEqual(sourceFileNameNew, newSrcFileName, "wrong new source file name"); + } +} -- GitLab From 138460c004a9a21a84f892896cf2f172fab2ac99 Mon Sep 17 00:00:00 2001 From: Sean Mullan Date: Wed, 23 Mar 2022 18:32:55 +0000 Subject: [PATCH 337/340] 8163327: Remove 3DES from the default enabled cipher suites list Reviewed-by: xuelei --- .../classes/sun/security/ssl/CipherSuite.java | 76 +++++++++---------- test/jdk/javax/net/ssl/DTLS/CipherSuite.java | 12 ++- .../ssl/ciphersuites/DisabledAlgorithms.java | 43 ++++++++--- ...uite.java => NoDesRC4DesEdeCiphSuite.java} | 27 +++++-- 4 files changed, 103 insertions(+), 55 deletions(-) rename test/jdk/sun/security/ssl/CipherSuite/{NoDesRC4CiphSuite.java => NoDesRC4DesEdeCiphSuite.java} (92%) diff --git a/src/java.base/share/classes/sun/security/ssl/CipherSuite.java b/src/java.base/share/classes/sun/security/ssl/CipherSuite.java index 8500ae7e188..d957d7b20bd 100644 --- a/src/java.base/share/classes/sun/security/ssl/CipherSuite.java +++ b/src/java.base/share/classes/sun/security/ssl/CipherSuite.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2022, 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 @@ -54,9 +54,9 @@ enum CipherSuite { // changed later, see below). // 2. Prefer forward secrecy cipher suites. // 3. Prefer the stronger bulk cipher, in the order of AES_256(GCM), - // AES_128(GCM), AES_256, AES_128, 3DES-EDE. + // AES_128(GCM), AES_256, AES_128. // 4. Prefer the stronger MAC algorithm, in the order of SHA384, - // SHA256, SHA, MD5. + // SHA256, SHA. // 5. Prefer the better performance of key exchange and digital // signature algorithm, in the order of ECDHE-ECDSA, ECDHE-RSA, // DHE-RSA, DHE-DSS, ECDH-ECDSA, ECDH-RSA, RSA. @@ -327,41 +327,6 @@ enum CipherSuite { ProtocolVersion.PROTOCOLS_TO_12, K_RSA, B_AES_128, M_SHA, H_SHA256), - // 3DES_EDE, forward secrecy. - TLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA( - 0xC008, true, "TLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA", "", - ProtocolVersion.PROTOCOLS_TO_12, - K_ECDHE_ECDSA, B_3DES, M_SHA, H_SHA256), - TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA( - 0xC012, true, "TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA", "", - ProtocolVersion.PROTOCOLS_TO_12, - K_ECDHE_RSA, B_3DES, M_SHA, H_SHA256), - SSL_DHE_RSA_WITH_3DES_EDE_CBC_SHA( - 0x0016, true, "SSL_DHE_RSA_WITH_3DES_EDE_CBC_SHA", - "TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA", - ProtocolVersion.PROTOCOLS_TO_12, - K_DHE_RSA, B_3DES, M_SHA, H_SHA256), - SSL_DHE_DSS_WITH_3DES_EDE_CBC_SHA( - 0x0013, true, "SSL_DHE_DSS_WITH_3DES_EDE_CBC_SHA", - "TLS_DHE_DSS_WITH_3DES_EDE_CBC_SHA", - ProtocolVersion.PROTOCOLS_TO_12, - K_DHE_DSS, B_3DES, M_SHA, H_SHA256), - - // 3DES_EDE, not forward secrecy. - TLS_ECDH_ECDSA_WITH_3DES_EDE_CBC_SHA( - 0xC003, true, "TLS_ECDH_ECDSA_WITH_3DES_EDE_CBC_SHA", "", - ProtocolVersion.PROTOCOLS_TO_12, - K_ECDH_ECDSA, B_3DES, M_SHA, H_SHA256), - TLS_ECDH_RSA_WITH_3DES_EDE_CBC_SHA( - 0xC00D, true, "TLS_ECDH_RSA_WITH_3DES_EDE_CBC_SHA", "", - ProtocolVersion.PROTOCOLS_TO_12, - K_ECDH_RSA, B_3DES, M_SHA, H_SHA256), - SSL_RSA_WITH_3DES_EDE_CBC_SHA( - 0x000A, true, "SSL_RSA_WITH_3DES_EDE_CBC_SHA", - "TLS_RSA_WITH_3DES_EDE_CBC_SHA", - ProtocolVersion.PROTOCOLS_TO_12, - K_RSA, B_3DES, M_SHA, H_SHA256), - // Renegotiation protection request Signalling Cipher Suite Value (SCSV). TLS_EMPTY_RENEGOTIATION_INFO_SCSV( // RFC 5746, TLS 1.2 and prior 0x00FF, true, "TLS_EMPTY_RENEGOTIATION_INFO_SCSV", "", @@ -413,6 +378,41 @@ enum CipherSuite { 0x0034, false, "TLS_DH_anon_WITH_AES_128_CBC_SHA", "", ProtocolVersion.PROTOCOLS_TO_12, K_DH_ANON, B_AES_128, M_SHA, H_SHA256), + + // 3DES_EDE, forward secrecy. + TLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA( + 0xC008, false, "TLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA", "", + ProtocolVersion.PROTOCOLS_TO_12, + K_ECDHE_ECDSA, B_3DES, M_SHA, H_SHA256), + TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA( + 0xC012, false, "TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA", "", + ProtocolVersion.PROTOCOLS_TO_12, + K_ECDHE_RSA, B_3DES, M_SHA, H_SHA256), + SSL_DHE_RSA_WITH_3DES_EDE_CBC_SHA( + 0x0016, false, "SSL_DHE_RSA_WITH_3DES_EDE_CBC_SHA", + "TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA", + ProtocolVersion.PROTOCOLS_TO_12, + K_DHE_RSA, B_3DES, M_SHA, H_SHA256), + SSL_DHE_DSS_WITH_3DES_EDE_CBC_SHA( + 0x0013, false, "SSL_DHE_DSS_WITH_3DES_EDE_CBC_SHA", + "TLS_DHE_DSS_WITH_3DES_EDE_CBC_SHA", + ProtocolVersion.PROTOCOLS_TO_12, + K_DHE_DSS, B_3DES, M_SHA, H_SHA256), + + // 3DES_EDE, not forward secrecy. + TLS_ECDH_ECDSA_WITH_3DES_EDE_CBC_SHA( + 0xC003, false, "TLS_ECDH_ECDSA_WITH_3DES_EDE_CBC_SHA", "", + ProtocolVersion.PROTOCOLS_TO_12, + K_ECDH_ECDSA, B_3DES, M_SHA, H_SHA256), + TLS_ECDH_RSA_WITH_3DES_EDE_CBC_SHA( + 0xC00D, false, "TLS_ECDH_RSA_WITH_3DES_EDE_CBC_SHA", "", + ProtocolVersion.PROTOCOLS_TO_12, + K_ECDH_RSA, B_3DES, M_SHA, H_SHA256), + SSL_RSA_WITH_3DES_EDE_CBC_SHA( + 0x000A, false, "SSL_RSA_WITH_3DES_EDE_CBC_SHA", + "TLS_RSA_WITH_3DES_EDE_CBC_SHA", + ProtocolVersion.PROTOCOLS_TO_12, + K_RSA, B_3DES, M_SHA, H_SHA256), TLS_ECDH_anon_WITH_3DES_EDE_CBC_SHA( 0xC017, false, "TLS_ECDH_anon_WITH_3DES_EDE_CBC_SHA", "", ProtocolVersion.PROTOCOLS_TO_12, diff --git a/test/jdk/javax/net/ssl/DTLS/CipherSuite.java b/test/jdk/javax/net/ssl/DTLS/CipherSuite.java index 773fb08d317..1c4b1c6d84f 100644 --- a/test/jdk/javax/net/ssl/DTLS/CipherSuite.java +++ b/test/jdk/javax/net/ssl/DTLS/CipherSuite.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2022, 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 @@ -51,6 +51,9 @@ import javax.net.ssl.SSLEngine; import java.security.Security; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; /** * Test common DTLS cipher suites. @@ -59,10 +62,12 @@ public class CipherSuite extends DTLSOverDatagram { // use the specific cipher suite volatile static String cipherSuite; + private static boolean reenable; public static void main(String[] args) throws Exception { if (args.length > 1 && "re-enable".equals(args[1])) { Security.setProperty("jdk.tls.disabledAlgorithms", ""); + reenable = true; } cipherSuite = args[0]; @@ -77,6 +82,11 @@ public class CipherSuite extends DTLSOverDatagram { if (isClient) { engine.setEnabledCipherSuites(new String[]{cipherSuite}); + } else if (reenable) { + List cipherSuites = + new ArrayList(Arrays.asList(engine.getEnabledCipherSuites())); + cipherSuites.add(cipherSuite); + engine.setEnabledCipherSuites(cipherSuites.toArray(new String[0])); } return engine; diff --git a/test/jdk/javax/net/ssl/ciphersuites/DisabledAlgorithms.java b/test/jdk/javax/net/ssl/ciphersuites/DisabledAlgorithms.java index 7bb3e2c8d2b..441f6bdff48 100644 --- a/test/jdk/javax/net/ssl/ciphersuites/DisabledAlgorithms.java +++ b/test/jdk/javax/net/ssl/ciphersuites/DisabledAlgorithms.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2022, 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 - * @bug 8076221 8211883 + * @bug 8076221 8211883 8163327 * @summary Check if weak cipher suites are disabled * @modules jdk.crypto.ec * @run main/othervm DisabledAlgorithms default @@ -60,9 +60,10 @@ public class DisabledAlgorithms { System.getProperty("test.src", "./") + "/" + pathToStores + "/" + trustStoreFile; - // supported RC4, NULL, and anon cipher suites + // supported 3DES, DES, RC4, NULL, and anon cipher suites // it does not contain KRB5 cipher suites because they need a KDC - private static final String[] rc4_null_anon_ciphersuites = new String[] { + private static final String[] desede_des_rc4_null_anon_ciphersuites + = new String[] { "TLS_ECDHE_ECDSA_WITH_RC4_128_SHA", "TLS_ECDHE_RSA_WITH_RC4_128_SHA", "SSL_RSA_WITH_RC4_128_SHA", @@ -90,11 +91,25 @@ public class DisabledAlgorithms { "TLS_DH_anon_WITH_AES_256_CBC_SHA", "TLS_DH_anon_WITH_AES_256_CBC_SHA256", "TLS_DH_anon_WITH_AES_256_GCM_SHA384", + "SSL_RSA_WITH_DES_CBC_SHA", + "SSL_DHE_RSA_WITH_DES_CBC_SHA", + "SSL_DHE_DSS_WITH_DES_CBC_SHA", + "SSL_RSA_EXPORT_WITH_DES40_CBC_SHA", + "SSL_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA", + "SSL_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA", + "SSL_RSA_EXPORT_WITH_RC4_40_MD5", "TLS_ECDH_anon_WITH_3DES_EDE_CBC_SHA", "TLS_ECDH_anon_WITH_AES_128_CBC_SHA", "TLS_ECDH_anon_WITH_AES_256_CBC_SHA", "TLS_ECDH_anon_WITH_NULL_SHA", - "TLS_ECDH_anon_WITH_RC4_128_SHA" + "TLS_ECDH_anon_WITH_RC4_128_SHA", + "TLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA", + "TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA", + "SSL_DHE_RSA_WITH_3DES_EDE_CBC_SHA", + "SSL_DHE_DSS_WITH_3DES_EDE_CBC_SHA", + "TLS_ECDH_ECDSA_WITH_3DES_EDE_CBC_SHA", + "TLS_ECDH_RSA_WITH_3DES_EDE_CBC_SHA", + "SSL_RSA_WITH_3DES_EDE_CBC_SHA" }; public static void main(String[] args) throws Exception { @@ -113,19 +128,25 @@ public class DisabledAlgorithms { System.out.println("jdk.tls.disabledAlgorithms = " + Security.getProperty("jdk.tls.disabledAlgorithms")); - // check if RC4, NULL, and anon cipher suites + // check if 3DES, DES, RC4, NULL, and anon cipher suites // can't be used by default - checkFailure(rc4_null_anon_ciphersuites); + checkFailure(desede_des_rc4_null_anon_ciphersuites); break; case "empty": // reset jdk.tls.disabledAlgorithms Security.setProperty("jdk.tls.disabledAlgorithms", ""); System.out.println("jdk.tls.disabledAlgorithms = " + Security.getProperty("jdk.tls.disabledAlgorithms")); - - // check if RC4, NULL, and anon cipher suites can be used - // if jdk.tls.disabledAlgorithms is empty - checkSuccess(rc4_null_anon_ciphersuites); + // reset jdk.certpath.disabledAlgorithms. This is necessary + // to allow the RSA_EXPORT suites to pass which use an RSA 512 + // bit key which violates the default certpath constraints. + Security.setProperty("jdk.certpath.disabledAlgorithms", ""); + System.out.println("jdk.certpath.disabledAlgorithms = " + + Security.getProperty("jdk.certpath.disabledAlgorithms")); + + // check if 3DES, DES, RC4, NULL, and anon cipher suites + // can be used if jdk.{tls,certpath}.disabledAlgorithms is empty + checkSuccess(desede_des_rc4_null_anon_ciphersuites); break; default: throw new RuntimeException("Wrong parameter: " + args[0]); diff --git a/test/jdk/sun/security/ssl/CipherSuite/NoDesRC4CiphSuite.java b/test/jdk/sun/security/ssl/CipherSuite/NoDesRC4DesEdeCiphSuite.java similarity index 92% rename from test/jdk/sun/security/ssl/CipherSuite/NoDesRC4CiphSuite.java rename to test/jdk/sun/security/ssl/CipherSuite/NoDesRC4DesEdeCiphSuite.java index 22238d38e1d..c9861324237 100644 --- a/test/jdk/sun/security/ssl/CipherSuite/NoDesRC4CiphSuite.java +++ b/test/jdk/sun/security/ssl/CipherSuite/NoDesRC4DesEdeCiphSuite.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2022, 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,9 +23,9 @@ /* * @test - * @bug 8208350 - * @summary Disable all DES cipher suites - * @run main/othervm NoDesRC4CiphSuite + * @bug 8208350 8163327 + * @summary Disable all DES, RC4, and 3DES/DesEde cipher suites + * @run main/othervm NoDesRC4DesEdeCiphSuite */ /* @@ -43,7 +43,7 @@ import java.util.List; import java.util.ArrayList; import java.util.Arrays; -public class NoDesRC4CiphSuite { +public class NoDesRC4DesEdeCiphSuite { private static final boolean DEBUG = false; @@ -80,6 +80,18 @@ public class NoDesRC4CiphSuite { "SSL_RSA_EXPORT_WITH_RC4_40_MD5", "SSL_DH_anon_EXPORT_WITH_RC4_40_MD5" }; + private static final List DESEDE_CS_LIST = Arrays.asList( + 0xC008, 0xC012, 0x0016, 0x0013, 0xC003, 0xC00D, 0x000A + ); + private static final String[] DESEDE_CS_LIST_NAMES = new String[] { + "TLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA", + "TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA", + "SSL_DHE_RSA_WITH_3DES_EDE_CBC_SHA", + "SSL_DHE_DSS_WITH_3DES_EDE_CBC_SHA", + "TLS_ECDH_ECDSA_WITH_3DES_EDE_CBC_SHA", + "TLS_ECDH_RSA_WITH_3DES_EDE_CBC_SHA", + "SSL_RSA_WITH_3DES_EDE_CBC_SHA" + }; private static final ByteBuffer CLIOUTBUF = ByteBuffer.wrap("Client Side".getBytes()); @@ -99,6 +111,11 @@ public class NoDesRC4CiphSuite { allGood &= testEngAddDisabled(RC4_CS_LIST_NAMES, RC4_CS_LIST); allGood &= testEngOnlyDisabled(RC4_CS_LIST_NAMES); + // Disabled 3DES tests + allGood &= testDefaultCase(DESEDE_CS_LIST); + allGood &= testEngAddDisabled(DESEDE_CS_LIST_NAMES, DESEDE_CS_LIST); + allGood &= testEngOnlyDisabled(DESEDE_CS_LIST_NAMES); + if (allGood) { System.err.println("All tests passed"); } else { -- GitLab From 0b11b576a2a53446444a6d4899faa0be9e7bb18a Mon Sep 17 00:00:00 2001 From: "Daniel D. Daugherty" Date: Wed, 23 Mar 2022 19:18:57 +0000 Subject: [PATCH 338/340] 8283222: improve diagnosability of runtime/8176717/TestInheritFD.java timeouts Reviewed-by: dholmes, hseigel --- .../jtreg/runtime/8176717/TestInheritFD.java | 208 +++++++++++++++--- 1 file changed, 177 insertions(+), 31 deletions(-) diff --git a/test/hotspot/jtreg/runtime/8176717/TestInheritFD.java b/test/hotspot/jtreg/runtime/8176717/TestInheritFD.java index 37c5280d236..c84bc7e0159 100644 --- a/test/hotspot/jtreg/runtime/8176717/TestInheritFD.java +++ b/test/hotspot/jtreg/runtime/8176717/TestInheritFD.java @@ -21,6 +21,7 @@ * questions. */ +import static java.lang.Character.isDigit; import static java.lang.Long.parseLong; import static java.lang.System.getProperty; import static java.nio.file.Files.readAllBytes; @@ -40,6 +41,7 @@ import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStreamReader; import java.util.Collection; +import java.util.concurrent.TimeUnit; import java.util.Optional; import java.util.stream.Stream; @@ -60,17 +62,18 @@ import java.util.stream.Stream; * * This test is performed in three steps. The first VM starts a second VM with * gc logging enabled. The second VM starts a third VM and redirects the third - * VMs output to the first VM, it then exits and hopefully closes its log file. + * VMs output to the first VM. The second VM then exits and hopefully closes + * its log file. * - * The third VM waits for the second to exit and close its log file. After that, - * the third VM tries to rename the log file of the second VM. If it succeeds in - * doing so it means that the third VM did not inherit the open log file - * (windows can not rename opened files easily) + * The third VM waits for the second to exit and close its log file. + * On Windows, the third VM tries to rename the log file of the second VM. + * If it succeeds in doing so it means that the third VM did not inherit + * the open log file (windows cannot rename opened files easily). + * On unix like systems, the third VM uses "lsof" for verification. * - * The third VM communicates the success to rename the file by printing "CLOSED - * FD". The first VM checks that the string was printed by the third VM. - * - * On unix like systems "lsof" is used. + * The third VM communicates success by printing "RETAINS FD". The first VM + * waits for the third VM to exit and checks that the string was printed by + * the third VM. */ public class TestInheritFD { @@ -80,9 +83,145 @@ public class TestInheritFD { public static final String EXIT = "VM RESULT => VM EXIT"; public static final String LOG_SUFFIX = ".strangelogsuffixthatcanbecheckedfor"; public static final String USER_DIR = System.getProperty("user.dir"); + public static final String LSOF_PID_PREFIX = " VM lsof pid="; + public static final String SECOND_VM_PID_PREFIX = "Second VM pid="; + public static final String THIRD_VM_PID_PREFIX = "Third VM pid="; + public static final String THIRD_VM_WAITING_PREFIX = "Third VM waiting for second VM pid="; + + public static float timeoutFactor = Float.parseFloat(System.getProperty("test.timeout.factor", "1.0")); + public static long subProcessTimeout = (long)(15L * timeoutFactor); + + // Extract a pid from the specified String at the specified start offset. + private static long extractPidFromStringOffset(String str, int start) { + int end; + for (end = start; end < str.length(); end++) { + if (!isDigit(str.charAt(end))) { + break; + } + } + if (start == end) { // no digits at all + return -1; + } + return parseLong(str.substring(start, end)); + } + + // Wait for the sub-process pids identified in commFile to finish executing. + // Returns true if RETAINS_FD was found in the commFile and false otherwise. + private static boolean waitForSubPids(File commFile) throws Exception { + String out = ""; + int sleepCnt = 0; + long secondVMPID = -1; + long secondVMlsofPID = -1; + long thirdVMPID = -1; + long thirdVMlsofPID = -1; + // Only have to gather info until the doneWithPattern shows up in the output: + String doneWithPattern; + if (isWindows()) { + doneWithPattern = THIRD_VM_PID_PREFIX; + } else { + doneWithPattern = "Third" + LSOF_PID_PREFIX; + } + do { + out = new String(readAllBytes(commFile.toPath())); + if (secondVMPID == -1) { + int ind = out.indexOf(SECOND_VM_PID_PREFIX); + if (ind != -1) { + int startPid = ind + SECOND_VM_PID_PREFIX.length(); + secondVMPID = extractPidFromStringOffset(out, startPid); + System.out.println("secondVMPID=" + secondVMPID); + } + } + if (!isWindows() && secondVMlsofPID == -1) { + String prefix = "Second" + LSOF_PID_PREFIX; + int ind = out.indexOf(prefix); + if (ind != -1) { + int startPid = ind + prefix.length(); + secondVMlsofPID = extractPidFromStringOffset(out, startPid); + System.out.println("secondVMlsofPID=" + secondVMlsofPID); + } + } + if (thirdVMPID == -1) { + int ind = out.indexOf(THIRD_VM_PID_PREFIX); + if (ind != -1) { + int startPid = ind + THIRD_VM_PID_PREFIX.length(); + thirdVMPID = extractPidFromStringOffset(out, startPid); + System.out.println("thirdVMPID=" + thirdVMPID); + } + } + if (!isWindows() && thirdVMlsofPID == -1) { + String prefix = "Third" + LSOF_PID_PREFIX; + int ind = out.indexOf(prefix); + if (ind != -1) { + int startPid = ind + prefix.length(); + thirdVMlsofPID = extractPidFromStringOffset(out, startPid); + System.out.println("thirdVMlsofPID=" + thirdVMlsofPID); + } + } + Thread.sleep(100); + sleepCnt++; + } while (!out.contains(doneWithPattern) && !out.contains(EXIT)); + + System.out.println("Called Thread.sleep(100) " + sleepCnt + " times."); + + long subPids[] = new long[4]; // At most 4 pids to check. + String subNames[] = new String[4]; // At most 4 names for those pids. + int ind = 0; + if (!isWindows() && secondVMlsofPID != -1) { + // The second VM's lsof cmd should be the first non-windows sub-process to finish: + subPids[ind] = secondVMlsofPID; + subNames[ind] = "second VM lsof"; + ind++; + } + // The second VM should the second non-windows or first windows sub-process to finish: + subPids[ind] = secondVMPID; + subNames[ind] = "second VM"; + ind++; + if (!isWindows() && thirdVMlsofPID != -1) { + // The third VM's lsof cmd should be the third non-windows sub-process to finish: + subPids[ind] = thirdVMlsofPID; + subNames[ind] = "third VM lsof"; + ind++; + } + // The third VM should the last sub-process to finish: + subPids[ind] = thirdVMPID; + subNames[ind] = "third VM"; + ind++; + if (isWindows()) { + // No lsof pids on windows so we use fewer array slots. + // Make sure they are marked as not used. + for (; ind < subPids.length; ind++) { + subPids[ind] = -1; + } + } + + try { + for (ind = 0; ind < subPids.length; ind++) { + if (subPids[ind] == -1) { + continue; + } + System.out.print("subs[" + ind + "]={pid=" + subPids[ind] + ", name=" + subNames[ind] + "}"); + ProcessHandle.of(subPids[ind]).ifPresent(handle -> handle.onExit().orTimeout(subProcessTimeout, TimeUnit.SECONDS).join()); + System.out.println(" finished."); + } + } catch (Exception e) { + // Terminate the "subs" line from above: + System.out.println(" Exception was thrown while trying to join() subPids: " + e.toString()); + throw e; + } finally { + // Reread to get everything in the commFile: + out = new String(readAllBytes(commFile.toPath())); + System.out.println(""); + System.out.println(out); + System.out.println(""); + } + + return out.contains(RETAINS_FD); + } // first VM public static void main(String[] args) throws Exception { + System.out.println("subProcessTimeout=" + subProcessTimeout + " seconds."); + System.out.println("First VM starts."); String logPath = Utils.createTempFile("logging", LOG_SUFFIX).toFile().getName(); File commFile = Utils.createTempFile("communication", ".txt").toFile(); @@ -99,24 +238,18 @@ public class TestInheritFD { pb.redirectOutput(commFile); // use temp file to communicate between processes pb.start(); - String out = ""; - do { - out = new String(readAllBytes(commFile.toPath())); - Thread.sleep(100); - System.out.println("SLEEP 100 millis"); - } while (!out.contains(EXIT)); - - System.out.println(out); - if (out.contains(RETAINS_FD)) { - System.out.println("Log file was not inherited by third VM"); + if (waitForSubPids(commFile)) { + System.out.println("Log file was not inherited by third VM."); } else { - throw new RuntimeException("could not match: " + RETAINS_FD); + throw new RuntimeException("Log file was leaked to the third VM."); } + System.out.println("First VM ends."); } static class VMStartedWithLogging { // second VM public static void main(String[] args) throws IOException, InterruptedException { + System.out.println(SECOND_VM_PID_PREFIX + ProcessHandle.current().pid()); ProcessBuilder pb = createJavaProcessBuilder( "-Dtest.jdk=" + getProperty("test.jdk"), VMShouldNotInheritFileDescriptors.class.getName(), @@ -126,30 +259,43 @@ public class TestInheritFD { pb.start(); if (!isWindows()) { - System.out.println("(Second VM) Open file descriptors:\n" + outputContainingFilenames().stream().collect(joining("\n"))); + System.out.println("(Second VM) Open file descriptors:\n" + outputContainingFilenames("Second").stream().collect(joining("\n"))); + } + if (false) { // Enable to simulate a timeout in the second VM. + Thread.sleep(300 * 1000); } + System.out.println("Second VM ends."); } } static class VMShouldNotInheritFileDescriptors { // third VM public static void main(String[] args) throws InterruptedException { + System.out.println(THIRD_VM_PID_PREFIX + ProcessHandle.current().pid()); try { File logFile = new File(args[0]); long parentPid = parseLong(args[1]); fakeLeakyJVM(false); // for debugging of test case + System.out.println(THIRD_VM_WAITING_PREFIX + parentPid); + ProcessHandle.of(parentPid).ifPresent(handle -> handle.onExit().orTimeout(subProcessTimeout, TimeUnit.SECONDS).join()); + if (isWindows()) { - windows(logFile, parentPid); + windows(logFile); } else { - Collection output = outputContainingFilenames(); + Collection output = outputContainingFilenames("Third"); System.out.println("(Third VM) Open file descriptors:\n" + output.stream().collect(joining("\n"))); System.out.println(findOpenLogFile(output) ? LEAKS_FD : RETAINS_FD); } + if (false) { // Enable to simulate a timeout in the third VM. + Thread.sleep(300 * 1000); + } } catch (Exception e) { - System.out.println(e.toString()); + System.out.println("Exception was thrown: " + e.toString()); + throw e; } finally { System.out.println(EXIT); + System.out.println("Third VM ends."); } } } @@ -165,9 +311,11 @@ public class TestInheritFD { } } - static Stream run(String... args){ + static Stream runLsof(String whichVM, String... args){ try { - return new BufferedReader(new InputStreamReader(new ProcessBuilder(args).start().getInputStream())).lines(); + Process lsof = new ProcessBuilder(args).start(); + System.out.println(whichVM + LSOF_PID_PREFIX + lsof.pid()); + return new BufferedReader(new InputStreamReader(lsof.getInputStream())).lines(); } catch (IOException e) { throw new RuntimeException(e); } @@ -186,12 +334,12 @@ public class TestInheritFD { return lsofCommandCache; } - static Collection outputContainingFilenames() { + static Collection outputContainingFilenames(String whichVM) { long pid = ProcessHandle.current().pid(); String[] command = lsofCommand().orElseThrow(() -> new RuntimeException("lsof like command not found")); // Only search the directory in which the VM is running (user.dir property). System.out.println("using command: " + command[0] + " -a +d " + USER_DIR + " " + command[1] + " " + pid); - return run(command[0], "-a", "+d", USER_DIR, command[1], "" + pid).collect(toList()); + return runLsof(whichVM, command[0], "-a", "+d", USER_DIR, command[1], "" + pid).collect(toList()); } static boolean findOpenLogFile(Collection fileNames) { @@ -208,9 +356,7 @@ public class TestInheritFD { .isPresent(); } - static void windows(File f, long parentPid) throws InterruptedException { - System.out.println("waiting for pid: " + parentPid); - ProcessHandle.of(parentPid).ifPresent(handle -> handle.onExit().join()); + static void windows(File f) throws InterruptedException { System.out.println("trying to rename file to the same name: " + f); System.out.println(f.renameTo(f) ? RETAINS_FD : LEAKS_FD); // this parts communicates a closed file descriptor by printing "VM RESULT => RETAINS FD" } -- GitLab From f9137cb7b79f86e96247e7b4bc4abb03857afe75 Mon Sep 17 00:00:00 2001 From: Andrey Turbanov Date: Wed, 23 Mar 2022 19:27:56 +0000 Subject: [PATCH 339/340] 8280896: java/nio/file/Files/probeContentType/Basic.java fails on Windows 11 Reviewed-by: jpai, bpb --- test/jdk/java/nio/file/Files/probeContentType/Basic.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/jdk/java/nio/file/Files/probeContentType/Basic.java b/test/jdk/java/nio/file/Files/probeContentType/Basic.java index b404673b2f4..74e4cd5ab39 100644 --- a/test/jdk/java/nio/file/Files/probeContentType/Basic.java +++ b/test/jdk/java/nio/file/Files/probeContentType/Basic.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2022, 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 @@ -161,7 +161,7 @@ public class Basic { new ExType("doc", List.of("application/msword")), new ExType("docx", List.of("application/vnd.openxmlformats-officedocument.wordprocessingml.document")), new ExType("gz", List.of("application/gzip", "application/x-gzip")), - new ExType("jar", List.of("application/java-archive", "application/x-java-archive")), + new ExType("jar", List.of("application/java-archive", "application/x-java-archive", "application/jar")), new ExType("jpg", List.of("image/jpeg")), new ExType("js", List.of("text/javascript", "application/javascript")), new ExType("json", List.of("application/json")), -- GitLab From 0ee65e1ff3eaed4a8a2542562f0ba2a61d0f5894 Mon Sep 17 00:00:00 2001 From: Naoto Sato Date: Wed, 23 Mar 2022 19:44:04 +0000 Subject: [PATCH 340/340] 8283465: Character.UnicodeBlock.NUM_ENTITIES is out of date Reviewed-by: bpb, iris, smarks --- .../share/classes/java/lang/Character.java | 7 +- .../UnicodeBlock/NumberEntities.java | 50 +++++++++++++ .../UnicodeBlock/OptimalMapSize.java | 73 ------------------- 3 files changed, 55 insertions(+), 75 deletions(-) create mode 100644 test/jdk/java/lang/Character/UnicodeBlock/NumberEntities.java delete mode 100644 test/jdk/java/lang/Character/UnicodeBlock/OptimalMapSize.java diff --git a/src/java.base/share/classes/java/lang/Character.java b/src/java.base/share/classes/java/lang/Character.java index 92e9b5b43f5..d30743b143c 100644 --- a/src/java.base/share/classes/java/lang/Character.java +++ b/src/java.base/share/classes/java/lang/Character.java @@ -737,10 +737,13 @@ class Character implements java.io.Serializable, Comparable, Constabl */ public static final class UnicodeBlock extends Subset { /** - * 696 - the expected number of entities + * NUM_ENTITIES should match the total number of UnicodeBlocks + * to calculate the initial capacity of the map. It should be + * adjusted whenever the Unicode Character Database is upgraded. + * * 0.75 - the default load factor of HashMap */ - private static final int NUM_ENTITIES = 696; + private static final int NUM_ENTITIES = 737; private static Map map = new HashMap<>((int)(NUM_ENTITIES / 0.75f + 1.0f)); diff --git a/test/jdk/java/lang/Character/UnicodeBlock/NumberEntities.java b/test/jdk/java/lang/Character/UnicodeBlock/NumberEntities.java new file mode 100644 index 00000000000..a2a2312d6e3 --- /dev/null +++ b/test/jdk/java/lang/Character/UnicodeBlock/NumberEntities.java @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2015, 2022, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/** + * @test + * @bug 8080535 8191410 8215194 8221431 8239383 8268081 8283465 + * @summary Check if the NUM_ENTITIES field reflects the correct number + * of Character.UnicodeBlock constants. + * @modules java.base/java.lang:open + * @run testng NumberEntities + */ + +import static org.testng.Assert.assertEquals; +import org.testng.annotations.Test; + +import java.lang.reflect.Field; +import java.util.Map; + +@Test +public class NumberEntities { + public void test_NumberEntities() throws Throwable { + // The number of entries in Character.UnicodeBlock.map. + // See src/java.base/share/classes/java/lang/Character.java + Field n = Character.UnicodeBlock.class.getDeclaredField("NUM_ENTITIES"); + Field m = Character.UnicodeBlock.class.getDeclaredField("map"); + n.setAccessible(true); + m.setAccessible(true); + assertEquals(((Map)m.get(null)).size(), n.getInt(null)); + } +} diff --git a/test/jdk/java/lang/Character/UnicodeBlock/OptimalMapSize.java b/test/jdk/java/lang/Character/UnicodeBlock/OptimalMapSize.java deleted file mode 100644 index abe63eb0b7c..00000000000 --- a/test/jdk/java/lang/Character/UnicodeBlock/OptimalMapSize.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (c) 2015, 2022, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/** - * @test - * @bug 8080535 8191410 8215194 8221431 8239383 8268081 - * @summary Expected size of Character.UnicodeBlock.map is not optimal - * @library /test/lib - * @modules java.base/java.lang:open - * java.base/java.util:open - * @build jdk.test.lib.util.OptimalCapacity - * @run main OptimalMapSize - */ - -import java.lang.reflect.Field; -import jdk.test.lib.util.OptimalCapacity; - -// What will be the number of the Unicode blocks in the future. -// -// According to http://www.unicode.org/versions/Unicode7.0.0/ , -// in Unicode 7 there will be added 32 new blocks (96 with aliases). -// According to http://www.unicode.org/versions/beta-8.0.0.html , -// in Unicode 8 there will be added 10 more blocks (30 with aliases). -// -// After implementing support of Unicode 9 and 10 in Java, there will -// be 638 entries in Character.UnicodeBlock.map. -// -// As of Unicode 11, 667 entries are expected. -// As of Unicode 12.1, 676 entries are expected. -// As of Unicode 13.0, 684 entries are expected. -// As of Unicode 14.0, 696 entries are expected. -// -// Initialization of the map and this test will have to be adjusted -// accordingly then. -// -// Note that HashMap's implementation aligns the initial capacity to -// a power of two size, so it will end up 1024 (and thus succeed) in -// cases, such as 638, 667, 676, 684, and 696. - -public class OptimalMapSize { - public static void main(String[] args) throws Throwable { - // The initial size of Character.UnicodeBlock.map. - // See src/java.base/share/classes/java/lang/Character.java - Field f = Character.UnicodeBlock.class.getDeclaredField("NUM_ENTITIES"); - f.setAccessible(true); - int num_entities = f.getInt(null); - assert num_entities == 696; - int initialCapacity = (int)(num_entities / 0.75f + 1.0f); - - OptimalCapacity.ofHashMap(Character.UnicodeBlock.class, - "map", initialCapacity); - } -} -- GitLab

If you do not have access to sufficiently powerful hardware, it is also possible to use cross-compiling.