diff --git a/doc/building.html b/doc/building.html index feb699fd24d62..3601fa8af16c4 100644 --- a/doc/building.html +++ b/doc/building.html @@ -819,11 +819,11 @@

Running Configure

Some command line examples:

Common Configure Arguments

Here follows some of the most common and important @@ -1331,14 +1331,12 @@

ALSA

libasound2-dev packages for your target system. Download them to /tmp.

  • Install the libraries into the cross-compilation toolchain. For -instance:

  • - +instance:

    cd /tools/gcc-linaro-arm-linux-gnueabihf-raspbian-2012.09-20120921_linux/arm-linux-gnueabihf/libc
     dpkg-deb -x /tmp/libasound2_1.0.25-4_armhf.deb .
    -dpkg-deb -x /tmp/libasound2-dev_1.0.25-4_armhf.deb .
    -

    X11

    You will need X11 libraries suitable for your target system. @@ -1372,21 +1370,18 @@

    X11

  • Install the libraries into the cross-compilation toolchain. For instance:

    -
        cd /tools/gcc-linaro-arm-linux-gnueabihf-raspbian-2012.09-20120921_linux/arm-linux-gnueabihf/libc/usr
    -    mkdir X11R6
    -    cd X11R6
    -    for deb in /tmp/target-x11/*.deb ; do dpkg-deb -x $deb . ; done
    -    mv usr/* .
    -    cd lib
    -    cp arm-linux-gnueabihf/* .
    -    ```
    -
    -You can ignore the following messages. These libraries are not needed to
    -successfully complete a full JDK build.
    -

    cp: cannot stat -arm-linux-gnueabihf/libICE.so': No such file or directory cp: cannot statarm-linux-gnueabihf/libSM.so': -No such file or directory cp: cannot stat -`arm-linux-gnueabihf/libXt.so': No such file or directory ```

  • +
    cd /tools/gcc-linaro-arm-linux-gnueabihf-raspbian-2012.09-20120921_linux/arm-linux-gnueabihf/libc/usr
    +mkdir X11R6
    +cd X11R6
    +for deb in /tmp/target-x11/*.deb ; do dpkg-deb -x $deb . ; done
    +mv usr/* .
    +cd lib
    +cp arm-linux-gnueabihf/* .
    +

    You can ignore the following messages. These libraries are not needed +to successfully complete a full JDK build.

    +
    cp: cannot stat `arm-linux-gnueabihf/libICE.so': No such file or directory
    +cp: cannot stat `arm-linux-gnueabihf/libSM.so': No such file or directory
    +cp: cannot stat `arm-linux-gnueabihf/libXt.so': No such file or directory
  • If the X11 libraries are not properly detected by configure, you can point them out by --with-x.

  • @@ -1404,17 +1399,41 @@

    Cross compiling with

    For example, cross-compiling to AArch64 from x86_64 could be done like this:

    The build does not create new files in that chroot, so it can be reused for multiple builds without additional cleanup.

    @@ -1566,12 +1585,27 @@

    Building for RISC-V

    placeholder <toolchain-installed-path> shown below is the path where you want to install the toolchain.

    Building for musl

    Just like it's possible to cross-compile for a different CPU, it's diff --git a/doc/building.md b/doc/building.md index 415454cf6c36c..68c65bf0517a4 100644 --- a/doc/building.md +++ b/doc/building.md @@ -626,11 +626,13 @@ automatically, it will exit and inform you about the problem. Some command line examples: * Create a 32-bit build for Windows with FreeType2 in `C:\freetype-i586`: + ``` bash configure --with-freetype=/cygdrive/c/freetype-i586 --with-target-bits=32 ``` * Create a debug build with the `server` JVM and DTrace enabled: + ``` bash configure --enable-debug --with-jvm-variants=server --enable-dtrace ``` @@ -1100,11 +1102,12 @@ Note that alsa is needed even if you only want to build a headless JDK. system. Download them to /tmp. * Install the libraries into the cross-compilation toolchain. For instance: -``` -cd /tools/gcc-linaro-arm-linux-gnueabihf-raspbian-2012.09-20120921_linux/arm-linux-gnueabihf/libc -dpkg-deb -x /tmp/libasound2_1.0.25-4_armhf.deb . -dpkg-deb -x /tmp/libasound2-dev_1.0.25-4_armhf.deb . -``` + + ``` + cd /tools/gcc-linaro-arm-linux-gnueabihf-raspbian-2012.09-20120921_linux/arm-linux-gnueabihf/libc + dpkg-deb -x /tmp/libasound2_1.0.25-4_armhf.deb . + dpkg-deb -x /tmp/libasound2-dev_1.0.25-4_armhf.deb . + ``` * If alsa is not properly detected by `configure`, you can point it out by `--with-alsa`. @@ -1140,6 +1143,7 @@ Note that X11 is needed even if you only want to build a headless JDK. * libxext-dev * Install the libraries into the cross-compilation toolchain. For instance: + ``` cd /tools/gcc-linaro-arm-linux-gnueabihf-raspbian-2012.09-20120921_linux/arm-linux-gnueabihf/libc/usr mkdir X11R6 @@ -1173,11 +1177,13 @@ for foreign architectures with native compilation speed. For example, cross-compiling to AArch64 from x86_64 could be done like this: * Install cross-compiler on the *build* system: + ``` apt install g++-aarch64-linux-gnu gcc-aarch64-linux-gnu ``` * Create chroot on the *build* system, configuring it for *target* system: + ``` sudo debootstrap \ --arch=arm64 \ @@ -1191,12 +1197,29 @@ For example, cross-compiling to AArch64 from x86_64 could be done like this: # the path should be `debian-ports` instead of `debian`. ``` + * To create a Ubuntu-based chroot: + + ``` + sudo debootstrap \ + --arch=arm64 \ + --verbose \ + --components=main,universe \ + --include=fakeroot,symlinks,build-essential,libx11-dev,libxext-dev,libxrender-dev,libxrandr-dev,libxtst-dev,libxt-dev,libcups2-dev,libfontconfig1-dev,libasound2-dev,libfreetype6-dev,libpng-dev,libffi-dev \ + --resolve-deps \ + jammy \ + ~/sysroot-arm64 \ + http://ports.ubuntu.com/ubuntu-ports/ + # symlinks is in the universe repository + ``` + * Make sure the symlinks inside the newly created chroot point to proper locations: + ``` sudo chroot ~/sysroot-arm64 symlinks -cr . ``` * Configure and build with newly created chroot as sysroot/toolchain-path: + ``` sh ./configure \ --openjdk-target=aarch64-linux-gnu \ @@ -1255,6 +1278,7 @@ complicate the building process. The placeholder `` shown below is the path where you want to install the toolchain. * Install the RISC-V GNU compiler toolchain: + ``` git clone --recursive https://github.com/riscv-collab/riscv-gnu-toolchain cd riscv-gnu-toolchain @@ -1264,6 +1288,7 @@ shown below is the path where you want to install the toolchain. ``` * Cross-compile all the required libraries: + ``` # An example for libffi git clone https://github.com/libffi/libffi @@ -1274,6 +1299,7 @@ shown below is the path where you want to install the toolchain. ``` * Configure and build OpenJDK: + ``` bash configure \ --with-boot-jdk=$BOOT_JDK \ diff --git a/make/CreateJmods.gmk b/make/CreateJmods.gmk index 2901930cf8814..6fbaef6bdf1c4 100644 --- a/make/CreateJmods.gmk +++ b/make/CreateJmods.gmk @@ -1,5 +1,5 @@ # -# Copyright (c) 2014, 2022, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2014, 2023, Oracle and/or its affiliates. All rights reserved. # 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,13 +81,11 @@ endif ifneq ($(CMDS_DIR), ) DEPS += $(call FindFiles, $(CMDS_DIR)) ifeq ($(call isTargetOs, windows)+$(SHIP_DEBUG_SYMBOLS), true+public) - # For public debug symbols on Windows, we have to use stripped pdbs, rename them - # and filter out a few launcher pdbs where there's a lib that goes by the same name + # For public debug symbols on Windows, we have to use stripped pdbs and rename them rename_stripped = $(patsubst %.stripped.pdb,%.pdb,$1) CMDS_DIR_FILTERED := $(subst modules_cmds,modules_cmds_filtered, $(CMDS_DIR)) FILES_CMDS := $(filter-out %.pdb, $(call FindFiles, $(CMDS_DIR))) \ - $(filter-out %jimage.stripped.pdb %jpackage.stripped.pdb %java.stripped.pdb, \ - $(filter %.stripped.pdb, $(call FindFiles, $(CMDS_DIR)))) + $(filter %.stripped.pdb, $(call FindFiles, $(CMDS_DIR))) $(eval $(call SetupCopyFiles, COPY_FILTERED_CMDS, \ SRC := $(CMDS_DIR), \ DEST := $(CMDS_DIR_FILTERED), \ @@ -96,18 +94,6 @@ ifneq ($(CMDS_DIR), ) )) DEPS += $(COPY_FILTERED_CMDS) JMOD_FLAGS += --cmds $(CMDS_DIR_FILTERED) - else ifeq ($(call isTargetOs, windows)+$(SHIP_DEBUG_SYMBOLS), true+full) - # For full debug symbols on Windows, we have to filter out a few launcher pdbs - # where there's a lib that goes by the same name - CMDS_DIR_FILTERED := $(subst modules_cmds,modules_cmds_filtered, $(CMDS_DIR)) - $(eval $(call SetupCopyFiles, COPY_FILTERED_CMDS, \ - SRC := $(CMDS_DIR), \ - DEST := $(CMDS_DIR_FILTERED), \ - FILES := $(filter-out %jimage.pdb %jpackage.pdb %java.pdb, \ - $(call FindFiles, $(CMDS_DIR))), \ - )) - DEPS += $(COPY_FILTERED_CMDS) - JMOD_FLAGS += --cmds $(CMDS_DIR_FILTERED) else JMOD_FLAGS += --cmds $(CMDS_DIR) endif diff --git a/make/Images.gmk b/make/Images.gmk index aeda1e2f0d6c1..adf53a83c4f4c 100644 --- a/make/Images.gmk +++ b/make/Images.gmk @@ -274,9 +274,6 @@ else endif endif -FILTERED_PDBS := %jimage.stripped.pdb %jpackage.stripped.pdb %java.stripped.pdb \ - %jimage.pdb %jpackage.pdb %java.pdb %jimage.map %jpackage.map %java.map - # Param 1 - either JDK or JRE SetupCopyDebuginfo = \ $(foreach m, $(ALL_$1_MODULES), \ @@ -290,8 +287,8 @@ SetupCopyDebuginfo = \ $(eval $(call SetupCopyFiles, COPY_$1_CMDS_DEBUGINFO_$m, \ SRC := $(SUPPORT_OUTPUTDIR)/modules_cmds/$m, \ DEST := $($1_IMAGE_DIR)/$(CMDS_TARGET_SUBDIR), \ - FILES := $(filter-out $(FILTERED_PDBS), $(call FindDebuginfoFiles, \ - $(SUPPORT_OUTPUTDIR)/modules_cmds/$m)), \ + FILES := $(call FindDebuginfoFiles, \ + $(SUPPORT_OUTPUTDIR)/modules_cmds/$m), \ )) \ $(eval $1_TARGETS += $$(COPY_$1_CMDS_DEBUGINFO_$m)) \ ) diff --git a/make/RunTestsPrebuilt.gmk b/make/RunTestsPrebuilt.gmk index ae14b1e533652..93febe5ed31d9 100644 --- a/make/RunTestsPrebuilt.gmk +++ b/make/RunTestsPrebuilt.gmk @@ -158,6 +158,10 @@ ifeq ($(UNAME_OS), CYGWIN) OPENJDK_TARGET_OS := windows OPENJDK_TARGET_OS_TYPE := windows OPENJDK_TARGET_OS_ENV := windows.cygwin +else ifeq ($(UNAME_OS), MINGW64) + OPENJDK_TARGET_OS := windows + OPENJDK_TARGET_OS_TYPE := windows + OPENJDK_TARGET_OS_ENV := windows.msys2 else OPENJDK_TARGET_OS_TYPE:=unix ifeq ($(UNAME_OS), Linux) @@ -170,6 +174,9 @@ else OPENJDK_TARGET_OS_ENV := $(OPENJDK_TARGET_OS) endif +# Sanity check env detection +$(info Detected target OS, type and env: [$(OPENJDK_TARGET_OS)] [$(OPENJDK_TARGET_OS_TYPE)] [$(OPENJDK_TARGET_OS_ENV)]) + # Assume little endian unless otherwise specified OPENJDK_TARGET_CPU_ENDIAN := little diff --git a/make/ZipSecurity.gmk b/make/ZipSecurity.gmk index 4f960cd2fcd4b..00b552fae0af8 100644 --- a/make/ZipSecurity.gmk +++ b/make/ZipSecurity.gmk @@ -87,9 +87,9 @@ ifeq ($(call isTargetOs, windows), true) $(eval $(call SetupZipArchive,BUILD_JGSS_BIN_ZIP, \ SRC := $(SUPPORT_OUTPUTDIR), \ INCLUDE_FILES := modules_libs/java.security.jgss/w2k_lsa_auth.dll \ - modules_libs/java.security.jgss/w2k_lsa_auth.diz \ - modules_libs/java.security.jgss/w2k_lsa_auth.map \ - modules_libs/java.security.jgss/w2k_lsa_auth.pdb, \ + modules_libs/java.security.jgss/w2k_lsa_auth.dll.diz \ + modules_libs/java.security.jgss/w2k_lsa_auth.dll.map \ + modules_libs/java.security.jgss/w2k_lsa_auth.dll.pdb, \ ZIP := $(IMAGES_OUTPUTDIR)/$(JGSS_ZIP_NAME))) TARGETS += $(IMAGES_OUTPUTDIR)/$(JGSS_ZIP_NAME) diff --git a/make/common/NativeCompilation.gmk b/make/common/NativeCompilation.gmk index 6056f4632a525..68d1dba27ffcc 100644 --- a/make/common/NativeCompilation.gmk +++ b/make/common/NativeCompilation.gmk @@ -1073,13 +1073,13 @@ define SetupNativeCompilationBody ifneq ($$($1_TYPE), STATIC_LIBRARY) # Generate debuginfo files. ifeq ($(call isTargetOs, windows), true) - $1_EXTRA_LDFLAGS += -debug "-pdb:$$($1_SYMBOLS_DIR)/$$($1_NOSUFFIX).pdb" \ - "-map:$$($1_SYMBOLS_DIR)/$$($1_NOSUFFIX).map" + $1_EXTRA_LDFLAGS += -debug "-pdb:$$($1_SYMBOLS_DIR)/$$($1_BASENAME).pdb" \ + "-map:$$($1_SYMBOLS_DIR)/$$($1_BASENAME).map" ifeq ($(SHIP_DEBUG_SYMBOLS), public) - $1_EXTRA_LDFLAGS += "-pdbstripped:$$($1_SYMBOLS_DIR)/$$($1_NOSUFFIX).stripped.pdb" + $1_EXTRA_LDFLAGS += "-pdbstripped:$$($1_SYMBOLS_DIR)/$$($1_BASENAME).stripped.pdb" endif - $1_DEBUGINFO_FILES := $$($1_SYMBOLS_DIR)/$$($1_NOSUFFIX).pdb \ - $$($1_SYMBOLS_DIR)/$$($1_NOSUFFIX).map + $1_DEBUGINFO_FILES := $$($1_SYMBOLS_DIR)/$$($1_BASENAME).pdb \ + $$($1_SYMBOLS_DIR)/$$($1_BASENAME).map else ifeq ($(call isTargetOs, linux), true) $1_DEBUGINFO_FILES := $$($1_SYMBOLS_DIR)/$$($1_NOSUFFIX).debuginfo @@ -1127,7 +1127,11 @@ define SetupNativeCompilationBody $1 += $$($1_DEBUGINFO_FILES) ifeq ($$($1_ZIP_EXTERNAL_DEBUG_SYMBOLS), true) - $1_DEBUGINFO_ZIP := $$($1_SYMBOLS_DIR)/$$($1_NOSUFFIX).diz + ifeq ($(call isTargetOs, windows), true) + $1_DEBUGINFO_ZIP := $$($1_SYMBOLS_DIR)/$$($1_BASENAME).diz + else + $1_DEBUGINFO_ZIP := $$($1_SYMBOLS_DIR)/$$($1_NOSUFFIX).diz + endif $1 += $$($1_DEBUGINFO_ZIP) # The dependency on TARGET is needed for debuginfo files diff --git a/make/hotspot/test/GtestImage.gmk b/make/hotspot/test/GtestImage.gmk index d216328e5674e..9b2a37962cddd 100644 --- a/make/hotspot/test/GtestImage.gmk +++ b/make/hotspot/test/GtestImage.gmk @@ -61,7 +61,7 @@ ifeq ($(call isTargetOs, windows), true) $(eval $(call SetupCopyFiles, COPY_GTEST_PDB_$v, \ SRC := $(HOTSPOT_OUTPUTDIR)/variant-$v/libjvm/gtest, \ DEST := $(TEST_IMAGE_DIR)/hotspot/gtest/$v, \ - FILES := jvm.pdb gtestLauncher.pdb, \ + FILES := jvm.dll.pdb gtestLauncher.exe.pdb, \ )) \ $(eval TARGETS += $$(COPY_GTEST_PDB_$v)) \ ) \ diff --git a/make/ide/visualstudio/hotspot/src/classes/build/tools/projectcreator/WinGammaPlatformVC10.java b/make/ide/visualstudio/hotspot/src/classes/build/tools/projectcreator/WinGammaPlatformVC10.java index 092e5afd3e8fe..ed085dae09562 100644 --- a/make/ide/visualstudio/hotspot/src/classes/build/tools/projectcreator/WinGammaPlatformVC10.java +++ b/make/ide/visualstudio/hotspot/src/classes/build/tools/projectcreator/WinGammaPlatformVC10.java @@ -329,7 +329,7 @@ Vector getBaseCompilerFlags(Vector defines, Vector includes, String outDir) { addAttr(rv, "PrecompiledHeaderOutputFile", outDir+Util.sep+"vm.pch"); addAttr(rv, "AssemblerListingLocation", outDir); addAttr(rv, "ObjectFileName", outDir+Util.sep); - addAttr(rv, "ProgramDataBaseFileName", outDir+Util.sep+"jvm.pdb"); + addAttr(rv, "ProgramDataBaseFileName", outDir+Util.sep+"jvm.dll.pdb"); // Set /nologo option addAttr(rv, "SuppressStartupBanner", "true"); // Surpass the default /Tc or /Tp. @@ -409,7 +409,7 @@ Vector getBaseLinkerFlags(String outDir, String outDll, String platformName) { addAttr(rv, "OutputFile", outDll); addAttr(rv, "SuppressStartupBanner", "true"); addAttr(rv, "ModuleDefinitionFile", outDir+Util.sep+"vm.def"); - addAttr(rv, "ProgramDatabaseFile", outDir+Util.sep+"jvm.pdb"); + addAttr(rv, "ProgramDatabaseFile", outDir+Util.sep+"jvm.dll.pdb"); addAttr(rv, "SubSystem", "Windows"); addAttr(rv, "BaseAddress", "0x8000000"); addAttr(rv, "ImportLibrary", outDir+Util.sep+"jvm.lib"); diff --git a/make/scripts/compare_exceptions.sh.incl b/make/scripts/compare_exceptions.sh.incl index d9f62aa113222..d5043637145b2 100644 --- a/make/scripts/compare_exceptions.sh.incl +++ b/make/scripts/compare_exceptions.sh.incl @@ -49,8 +49,8 @@ elif [ "$OPENJDK_TARGET_OS" = "windows" ]; then SKIP_BIN_DIFF="true" SKIP_FULLDUMP_DIFF="true" ACCEPTED_JARZIP_CONTENTS=" - /modules_libs/java.security.jgss/w2k_lsa_auth.pdb - /modules_libs/java.security.jgss/w2k_lsa_auth.map + /modules_libs/java.security.jgss/w2k_lsa_auth.dll.pdb + /modules_libs/java.security.jgss/w2k_lsa_auth.dll.map /modules_libs/java.security.jgss/w2k_lsa_auth.dll " elif [ "$OPENJDK_TARGET_OS" = "macosx" ]; then diff --git a/src/hotspot/cpu/riscv/riscv.ad b/src/hotspot/cpu/riscv/riscv.ad index bcdf7b4137071..c28184e7ae5ff 100644 --- a/src/hotspot/cpu/riscv/riscv.ad +++ b/src/hotspot/cpu/riscv/riscv.ad @@ -983,8 +983,8 @@ definitions %{ int_def XFER_COST ( 300, 3 * DEFAULT_COST); // mfc, mtc, fcvt, fmove, fcmp int_def BRANCH_COST ( 200, 2 * DEFAULT_COST); // branch, jmp, call int_def IMUL_COST ( 1000, 10 * DEFAULT_COST); // imul - int_def IDIVSI_COST ( 3400, 34 * DEFAULT_COST); // idivdi - int_def IDIVDI_COST ( 6600, 66 * DEFAULT_COST); // idivsi + int_def IDIVSI_COST ( 3400, 34 * DEFAULT_COST); // idivsi + int_def IDIVDI_COST ( 6600, 66 * DEFAULT_COST); // idivdi int_def FMUL_SINGLE_COST ( 500, 5 * DEFAULT_COST); // fmul, fmadd int_def FMUL_DOUBLE_COST ( 700, 7 * DEFAULT_COST); // fmul, fmadd int_def FDIV_COST ( 2000, 20 * DEFAULT_COST); // fdiv diff --git a/src/hotspot/cpu/x86/c2_MacroAssembler_x86.cpp b/src/hotspot/cpu/x86/c2_MacroAssembler_x86.cpp index 2154601f2f26f..29413e5457c57 100644 --- a/src/hotspot/cpu/x86/c2_MacroAssembler_x86.cpp +++ b/src/hotspot/cpu/x86/c2_MacroAssembler_x86.cpp @@ -3853,13 +3853,11 @@ void C2_MacroAssembler::count_positives(Register ary1, Register len, VM_Version::supports_bmi2()) { Label test_64_loop, test_tail, BREAK_LOOP; - Register tmp3_aliased = len; - movl(tmp1, len); vpxor(vec2, vec2, vec2, Assembler::AVX_512bit); - andl(tmp1, 64 - 1); // tail count (in chars) 0x3F - andl(len, ~(64 - 1)); // vector count (in chars) + andl(tmp1, 0x0000003f); // tail count (in chars) 0x3F + andl(len, 0xffffffc0); // vector count (in chars) jccb(Assembler::zero, test_tail); lea(ary1, Address(ary1, len, Address::times_1)); @@ -3879,12 +3877,17 @@ void C2_MacroAssembler::count_positives(Register ary1, Register len, testl(tmp1, -1); jcc(Assembler::zero, DONE); + + // check the tail for absense of negatives // ~(~0 << len) applied up to two times (for 32-bit scenario) #ifdef _LP64 - mov64(tmp3_aliased, 0xFFFFFFFFFFFFFFFF); - shlxq(tmp3_aliased, tmp3_aliased, tmp1); - notq(tmp3_aliased); - kmovql(mask2, tmp3_aliased); + { + Register tmp3_aliased = len; + mov64(tmp3_aliased, 0xFFFFFFFFFFFFFFFF); + shlxq(tmp3_aliased, tmp3_aliased, tmp1); + notq(tmp3_aliased); + kmovql(mask2, tmp3_aliased); + } #else Label k_init; jmp(k_init); @@ -3916,8 +3919,13 @@ void C2_MacroAssembler::count_positives(Register ary1, Register len, ktestq(mask1, mask2); jcc(Assembler::zero, DONE); + // do a full check for negative registers in the tail + movl(len, tmp1); // tmp1 holds low 6-bit from original len; + // ary1 already pointing to the right place + jmpb(TAIL_START); + bind(BREAK_LOOP); - // At least one byte in the last 64 bytes is negative. + // At least one byte in the last 64 byte block was 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); diff --git a/src/hotspot/os/aix/safepointMechanism_aix.cpp b/src/hotspot/os/aix/safepointMechanism_aix.cpp index ef39149d74098..0a36c89bec6a9 100644 --- a/src/hotspot/os/aix/safepointMechanism_aix.cpp +++ b/src/hotspot/os/aix/safepointMechanism_aix.cpp @@ -24,10 +24,10 @@ #include "precompiled.hpp" #include "logging/log.hpp" +#include "nmt/memTracker.hpp" #include "runtime/globals.hpp" #include "runtime/os.hpp" #include "runtime/safepointMechanism.hpp" -#include "services/memTracker.hpp" #include void SafepointMechanism::pd_initialize() { diff --git a/src/hotspot/os/bsd/os_bsd.cpp b/src/hotspot/os/bsd/os_bsd.cpp index 31c33d43612f6..20eb3bec17fd9 100644 --- a/src/hotspot/os/bsd/os_bsd.cpp +++ b/src/hotspot/os/bsd/os_bsd.cpp @@ -34,6 +34,7 @@ #include "logging/log.hpp" #include "logging/logStream.hpp" #include "memory/allocation.inline.hpp" +#include "nmt/memTracker.hpp" #include "oops/oop.inline.hpp" #include "os_bsd.inline.hpp" #include "os_posix.inline.hpp" @@ -60,7 +61,6 @@ #include "runtime/threads.hpp" #include "runtime/timer.hpp" #include "services/attachListener.hpp" -#include "services/memTracker.hpp" #include "services/runtimeService.hpp" #include "signals_posix.hpp" #include "utilities/align.hpp" @@ -202,11 +202,13 @@ static char cpu_arch[] = "ppc"; #error Add appropriate cpu_arch setting #endif -// Compiler variant -#ifdef COMPILER2 - #define COMPILER_VARIANT "server" +// JVM variant +#if defined(ZERO) + #define JVM_VARIANT "zero" +#elif defined(COMPILER2) + #define JVM_VARIANT "server" #else - #define COMPILER_VARIANT "client" + #define JVM_VARIANT "client" #endif @@ -1501,10 +1503,10 @@ void os::jvm_path(char *buf, jint buflen) { snprintf(jrelib_p, buflen-len, "/lib"); } - // Add the appropriate client or server subdir + // Add the appropriate JVM variant subdir len = strlen(buf); jrelib_p = buf + len; - snprintf(jrelib_p, buflen-len, "/%s", COMPILER_VARIANT); + snprintf(jrelib_p, buflen-len, "/%s", JVM_VARIANT); if (0 != access(buf, F_OK)) { snprintf(jrelib_p, buflen-len, "%s", ""); } diff --git a/src/hotspot/os/linux/os_linux.cpp b/src/hotspot/os/linux/os_linux.cpp index db942feabcf52..6063e23da701a 100644 --- a/src/hotspot/os/linux/os_linux.cpp +++ b/src/hotspot/os/linux/os_linux.cpp @@ -36,10 +36,11 @@ #include "logging/log.hpp" #include "logging/logStream.hpp" #include "memory/allocation.inline.hpp" +#include "nmt/memTracker.hpp" #include "oops/oop.inline.hpp" +#include "osContainer_linux.hpp" #include "os_linux.inline.hpp" #include "os_posix.inline.hpp" -#include "osContainer_linux.hpp" #include "prims/jniFastGetField.hpp" #include "prims/jvm_misc.hpp" #include "runtime/arguments.hpp" @@ -64,19 +65,18 @@ #include "runtime/threadSMR.hpp" #include "runtime/timer.hpp" #include "runtime/vm_version.hpp" -#include "signals_posix.hpp" #include "semaphore_posix.hpp" -#include "services/memTracker.hpp" #include "services/runtimeService.hpp" +#include "signals_posix.hpp" #include "utilities/align.hpp" #include "utilities/checkedCast.hpp" #include "utilities/debug.hpp" #include "utilities/decoder.hpp" #include "utilities/defaultStream.hpp" -#include "utilities/events.hpp" #include "utilities/elfFile.hpp" -#include "utilities/growableArray.hpp" +#include "utilities/events.hpp" #include "utilities/globalDefinitions.hpp" +#include "utilities/growableArray.hpp" #include "utilities/macros.hpp" #include "utilities/powerOfTwo.hpp" #include "utilities/vmError.hpp" diff --git a/src/hotspot/os/posix/os_posix.cpp b/src/hotspot/os/posix/os_posix.cpp index 11dbead5d39ed..2df2220441262 100644 --- a/src/hotspot/os/posix/os_posix.cpp +++ b/src/hotspot/os/posix/os_posix.cpp @@ -27,20 +27,20 @@ #include "jvmtifiles/jvmti.h" #include "logging/log.hpp" #include "memory/allocation.inline.hpp" +#include "nmt/memTracker.hpp" #include "os_posix.inline.hpp" -#include "runtime/globals_extension.hpp" -#include "runtime/osThread.hpp" -#include "runtime/frame.inline.hpp" -#include "runtime/interfaceSupport.inline.hpp" -#include "runtime/sharedRuntime.hpp" -#include "services/attachListener.hpp" -#include "services/memTracker.hpp" #include "runtime/arguments.hpp" #include "runtime/atomic.hpp" +#include "runtime/frame.inline.hpp" +#include "runtime/globals_extension.hpp" +#include "runtime/interfaceSupport.inline.hpp" #include "runtime/java.hpp" #include "runtime/orderAccess.hpp" +#include "runtime/osThread.hpp" #include "runtime/park.hpp" #include "runtime/perfMemory.hpp" +#include "runtime/sharedRuntime.hpp" +#include "services/attachListener.hpp" #include "utilities/align.hpp" #include "utilities/checkedCast.hpp" #include "utilities/debug.hpp" diff --git a/src/hotspot/os/posix/perfMemory_posix.cpp b/src/hotspot/os/posix/perfMemory_posix.cpp index 7c39c5af466dc..8736e05bc62ae 100644 --- a/src/hotspot/os/posix/perfMemory_posix.cpp +++ b/src/hotspot/os/posix/perfMemory_posix.cpp @@ -29,13 +29,13 @@ #include "logging/log.hpp" #include "memory/allocation.inline.hpp" #include "memory/resourceArea.hpp" +#include "nmt/memTracker.hpp" #include "oops/oop.inline.hpp" #include "os_posix.inline.hpp" #include "runtime/globals_extension.hpp" #include "runtime/handles.inline.hpp" #include "runtime/os.hpp" #include "runtime/perfMemory.hpp" -#include "services/memTracker.hpp" #include "utilities/exceptions.hpp" #if defined(LINUX) #include "os_linux.hpp" diff --git a/src/hotspot/os/windows/os_windows.cpp b/src/hotspot/os/windows/os_windows.cpp index 45a240fea27b4..2cb3f7e754a9b 100644 --- a/src/hotspot/os/windows/os_windows.cpp +++ b/src/hotspot/os/windows/os_windows.cpp @@ -38,6 +38,7 @@ #include "logging/log.hpp" #include "logging/logStream.hpp" #include "memory/allocation.inline.hpp" +#include "nmt/memTracker.hpp" #include "oops/oop.inline.hpp" #include "os_windows.inline.hpp" #include "prims/jniFastGetField.hpp" @@ -63,12 +64,11 @@ #include "runtime/sharedRuntime.hpp" #include "runtime/statSampler.hpp" #include "runtime/stubRoutines.hpp" -#include "runtime/threads.hpp" #include "runtime/threadCritical.hpp" +#include "runtime/threads.hpp" #include "runtime/timer.hpp" #include "runtime/vm_version.hpp" #include "services/attachListener.hpp" -#include "services/memTracker.hpp" #include "services/runtimeService.hpp" #include "symbolengine.hpp" #include "utilities/align.hpp" diff --git a/src/hotspot/os/windows/perfMemory_windows.cpp b/src/hotspot/os/windows/perfMemory_windows.cpp index 8fa1aa5c34d5b..5a4f95d044fc8 100644 --- a/src/hotspot/os/windows/perfMemory_windows.cpp +++ b/src/hotspot/os/windows/perfMemory_windows.cpp @@ -27,13 +27,13 @@ #include "logging/log.hpp" #include "memory/allocation.inline.hpp" #include "memory/resourceArea.hpp" +#include "nmt/memTracker.hpp" #include "oops/oop.inline.hpp" #include "os_windows.inline.hpp" #include "runtime/globals_extension.hpp" #include "runtime/handles.inline.hpp" #include "runtime/os.hpp" #include "runtime/perfMemory.hpp" -#include "services/memTracker.hpp" #include "utilities/exceptions.hpp" #include "utilities/formatBuffer.hpp" diff --git a/src/hotspot/os_cpu/bsd_x86/atomic_bsd_x86.hpp b/src/hotspot/os_cpu/bsd_x86/atomic_bsd_x86.hpp index 77104194b0b78..9ba246f553d88 100644 --- a/src/hotspot/os_cpu/bsd_x86/atomic_bsd_x86.hpp +++ b/src/hotspot/os_cpu/bsd_x86/atomic_bsd_x86.hpp @@ -153,6 +153,14 @@ inline T Atomic::PlatformCmpxchg<8>::operator()(T volatile* dest, return cmpxchg_using_helper(_Atomic_cmpxchg_long, dest, compare_value, exchange_value); } +// No direct support for 8-byte xchg; emulate using cmpxchg. +template<> +struct Atomic::PlatformXchg<8> : Atomic::XchgUsingCmpxchg<8> {}; + +// No direct support for 8-byte add; emulate using cmpxchg. +template<> +struct Atomic::PlatformAdd<8> : Atomic::AddUsingCmpxchg<8> {}; + template<> template inline T Atomic::PlatformLoad<8>::operator()(T const volatile* src) const { diff --git a/src/hotspot/os_cpu/linux_arm/atomic_linux_arm.hpp b/src/hotspot/os_cpu/linux_arm/atomic_linux_arm.hpp index 814dbd9aab501..513217649e633 100644 --- a/src/hotspot/os_cpu/linux_arm/atomic_linux_arm.hpp +++ b/src/hotspot/os_cpu/linux_arm/atomic_linux_arm.hpp @@ -128,6 +128,13 @@ inline T Atomic::PlatformXchg<4>::operator()(T volatile* dest, return xchg_using_helper(ARMAtomicFuncs::_xchg_func, dest, exchange_value); } +// No direct support for 8-byte xchg; emulate using cmpxchg. +template<> +struct Atomic::PlatformXchg<8> : Atomic::XchgUsingCmpxchg<8> {}; + +// No direct support for 8-byte add; emulate using cmpxchg. +template<> +struct Atomic::PlatformAdd<8> : Atomic::AddUsingCmpxchg<8> {}; // The memory_order parameter is ignored - we always provide the strongest/most-conservative ordering diff --git a/src/hotspot/os_cpu/linux_x86/atomic_linux_x86.hpp b/src/hotspot/os_cpu/linux_x86/atomic_linux_x86.hpp index 2e472a020683a..0156546ba9b77 100644 --- a/src/hotspot/os_cpu/linux_x86/atomic_linux_x86.hpp +++ b/src/hotspot/os_cpu/linux_x86/atomic_linux_x86.hpp @@ -153,6 +153,14 @@ inline T Atomic::PlatformCmpxchg<8>::operator()(T volatile* dest, return cmpxchg_using_helper(_Atomic_cmpxchg_long, dest, compare_value, exchange_value); } +// No direct support for 8-byte xchg; emulate using cmpxchg. +template<> +struct Atomic::PlatformXchg<8> : Atomic::XchgUsingCmpxchg<8> {}; + +// No direct support for 8-byte add; emulate using cmpxchg. +template<> +struct Atomic::PlatformAdd<8> : Atomic::AddUsingCmpxchg<8> {}; + template<> template inline T Atomic::PlatformLoad<8>::operator()(T const volatile* src) const { 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 db5e1ed4bf212..b211330409d59 100644 --- a/src/hotspot/os_cpu/linux_x86/os_linux_x86.cpp +++ b/src/hotspot/os_cpu/linux_x86/os_linux_x86.cpp @@ -32,6 +32,7 @@ #include "jvm.h" #include "logging/log.hpp" #include "memory/allocation.inline.hpp" +#include "nmt/memTracker.hpp" #include "os_linux.hpp" #include "os_posix.hpp" #include "prims/jniFastGetField.hpp" @@ -48,7 +49,6 @@ #include "runtime/stubRoutines.hpp" #include "runtime/timer.hpp" #include "signals_posix.hpp" -#include "services/memTracker.hpp" #include "utilities/align.hpp" #include "utilities/debug.hpp" #include "utilities/events.hpp" diff --git a/src/hotspot/share/cds/filemap.cpp b/src/hotspot/share/cds/filemap.cpp index daab34857c0b7..14e901d7b08c6 100644 --- a/src/hotspot/share/cds/filemap.cpp +++ b/src/hotspot/share/cds/filemap.cpp @@ -45,13 +45,14 @@ #include "classfile/vmSymbols.hpp" #include "jvm.h" #include "logging/log.hpp" -#include "logging/logStream.hpp" #include "logging/logMessage.hpp" +#include "logging/logStream.hpp" #include "memory/iterator.inline.hpp" #include "memory/metadataFactory.hpp" #include "memory/metaspaceClosure.hpp" #include "memory/oopFactory.hpp" #include "memory/universe.hpp" +#include "nmt/memTracker.hpp" #include "oops/compressedOops.hpp" #include "oops/compressedOops.inline.hpp" #include "oops/objArrayOop.hpp" @@ -63,7 +64,6 @@ #include "runtime/mutexLocker.hpp" #include "runtime/os.hpp" #include "runtime/vm_version.hpp" -#include "services/memTracker.hpp" #include "utilities/align.hpp" #include "utilities/bitMap.inline.hpp" #include "utilities/classpathStream.hpp" diff --git a/src/hotspot/share/cds/metaspaceShared.cpp b/src/hotspot/share/cds/metaspaceShared.cpp index 0713212c10047..9f3a554bd1158 100644 --- a/src/hotspot/share/cds/metaspaceShared.cpp +++ b/src/hotspot/share/cds/metaspaceShared.cpp @@ -29,8 +29,9 @@ #include "cds/cds_globals.hpp" #include "cds/cdsConfig.hpp" #include "cds/cdsProtectionDomain.hpp" -#include "cds/classListWriter.hpp" +#include "cds/cds_globals.hpp" #include "cds/classListParser.hpp" +#include "cds/classListWriter.hpp" #include "cds/classPrelinker.hpp" #include "cds/cppVtables.hpp" #include "cds/dumpAllocStats.hpp" @@ -45,8 +46,8 @@ #include "classfile/javaClasses.inline.hpp" #include "classfile/loaderConstraints.hpp" #include "classfile/placeholders.hpp" -#include "classfile/symbolTable.hpp" #include "classfile/stringTable.hpp" +#include "classfile/symbolTable.hpp" #include "classfile/systemDictionary.hpp" #include "classfile/systemDictionaryShared.hpp" #include "classfile/vmClasses.hpp" @@ -63,6 +64,7 @@ #include "memory/metaspaceClosure.hpp" #include "memory/resourceArea.hpp" #include "memory/universe.hpp" +#include "nmt/memTracker.hpp" #include "oops/compressedKlass.hpp" #include "oops/instanceMirrorKlass.hpp" #include "oops/klass.inline.hpp" @@ -77,14 +79,13 @@ #include "runtime/os.inline.hpp" #include "runtime/safepointVerifiers.hpp" #include "runtime/sharedRuntime.hpp" -#include "runtime/vmThread.hpp" #include "runtime/vmOperations.hpp" +#include "runtime/vmThread.hpp" #include "sanitizers/leak.hpp" -#include "services/memTracker.hpp" #include "utilities/align.hpp" #include "utilities/bitMap.inline.hpp" -#include "utilities/ostream.hpp" #include "utilities/defaultStream.hpp" +#include "utilities/ostream.hpp" #include "utilities/resourceHash.hpp" ReservedSpace MetaspaceShared::_symbol_rs; diff --git a/src/hotspot/share/compiler/compilationMemoryStatistic.cpp b/src/hotspot/share/compiler/compilationMemoryStatistic.cpp index 182ab9fd2ed2e..8395d221c9244 100644 --- a/src/hotspot/share/compiler/compilationMemoryStatistic.cpp +++ b/src/hotspot/share/compiler/compilationMemoryStatistic.cpp @@ -34,12 +34,12 @@ #include "compiler/compilerThread.hpp" #include "memory/arena.hpp" #include "memory/resourceArea.hpp" +#include "nmt/nmtCommon.hpp" #include "oops/symbol.hpp" #ifdef COMPILER2 #include "opto/node.hpp" // compile.hpp is not self-contained #include "opto/compile.hpp" #endif -#include "services/nmtCommon.hpp" #include "runtime/mutexLocker.hpp" #include "runtime/os.hpp" #include "utilities/globalDefinitions.hpp" diff --git a/src/hotspot/share/compiler/compileBroker.cpp b/src/hotspot/share/compiler/compileBroker.cpp index f265271857dc1..22a9eb4dcaa55 100644 --- a/src/hotspot/share/compiler/compileBroker.cpp +++ b/src/hotspot/share/compiler/compileBroker.cpp @@ -2211,7 +2211,9 @@ void CompileBroker::invoke_compiler_on_method(CompileTask* task) { } else { JVMCIEnv env(thread, &compile_state, __FILE__, __LINE__); if (env.init_error() != JNI_OK) { - failure_reason = os::strdup(err_msg("Error attaching to libjvmci (err: %d)", env.init_error()), mtJVMCI); + const char* msg = env.init_error_msg(); + failure_reason = os::strdup(err_msg("Error attaching to libjvmci (err: %d, %s)", + env.init_error(), msg == nullptr ? "unknown" : msg), mtJVMCI); bool reason_on_C_heap = true; // In case of JNI_ENOMEM, there's a good chance a subsequent attempt to create libjvmci or attach to it // might succeed. Other errors most likely indicate a non-recoverable error in the JVMCI runtime. diff --git a/src/hotspot/share/gc/g1/g1BlockOffsetTable.cpp b/src/hotspot/share/gc/g1/g1BlockOffsetTable.cpp index c8b60b4c98236..71107387564a2 100644 --- a/src/hotspot/share/gc/g1/g1BlockOffsetTable.cpp +++ b/src/hotspot/share/gc/g1/g1BlockOffsetTable.cpp @@ -27,11 +27,9 @@ #include "gc/g1/g1CollectedHeap.inline.hpp" #include "gc/g1/heapRegion.inline.hpp" #include "logging/log.hpp" +#include "nmt/memTracker.hpp" #include "oops/oop.inline.hpp" #include "runtime/java.hpp" -#include "services/memTracker.hpp" - - ////////////////////////////////////////////////////////////////////// // G1BlockOffsetTable diff --git a/src/hotspot/share/gc/g1/g1CodeRootSet.cpp b/src/hotspot/share/gc/g1/g1CodeRootSet.cpp index 8b32d3c295685..59d877554ea4e 100644 --- a/src/hotspot/share/gc/g1/g1CodeRootSet.cpp +++ b/src/hotspot/share/gc/g1/g1CodeRootSet.cpp @@ -143,8 +143,11 @@ class G1CodeRootSetHashTable : public CHeapObj { } void clear() { - _table.unsafe_reset(); - Atomic::store(&_num_entries, (size_t)0); + // Remove all entries. + auto always_true = [] (nmethod** value) { + return true; + }; + clean(always_true); } void iterate_at_safepoint(CodeBlobClosure* blk) { diff --git a/src/hotspot/share/gc/g1/g1ConcurrentMark.cpp b/src/hotspot/share/gc/g1/g1ConcurrentMark.cpp index f46ac31ceeb8d..c30ea3d69d01a 100644 --- a/src/hotspot/share/gc/g1/g1ConcurrentMark.cpp +++ b/src/hotspot/share/gc/g1/g1ConcurrentMark.cpp @@ -64,6 +64,7 @@ #include "memory/metaspaceUtils.hpp" #include "memory/resourceArea.hpp" #include "memory/universe.hpp" +#include "nmt/memTracker.hpp" #include "oops/access.inline.hpp" #include "oops/oop.inline.hpp" #include "runtime/atomic.hpp" @@ -73,7 +74,6 @@ #include "runtime/orderAccess.hpp" #include "runtime/prefetch.inline.hpp" #include "runtime/threads.hpp" -#include "services/memTracker.hpp" #include "utilities/align.hpp" #include "utilities/formatBuffer.hpp" #include "utilities/growableArray.hpp" diff --git a/src/hotspot/share/gc/g1/g1HeapTransition.cpp b/src/hotspot/share/gc/g1/g1HeapTransition.cpp index 49ba19dfdba6d..a2097041b2093 100644 --- a/src/hotspot/share/gc/g1/g1HeapTransition.cpp +++ b/src/hotspot/share/gc/g1/g1HeapTransition.cpp @@ -143,11 +143,11 @@ void G1HeapTransition::print() { usage = blk._usage; assert(usage._eden_region_count == 0, "Expected no eden regions, but got " SIZE_FORMAT, usage._eden_region_count); assert(usage._survivor_region_count == after._survivor_length, "Expected survivors to be " SIZE_FORMAT " but was " SIZE_FORMAT, - after._survivor_length, usage._survivor_region_count); + after._survivor_length, usage._survivor_region_count); assert(usage._old_region_count == after._old_length, "Expected old to be " SIZE_FORMAT " but was " SIZE_FORMAT, - after._old_length, usage._old_region_count); + after._old_length, usage._old_region_count); assert(usage._humongous_region_count == after._humongous_length, "Expected humongous to be " SIZE_FORMAT " but was " SIZE_FORMAT, - after._humongous_length, usage._humongous_region_count); + after._humongous_length, usage._humongous_region_count); } log_regions("Eden", _before._eden_length, after._eden_length, eden_capacity_length_after_gc, @@ -157,17 +157,17 @@ void G1HeapTransition::print() { log_regions("Survivor", _before._survivor_length, after._survivor_length, survivor_capacity_length_before_gc, _before._survivor_length_per_node, after._survivor_length_per_node); log_trace(gc, heap)(" Used: " SIZE_FORMAT "K, Waste: " SIZE_FORMAT "K", - usage._survivor_used / K, ((after._survivor_length * HeapRegion::GrainBytes) - usage._survivor_used) / K); + usage._survivor_used / K, ((after._survivor_length * HeapRegion::GrainBytes) - usage._survivor_used) / K); log_info(gc, heap)("Old regions: " SIZE_FORMAT "->" SIZE_FORMAT, _before._old_length, after._old_length); log_trace(gc, heap)(" Used: " SIZE_FORMAT "K, Waste: " SIZE_FORMAT "K", - usage._old_used / K, ((after._old_length * HeapRegion::GrainBytes) - usage._old_used) / K); + usage._old_used / K, ((after._old_length * HeapRegion::GrainBytes) - usage._old_used) / K); log_info(gc, heap)("Humongous regions: " SIZE_FORMAT "->" SIZE_FORMAT, _before._humongous_length, after._humongous_length); log_trace(gc, heap)(" Used: " SIZE_FORMAT "K, Waste: " SIZE_FORMAT "K", - usage._humongous_used / K, ((after._humongous_length * HeapRegion::GrainBytes) - usage._humongous_used) / K); + usage._humongous_used / K, ((after._humongous_length * HeapRegion::GrainBytes) - usage._humongous_used) / K); MetaspaceUtils::print_metaspace_change(_before._meta_sizes); } diff --git a/src/hotspot/share/gc/g1/g1PageBasedVirtualSpace.cpp b/src/hotspot/share/gc/g1/g1PageBasedVirtualSpace.cpp index 5265d23b555a8..bdb732f6ebb39 100644 --- a/src/hotspot/share/gc/g1/g1PageBasedVirtualSpace.cpp +++ b/src/hotspot/share/gc/g1/g1PageBasedVirtualSpace.cpp @@ -26,11 +26,11 @@ #include "gc/g1/g1PageBasedVirtualSpace.hpp" #include "gc/shared/pretouchTask.hpp" #include "gc/shared/workerThread.hpp" +#include "nmt/memTracker.hpp" #include "oops/markWord.hpp" #include "oops/oop.inline.hpp" #include "runtime/atomic.hpp" #include "runtime/os.hpp" -#include "services/memTracker.hpp" #include "utilities/align.hpp" #include "utilities/bitMap.inline.hpp" diff --git a/src/hotspot/share/gc/g1/g1Policy.cpp b/src/hotspot/share/gc/g1/g1Policy.cpp index 13736b891e208..1bc1d44691bbb 100644 --- a/src/hotspot/share/gc/g1/g1Policy.cpp +++ b/src/hotspot/share/gc/g1/g1Policy.cpp @@ -1099,7 +1099,7 @@ double G1Policy::predict_eden_copy_time_ms(uint count, size_t* bytes_to_copy) co if (count == 0) { return 0.0; } - size_t const expected_bytes = _eden_surv_rate_group->accum_surv_rate_pred(count) * HeapRegion::GrainBytes; + size_t const expected_bytes = _eden_surv_rate_group->accum_surv_rate_pred(count - 1) * HeapRegion::GrainBytes; if (bytes_to_copy != nullptr) { *bytes_to_copy = expected_bytes; } diff --git a/src/hotspot/share/gc/g1/g1RegionToSpaceMapper.cpp b/src/hotspot/share/gc/g1/g1RegionToSpaceMapper.cpp index 028b2a0748778..5f903960cce8c 100644 --- a/src/hotspot/share/gc/g1/g1RegionToSpaceMapper.cpp +++ b/src/hotspot/share/gc/g1/g1RegionToSpaceMapper.cpp @@ -29,8 +29,8 @@ #include "gc/shared/gc_globals.hpp" #include "memory/allocation.inline.hpp" #include "memory/virtualspace.hpp" +#include "nmt/memTracker.hpp" #include "runtime/mutexLocker.hpp" -#include "services/memTracker.hpp" #include "utilities/align.hpp" #include "utilities/bitMap.inline.hpp" #include "utilities/powerOfTwo.hpp" diff --git a/src/hotspot/share/gc/parallel/objectStartArray.cpp b/src/hotspot/share/gc/parallel/objectStartArray.cpp index 3e4820aa9414f..804b936393c45 100644 --- a/src/hotspot/share/gc/parallel/objectStartArray.cpp +++ b/src/hotspot/share/gc/parallel/objectStartArray.cpp @@ -26,9 +26,9 @@ #include "gc/parallel/objectStartArray.inline.hpp" #include "gc/shared/cardTableBarrierSet.hpp" #include "memory/allocation.inline.hpp" +#include "nmt/memTracker.hpp" #include "oops/oop.inline.hpp" #include "runtime/java.hpp" -#include "services/memTracker.hpp" #include "utilities/align.hpp" uint ObjectStartArray::_card_shift = 0; diff --git a/src/hotspot/share/gc/parallel/parMarkBitMap.cpp b/src/hotspot/share/gc/parallel/parMarkBitMap.cpp index 9cdd91652f054..54db633af5289 100644 --- a/src/hotspot/share/gc/parallel/parMarkBitMap.cpp +++ b/src/hotspot/share/gc/parallel/parMarkBitMap.cpp @@ -26,10 +26,10 @@ #include "gc/parallel/parMarkBitMap.inline.hpp" #include "gc/parallel/psCompactionManager.inline.hpp" #include "gc/parallel/psParallelCompact.inline.hpp" +#include "nmt/memTracker.hpp" #include "oops/oop.inline.hpp" #include "runtime/atomic.hpp" #include "runtime/os.hpp" -#include "services/memTracker.hpp" #include "utilities/align.hpp" #include "utilities/bitMap.inline.hpp" diff --git a/src/hotspot/share/gc/parallel/parallelScavengeHeap.cpp b/src/hotspot/share/gc/parallel/parallelScavengeHeap.cpp index 57452cf07e5ae..190e01d96740d 100644 --- a/src/hotspot/share/gc/parallel/parallelScavengeHeap.cpp +++ b/src/hotspot/share/gc/parallel/parallelScavengeHeap.cpp @@ -24,8 +24,8 @@ #include "precompiled.hpp" #include "code/codeCache.hpp" -#include "gc/parallel/parallelArguments.hpp" #include "gc/parallel/objectStartArray.inline.hpp" +#include "gc/parallel/parallelArguments.hpp" #include "gc/parallel/parallelInitLogger.hpp" #include "gc/parallel/parallelScavengeHeap.inline.hpp" #include "gc/parallel/psAdaptiveSizePolicy.hpp" @@ -35,10 +35,10 @@ #include "gc/parallel/psScavenge.hpp" #include "gc/parallel/psVMOperations.hpp" #include "gc/shared/gcHeapSummary.hpp" +#include "gc/shared/gcInitLogger.hpp" #include "gc/shared/gcLocker.inline.hpp" #include "gc/shared/gcWhen.hpp" #include "gc/shared/genArguments.hpp" -#include "gc/shared/gcInitLogger.hpp" #include "gc/shared/locationPrinter.inline.hpp" #include "gc/shared/scavengableNMethods.hpp" #include "gc/shared/suspendibleThreadSet.hpp" @@ -47,12 +47,12 @@ #include "memory/metaspaceCounters.hpp" #include "memory/metaspaceUtils.hpp" #include "memory/universe.hpp" +#include "nmt/memTracker.hpp" #include "oops/oop.inline.hpp" #include "runtime/handles.inline.hpp" #include "runtime/java.hpp" #include "runtime/vmThread.hpp" #include "services/memoryManager.hpp" -#include "services/memTracker.hpp" #include "utilities/macros.hpp" #include "utilities/vmError.hpp" diff --git a/src/hotspot/share/gc/parallel/psCardTable.cpp b/src/hotspot/share/gc/parallel/psCardTable.cpp index 4d63cdb9a3f3a..06fd02b0da81e 100644 --- a/src/hotspot/share/gc/parallel/psCardTable.cpp +++ b/src/hotspot/share/gc/parallel/psCardTable.cpp @@ -95,29 +95,6 @@ class CheckForUnmarkedObjects : public ObjectClosure { } }; -// Checks for precise marking of oops as newgen. -class CheckForPreciseMarks : public BasicOopIterateClosure { - private: - PSYoungGen* _young_gen; - PSCardTable* _card_table; - - protected: - template void do_oop_work(T* p) { - oop obj = RawAccess::oop_load(p); - if (_young_gen->is_in_reserved(obj)) { - assert(_card_table->addr_is_marked_precise(p), "Found unmarked precise oop"); - _card_table->set_card_newgen(p); - } - } - - public: - CheckForPreciseMarks(PSYoungGen* young_gen, PSCardTable* card_table) : - _young_gen(young_gen), _card_table(card_table) { } - - virtual void do_oop(oop* p) { CheckForPreciseMarks::do_oop_work(p); } - virtual void do_oop(narrowOop* p) { CheckForPreciseMarks::do_oop_work(p); } -}; - static void prefetch_write(void *p) { if (PrefetchScanIntervalInBytes >= 0) { Prefetch::write(p, PrefetchScanIntervalInBytes); @@ -410,29 +387,6 @@ void PSCardTable::verify_all_young_refs_imprecise() { old_gen->object_iterate(&check); } -// This should be called immediately after a scavenge, before mutators resume. -void PSCardTable::verify_all_young_refs_precise() { - ParallelScavengeHeap* heap = ParallelScavengeHeap::heap(); - PSOldGen* old_gen = heap->old_gen(); - - CheckForPreciseMarks check(heap->young_gen(), this); - - old_gen->oop_iterate(&check); - - verify_all_young_refs_precise_helper(old_gen->object_space()->used_region()); -} - -void PSCardTable::verify_all_young_refs_precise_helper(MemRegion mr) { - CardValue* bot = byte_for(mr.start()); - CardValue* top = byte_for(mr.end()); - while (bot <= top) { - assert(*bot == clean_card || *bot == verify_card, "Found unwanted or unknown card mark"); - if (*bot == verify_card) - *bot = youngergen_card; - bot++; - } -} - bool PSCardTable::addr_is_marked_imprecise(void *addr) { CardValue* p = byte_for(addr); CardValue val = *p; @@ -451,28 +405,6 @@ bool PSCardTable::addr_is_marked_imprecise(void *addr) { return false; } -// Also includes verify_card -bool PSCardTable::addr_is_marked_precise(void *addr) { - CardValue* p = byte_for(addr); - CardValue val = *p; - - if (card_is_newgen(val)) - return true; - - if (card_is_verify(val)) - return true; - - if (card_is_clean(val)) - return false; - - if (card_is_dirty(val)) - return false; - - assert(false, "Found unhandled card mark type"); - - return false; -} - bool PSCardTable::is_in_young(const void* p) const { return ParallelScavengeHeap::heap()->is_in_young(p); } diff --git a/src/hotspot/share/gc/parallel/psCardTable.hpp b/src/hotspot/share/gc/parallel/psCardTable.hpp index b0634d5c0b084..b34d5961d6cae 100644 --- a/src/hotspot/share/gc/parallel/psCardTable.hpp +++ b/src/hotspot/share/gc/parallel/psCardTable.hpp @@ -63,8 +63,6 @@ class PSCardTable: public CardTable { HeapWord* const start, HeapWord* const end); - void verify_all_young_refs_precise_helper(MemRegion mr); - enum ExtendedCardValue { youngergen_card = CT_MR_BS_last_reserved + 1, verify_card = CT_MR_BS_last_reserved + 5 @@ -93,7 +91,6 @@ class PSCardTable: public CardTable { uint n_stripes); bool addr_is_marked_imprecise(void *addr); - bool addr_is_marked_precise(void *addr); void set_card_newgen(void* addr) { CardValue* p = byte_for(addr); *p = verify_card; } @@ -120,7 +117,6 @@ class PSCardTable: public CardTable { // Verification void verify_all_young_refs_imprecise(); - void verify_all_young_refs_precise(); }; #endif // SHARE_GC_PARALLEL_PSCARDTABLE_HPP diff --git a/src/hotspot/share/gc/parallel/psParallelCompact.cpp b/src/hotspot/share/gc/parallel/psParallelCompact.cpp index b8ee8ef6163ac..496f6dd35295f 100644 --- a/src/hotspot/share/gc/parallel/psParallelCompact.cpp +++ b/src/hotspot/share/gc/parallel/psParallelCompact.cpp @@ -67,6 +67,7 @@ #include "memory/metaspaceUtils.hpp" #include "memory/resourceArea.hpp" #include "memory/universe.hpp" +#include "nmt/memTracker.hpp" #include "oops/access.inline.hpp" #include "oops/instanceClassLoaderKlass.inline.hpp" #include "oops/instanceKlass.inline.hpp" @@ -80,7 +81,6 @@ #include "runtime/safepoint.hpp" #include "runtime/threads.hpp" #include "runtime/vmThread.hpp" -#include "services/memTracker.hpp" #include "services/memoryService.hpp" #include "utilities/align.hpp" #include "utilities/debug.hpp" diff --git a/src/hotspot/share/gc/parallel/psScavenge.cpp b/src/hotspot/share/gc/parallel/psScavenge.cpp index 5354d9257b9fe..2f114e1e2cecc 100644 --- a/src/hotspot/share/gc/parallel/psScavenge.cpp +++ b/src/hotspot/share/gc/parallel/psScavenge.cpp @@ -643,11 +643,7 @@ bool PSScavenge::invoke_no_policy() { old_gen->verify_object_start_array(); } - // Verify all old -> young cards are now precise if (VerifyRememberedSets) { - // Precise verification will give false positives. Until this is fixed, - // use imprecise verification. - // heap->card_table()->verify_all_young_refs_precise(); heap->card_table()->verify_all_young_refs_imprecise(); } diff --git a/src/hotspot/share/gc/serial/serialBlockOffsetTable.cpp b/src/hotspot/share/gc/serial/serialBlockOffsetTable.cpp index 0fdeab92bab62..721a8de5abc36 100644 --- a/src/hotspot/share/gc/serial/serialBlockOffsetTable.cpp +++ b/src/hotspot/share/gc/serial/serialBlockOffsetTable.cpp @@ -30,9 +30,9 @@ #include "logging/log.hpp" #include "memory/iterator.hpp" #include "memory/universe.hpp" +#include "nmt/memTracker.hpp" #include "oops/oop.inline.hpp" #include "runtime/java.hpp" -#include "services/memTracker.hpp" ////////////////////////////////////////////////////////////////////// // BlockOffsetSharedArray diff --git a/src/hotspot/share/gc/shared/cardTable.cpp b/src/hotspot/share/gc/shared/cardTable.cpp index ea173af015a14..a5025a4e5a211 100644 --- a/src/hotspot/share/gc/shared/cardTable.cpp +++ b/src/hotspot/share/gc/shared/cardTable.cpp @@ -30,10 +30,10 @@ #include "gc/shared/space.inline.hpp" #include "logging/log.hpp" #include "memory/virtualspace.hpp" +#include "nmt/memTracker.hpp" #include "runtime/init.hpp" #include "runtime/java.hpp" #include "runtime/os.hpp" -#include "services/memTracker.hpp" #include "utilities/align.hpp" #if INCLUDE_PARALLELGC #include "gc/parallel/objectStartArray.hpp" diff --git a/src/hotspot/share/gc/shared/cardTableBarrierSet.cpp b/src/hotspot/share/gc/shared/cardTableBarrierSet.cpp index 24448b61e192e..b7d706df6e395 100644 --- a/src/hotspot/share/gc/shared/cardTableBarrierSet.cpp +++ b/src/hotspot/share/gc/shared/cardTableBarrierSet.cpp @@ -25,15 +25,15 @@ #include "precompiled.hpp" #include "compiler/compilerDefinitions.inline.hpp" #include "gc/shared/cardTable.hpp" -#include "gc/shared/cardTableBarrierSetAssembler.hpp" #include "gc/shared/cardTableBarrierSet.inline.hpp" +#include "gc/shared/cardTableBarrierSetAssembler.hpp" #include "gc/shared/collectedHeap.hpp" #include "gc/shared/space.inline.hpp" #include "logging/log.hpp" #include "memory/virtualspace.hpp" +#include "nmt/memTracker.hpp" #include "oops/oop.inline.hpp" #include "runtime/javaThread.hpp" -#include "services/memTracker.hpp" #include "utilities/align.hpp" #include "utilities/macros.hpp" #ifdef COMPILER1 diff --git a/src/hotspot/share/gc/shared/oopStorage.cpp b/src/hotspot/share/gc/shared/oopStorage.cpp index e91f9f2cd416a..4d1a720bb3430 100644 --- a/src/hotspot/share/gc/shared/oopStorage.cpp +++ b/src/hotspot/share/gc/shared/oopStorage.cpp @@ -28,6 +28,7 @@ #include "logging/log.hpp" #include "logging/logStream.hpp" #include "memory/allocation.inline.hpp" +#include "nmt/memTracker.hpp" #include "runtime/atomic.hpp" #include "runtime/globals.hpp" #include "runtime/handles.inline.hpp" @@ -39,7 +40,6 @@ #include "runtime/os.hpp" #include "runtime/safefetch.hpp" #include "runtime/safepoint.hpp" -#include "services/memTracker.hpp" #include "utilities/align.hpp" #include "utilities/count_trailing_zeros.hpp" #include "utilities/debug.hpp" diff --git a/src/hotspot/share/gc/shenandoah/shenandoahCollectionSet.cpp b/src/hotspot/share/gc/shenandoah/shenandoahCollectionSet.cpp index cc5e58aee25b8..25062c5317dcb 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahCollectionSet.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahCollectionSet.cpp @@ -30,7 +30,7 @@ #include "gc/shenandoah/shenandoahHeapRegionSet.hpp" #include "gc/shenandoah/shenandoahUtils.hpp" #include "runtime/atomic.hpp" -#include "services/memTracker.hpp" +#include "nmt/memTracker.hpp" #include "utilities/copy.hpp" ShenandoahCollectionSet::ShenandoahCollectionSet(ShenandoahHeap* heap, ReservedSpace space, char* heap_base) : diff --git a/src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp b/src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp index b6d77d1147eee..13f9d430ca56a 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp @@ -76,6 +76,8 @@ #include "code/codeCache.hpp" #include "memory/classLoaderMetaspace.hpp" #include "memory/metaspaceUtils.hpp" +#include "nmt/mallocTracker.hpp" +#include "nmt/memTracker.hpp" #include "oops/compressedOops.inline.hpp" #include "prims/jvmtiTagMap.hpp" #include "runtime/atomic.hpp" @@ -85,8 +87,6 @@ #include "runtime/orderAccess.hpp" #include "runtime/safepointMechanism.hpp" #include "runtime/vmThread.hpp" -#include "services/mallocTracker.hpp" -#include "services/memTracker.hpp" #include "utilities/events.hpp" #include "utilities/powerOfTwo.hpp" diff --git a/src/hotspot/share/gc/x/xPhysicalMemory.cpp b/src/hotspot/share/gc/x/xPhysicalMemory.cpp index 9519ae93ee1b4..ca093f73d71de 100644 --- a/src/hotspot/share/gc/x/xPhysicalMemory.cpp +++ b/src/hotspot/share/gc/x/xPhysicalMemory.cpp @@ -31,11 +31,11 @@ #include "gc/x/xNUMA.inline.hpp" #include "gc/x/xPhysicalMemory.inline.hpp" #include "logging/log.hpp" +#include "nmt/memTracker.hpp" #include "runtime/globals.hpp" #include "runtime/globals_extension.hpp" #include "runtime/init.hpp" #include "runtime/os.hpp" -#include "services/memTracker.hpp" #include "utilities/align.hpp" #include "utilities/debug.hpp" #include "utilities/globalDefinitions.hpp" diff --git a/src/hotspot/share/gc/x/xVirtualMemory.cpp b/src/hotspot/share/gc/x/xVirtualMemory.cpp index 650f22f328392..1d66cdd069ef7 100644 --- a/src/hotspot/share/gc/x/xVirtualMemory.cpp +++ b/src/hotspot/share/gc/x/xVirtualMemory.cpp @@ -27,7 +27,7 @@ #include "gc/x/xAddressSpaceLimit.hpp" #include "gc/x/xGlobals.hpp" #include "gc/x/xVirtualMemory.inline.hpp" -#include "services/memTracker.hpp" +#include "nmt/memTracker.hpp" #include "utilities/align.hpp" #include "utilities/debug.hpp" diff --git a/src/hotspot/share/gc/z/zNMT.cpp b/src/hotspot/share/gc/z/zNMT.cpp index d8753dc22833c..fa6c3cd6540ad 100644 --- a/src/hotspot/share/gc/z/zNMT.cpp +++ b/src/hotspot/share/gc/z/zNMT.cpp @@ -27,7 +27,7 @@ #include "gc/z/zNMT.hpp" #include "gc/z/zVirtualMemory.hpp" #include "memory/allocation.hpp" -#include "services/memTracker.hpp" +#include "nmt/memTracker.hpp" #include "utilities/nativeCallStack.hpp" ZNMT::Reservation ZNMT::_reservations[ZMaxVirtualReservations] = {}; diff --git a/src/hotspot/share/jfr/periodic/jfrNativeMemoryEvent.cpp b/src/hotspot/share/jfr/periodic/jfrNativeMemoryEvent.cpp index d440a5070b854..2b86108121586 100644 --- a/src/hotspot/share/jfr/periodic/jfrNativeMemoryEvent.cpp +++ b/src/hotspot/share/jfr/periodic/jfrNativeMemoryEvent.cpp @@ -25,8 +25,8 @@ #include "precompiled.hpp" #include "jfr/jfrEvents.hpp" #include "jfr/periodic/jfrNativeMemoryEvent.hpp" -#include "services/memTracker.hpp" -#include "services/nmtUsage.hpp" +#include "nmt/memTracker.hpp" +#include "nmt/nmtUsage.hpp" #include "utilities/globalDefinitions.hpp" #include "utilities/ticks.hpp" diff --git a/src/hotspot/share/jfr/periodic/jfrNativeMemoryEvent.hpp b/src/hotspot/share/jfr/periodic/jfrNativeMemoryEvent.hpp index fde4c284ab31a..710198efdddc3 100644 --- a/src/hotspot/share/jfr/periodic/jfrNativeMemoryEvent.hpp +++ b/src/hotspot/share/jfr/periodic/jfrNativeMemoryEvent.hpp @@ -26,7 +26,7 @@ #define SHARE_JFR_PERIODIC_JFRNATIVEMEMORYEVENT_HPP #include "memory/allocation.hpp" -#include "services/nmtUsage.hpp" +#include "nmt/nmtUsage.hpp" #include "utilities/globalDefinitions.hpp" #include "utilities/ticks.hpp" diff --git a/src/hotspot/share/jfr/recorder/checkpoint/jfrCheckpointManager.cpp b/src/hotspot/share/jfr/recorder/checkpoint/jfrCheckpointManager.cpp index 118813ef88e82..eb1258e35a200 100644 --- a/src/hotspot/share/jfr/recorder/checkpoint/jfrCheckpointManager.cpp +++ b/src/hotspot/share/jfr/recorder/checkpoint/jfrCheckpointManager.cpp @@ -109,6 +109,9 @@ bool JfrCheckpointManager::initialize() { // preallocate buffer count to each of the epoch live lists for (size_t i = 0; i < global_buffer_prealloc_count * 2; ++i) { Buffer* const buffer = mspace_allocate(global_buffer_size, _global_mspace); + if (buffer == nullptr) { + return false; + } _global_mspace->add_to_live_list(buffer, i % 2 == 0); } assert(_global_mspace->free_list_is_empty(), "invariant"); diff --git a/src/hotspot/share/jfr/recorder/checkpoint/types/jfrType.cpp b/src/hotspot/share/jfr/recorder/checkpoint/types/jfrType.cpp index 78ef7f5b523c9..5cd9e6b253b1e 100644 --- a/src/hotspot/share/jfr/recorder/checkpoint/types/jfrType.cpp +++ b/src/hotspot/share/jfr/recorder/checkpoint/types/jfrType.cpp @@ -33,18 +33,19 @@ #include "gc/shared/gcWhen.hpp" #include "jfr/leakprofiler/leakProfiler.hpp" #include "jfr/recorder/checkpoint/jfrCheckpointWriter.hpp" -#include "jfr/recorder/checkpoint/types/jfrType.hpp" -#include "jfr/recorder/jfrRecorder.hpp" #include "jfr/recorder/checkpoint/types/jfrThreadGroup.hpp" #include "jfr/recorder/checkpoint/types/jfrThreadState.hpp" +#include "jfr/recorder/checkpoint/types/jfrType.hpp" +#include "jfr/recorder/jfrRecorder.hpp" #include "jfr/support/jfrThreadLocal.hpp" -#include "jfr/writers/jfrJavaEventWriter.hpp" #include "jfr/utilities/jfrThreadIterator.hpp" +#include "jfr/writers/jfrJavaEventWriter.hpp" #include "memory/iterator.hpp" #include "memory/metaspace.hpp" #include "memory/metaspaceUtils.hpp" #include "memory/referenceType.hpp" #include "memory/universe.hpp" +#include "nmt/nmtCommon.hpp" #include "oops/compressedOops.hpp" #include "runtime/flags/jvmFlag.hpp" #include "runtime/javaThread.hpp" @@ -53,7 +54,6 @@ #include "runtime/safepoint.hpp" #include "runtime/synchronizer.hpp" #include "runtime/vmOperations.hpp" -#include "services/nmtCommon.hpp" #ifdef COMPILER2 #include "opto/compile.hpp" #include "opto/node.hpp" diff --git a/src/hotspot/share/jfr/recorder/checkpoint/types/jfrTypeManager.cpp b/src/hotspot/share/jfr/recorder/checkpoint/types/jfrTypeManager.cpp index 6f73fdece3c35..20c1100994722 100644 --- a/src/hotspot/share/jfr/recorder/checkpoint/types/jfrTypeManager.cpp +++ b/src/hotspot/share/jfr/recorder/checkpoint/types/jfrTypeManager.cpp @@ -34,10 +34,10 @@ #include "jfr/utilities/jfrIterator.hpp" #include "jfr/utilities/jfrLinkedList.inline.hpp" #include "memory/resourceArea.hpp" +#include "nmt/memTracker.hpp" #include "runtime/javaThread.hpp" #include "runtime/semaphore.hpp" #include "runtime/thread.inline.hpp" -#include "services/memTracker.hpp" #include "utilities/macros.hpp" class JfrSerializerRegistration : public JfrCHeapObj { diff --git a/src/hotspot/share/jfr/recorder/storage/jfrVirtualMemory.cpp b/src/hotspot/share/jfr/recorder/storage/jfrVirtualMemory.cpp index 254869c03b117..78309f00913cc 100644 --- a/src/hotspot/share/jfr/recorder/storage/jfrVirtualMemory.cpp +++ b/src/hotspot/share/jfr/recorder/storage/jfrVirtualMemory.cpp @@ -25,9 +25,9 @@ #include "precompiled.hpp" #include "jfr/recorder/storage/jfrVirtualMemory.hpp" #include "memory/virtualspace.hpp" +#include "nmt/memTracker.hpp" #include "runtime/globals.hpp" #include "runtime/os.hpp" -#include "services/memTracker.hpp" #include "utilities/globalDefinitions.hpp" /* diff --git a/src/hotspot/share/jfr/recorder/stringpool/jfrStringPool.cpp b/src/hotspot/share/jfr/recorder/stringpool/jfrStringPool.cpp index 47cfca6b89210..217b6dbddc3c4 100644 --- a/src/hotspot/share/jfr/recorder/stringpool/jfrStringPool.cpp +++ b/src/hotspot/share/jfr/recorder/stringpool/jfrStringPool.cpp @@ -131,6 +131,9 @@ bool JfrStringPool::initialize() { // preallocate buffer count to each of the epoch live lists for (size_t i = 0; i < string_pool_cache_count * 2; ++i) { Buffer* const buffer = mspace_allocate(string_pool_buffer_size, _mspace); + if (buffer == nullptr) { + return false; + } _mspace->add_to_live_list(buffer, i % 2 == 0); } assert(_mspace->free_list_is_empty(), "invariant"); diff --git a/src/hotspot/share/jfr/utilities/jfrAllocation.cpp b/src/hotspot/share/jfr/utilities/jfrAllocation.cpp index a9d164c40b030..e9e41ac7cd875 100644 --- a/src/hotspot/share/jfr/utilities/jfrAllocation.cpp +++ b/src/hotspot/share/jfr/utilities/jfrAllocation.cpp @@ -27,9 +27,9 @@ #include "jfr/utilities/jfrAllocation.hpp" #include "logging/log.hpp" #include "memory/allocation.inline.hpp" +#include "nmt/memTracker.hpp" #include "runtime/atomic.hpp" #include "runtime/vm_version.hpp" -#include "services/memTracker.hpp" #include "utilities/debug.hpp" #include "utilities/macros.hpp" #include "utilities/nativeCallStack.hpp" diff --git a/src/hotspot/share/jfr/utilities/jfrHashtable.hpp b/src/hotspot/share/jfr/utilities/jfrHashtable.hpp index 54ba3eef04423..530f19ac2c684 100644 --- a/src/hotspot/share/jfr/utilities/jfrHashtable.hpp +++ b/src/hotspot/share/jfr/utilities/jfrHashtable.hpp @@ -26,8 +26,8 @@ #define SHARE_JFR_UTILITIES_JFRHASHTABLE_HPP #include "jfr/utilities/jfrAllocation.hpp" +#include "nmt/memTracker.hpp" #include "runtime/atomic.hpp" -#include "services/memTracker.hpp" #include "utilities/debug.hpp" #include "utilities/macros.hpp" diff --git a/src/hotspot/share/jfr/writers/jfrJavaEventWriter.cpp b/src/hotspot/share/jfr/writers/jfrJavaEventWriter.cpp index 5ff319782b265..9b27f06df7a12 100644 --- a/src/hotspot/share/jfr/writers/jfrJavaEventWriter.cpp +++ b/src/hotspot/share/jfr/writers/jfrJavaEventWriter.cpp @@ -260,7 +260,6 @@ jobject JfrJavaEventWriter::new_event_writer(TRAPS) { DEBUG_ONLY(JfrJavaSupport::check_java_thread_in_vm(THREAD)); assert(event_writer(THREAD) == nullptr, "invariant"); JfrThreadLocal* const tl = THREAD->jfr_thread_local(); - assert(!tl->has_java_buffer(), "invariant"); JfrBuffer* const buffer = tl->java_buffer(); if (buffer == nullptr) { JfrJavaSupport::throw_out_of_memory_error("OOME for thread local buffer", THREAD); diff --git a/src/hotspot/share/jvmci/jvmciEnv.cpp b/src/hotspot/share/jvmci/jvmciEnv.cpp index bab3de8c3355d..24af7715a5b1e 100644 --- a/src/hotspot/share/jvmci/jvmciEnv.cpp +++ b/src/hotspot/share/jvmci/jvmciEnv.cpp @@ -147,13 +147,14 @@ void JVMCIEnv::init_env_mode_runtime(JavaThread* thread, JNIEnv* parent_env) { _is_hotspot = false; _runtime = JVMCI::compiler_runtime(thread); - _env = _runtime->init_shared_library_javavm(&_init_error); + _env = _runtime->init_shared_library_javavm(&_init_error, &_init_error_msg); if (_env != nullptr) { // Creating the JVMCI shared library VM also attaches the current thread _detach_on_close = true; } else if (_init_error != JNI_OK) { // Caller creating this JVMCIEnv must handle the error. - JVMCI_event_1("[%s:%d] Error creating libjvmci (err: %d)", _file, _line, _init_error); + JVMCI_event_1("[%s:%d] Error creating libjvmci (err: %d, %s)", _file, _line, + _init_error, _init_error_msg == nullptr ? "unknown" : _init_error_msg); return; } else { _runtime->GetEnv(thread, (void**)&parent_env, JNI_VERSION_1_2); @@ -195,17 +196,17 @@ void JVMCIEnv::init_env_mode_runtime(JavaThread* thread, JNIEnv* parent_env) { } JVMCIEnv::JVMCIEnv(JavaThread* thread, JVMCICompileState* compile_state, const char* file, int line): - _throw_to_caller(false), _file(file), _line(line), _init_error(JNI_OK), _compile_state(compile_state) { + _throw_to_caller(false), _file(file), _line(line), _init_error(JNI_OK), _init_error_msg(nullptr), _compile_state(compile_state) { init_env_mode_runtime(thread, nullptr); } JVMCIEnv::JVMCIEnv(JavaThread* thread, const char* file, int line): - _throw_to_caller(false), _file(file), _line(line), _init_error(JNI_OK), _compile_state(nullptr) { + _throw_to_caller(false), _file(file), _line(line), _init_error(JNI_OK), _init_error_msg(nullptr), _compile_state(nullptr) { init_env_mode_runtime(thread, nullptr); } JVMCIEnv::JVMCIEnv(JavaThread* thread, JNIEnv* parent_env, const char* file, int line): - _throw_to_caller(true), _file(file), _line(line), _init_error(JNI_OK), _compile_state(nullptr) { + _throw_to_caller(true), _file(file), _line(line), _init_error(JNI_OK), _init_error_msg(nullptr), _compile_state(nullptr) { assert(parent_env != nullptr, "npe"); init_env_mode_runtime(thread, parent_env); assert(_env == nullptr || parent_env == _env, "mismatched JNIEnvironment"); @@ -218,6 +219,7 @@ void JVMCIEnv::init(JavaThread* thread, bool is_hotspot, const char* file, int l _file = file; _line = line; _init_error = JNI_OK; + _init_error_msg = nullptr; if (is_hotspot) { _env = nullptr; _pop_frame_on_close = false; @@ -237,7 +239,8 @@ void JVMCIEnv::check_init(JVMCI_TRAPS) { if (_init_error == JNI_ENOMEM) { JVMCI_THROW_MSG(OutOfMemoryError, "JNI_ENOMEM creating or attaching to libjvmci"); } - JVMCI_THROW_MSG(InternalError, err_msg("Error creating or attaching to libjvmci (err: %d)", _init_error)); + JVMCI_THROW_MSG(InternalError, err_msg("Error creating or attaching to libjvmci (err: %d, description: %s)", + _init_error, _init_error_msg == nullptr ? "unknown" : _init_error_msg)); } void JVMCIEnv::check_init(TRAPS) { @@ -247,7 +250,8 @@ void JVMCIEnv::check_init(TRAPS) { if (_init_error == JNI_ENOMEM) { THROW_MSG(vmSymbols::java_lang_OutOfMemoryError(), "JNI_ENOMEM creating or attaching to libjvmci"); } - THROW_MSG(vmSymbols::java_lang_OutOfMemoryError(), err_msg("Error creating or attaching to libjvmci (err: %d)", _init_error)); + THROW_MSG(vmSymbols::java_lang_OutOfMemoryError(), err_msg("Error creating or attaching to libjvmci (err: %d, description: %s)", + _init_error, _init_error_msg == nullptr ? "unknown" : _init_error_msg)); } // Prints a pending exception (if any) and its stack trace to st. @@ -572,6 +576,9 @@ jboolean JVMCIEnv::transfer_pending_exception(JavaThread* THREAD, JVMCIEnv* peer } JVMCIEnv::~JVMCIEnv() { + if (_init_error_msg != nullptr) { + os::free((void*) _init_error_msg); + } if (_init_error != JNI_OK) { return; } diff --git a/src/hotspot/share/jvmci/jvmciEnv.hpp b/src/hotspot/share/jvmci/jvmciEnv.hpp index 59600b97fe15a..ace0cc53352c3 100644 --- a/src/hotspot/share/jvmci/jvmciEnv.hpp +++ b/src/hotspot/share/jvmci/jvmciEnv.hpp @@ -172,6 +172,7 @@ class JVMCIEnv : public ResourceObj { int _init_error; // JNI code returned when creating or attaching to a libjvmci isolate. // If not JNI_OK, the JVMCIEnv is invalid and should not be used apart from // calling init_error(). + const char* _init_error_msg; // Message for _init_error if available. C heap allocated. // Translates an exception on the HotSpot heap (i.e., hotspot_env) to an exception on // the shared library heap (i.e., jni_env). The translation includes the stack and cause(s) of `throwable`. @@ -217,6 +218,12 @@ class JVMCIEnv : public ResourceObj { return _init_error; } + // Gets a message describing a non-zero init_error(). + // Valid as long as this JVMCIEnv is valid. + const char* init_error_msg() { + return _init_error_msg; + } + // Checks the value of init_error() and throws an exception in `JVMCI_TRAPS` // (which must not be this) if it is not JNI_OK. void check_init(JVMCI_TRAPS); diff --git a/src/hotspot/share/jvmci/jvmciRuntime.cpp b/src/hotspot/share/jvmci/jvmciRuntime.cpp index 68177fa8acd0f..226c4f5dea199 100644 --- a/src/hotspot/share/jvmci/jvmciRuntime.cpp +++ b/src/hotspot/share/jvmci/jvmciRuntime.cpp @@ -1253,7 +1253,7 @@ bool JVMCIRuntime::detach_thread(JavaThread* thread, const char* reason, bool ca return destroyed_javavm; } -JNIEnv* JVMCIRuntime::init_shared_library_javavm(int* create_JavaVM_err) { +JNIEnv* JVMCIRuntime::init_shared_library_javavm(int* create_JavaVM_err, const char** err_msg) { MutexLocker locker(_lock); JavaVM* javaVM = _shared_library_javavm; if (javaVM == nullptr) { @@ -1280,7 +1280,7 @@ JNIEnv* JVMCIRuntime::init_shared_library_javavm(int* create_JavaVM_err) { JavaVMInitArgs vm_args; vm_args.version = JNI_VERSION_1_2; vm_args.ignoreUnrecognized = JNI_TRUE; - JavaVMOption options[5]; + JavaVMOption options[6]; jlong javaVM_id = 0; // Protocol: JVMCI shared library JavaVM should support a non-standard "_javavm_id" @@ -1297,6 +1297,8 @@ JNIEnv* JVMCIRuntime::init_shared_library_javavm(int* create_JavaVM_err) { options[3].extraInfo = (void*) _fatal; options[4].optionString = (char*) "_fatal_log"; options[4].extraInfo = (void*) _fatal_log; + options[5].optionString = (char*) "_createvm_errorstr"; + options[5].extraInfo = (void*) err_msg; vm_args.version = JNI_VERSION_1_2; vm_args.options = options; diff --git a/src/hotspot/share/jvmci/jvmciRuntime.hpp b/src/hotspot/share/jvmci/jvmciRuntime.hpp index a3f464cd724c1..d3898be4ce0ae 100644 --- a/src/hotspot/share/jvmci/jvmciRuntime.hpp +++ b/src/hotspot/share/jvmci/jvmciRuntime.hpp @@ -280,8 +280,10 @@ class JVMCIRuntime: public CHeapObj { // If the JavaVM was created by this call, then the thread-local JNI // interface pointer for the JavaVM is returned otherwise null is returned. // If this method tried to create the JavaVM but failed, the error code returned - // by JNI_CreateJavaVM is returned in create_JavaVM_err. - JNIEnv* init_shared_library_javavm(int* create_JavaVM_err); + // by JNI_CreateJavaVM is returned in create_JavaVM_err and, if available, an + // error message is malloc'ed and assigned to err_msg. The caller is responsible + // for freeing err_msg. + JNIEnv* init_shared_library_javavm(int* create_JavaVM_err, const char** err_msg); // Determines if the JVMCI shared library JavaVM exists for this runtime. bool has_shared_library_javavm() { return _shared_library_javavm != nullptr; } diff --git a/src/hotspot/share/memory/allocation.cpp b/src/hotspot/share/memory/allocation.cpp index 64b00a1369427..57dc88620c089 100644 --- a/src/hotspot/share/memory/allocation.cpp +++ b/src/hotspot/share/memory/allocation.cpp @@ -28,10 +28,10 @@ #include "memory/arena.hpp" #include "memory/metaspace.hpp" #include "memory/resourceArea.hpp" +#include "nmt/memTracker.hpp" #include "runtime/os.hpp" #include "runtime/task.hpp" #include "runtime/threadCritical.hpp" -#include "services/memTracker.hpp" #include "utilities/ostream.hpp" // allocate using malloc; will fail if no memory available diff --git a/src/hotspot/share/memory/arena.cpp b/src/hotspot/share/memory/arena.cpp index f767255116c07..44f1648921f6f 100644 --- a/src/hotspot/share/memory/arena.cpp +++ b/src/hotspot/share/memory/arena.cpp @@ -29,11 +29,11 @@ #include "memory/allocation.inline.hpp" #include "memory/arena.hpp" #include "memory/resourceArea.hpp" +#include "nmt/memTracker.inline.hpp" #include "runtime/os.hpp" #include "runtime/task.hpp" #include "runtime/threadCritical.hpp" #include "runtime/trimNativeHeap.hpp" -#include "services/memTracker.inline.hpp" #include "utilities/align.hpp" #include "utilities/debug.hpp" #include "utilities/ostream.hpp" diff --git a/src/hotspot/share/memory/heap.cpp b/src/hotspot/share/memory/heap.cpp index 3f584ccd1f1b7..98e59f5818432 100644 --- a/src/hotspot/share/memory/heap.cpp +++ b/src/hotspot/share/memory/heap.cpp @@ -24,10 +24,10 @@ #include "precompiled.hpp" #include "memory/heap.hpp" +#include "nmt/memTracker.hpp" #include "oops/oop.inline.hpp" -#include "runtime/os.hpp" #include "runtime/mutexLocker.hpp" -#include "services/memTracker.hpp" +#include "runtime/os.hpp" #include "utilities/align.hpp" #include "utilities/checkedCast.hpp" #include "utilities/powerOfTwo.hpp" diff --git a/src/hotspot/share/memory/heapInspection.cpp b/src/hotspot/share/memory/heapInspection.cpp index 820814f755cac..262dc62d977de 100644 --- a/src/hotspot/share/memory/heapInspection.cpp +++ b/src/hotspot/share/memory/heapInspection.cpp @@ -33,10 +33,10 @@ #include "memory/heapInspection.hpp" #include "memory/resourceArea.hpp" #include "memory/universe.hpp" +#include "nmt/memTracker.hpp" #include "oops/oop.inline.hpp" #include "runtime/atomic.hpp" #include "runtime/os.hpp" -#include "services/memTracker.hpp" #include "utilities/globalDefinitions.hpp" #include "utilities/macros.hpp" #include "utilities/stack.inline.hpp" diff --git a/src/hotspot/share/memory/metaspace.cpp b/src/hotspot/share/memory/metaspace.cpp index b0d47dcce0d16..de36cd8c7a860 100644 --- a/src/hotspot/share/memory/metaspace.cpp +++ b/src/hotspot/share/memory/metaspace.cpp @@ -31,7 +31,6 @@ #include "logging/logStream.hpp" #include "memory/classLoaderMetaspace.hpp" #include "memory/metaspace.hpp" -#include "memory/metaspaceCriticalAllocation.hpp" #include "memory/metaspace/chunkHeaderPool.hpp" #include "memory/metaspace/chunkManager.hpp" #include "memory/metaspace/commitLimiter.hpp" @@ -42,11 +41,13 @@ #include "memory/metaspace/metaspaceSettings.hpp" #include "memory/metaspace/runningCounters.hpp" #include "memory/metaspace/virtualSpaceList.hpp" -#include "memory/metaspaceTracer.hpp" +#include "memory/metaspaceCriticalAllocation.hpp" #include "memory/metaspaceStats.hpp" +#include "memory/metaspaceTracer.hpp" #include "memory/metaspaceUtils.hpp" #include "memory/resourceArea.hpp" #include "memory/universe.hpp" +#include "nmt/memTracker.hpp" #include "oops/compressedKlass.inline.hpp" #include "oops/compressedOops.hpp" #include "prims/jvmtiExport.hpp" @@ -54,7 +55,6 @@ #include "runtime/globals_extension.hpp" #include "runtime/init.hpp" #include "runtime/java.hpp" -#include "services/memTracker.hpp" #include "utilities/copy.hpp" #include "utilities/debug.hpp" #include "utilities/formatBuffer.hpp" diff --git a/src/hotspot/share/memory/metaspace/metaspaceDCmd.cpp b/src/hotspot/share/memory/metaspace/metaspaceDCmd.cpp index db6d36314507b..32fee96ad7d09 100644 --- a/src/hotspot/share/memory/metaspace/metaspaceDCmd.cpp +++ b/src/hotspot/share/memory/metaspace/metaspaceDCmd.cpp @@ -29,9 +29,9 @@ #include "memory/metaspace/metaspaceReporter.hpp" #include "memory/metaspaceUtils.hpp" #include "memory/resourceArea.hpp" +#include "nmt/nmtCommon.hpp" #include "runtime/vmOperations.hpp" #include "services/diagnosticCommand.hpp" -#include "services/nmtCommon.hpp" namespace metaspace { diff --git a/src/hotspot/share/memory/metaspace/virtualSpaceNode.cpp b/src/hotspot/share/memory/metaspace/virtualSpaceNode.cpp index 1ebda015eb3c8..dc5f7a6cdf110 100644 --- a/src/hotspot/share/memory/metaspace/virtualSpaceNode.cpp +++ b/src/hotspot/share/memory/metaspace/virtualSpaceNode.cpp @@ -39,12 +39,12 @@ #include "memory/metaspace/rootChunkArea.hpp" #include "memory/metaspace/runningCounters.hpp" #include "memory/metaspace/virtualSpaceNode.hpp" +#include "nmt/memTracker.hpp" #include "runtime/globals.hpp" #include "runtime/mutexLocker.hpp" #include "runtime/os.hpp" #include "sanitizers/address.hpp" #include "sanitizers/leak.hpp" -#include "services/memTracker.hpp" #include "utilities/align.hpp" #include "utilities/debug.hpp" #include "utilities/globalDefinitions.hpp" diff --git a/src/hotspot/share/memory/resourceArea.cpp b/src/hotspot/share/memory/resourceArea.cpp index bc01a7baaaa29..f281274d98a3d 100644 --- a/src/hotspot/share/memory/resourceArea.cpp +++ b/src/hotspot/share/memory/resourceArea.cpp @@ -25,9 +25,9 @@ #include "precompiled.hpp" #include "memory/allocation.inline.hpp" #include "memory/resourceArea.inline.hpp" +#include "nmt/memTracker.hpp" #include "runtime/atomic.hpp" #include "runtime/javaThread.hpp" -#include "services/memTracker.hpp" #include "utilities/vmError.hpp" void ResourceArea::bias_to(MEMFLAGS new_flags) { diff --git a/src/hotspot/share/memory/resourceArea.inline.hpp b/src/hotspot/share/memory/resourceArea.inline.hpp index 0cd7b8a28b956..d3e8364773ac4 100644 --- a/src/hotspot/share/memory/resourceArea.inline.hpp +++ b/src/hotspot/share/memory/resourceArea.inline.hpp @@ -26,8 +26,7 @@ #define SHARE_MEMORY_RESOURCEAREA_INLINE_HPP #include "memory/resourceArea.hpp" - -#include "services/memTracker.hpp" +#include "nmt/memTracker.hpp" inline char* ResourceArea::allocate_bytes(size_t size, AllocFailType alloc_failmode) { #ifdef ASSERT diff --git a/src/hotspot/share/memory/virtualspace.cpp b/src/hotspot/share/memory/virtualspace.cpp index 1a99b9674364c..fd73cbb3362b3 100644 --- a/src/hotspot/share/memory/virtualspace.cpp +++ b/src/hotspot/share/memory/virtualspace.cpp @@ -26,6 +26,7 @@ #include "logging/log.hpp" #include "memory/resourceArea.hpp" #include "memory/virtualspace.hpp" +#include "nmt/memTracker.hpp" #include "oops/compressedKlass.hpp" #include "oops/compressedOops.hpp" #include "oops/markWord.hpp" @@ -33,7 +34,6 @@ #include "runtime/globals_extension.hpp" #include "runtime/java.hpp" #include "runtime/os.hpp" -#include "services/memTracker.hpp" #include "utilities/align.hpp" #include "utilities/formatBuffer.hpp" #include "utilities/powerOfTwo.hpp" diff --git a/src/hotspot/share/services/allocationSite.hpp b/src/hotspot/share/nmt/allocationSite.hpp similarity index 93% rename from src/hotspot/share/services/allocationSite.hpp rename to src/hotspot/share/nmt/allocationSite.hpp index 41ff262950936..5093bb39f0c6a 100644 --- a/src/hotspot/share/services/allocationSite.hpp +++ b/src/hotspot/share/nmt/allocationSite.hpp @@ -22,8 +22,8 @@ * */ -#ifndef SHARE_SERVICES_ALLOCATIONSITE_HPP -#define SHARE_SERVICES_ALLOCATIONSITE_HPP +#ifndef SHARE_NMT_ALLOCATIONSITE_HPP +#define SHARE_NMT_ALLOCATIONSITE_HPP #include "memory/allocation.hpp" #include "utilities/nativeCallStack.hpp" @@ -52,4 +52,4 @@ class AllocationSite { MEMFLAGS flag() const { return _flag; } }; -#endif // SHARE_SERVICES_ALLOCATIONSITE_HPP +#endif // SHARE_NMT_ALLOCATIONSITE_HPP diff --git a/src/hotspot/share/services/mallocHeader.cpp b/src/hotspot/share/nmt/mallocHeader.cpp similarity index 96% rename from src/hotspot/share/services/mallocHeader.cpp rename to src/hotspot/share/nmt/mallocHeader.cpp index 55f8169851ae0..57d1c4a313ab9 100644 --- a/src/hotspot/share/services/mallocHeader.cpp +++ b/src/hotspot/share/nmt/mallocHeader.cpp @@ -24,15 +24,13 @@ */ #include "precompiled.hpp" -#include "services/mallocHeader.inline.hpp" - +#include "nmt/mallocHeader.inline.hpp" +#include "nmt/mallocSiteTable.hpp" #include "runtime/os.hpp" -#include "services/mallocSiteTable.hpp" #include "utilities/globalDefinitions.hpp" #include "utilities/nativeCallStack.hpp" #include "utilities/ostream.hpp" - void MallocHeader::print_block_on_error(outputStream* st, address bad_address) const { assert(bad_address >= (address)this, "sanity"); diff --git a/src/hotspot/share/services/mallocHeader.hpp b/src/hotspot/share/nmt/mallocHeader.hpp similarity index 98% rename from src/hotspot/share/services/mallocHeader.hpp rename to src/hotspot/share/nmt/mallocHeader.hpp index 9a2ba3ff053c6..c0fae5803cec4 100644 --- a/src/hotspot/share/services/mallocHeader.hpp +++ b/src/hotspot/share/nmt/mallocHeader.hpp @@ -23,8 +23,8 @@ * */ -#ifndef SHARE_SERVICES_MALLOCHEADER_HPP -#define SHARE_SERVICES_MALLOCHEADER_HPP +#ifndef SHARE_NMT_MALLOCHEADER_HPP +#define SHARE_NMT_MALLOCHEADER_HPP #include "memory/allocation.hpp" #include "utilities/globalDefinitions.hpp" @@ -165,4 +165,4 @@ class MallocHeader { STATIC_ASSERT(sizeof(MallocHeader) == (sizeof(uint64_t) * 2)); -#endif // SHARE_SERVICES_MALLOCHEADER_HPP +#endif // SHARE_NMT_MALLOCHEADER_HPP diff --git a/src/hotspot/share/services/mallocHeader.inline.hpp b/src/hotspot/share/nmt/mallocHeader.inline.hpp similarity index 97% rename from src/hotspot/share/services/mallocHeader.inline.hpp rename to src/hotspot/share/nmt/mallocHeader.inline.hpp index 669438c85fa4e..d763241b36d8c 100644 --- a/src/hotspot/share/services/mallocHeader.inline.hpp +++ b/src/hotspot/share/nmt/mallocHeader.inline.hpp @@ -23,10 +23,10 @@ * */ -#ifndef SHARE_SERVICES_MALLOCHEADER_INLINE_HPP -#define SHARE_SERVICES_MALLOCHEADER_INLINE_HPP +#ifndef SHARE_NMT_MALLOCHEADER_INLINE_HPP +#define SHARE_NMT_MALLOCHEADER_INLINE_HPP -#include "services/mallocHeader.hpp" +#include "nmt/mallocHeader.hpp" #include "jvm_io.h" #include "utilities/debug.hpp" @@ -163,4 +163,4 @@ inline bool MallocHeader::check_block_integrity(char* msg, size_t msglen, addres return true; } -#endif // SHARE_SERVICES_MALLOCHEADER_INLINE_HPP +#endif // SHARE_NMT_MALLOCHEADER_INLINE_HPP diff --git a/src/hotspot/share/services/mallocSiteTable.cpp b/src/hotspot/share/nmt/mallocSiteTable.cpp similarity index 99% rename from src/hotspot/share/services/mallocSiteTable.cpp rename to src/hotspot/share/nmt/mallocSiteTable.cpp index 2780e86d8924e..0fdf9e0f83dcc 100644 --- a/src/hotspot/share/services/mallocSiteTable.cpp +++ b/src/hotspot/share/nmt/mallocSiteTable.cpp @@ -23,10 +23,9 @@ */ #include "precompiled.hpp" - #include "memory/allocation.inline.hpp" +#include "nmt/mallocSiteTable.hpp" #include "runtime/atomic.hpp" -#include "services/mallocSiteTable.hpp" // Malloc site hashtable buckets MallocSiteHashtableEntry** MallocSiteTable::_table = nullptr; diff --git a/src/hotspot/share/services/mallocSiteTable.hpp b/src/hotspot/share/nmt/mallocSiteTable.hpp similarity index 96% rename from src/hotspot/share/services/mallocSiteTable.hpp rename to src/hotspot/share/nmt/mallocSiteTable.hpp index 2b602527e9875..47fe82b590a9f 100644 --- a/src/hotspot/share/services/mallocSiteTable.hpp +++ b/src/hotspot/share/nmt/mallocSiteTable.hpp @@ -22,14 +22,14 @@ * */ -#ifndef SHARE_SERVICES_MALLOCSITETABLE_HPP -#define SHARE_SERVICES_MALLOCSITETABLE_HPP +#ifndef SHARE_NMT_MALLOCSITETABLE_HPP +#define SHARE_NMT_MALLOCSITETABLE_HPP #include "memory/allocation.hpp" +#include "nmt/allocationSite.hpp" +#include "nmt/mallocTracker.hpp" +#include "nmt/nmtCommon.hpp" #include "runtime/atomic.hpp" -#include "services/allocationSite.hpp" -#include "services/mallocTracker.hpp" -#include "services/nmtCommon.hpp" #include "utilities/macros.hpp" #include "utilities/nativeCallStack.hpp" @@ -198,4 +198,4 @@ class MallocSiteTable : AllStatic { static const MallocSiteHashtableEntry* _hash_entry_allocation_site; }; -#endif // SHARE_SERVICES_MALLOCSITETABLE_HPP +#endif // SHARE_NMT_MALLOCSITETABLE_HPP diff --git a/src/hotspot/share/services/mallocTracker.cpp b/src/hotspot/share/nmt/mallocTracker.cpp similarity index 98% rename from src/hotspot/share/services/mallocTracker.cpp rename to src/hotspot/share/nmt/mallocTracker.cpp index 0793ca6f4e9a8..5c02226654c57 100644 --- a/src/hotspot/share/services/mallocTracker.cpp +++ b/src/hotspot/share/nmt/mallocTracker.cpp @@ -29,16 +29,16 @@ #include "jvm_io.h" #include "logging/log.hpp" #include "logging/logStream.hpp" +#include "nmt/mallocHeader.inline.hpp" +#include "nmt/mallocSiteTable.hpp" +#include "nmt/mallocTracker.hpp" +#include "nmt/memTracker.hpp" #include "runtime/arguments.hpp" #include "runtime/atomic.hpp" #include "runtime/globals.hpp" #include "runtime/os.hpp" #include "runtime/safefetch.hpp" -#include "services/mallocHeader.inline.hpp" #include "services/mallocLimit.hpp" -#include "services/mallocSiteTable.hpp" -#include "services/mallocTracker.hpp" -#include "services/memTracker.hpp" #include "utilities/debug.hpp" #include "utilities/ostream.hpp" #include "utilities/vmError.hpp" diff --git a/src/hotspot/share/services/mallocTracker.hpp b/src/hotspot/share/nmt/mallocTracker.hpp similarity index 98% rename from src/hotspot/share/services/mallocTracker.hpp rename to src/hotspot/share/nmt/mallocTracker.hpp index cf9a623c0bd92..ae56d31d786d1 100644 --- a/src/hotspot/share/services/mallocTracker.hpp +++ b/src/hotspot/share/nmt/mallocTracker.hpp @@ -23,14 +23,14 @@ * */ -#ifndef SHARE_SERVICES_MALLOCTRACKER_HPP -#define SHARE_SERVICES_MALLOCTRACKER_HPP +#ifndef SHARE_NMT_MALLOCTRACKER_HPP +#define SHARE_NMT_MALLOCTRACKER_HPP #include "memory/allocation.hpp" +#include "nmt/mallocHeader.hpp" +#include "nmt/nmtCommon.hpp" #include "runtime/atomic.hpp" #include "runtime/threadCritical.hpp" -#include "services/mallocHeader.hpp" -#include "services/nmtCommon.hpp" #include "utilities/nativeCallStack.hpp" class outputStream; @@ -315,4 +315,4 @@ class MallocTracker : AllStatic { } }; -#endif // SHARE_SERVICES_MALLOCTRACKER_HPP +#endif // SHARE_NMT_MALLOCTRACKER_HPP diff --git a/src/hotspot/share/services/mallocTracker.inline.hpp b/src/hotspot/share/nmt/mallocTracker.inline.hpp similarity index 93% rename from src/hotspot/share/services/mallocTracker.inline.hpp rename to src/hotspot/share/nmt/mallocTracker.inline.hpp index 75eaf7c1054ee..f226d56bc3d22 100644 --- a/src/hotspot/share/services/mallocTracker.inline.hpp +++ b/src/hotspot/share/nmt/mallocTracker.inline.hpp @@ -23,11 +23,11 @@ * */ -#ifndef SHARE_SERVICES_MALLOCTRACKER_INLINE_HPP -#define SHARE_SERVICES_MALLOCTRACKER_INLINE_HPP +#ifndef SHARE_NMT_MALLOCTRACKER_INLINE_HPP +#define SHARE_NMT_MALLOCTRACKER_INLINE_HPP +#include "nmt/mallocTracker.hpp" #include "services/mallocLimit.hpp" -#include "services/mallocTracker.hpp" #include "utilities/debug.hpp" #include "utilities/globalDefinitions.hpp" @@ -69,4 +69,4 @@ inline bool MallocTracker::check_exceeds_limit(size_t s, MEMFLAGS f) { } -#endif // SHARE_SERVICES_MALLOCTRACKER_INLINE_HPP +#endif // SHARE_NMT_MALLOCTRACKER_INLINE_HPP diff --git a/src/hotspot/share/services/memBaseline.cpp b/src/hotspot/share/nmt/memBaseline.cpp similarity index 99% rename from src/hotspot/share/services/memBaseline.cpp rename to src/hotspot/share/nmt/memBaseline.cpp index df9c4d85aa84a..637acc5245811 100644 --- a/src/hotspot/share/services/memBaseline.cpp +++ b/src/hotspot/share/nmt/memBaseline.cpp @@ -26,10 +26,10 @@ #include "classfile/classLoaderDataGraph.inline.hpp" #include "memory/allocation.hpp" #include "memory/metaspaceUtils.hpp" +#include "nmt/memBaseline.hpp" +#include "nmt/memTracker.hpp" #include "runtime/javaThread.hpp" #include "runtime/safepoint.hpp" -#include "services/memBaseline.hpp" -#include "services/memTracker.hpp" /* * Sizes are sorted in descenting order for reporting diff --git a/src/hotspot/share/services/memBaseline.hpp b/src/hotspot/share/nmt/memBaseline.hpp similarity index 96% rename from src/hotspot/share/services/memBaseline.hpp rename to src/hotspot/share/nmt/memBaseline.hpp index fa44a45470461..903f558051103 100644 --- a/src/hotspot/share/services/memBaseline.hpp +++ b/src/hotspot/share/nmt/memBaseline.hpp @@ -22,15 +22,15 @@ * */ -#ifndef SHARE_SERVICES_MEMBASELINE_HPP -#define SHARE_SERVICES_MEMBASELINE_HPP +#ifndef SHARE_NMT_MEMBASELINE_HPP +#define SHARE_NMT_MEMBASELINE_HPP #include "memory/metaspaceStats.hpp" +#include "nmt/mallocSiteTable.hpp" +#include "nmt/mallocTracker.hpp" +#include "nmt/nmtCommon.hpp" +#include "nmt/virtualMemoryTracker.hpp" #include "runtime/mutex.hpp" -#include "services/mallocSiteTable.hpp" -#include "services/mallocTracker.hpp" -#include "services/nmtCommon.hpp" -#include "services/virtualMemoryTracker.hpp" #include "utilities/linkedlist.hpp" typedef LinkedListIterator MallocSiteIterator; @@ -212,4 +212,4 @@ class MemBaseline { void virtual_memory_sites_to_reservation_site_order(); }; -#endif // SHARE_SERVICES_MEMBASELINE_HPP +#endif // SHARE_NMT_MEMBASELINE_HPP diff --git a/src/hotspot/share/services/memReporter.cpp b/src/hotspot/share/nmt/memReporter.cpp similarity index 99% rename from src/hotspot/share/services/memReporter.cpp rename to src/hotspot/share/nmt/memReporter.cpp index 235ce96dba7fe..48470478b9bb8 100644 --- a/src/hotspot/share/services/memReporter.cpp +++ b/src/hotspot/share/nmt/memReporter.cpp @@ -26,10 +26,10 @@ #include "memory/allocation.hpp" #include "memory/metaspace.hpp" #include "memory/metaspaceUtils.hpp" -#include "services/mallocTracker.hpp" -#include "services/memReporter.hpp" -#include "services/threadStackTracker.hpp" -#include "services/virtualMemoryTracker.hpp" +#include "nmt/mallocTracker.hpp" +#include "nmt/memReporter.hpp" +#include "nmt/threadStackTracker.hpp" +#include "nmt/virtualMemoryTracker.hpp" #include "utilities/globalDefinitions.hpp" // Diff two counters, express them as signed, with range checks diff --git a/src/hotspot/share/services/memReporter.hpp b/src/hotspot/share/nmt/memReporter.hpp similarity index 97% rename from src/hotspot/share/services/memReporter.hpp rename to src/hotspot/share/nmt/memReporter.hpp index b9e31d4bc4bee..875f5b1d45334 100644 --- a/src/hotspot/share/services/memReporter.hpp +++ b/src/hotspot/share/nmt/memReporter.hpp @@ -22,15 +22,15 @@ * */ -#ifndef SHARE_SERVICES_MEMREPORTER_HPP -#define SHARE_SERVICES_MEMREPORTER_HPP +#ifndef SHARE_NMT_MEMREPORTER_HPP +#define SHARE_NMT_MEMREPORTER_HPP #include "memory/metaspace.hpp" +#include "nmt/mallocTracker.hpp" +#include "nmt/memBaseline.hpp" +#include "nmt/nmtCommon.hpp" +#include "nmt/virtualMemoryTracker.hpp" #include "oops/instanceKlass.hpp" -#include "services/memBaseline.hpp" -#include "services/nmtCommon.hpp" -#include "services/mallocTracker.hpp" -#include "services/virtualMemoryTracker.hpp" /* * Base class that provides helpers @@ -265,4 +265,4 @@ class MemDetailDiffReporter : public MemSummaryDiffReporter { size_t current_committed, size_t early_reserved, size_t early_committed, MEMFLAGS flag) const; }; -#endif // SHARE_SERVICES_MEMREPORTER_HPP +#endif // SHARE_NMT_MEMREPORTER_HPP diff --git a/src/hotspot/share/services/memTracker.cpp b/src/hotspot/share/nmt/memTracker.cpp similarity index 95% rename from src/hotspot/share/services/memTracker.cpp rename to src/hotspot/share/nmt/memTracker.cpp index fa2f78abc43f0..192be9ecc1dd3 100644 --- a/src/hotspot/share/services/memTracker.cpp +++ b/src/hotspot/share/nmt/memTracker.cpp @@ -27,19 +27,19 @@ #include "logging/log.hpp" #include "logging/logStream.hpp" #include "memory/metaspaceUtils.hpp" +#include "nmt/mallocTracker.hpp" +#include "nmt/memBaseline.hpp" +#include "nmt/memReporter.hpp" +#include "nmt/memTracker.hpp" +#include "nmt/nmtCommon.hpp" +#include "nmt/nmtPreInit.hpp" +#include "nmt/threadStackTracker.hpp" #include "runtime/atomic.hpp" #include "runtime/globals.hpp" #include "runtime/orderAccess.hpp" -#include "runtime/vmThread.hpp" #include "runtime/vmOperations.hpp" -#include "services/memBaseline.hpp" -#include "services/memReporter.hpp" +#include "runtime/vmThread.hpp" #include "services/mallocLimit.hpp" -#include "services/mallocTracker.hpp" -#include "services/memTracker.hpp" -#include "services/nmtCommon.hpp" -#include "services/nmtPreInit.hpp" -#include "services/threadStackTracker.hpp" #include "utilities/debug.hpp" #include "utilities/defaultStream.hpp" #include "utilities/vmError.hpp" diff --git a/src/hotspot/share/services/memTracker.hpp b/src/hotspot/share/nmt/memTracker.hpp similarity index 96% rename from src/hotspot/share/services/memTracker.hpp rename to src/hotspot/share/nmt/memTracker.hpp index fb687c202b028..a863c45a65854 100644 --- a/src/hotspot/share/services/memTracker.hpp +++ b/src/hotspot/share/nmt/memTracker.hpp @@ -22,15 +22,15 @@ * */ -#ifndef SHARE_SERVICES_MEMTRACKER_HPP -#define SHARE_SERVICES_MEMTRACKER_HPP +#ifndef SHARE_NMT_MEMTRACKER_HPP +#define SHARE_NMT_MEMTRACKER_HPP +#include "nmt/mallocTracker.hpp" +#include "nmt/nmtCommon.hpp" +#include "nmt/threadStackTracker.hpp" +#include "nmt/virtualMemoryTracker.hpp" #include "runtime/mutexLocker.hpp" #include "runtime/threadCritical.hpp" -#include "services/mallocTracker.hpp" -#include "services/nmtCommon.hpp" -#include "services/threadStackTracker.hpp" -#include "services/virtualMemoryTracker.hpp" #include "utilities/debug.hpp" #include "utilities/nativeCallStack.hpp" @@ -250,4 +250,4 @@ class MemTracker : AllStatic { static Mutex* _query_lock; }; -#endif // SHARE_SERVICES_MEMTRACKER_HPP +#endif // SHARE_NMT_MEMTRACKER_HPP diff --git a/src/hotspot/share/services/memTracker.inline.hpp b/src/hotspot/share/nmt/memTracker.inline.hpp similarity index 85% rename from src/hotspot/share/services/memTracker.inline.hpp rename to src/hotspot/share/nmt/memTracker.inline.hpp index 6c08f1154d0e5..500f2a75d8cf7 100644 --- a/src/hotspot/share/services/memTracker.inline.hpp +++ b/src/hotspot/share/nmt/memTracker.inline.hpp @@ -23,11 +23,12 @@ * */ -#ifndef SHARE_SERVICES_MEMTRACKER_INLINE_HPP -#define SHARE_SERVICES_MEMTRACKER_INLINE_HPP +#ifndef SHARE_NMT_MEMTRACKER_INLINE_HPP +#define SHARE_NMT_MEMTRACKER_INLINE_HPP -#include "services/mallocTracker.inline.hpp" -#include "services/memTracker.hpp" +#include "nmt/memTracker.hpp" + +#include "nmt/mallocTracker.inline.hpp" inline bool MemTracker::check_exceeds_limit(size_t s, MEMFLAGS f) { if (!enabled()) { @@ -36,4 +37,4 @@ inline bool MemTracker::check_exceeds_limit(size_t s, MEMFLAGS f) { return MallocTracker::check_exceeds_limit(s, f); } -#endif // SHARE_SERVICES_MEMTRACKER_INLINE_HPP +#endif // SHARE_NMT_MEMTRACKER_INLINE_HPP diff --git a/src/hotspot/share/services/nmtCommon.cpp b/src/hotspot/share/nmt/nmtCommon.cpp similarity index 98% rename from src/hotspot/share/services/nmtCommon.cpp rename to src/hotspot/share/nmt/nmtCommon.cpp index 53d9daa5b5269..dadb830f29182 100644 --- a/src/hotspot/share/services/nmtCommon.cpp +++ b/src/hotspot/share/nmt/nmtCommon.cpp @@ -22,7 +22,7 @@ * */ #include "precompiled.hpp" -#include "services/nmtCommon.hpp" +#include "nmt/nmtCommon.hpp" #include "utilities/globalDefinitions.hpp" STATIC_ASSERT(NMT_off > NMT_unknown); diff --git a/src/hotspot/share/services/nmtCommon.hpp b/src/hotspot/share/nmt/nmtCommon.hpp similarity index 97% rename from src/hotspot/share/services/nmtCommon.hpp rename to src/hotspot/share/nmt/nmtCommon.hpp index 71a48f656d084..4dafaed04ce0e 100644 --- a/src/hotspot/share/services/nmtCommon.hpp +++ b/src/hotspot/share/nmt/nmtCommon.hpp @@ -24,8 +24,8 @@ * */ -#ifndef SHARE_SERVICES_NMTCOMMON_HPP -#define SHARE_SERVICES_NMTCOMMON_HPP +#ifndef SHARE_NMT_NMTCOMMON_HPP +#define SHARE_NMT_NMTCOMMON_HPP #include "memory/allocation.hpp" // for MEMFLAGS only #include "utilities/align.hpp" @@ -139,4 +139,4 @@ class NMTUtil : AllStatic { }; -#endif // SHARE_SERVICES_NMTCOMMON_HPP +#endif // SHARE_NMT_NMTCOMMON_HPP diff --git a/src/hotspot/share/services/nmtDCmd.cpp b/src/hotspot/share/nmt/nmtDCmd.cpp similarity index 98% rename from src/hotspot/share/services/nmtDCmd.cpp rename to src/hotspot/share/nmt/nmtDCmd.cpp index d6f80613b37c3..80b2ed6141aaf 100644 --- a/src/hotspot/share/services/nmtDCmd.cpp +++ b/src/hotspot/share/nmt/nmtDCmd.cpp @@ -23,12 +23,12 @@ */ #include "precompiled.hpp" #include "memory/resourceArea.hpp" +#include "nmt/memReporter.hpp" +#include "nmt/memTracker.hpp" +#include "nmt/nmtDCmd.hpp" #include "runtime/mutexLocker.hpp" -#include "runtime/vmThread.hpp" #include "runtime/vmOperations.hpp" -#include "services/nmtDCmd.hpp" -#include "services/memReporter.hpp" -#include "services/memTracker.hpp" +#include "runtime/vmThread.hpp" #include "utilities/globalDefinitions.hpp" NMTDCmd::NMTDCmd(outputStream* output, diff --git a/src/hotspot/share/services/nmtDCmd.hpp b/src/hotspot/share/nmt/nmtDCmd.hpp similarity index 92% rename from src/hotspot/share/services/nmtDCmd.hpp rename to src/hotspot/share/nmt/nmtDCmd.hpp index 9a06abb91441f..c70d17a481fb4 100644 --- a/src/hotspot/share/services/nmtDCmd.hpp +++ b/src/hotspot/share/nmt/nmtDCmd.hpp @@ -22,13 +22,13 @@ * */ -#ifndef SHARE_SERVICES_NMTDCMD_HPP -#define SHARE_SERVICES_NMTDCMD_HPP +#ifndef SHARE_NMT_NMTDCMD_HPP +#define SHARE_NMT_NMTDCMD_HPP +#include "nmt/mallocTracker.hpp" +#include "nmt/memBaseline.hpp" #include "services/diagnosticArgument.hpp" #include "services/diagnosticFramework.hpp" -#include "services/memBaseline.hpp" -#include "services/mallocTracker.hpp" /** * Native memory tracking DCmd implementation @@ -70,4 +70,4 @@ class NMTDCmd: public DCmdWithParser { bool check_detail_tracking_level(outputStream* out); }; -#endif // SHARE_SERVICES_NMTDCMD_HPP +#endif // SHARE_NMT_NMTDCMD_HPP diff --git a/src/hotspot/share/services/nmtPreInit.cpp b/src/hotspot/share/nmt/nmtPreInit.cpp similarity index 99% rename from src/hotspot/share/services/nmtPreInit.cpp rename to src/hotspot/share/nmt/nmtPreInit.cpp index 35aec38a6f45a..a8ff18f3b62b2 100644 --- a/src/hotspot/share/services/nmtPreInit.cpp +++ b/src/hotspot/share/nmt/nmtPreInit.cpp @@ -24,12 +24,12 @@ */ #include "precompiled.hpp" +#include "nmt/nmtPreInit.hpp" #include "runtime/os.hpp" -#include "services/nmtPreInit.hpp" #include "utilities/align.hpp" #include "utilities/debug.hpp" -#include "utilities/ostream.hpp" #include "utilities/globalDefinitions.hpp" +#include "utilities/ostream.hpp" // Obviously we cannot use os::malloc for any dynamic allocation during pre-NMT-init, so we must use // raw malloc; to make this very clear, wrap them. diff --git a/src/hotspot/share/services/nmtPreInit.hpp b/src/hotspot/share/nmt/nmtPreInit.hpp similarity index 98% rename from src/hotspot/share/services/nmtPreInit.hpp rename to src/hotspot/share/nmt/nmtPreInit.hpp index 7705c5180d38c..38a34616b3f38 100644 --- a/src/hotspot/share/services/nmtPreInit.hpp +++ b/src/hotspot/share/nmt/nmtPreInit.hpp @@ -23,18 +23,17 @@ * */ -#ifndef SHARE_SERVICES_NMT_PREINIT_HPP -#define SHARE_SERVICES_NMT_PREINIT_HPP +#ifndef SHARE_NMT_NMT_PREINIT_HPP +#define SHARE_NMT_NMT_PREINIT_HPP #include "memory/allStatic.hpp" -#ifdef ASSERT -#include "runtime/atomic.hpp" -#endif -#include "services/memTracker.hpp" -#include "utilities/checkedCast.hpp" +#include "nmt/memTracker.hpp" #include "utilities/debug.hpp" #include "utilities/globalDefinitions.hpp" #include "utilities/macros.hpp" +#ifdef ASSERT +#include "runtime/atomic.hpp" +#endif class outputStream; @@ -378,5 +377,5 @@ class NMTPreInit : public AllStatic { DEBUG_ONLY(static void verify();) }; -#endif // SHARE_SERVICES_NMT_PREINIT_HPP +#endif // SHARE_NMT_NMT_PREINIT_HPP diff --git a/src/hotspot/share/services/nmtUsage.cpp b/src/hotspot/share/nmt/nmtUsage.cpp similarity index 95% rename from src/hotspot/share/services/nmtUsage.cpp rename to src/hotspot/share/nmt/nmtUsage.cpp index 03229ce417157..a00b3cdc90df3 100644 --- a/src/hotspot/share/services/nmtUsage.cpp +++ b/src/hotspot/share/nmt/nmtUsage.cpp @@ -23,12 +23,12 @@ */ #include "precompiled.hpp" +#include "nmt/mallocTracker.hpp" +#include "nmt/nmtCommon.hpp" +#include "nmt/nmtUsage.hpp" +#include "nmt/threadStackTracker.hpp" +#include "nmt/virtualMemoryTracker.hpp" #include "runtime/threadCritical.hpp" -#include "services/nmtCommon.hpp" -#include "services/nmtUsage.hpp" -#include "services/mallocTracker.hpp" -#include "services/threadStackTracker.hpp" -#include "services/virtualMemoryTracker.hpp" // Enabled all options for snapshot. const NMTUsageOptions NMTUsage::OptionsAll = { true, true, true }; diff --git a/src/hotspot/share/services/nmtUsage.hpp b/src/hotspot/share/nmt/nmtUsage.hpp similarity index 94% rename from src/hotspot/share/services/nmtUsage.hpp rename to src/hotspot/share/nmt/nmtUsage.hpp index 38b7b43913fcf..cfff59db9af85 100644 --- a/src/hotspot/share/services/nmtUsage.hpp +++ b/src/hotspot/share/nmt/nmtUsage.hpp @@ -22,8 +22,8 @@ * */ -#ifndef SHARE_SERVICES_NMTUSAGE_HPP -#define SHARE_SERVICES_NMTUSAGE_HPP +#ifndef SHARE_NMT_NMTUSAGE_HPP +#define SHARE_NMT_NMTUSAGE_HPP #include "memory/allocation.hpp" #include "utilities/globalDefinitions.hpp" @@ -65,4 +65,4 @@ class NMTUsage : public CHeapObj { size_t committed(MEMFLAGS flag) const; }; -#endif // SHARE_SERVICES_NMTUSAGE_HPP +#endif // SHARE_NMT_NMTUSAGE_HPP diff --git a/src/hotspot/share/services/threadStackTracker.cpp b/src/hotspot/share/nmt/threadStackTracker.cpp similarity index 96% rename from src/hotspot/share/services/threadStackTracker.cpp rename to src/hotspot/share/nmt/threadStackTracker.cpp index decacc64c5d1a..6060b636153d0 100644 --- a/src/hotspot/share/services/threadStackTracker.cpp +++ b/src/hotspot/share/nmt/threadStackTracker.cpp @@ -24,11 +24,11 @@ #include "precompiled.hpp" +#include "nmt/mallocTracker.hpp" +#include "nmt/memTracker.hpp" +#include "nmt/threadStackTracker.hpp" +#include "nmt/virtualMemoryTracker.hpp" #include "runtime/threadCritical.hpp" -#include "services/mallocTracker.hpp" -#include "services/memTracker.hpp" -#include "services/virtualMemoryTracker.hpp" -#include "services/threadStackTracker.hpp" volatile size_t ThreadStackTracker::_thread_count = 0; SortedLinkedList* ThreadStackTracker::_simple_thread_stacks = nullptr; diff --git a/src/hotspot/share/services/threadStackTracker.hpp b/src/hotspot/share/nmt/threadStackTracker.hpp similarity index 92% rename from src/hotspot/share/services/threadStackTracker.hpp rename to src/hotspot/share/nmt/threadStackTracker.hpp index db7fc0e8569f4..6e2ec361954ba 100644 --- a/src/hotspot/share/services/threadStackTracker.hpp +++ b/src/hotspot/share/nmt/threadStackTracker.hpp @@ -22,14 +22,14 @@ * */ -#ifndef SHARE_SERVICES_THREADSTACKTRACKER_HPP -#define SHARE_SERVICES_THREADSTACKTRACKER_HPP +#ifndef SHARE_NMT_THREADSTACKTRACKER_HPP +#define SHARE_NMT_THREADSTACKTRACKER_HPP -#include "services/allocationSite.hpp" -#include "services/mallocSiteTable.hpp" -#include "services/nmtCommon.hpp" -#include "utilities/nativeCallStack.hpp" +#include "nmt/allocationSite.hpp" +#include "nmt/mallocSiteTable.hpp" +#include "nmt/nmtCommon.hpp" #include "utilities/linkedlist.hpp" +#include "utilities/nativeCallStack.hpp" class SimpleThreadStackSite : public AllocationSite { const address _base; @@ -82,5 +82,5 @@ class ThreadStackTracker : AllStatic { static bool walk_simple_thread_stack_site(MallocSiteWalker* walker); }; -#endif // SHARE_SERVICES_THREADSTACKTRACKER_HPP +#endif // SHARE_NMT_THREADSTACKTRACKER_HPP diff --git a/src/hotspot/share/services/virtualMemoryTracker.cpp b/src/hotspot/share/nmt/virtualMemoryTracker.cpp similarity index 99% rename from src/hotspot/share/services/virtualMemoryTracker.cpp rename to src/hotspot/share/nmt/virtualMemoryTracker.cpp index ebb32ecbeebc3..65bd9afa2d661 100644 --- a/src/hotspot/share/services/virtualMemoryTracker.cpp +++ b/src/hotspot/share/nmt/virtualMemoryTracker.cpp @@ -23,13 +23,13 @@ */ #include "precompiled.hpp" #include "logging/log.hpp" -#include "memory/metaspaceUtils.hpp" #include "memory/metaspaceStats.hpp" +#include "memory/metaspaceUtils.hpp" +#include "nmt/memTracker.hpp" +#include "nmt/threadStackTracker.hpp" +#include "nmt/virtualMemoryTracker.hpp" #include "runtime/os.hpp" #include "runtime/threadCritical.hpp" -#include "services/memTracker.hpp" -#include "services/threadStackTracker.hpp" -#include "services/virtualMemoryTracker.hpp" #include "utilities/ostream.hpp" size_t VirtualMemorySummary::_snapshot[CALC_OBJ_SIZE_IN_TYPE(VirtualMemorySnapshot, size_t)]; diff --git a/src/hotspot/share/services/virtualMemoryTracker.hpp b/src/hotspot/share/nmt/virtualMemoryTracker.hpp similarity index 98% rename from src/hotspot/share/services/virtualMemoryTracker.hpp rename to src/hotspot/share/nmt/virtualMemoryTracker.hpp index 172c3cc7d0cb0..b6f89c278ce15 100644 --- a/src/hotspot/share/services/virtualMemoryTracker.hpp +++ b/src/hotspot/share/nmt/virtualMemoryTracker.hpp @@ -22,19 +22,18 @@ * */ -#ifndef SHARE_SERVICES_VIRTUALMEMORYTRACKER_HPP -#define SHARE_SERVICES_VIRTUALMEMORYTRACKER_HPP +#ifndef SHARE_NMT_VIRTUALMEMORYTRACKER_HPP +#define SHARE_NMT_VIRTUALMEMORYTRACKER_HPP #include "memory/allocation.hpp" #include "memory/metaspace.hpp" // For MetadataType #include "memory/metaspaceStats.hpp" -#include "services/allocationSite.hpp" -#include "services/nmtCommon.hpp" +#include "nmt/allocationSite.hpp" +#include "nmt/nmtCommon.hpp" #include "utilities/linkedlist.hpp" #include "utilities/nativeCallStack.hpp" #include "utilities/ostream.hpp" - /* * Virtual memory counter */ @@ -413,5 +412,5 @@ class VirtualMemoryTracker : AllStatic { static SortedLinkedList* _reserved_regions; }; -#endif // SHARE_SERVICES_VIRTUALMEMORYTRACKER_HPP +#endif // SHARE_NMT_VIRTUALMEMORYTRACKER_HPP diff --git a/src/hotspot/share/oops/method.cpp b/src/hotspot/share/oops/method.cpp index 003f47b1e9c50..c408bc23be7c7 100644 --- a/src/hotspot/share/oops/method.cpp +++ b/src/hotspot/share/oops/method.cpp @@ -41,14 +41,15 @@ #include "interpreter/interpreter.hpp" #include "interpreter/oopMapCache.hpp" #include "logging/log.hpp" -#include "logging/logTag.hpp" #include "logging/logStream.hpp" +#include "logging/logTag.hpp" #include "memory/allocation.inline.hpp" #include "memory/metadataFactory.hpp" #include "memory/metaspaceClosure.hpp" #include "memory/oopFactory.hpp" #include "memory/resourceArea.hpp" #include "memory/universe.hpp" +#include "nmt/memTracker.hpp" #include "oops/constMethod.hpp" #include "oops/constantPool.hpp" #include "oops/klass.inline.hpp" @@ -72,7 +73,6 @@ #include "runtime/sharedRuntime.hpp" #include "runtime/signature.hpp" #include "runtime/vm_version.hpp" -#include "services/memTracker.hpp" #include "utilities/align.hpp" #include "utilities/quickSort.hpp" #include "utilities/vmError.hpp" diff --git a/src/hotspot/share/opto/library_call.cpp b/src/hotspot/share/opto/library_call.cpp index 4a9d7fb161667..62d785809531e 100644 --- a/src/hotspot/share/opto/library_call.cpp +++ b/src/hotspot/share/opto/library_call.cpp @@ -5367,8 +5367,6 @@ void LibraryCallKit::create_new_uncommon_trap(CallStaticJavaNode* uncommon_trap_ //------------------------------inline_array_partition----------------------- bool LibraryCallKit::inline_array_partition() { - const char *stubName = "array_partition_stub"; - Node* elementType = null_check(argument(0)); Node* obj = argument(1); Node* offset = argument(2); @@ -5377,38 +5375,48 @@ bool LibraryCallKit::inline_array_partition() { Node* indexPivot1 = argument(6); Node* indexPivot2 = argument(7); - const TypeInstPtr* elem_klass = gvn().type(elementType)->isa_instptr(); - ciType* elem_type = elem_klass->const_oop()->as_instance()->java_mirror_type(); - BasicType bt = elem_type->basic_type(); - address stubAddr = nullptr; - stubAddr = StubRoutines::select_array_partition_function(); - // stub not loaded - if (stubAddr == nullptr) { - return false; - } - // get the address of the array - const TypeAryPtr* obj_t = _gvn.type(obj)->isa_aryptr(); - if (obj_t == nullptr || obj_t->elem() == Type::BOTTOM ) { - return false; // failed input validation - } - Node* obj_adr = make_unsafe_address(obj, offset); + Node* pivotIndices = nullptr; - // create the pivotIndices array of type int and size = 2 - Node* size = intcon(2); - Node* klass_node = makecon(TypeKlassPtr::make(ciTypeArrayKlass::make(T_INT))); - Node* pivotIndices = new_array(klass_node, size, 0); // no arguments to push - AllocateArrayNode* alloc = tightly_coupled_allocation(pivotIndices); - guarantee(alloc != nullptr, "created above"); - Node* pivotIndices_adr = basic_plus_adr(pivotIndices, arrayOopDesc::base_offset_in_bytes(T_INT)); + // Set the original stack and the reexecute bit for the interpreter to reexecute + // the bytecode that invokes DualPivotQuicksort.partition() if deoptimization happens. + { PreserveReexecuteState preexecs(this); + jvms()->set_should_reexecute(true); - // pass the basic type enum to the stub - Node* elemType = intcon(bt); + const TypeInstPtr* elem_klass = gvn().type(elementType)->isa_instptr(); + ciType* elem_type = elem_klass->const_oop()->as_instance()->java_mirror_type(); + BasicType bt = elem_type->basic_type(); + address stubAddr = nullptr; + stubAddr = StubRoutines::select_array_partition_function(); + // stub not loaded + if (stubAddr == nullptr) { + return false; + } + // get the address of the array + const TypeAryPtr* obj_t = _gvn.type(obj)->isa_aryptr(); + if (obj_t == nullptr || obj_t->elem() == Type::BOTTOM ) { + return false; // failed input validation + } + Node* obj_adr = make_unsafe_address(obj, offset); - // Call the stub - make_runtime_call(RC_LEAF|RC_NO_FP, OptoRuntime::array_partition_Type(), - stubAddr, stubName, TypePtr::BOTTOM, - obj_adr, elemType, fromIndex, toIndex, pivotIndices_adr, - indexPivot1, indexPivot2); + // create the pivotIndices array of type int and size = 2 + Node* size = intcon(2); + Node* klass_node = makecon(TypeKlassPtr::make(ciTypeArrayKlass::make(T_INT))); + pivotIndices = new_array(klass_node, size, 0); // no arguments to push + AllocateArrayNode* alloc = tightly_coupled_allocation(pivotIndices); + guarantee(alloc != nullptr, "created above"); + Node* pivotIndices_adr = basic_plus_adr(pivotIndices, arrayOopDesc::base_offset_in_bytes(T_INT)); + + // pass the basic type enum to the stub + Node* elemType = intcon(bt); + + // Call the stub + const char *stubName = "array_partition_stub"; + make_runtime_call(RC_LEAF|RC_NO_FP, OptoRuntime::array_partition_Type(), + stubAddr, stubName, TypePtr::BOTTOM, + obj_adr, elemType, fromIndex, toIndex, pivotIndices_adr, + indexPivot1, indexPivot2); + + } // original reexecute is set back here if (!stopped()) { set_result(pivotIndices); @@ -5421,9 +5429,6 @@ bool LibraryCallKit::inline_array_partition() { //------------------------------inline_array_sort----------------------- bool LibraryCallKit::inline_array_sort() { - const char *stubName; - stubName = "arraysort_stub"; - Node* elementType = null_check(argument(0)); Node* obj = argument(1); Node* offset = argument(2); @@ -5451,6 +5456,7 @@ bool LibraryCallKit::inline_array_sort() { Node* elemType = intcon(bt); // Call the stub. + const char *stubName = "arraysort_stub"; make_runtime_call(RC_LEAF|RC_NO_FP, OptoRuntime::array_sort_Type(), stubAddr, stubName, TypePtr::BOTTOM, obj_adr, elemType, fromIndex, toIndex); diff --git a/src/hotspot/share/opto/replacednodes.cpp b/src/hotspot/share/opto/replacednodes.cpp index 78c1703799e5e..56c5ee1c0bfb7 100644 --- a/src/hotspot/share/opto/replacednodes.cpp +++ b/src/hotspot/share/opto/replacednodes.cpp @@ -106,88 +106,175 @@ void ReplacedNodes::apply(Node* n, uint idx) { } } -static void enqueue_use(Node* n, Node* use, Unique_Node_List& work) { - if (use->is_Phi()) { - Node* r = use->in(0); - assert(r->is_Region(), "Phi should have Region"); - for (uint i = 1; i < use->req(); i++) { - if (use->in(i) == n) { - work.push(r->in(i)); - } - } - } else { - work.push(use); - } -} - // Perform node replacement following late inlining. void ReplacedNodes::apply(Compile* C, Node* ctl) { // ctl is the control on exit of the method that was late inlined if (is_empty()) { return; } + ResourceMark rm; + Node_Stack stack(0); + Unique_Node_List to_fix; // nodes to clone + uses at the end of the chain that need to updated + VectorSet seen; + VectorSet valid_control; + for (int i = 0; i < _replaced_nodes->length(); i++) { ReplacedNode replaced = _replaced_nodes->at(i); Node* initial = replaced.initial(); Node* improved = replaced.improved(); assert (ctl != nullptr && !ctl->is_top(), "replaced node should have actual control"); - ResourceMark rm; - Unique_Node_List work; - // Go over all the uses of the node that is considered for replacement... - for (DUIterator j = initial->outs(); initial->has_out(j); j++) { - Node* use = initial->out(j); + if (initial->outcnt() == 0) { + continue; + } - if (use == improved || use->outcnt() == 0) { - continue; - } - work.clear(); - enqueue_use(initial, use, work); - bool replace = true; - // Check that this use is dominated by ctl. Go ahead with the replacement if it is. - while (work.size() != 0 && replace) { - Node* n = work.pop(); - if (use->outcnt() == 0) { - continue; + // Find uses of initial that are dominated by ctl so, initial can be replaced by improved. + // Proving domination here is not straightforward. To do so, we follow uses of initial, and uses of uses until we + // encounter a node which is a control node or is pinned at some control. Then, we try to prove this control is + // dominated by ctl. If that's the case, it's legal to replace initial by improved but for this chain of uses only. + // It may not be the case for some other chain of uses, so we clone that chain and perform the replacement only for + // these uses. + assert(stack.is_empty(), ""); + stack.push(initial, 1); + Node* use = initial->raw_out(0); + stack.push(use, 0); + + while (!stack.is_empty()) { + assert(stack.size() > 1, "at least initial + one use"); + Node* n = stack.node(); + + uint current_size = stack.size(); + + if (seen.test_set(n->_idx)) { + if (to_fix.member(n)) { + collect_nodes_to_clone(stack, to_fix); } - if (n->is_CFG() || (n->in(0) != nullptr && !n->in(0)->is_top())) { - // Skip projections, since some of the multi nodes aren't CFG (e.g., LoadStore and SCMemProj). - if (n->is_Proj()) { - n = n->in(0); + } else if (n->outcnt() != 0 && n != improved) { + if (n->is_Phi()) { + Node* region = n->in(0); + Node* prev = stack.node_at(stack.size() - 2); + for (uint j = 1; j < region->req(); ++j) { + if (n->in(j) == prev) { + Node* in = region->in(j); + if (in != nullptr && !in->is_top()) { + if (is_dominator(ctl, in)) { + valid_control.set(in->_idx); + collect_nodes_to_clone(stack, to_fix); + } + } + } } - if (!n->is_CFG()) { - n = n->in(0); + } else if (n->is_CFG()) { + if (is_dominator(ctl, n)) { + collect_nodes_to_clone(stack, to_fix); } - assert(n->is_CFG(), "should be CFG now"); - int depth = 0; - while(n != ctl) { - n = IfNode::up_one_dom(n); - depth++; - // limit search depth - if (depth >= 100 || n == nullptr) { - replace = false; - break; - } + } else if (n->in(0) != nullptr && n->in(0)->is_CFG()) { + Node* c = n->in(0); + if (is_dominator(ctl, c)) { + collect_nodes_to_clone(stack, to_fix); } } else { - for (DUIterator k = n->outs(); n->has_out(k); k++) { - enqueue_use(n, n->out(k), work); + uint idx = stack.index(); + if (idx < n->outcnt()) { + stack.set_index(idx + 1); + stack.push(n->raw_out(idx), 0); } } } - if (replace) { - bool is_in_table = C->initial_gvn()->hash_delete(use); - int replaced = use->replace_edge(initial, improved); - if (is_in_table) { - C->initial_gvn()->hash_find_insert(use); + if (stack.size() == current_size) { + for (;;) { + stack.pop(); + if (stack.is_empty()) { + break; + } + n = stack.node(); + uint idx = stack.index(); + if (idx < n->outcnt()) { + stack.set_index(idx + 1); + stack.push(n->raw_out(idx), 0); + break; + } } - C->record_for_igvn(use); + } + } + } + if (to_fix.size() > 0) { + uint hash_table_size = _replaced_nodes->length(); + for (uint i = 0; i < to_fix.size(); ++i) { + Node* n = to_fix.at(i); + if (n->is_CFG() || n->in(0) != nullptr) { // End of a chain is not cloned + continue; + } + hash_table_size++; + } + // Map from current node to cloned/replaced node + ResizeableResourceHashtable clones(hash_table_size, hash_table_size); + // Record mapping from initial to improved nodes + for (int i = 0; i < _replaced_nodes->length(); i++) { + ReplacedNode replaced = _replaced_nodes->at(i); + Node* initial = replaced.initial(); + Node* improved = replaced.improved(); + clones.put(initial, improved); + // If initial needs to be cloned but is also improved then there's no need to clone it. + if (to_fix.member(initial)) { + to_fix.remove(initial); + } + } - assert(replaced > 0, "inconsistent"); - --j; + // Clone nodes and record mapping from current to cloned nodes + for (uint i = 0; i < to_fix.size(); ++i) { + Node* n = to_fix.at(i); + if (n->is_CFG() || n->in(0) != nullptr) { // End of a chain + continue; } + Node* clone = n->clone(); + bool added = clones.put(n, clone); + assert(added, "clone node must be added to mapping"); + C->initial_gvn()->set_type_bottom(clone); + to_fix.map(i, clone); // Update list of nodes with cloned node + } + + // Fix edges in cloned nodes and use at the end of the chain + for (uint i = 0; i < to_fix.size(); ++i) { + Node* n = to_fix.at(i); + bool is_in_table = C->initial_gvn()->hash_delete(n); + uint updates = 0; + for (uint j = 0; j < n->req(); ++j) { + Node* in = n->in(j); + if (in == nullptr || (n->is_Phi() && n->in(0)->in(j) == nullptr)) { + continue; + } + if (n->is_Phi() && !valid_control.test(n->in(0)->in(j)->_idx)) { + continue; + } + Node** clone_ptr = clones.get(in); + if (clone_ptr != nullptr) { + Node* clone = *clone_ptr; + n->set_req(j, clone); + updates++; + } + } + assert(updates > 0, ""); + C->record_for_igvn(n); + if (is_in_table) { + C->initial_gvn()->hash_find_insert(n); + } + } + } +} + +bool ReplacedNodes::is_dominator(const Node* ctl, Node* n) const { + assert(n->is_CFG(), "should be CFG now"); + int depth = 0; + while (n != ctl) { + n = IfNode::up_one_dom(n); + depth++; + // limit search depth + if (depth >= 100 || n == nullptr) { + return false; } } + return true; } void ReplacedNodes::dump(outputStream *st) const { @@ -224,3 +311,10 @@ void ReplacedNodes::merge_with(const ReplacedNodes& other) { _replaced_nodes->trunc_to(len - shift); } } + +void ReplacedNodes::collect_nodes_to_clone(const Node_Stack& stack, Unique_Node_List& to_fix) { + for (uint i = stack.size() - 1; i >= 1; i--) { + Node* n = stack.node_at(i); + to_fix.push(n); + } +} diff --git a/src/hotspot/share/opto/replacednodes.hpp b/src/hotspot/share/opto/replacednodes.hpp index c569e55ce5ff2..9b66a2c5f49b8 100644 --- a/src/hotspot/share/opto/replacednodes.hpp +++ b/src/hotspot/share/opto/replacednodes.hpp @@ -76,6 +76,10 @@ class ReplacedNodes { bool is_empty() const; void dump(outputStream *st) const; void apply(Compile* C, Node* ctl); + + bool is_dominator(const Node* ctl, Node* n) const; + + void collect_nodes_to_clone(const Node_Stack& stack, Unique_Node_List& to_fix); }; #endif // SHARE_OPTO_REPLACEDNODES_HPP diff --git a/src/hotspot/share/precompiled/precompiled.hpp b/src/hotspot/share/precompiled/precompiled.hpp index c6b8668010ed3..c53a78de87bca 100644 --- a/src/hotspot/share/precompiled/precompiled.hpp +++ b/src/hotspot/share/precompiled/precompiled.hpp @@ -42,6 +42,7 @@ #include "memory/memRegion.hpp" #include "memory/resourceArea.hpp" #include "memory/universe.hpp" +#include "nmt/memTracker.hpp" #include "oops/instanceKlass.hpp" #include "oops/klass.hpp" #include "oops/method.hpp" @@ -57,7 +58,6 @@ #include "runtime/orderAccess.hpp" #include "runtime/os.hpp" #include "runtime/timer.hpp" -#include "services/memTracker.hpp" #include "utilities/align.hpp" #include "utilities/bitMap.hpp" #include "utilities/copy.hpp" diff --git a/src/hotspot/share/prims/jni.cpp b/src/hotspot/share/prims/jni.cpp index 2d73feba6137c..33dcfb6c3fe5e 100644 --- a/src/hotspot/share/prims/jni.cpp +++ b/src/hotspot/share/prims/jni.cpp @@ -52,6 +52,7 @@ #include "memory/oopFactory.hpp" #include "memory/resourceArea.hpp" #include "memory/universe.hpp" +#include "nmt/memTracker.hpp" #include "oops/access.inline.hpp" #include "oops/arrayOop.hpp" #include "oops/instanceKlass.inline.hpp" @@ -88,7 +89,6 @@ #include "runtime/synchronizer.hpp" #include "runtime/thread.inline.hpp" #include "runtime/vmOperations.hpp" -#include "services/memTracker.hpp" #include "services/runtimeService.hpp" #include "utilities/defaultStream.hpp" #include "utilities/dtrace.hpp" diff --git a/src/hotspot/share/prims/whitebox.cpp b/src/hotspot/share/prims/whitebox.cpp index e86217f8de694..7afc0ea2c0c61 100644 --- a/src/hotspot/share/prims/whitebox.cpp +++ b/src/hotspot/share/prims/whitebox.cpp @@ -56,6 +56,8 @@ #include "memory/oopFactory.hpp" #include "memory/resourceArea.hpp" #include "memory/universe.hpp" +#include "nmt/mallocSiteTable.hpp" +#include "nmt/memTracker.hpp" #include "oops/array.hpp" #include "oops/compressedOops.hpp" #include "oops/constantPool.inline.hpp" @@ -88,9 +90,7 @@ #include "runtime/threadSMR.hpp" #include "runtime/vframe.hpp" #include "runtime/vm_version.hpp" -#include "services/mallocSiteTable.hpp" #include "services/memoryService.hpp" -#include "services/memTracker.hpp" #include "utilities/align.hpp" #include "utilities/checkedCast.hpp" #include "utilities/debug.hpp" @@ -121,9 +121,9 @@ #include "jvmci/jvmciRuntime.hpp" #endif #ifdef LINUX -#include "os_linux.hpp" -#include "osContainer_linux.hpp" #include "cgroupSubsystem_linux.hpp" +#include "osContainer_linux.hpp" +#include "os_linux.hpp" #endif #define CHECK_JNI_EXCEPTION_(env, value) \ @@ -381,7 +381,7 @@ WB_ENTRY(jboolean, WB_IsGCSupportedByJVMCICompiler(JNIEnv* env, jobject o, jint if (EnableJVMCI) { // Enter the JVMCI env that will be used by the CompileBroker. JVMCIEnv jvmciEnv(thread, __FILE__, __LINE__); - return jvmciEnv.runtime()->is_gc_supported(&jvmciEnv, (CollectedHeap::Name)name); + return jvmciEnv.init_error() == JNI_OK && jvmciEnv.runtime()->is_gc_supported(&jvmciEnv, (CollectedHeap::Name)name); } #endif return false; diff --git a/src/hotspot/share/runtime/arguments.cpp b/src/hotspot/share/runtime/arguments.cpp index 33686a3b6e911..9b229c171c050 100644 --- a/src/hotspot/share/runtime/arguments.cpp +++ b/src/hotspot/share/runtime/arguments.cpp @@ -42,6 +42,7 @@ #include "logging/logStream.hpp" #include "logging/logTag.hpp" #include "memory/allocation.inline.hpp" +#include "nmt/nmtCommon.hpp" #include "oops/compressedKlass.hpp" #include "oops/instanceKlass.hpp" #include "oops/oop.inline.hpp" @@ -59,7 +60,6 @@ #include "runtime/synchronizer.hpp" #include "runtime/vm_version.hpp" #include "services/management.hpp" -#include "services/nmtCommon.hpp" #include "utilities/align.hpp" #include "utilities/checkedCast.hpp" #include "utilities/debug.hpp" diff --git a/src/hotspot/share/runtime/atomic.hpp b/src/hotspot/share/runtime/atomic.hpp index c85bf9055ab39..ac0ce49d26e56 100644 --- a/src/hotspot/share/runtime/atomic.hpp +++ b/src/hotspot/share/runtime/atomic.hpp @@ -398,11 +398,15 @@ class Atomic : AllStatic { T compare_value, T exchange_value); - // Support platforms that do not provide Read-Modify-Write - // byte-level atomic access. To use, derive PlatformCmpxchg<1> from - // this class. + // Support platforms that do not provide Read-Modify-Write atomic + // accesses for 1-byte and 8-byte widths. To use, derive PlatformCmpxchg<1>, + // PlatformAdd, PlatformXchg from these classes. public: // Temporary, can't be private: C++03 11.4/2. Fixed by C++11. struct CmpxchgByteUsingInt; + template + struct XchgUsingCmpxchg; + template + class AddUsingCmpxchg; private: // Dispatch handler for xchg. Provides type-based validity @@ -677,6 +681,47 @@ struct Atomic::CmpxchgByteUsingInt { atomic_memory_order order) const; }; +// Define the class before including platform file, which may use this +// as a base class, requiring it be complete. The definition is later +// in this file, near the other definitions related to xchg. +template +struct Atomic::XchgUsingCmpxchg { + template + T operator()(T volatile* dest, + T exchange_value, + atomic_memory_order order) const; +}; + +// Define the class before including platform file, which may use this +// as a base class, requiring it be complete. +template +class Atomic::AddUsingCmpxchg { +public: + template + static inline D add_then_fetch(D volatile* dest, + I add_value, + atomic_memory_order order) { + D addend = add_value; + return fetch_then_add(dest, add_value, order) + add_value; + } + + template + static inline D fetch_then_add(D volatile* dest, + I add_value, + atomic_memory_order order) { + STATIC_ASSERT(byte_size == sizeof(I)); + STATIC_ASSERT(byte_size == sizeof(D)); + + D old_value; + D new_value; + do { + old_value = Atomic::load(dest); + new_value = old_value + add_value; + } while (old_value != Atomic::cmpxchg(dest, old_value, new_value, order)); + return old_value; + } +}; + // Define the class before including platform file, which may specialize // the operator definition. No generic definition of specializations // of the operator template are provided, nor are there any generic @@ -1170,4 +1215,18 @@ inline D Atomic::xchg(volatile D* dest, T exchange_value, atomic_memory_order or return XchgImpl()(dest, exchange_value, order); } +template +template +inline T Atomic::XchgUsingCmpxchg::operator()(T volatile* dest, + T exchange_value, + atomic_memory_order order) const { + STATIC_ASSERT(byte_size == sizeof(T)); + + T old_value; + do { + old_value = Atomic::load(dest); + } while (old_value != Atomic::cmpxchg(dest, old_value, exchange_value, order)); + return old_value; +} + #endif // SHARE_RUNTIME_ATOMIC_HPP diff --git a/src/hotspot/share/runtime/init.cpp b/src/hotspot/share/runtime/init.cpp index 17dfb44579292..3343521af62a4 100644 --- a/src/hotspot/share/runtime/init.cpp +++ b/src/hotspot/share/runtime/init.cpp @@ -32,20 +32,20 @@ #include "interpreter/bytecodes.hpp" #include "logging/logAsyncWriter.hpp" #include "memory/universe.hpp" +#include "nmt/memTracker.hpp" +#include "prims/downcallLinker.hpp" #include "prims/jvmtiExport.hpp" #include "prims/methodHandles.hpp" -#include "prims/downcallLinker.hpp" -#include "runtime/globals.hpp" #include "runtime/atomic.hpp" #include "runtime/continuation.hpp" #include "runtime/flags/jvmFlag.hpp" +#include "runtime/globals.hpp" #include "runtime/handles.inline.hpp" #include "runtime/icache.hpp" #include "runtime/init.hpp" #include "runtime/safepoint.hpp" #include "runtime/sharedRuntime.hpp" #include "sanitizers/leak.hpp" -#include "services/memTracker.hpp" #include "utilities/macros.hpp" #if INCLUDE_JVMCI #include "jvmci/jvmci.hpp" diff --git a/src/hotspot/share/runtime/java.cpp b/src/hotspot/share/runtime/java.cpp index d075b6cb9c83e..a5e0d55fe1483 100644 --- a/src/hotspot/share/runtime/java.cpp +++ b/src/hotspot/share/runtime/java.cpp @@ -46,6 +46,7 @@ #include "memory/oopFactory.hpp" #include "memory/resourceArea.hpp" #include "memory/universe.hpp" +#include "nmt/memTracker.hpp" #include "oops/constantPool.hpp" #include "oops/generateOopMap.hpp" #include "oops/instanceKlass.hpp" @@ -76,7 +77,6 @@ #include "runtime/vmThread.hpp" #include "runtime/vm_version.hpp" #include "sanitizers/leak.hpp" -#include "services/memTracker.hpp" #include "utilities/dtrace.hpp" #include "utilities/globalDefinitions.hpp" #include "utilities/macros.hpp" diff --git a/src/hotspot/share/runtime/os.cpp b/src/hotspot/share/runtime/os.cpp index 41b951b880144..0fea576269b32 100644 --- a/src/hotspot/share/runtime/os.cpp +++ b/src/hotspot/share/runtime/os.cpp @@ -39,10 +39,15 @@ #include "memory/allocation.inline.hpp" #include "memory/resourceArea.hpp" #include "memory/universe.hpp" +#include "nmt/mallocHeader.inline.hpp" +#include "nmt/mallocTracker.hpp" +#include "nmt/memTracker.inline.hpp" +#include "nmt/nmtCommon.hpp" +#include "nmt/nmtPreInit.hpp" #include "oops/compressedKlass.inline.hpp" #include "oops/oop.inline.hpp" -#include "prims/jvmtiAgent.hpp" #include "prims/jvm_misc.hpp" +#include "prims/jvmtiAgent.hpp" #include "runtime/arguments.hpp" #include "runtime/atomic.hpp" #include "runtime/frame.inline.hpp" @@ -63,11 +68,6 @@ #include "runtime/vm_version.hpp" #include "sanitizers/address.hpp" #include "services/attachListener.hpp" -#include "services/mallocTracker.hpp" -#include "services/mallocHeader.inline.hpp" -#include "services/memTracker.inline.hpp" -#include "services/nmtPreInit.hpp" -#include "services/nmtCommon.hpp" #include "services/threadService.hpp" #include "utilities/align.hpp" #include "utilities/checkedCast.hpp" diff --git a/src/hotspot/share/runtime/park.cpp b/src/hotspot/share/runtime/park.cpp index 03560974d0598..56eb00b50199f 100644 --- a/src/hotspot/share/runtime/park.cpp +++ b/src/hotspot/share/runtime/park.cpp @@ -24,8 +24,8 @@ #include "precompiled.hpp" #include "memory/allocation.inline.hpp" +#include "nmt/memTracker.hpp" #include "runtime/javaThread.hpp" -#include "services/memTracker.hpp" // Lifecycle management for TSM ParkEvents. // ParkEvents are type-stable (TSM). diff --git a/src/hotspot/share/runtime/safepointMechanism.cpp b/src/hotspot/share/runtime/safepointMechanism.cpp index 63f237df7e80e..624583db3d130 100644 --- a/src/hotspot/share/runtime/safepointMechanism.cpp +++ b/src/hotspot/share/runtime/safepointMechanism.cpp @@ -24,6 +24,7 @@ #include "precompiled.hpp" #include "logging/log.hpp" +#include "nmt/memTracker.hpp" #include "runtime/globals.hpp" #include "runtime/javaThread.inline.hpp" #include "runtime/orderAccess.hpp" @@ -31,7 +32,6 @@ #include "runtime/osThread.hpp" #include "runtime/safepointMechanism.inline.hpp" #include "runtime/stackWatermarkSet.hpp" -#include "services/memTracker.hpp" #include "utilities/globalDefinitions.hpp" uintptr_t SafepointMechanism::_poll_word_armed_value; diff --git a/src/hotspot/share/runtime/thread.cpp b/src/hotspot/share/runtime/thread.cpp index 1023ab8bac2ae..851e5139f8aad 100644 --- a/src/hotspot/share/runtime/thread.cpp +++ b/src/hotspot/share/runtime/thread.cpp @@ -34,6 +34,7 @@ #include "memory/allocation.inline.hpp" #include "memory/iterator.hpp" #include "memory/resourceArea.hpp" +#include "nmt/memTracker.hpp" #include "oops/oop.inline.hpp" #include "runtime/atomic.hpp" #include "runtime/handles.inline.hpp" @@ -45,7 +46,6 @@ #include "runtime/safepointMechanism.inline.hpp" #include "runtime/thread.inline.hpp" #include "runtime/threadSMR.inline.hpp" -#include "services/memTracker.hpp" #include "utilities/macros.hpp" #include "utilities/spinYield.hpp" #if INCLUDE_JFR diff --git a/src/hotspot/share/runtime/threads.cpp b/src/hotspot/share/runtime/threads.cpp index 276c3e362f030..b07f6e21d20df 100644 --- a/src/hotspot/share/runtime/threads.cpp +++ b/src/hotspot/share/runtime/threads.cpp @@ -52,17 +52,18 @@ #include "memory/oopFactory.hpp" #include "memory/resourceArea.hpp" #include "memory/universe.hpp" +#include "nmt/memTracker.hpp" #include "oops/instanceKlass.hpp" #include "oops/klass.inline.hpp" #include "oops/oop.inline.hpp" #include "oops/symbol.hpp" -#include "prims/jvmtiAgentList.hpp" #include "prims/jvm_misc.hpp" +#include "prims/jvmtiAgentList.hpp" #include "runtime/arguments.hpp" #include "runtime/fieldDescriptor.inline.hpp" #include "runtime/flags/jvmFlagLimit.hpp" -#include "runtime/handles.inline.hpp" #include "runtime/globals.hpp" +#include "runtime/handles.inline.hpp" #include "runtime/interfaceSupport.inline.hpp" #include "runtime/java.hpp" #include "runtime/javaCalls.hpp" @@ -83,8 +84,8 @@ #include "runtime/statSampler.hpp" #include "runtime/stubCodeGenerator.hpp" #include "runtime/thread.inline.hpp" -#include "runtime/threads.hpp" #include "runtime/threadSMR.inline.hpp" +#include "runtime/threads.hpp" #include "runtime/timer.hpp" #include "runtime/timerTrace.hpp" #include "runtime/trimNativeHeap.hpp" @@ -92,7 +93,6 @@ #include "runtime/vm_version.hpp" #include "services/attachListener.hpp" #include "services/management.hpp" -#include "services/memTracker.hpp" #include "services/threadIdTable.hpp" #include "services/threadService.hpp" #include "utilities/dtrace.hpp" diff --git a/src/hotspot/share/services/diagnosticCommand.cpp b/src/hotspot/share/services/diagnosticCommand.cpp index a54f2ebaa707b..98bfcbafd290e 100644 --- a/src/hotspot/share/services/diagnosticCommand.cpp +++ b/src/hotspot/share/services/diagnosticCommand.cpp @@ -24,9 +24,9 @@ #include "precompiled.hpp" #include "cds/cds_globals.hpp" +#include "classfile/classLoaderDataGraph.hpp" #include "classfile/classLoaderHierarchyDCmd.hpp" #include "classfile/classLoaderStats.hpp" -#include "classfile/classLoaderDataGraph.hpp" #include "classfile/javaClasses.hpp" #include "classfile/systemDictionary.hpp" #include "classfile/vmClasses.hpp" @@ -40,6 +40,7 @@ #include "memory/metaspace/metaspaceDCmd.hpp" #include "memory/resourceArea.hpp" #include "memory/universe.hpp" +#include "nmt/nmtDCmd.hpp" #include "oops/instanceKlass.hpp" #include "oops/objArrayOop.inline.hpp" #include "oops/oop.inline.hpp" @@ -59,7 +60,6 @@ #include "services/diagnosticFramework.hpp" #include "services/heapDumper.hpp" #include "services/management.hpp" -#include "services/nmtDCmd.hpp" #include "services/writeableFlags.hpp" #include "utilities/debug.hpp" #include "utilities/events.hpp" @@ -67,8 +67,8 @@ #include "utilities/macros.hpp" #include "utilities/parseInteger.hpp" #ifdef LINUX -#include "trimCHeapDCmd.hpp" #include "mallocInfoDcmd.hpp" +#include "trimCHeapDCmd.hpp" #endif static void loadAgentModule(TRAPS) { diff --git a/src/hotspot/share/services/mallocLimit.cpp b/src/hotspot/share/services/mallocLimit.cpp index 4f96bb582f29e..392b20f61ef50 100644 --- a/src/hotspot/share/services/mallocLimit.cpp +++ b/src/hotspot/share/services/mallocLimit.cpp @@ -26,10 +26,10 @@ #include "precompiled.hpp" #include "memory/allocation.hpp" +#include "nmt/nmtCommon.hpp" #include "runtime/java.hpp" #include "runtime/globals.hpp" #include "services/mallocLimit.hpp" -#include "services/nmtCommon.hpp" #include "utilities/globalDefinitions.hpp" #include "utilities/parseInteger.hpp" #include "utilities/ostream.hpp" diff --git a/src/hotspot/share/utilities/debug.cpp b/src/hotspot/share/utilities/debug.cpp index c918d8d04b36f..d39335c6307f4 100644 --- a/src/hotspot/share/utilities/debug.cpp +++ b/src/hotspot/share/utilities/debug.cpp @@ -37,6 +37,9 @@ #include "memory/allocation.hpp" #include "memory/resourceArea.hpp" #include "memory/universe.hpp" +#include "nmt/mallocTracker.hpp" +#include "nmt/memTracker.hpp" +#include "nmt/virtualMemoryTracker.hpp" #include "oops/klass.inline.hpp" #include "oops/oop.inline.hpp" #include "runtime/atomic.hpp" @@ -54,9 +57,6 @@ #include "runtime/vframe.hpp" #include "runtime/vm_version.hpp" #include "services/heapDumper.hpp" -#include "services/mallocTracker.hpp" -#include "services/memTracker.hpp" -#include "services/virtualMemoryTracker.hpp" #include "utilities/defaultStream.hpp" #include "utilities/events.hpp" #include "utilities/formatBuffer.hpp" diff --git a/src/hotspot/share/utilities/nativeCallStack.hpp b/src/hotspot/share/utilities/nativeCallStack.hpp index 841b2cb204563..d61867c1dea9a 100644 --- a/src/hotspot/share/utilities/nativeCallStack.hpp +++ b/src/hotspot/share/utilities/nativeCallStack.hpp @@ -26,7 +26,7 @@ #define SHARE_UTILITIES_NATIVECALLSTACK_HPP #include "memory/allocation.hpp" -#include "services/nmtCommon.hpp" +#include "nmt/nmtCommon.hpp" #include "utilities/ostream.hpp" /* diff --git a/src/hotspot/share/utilities/vmError.cpp b/src/hotspot/share/utilities/vmError.cpp index 2f4aec97868a4..9cf434fa2189e 100644 --- a/src/hotspot/share/utilities/vmError.cpp +++ b/src/hotspot/share/utilities/vmError.cpp @@ -38,14 +38,15 @@ #include "memory/metaspaceUtils.hpp" #include "memory/resourceArea.inline.hpp" #include "memory/universe.hpp" +#include "nmt/memTracker.hpp" #include "oops/compressedOops.hpp" #include "prims/whitebox.hpp" #include "runtime/arguments.hpp" #include "runtime/atomic.hpp" #include "runtime/flags/jvmFlag.hpp" #include "runtime/frame.inline.hpp" -#include "runtime/javaThread.inline.hpp" #include "runtime/init.hpp" +#include "runtime/javaThread.inline.hpp" #include "runtime/os.inline.hpp" #include "runtime/osThread.hpp" #include "runtime/safefetch.hpp" @@ -55,10 +56,9 @@ #include "runtime/threads.hpp" #include "runtime/threadSMR.hpp" #include "runtime/trimNativeHeap.hpp" -#include "runtime/vmThread.hpp" #include "runtime/vmOperations.hpp" +#include "runtime/vmThread.hpp" #include "runtime/vm_version.hpp" -#include "services/memTracker.hpp" #include "utilities/debug.hpp" #include "utilities/decoder.hpp" #include "utilities/defaultStream.hpp" diff --git a/src/java.base/share/classes/java/text/ChoiceFormat.java b/src/java.base/share/classes/java/text/ChoiceFormat.java index 538454d669a91..6f27137ea0d58 100644 --- a/src/java.base/share/classes/java/text/ChoiceFormat.java +++ b/src/java.base/share/classes/java/text/ChoiceFormat.java @@ -235,8 +235,9 @@ public class ChoiceFormat extends NumberFormat { /** * Apply the given pattern to this ChoiceFormat object. The syntax * for the ChoiceFormat pattern can be seen in the {@linkplain ##patterns - * Patterns} section. - * + * Patterns} section. Unlike {@link #setChoices(double[], String[])} this + * method will throw an {@code IllegalArgumentException} if the {@code + * limits} are not in ascending order. * @param newPattern a pattern string * @throws NullPointerException if {@code newPattern} * is {@code null} diff --git a/src/java.base/share/classes/java/text/ListFormat.java b/src/java.base/share/classes/java/text/ListFormat.java index d0b1b2aaf2aec..cd26f68bf4639 100644 --- a/src/java.base/share/classes/java/text/ListFormat.java +++ b/src/java.base/share/classes/java/text/ListFormat.java @@ -322,6 +322,26 @@ public static ListFormat getInstance(String[] patterns) { return new ListFormat(Locale.ROOT, Arrays.copyOf(patterns, PATTERN_ARRAY_LENGTH)); } + /** + * {@return the {@code Locale} of this ListFormat} + * + * The {@code locale} is defined by {@link #getInstance(Locale, Type, Style)} or + * {@link #getInstance(String[])}. + */ + public Locale getLocale() { + return locale; + } + + /** + * {@return the patterns used in this ListFormat} + * + * The {@code patterns} are defined by {@link #getInstance(Locale, Type, Style)} or + * {@link #getInstance(String[])}. + */ + public String[] getPatterns() { + return Arrays.copyOf(patterns, patterns.length); + } + /** * {@return the string that consists of the input strings, concatenated with the * patterns of this {@code ListFormat}} @@ -480,11 +500,12 @@ public AttributedCharacterIterator formatToCharacterIterator(Object arguments) { } /** - * Checks if this {@code ListFormat} is equal to another {@code ListFormat}. - * The comparison is based on the {@code Locale} and formatting patterns, given or - * generated with {@code Locale}, {@code Type}, and {@code Style}. - * @param obj the object to check, {@code null} returns {@code false} - * @return {@code true} if this is equals to the other {@code ListFormat} + * Compares the specified object with this {@code ListFormat} for equality. + * Returns {@code true} if the specified object is also a {@code ListFormat}, and + * {@code locale} and {@code patterns}, returned from {@link #getLocale()} + * and {@link #getPatterns()} respectively, are equal. + * @param obj the object to be compared for equality. + * @return {@code true} if the specified object is equal to this {@code ListFormat} */ @Override public boolean equals(Object obj) { diff --git a/src/java.base/share/classes/java/time/Duration.java b/src/java.base/share/classes/java/time/Duration.java index c1894e2db5a7c..ab46159efd6a2 100644 --- a/src/java.base/share/classes/java/time/Duration.java +++ b/src/java.base/share/classes/java/time/Duration.java @@ -486,23 +486,26 @@ private static Duration create(boolean negate, long daysAsSecs, long hoursAsSecs * @throws ArithmeticException if the calculation exceeds the capacity of {@code Duration} */ public static Duration between(Temporal startInclusive, Temporal endExclusive) { - try { + long secs = startInclusive.until(endExclusive, SECONDS); + if (secs == 0) { + // We don't know which Temporal is earlier, so the adjustment below would not work. + // But we do know that there's no danger of until(NANOS) overflowing in that case. return ofNanos(startInclusive.until(endExclusive, NANOS)); - } catch (DateTimeException | ArithmeticException ex) { - long secs = startInclusive.until(endExclusive, SECONDS); - long nanos; - try { - nanos = endExclusive.getLong(NANO_OF_SECOND) - startInclusive.getLong(NANO_OF_SECOND); - if (secs > 0 && nanos < 0) { - secs++; - } else if (secs < 0 && nanos > 0) { - secs--; - } - } catch (DateTimeException ex2) { - nanos = 0; - } - return ofSeconds(secs, nanos); } + long nanos; + try { + nanos = endExclusive.getLong(NANO_OF_SECOND) - startInclusive.getLong(NANO_OF_SECOND); + } catch (DateTimeException ex2) { + nanos = 0; + } + if (nanos < 0 && secs > 0) { + // ofSeconds will subtract one even though until(SECONDS) already gave the correct + // number of seconds. So compensate. Similarly for the secs < 0 case below. + secs++; + } else if (nanos > 0 && secs < 0) { + secs--; + } + return ofSeconds(secs, nanos); } //----------------------------------------------------------------------- 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 2effa3425d71a..b094acc51fe96 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 @@ -405,26 +405,38 @@ public String toString() { collator.setStrength(Collator.PRIMARY); } - private Main() { } - public static void main(String[] args) throws Exception { Main kt = new Main(); - kt.run(args, System.out); + int exitCode = kt.run(args, System.out); + if (exitCode != 0) { + System.exit(exitCode); + } + } + + private static class ExitException extends RuntimeException { + @java.io.Serial + static final long serialVersionUID = 0L; + private final int errorCode; + public ExitException(int errorCode) { + this.errorCode = errorCode; + } } - private void run(String[] args, PrintStream out) throws Exception { + public int run(String[] args, PrintStream out) throws Exception { try { - args = parseArgs(args); + parseArgs(args); if (command != null) { doCommands(out); } + } catch (ExitException ee) { + return ee.errorCode; } catch (Exception e) { System.out.println(rb.getString("keytool.error.") + e); if (verbose) { e.printStackTrace(System.out); } if (!debug) { - System.exit(1); + return 1; } else { throw e; } @@ -441,6 +453,7 @@ private void run(String[] args, PrintStream out) throws Exception { ksStream.close(); } } + return 0; } /** @@ -5247,7 +5260,7 @@ private void tinyHelp() { if (debug) { throw new RuntimeException("NO BIG ERROR, SORRY"); } else { - System.exit(1); + throw new ExitException(1); } } diff --git a/src/java.desktop/macosx/classes/sun/java2d/MacOSFlags.java b/src/java.desktop/macosx/classes/sun/java2d/MacOSFlags.java index 5e09d39692b9c..37b573a339b25 100644 --- a/src/java.desktop/macosx/classes/sun/java2d/MacOSFlags.java +++ b/src/java.desktop/macosx/classes/sun/java2d/MacOSFlags.java @@ -125,16 +125,7 @@ private static void initJavaFlags() { System.out.println("Could not enable OpenGL pipeline (CGL not available)"); } oglEnabled = false; - metalEnabled = MTLGraphicsConfig.isMetalAvailable(); - } - } else if (metalEnabled && !oglEnabled) { - // Check whether Metal framework is available - if (!MTLGraphicsConfig.isMetalAvailable()) { - if (metalVerbose) { - System.out.println("Could not enable Metal pipeline (Metal framework not available)"); - } - metalEnabled = false; - oglEnabled = CGLGraphicsConfig.isCGLAvailable(); + metalEnabled = true; } } diff --git a/src/java.desktop/macosx/classes/sun/java2d/metal/MTLGraphicsConfig.java b/src/java.desktop/macosx/classes/sun/java2d/metal/MTLGraphicsConfig.java index 64117b8999e19..8a992361b9628 100644 --- a/src/java.desktop/macosx/classes/sun/java2d/metal/MTLGraphicsConfig.java +++ b/src/java.desktop/macosx/classes/sun/java2d/metal/MTLGraphicsConfig.java @@ -72,7 +72,6 @@ public final class MTLGraphicsConfig extends CGraphicsConfig implements AccelGraphicsConfig, SurfaceManager.ProxiedGraphicsConfig { - private static boolean mtlAvailable; private static ImageCapabilities imageCaps = new MTLImageCaps(); @SuppressWarnings("removal") @@ -89,7 +88,6 @@ public final class MTLGraphicsConfig extends CGraphicsConfig private final Object disposerReferent = new Object(); private final int maxTextureSize; - private static native boolean isMetalFrameworkAvailable(); private static native boolean tryLoadMetalLibrary(int displayID, String shaderLib); private static native long getMTLConfigInfo(int displayID, String mtlShadersLib); @@ -99,10 +97,6 @@ public final class MTLGraphicsConfig extends CGraphicsConfig */ private static native int nativeGetMaxTextureSize(); - static { - mtlAvailable = isMetalFrameworkAvailable(); - } - private MTLGraphicsConfig(CGraphicsDevice device, long configInfo, int maxTextureSize, ContextCapabilities mtlCaps) { @@ -133,10 +127,6 @@ public SurfaceData createManagedSurface(int w, int h, int transparency) { public static MTLGraphicsConfig getConfig(CGraphicsDevice device, int displayID) { - if (!mtlAvailable) { - return null; - } - if (!tryLoadMetalLibrary(displayID, mtlShadersLib)) { return null; } @@ -171,10 +161,6 @@ public static MTLGraphicsConfig getConfig(CGraphicsDevice device, return new MTLGraphicsConfig(device, cfginfo, textureSize, caps); } - public static boolean isMetalAvailable() { - return mtlAvailable; - } - /** * Returns true if the provided capability bit is present for this config. * See MTLContext.java for a list of supported capabilities. diff --git a/src/java.desktop/macosx/native/libawt_lwawt/awt/CSystemColors.m b/src/java.desktop/macosx/native/libawt_lwawt/awt/CSystemColors.m index 40ef6e67d0173..1bd767c320b52 100644 --- a/src/java.desktop/macosx/native/libawt_lwawt/awt/CSystemColors.m +++ b/src/java.desktop/macosx/native/libawt_lwawt/awt/CSystemColors.m @@ -96,11 +96,7 @@ + (void)reloadColors { sColors[java_awt_SystemColor_TEXT_INACTIVE_TEXT] = [NSColor disabledControlTextColor]; sColors[java_awt_SystemColor_CONTROL] = [NSColor controlColor]; sColors[java_awt_SystemColor_CONTROL_TEXT] = [NSColor controlTextColor]; - if (@available(macOS 10.14, *)) { - sColors[java_awt_SystemColor_CONTROL_HIGHLIGHT] = [NSColor selectedContentBackgroundColor]; - } else { - sColors[java_awt_SystemColor_CONTROL_HIGHLIGHT] = [NSColor alternateSelectedControlColor]; - } + sColors[java_awt_SystemColor_CONTROL_HIGHLIGHT] = [NSColor selectedContentBackgroundColor]; sColors[java_awt_SystemColor_CONTROL_LT_HIGHLIGHT] = [NSColor alternateSelectedControlTextColor]; sColors[java_awt_SystemColor_CONTROL_SHADOW] = [NSColor controlShadowColor]; sColors[java_awt_SystemColor_CONTROL_DK_SHADOW] = [NSColor controlDarkShadowColor]; @@ -121,11 +117,7 @@ + (void)reloadColors { } // added for JTable Focus Ring - if (@available(macOS 10.14, *)) { - appleColors[sun_lwawt_macosx_LWCToolkit_CELL_HIGHLIGHT_COLOR] = [NSColor controlAccentColor]; - } else { - appleColors[sun_lwawt_macosx_LWCToolkit_CELL_HIGHLIGHT_COLOR] = [NSColor keyboardFocusIndicatorColor]; - } + appleColors[sun_lwawt_macosx_LWCToolkit_CELL_HIGHLIGHT_COLOR] = [NSColor controlAccentColor]; appleColors[sun_lwawt_macosx_LWCToolkit_KEYBOARD_FOCUS_COLOR] = [NSColor keyboardFocusIndicatorColor]; appleColors[sun_lwawt_macosx_LWCToolkit_INACTIVE_SELECTION_BACKGROUND_COLOR] = [NSColor secondarySelectedControlColor]; appleColors[sun_lwawt_macosx_LWCToolkit_INACTIVE_SELECTION_FOREGROUND_COLOR] = [NSColor controlDarkShadowColor]; diff --git a/src/java.desktop/macosx/native/libawt_lwawt/java2d/metal/MTLGraphicsConfig.m b/src/java.desktop/macosx/native/libawt_lwawt/java2d/metal/MTLGraphicsConfig.m index af6662cecf2ab..7b165a668b3a2 100644 --- a/src/java.desktop/macosx/native/libawt_lwawt/java2d/metal/MTLGraphicsConfig.m +++ b/src/java.desktop/macosx/native/libawt_lwawt/java2d/metal/MTLGraphicsConfig.m @@ -54,22 +54,6 @@ free(mtlinfo); } -JNIEXPORT jboolean JNICALL -Java_sun_java2d_metal_MTLGraphicsConfig_isMetalFrameworkAvailable - (JNIEnv *env, jclass mtlgc) -{ - jboolean metalSupported = JNI_FALSE; - - // It is guaranteed that metal supported GPU is available since macOS 10.14 - if (@available(macOS 10.14, *)) { - metalSupported = JNI_TRUE; - } - - J2dRlsTraceLn1(J2D_TRACE_INFO, "MTLGraphicsConfig_isMetalFrameworkAvailable : %d", metalSupported); - - return metalSupported; -} - JNIEXPORT jboolean JNICALL Java_sun_java2d_metal_MTLGraphicsConfig_tryLoadMetalLibrary (JNIEnv *env, jclass mtlgc, jint displayID, jstring shadersLibName) diff --git a/src/java.desktop/share/native/common/font/fontscalerdefs.h b/src/java.desktop/share/native/common/font/fontscalerdefs.h index 520ba406e04c4..4b39146640348 100644 --- a/src/java.desktop/share/native/common/font/fontscalerdefs.h +++ b/src/java.desktop/share/native/common/font/fontscalerdefs.h @@ -103,7 +103,7 @@ typedef struct GlyphInfo { * FileFontStrike logic - presence of context is used as marker to * free the memory. */ -JNIEXPORT int isNullScalerContext(void *context); +int isNullScalerContext(void *context); #ifdef __cplusplus } diff --git a/src/java.desktop/share/native/common/font/sunfontids.h b/src/java.desktop/share/native/common/font/sunfontids.h index 2301f80b5bcbf..5f764e241cb91 100644 --- a/src/java.desktop/share/native/common/font/sunfontids.h +++ b/src/java.desktop/share/native/common/font/sunfontids.h @@ -82,10 +82,7 @@ typedef struct FontManagerNativeIDs { glyphImages, glyphListUsePos, glyphListPos, lcdRGBOrder, lcdSubPixPos; } FontManagerNativeIDs; -/* Note: we share variable in the context of fontmanager lib - but we need access method to use it from separate rasterizer lib */ extern FontManagerNativeIDs sunFontIDs; -JNIEXPORT FontManagerNativeIDs getSunFontIDs(JNIEnv* env); #ifdef __cplusplus } diff --git a/src/java.desktop/share/native/libawt/awt/image/imageInitIDs.h b/src/java.desktop/share/native/libawt/awt/image/imageInitIDs.h index 031d133edaebd..62c52450f552e 100644 --- a/src/java.desktop/share/native/libawt/awt/image/imageInitIDs.h +++ b/src/java.desktop/share/native/libawt/awt/image/imageInitIDs.h @@ -74,7 +74,6 @@ IMGEXTERN jfieldID g_ICRdataOffsetsID; IMGEXTERN jfieldID g_ICRtypeID; /* Color Model ids */ -JNIEXPORT IMGEXTERN jfieldID g_CMnBitsID; IMGEXTERN jfieldID g_CMcspaceID; IMGEXTERN jfieldID g_CMnumComponentsID; diff --git a/src/java.desktop/share/native/libawt/java2d/SurfaceData.c b/src/java.desktop/share/native/libawt/java2d/SurfaceData.c index ffff2bd09b48c..4d96a2d3ff40d 100644 --- a/src/java.desktop/share/native/libawt/java2d/SurfaceData.c +++ b/src/java.desktop/share/native/libawt/java2d/SurfaceData.c @@ -139,13 +139,13 @@ SurfaceData_GetOps(JNIEnv *env, jobject sData) return GetSDOps(env, sData, JNI_TRUE); } -JNIEXPORT SurfaceDataOps * JNICALL +SurfaceDataOps * SurfaceData_GetOpsNoSetup(JNIEnv *env, jobject sData) { return GetSDOps(env, sData, JNI_FALSE); } -JNIEXPORT void JNICALL +void SurfaceData_SetOps(JNIEnv *env, jobject sData, SurfaceDataOps *ops) { if (JNU_GetLongFieldAsPtr(env, sData, pDataID) == NULL) { diff --git a/src/java.desktop/share/native/libawt/java2d/SurfaceData.h b/src/java.desktop/share/native/libawt/java2d/SurfaceData.h index 745fd012e8655..c4eae3c19aa78 100644 --- a/src/java.desktop/share/native/libawt/java2d/SurfaceData.h +++ b/src/java.desktop/share/native/libawt/java2d/SurfaceData.h @@ -553,7 +553,7 @@ SurfaceData_GetOps(JNIEnv *env, jobject sData); * Does the same as the above, but doesn't call Setup function * even if it's set. */ -JNIEXPORT SurfaceDataOps * JNICALL +SurfaceDataOps * SurfaceData_GetOpsNoSetup(JNIEnv *env, jobject sData); /* @@ -569,7 +569,7 @@ SurfaceData_GetOpsNoSetup(JNIEnv *env, jobject sData); * is called since this function will not leave any outstanding * JNI Critical locks unreleased. */ -JNIEXPORT void JNICALL +void SurfaceData_SetOps(JNIEnv *env, jobject sData, SurfaceDataOps *ops); /* diff --git a/src/java.desktop/share/native/libawt/java2d/Trace.c b/src/java.desktop/share/native/libawt/java2d/Trace.c index bba31f8b837f7..a2783a9b64c6d 100644 --- a/src/java.desktop/share/native/libawt/java2d/Trace.c +++ b/src/java.desktop/share/native/libawt/java2d/Trace.c @@ -31,6 +31,9 @@ static int j2dTraceLevel = J2D_TRACE_INVALID; static FILE *j2dTraceFile = NULL; +static void +J2dTraceInit(); + JNIEXPORT void JNICALL J2dTraceImpl(int level, jboolean cr, const char *string, ...) { @@ -72,7 +75,7 @@ J2dTraceImpl(int level, jboolean cr, const char *string, ...) } } -JNIEXPORT void JNICALL +static void J2dTraceInit() { char *j2dTraceLevelString = getenv("J2D_TRACE_LEVEL"); diff --git a/src/java.desktop/share/native/libawt/java2d/Trace.h b/src/java.desktop/share/native/libawt/java2d/Trace.h index 322c63b0a60a6..b4fe41f77b02b 100644 --- a/src/java.desktop/share/native/libawt/java2d/Trace.h +++ b/src/java.desktop/share/native/libawt/java2d/Trace.h @@ -52,8 +52,6 @@ extern "C" { JNIEXPORT void JNICALL J2dTraceImpl(int level, jboolean cr, const char *string, ...); -JNIEXPORT void JNICALL -J2dTraceInit(); #ifndef DEBUG #define J2dTrace(level, string) diff --git a/src/java.desktop/share/native/libawt/java2d/loops/GraphicsPrimitiveMgr.c b/src/java.desktop/share/native/libawt/java2d/loops/GraphicsPrimitiveMgr.c index cb0dafe3dbcee..3ff40a4ef4ddc 100644 --- a/src/java.desktop/share/native/libawt/java2d/loops/GraphicsPrimitiveMgr.c +++ b/src/java.desktop/share/native/libawt/java2d/loops/GraphicsPrimitiveMgr.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2023, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -470,7 +470,7 @@ GrPrim_Sg2dGetCompInfo(JNIEnv *env, jobject sg2d, (*env)->DeleteLocalRef(env, comp); } -JNIEXPORT jint JNICALL +jint GrPrim_CompGetXorColor(JNIEnv *env, jobject comp) { jobject color; @@ -511,7 +511,7 @@ GrPrim_Sg2dGetLCDTextContrast(JNIEnv *env, jobject sg2d) /* * Helper function for CompositeTypes.Xor */ -JNIEXPORT void JNICALL +static void JNICALL GrPrim_CompGetXorInfo(JNIEnv *env, CompositeInfo *pCompInfo, jobject comp) { pCompInfo->rule = RULE_Xor; @@ -522,7 +522,7 @@ GrPrim_CompGetXorInfo(JNIEnv *env, CompositeInfo *pCompInfo, jobject comp) /* * Helper function for CompositeTypes.AnyAlpha */ -JNIEXPORT void JNICALL +static void JNICALL GrPrim_CompGetAlphaInfo(JNIEnv *env, CompositeInfo *pCompInfo, jobject comp) { pCompInfo->rule = @@ -531,7 +531,7 @@ GrPrim_CompGetAlphaInfo(JNIEnv *env, CompositeInfo *pCompInfo, jobject comp) (*env)->GetFloatField(env, comp, extraAlphaID); } -JNIEXPORT void JNICALL +void Transform_GetInfo(JNIEnv *env, jobject txform, TransformInfo *pTxInfo) { pTxInfo->dxdx = (*env)->GetDoubleField(env, txform, m00ID); @@ -542,7 +542,7 @@ Transform_GetInfo(JNIEnv *env, jobject txform, TransformInfo *pTxInfo) pTxInfo->ty = (*env)->GetDoubleField(env, txform, m12ID); } -JNIEXPORT void JNICALL +void Transform_transform(TransformInfo *pTxInfo, jdouble *pX, jdouble *pY) { jdouble x = *pX; diff --git a/src/java.desktop/share/native/libawt/java2d/loops/GraphicsPrimitiveMgr.h b/src/java.desktop/share/native/libawt/java2d/loops/GraphicsPrimitiveMgr.h index 3ba7574a0d5dd..c3a42eee5394e 100644 --- a/src/java.desktop/share/native/libawt/java2d/loops/GraphicsPrimitiveMgr.h +++ b/src/java.desktop/share/native/libawt/java2d/loops/GraphicsPrimitiveMgr.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2023, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -510,12 +510,8 @@ extern JNIEXPORT void JNICALL GrPrim_Sg2dGetCompInfo(JNIEnv *env, jobject sg2d, NativePrimitive *pPrim, CompositeInfo *pCompInfo); -extern JNIEXPORT jint JNICALL +extern jint GrPrim_CompGetXorColor(JNIEnv *env, jobject comp); -extern JNIEXPORT void JNICALL -GrPrim_CompGetXorInfo(JNIEnv *env, CompositeInfo *pCompInfo, jobject comp); -extern JNIEXPORT void JNICALL -GrPrim_CompGetAlphaInfo(JNIEnv *env, CompositeInfo *pCompInfo, jobject comp); extern JNIEXPORT void JNICALL GrPrim_Sg2dGetClip(JNIEnv *env, jobject sg2d, @@ -541,9 +537,9 @@ typedef struct { jdouble ty; } TransformInfo; -extern JNIEXPORT void JNICALL +extern void Transform_GetInfo(JNIEnv *env, jobject txform, TransformInfo *pTxInfo); -extern JNIEXPORT void JNICALL +extern void Transform_transform(TransformInfo *pTxInfo, jdouble *pX, jdouble *pY); void GrPrim_RefineBounds(SurfaceDataBounds *bounds, jint transX, jint transY, diff --git a/src/java.desktop/share/native/libfontmanager/sunFont.c b/src/java.desktop/share/native/libfontmanager/sunFont.c index 661dccae0c5c6..0461d61c26cf4 100644 --- a/src/java.desktop/share/native/libfontmanager/sunFont.c +++ b/src/java.desktop/share/native/libfontmanager/sunFont.c @@ -201,12 +201,6 @@ Java_sun_font_SunFontManager_initIDs initFontIDs(env); } -JNIEXPORT FontManagerNativeIDs getSunFontIDs(JNIEnv *env) { - - initFontIDs(env); - return sunFontIDs; -} - /* * Class: sun_font_StrikeCache * Method: freeIntPointer diff --git a/src/java.desktop/unix/native/common/awt/X11Color.c b/src/java.desktop/unix/native/common/awt/X11Color.c index b754f77537c44..b1602bb5ae41b 100644 --- a/src/java.desktop/unix/native/common/awt/X11Color.c +++ b/src/java.desktop/unix/native/common/awt/X11Color.c @@ -1230,8 +1230,6 @@ jobject awtJNI_GetColorModel(JNIEnv *env, AwtGraphicsConfigDataPtr aData) } #endif /* !HEADLESS */ -extern jfieldID colorValueID; - #ifndef HEADLESS void awt_allocate_systemrgbcolors (jint *rgbColors, int num_colors, diff --git a/src/java.desktop/unix/native/common/java2d/x11/X11SurfaceData.c b/src/java.desktop/unix/native/common/java2d/x11/X11SurfaceData.c index 1be65e546cab7..36d6feb6029a7 100644 --- a/src/java.desktop/unix/native/common/java2d/x11/X11SurfaceData.c +++ b/src/java.desktop/unix/native/common/java2d/x11/X11SurfaceData.c @@ -291,7 +291,7 @@ Java_sun_java2d_x11_XSurfaceData_flushNativeSurface(JNIEnv *env, jobject xsd) } -JNIEXPORT X11SDOps * JNICALL +X11SDOps * X11SurfaceData_GetOps(JNIEnv *env, jobject sData) { #ifdef HEADLESS diff --git a/src/java.desktop/unix/native/common/java2d/x11/X11SurfaceData.h b/src/java.desktop/unix/native/common/java2d/x11/X11SurfaceData.h index 66022f2426edd..860c45f7fb0ae 100644 --- a/src/java.desktop/unix/native/common/java2d/x11/X11SurfaceData.h +++ b/src/java.desktop/unix/native/common/java2d/x11/X11SurfaceData.h @@ -163,5 +163,5 @@ jboolean XShared_initSurface(JNIEnv *env, X11SDOps *xsdo, jint depth, jint width * is called since this function will not leave any outstanding * JNI Critical locks unreleased. */ -JNIEXPORT X11SDOps * JNICALL +X11SDOps * X11SurfaceData_GetOps(JNIEnv *env, jobject sData); diff --git a/src/java.desktop/unix/native/libawt/awt/initIDs.c b/src/java.desktop/unix/native/libawt/awt/initIDs.c index c5a8c0ea58db9..d1c24c76af6d1 100644 --- a/src/java.desktop/unix/native/libawt/awt/initIDs.c +++ b/src/java.desktop/unix/native/libawt/awt/initIDs.c @@ -40,13 +40,10 @@ * which are used in the win32 awt. */ -JNIEXPORT jfieldID colorValueID; - JNIEXPORT void JNICALL Java_java_awt_Color_initIDs (JNIEnv *env, jclass clazz) { - colorValueID = (*env)->GetFieldID(env, clazz, "value", "I"); } JNIEXPORT void JNICALL diff --git a/src/java.desktop/windows/native/libawt/java2d/windows/GDIWindowSurfaceData.cpp b/src/java.desktop/windows/native/libawt/java2d/windows/GDIWindowSurfaceData.cpp index 77528dc333069..6dae331f88f64 100644 --- a/src/java.desktop/windows/native/libawt/java2d/windows/GDIWindowSurfaceData.cpp +++ b/src/java.desktop/windows/native/libawt/java2d/windows/GDIWindowSurfaceData.cpp @@ -471,7 +471,7 @@ Java_sun_java2d_windows_GDIWindowSurfaceData_initOps(JNIEnv *env, jobject wsd, wsdo->bmCopyToScreen = FALSE; } -JNIEXPORT GDIWinSDOps * JNICALL +GDIWinSDOps * GDIWindowSurfaceData_GetOps(JNIEnv *env, jobject sData) { SurfaceDataOps *ops = SurfaceData_GetOps(env, sData); @@ -484,7 +484,7 @@ GDIWindowSurfaceData_GetOps(JNIEnv *env, jobject sData) return (GDIWinSDOps *) ops; } -JNIEXPORT GDIWinSDOps * JNICALL +GDIWinSDOps * GDIWindowSurfaceData_GetOpsNoSetup(JNIEnv *env, jobject sData) { // use the 'no setup' version of GetOps @@ -492,7 +492,7 @@ GDIWindowSurfaceData_GetOpsNoSetup(JNIEnv *env, jobject sData) return (GDIWinSDOps *) ops; } -JNIEXPORT AwtComponent * JNICALL +AwtComponent * GDIWindowSurfaceData_GetComp(JNIEnv *env, GDIWinSDOps *wsdo) { PDATA pData = NULL; @@ -524,7 +524,7 @@ GDIWindowSurfaceData_GetComp(JNIEnv *env, GDIWinSDOps *wsdo) return static_cast(pData); } -JNIEXPORT HWND JNICALL +HWND GDIWindowSurfaceData_GetWindow(JNIEnv *env, GDIWinSDOps *wsdo) { HWND window = wsdo->window; @@ -1019,7 +1019,7 @@ static HDC GDIWinSD_GetDC(JNIEnv *env, GDIWinSDOps *wsdo, return env->ExceptionCheck() ? (HDC)NULL : info->hDC; } -JNIEXPORT void JNICALL +void GDIWinSD_InitDC(JNIEnv *env, GDIWinSDOps *wsdo, ThreadGraphicsInfo *info, jint type, jint *patrop, jobject clip, jobject comp, jint color) diff --git a/src/java.desktop/windows/native/libawt/java2d/windows/GDIWindowSurfaceData.h b/src/java.desktop/windows/native/libawt/java2d/windows/GDIWindowSurfaceData.h index 2825d495e0407..830ada4335894 100644 --- a/src/java.desktop/windows/native/libawt/java2d/windows/GDIWindowSurfaceData.h +++ b/src/java.desktop/windows/native/libawt/java2d/windows/GDIWindowSurfaceData.h @@ -236,21 +236,21 @@ typedef struct { * is called since this function will not leave any outstanding * JNI Critical locks unreleased. */ -JNIEXPORT GDIWinSDOps * JNICALL +GDIWinSDOps * GDIWindowSurfaceData_GetOps(JNIEnv *env, jobject sData); -JNIEXPORT GDIWinSDOps * JNICALL +GDIWinSDOps * GDIWindowSurfaceData_GetOpsNoSetup(JNIEnv *env, jobject sData); -JNIEXPORT HWND JNICALL +HWND GDIWindowSurfaceData_GetWindow(JNIEnv *env, GDIWinSDOps *wsdo); -JNIEXPORT void JNICALL +void GDIWinSD_InitDC(JNIEnv *env, GDIWinSDOps *wsdo, ThreadGraphicsInfo *info, jint type, jint *patrop, jobject clip, jobject comp, jint color); -JNIEXPORT AwtComponent * JNICALL +AwtComponent * GDIWindowSurfaceData_GetComp(JNIEnv *env, GDIWinSDOps *wsdo); } /* extern "C" */ diff --git a/src/java.desktop/windows/native/libawt/windows/awt_Mlib.h b/src/java.desktop/windows/native/libawt/windows/awt_Mlib.h index db0406245a639..55099bf369888 100644 --- a/src/java.desktop/windows/native/libawt/windows/awt_Mlib.h +++ b/src/java.desktop/windows/native/libawt/windows/awt_Mlib.h @@ -34,10 +34,10 @@ extern "C" { typedef void (*mlib_start_timer)(int); typedef void (*mlib_stop_timer)(int, int); -JNIEXPORT mlib_status awt_getImagingLib(JNIEnv *env, mlibFnS_t *sMlibFns, +mlib_status awt_getImagingLib(JNIEnv *env, mlibFnS_t *sMlibFns, mlibSysFnS_t *sMlibSysFns); -JNIEXPORT mlib_start_timer awt_setMlibStartTimer(); -JNIEXPORT mlib_stop_timer awt_setMlibStopTimer(); +mlib_start_timer awt_setMlibStartTimer(); +mlib_stop_timer awt_setMlibStopTimer(); #ifdef __cplusplus } /* end of extern "C" */ diff --git a/src/java.security.jgss/windows/classes/sun/security/krb5/internal/tools/Kinit.java b/src/java.security.jgss/windows/classes/sun/security/krb5/internal/tools/Kinit.java index 813939643c3cf..a14ece6ee0e02 100644 --- a/src/java.security.jgss/windows/classes/sun/security/krb5/internal/tools/Kinit.java +++ b/src/java.security.jgss/windows/classes/sun/security/krb5/internal/tools/Kinit.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2023, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -92,14 +92,44 @@ public class Kinit { */ public static void main(String[] args) { - try { - Kinit self = new Kinit(args); + Kinit kinit = new Kinit(); + int exitCode = kinit.run(args); + if (exitCode != 0) { + System.exit(exitCode); } - catch (Exception e) { - String msg = null; - if (e instanceof KrbException) { - msg = ((KrbException)e).krbErrorMessage() + " " + - ((KrbException)e).returnCodeMessage(); + } + + /** + * Run the Kinit command. + * @param args array of ticket request options. + * Available options are: -f, -p, -c, principal, password. + * @return the exit code + */ + public int run(String[] args) { + try { + if (args == null || args.length == 0) { + options = new KinitOptions(); + } else { + options = new KinitOptions(args); + } + switch (options.action) { + case 0: + // Help, already displayed in new KinitOptions(). + break; + case 1: + acquire(); + break; + case 2: + renew(); + break; + default: + throw new KrbException("kinit does not support action " + + options.action); + } + } catch (Exception e) { + String msg; + if (e instanceof KrbException ke) { + msg = ke.krbErrorMessage() + " " + ke.returnCodeMessage(); } else { msg = e.getMessage(); } @@ -109,37 +139,9 @@ public static void main(String[] args) { System.out.println("Exception: " + e); } e.printStackTrace(); - System.exit(-1); - } - return; - } - - /** - * Constructs a new Kinit object. - * @param args array of ticket request options. - * Available options are: -f, -p, -c, principal, password. - * @exception IOException if an I/O error occurs. - * @exception RealmException if the Realm could not be instantiated. - * @exception KrbException if error occurs during Kerberos operation. - */ - private Kinit(String[] args) - throws IOException, RealmException, KrbException { - if (args == null || args.length == 0) { - options = new KinitOptions(); - } else { - options = new KinitOptions(args); - } - switch (options.action) { - case 1: - acquire(); - break; - case 2: - renew(); - break; - default: - throw new KrbException("kinit does not support action " - + options.action); + return -1; } + return 0; } private void renew() diff --git a/src/java.security.jgss/windows/classes/sun/security/krb5/internal/tools/KinitOptions.java b/src/java.security.jgss/windows/classes/sun/security/krb5/internal/tools/KinitOptions.java index 5cfc574d95acf..445b806bb50cf 100644 --- a/src/java.security.jgss/windows/classes/sun/security/krb5/internal/tools/KinitOptions.java +++ b/src/java.security.jgss/windows/classes/sun/security/krb5/internal/tools/KinitOptions.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2023, Oracle and/or its affiliates. All rights reserved. * 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,7 +46,7 @@ */ class KinitOptions { - // 1. acquire, 2. renew, 3. validate + // 0. Help, 1. acquire, 2. renew, 3. validate public int action = 1; // forwardable and proxiable flags have two states: @@ -143,7 +143,8 @@ public KinitOptions(String[] args) // -help: legacy. args[i].equalsIgnoreCase("-help")) { printHelp(); - System.exit(0); + action = 0; + return; } else if (p == null) { // Haven't yet processed a "principal" p = args[i]; try { diff --git a/src/java.security.jgss/windows/classes/sun/security/krb5/internal/tools/Klist.java b/src/java.security.jgss/windows/classes/sun/security/krb5/internal/tools/Klist.java index 5a0c3bee0776e..16c9fd99ec406 100644 --- a/src/java.security.jgss/windows/classes/sun/security/krb5/internal/tools/Klist.java +++ b/src/java.security.jgss/windows/classes/sun/security/krb5/internal/tools/Klist.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2023, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -78,115 +78,111 @@ public class Klist { */ public static void main(String[] args) { Klist klist = new Klist(); + int exitCode = klist.run(args); + if (exitCode != 0) { + System.exit(exitCode); + } + } + + public int run(String[] args) { if ((args == null) || (args.length == 0)) { - klist.action = 'c'; // default will list default credentials cache. + action = 'c'; // default will list default credentials cache. } else { - klist.processArgs(args); + Character arg; + for (int i = 0; i < args.length; i++) { + if (args[i].equals("-?") || + args[i].equals("-h") || + args[i].equals("--help")) { + printHelp(); + return 0; + } + if ((args[i].length() >= 2) && (args[i].startsWith("-"))) { + arg = Character.valueOf(args[i].charAt(1)); + switch (arg.charValue()) { + case 'c': + action = 'c'; + break; + case 'k': + action = 'k'; + break; + case 'a': + options[2] = 'a'; + break; + case 'n': + options[3] = 'n'; + break; + case 'f': + options[1] = 'f'; + break; + case 'e': + options[0] = 'e'; + break; + case 'K': + options[1] = 'K'; + break; + case 't': + options[2] = 't'; + break; + default: + System.out.println("Invalid argument: " + args[i]); + printHelp(); + return -1; + } + } else { + if (!args[i].startsWith("-") && (i == args.length - 1)) { + // the argument is the last one. + name = args[i]; + } else { + System.out.println("Invalid argument: " + args[i]); + printHelp(); // incorrect input format. + return -1; + } + } + } } - switch (klist.action) { + switch (action) { case 'c': - if (klist.name == null) { - klist.target = CredentialsCache.getInstance(); - klist.name = CredentialsCache.cacheName(); + if (name == null) { + target = CredentialsCache.getInstance(); + name = CredentialsCache.cacheName(); } else - klist.target = CredentialsCache.getInstance(klist.name); + target = CredentialsCache.getInstance(name); - if (klist.target != null) { - klist.displayCache(); + if (target != null) { + return displayCache(); } else { - klist.displayMessage("Credentials cache"); - System.exit(-1); + return displayError("Credentials cache"); } - break; case 'k': - KeyTab ktab = KeyTab.getInstance(klist.name); + KeyTab ktab = KeyTab.getInstance(name); if (ktab.isMissing()) { - System.out.println("KeyTab " + klist.name + " not found."); - System.exit(-1); + System.out.println("KeyTab " + name + " not found."); + return -1; } else if (!ktab.isValid()) { - System.out.println("KeyTab " + klist.name + System.out.println("KeyTab " + name + " format not supported."); - System.exit(-1); + return -1; } - klist.target = ktab; - klist.name = ktab.tabName(); - klist.displayTab(); - break; + target = ktab; + name = ktab.tabName(); + return displayTab(); default: - if (klist.name != null) { - klist.printHelp(); - System.exit(-1); - } else { - klist.target = CredentialsCache.getInstance(); - klist.name = CredentialsCache.cacheName(); - if (klist.target != null) { - klist.displayCache(); - } else { - klist.displayMessage("Credentials cache"); - System.exit(-1); - } - } - } - } - - /** - * Parses the command line arguments. - */ - void processArgs(String[] args) { - Character arg; - for (int i = 0; i < args.length; i++) { - if (args[i].equals("-?") || - args[i].equals("-h") || - args[i].equals("--help")) { + if (name != null) { printHelp(); - System.exit(0); - } - if ((args[i].length() >= 2) && (args[i].startsWith("-"))) { - arg = Character.valueOf(args[i].charAt(1)); - switch (arg.charValue()) { - case 'c': - action = 'c'; - break; - case 'k': - action = 'k'; - break; - case 'a': - options[2] = 'a'; - break; - case 'n': - options[3] = 'n'; - break; - case 'f': - options[1] = 'f'; - break; - case 'e': - options[0] = 'e'; - break; - case 'K': - options[1] = 'K'; - break; - case 't': - options[2] = 't'; - break; - default: - printHelp(); - System.exit(-1); - } - + return -1; } else { - if (!args[i].startsWith("-") && (i == args.length - 1)) { - // the argument is the last one. - name = args[i]; - arg = null; + target = CredentialsCache.getInstance(); + name = CredentialsCache.cacheName(); + if (target != null) { + return displayCache(); } else { - printHelp(); // incorrect input format. - System.exit(-1); + return displayError("Credentials cache"); } } } } - void displayTab() { + int displayTab() { KeyTab table = (KeyTab)target; KeyTabEntry[] entries = table.getEntries(); if (entries.length == 0) { @@ -201,7 +197,7 @@ void displayTab() { entries.length + " entries found.\n"); for (int i = 0; i < entries.length; i++) { System.out.println("[" + (i + 1) + "] " + - "Service principal: " + + "Service principal: " + entries[i].getService().toString()); System.out.println("\t KVNO: " + entries[i].getKey().getKeyVersionNumber()); @@ -221,18 +217,19 @@ void displayTab() { } } } + return 0; } - void displayCache() { + int displayCache() { CredentialsCache cache = (CredentialsCache)target; sun.security.krb5.internal.ccache.Credentials[] creds = cache.getCredsList(); if (creds == null) { System.out.println ("No credentials available in the cache " + name); - System.exit(-1); + return -1; } - System.out.println("\nCredentials cache: " + name); + System.out.println("\nCredentials cache: " + name); String defaultPrincipal = cache.getPrimaryPrincipal().toString(); int num = creds.length; @@ -327,7 +324,7 @@ void displayCache() { if (DEBUG) { e.printStackTrace(); } - System.exit(-1); + return -1; } } } else { @@ -342,14 +339,17 @@ void displayCache() { System.out.println(" " + e); } } + + return 0; } - void displayMessage(String target) { + int displayError(String target) { if (name == null) { System.out.println("Default " + target + " not found."); } else { System.out.println(target + " " + name + " not found."); } + return -1; } /** * Reformats the date from the form - @@ -359,7 +359,7 @@ void displayMessage(String target) { * the day, mm is the minute within the hour, * ss is the second within the minute, zzz is the time zone, * and yyyy is the year. - * @param date the string form of Date object. + * @param kt the string form of Date object. */ private String format(KerberosTime kt) { String date = kt.toDate().toString(); diff --git a/src/java.security.jgss/windows/classes/sun/security/krb5/internal/tools/Ktab.java b/src/java.security.jgss/windows/classes/sun/security/krb5/internal/tools/Ktab.java index df12b2d6c11dd..21002f3369a03 100644 --- a/src/java.security.jgss/windows/classes/sun/security/krb5/internal/tools/Ktab.java +++ b/src/java.security.jgss/windows/classes/sun/security/krb5/internal/tools/Ktab.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2023, Oracle and/or its affiliates. All rights reserved. * 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,52 +73,76 @@ public class Ktab { */ public static void main(String[] args) { Ktab ktab = new Ktab(); + int exitCode = ktab.run(args); + if (exitCode != 0) { + System.exit(exitCode); + } + } + + private static class ExitException extends RuntimeException { + @java.io.Serial + static final long serialVersionUID = 0L; + private final int errorCode; + public ExitException(int errorCode) { + this.errorCode = errorCode; + } + } + + public int run(String[] args) { + try { + run0(args); + return 0; + } catch (ExitException ee) { + return ee.errorCode; + } + } + + private void run0(String[] args) throws ExitException { if ((args.length == 1) && ((args[0].equalsIgnoreCase("-?")) || (args[0].equalsIgnoreCase("-h")) || (args[0].equalsIgnoreCase("--help")) || // -help: legacy. (args[0].equalsIgnoreCase("-help")))) { - ktab.printHelp(); - System.exit(0); + printHelp(); return; } else if ((args == null) || (args.length == 0)) { - ktab.action = 'l'; + action = 'l'; } else { - ktab.processArgs(args); + processArgs(args); } - ktab.table = KeyTab.getInstance(ktab.name); - if (ktab.table.isMissing() && ktab.action != 'a') { - if (ktab.name == null) { + table = KeyTab.getInstance(name); + if (table.isMissing() && action != 'a') { + if (name == null) { System.out.println("No default key table exists."); } else { System.out.println("Key table " + - ktab.name + " does not exist."); + name + " does not exist."); } - System.exit(-1); + throw new ExitException(-1); } - if (!ktab.table.isValid()) { - if (ktab.name == null) { + if (!table.isValid()) { + if (name == null) { System.out.println("The format of the default key table " + " is incorrect."); } else { System.out.println("The format of key table " + - ktab.name + " is incorrect."); + name + " is incorrect."); } - System.exit(-1); + throw new ExitException(-1); } - switch (ktab.action) { + switch (action) { case 'l': - ktab.listKt(); + listKt(); break; case 'a': - ktab.addEntry(); + addEntry(); break; case 'd': - ktab.deleteEntry(); + deleteEntry(); break; default: - ktab.error("A command must be provided"); + error("A command must be provided"); } } @@ -267,7 +291,7 @@ void processArgs(String[] args) { void addEntry() { if (salt != null && fopt) { System.err.println("-s and -f cannot coexist when adding a keytab entry."); - System.exit(-1); + throw new ExitException(-1); } PrincipalName pname = null; try { @@ -276,7 +300,7 @@ void addEntry() { System.err.println("Failed to add " + principal + " to keytab."); e.printStackTrace(); - System.exit(-1); + throw new ExitException(-1); } if (password == null) { try { @@ -288,7 +312,7 @@ void addEntry() { } catch (IOException e) { System.err.println("Failed to read the password."); e.printStackTrace(); - System.exit(-1); + throw new ExitException(-1); } } @@ -313,11 +337,11 @@ void addEntry() { } catch (KrbException e) { System.err.println("Failed to add " + principal + " to keytab."); e.printStackTrace(); - System.exit(-1); + throw new ExitException(-1); } catch (IOException e) { System.err.println("Failed to save new entry."); e.printStackTrace(); - System.exit(-1); + throw new ExitException(-1); } } @@ -399,22 +423,23 @@ void deleteEntry() { System.out.flush(); answer = cis.readLine(); if (answer.equalsIgnoreCase("Y") || - answer.equalsIgnoreCase("Yes")); - else { + answer.equalsIgnoreCase("Yes")) { + ; + } else { // no error, the user did not want to delete the entry - System.exit(0); + return; } } } catch (KrbException e) { System.err.println("Error occurred while deleting the entry. "+ "Deletion failed."); e.printStackTrace(); - System.exit(-1); + throw new ExitException(-1); } catch (IOException e) { System.err.println("Error occurred while deleting the entry. "+ " Deletion failed."); e.printStackTrace(); - System.exit(-1); + throw new ExitException(-1); } int count = table.deleteEntries(pname, etype, vDel); @@ -422,7 +447,7 @@ void deleteEntry() { if (count == 0) { System.err.println("No matched entry in the keytab. " + "Deletion fails."); - System.exit(-1); + throw new ExitException(-1); } else { try { table.save(); @@ -430,7 +455,7 @@ void deleteEntry() { System.err.println("Error occurs while saving the keytab. " + "Deletion fails."); e.printStackTrace(); - System.exit(-1); + throw new ExitException(-1); } System.out.println("Done! " + count + " entries removed."); } @@ -441,7 +466,7 @@ void error(String... errors) { System.out.println("Error: " + error + "."); } printHelp(); - System.exit(-1); + throw new ExitException(-1); } /** diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java index 295bb192a4288..ab84d372bd72d 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java @@ -3605,6 +3605,18 @@ ReferenceKind referenceKind(Symbol sym) { ReferenceKind.BOUND; } } + + @Override + Symbol access(Env env, DiagnosticPosition pos, Symbol location, Symbol sym) { + if (originalSite.hasTag(TYPEVAR) && sym.kind == MTH) { + sym = (sym.flags() & Flags.PRIVATE) != 0 ? + new AccessError(env, site, sym) : + sym; + return accessBase(sym, pos, location, originalSite, name, true); + } else { + return super.access(env, pos, location, sym); + } + } } /** 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 117fea688c71b..ed2c9be854310 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 @@ -135,7 +135,19 @@ public class Main { // This is the entry that get launched by the security tool jarsigner. public static void main(String args[]) throws Exception { Main js = new Main(); - js.run(args); + int exitCode = js.run(args); + if (exitCode != 0) { + System.exit(exitCode); + } + } + + private static class ExitException extends RuntimeException { + @java.io.Serial + static final long serialVersionUID = 0L; + private final int errorCode; + public ExitException(int errorCode) { + this.errorCode = errorCode; + } } X509Certificate[] certChain; // signer's cert chain (when composing) @@ -230,13 +242,13 @@ public static void main(String args[]) throws Exception { PKIXBuilderParameters pkixParameters; Set trustedCerts = new HashSet<>(); - public void run(String args[]) { + public int run(String args[]) { try { - args = parseArgs(args); + parseArgs(args); // Try to load and install the specified providers if (providers != null) { - for (String provName: providers) { + for (String provName : providers) { try { KeyStoreUtil.loadProviderByName(provName, providerArgs.get(provName)); @@ -263,7 +275,7 @@ public void run(String args[]) { } else { cl = ClassLoader.getSystemClassLoader(); } - for (String provClass: providerClasses) { + for (String provClass : providerClasses) { try { KeyStoreUtil.loadProviderByClass(provClass, providerArgs.get(provClass), cl); @@ -285,19 +297,9 @@ public void run(String args[]) { loadKeyStore(keystore, false); } catch (Exception e) { if ((keystore != null) || (storepass != null)) { - System.out.println(rb.getString("jarsigner.error.") + - e.getMessage()); - if (debug) { - e.printStackTrace(); - } - System.exit(1); + throw e; } } - /* if (debug) { - SignatureFileVerifier.setDebug(true); - ManifestEntryVerifier.setDebug(true); - } - */ verifyJar(jarfile); } else { loadKeyStore(keystore, true); @@ -305,12 +307,14 @@ public void run(String args[]) { signJar(jarfile, alias); } + } catch (ExitException ee) { + return ee.errorCode; } catch (Exception e) { System.out.println(rb.getString("jarsigner.error.") + e); if (debug) { e.printStackTrace(); } - System.exit(1); + return 1; } finally { // zero-out private key password if (keypass != null) { @@ -343,10 +347,10 @@ public void run(String args[]) { if (tsaChainNotValidated) { exitCode |= 64; } - if (exitCode != 0) { - System.exit(exitCode); - } + return exitCode; } + + return 0; } /* @@ -612,12 +616,12 @@ static void usageNoArg() { static void usage() { System.out.println(); System.out.println(rb.getString("Please.type.jarsigner.help.for.usage")); - System.exit(1); + throw new ExitException(1); } static void doPrintVersion() { System.out.println("jarsigner " + System.getProperty("java.version")); - System.exit(0); + throw new ExitException(0); } static void fullusage() { @@ -719,7 +723,7 @@ static void fullusage() { (".print.this.help.message")); System.out.println(); - System.exit(0); + throw new ExitException(0); } void verifyJar(String jarName) @@ -1105,19 +1109,11 @@ void verifyJar(String jarName) } else { displayMessagesAndResult(false); } - return; - } catch (Exception e) { - System.out.println(rb.getString("jarsigner.") + e); - if (debug) { - e.printStackTrace(); - } } finally { // close the resource if (jf != null) { jf.close(); } } - - System.exit(1); } private void displayMessagesAndResult(boolean isSigning) { @@ -2469,7 +2465,7 @@ void getAliasInfo(String alias) throws Exception { void error(String message) { System.out.println(rb.getString("jarsigner.")+message); - System.exit(1); + throw new ExitException(1); } @@ -2478,7 +2474,7 @@ void error(String message, Throwable e) { if (debug) { e.printStackTrace(); } - System.exit(1); + throw new ExitException(1); } /** diff --git a/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacAppBundler.java b/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacAppBundler.java index cf031cb47a5ee..06796db98847a 100644 --- a/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacAppBundler.java +++ b/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacAppBundler.java @@ -85,6 +85,13 @@ public MacAppBundler() { }, (s, p) -> s); + public static final BundlerParamInfo APP_IMAGE_SIGN_IDENTITY = + new StandardBundlerParam<>( + Arguments.CLIOptions.MAC_APP_IMAGE_SIGN_IDENTITY.getId(), + String.class, + params -> "", + null); + public static final BundlerParamInfo BUNDLE_ID_SIGNING_PREFIX = new StandardBundlerParam<>( Arguments.CLIOptions.MAC_BUNDLE_SIGNING_PREFIX.getId(), @@ -127,14 +134,21 @@ private static void doValidate(Map params) // reject explicitly set sign to true and no valid signature key if (Optional.ofNullable( SIGN_BUNDLE.fetchFrom(params)).orElse(Boolean.FALSE)) { - String signingIdentity = - DEVELOPER_ID_APP_SIGNING_KEY.fetchFrom(params); - if (signingIdentity == null) { - throw new ConfigException( - I18N.getString("error.explicit-sign-no-cert"), - I18N.getString("error.explicit-sign-no-cert.advice")); + // Validate DEVELOPER_ID_APP_SIGNING_KEY only if user provided + // SIGNING_KEY_USER. + if (!SIGNING_KEY_USER.getIsDefaultValue(params)) { // --mac-signing-key-user-name + String signingIdentity = + DEVELOPER_ID_APP_SIGNING_KEY.fetchFrom(params); + if (signingIdentity == null) { + throw new ConfigException( + I18N.getString("error.explicit-sign-no-cert"), + I18N.getString("error.explicit-sign-no-cert.advice")); + } } + // No need to validate --mac-app-image-sign-identity, since it is + // pass through option. + // Signing will not work without Xcode with command line developer tools try { ProcessBuilder pb = new ProcessBuilder("/usr/bin/xcrun", "--help"); diff --git a/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacAppImageBuilder.java b/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacAppImageBuilder.java index d9250ae147409..ea86c41d98128 100644 --- a/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacAppImageBuilder.java +++ b/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacAppImageBuilder.java @@ -25,8 +25,10 @@ package jdk.jpackage.internal; +import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; +import java.io.PrintStream; import java.io.Writer; import java.nio.file.Files; import java.nio.file.Path; @@ -53,7 +55,10 @@ import jdk.internal.util.OSVersion; import static jdk.jpackage.internal.MacAppBundler.BUNDLE_ID_SIGNING_PREFIX; import static jdk.jpackage.internal.MacAppBundler.DEVELOPER_ID_APP_SIGNING_KEY; +import static jdk.jpackage.internal.MacAppBundler.APP_IMAGE_SIGN_IDENTITY; import static jdk.jpackage.internal.MacBaseInstallerBundler.SIGNING_KEYCHAIN; +import static jdk.jpackage.internal.MacBaseInstallerBundler.SIGNING_KEY_USER; +import static jdk.jpackage.internal.MacBaseInstallerBundler.INSTALLER_SIGN_IDENTITY; import static jdk.jpackage.internal.OverridableResource.createResource; import static jdk.jpackage.internal.StandardBundlerParam.APP_NAME; import static jdk.jpackage.internal.StandardBundlerParam.CONFIG_ROOT; @@ -395,12 +400,25 @@ private void doSigning(Map params) } catch (InterruptedException e) { Log.error(e.getMessage()); } - String signingIdentity = - DEVELOPER_ID_APP_SIGNING_KEY.fetchFrom(params); + String signingIdentity = null; + // Try --mac-app-image-sign-identity first if set + if (!APP_IMAGE_SIGN_IDENTITY.getIsDefaultValue(params)) { + signingIdentity = APP_IMAGE_SIGN_IDENTITY.fetchFrom(params); + } else { + // Check if INSTALLER_SIGN_IDENTITY is set and if it is set + // then do not sign app image, otherwise use --mac-signing-key-user-name + if (INSTALLER_SIGN_IDENTITY.getIsDefaultValue(params)) { + // --mac-sign and/or --mac-signing-key-user-name case + signingIdentity = DEVELOPER_ID_APP_SIGNING_KEY.fetchFrom(params); + } + } if (signingIdentity != null) { signAppBundle(params, root, signingIdentity, BUNDLE_ID_SIGNING_PREFIX.fetchFrom(params), ENTITLEMENTS.fetchFrom(params)); + } else { + // Case when user requested to sign installer only + signAppBundle(params, root, "-", null, null); } restoreKeychainList(params); } else if (OperatingSystem.isMacOS()) { @@ -715,6 +733,25 @@ private static List getCodesignArgs( return args; } + private static void runCodesign(ProcessBuilder pb, boolean quiet) + throws IOException { + try (ByteArrayOutputStream baos = new ByteArrayOutputStream(); + PrintStream ps = new PrintStream(baos)) { + try { + IOUtils.exec(pb, false, ps, false, + Executor.INFINITE_TIMEOUT, quiet); + } catch (IOException ioe) { + // Log output of "codesign" in case of + // error. It should help user to diagnose + // issue when using --mac-app-image-sign-identity + Log.info(MessageFormat.format(I18N.getString( + "error.tool.failed.with.output"), "codesign")); + Log.info(baos.toString().strip()); + throw ioe; + } + } + } + static void signAppBundle( Map params, Path appLocation, String signingIdentity, String identifierPrefix, Path entitlements) @@ -781,8 +818,7 @@ static void signAppBundle( p.toFile().setWritable(true, true); ProcessBuilder pb = new ProcessBuilder(args); // run quietly - IOUtils.exec(pb, false, null, false, - Executor.INFINITE_TIMEOUT, true); + runCodesign(pb, true); Files.setPosixFilePermissions(p, oldPermissions); } catch (IOException ioe) { toThrow.set(ioe); @@ -810,8 +846,7 @@ static void signAppBundle( List args = getCodesignArgs(true, path, signingIdentity, identifierPrefix, entitlements, keyChain); ProcessBuilder pb = new ProcessBuilder(args); - - IOUtils.exec(pb); + runCodesign(pb, false); } catch (IOException e) { toThrow.set(e); } @@ -842,8 +877,7 @@ static void signAppBundle( List args = getCodesignArgs(true, appLocation, signingIdentity, identifierPrefix, entitlements, keyChain); ProcessBuilder pb = new ProcessBuilder(args); - - IOUtils.exec(pb); + runCodesign(pb, false); } private static String extractBundleIdentifier(Map params) { diff --git a/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacBaseInstallerBundler.java b/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacBaseInstallerBundler.java index b4f63d66f5722..8d9db0a007783 100644 --- a/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacBaseInstallerBundler.java +++ b/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacBaseInstallerBundler.java @@ -79,6 +79,13 @@ public abstract class MacBaseInstallerBundler extends AbstractBundler { params -> "", null); + public static final BundlerParamInfo INSTALLER_SIGN_IDENTITY = + new StandardBundlerParam<>( + Arguments.CLIOptions.MAC_INSTALLER_SIGN_IDENTITY.getId(), + String.class, + params -> "", + null); + public static final BundlerParamInfo MAC_INSTALLER_NAME = new StandardBundlerParam<> ( "mac.installerName", diff --git a/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacPkgBundler.java b/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacPkgBundler.java index 60cd11b6f06f8..6ac84975451b4 100644 --- a/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacPkgBundler.java +++ b/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacPkgBundler.java @@ -28,7 +28,9 @@ import jdk.internal.util.Architecture; import jdk.internal.util.OSVersion; +import java.io.ByteArrayOutputStream; import java.io.IOException; +import java.io.PrintStream; import java.io.PrintWriter; import java.net.URI; import java.net.URISyntaxException; @@ -54,6 +56,8 @@ import static jdk.jpackage.internal.StandardBundlerParam.SIGN_BUNDLE; import static jdk.jpackage.internal.MacBaseInstallerBundler.SIGNING_KEYCHAIN; import static jdk.jpackage.internal.MacBaseInstallerBundler.SIGNING_KEY_USER; +import static jdk.jpackage.internal.MacBaseInstallerBundler.INSTALLER_SIGN_IDENTITY; +import static jdk.jpackage.internal.MacAppBundler.APP_IMAGE_SIGN_IDENTITY; import static jdk.jpackage.internal.StandardBundlerParam.APP_STORE; import static jdk.jpackage.internal.MacAppImageBuilder.MAC_CF_BUNDLE_IDENTIFIER; import static jdk.jpackage.internal.OverridableResource.createResource; @@ -605,8 +609,19 @@ private Path createPKG(Map params, Log.verbose(I18N.getString("message.signing.pkg")); } - String signingIdentity = - DEVELOPER_ID_INSTALLER_SIGNING_KEY.fetchFrom(params); + String signingIdentity = null; + // --mac-installer-sign-identity + if (!INSTALLER_SIGN_IDENTITY.getIsDefaultValue(params)) { + signingIdentity = INSTALLER_SIGN_IDENTITY.fetchFrom(params); + } else { + // Use --mac-signing-key-user-name if user did not request + // to sign just app image using --mac-app-image-sign-identity + if (APP_IMAGE_SIGN_IDENTITY.getIsDefaultValue(params)) { + // --mac-signing-key-user-name + signingIdentity = DEVELOPER_ID_INSTALLER_SIGNING_KEY.fetchFrom(params); + } + } + if (signingIdentity != null) { commandLine.add("--sign"); commandLine.add(signingIdentity); @@ -638,7 +653,21 @@ private Path createPKG(Map params, commandLine.add(finalPKG.toAbsolutePath().toString()); pb = new ProcessBuilder(commandLine); - IOUtils.exec(pb, false, null, true, Executor.INFINITE_TIMEOUT); + + try (ByteArrayOutputStream baos = new ByteArrayOutputStream(); + PrintStream ps = new PrintStream(baos)) { + try { + IOUtils.exec(pb, false, ps, true, Executor.INFINITE_TIMEOUT); + } catch (IOException ioe) { + // Log output of "productbuild" in case of + // error. It should help user to diagnose + // issue when using --mac-installer-sign-identity + Log.info(MessageFormat.format(I18N.getString( + "error.tool.failed.with.output"), "productbuild")); + Log.info(baos.toString().strip()); + throw ioe; + } + } return finalPKG; } catch (Exception ignored) { @@ -702,14 +731,19 @@ public boolean validate(Map params) // reject explicitly set sign to true and no valid signature key if (Optional.ofNullable( SIGN_BUNDLE.fetchFrom(params)).orElse(Boolean.FALSE)) { - String signingIdentity = - DEVELOPER_ID_INSTALLER_SIGNING_KEY.fetchFrom(params); - if (signingIdentity == null) { - throw new ConfigException( - I18N.getString("error.explicit-sign-no-cert"), - I18N.getString( - "error.explicit-sign-no-cert.advice")); + if (!SIGNING_KEY_USER.getIsDefaultValue(params)) { + String signingIdentity = + DEVELOPER_ID_INSTALLER_SIGNING_KEY.fetchFrom(params); + if (signingIdentity == null) { + throw new ConfigException( + I18N.getString("error.explicit-sign-no-cert"), + I18N.getString( + "error.explicit-sign-no-cert.advice")); + } } + + // No need to validate --mac-installer-sign-identity, since it is + // pass through option. } // hdiutil is always available so there's no need 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 c575df2494e02..de4e7157b2ae3 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, 2022, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2017, 2023, Oracle and/or its affiliates. All rights reserved. # 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 @@ error.no.xcode.signing.advice=Install Xcode with command line developer tools. error.cert.not.found=No certificate found matching [{0}] using keychain [{1}] error.multiple.certs.found=WARNING: Multiple certificates found matching [{0}] using keychain [{1}], using first one error.app-image.mac-sign.required=Error: --mac-sign option is required with predefined application image and with type [app-image] +error.tool.failed.with.output=Error: "{0}" failed with following output: resource.bundle-config-file=Bundle config file resource.app-info-plist=Application Info.plist resource.runtime-info-plist=Java Runtime Info.plist diff --git a/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/resources/MacResources_de.properties b/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/resources/MacResources_de.properties index 6dd037c9bce05..8586041d417f9 100644 --- a/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/resources/MacResources_de.properties +++ b/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/resources/MacResources_de.properties @@ -1,5 +1,5 @@ # -# Copyright (c) 2017, 2022, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2017, 2023, Oracle and/or its affiliates. All rights reserved. # 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 @@ error.no.xcode.signing.advice=Installieren Sie Xcode mit Befehlszeilen-Entwickle error.cert.not.found=Kein Zertifikat gefunden, das [{0}] mit Schlรผsselbund [{1}] entspricht error.multiple.certs.found=WARNUNG: Mehrere Zertifikate gefunden, die [{0}] mit Schlรผsselbund [{1}] entsprechen. Es wird das erste Zertifikat verwendet error.app-image.mac-sign.required=Fehler: Die Option "--mac-sign" ist mit einem vordefinierten Anwendungsimage und Typ [app-image] erforderlich +error.tool.failed.with.output=Error: "{0}" failed with following output: resource.bundle-config-file=Bundle-Konfigurationsdatei resource.app-info-plist=Info.plist der Anwendung resource.runtime-info-plist=Info.plist von Java Runtime 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 b75d1dc465f36..518e3e45f97e9 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, 2022, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2017, 2023, Oracle and/or its affiliates. All rights reserved. # 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 @@ error.no.xcode.signing.advice=Xcodeใจใ‚ณใƒžใƒณใƒ‰ใƒฉใ‚คใƒณใƒปใƒ‡ใƒ™ใƒญใƒƒใƒ‘ใƒป error.cert.not.found=ใ‚ญใƒผใƒใ‚งใƒผใƒณ[{1}]ใ‚’ไฝฟ็”จใ™ใ‚‹[{0}]ใจไธ€่‡ดใ™ใ‚‹่จผๆ˜Žๆ›ธใŒ่ฆ‹ใคใ‹ใ‚Šใพใ›ใ‚“ error.multiple.certs.found=่ญฆๅ‘Š: ใ‚ญใƒผใƒใ‚งใƒผใƒณ[{1}]ใ‚’ไฝฟ็”จใ™ใ‚‹[{0}]ใจไธ€่‡ดใ™ใ‚‹่ค‡ๆ•ฐใฎ่จผๆ˜Žๆ›ธใŒ่ฆ‹ใคใ‹ใ‚Šใพใ—ใŸใ€‚ๆœ€ๅˆใฎใ‚‚ใฎใ‚’ไฝฟ็”จใ—ใพใ™ error.app-image.mac-sign.required=ใ‚จใƒฉใƒผ: --mac-signใ‚ชใƒ—ใ‚ทใƒงใƒณใฏใ€ไบ‹ๅ‰ๅฎš็พฉๆธˆใ‚ขใƒ—ใƒชใ‚ฑใƒผใ‚ทใƒงใƒณใƒปใ‚คใƒกใƒผใ‚ธใŠใ‚ˆใณใ‚ฟใ‚คใƒ—[app-image]ใงๅฟ…่ฆใงใ™ +error.tool.failed.with.output=Error: "{0}" failed with following output: resource.bundle-config-file=ใƒใƒณใƒ‰ใƒซๆง‹ๆˆใƒ•ใ‚กใ‚คใƒซ resource.app-info-plist=ใ‚ขใƒ—ใƒชใ‚ฑใƒผใ‚ทใƒงใƒณใฎInfo.plist resource.runtime-info-plist=Javaใƒฉใƒณใ‚ฟใ‚คใƒ ใฎInfo.plist 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 dc1f592852dd9..c4e4bd2293950 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, 2022, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2017, 2023, Oracle and/or its affiliates. All rights reserved. # 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 @@ error.no.xcode.signing.advice=ๅฎ‰่ฃ…ๅธฆๅ‘ฝไปค่กŒๅผ€ๅ‘ไบบๅ‘˜ๅทฅๅ…ท็š„ Xcodeใ€‚ error.cert.not.found=ไฝฟ็”จๅฏ†้’ฅ้“พ [{1}] ๆ‰พไธๅˆฐไธŽ [{0}] ๅŒน้…็š„่ฏไนฆ error.multiple.certs.found=่ญฆๅ‘Š๏ผšไฝฟ็”จๅฏ†้’ฅ้“พ [{1}] ๆ‰พๅˆฐๅคšไธชไธŽ [{0}] ๅŒน้…็š„่ฏไนฆ๏ผŒๅฐ†ไฝฟ็”จ็ฌฌไธ€ไธช่ฏไนฆ error.app-image.mac-sign.required=้”™่ฏฏ๏ผš้ข„ๅฎšไน‰็š„ๅบ”็”จ็จ‹ๅบๆ˜ ๅƒๅ’Œ็ฑปๅž‹ [app image] ้œ€่ฆ --mac-sign ้€‰้กน +error.tool.failed.with.output=Error: "{0}" failed with following output: resource.bundle-config-file=ๅŒ…้…็ฝฎๆ–‡ไปถ resource.app-info-plist=ๅบ”็”จ็จ‹ๅบ Info.plist resource.runtime-info-plist=Java ่ฟ่กŒๆ—ถ Info.plist diff --git a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/Arguments.java b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/Arguments.java index b4a28e7fb3c4e..16cd89d9d52d0 100644 --- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/Arguments.java +++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/Arguments.java @@ -338,6 +338,12 @@ public enum CLIOptions { MAC_SIGNING_KEY_NAME ("mac-signing-key-user-name", OptionCategories.PLATFORM_MAC), + MAC_APP_IMAGE_SIGN_IDENTITY ("mac-app-image-sign-identity", + OptionCategories.PLATFORM_MAC), + + MAC_INSTALLER_SIGN_IDENTITY ("mac-installer-sign-identity", + OptionCategories.PLATFORM_MAC), + MAC_SIGNING_KEYCHAIN ("mac-signing-keychain", OptionCategories.PLATFORM_MAC), @@ -631,6 +637,24 @@ private void validateArguments() throws PackagerException { CLIOptions.JLINK_OPTIONS.getIdWithPrefix()); } } + if (allOptions.contains(CLIOptions.MAC_SIGNING_KEY_NAME) && + allOptions.contains(CLIOptions.MAC_APP_IMAGE_SIGN_IDENTITY)) { + throw new PackagerException("ERR_MutuallyExclusiveOptions", + CLIOptions.MAC_SIGNING_KEY_NAME.getIdWithPrefix(), + CLIOptions.MAC_APP_IMAGE_SIGN_IDENTITY.getIdWithPrefix()); + } + if (allOptions.contains(CLIOptions.MAC_SIGNING_KEY_NAME) && + allOptions.contains(CLIOptions.MAC_INSTALLER_SIGN_IDENTITY)) { + throw new PackagerException("ERR_MutuallyExclusiveOptions", + CLIOptions.MAC_SIGNING_KEY_NAME.getIdWithPrefix(), + CLIOptions.MAC_INSTALLER_SIGN_IDENTITY.getIdWithPrefix()); + } + if (isMac && (imageOnly || "dmg".equals(type)) && + allOptions.contains(CLIOptions.MAC_INSTALLER_SIGN_IDENTITY)) { + throw new PackagerException("ERR_InvalidTypeOption", + CLIOptions.MAC_INSTALLER_SIGN_IDENTITY.getIdWithPrefix(), + type); + } if (allOptions.contains(CLIOptions.DMG_CONTENT) && !("dmg".equals(type))) { throw new PackagerException("ERR_InvalidTypeOption", diff --git a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/BundlerParamInfo.java b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/BundlerParamInfo.java index 4173980002bb8..fa99073ff7f79 100644 --- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/BundlerParamInfo.java +++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/BundlerParamInfo.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2023, Oracle and/or its affiliates. All rights reserved. * 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,11 +46,6 @@ class BundlerParamInfo { */ Class valueType; - /** - * Indicates if value was set using default value function - */ - boolean isDefaultValue; - /** * If the value is not set, and no fallback value is found, * the parameter uses the value returned by the producer. @@ -70,8 +65,24 @@ Class getValueType() { return valueType; } - boolean getIsDefaultValue() { - return isDefaultValue; + /** + * Returns true if value was not provided on command line for this + * parameter. + * + * @param params - params from which value will be fetch + * @return true if value was not provided on command line, false otherwise + */ + boolean getIsDefaultValue(Map params) { + Object o = params.get(getID()); + if (o != null) { + return false; // We have user provided value + } + + if (params.containsKey(getID())) { + return false; // explicit nulls are allowed for provided value + } + + return true; } Function, T> getDefaultValueFunction() { @@ -114,7 +125,6 @@ final T fetchFrom(Map params, T result = getDefaultValueFunction().apply(params); if (result != null) { params.put(getID(), result); - isDefaultValue = true; } return result; } diff --git a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/ValidOptions.java b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/ValidOptions.java index 4d3e163cdc194..89a2e4b56fed7 100644 --- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/ValidOptions.java +++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/ValidOptions.java @@ -27,6 +27,7 @@ import java.util.EnumSet; import java.util.HashMap; + import jdk.internal.util.OperatingSystem; import jdk.jpackage.internal.Arguments.CLIOptions; @@ -62,7 +63,6 @@ enum USE { private static final HashMap> options = new HashMap<>(); - // initializing list of mandatory arguments static { put(CLIOptions.NAME.getId(), USE.ALL); @@ -130,6 +130,10 @@ enum USE { EnumSet.of(USE.ALL, USE.SIGN)); put(CLIOptions.MAC_SIGNING_KEY_NAME.getId(), EnumSet.of(USE.ALL, USE.SIGN)); + put(CLIOptions.MAC_APP_IMAGE_SIGN_IDENTITY.getId(), + EnumSet.of(USE.ALL, USE.SIGN)); + put(CLIOptions.MAC_INSTALLER_SIGN_IDENTITY.getId(), + EnumSet.of(USE.INSTALL, USE.SIGN)); put(CLIOptions.MAC_SIGNING_KEYCHAIN.getId(), EnumSet.of(USE.ALL, USE.SIGN)); put(CLIOptions.MAC_APP_STORE.getId(), USE.ALL); diff --git a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/HelpResources.properties b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/HelpResources.properties index 6c92cf3e55ca6..c21daab30d030 100644 --- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/HelpResources.properties +++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/HelpResources.properties @@ -1,5 +1,5 @@ # -# Copyright (c) 2017, 2022, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2017, 2023, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -265,7 +265,19 @@ MSG_Help_mac_launcher=\ \ Name of the keychain to search for the signing identity\n\ \ If not specified, the standard keychains are used.\n\ \ --mac-signing-key-user-name \n\ -\ Team or user name portion of Apple signing identities.\n\ +\ Team or user name portion of Apple signing identities. For direct\n\ +\ control of the signing identity used to sign application images or\n\ +\ installers use --mac-app-image-sign-identity and/or\n\ +\ --mac-installer-sign-identity. This option cannot be combined with\n\ +\ --mac-app-image-sign-identity or --mac-installer-sign-identity.\n\ +\ --mac-app-image-sign-identity \n\ +\ Identity used to sign application image. This value will be passed\n\ +\ directly to --sign option of "codesign" tool. This option cannot\n\ +\ be combined with --mac-signing-key-user-name.\n\ +\ --mac-installer-sign-identity \n\ +\ Identity used to sign "pkg" installer. This value will be passed\n\ +\ directly to --sign option of "productbuild" tool. This option\n\ +\ cannot be combined with --mac-signing-key-user-name.\n\ \ --mac-app-store\n\ \ Indicates that the jpackage output is intended for the\n\ \ Mac App Store.\n\ diff --git a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/MainResources.properties b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/MainResources.properties index 5297ef92d3414..4c5d51d5bcc65 100644 --- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/MainResources.properties +++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/MainResources.properties @@ -1,5 +1,5 @@ # -# Copyright (c) 2017, 2022, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2017, 2023, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -92,10 +92,11 @@ ERR_NoMainClass=Error: Main application class is missing ERR_UnsupportedOption=Error: Option [{0}] is not valid on this platform ERR_InvalidTypeOption=Error: Option [{0}] is not valid with type [{1}] ERR_NoInstallerEntryPoint=Error: Option [{0}] is not valid without --module or --main-jar entry point option -ERR_MutuallyExclusiveOptions="Error: Mutually exclusive options [{0}] and [{1}] +ERR_MutuallyExclusiveOptions=Error: Mutually exclusive options [{0}] and [{1}] ERR_InvalidOptionWithAppImageSigning=Error: Option [{0}] is not valid when signing application image ERR_MissingArgument=Error: Missing argument: {0} +ERR_MissingRequiredArgument=Error: {0} argument requires at least one of [{1}] argument(s) ERR_MissingAppResources=Error: No application jars found ERR_AppImageNotExist=Error: App image directory "{0}" does not exist ERR_NoAddLauncherName=Error: --add-launcher option requires a name and a file path (--add-launcher =) diff --git a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/MainResources_de.properties b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/MainResources_de.properties index 732c8a339f9d9..e505262ea28c5 100644 --- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/MainResources_de.properties +++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/MainResources_de.properties @@ -1,5 +1,5 @@ # -# Copyright (c) 2017, 2022, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2017, 2023, Oracle and/or its affiliates. All rights reserved. # 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,6 +95,7 @@ ERR_MutuallyExclusiveOptions="Fehler: Optionen [{0}] und [{1}] schlieรŸen sich g ERR_InvalidOptionWithAppImageSigning=Fehler: Option [{0}] ist nicht gรผltig beim Signieren eines Anwendungsimages ERR_MissingArgument=Fehler: Fehlendes Argument: {0} +ERR_MissingRequiredArgument=Error: {0} argument requires at least one of [{1}] argument(s) ERR_MissingAppResources=Fehler: Keine Anwendungs-JAR-Dateien gefunden ERR_AppImageNotExist=Fehler: Anwendungsimageverzeichnis "{0}" ist nicht vorhanden ERR_NoAddLauncherName=Fehler: Fรผr Option --add-launcher mรผssen ein Name und ein Dateipfad angegeben werden (--add-launcher =) diff --git a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/MainResources_ja.properties b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/MainResources_ja.properties index 8b4c457e61cb8..6cc9c23793c29 100644 --- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/MainResources_ja.properties +++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/MainResources_ja.properties @@ -1,5 +1,5 @@ # -# Copyright (c) 2017, 2022, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2017, 2023, Oracle and/or its affiliates. All rights reserved. # 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,6 +95,7 @@ ERR_MutuallyExclusiveOptions="ใ‚จใƒฉใƒผ: ็›ธไบ’ๆŽ’ไป–็š„ใชใ‚ชใƒ—ใ‚ทใƒงใƒณ[{0}] ERR_InvalidOptionWithAppImageSigning=ใ‚จใƒฉใƒผ: ใ‚ขใƒ—ใƒชใ‚ฑใƒผใ‚ทใƒงใƒณใƒปใ‚คใƒกใƒผใ‚ธใธใฎ็ฝฒๅๆ™‚ใซใ‚ชใƒ—ใ‚ทใƒงใƒณ[{0}]ใŒๆœ‰ๅŠนใงใฏใ‚ใ‚Šใพใ›ใ‚“ ERR_MissingArgument=ใ‚จใƒฉใƒผ: ๅผ•ๆ•ฐใŒใ‚ใ‚Šใพใ›ใ‚“: {0} +ERR_MissingRequiredArgument=Error: {0} argument requires at least one of [{1}] argument(s) ERR_MissingAppResources=ใ‚จใƒฉใƒผ: ใ‚ขใƒ—ใƒชใ‚ฑใƒผใ‚ทใƒงใƒณjarใŒ่ฆ‹ใคใ‹ใ‚Šใพใ›ใ‚“ใงใ—ใŸ ERR_AppImageNotExist=ใ‚จใƒฉใƒผ: ใ‚ขใƒ—ใƒชใ‚ฑใƒผใ‚ทใƒงใƒณใƒปใ‚คใƒกใƒผใ‚ธใƒปใƒ‡ใ‚ฃใƒฌใ‚ฏใƒˆใƒช"{0}"ใฏๅญ˜ๅœจใ—ใพใ›ใ‚“ ERR_NoAddLauncherName=ใ‚จใƒฉใƒผ: --add-launcherใ‚ชใƒ—ใ‚ทใƒงใƒณใซใฏๅๅ‰ใŠใ‚ˆใณใƒ•ใ‚กใ‚คใƒซใƒปใƒ‘ใ‚นใŒๅฟ…่ฆใงใ™(--add-launcher =) diff --git a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/MainResources_zh_CN.properties b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/MainResources_zh_CN.properties index 4a37c781ba4e1..7eab865568c81 100644 --- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/MainResources_zh_CN.properties +++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/MainResources_zh_CN.properties @@ -1,5 +1,5 @@ # -# Copyright (c) 2017, 2022, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2017, 2023, Oracle and/or its affiliates. All rights reserved. # 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,6 +95,7 @@ ERR_MutuallyExclusiveOptions="้”™่ฏฏ๏ผš้€‰้กน [{0}] ๅ’Œ [{1}] ็›ธไบ’ๆŽ’ๆ–ฅ ERR_InvalidOptionWithAppImageSigning=้”™่ฏฏ๏ผšๅฏนๅบ”็”จ็จ‹ๅบๆ˜ ๅƒ็ญพๅๆ—ถ๏ผŒ้€‰้กน [{0}] ๆ— ๆ•ˆ ERR_MissingArgument=้”™่ฏฏ: ็ผบๅฐ‘ๅ‚ๆ•ฐ: {0} +ERR_MissingRequiredArgument=Error: {0} argument requires at least one of [{1}] argument(s) ERR_MissingAppResources=้”™่ฏฏ: ๆ‰พไธๅˆฐๅบ”็”จ็จ‹ๅบ jar ERR_AppImageNotExist=้”™่ฏฏ๏ผšๅบ”็”จ็จ‹ๅบๆ˜ ๅƒ็›ฎๅฝ• "{0}" ไธๅญ˜ๅœจ ERR_NoAddLauncherName=้”™่ฏฏ๏ผš--add-launcher ้€‰้กน้œ€่ฆไธ€ไธชๅ็งฐๅ’Œไธ€ไธชๆ–‡ไปถ่ทฏๅพ„ (--add-launcher =) diff --git a/test/hotspot/gtest/nmt/test_nmt_buffer_overflow_detection.cpp b/test/hotspot/gtest/nmt/test_nmt_buffer_overflow_detection.cpp index ce30fb8d61d71..d293f59367c6a 100644 --- a/test/hotspot/gtest/nmt/test_nmt_buffer_overflow_detection.cpp +++ b/test/hotspot/gtest/nmt/test_nmt_buffer_overflow_detection.cpp @@ -24,8 +24,8 @@ #include "precompiled.hpp" #include "memory/allocation.hpp" +#include "nmt/memTracker.hpp" #include "runtime/os.hpp" -#include "services/memTracker.hpp" #include "utilities/debug.hpp" #include "utilities/ostream.hpp" #include "unittest.hpp" diff --git a/test/hotspot/gtest/nmt/test_nmt_cornercases.cpp b/test/hotspot/gtest/nmt/test_nmt_cornercases.cpp index 695c586b1d8da..f590b2509b274 100644 --- a/test/hotspot/gtest/nmt/test_nmt_cornercases.cpp +++ b/test/hotspot/gtest/nmt/test_nmt_cornercases.cpp @@ -24,10 +24,10 @@ #include "precompiled.hpp" #include "memory/allocation.hpp" +#include "nmt/mallocHeader.inline.hpp" +#include "nmt/mallocTracker.hpp" +#include "nmt/memTracker.hpp" #include "runtime/os.hpp" -#include "services/mallocHeader.inline.hpp" -#include "services/mallocTracker.hpp" -#include "services/memTracker.hpp" #include "testutils.hpp" #include "unittest.hpp" diff --git a/test/hotspot/gtest/nmt/test_nmt_locationprinting.cpp b/test/hotspot/gtest/nmt/test_nmt_locationprinting.cpp index 8760f22baa967..cafeeb424f0a7 100644 --- a/test/hotspot/gtest/nmt/test_nmt_locationprinting.cpp +++ b/test/hotspot/gtest/nmt/test_nmt_locationprinting.cpp @@ -24,9 +24,9 @@ #include "precompiled.hpp" #include "memory/allocation.hpp" +#include "nmt/mallocHeader.inline.hpp" +#include "nmt/memTracker.hpp" #include "runtime/os.hpp" -#include "services/mallocHeader.inline.hpp" -#include "services/memTracker.hpp" #include "unittest.hpp" // Uncomment to get test output diff --git a/test/hotspot/gtest/nmt/test_nmt_malloclimit.cpp b/test/hotspot/gtest/nmt/test_nmt_malloclimit.cpp index ab2352587562e..003063144f3ab 100644 --- a/test/hotspot/gtest/nmt/test_nmt_malloclimit.cpp +++ b/test/hotspot/gtest/nmt/test_nmt_malloclimit.cpp @@ -24,14 +24,13 @@ #include "precompiled.hpp" #include "memory/allocation.hpp" +#include "nmt/memTracker.hpp" +#include "nmt/nmtCommon.hpp" #include "runtime/os.hpp" #include "services/mallocLimit.hpp" -#include "services/memTracker.hpp" -#include "services/nmtCommon.hpp" #include "utilities/debug.hpp" #include "utilities/globalDefinitions.hpp" #include "utilities/ostream.hpp" - #include "testutils.hpp" #include "unittest.hpp" diff --git a/test/hotspot/gtest/nmt/test_nmt_reserved_region.cpp b/test/hotspot/gtest/nmt/test_nmt_reserved_region.cpp index 753a374fdbb26..0708ce5f3000a 100644 --- a/test/hotspot/gtest/nmt/test_nmt_reserved_region.cpp +++ b/test/hotspot/gtest/nmt/test_nmt_reserved_region.cpp @@ -23,9 +23,9 @@ */ #include "precompiled.hpp" +#include "nmt/memTracker.hpp" +#include "nmt/virtualMemoryTracker.hpp" #include "runtime/os.hpp" -#include "services/memTracker.hpp" -#include "services/virtualMemoryTracker.hpp" #include "unittest.hpp" // Tests the assignment operator of ReservedMemoryRegion diff --git a/test/hotspot/gtest/nmt/test_nmt_totals.cpp b/test/hotspot/gtest/nmt/test_nmt_totals.cpp index 9f1319f4f0480..bf2c1397e7def 100644 --- a/test/hotspot/gtest/nmt/test_nmt_totals.cpp +++ b/test/hotspot/gtest/nmt/test_nmt_totals.cpp @@ -24,9 +24,9 @@ #include "precompiled.hpp" #include "memory/allocation.hpp" +#include "nmt/mallocTracker.hpp" +#include "nmt/memTracker.hpp" #include "runtime/os.hpp" -#include "services/mallocTracker.hpp" -#include "services/memTracker.hpp" #include "unittest.hpp" // convenience log. switch on if debugging tests. Don't use tty, plain stdio only. diff --git a/test/hotspot/gtest/nmt/test_nmtpreinit.cpp b/test/hotspot/gtest/nmt/test_nmtpreinit.cpp index 9befda97bdc59..745e4ac347670 100644 --- a/test/hotspot/gtest/nmt/test_nmtpreinit.cpp +++ b/test/hotspot/gtest/nmt/test_nmtpreinit.cpp @@ -24,9 +24,9 @@ #include "precompiled.hpp" #include "memory/allocation.hpp" +#include "nmt/memTracker.hpp" +#include "nmt/nmtPreInit.hpp" #include "runtime/os.hpp" -#include "services/memTracker.hpp" -#include "services/nmtPreInit.hpp" #include "utilities/debug.hpp" #include "utilities/ostream.hpp" #include "unittest.hpp" diff --git a/test/hotspot/gtest/nmt/test_nmtpreinitmap.cpp b/test/hotspot/gtest/nmt/test_nmtpreinitmap.cpp index cf4a77c397615..f0802e25a44c6 100644 --- a/test/hotspot/gtest/nmt/test_nmtpreinitmap.cpp +++ b/test/hotspot/gtest/nmt/test_nmtpreinitmap.cpp @@ -25,8 +25,8 @@ #include "precompiled.hpp" #include "jvm_io.h" #include "memory/allocation.hpp" +#include "nmt/nmtPreInit.hpp" #include "runtime/os.hpp" -#include "services/nmtPreInit.hpp" #include "utilities/debug.hpp" #include "utilities/ostream.hpp" #include "unittest.hpp" diff --git a/test/hotspot/gtest/runtime/test_atomic.cpp b/test/hotspot/gtest/runtime/test_atomic.cpp index e7c6f9e3f2b59..744714c6f7fa5 100644 --- a/test/hotspot/gtest/runtime/test_atomic.cpp +++ b/test/hotspot/gtest/runtime/test_atomic.cpp @@ -59,14 +59,14 @@ TEST_VM(AtomicAddTest, int32) { Support().test_fetch_add(); } -// 64bit Atomic::add is only supported on 64bit platforms. -#ifdef _LP64 TEST_VM(AtomicAddTest, int64) { + // Check if 64-bit atomics are available on the machine. + if (!VM_Version::supports_cx8()) return; + using Support = AtomicAddTestSupport; Support().test_add(); Support().test_fetch_add(); } -#endif // _LP64 TEST_VM(AtomicAddTest, ptr) { uint _test_values[10] = {}; @@ -108,13 +108,13 @@ TEST_VM(AtomicXchgTest, int32) { Support().test(); } -// 64bit Atomic::xchg is only supported on 64bit platforms. -#ifdef _LP64 TEST_VM(AtomicXchgTest, int64) { + // Check if 64-bit atomics are available on the machine. + if (!VM_Version::supports_cx8()) return; + using Support = AtomicXchgTestSupport; Support().test(); } -#endif // _LP64 template struct AtomicCmpxchgTestSupport { @@ -142,6 +142,9 @@ TEST_VM(AtomicCmpxchgTest, int32) { } TEST_VM(AtomicCmpxchgTest, int64) { + // Check if 64-bit atomics are available on the machine. + if (!VM_Version::supports_cx8()) return; + using Support = AtomicCmpxchgTestSupport; Support().test(); } @@ -345,12 +348,16 @@ TEST_VM(AtomicBitopsTest, uint32) { AtomicBitopsTestSupport()(); } -#ifdef _LP64 TEST_VM(AtomicBitopsTest, int64) { + // Check if 64-bit atomics are available on the machine. + if (!VM_Version::supports_cx8()) return; + AtomicBitopsTestSupport()(); } TEST_VM(AtomicBitopsTest, uint64) { + // Check if 64-bit atomics are available on the machine. + if (!VM_Version::supports_cx8()) return; + AtomicBitopsTestSupport()(); } -#endif // _LP64 diff --git a/test/hotspot/gtest/runtime/test_committed_virtualmemory.cpp b/test/hotspot/gtest/runtime/test_committed_virtualmemory.cpp index 98353e5ea500a..5d6bd01af420b 100644 --- a/test/hotspot/gtest/runtime/test_committed_virtualmemory.cpp +++ b/test/hotspot/gtest/runtime/test_committed_virtualmemory.cpp @@ -22,9 +22,9 @@ */ #include "precompiled.hpp" +#include "nmt/memTracker.hpp" +#include "nmt/virtualMemoryTracker.hpp" #include "runtime/thread.hpp" -#include "services/memTracker.hpp" -#include "services/virtualMemoryTracker.hpp" #include "utilities/globalDefinitions.hpp" #include "utilities/macros.hpp" #include "unittest.hpp" diff --git a/test/hotspot/gtest/runtime/test_os.cpp b/test/hotspot/gtest/runtime/test_os.cpp index 035210218c46b..337484eeaecdc 100644 --- a/test/hotspot/gtest/runtime/test_os.cpp +++ b/test/hotspot/gtest/runtime/test_os.cpp @@ -24,12 +24,12 @@ #include "precompiled.hpp" #include "memory/allocation.hpp" #include "memory/resourceArea.hpp" +#include "nmt/memTracker.hpp" #include "runtime/frame.inline.hpp" #include "runtime/globals.hpp" #include "runtime/os.inline.hpp" #include "runtime/thread.hpp" #include "runtime/threads.hpp" -#include "services/memTracker.hpp" #include "utilities/align.hpp" #include "utilities/globalDefinitions.hpp" #include "utilities/macros.hpp" diff --git a/test/hotspot/gtest/runtime/test_virtualMemoryTracker.cpp b/test/hotspot/gtest/runtime/test_virtualMemoryTracker.cpp index 4aa058dc160e3..596934e39a85f 100644 --- a/test/hotspot/gtest/runtime/test_virtualMemoryTracker.cpp +++ b/test/hotspot/gtest/runtime/test_virtualMemoryTracker.cpp @@ -33,8 +33,8 @@ #include "precompiled.hpp" #include "memory/virtualspace.hpp" -#include "services/memTracker.hpp" -#include "services/virtualMemoryTracker.hpp" +#include "nmt/memTracker.hpp" +#include "nmt/virtualMemoryTracker.hpp" #include "utilities/globalDefinitions.hpp" #include "utilities/macros.hpp" #include "unittest.hpp" diff --git a/test/hotspot/jtreg/compiler/c2/irTests/CmpUWithZero.java b/test/hotspot/jtreg/compiler/c2/irTests/CmpUWithZero.java index f5b37f229d017..2e8fdd1aea4fe 100644 --- a/test/hotspot/jtreg/compiler/c2/irTests/CmpUWithZero.java +++ b/test/hotspot/jtreg/compiler/c2/irTests/CmpUWithZero.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, Red Hat, Inc. All rights reserved. + * Copyright (c) 2022, 2023, 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 @@ -29,7 +29,7 @@ * @test * bug 8290529 * @summary verify that x = 0) + // The constraint comes from intrinsic checkIndex + s.charAt(i); + // Graph below intentionally branches out 4x, and merges again (4-fold diamonds). + // This creates an exponential explosion in number of paths. + int e = i; + e = (e & 7) + (e & 31) + (e & 1111) + (e & 1000_000); + e = (e & 7) + (e & 31) + (e & 1111) + (e & 1000_000); + e = (e & 7) + (e & 31) + (e & 1111) + (e & 1000_000); + e = (e & 7) + (e & 31) + (e & 1111) + (e & 1000_000); + e = (e & 7) + (e & 31) + (e & 1111) + (e & 1000_000); + // Comment out lines below to make it not assert + // assert(C->live_nodes() <= C->max_node_limit()) failed: Live Node limit exceeded limit + e = (e & 7) + (e & 31) + (e & 1111) + (e & 1000_000); + e = (e & 7) + (e & 31) + (e & 1111) + (e & 1000_000); + e = (e & 7) + (e & 31) + (e & 1111) + (e & 1000_000); + e = (e & 7) + (e & 31) + (e & 1111) + (e & 1000_000); + e = (e & 7) + (e & 31) + (e & 1111) + (e & 1000_000); + e = (e & 7) + (e & 31) + (e & 1111) + (e & 1000_000); + e = (e & 7) + (e & 31) + (e & 1111) + (e & 1000_000); + e = (e & 7) + (e & 31) + (e & 1111) + (e & 1000_000); + e = (e & 7) + (e & 31) + (e & 1111) + (e & 1000_000); + result += e; + i++; + } + return result; + } +} diff --git a/test/hotspot/jtreg/compiler/intrinsics/SortingDeoptimizationTest.java b/test/hotspot/jtreg/compiler/intrinsics/SortingDeoptimizationTest.java new file mode 100644 index 0000000000000..f9fbcfefb9953 --- /dev/null +++ b/test/hotspot/jtreg/compiler/intrinsics/SortingDeoptimizationTest.java @@ -0,0 +1,72 @@ +/* + * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. + * 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 8318306 + * @run main/othervm/timeout=200 -XX:+IgnoreUnrecognizedVMOptions -Xcomp -ea -esa -XX:CompileThreshold=100 -XX:+UnlockExperimentalVMOptions -server -XX:-TieredCompilation -XX:+DeoptimizeALot SortingDeoptimizationTest 1e-2 100 50 + * @summary Exercise Arrays.parallelSort when -XX:+DeoptimizeALot is enabled + * + */ + +import java.io.PrintStream; +import java.util.Arrays; +import java.util.Random; + +public class SortingDeoptimizationTest { + + private static final PrintStream err = System.err; + private static final PrintStream out = System.out; + + public static void main(String[] args) { + int MAX = 2147483647; // 2^32 - 1 + float fraction = Float.parseFloat(args[0]); + int size = (int) (fraction * MAX); // size is a fraction of the MAX size + int iters = Integer.parseInt(args[1]); // number of iterations + int max = args.length > 2 ? Integer.parseInt(args[2]) : -1 ; // max value for the array elements + long seed = 0xC0FFEE; + Random rand = new Random(seed); + + for (int i = 0; i < iters; i++) { + boolean isSorted = runSort(size, max, rand); + out.println("Iteration " + i + ": is sorted? -> "+ isSorted); + if (!isSorted) fail("Array is not correctly sorted."); + } + } + + private static void fail(String message) { + err.format("\n*** TEST FAILED ***\n\n%s\n\n", message); + throw new RuntimeException("Test failed"); + } + + private static boolean runSort(int size, int max, Random rand) { + int[] a = new int[size]; + for (int i = 0; i < a.length; i++) a[i] = max > 0 ? rand.nextInt(max) : rand.nextInt(); + // call parallel sort + Arrays.parallelSort(a); + // check if sorted + boolean isSorted = true; + for (int i = 0; i < (a.length -1); i++) isSorted = isSorted && (a[i] <= a[i+1]); + return isSorted; + } +} diff --git a/test/hotspot/jtreg/compiler/intrinsics/TestCompareUnsigned.java b/test/hotspot/jtreg/compiler/intrinsics/TestCompareUnsigned.java index 6d1943ca1457a..99a594ade69d7 100644 --- a/test/hotspot/jtreg/compiler/intrinsics/TestCompareUnsigned.java +++ b/test/hotspot/jtreg/compiler/intrinsics/TestCompareUnsigned.java @@ -30,7 +30,7 @@ * @test * @key randomness * @bug 8283726 8287925 - * @requires os.arch=="amd64" | os.arch=="x86_64" | os.arch=="aarch64" + * @requires os.arch=="amd64" | os.arch=="x86_64" | os.arch=="aarch64" | os.arch=="riscv64" * @summary Test the intrinsics implementation of Integer/Long::compareUnsigned * @library /test/lib / * @run driver compiler.intrinsics.TestCompareUnsigned diff --git a/test/hotspot/jtreg/compiler/intrinsics/string/TestCountPositives.java b/test/hotspot/jtreg/compiler/intrinsics/string/TestCountPositives.java index afc308c37dd7a..76ef476615927 100644 --- a/test/hotspot/jtreg/compiler/intrinsics/string/TestCountPositives.java +++ b/test/hotspot/jtreg/compiler/intrinsics/string/TestCountPositives.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2023, Oracle and/or its affiliates. All rights reserved. * 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,88 +21,121 @@ * questions. */ -package compiler.intrinsics.string; - /* * @test - * @bug 8999999 + * @bug 8281146 * @summary Validates StringCoding.countPositives intrinsic with a small range of tests. + * @key randomness * @library /compiler/patches + * @library /test/lib * * @build java.base/java.lang.Helper * @run main compiler.intrinsics.string.TestCountPositives */ +/* + * @test + * @bug 8281146 8318509 + * @summary Validates StringCoding.countPositives intrinsic for AVX3 works with and without + * AVX3Threshold=0 + * @key randomness + * @library /compiler/patches + * @library /test/lib + * + * @build java.base/java.lang.Helper + * @requires vm.cpu.features ~= ".*avx512.*" + * @run main/othervm/timeout=1200 -XX:UseAVX=3 compiler.intrinsics.string.TestCountPositives + * @run main/othervm/timeout=1200 -XX:UseAVX=3 -XX:+UnlockDiagnosticVMOptions -XX:AVX3Threshold=0 compiler.intrinsics.string.TestCountPositives + */ +/** + * This test was derived from compiler.intrinsics.string.TestHasNegatives + */ +package compiler.intrinsics.string; + +import java.lang.Helper; +import java.util.Random; +import java.util.stream.IntStream; + +import jdk.test.lib.Utils; public class TestCountPositives { - private static byte[] tBa = new byte[4096 + 16]; + private static byte[] bytes = new byte[4096 + 32]; + + private static final Random RANDOM = Utils.getRandomInstance(); /** * 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. + * length, and number of negative bytes. The lowest index that will be + * negative is marked by negOffset */ - public static void initialize(int off, int len, int neg) { - assert (len + off <= tBa.length); + public static void initialize(int off, int len, int neg, int negOffset) { + assert (len + off <= bytes.length); // insert "canary" (negative) values before offset for (int i = 0; i < off; ++i) { - tBa[i] = (byte) (((i + 15) & 0x7F) | 0x80); + bytes[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)); + bytes[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]); + for (int i = 0; i < neg; i++) { + int idx = off + RANDOM.nextInt(len - negOffset) + negOffset; + bytes[idx] = (byte) (0x80 | bytes[idx]); } } // insert "canary" negative values after array segment - for (int i = len + off; i < tBa.length; ++i) { - tBa[i] = (byte) (((i + 15) & 0x7F) | 0x80); + for (int i = len + off; i < bytes.length; ++i) { + bytes[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 (int off = 0; off < 16; off++) { // starting offset of array segment + // Test all array segment sizes 1-63 + for (int len = 1; len < 64; len++) { + test_countPositives(off, len, 0, 0); + test_countPositives(off, len, 1, 0); + test_countPositives(off, len, RANDOM.nextInt(30) + 2, 0); + } + // Test a random selection of sizes between 64 and 4099, inclusive + for (int i = 0; i < 20; i++) { + int len = 64 + RANDOM.nextInt(4100 - 64); + test_countPositives(off, len, 0, 0); + test_countPositives(off, len, 1, 0); + test_countPositives(off, len, RANDOM.nextInt(len) + 2, 0); + } + for (int len : new int[] { 128, 2048 }) { + // test with negatives only in a 1-63 byte tail + int tail = RANDOM.nextInt(63) + 1; + int ng = RANDOM.nextInt(tail) + 1; + test_countPositives(off, len + tail, ng, len); + } + } + } - 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 void test_countPositives(int off, int len, int ng, int ngOffset) throws Exception { + assert (len + off < bytes.length); + initialize(off, len, ng, ngOffset); + int calculated = Helper.StringCodingCountPositives(bytes, off, len); + int expected = countPositives(bytes, off, len); + if (calculated != expected) { + if (expected != len && ng >= 0 && 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) + return; } + throw new Exception("Failed test countPositives " + "offset: " + off + " " + + "length: " + len + " " + "return: " + calculated + " expected: " + expected + " negatives: " + + ng + " offset: " + ngOffset); } } diff --git a/test/hotspot/jtreg/compiler/intrinsics/string/TestHasNegatives.java b/test/hotspot/jtreg/compiler/intrinsics/string/TestHasNegatives.java index d73ea3f0139d6..6edf2dc2e5676 100644 --- a/test/hotspot/jtreg/compiler/intrinsics/string/TestHasNegatives.java +++ b/test/hotspot/jtreg/compiler/intrinsics/string/TestHasNegatives.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2023, Oracle and/or its affiliates. All rights reserved. * 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,20 +26,39 @@ * @bug 8054307 * @summary Validates StringCoding.hasNegatives intrinsic with a small range of tests. * @library /compiler/patches + * @library /test/lib * * @build java.base/java.lang.Helper * @run main compiler.intrinsics.string.TestHasNegatives */ +/* + * @test + * @bug 8054307 8318509 + * @summary Validates StringCoding.hasNegatives intrinsic for AVX3 works with and without + * AVX3Threshold=0 + * @key randomness + * @library /compiler/patches + * @library /test/lib + * + * @build java.base/java.lang.Helper + * @requires vm.cpu.features ~= ".*avx512.*" + * @run main/othervm/timeout=1200 -XX:UseAVX=3 compiler.intrinsics.string.TestHasNegatives + * @run main/othervm/timeout=1200 -XX:UseAVX=3 -XX:+UnlockDiagnosticVMOptions -XX:AVX3Threshold=0 compiler.intrinsics.string.TestHasNegatives + */ package compiler.intrinsics.string; -/* - * @summary Validates StringCoding.hasNegatives intrinsic with a small - * range of tests. - */ +import java.lang.Helper; +import java.util.Random; +import java.util.stream.IntStream; + +import jdk.test.lib.Utils; + public class TestHasNegatives { - private static byte[] tBa = new byte[4096 + 16]; + private static byte[] bytes = new byte[4096 + 32]; + + private static final Random RANDOM = Utils.getRandomInstance(); /** * Completely initialize the test array, preparing it for tests of the @@ -47,60 +66,60 @@ public class TestHasNegatives { * length, and number of negative bytes. */ public static void initialize(int off, int len, int neg) { - assert (len + off <= tBa.length); + assert (len + off <= bytes.length); // insert "canary" (negative) values before offset for (int i = 0; i < off; ++i) { - tBa[i] = (byte) (((i + 15) & 0x7F) | 0x80); + bytes[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)); + bytes[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]); + for (int i = 0; i < neg; i++) { + int idx = off + RANDOM.nextInt(len); + bytes[idx] = (byte) (0x80 | bytes[idx]); } } // insert "canary" negative values after array segment - for (int i = len + off; i < tBa.length; ++i) { - tBa[i] = (byte) (((i + 15) & 0x7F) | 0x80); + for (int i = len + off; i < bytes.length; ++i) { + bytes[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_hasNegatives() throws Exception { - int len, off; - int ng; - boolean r; - - 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); - r = Helper.StringCodingHasNegatives(tBa, off, len); - if (r ^ ((ng == 0) ? false : true)) { - throw new Exception("Failed test hasNegatives " + "offset: " + off + " " - + "length: " + len + " " + "return: " + r + " " + "negatives: " - + ng); - } - } + for (int off = 0; off < 16; off++) { // starting offset of array segment + // Test all array segment sizes 1-63 + for (int len = 1; len < 64; len++) { + test_hasNegatives(off, len, 0); + test_hasNegatives(off, len, 1); + test_hasNegatives(off, len, RANDOM.nextInt(30) + 2); } + // Test a random selection of sizes between 64 and 4099, inclusive + for (int i = 0; i < 20; i++) { + int len = 64 + RANDOM.nextInt(4100 - 64); + test_hasNegatives(off, len, 0); + test_hasNegatives(off, len, 1); + test_hasNegatives(off, len, RANDOM.nextInt(len) + 2); + } + } + } + + private static void test_hasNegatives(int off, int len, int maxNegatives) throws Exception { + assert (len + off < bytes.length); + initialize(off, len, maxNegatives); + boolean expected = (maxNegatives > 0); + boolean actual = Helper.StringCodingHasNegatives(bytes, off, len); + if (actual != expected) { + throw new Exception("Failed test hasNegatives " + "offset: " + off + " " + + "length: " + len + " " + "return: " + actual + " " + "negatives: " + + maxNegatives); } } diff --git a/test/hotspot/jtreg/runtime/ErrorHandling/TestSymbolsInHsErrFile.java b/test/hotspot/jtreg/runtime/ErrorHandling/TestSymbolsInHsErrFile.java new file mode 100644 index 0000000000000..b6a7b58261182 --- /dev/null +++ b/test/hotspot/jtreg/runtime/ErrorHandling/TestSymbolsInHsErrFile.java @@ -0,0 +1,76 @@ +/* + * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 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 symbolsHsErr + * @summary Test that function names are present in native frames of hs-err file as a proof that symbols are available. + * @library /test/lib + * @requires vm.flagless + * @requires vm.debug + * @requires os.family == "windows" + * @modules java.base/jdk.internal.misc + * java.management + * @run driver TestSymbolsInHsErrFile + */ + +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; + +public class TestSymbolsInHsErrFile { + + public static void main(String[] args) throws Exception { + + // Start a jvm and cause a SIGSEGV / ACCESS_VIOLATION + ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + "-XX:+UnlockDiagnosticVMOptions", + "-Xmx100M", + "-XX:-CreateCoredumpOnCrash", + "-XX:ErrorHandlerTest=14", + "-version"); + + OutputAnalyzer output = new OutputAnalyzer(pb.start()); + output.shouldNotHaveExitValue(0); + + // Verify that the hs_err problematic frame contains a function name that points to origin of the crash; + // on Windows/MSVC, if symbols are present and loaded, we should see a ref to either 'crash_with_segfault' + // 'VMError::controlled_crash' depending on whether the compile optimizations (i.e. crash_with_segfault + // was inlined or not): + // # Problematic frame: + // # V [jvm.dll+0x.....] crash_with_segfault+0x10 + // or + // # V [jvm.dll+0x.....] VMError::controlled_crash+0x99 + // + // If symbols could not be loaded, however, then the frame will contain not function name at all, i.e. + // # Problematic frame: + // # V [jvm.dll+0x.....] + // NB: this is not true for other OS/Compilers, where the functions names are present even with no symbols, + // hence this test being restricted to Windows only. + output.shouldMatch(("# V \\[jvm.dll.*\\].*(crash_with_segfault|controlled_crash).*")); + + } + +} + + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/stress/jni/TEST.properties b/test/hotspot/jtreg/vmTestbase/nsk/stress/jni/TEST.properties deleted file mode 100644 index 8b51b2a911560..0000000000000 --- a/test/hotspot/jtreg/vmTestbase/nsk/stress/jni/TEST.properties +++ /dev/null @@ -1,24 +0,0 @@ -# -# Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. -# 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. -# - -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/nsk/stress/thread/TEST.properties b/test/hotspot/jtreg/vmTestbase/nsk/stress/thread/TEST.properties deleted file mode 100644 index 8b51b2a911560..0000000000000 --- a/test/hotspot/jtreg/vmTestbase/nsk/stress/thread/TEST.properties +++ /dev/null @@ -1,24 +0,0 @@ -# -# Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. -# 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. -# - -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/vm/gc/concurrent/lp30yp0rp0mr30st300/TEST.properties b/test/hotspot/jtreg/vmTestbase/vm/gc/concurrent/lp30yp0rp0mr30st300/TEST.properties deleted file mode 100644 index 04b22a107ac61..0000000000000 --- a/test/hotspot/jtreg/vmTestbase/vm/gc/concurrent/lp30yp0rp0mr30st300/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved. -# 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. -# -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/vm/gc/concurrent/lp30yp0rp0mr70st300t1/TEST.properties b/test/hotspot/jtreg/vmTestbase/vm/gc/concurrent/lp30yp0rp0mr70st300t1/TEST.properties deleted file mode 100644 index 04b22a107ac61..0000000000000 --- a/test/hotspot/jtreg/vmTestbase/vm/gc/concurrent/lp30yp0rp0mr70st300t1/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved. -# 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. -# -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/vm/gc/concurrent/lp30yp0rp30mr0st300/TEST.properties b/test/hotspot/jtreg/vmTestbase/vm/gc/concurrent/lp30yp0rp30mr0st300/TEST.properties deleted file mode 100644 index 04b22a107ac61..0000000000000 --- a/test/hotspot/jtreg/vmTestbase/vm/gc/concurrent/lp30yp0rp30mr0st300/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved. -# 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. -# -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/vm/gc/concurrent/lp30yp0rp30mr30st0t1/TEST.properties b/test/hotspot/jtreg/vmTestbase/vm/gc/concurrent/lp30yp0rp30mr30st0t1/TEST.properties deleted file mode 100644 index 04b22a107ac61..0000000000000 --- a/test/hotspot/jtreg/vmTestbase/vm/gc/concurrent/lp30yp0rp30mr30st0t1/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved. -# 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. -# -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/vm/gc/concurrent/lp30yp0rp30mr70st0/TEST.properties b/test/hotspot/jtreg/vmTestbase/vm/gc/concurrent/lp30yp0rp30mr70st0/TEST.properties deleted file mode 100644 index 04b22a107ac61..0000000000000 --- a/test/hotspot/jtreg/vmTestbase/vm/gc/concurrent/lp30yp0rp30mr70st0/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved. -# 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. -# -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/vm/gc/concurrent/lp30yp0rp30mr70st300t1/TEST.properties b/test/hotspot/jtreg/vmTestbase/vm/gc/concurrent/lp30yp0rp30mr70st300t1/TEST.properties deleted file mode 100644 index 04b22a107ac61..0000000000000 --- a/test/hotspot/jtreg/vmTestbase/vm/gc/concurrent/lp30yp0rp30mr70st300t1/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved. -# 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. -# -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/vm/gc/concurrent/lp30yp0rp70mr30st0/TEST.properties b/test/hotspot/jtreg/vmTestbase/vm/gc/concurrent/lp30yp0rp70mr30st0/TEST.properties deleted file mode 100644 index 04b22a107ac61..0000000000000 --- a/test/hotspot/jtreg/vmTestbase/vm/gc/concurrent/lp30yp0rp70mr30st0/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved. -# 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. -# -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/vm/gc/concurrent/lp30yp0rp70mr30st300t1/TEST.properties b/test/hotspot/jtreg/vmTestbase/vm/gc/concurrent/lp30yp0rp70mr30st300t1/TEST.properties deleted file mode 100644 index 04b22a107ac61..0000000000000 --- a/test/hotspot/jtreg/vmTestbase/vm/gc/concurrent/lp30yp0rp70mr30st300t1/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved. -# 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. -# -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/vm/gc/concurrent/lp30yp10rp0mr30st300/TEST.properties b/test/hotspot/jtreg/vmTestbase/vm/gc/concurrent/lp30yp10rp0mr30st300/TEST.properties deleted file mode 100644 index 04b22a107ac61..0000000000000 --- a/test/hotspot/jtreg/vmTestbase/vm/gc/concurrent/lp30yp10rp0mr30st300/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved. -# 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. -# -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/vm/gc/concurrent/lp30yp10rp0mr70st300t1/TEST.properties b/test/hotspot/jtreg/vmTestbase/vm/gc/concurrent/lp30yp10rp0mr70st300t1/TEST.properties deleted file mode 100644 index 04b22a107ac61..0000000000000 --- a/test/hotspot/jtreg/vmTestbase/vm/gc/concurrent/lp30yp10rp0mr70st300t1/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved. -# 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. -# -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/vm/gc/concurrent/lp30yp10rp30mr0st300/TEST.properties b/test/hotspot/jtreg/vmTestbase/vm/gc/concurrent/lp30yp10rp30mr0st300/TEST.properties deleted file mode 100644 index 04b22a107ac61..0000000000000 --- a/test/hotspot/jtreg/vmTestbase/vm/gc/concurrent/lp30yp10rp30mr0st300/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved. -# 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. -# -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/vm/gc/concurrent/lp30yp10rp30mr30st0t1/TEST.properties b/test/hotspot/jtreg/vmTestbase/vm/gc/concurrent/lp30yp10rp30mr30st0t1/TEST.properties deleted file mode 100644 index 04b22a107ac61..0000000000000 --- a/test/hotspot/jtreg/vmTestbase/vm/gc/concurrent/lp30yp10rp30mr30st0t1/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved. -# 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. -# -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/vm/gc/concurrent/lp30yp10rp30mr70st0/TEST.properties b/test/hotspot/jtreg/vmTestbase/vm/gc/concurrent/lp30yp10rp30mr70st0/TEST.properties deleted file mode 100644 index 04b22a107ac61..0000000000000 --- a/test/hotspot/jtreg/vmTestbase/vm/gc/concurrent/lp30yp10rp30mr70st0/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved. -# 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. -# -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/vm/gc/concurrent/lp30yp10rp30mr70st300t1/TEST.properties b/test/hotspot/jtreg/vmTestbase/vm/gc/concurrent/lp30yp10rp30mr70st300t1/TEST.properties deleted file mode 100644 index 04b22a107ac61..0000000000000 --- a/test/hotspot/jtreg/vmTestbase/vm/gc/concurrent/lp30yp10rp30mr70st300t1/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved. -# 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. -# -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/vm/gc/concurrent/lp30yp10rp70mr30st0/TEST.properties b/test/hotspot/jtreg/vmTestbase/vm/gc/concurrent/lp30yp10rp70mr30st0/TEST.properties deleted file mode 100644 index 04b22a107ac61..0000000000000 --- a/test/hotspot/jtreg/vmTestbase/vm/gc/concurrent/lp30yp10rp70mr30st0/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved. -# 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. -# -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/vm/gc/concurrent/lp30yp10rp70mr30st300t1/TEST.properties b/test/hotspot/jtreg/vmTestbase/vm/gc/concurrent/lp30yp10rp70mr30st300t1/TEST.properties deleted file mode 100644 index 04b22a107ac61..0000000000000 --- a/test/hotspot/jtreg/vmTestbase/vm/gc/concurrent/lp30yp10rp70mr30st300t1/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved. -# 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. -# -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/vm/gc/concurrent/lp30yp25rp0mr30st300/TEST.properties b/test/hotspot/jtreg/vmTestbase/vm/gc/concurrent/lp30yp25rp0mr30st300/TEST.properties deleted file mode 100644 index 04b22a107ac61..0000000000000 --- a/test/hotspot/jtreg/vmTestbase/vm/gc/concurrent/lp30yp25rp0mr30st300/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved. -# 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. -# -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/vm/gc/concurrent/lp30yp25rp0mr70st300t1/TEST.properties b/test/hotspot/jtreg/vmTestbase/vm/gc/concurrent/lp30yp25rp0mr70st300t1/TEST.properties deleted file mode 100644 index 04b22a107ac61..0000000000000 --- a/test/hotspot/jtreg/vmTestbase/vm/gc/concurrent/lp30yp25rp0mr70st300t1/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved. -# 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. -# -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/vm/gc/concurrent/lp30yp25rp30mr0st300/TEST.properties b/test/hotspot/jtreg/vmTestbase/vm/gc/concurrent/lp30yp25rp30mr0st300/TEST.properties deleted file mode 100644 index 04b22a107ac61..0000000000000 --- a/test/hotspot/jtreg/vmTestbase/vm/gc/concurrent/lp30yp25rp30mr0st300/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved. -# 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. -# -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/vm/gc/concurrent/lp30yp25rp30mr30st0t1/TEST.properties b/test/hotspot/jtreg/vmTestbase/vm/gc/concurrent/lp30yp25rp30mr30st0t1/TEST.properties deleted file mode 100644 index 04b22a107ac61..0000000000000 --- a/test/hotspot/jtreg/vmTestbase/vm/gc/concurrent/lp30yp25rp30mr30st0t1/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved. -# 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. -# -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/vm/gc/concurrent/lp30yp25rp30mr70st0/TEST.properties b/test/hotspot/jtreg/vmTestbase/vm/gc/concurrent/lp30yp25rp30mr70st0/TEST.properties deleted file mode 100644 index 04b22a107ac61..0000000000000 --- a/test/hotspot/jtreg/vmTestbase/vm/gc/concurrent/lp30yp25rp30mr70st0/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved. -# 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. -# -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/vm/gc/concurrent/lp30yp25rp30mr70st300t1/TEST.properties b/test/hotspot/jtreg/vmTestbase/vm/gc/concurrent/lp30yp25rp30mr70st300t1/TEST.properties deleted file mode 100644 index 04b22a107ac61..0000000000000 --- a/test/hotspot/jtreg/vmTestbase/vm/gc/concurrent/lp30yp25rp30mr70st300t1/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved. -# 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. -# -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/vm/gc/concurrent/lp30yp25rp70mr30st0/TEST.properties b/test/hotspot/jtreg/vmTestbase/vm/gc/concurrent/lp30yp25rp70mr30st0/TEST.properties deleted file mode 100644 index 04b22a107ac61..0000000000000 --- a/test/hotspot/jtreg/vmTestbase/vm/gc/concurrent/lp30yp25rp70mr30st0/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved. -# 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. -# -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/vm/gc/concurrent/lp30yp25rp70mr30st300t1/TEST.properties b/test/hotspot/jtreg/vmTestbase/vm/gc/concurrent/lp30yp25rp70mr30st300t1/TEST.properties deleted file mode 100644 index 04b22a107ac61..0000000000000 --- a/test/hotspot/jtreg/vmTestbase/vm/gc/concurrent/lp30yp25rp70mr30st300t1/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved. -# 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. -# -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/vm/gc/concurrent/lp50yp0rp0mr30st300/TEST.properties b/test/hotspot/jtreg/vmTestbase/vm/gc/concurrent/lp50yp0rp0mr30st300/TEST.properties deleted file mode 100644 index 04b22a107ac61..0000000000000 --- a/test/hotspot/jtreg/vmTestbase/vm/gc/concurrent/lp50yp0rp0mr30st300/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved. -# 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. -# -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/vm/gc/concurrent/lp50yp0rp0mr70st300t1/TEST.properties b/test/hotspot/jtreg/vmTestbase/vm/gc/concurrent/lp50yp0rp0mr70st300t1/TEST.properties deleted file mode 100644 index 04b22a107ac61..0000000000000 --- a/test/hotspot/jtreg/vmTestbase/vm/gc/concurrent/lp50yp0rp0mr70st300t1/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved. -# 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. -# -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/vm/gc/concurrent/lp50yp0rp30mr0st300/TEST.properties b/test/hotspot/jtreg/vmTestbase/vm/gc/concurrent/lp50yp0rp30mr0st300/TEST.properties deleted file mode 100644 index 04b22a107ac61..0000000000000 --- a/test/hotspot/jtreg/vmTestbase/vm/gc/concurrent/lp50yp0rp30mr0st300/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved. -# 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. -# -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/vm/gc/concurrent/lp50yp0rp30mr30st0t1/TEST.properties b/test/hotspot/jtreg/vmTestbase/vm/gc/concurrent/lp50yp0rp30mr30st0t1/TEST.properties deleted file mode 100644 index 04b22a107ac61..0000000000000 --- a/test/hotspot/jtreg/vmTestbase/vm/gc/concurrent/lp50yp0rp30mr30st0t1/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved. -# 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. -# -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/vm/gc/concurrent/lp50yp0rp30mr70st0/TEST.properties b/test/hotspot/jtreg/vmTestbase/vm/gc/concurrent/lp50yp0rp30mr70st0/TEST.properties deleted file mode 100644 index 04b22a107ac61..0000000000000 --- a/test/hotspot/jtreg/vmTestbase/vm/gc/concurrent/lp50yp0rp30mr70st0/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved. -# 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. -# -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/vm/gc/concurrent/lp50yp0rp30mr70st300t1/TEST.properties b/test/hotspot/jtreg/vmTestbase/vm/gc/concurrent/lp50yp0rp30mr70st300t1/TEST.properties deleted file mode 100644 index 04b22a107ac61..0000000000000 --- a/test/hotspot/jtreg/vmTestbase/vm/gc/concurrent/lp50yp0rp30mr70st300t1/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved. -# 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. -# -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/vm/gc/concurrent/lp50yp0rp70mr30st0/TEST.properties b/test/hotspot/jtreg/vmTestbase/vm/gc/concurrent/lp50yp0rp70mr30st0/TEST.properties deleted file mode 100644 index 04b22a107ac61..0000000000000 --- a/test/hotspot/jtreg/vmTestbase/vm/gc/concurrent/lp50yp0rp70mr30st0/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved. -# 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. -# -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/vm/gc/concurrent/lp50yp0rp70mr30st300t1/TEST.properties b/test/hotspot/jtreg/vmTestbase/vm/gc/concurrent/lp50yp0rp70mr30st300t1/TEST.properties deleted file mode 100644 index 04b22a107ac61..0000000000000 --- a/test/hotspot/jtreg/vmTestbase/vm/gc/concurrent/lp50yp0rp70mr30st300t1/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved. -# 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. -# -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/vm/gc/concurrent/lp50yp10rp0mr30st300/TEST.properties b/test/hotspot/jtreg/vmTestbase/vm/gc/concurrent/lp50yp10rp0mr30st300/TEST.properties deleted file mode 100644 index 04b22a107ac61..0000000000000 --- a/test/hotspot/jtreg/vmTestbase/vm/gc/concurrent/lp50yp10rp0mr30st300/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved. -# 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. -# -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/vm/gc/concurrent/lp50yp10rp0mr70st300t1/TEST.properties b/test/hotspot/jtreg/vmTestbase/vm/gc/concurrent/lp50yp10rp0mr70st300t1/TEST.properties deleted file mode 100644 index 04b22a107ac61..0000000000000 --- a/test/hotspot/jtreg/vmTestbase/vm/gc/concurrent/lp50yp10rp0mr70st300t1/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved. -# 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. -# -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/vm/gc/concurrent/lp50yp10rp30mr0st300/TEST.properties b/test/hotspot/jtreg/vmTestbase/vm/gc/concurrent/lp50yp10rp30mr0st300/TEST.properties deleted file mode 100644 index 04b22a107ac61..0000000000000 --- a/test/hotspot/jtreg/vmTestbase/vm/gc/concurrent/lp50yp10rp30mr0st300/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved. -# 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. -# -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/vm/gc/concurrent/lp50yp10rp30mr30st0t1/TEST.properties b/test/hotspot/jtreg/vmTestbase/vm/gc/concurrent/lp50yp10rp30mr30st0t1/TEST.properties deleted file mode 100644 index 04b22a107ac61..0000000000000 --- a/test/hotspot/jtreg/vmTestbase/vm/gc/concurrent/lp50yp10rp30mr30st0t1/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved. -# 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. -# -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/vm/gc/concurrent/lp50yp10rp30mr70st0/TEST.properties b/test/hotspot/jtreg/vmTestbase/vm/gc/concurrent/lp50yp10rp30mr70st0/TEST.properties deleted file mode 100644 index 04b22a107ac61..0000000000000 --- a/test/hotspot/jtreg/vmTestbase/vm/gc/concurrent/lp50yp10rp30mr70st0/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved. -# 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. -# -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/vm/gc/concurrent/lp50yp10rp30mr70st300t1/TEST.properties b/test/hotspot/jtreg/vmTestbase/vm/gc/concurrent/lp50yp10rp30mr70st300t1/TEST.properties deleted file mode 100644 index 04b22a107ac61..0000000000000 --- a/test/hotspot/jtreg/vmTestbase/vm/gc/concurrent/lp50yp10rp30mr70st300t1/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved. -# 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. -# -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/vm/gc/concurrent/lp50yp10rp70mr30st0/TEST.properties b/test/hotspot/jtreg/vmTestbase/vm/gc/concurrent/lp50yp10rp70mr30st0/TEST.properties deleted file mode 100644 index 04b22a107ac61..0000000000000 --- a/test/hotspot/jtreg/vmTestbase/vm/gc/concurrent/lp50yp10rp70mr30st0/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved. -# 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. -# -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/vm/gc/concurrent/lp50yp10rp70mr30st300t1/TEST.properties b/test/hotspot/jtreg/vmTestbase/vm/gc/concurrent/lp50yp10rp70mr30st300t1/TEST.properties deleted file mode 100644 index 04b22a107ac61..0000000000000 --- a/test/hotspot/jtreg/vmTestbase/vm/gc/concurrent/lp50yp10rp70mr30st300t1/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved. -# 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. -# -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/vm/gc/concurrent/lp60yp0rp30mr0st300/TEST.properties b/test/hotspot/jtreg/vmTestbase/vm/gc/concurrent/lp60yp0rp30mr0st300/TEST.properties deleted file mode 100644 index 04b22a107ac61..0000000000000 --- a/test/hotspot/jtreg/vmTestbase/vm/gc/concurrent/lp60yp0rp30mr0st300/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved. -# 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. -# -exclusiveAccess.dirs=. diff --git a/test/jdk/ProblemList-Xcomp.txt b/test/jdk/ProblemList-Xcomp.txt index 5ad0b3f24faaf..5f7f4a912aaa8 100644 --- a/test/jdk/ProblemList-Xcomp.txt +++ b/test/jdk/ProblemList-Xcomp.txt @@ -28,3 +28,4 @@ ############################################################################# java/lang/invoke/MethodHandles/CatchExceptionTest.java 8146623 generic-all +java/lang/management/MemoryMXBean/CollectionUsageThreshold.java 8318668 generic-all diff --git a/test/jdk/ProblemList.txt b/test/jdk/ProblemList.txt index af5642f21c16e..e264d4344f06f 100644 --- a/test/jdk/ProblemList.txt +++ b/test/jdk/ProblemList.txt @@ -585,6 +585,7 @@ java/rmi/transport/rapidExportUnexport/RapidExportUnexport.java 7146541 linux-al java/rmi/transport/checkLeaseInfoLeak/CheckLeaseLeak.java 7191877 generic-all java/rmi/registry/readTest/CodebaseTest.java 8173324 windows-all +java/rmi/registry/multipleRegistries/MultipleRegistries.java 8268182 macosx-all java/rmi/Naming/DefaultRegistryPort.java 8005619 windows-all java/rmi/Naming/legalRegistryNames/LegalRegistryNames.java 8005619 windows-all diff --git a/test/jdk/java/awt/regtesthelpers/PassFailJFrame.java b/test/jdk/java/awt/regtesthelpers/PassFailJFrame.java index 92ff937193341..e4fe393fd6e36 100644 --- a/test/jdk/java/awt/regtesthelpers/PassFailJFrame.java +++ b/test/jdk/java/awt/regtesthelpers/PassFailJFrame.java @@ -29,19 +29,25 @@ import java.awt.GraphicsEnvironment; import java.awt.Image; import java.awt.Insets; +import java.awt.Point; import java.awt.Rectangle; import java.awt.Robot; import java.awt.Toolkit; import java.awt.Window; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; +import java.awt.event.WindowListener; import java.awt.image.RenderedImage; import java.io.File; import java.io.IOException; import java.lang.reflect.InvocationTargetException; import java.util.ArrayList; import java.util.Arrays; +import java.util.Collection; import java.util.List; +import java.util.Objects; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; @@ -51,6 +57,7 @@ import javax.swing.JComboBox; import javax.swing.JComponent; import javax.swing.JDialog; +import javax.swing.JEditorPane; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JOptionPane; @@ -58,10 +65,87 @@ import javax.swing.JScrollPane; import javax.swing.JTextArea; import javax.swing.Timer; +import javax.swing.text.JTextComponent; +import javax.swing.text.html.HTMLEditorKit; +import javax.swing.text.html.StyleSheet; +import static java.util.Collections.unmodifiableList; import static javax.swing.SwingUtilities.invokeAndWait; import static javax.swing.SwingUtilities.isEventDispatchThread; +/** + * Provides a framework for manual tests to display test instructions and + * Pass/Fail buttons. + *

    + * Instructions for the user can be either plain text or HTML as supported + * by Swing. If the instructions start with {@code }, the + * instructions are displayed as HTML. + *

    + * A simple test would look like this: + *

    {@code
    + * public class SampleManualTest {
    + *     private static final String INSTRUCTIONS =
    + *             "Click Pass, or click Fail if the test failed.";
    + *
    + *     public static void main(String[] args) throws Exception {
    + *         PassFailJFrame.builder()
    + *                       .instructions(INSTRUCTIONS)
    + *                       .testUI(() -> createTestUI())
    + *                       .build()
    + *                       .awaitAndCheck();
    + *     }
    + *
    + *     private static List createTestUI() {
    + *         JFrame testUI = new JFrame("Test UI");
    + *         testUI.setSize(250, 150);
    + *         return List.of(testUI);
    + *     }
    + * }
    + * }
    + *

    + * The above example uses the {@link Builder Builder} to set the parameters of + * the instruction frame. It is the recommended way. + *

    + * The framework will create instruction UI, it will call + * the provided {@code createTestUI} on the Event Dispatch Thread (EDT), + * and it will automatically position the test UI and make it visible. + *

    + * Alternatively, use one of the {@code PassFailJFrame} constructors to + * create an object, then create secondary test UI, register it + * with {@code PassFailJFrame}, position it and make it visible. + * The following sample demonstrates it: + *

    {@code
    + * public class SampleOldManualTest {
    + *     private static final String INSTRUCTIONS =
    + *             "Click Pass, or click Fail if the test failed.";
    + *
    + *     public static void main(String[] args) throws Exception {
    + *         PassFailJFrame passFail = new PassFailJFrame(INSTRUCTIONS);
    + *
    + *         SwingUtilities.invokeAndWait(() -> createTestUI());
    + *
    + *         passFail.awaitAndCheck();
    + *     }
    + *
    + *     private static void createTestUI() {
    + *         JFrame testUI = new JFrame("Test UI");
    + *         testUI.setSize(250, 150);
    + *         PassFailJFrame.addTestWindow(testUI);
    + *         PassFailJFrame.positionTestWindow(testUI, PassFailJFrame.Position.HORIZONTAL);
    + *         testUI.setVisible(true);
    + *     }
    + * }
    + * }
    + *

    + * Use methods of the {@code Builder} class or constructors of the + * {@code PassFailJFrame} class to control other parameters: + *

      + *
    • the title of the instruction UI,
    • + *
    • the timeout of the test,
    • + *
    • the size of the instruction UI via rows and columns, and
    • + *
    • to enable screenshots.
    • + *
    + */ public class PassFailJFrame { private static final String TITLE = "Test Instruction Frame"; @@ -73,16 +157,31 @@ public class PassFailJFrame { * Prefix for the user-provided failure reason. */ private static final String FAILURE_REASON = "Failure Reason:\n"; + /** + * The failure reason message when the user didn't provide one. + */ + private static final String EMPTY_REASON = "(no reason provided)"; private static final List windowList = new ArrayList<>(); - private static final Timer timer = new Timer(0, null); + private static final CountDownLatch latch = new CountDownLatch(1); - private static volatile boolean failed; - private static volatile boolean timeout; - private static volatile String testFailedReason; + private static TimeoutHandler timeoutHandler; + + /** + * The description of why the test fails. + *

    + * Note: do not use this field directly, + * use the {@link #setFailureReason(String) setFailureReason} and + * {@link #getFailureReason() getFailureReason} methods to modify and + * to read its value. + */ + private static String failureReason; + private static final AtomicInteger imgCounter = new AtomicInteger(0); + private static JFrame frame; + private static Robot robot; public enum Position {HORIZONTAL, VERTICAL, TOP_LEFT_CORNER} @@ -165,21 +264,67 @@ public PassFailJFrame(String title, String instructions, long testTimeOut, */ public PassFailJFrame(String title, String instructions, long testTimeOut, int rows, int columns, - boolean enableScreenCapture) throws InterruptedException, - InvocationTargetException { - if (isEventDispatchThread()) { - createUI(title, instructions, testTimeOut, rows, columns, - enableScreenCapture); - } else { - invokeAndWait(() -> createUI(title, instructions, testTimeOut, - rows, columns, enableScreenCapture)); - } + boolean enableScreenCapture) + throws InterruptedException, InvocationTargetException { + invokeOnEDT(() -> createUI(title, instructions, + testTimeOut, + rows, columns, + enableScreenCapture)); } private PassFailJFrame(Builder builder) throws InterruptedException, InvocationTargetException { this(builder.title, builder.instructions, builder.testTimeOut, - builder.rows, builder.columns, builder.screenCapture); + builder.rows, builder.columns, builder.screenCapture); + + if (builder.windowCreator != null) { + invokeOnEDT(() -> + builder.testWindows = builder.windowCreator.createTestUI()); + } + + if (builder.testWindows != null) { + addTestWindow(builder.testWindows); + builder.testWindows + .forEach(w -> w.addWindowListener(windowClosingHandler)); + + if (builder.positionWindows != null) { + positionInstructionFrame(builder.position); + invokeOnEDT(() -> { + builder.positionWindows + .positionTestWindows(unmodifiableList(builder.testWindows), + builder.instructionUIHandler); + + windowList.forEach(w -> w.setVisible(true)); + }); + } else if (builder.testWindows.size() == 1) { + Window window = builder.testWindows.get(0); + positionTestWindow(window, builder.position); + window.setVisible(true); + } else { + positionTestWindow(null, builder.position); + } + } + } + + /** + * Performs an operation on EDT. If called on EDT, invokes {@code run} + * directly, otherwise wraps into {@code invokeAndWait}. + * + * @param doRun an operation to run on EDT + * @throws InterruptedException if we're interrupted while waiting for + * the event dispatching thread to finish executing + * {@code doRun.run()} + * @throws InvocationTargetException if an exception is thrown while + * running {@code doRun} + * @see javax.swing.SwingUtilities#invokeAndWait(Runnable) + */ + private static void invokeOnEDT(Runnable doRun) + throws InterruptedException, InvocationTargetException { + if (isEventDispatchThread()) { + doRun.run(); + } else { + invokeAndWait(doRun); + } } private static void createUI(String title, String instructions, @@ -187,41 +332,28 @@ private static void createUI(String title, String instructions, boolean enableScreenCapture) { frame = new JFrame(title); frame.setLayout(new BorderLayout()); - JTextArea instructionsText = new JTextArea(instructions, rows, columns); - instructionsText.setEditable(false); - instructionsText.setLineWrap(true); - - long tTimeout = TimeUnit.MINUTES.toMillis(testTimeOut); - - final JLabel testTimeoutLabel = new JLabel(String.format("Test " + - "timeout: %s", convertMillisToTimeStr(tTimeout)), JLabel.CENTER); - final long startTime = System.currentTimeMillis(); - timer.setDelay(1000); - timer.addActionListener((e) -> { - long leftTime = tTimeout - (System.currentTimeMillis() - startTime); - if ((leftTime < 0) || failed) { - timer.stop(); - testFailedReason = FAILURE_REASON - + "Timeout User did not perform testing."; - timeout = true; - latch.countDown(); - } - testTimeoutLabel.setText(String.format("Test timeout: %s", convertMillisToTimeStr(leftTime))); - }); - timer.start(); + + JLabel testTimeoutLabel = new JLabel("", JLabel.CENTER); + timeoutHandler = new TimeoutHandler(testTimeoutLabel, testTimeOut); frame.add(testTimeoutLabel, BorderLayout.NORTH); - frame.add(new JScrollPane(instructionsText), BorderLayout.CENTER); + + JTextComponent text = instructions.startsWith("") + ? configureHTML(instructions, rows, columns) + : configurePlainText(instructions, rows, columns); + text.setEditable(false); + + frame.add(new JScrollPane(text), BorderLayout.CENTER); JButton btnPass = new JButton("Pass"); btnPass.addActionListener((e) -> { latch.countDown(); - timer.stop(); + timeoutHandler.stop(); }); JButton btnFail = new JButton("Fail"); btnFail.addActionListener((e) -> { - getFailureReason(); - timer.stop(); + requestFailureReason(); + timeoutHandler.stop(); }); JPanel buttonsPanel = new JPanel(); @@ -232,16 +364,7 @@ private static void createUI(String title, String instructions, buttonsPanel.add(createCapturePanel()); } - frame.addWindowListener(new WindowAdapter() { - @Override - public void windowClosing(WindowEvent e) { - super.windowClosing(e); - testFailedReason = FAILURE_REASON - + "User closed the instruction Frame"; - failed = true; - latch.countDown(); - } - }); + frame.addWindowListener(windowClosingHandler); frame.add(buttonsPanel, BorderLayout.SOUTH); frame.pack(); @@ -249,6 +372,173 @@ public void windowClosing(WindowEvent e) { windowList.add(frame); } + private static JTextComponent configurePlainText(String instructions, + int rows, int columns) { + JTextArea text = new JTextArea(instructions, rows, columns); + text.setLineWrap(true); + text.setWrapStyleWord(true); + return text; + } + + private static JTextComponent configureHTML(String instructions, + int rows, int columns) { + JEditorPane text = new JEditorPane("text/html", instructions); + text.putClientProperty(JEditorPane.HONOR_DISPLAY_PROPERTIES, + Boolean.TRUE); + // Set preferred size as if it were JTextArea + text.setPreferredSize(new JTextArea(rows, columns).getPreferredSize()); + + HTMLEditorKit kit = (HTMLEditorKit) text.getEditorKit(); + StyleSheet styles = kit.getStyleSheet(); + // Reduce the default margins + styles.addRule("ol, ul { margin-left-ltr: 20; margin-left-rtl: 20 }"); + // Make the size of code blocks the same as other text + styles.addRule("code { font-size: inherit }"); + + return text; + } + + + /** + * Creates one or more windows for test UI. + */ + @FunctionalInterface + public interface WindowCreator { + /** + * Creates one or more windows for test UI. + * This method is called by the framework on the EDT. + * @return a list of windows. + */ + List createTestUI(); + } + + /** + * Positions test UI windows. + */ + @FunctionalInterface + public interface PositionWindows { + /** + * Positions test UI windows. + * This method is called by the framework on the EDT after + * the instruction UI frame was positioned on the screen. + *

    + * The list of the test windows contains the windows + * that were passed to the framework via + * {@link Builder#testUI(WindowCreator) testUI} method. + * + * @param testWindows the list of test windows + * @param instructionUI information about the instruction frame + */ + void positionTestWindows(List testWindows, + InstructionUI instructionUI); + } + + /** + * Provides information about the instruction frame. + */ + public interface InstructionUI { + /** + * {@return the location of the instruction frame} + */ + Point getLocation(); + + /** + * {@return the size of the instruction frame} + */ + Dimension getSize(); + + /** + * {@return the bounds of the instruction frame} + */ + Rectangle getBounds(); + + /** + * Allows to change the location of the instruction frame. + * + * @param location the new location of the instruction frame + */ + void setLocation(Point location); + + /** + * Allows to change the location of the instruction frame. + * + * @param x the x coordinate of the new location + * @param y the y coordinate of the new location + */ + void setLocation(int x, int y); + + /** + * Returns the specified position that was used to set + * the initial location of the instruction frame. + * + * @return the specified position + * + * @see Position + */ + Position getPosition(); + } + + + private static final class TimeoutHandler implements ActionListener { + private final long endTime; + + private final Timer timer; + + private final JLabel label; + + public TimeoutHandler(final JLabel label, final long testTimeOut) { + endTime = System.currentTimeMillis() + TimeUnit.MINUTES.toMillis(testTimeOut); + + this.label = label; + + timer = new Timer(1000, this); + timer.start(); + updateTime(testTimeOut); + } + + @Override + public void actionPerformed(ActionEvent e) { + long leftTime = endTime - System.currentTimeMillis(); + if (leftTime < 0) { + timer.stop(); + setFailureReason(FAILURE_REASON + + "Timeout - User did not perform testing."); + latch.countDown(); + } + updateTime(leftTime); + } + + private void updateTime(final long leftTime) { + if (leftTime < 0) { + label.setText("Test timeout: 00:00:00"); + return; + } + long hours = leftTime / 3_600_000; + long minutes = (leftTime - hours * 3_600_000) / 60_000; + long seconds = (leftTime - hours * 3_600_000 - minutes * 60_000) / 1_000; + label.setText(String.format("Test timeout: %02d:%02d:%02d", + hours, minutes, seconds)); + } + + public void stop() { + timer.stop(); + } + } + + + private static final class WindowClosingHandler extends WindowAdapter { + @Override + public void windowClosing(WindowEvent e) { + setFailureReason(FAILURE_REASON + + "User closed a window"); + latch.countDown(); + } + } + + private static final WindowListener windowClosingHandler = + new WindowClosingHandler(); + + private static JComponent createCapturePanel() { JComboBox screenShortType = new JComboBox<>(CaptureType.values()); @@ -334,14 +624,28 @@ private static void captureScreen(CaptureType type) { JOptionPane.INFORMATION_MESSAGE); } - private static String convertMillisToTimeStr(long millis) { - if (millis < 0) { - return "00:00:00"; + /** + * Sets the failure reason which describes why the test fails. + * This method ensures the {@code failureReason} field does not change + * after it's set to a non-{@code null} value. + * @param reason the description of why the test fails + * @throws IllegalArgumentException if the {@code reason} parameter + * is {@code null} + */ + private static synchronized void setFailureReason(final String reason) { + if (reason == null) { + throw new IllegalArgumentException("The failure reason must not be null"); + } + if (failureReason == null) { + failureReason = reason; } - long hours = millis / 3_600_000; - long minutes = (millis - hours * 3_600_000) / 60_000; - long seconds = (millis - hours * 3_600_000 - minutes * 60_000) / 1_000; - return String.format("%02d:%02d:%02d", hours, minutes, seconds); + } + + /** + * {@return the description of why the test fails} + */ + private static synchronized String getFailureReason() { + return failureReason; } /** @@ -362,32 +666,18 @@ public void awaitAndCheck() throws InterruptedException, InvocationTargetExcepti latch.await(); invokeAndWait(PassFailJFrame::disposeWindows); - if (timeout) { - throw new RuntimeException(testFailedReason); - } - - if (failed) { - throw new RuntimeException("Test failed! : " + testFailedReason); + String failure = getFailureReason(); + if (failure != null) { + throw new RuntimeException(failure); } System.out.println("Test passed!"); } /** - * Dispose all the window(s) i,e both the test instruction frame and - * the window(s) that is added via addTestWindow(Window testWindow) + * Requests the description of the test failure reason from the tester. */ - private static synchronized void disposeWindows() { - for (Window win : windowList) { - win.dispose(); - } - } - - /** - * Read the test failure reason and add the reason to the test result - * example in the jtreg .jtr file. - */ - private static void getFailureReason() { + private static void requestFailureReason() { final JDialog dialog = new JDialog(frame, "Test Failure ", true); dialog.setTitle("Failure reason"); JPanel jPanel = new JPanel(new BorderLayout()); @@ -395,7 +685,9 @@ private static void getFailureReason() { JButton okButton = new JButton("OK"); okButton.addActionListener((ae) -> { - testFailedReason = FAILURE_REASON + jTextArea.getText(); + String text = jTextArea.getText(); + setFailureReason(FAILURE_REASON + + (!text.isEmpty() ? text : EMPTY_REASON)); dialog.setVisible(false); }); @@ -410,11 +702,52 @@ private static void getFailureReason() { dialog.pack(); dialog.setVisible(true); - failed = true; + // Ensure the test fails even if the dialog is closed + // without clicking the OK button + setFailureReason(FAILURE_REASON + EMPTY_REASON); + dialog.dispose(); latch.countDown(); } + /** + * Disposes of all the windows. It disposes of the test instruction frame + * and all other windows added via {@link #addTestWindow(Window)}. + */ + private static synchronized void disposeWindows() { + windowList.forEach(Window::dispose); + } + + private static void positionInstructionFrame(final Position position) { + Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); + + // Get the screen insets to position the frame by taking into + // account the location of taskbar or menu bar on screen. + GraphicsConfiguration gc = GraphicsEnvironment.getLocalGraphicsEnvironment() + .getDefaultScreenDevice() + .getDefaultConfiguration(); + Insets screenInsets = Toolkit.getDefaultToolkit().getScreenInsets(gc); + + switch (position) { + case HORIZONTAL: + int newX = ((screenSize.width / 2) - frame.getWidth()); + frame.setLocation((newX + screenInsets.left), + (frame.getY() + screenInsets.top)); + break; + + case VERTICAL: + int newY = ((screenSize.height / 2) - frame.getHeight()); + frame.setLocation((frame.getX() + screenInsets.left), + (newY + screenInsets.top)); + break; + + case TOP_LEFT_CORNER: + frame.setLocation(screenInsets.left, screenInsets.top); + break; + } + syncLocationToWindowManager(); + } + /** * Approximately positions the instruction frame relative to the test * window as specified by the {@code position} parameter. If {@code testWindow} @@ -445,40 +778,23 @@ private static void getFailureReason() { * */ public static void positionTestWindow(Window testWindow, Position position) { - Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); - - // Get the screen insets to position the frame by taking into - // account the location of taskbar/menubars on screen. - GraphicsConfiguration gc = GraphicsEnvironment.getLocalGraphicsEnvironment() - .getDefaultScreenDevice().getDefaultConfiguration(); - Insets screenInsets = Toolkit.getDefaultToolkit().getScreenInsets(gc); - - if (position.equals(Position.HORIZONTAL)) { - int newX = ((screenSize.width / 2) - frame.getWidth()); - frame.setLocation((newX + screenInsets.left), - (frame.getY() + screenInsets.top)); - syncLocationToWindowManager(); - if (testWindow != null) { - testWindow.setLocation((frame.getX() + frame.getWidth() + 5), - frame.getY()); - } - } else if (position.equals(Position.VERTICAL)) { - int newY = ((screenSize.height / 2) - frame.getHeight()); - frame.setLocation((frame.getX() + screenInsets.left), - (newY + screenInsets.top)); - syncLocationToWindowManager(); - if (testWindow != null) { - testWindow.setLocation(frame.getX(), - (frame.getY() + frame.getHeight() + 5)); - } - } else if (position.equals(Position.TOP_LEFT_CORNER)) { - frame.setLocation(screenInsets.left, screenInsets.top); - syncLocationToWindowManager(); - if (testWindow != null) { - testWindow.setLocation((frame.getX() + frame.getWidth() + 5), - frame.getY()); + positionInstructionFrame(position); + + if (testWindow != null) { + switch (position) { + case HORIZONTAL: + case TOP_LEFT_CORNER: + testWindow.setLocation((frame.getX() + frame.getWidth() + 5), + frame.getY()); + break; + + case VERTICAL: + testWindow.setLocation(frame.getX(), + (frame.getY() + frame.getHeight() + 5)); + break; } } + // make instruction frame visible after updating // frame & window positions frame.setVisible(true); @@ -518,13 +834,7 @@ public static Rectangle getInstructionFrameBounds() throws InterruptedException, InvocationTargetException { final Rectangle[] bounds = {null}; - if (isEventDispatchThread()) { - bounds[0] = frame != null ? frame.getBounds() : null; - } else { - invokeAndWait(() -> { - bounds[0] = frame != null ? frame.getBounds() : null; - }); - } + invokeOnEDT(() -> bounds[0] = frame != null ? frame.getBounds() : null); return bounds[0]; } @@ -539,6 +849,16 @@ public static synchronized void addTestWindow(Window testWindow) { windowList.add(testWindow); } + /** + * Adds a collection of test windows to the windowList to be disposed of + * when the test completes. + * + * @param testWindows the collection of test windows to be disposed of + */ + public static synchronized void addTestWindow(Collection testWindows) { + windowList.addAll(testWindows); + } + /** * Forcibly pass the test. *

    The sample usage: @@ -567,18 +887,24 @@ public static void forceFail() { * @param reason the reason why the test is failed */ public static void forceFail(String reason) { - failed = true; - testFailedReason = FAILURE_REASON + reason; + setFailureReason(FAILURE_REASON + reason); latch.countDown(); } - public static class Builder { + public static final class Builder { private String title; private String instructions; private long testTimeOut; private int rows; private int columns; - private boolean screenCapture = false; + private boolean screenCapture; + + private List testWindows; + private WindowCreator windowCreator; + private PositionWindows positionWindows; + private InstructionUI instructionUIHandler; + + private Position position; public Builder title(String title) { this.title = title; @@ -610,6 +936,51 @@ public Builder screenCapture() { return this; } + public Builder testUI(Window window) { + return testUI(List.of(window)); + } + + public Builder testUI(Window... windows) { + return testUI(List.of(windows)); + } + + public Builder testUI(List windows) { + if (windows == null) { + throw new IllegalArgumentException("The list of windows can't be null"); + } + if (windows.stream() + .anyMatch(Objects::isNull)) { + throw new IllegalArgumentException("The windows list can't contain null"); + } + + if (windowCreator != null) { + throw new IllegalStateException("windowCreator is already set"); + } + this.testWindows = windows; + return this; + } + + public Builder testUI(WindowCreator windowCreator) { + if (windowCreator == null) { + throw new IllegalArgumentException("The window creator can't be null"); + } + if (testWindows != null) { + throw new IllegalStateException("testWindows are already set"); + } + this.windowCreator = windowCreator; + return this; + } + + public Builder positionTestUI(PositionWindows positionWindows) { + this.positionWindows = positionWindows; + return this; + } + + public Builder position(Position position) { + this.position = position; + return this; + } + public PassFailJFrame build() throws InterruptedException, InvocationTargetException { validate(); @@ -617,26 +988,76 @@ public PassFailJFrame build() throws InterruptedException, } private void validate() { - if (this.title == null) { - this.title = TITLE; + if (title == null) { + title = TITLE; } - if (this.instructions == null || this.instructions.length() == 0) { - throw new RuntimeException("Please provide the test " + - "instruction for this manual test"); + if (instructions == null || instructions.isEmpty()) { + throw new IllegalStateException("Please provide the test " + + "instructions for this manual test"); } - if (this.testTimeOut == 0L) { - this.testTimeOut = TEST_TIMEOUT; + if (testTimeOut == 0L) { + testTimeOut = TEST_TIMEOUT; } - if (this.rows == 0) { - this.rows = ROWS; + if (rows == 0) { + rows = ROWS; } - if (this.columns == 0) { - this.columns = COLUMNS; + if (columns == 0) { + columns = COLUMNS; + } + + if (position == null + && (testWindows != null || windowCreator != null)) { + + position = Position.HORIZONTAL; + } + + if (positionWindows != null) { + if (testWindows == null && windowCreator == null) { + throw new IllegalStateException("To position windows, " + + "provide an a list of windows to the builder"); + } + instructionUIHandler = new InstructionUIHandler(); + } + } + + private final class InstructionUIHandler implements InstructionUI { + @Override + public Point getLocation() { + return frame.getLocation(); + } + + @Override + public Dimension getSize() { + return frame.getSize(); + } + + @Override + public Rectangle getBounds() { + return frame.getBounds(); + } + + @Override + public void setLocation(Point location) { + setLocation(location.x, location.y); + } + + @Override + public void setLocation(int x, int y) { + frame.setLocation(x, y); + } + + @Override + public Position getPosition() { + return position; } } } + + public static Builder builder() { + return new Builder(); + } } diff --git a/test/jdk/java/net/Socks/SocksSocketProxySelectorTest.java b/test/jdk/java/net/Socks/SocksSocketProxySelectorTest.java index e43edb4f6f7ac..80d0e934f86de 100644 --- a/test/jdk/java/net/Socks/SocksSocketProxySelectorTest.java +++ b/test/jdk/java/net/Socks/SocksSocketProxySelectorTest.java @@ -21,12 +21,14 @@ * questions. */ -import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.Assumptions; import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.MethodSource; import java.io.IOException; +import java.net.Inet6Address; import java.net.InetAddress; import java.net.NetworkInterface; import java.net.Proxy; @@ -76,6 +78,7 @@ public static Stream linkLocalIpv6Literals() throws SocketException { return NetworkInterface.networkInterfaces() .flatMap(NetworkInterface::inetAddresses) .filter(InetAddress::isLinkLocalAddress) + .filter(Inet6Address.class::isInstance) .map(InetAddress::getHostAddress); } @@ -135,9 +138,12 @@ public void testShortIpv6Literals(String host) throws Exception { } } - @ParameterizedTest - @MethodSource("linkLocalIpv6Literals") - public void testLinkLocalIpv6Literals(String host) throws Exception { + @Test + public void testLinkLocalIpv6Literals() throws Exception { + String host = linkLocalIpv6Literals() + .findFirst() + .orElseGet(() -> Assumptions.abort("No IPv6 link-local addresses found")); + System.err.println(host); try (Socket s1 = new Socket(host, 80)) { fail("IOException was expected to be thrown, but wasn't"); } catch (IOException ioe) { diff --git a/test/jdk/java/text/Format/ChoiceFormat/PatternsTest.java b/test/jdk/java/text/Format/ChoiceFormat/PatternsTest.java new file mode 100644 index 0000000000000..dc514f5459f90 --- /dev/null +++ b/test/jdk/java/text/Format/ChoiceFormat/PatternsTest.java @@ -0,0 +1,153 @@ +/* + * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. + * 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 6801704 + * @summary Test the expected behavior for a wide range of patterns (both + * correct and incorrect). This test documents the behavior of incorrect + * ChoiceFormat patterns either throwing an exception, or discarding + * the incorrect portion of a pattern. + * @run junit PatternsTest + */ + +import java.text.ChoiceFormat; + +import org.junit.jupiter.api.Test; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.Arguments; +import org.junit.jupiter.params.provider.MethodSource; + +import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.params.provider.Arguments.arguments; + +public class PatternsTest { + + private static final String ERR1 = + "Each interval must contain a number before a format"; + private static final String ERR2 = + "Incorrect order of intervals, must be in ascending order"; + + // Check that some valid patterns do not throw an exception. Check + // them against the expected values they should be formatted as. + @ParameterizedTest + @MethodSource + public void validPatternsTest(String pattern, String[] expectedValues) { + var fmt = new ChoiceFormat(pattern); + for (int i=1; i<=expectedValues.length; i++) { + assertEquals(expectedValues[i-1], fmt.format(i), + String.format("ChoiceFormat formatted %s incorrectly:", i)); + } + } + + // Valid patterns ranging from normal appearing to odd. These should not + // throw an exception or discard any portions of the pattern. + private static Arguments[] validPatternsTest() { + return new Arguments[] { + // Multi pattern with trailing empty string Format + arguments("1#foo|2#bar|3#", new String[]{"foo", "bar", ""}), + // Multi patten with trailing '|' + arguments("1#foo|2#bar|", new String[]{"foo", "bar"}), + // Using a '>' (not a Relation) within a Format + arguments("1#foo|2#bar>", new String[]{"foo", "bar>"}), + // Standard Multi Pattern + arguments("1#foo|2#bar", new String[]{"foo", "bar"}), + // Same numerical value Limits, different Relations + arguments("1#foo|1 new ChoiceFormat(pattern)); + assertEquals(errMsg, ex.getMessage()); + } + + // Variety of patterns that break the ChoiceFormat pattern syntax and throw + // an exception. + private static Arguments[] invalidPatternsThrowsTest() { + return new Arguments[] { + arguments("#foo", ERR1), // No Limit + arguments("0#foo|#|1#bar", ERR1), // Missing Relation in SubPattern + arguments("#|", ERR1), // Missing Limit + arguments("##|", ERR1), // Double Relations + arguments("0#foo1#", ERR1), // SubPattern not separated by '|' + arguments("0#foo#", ERR1), // Using a Relation in a format + arguments("0#test|#", ERR1), // SubPattern missing Limit + arguments("0#foo|3#bar|1#baz", ERR2), // Non-ascending Limits + }; + } + + // Check that the incorrect pattern discards the trailing incorrect portion. + // These incorrect patterns should ideally throw an exception, but for + // behavioral compatibility reasons do not. + @ParameterizedTest + @MethodSource + public void invalidPatternsDiscardedTest(String brokenPattern, String actualPattern) { + var cf1 = new ChoiceFormat(brokenPattern); + var cf2 = new ChoiceFormat(actualPattern); + assertEquals(cf2, cf1, + String.format("Expected %s, but got %s", cf2.toPattern(), cf1.toPattern())); + } + + // Variety of incorrect patterns with the actual expected pattern + // after discarding occurs. + private static Arguments[] invalidPatternsDiscardedTest() { + return new Arguments[] { + // Incomplete SubPattern at the end of the Pattern + arguments("0#foo|1#bar|baz", "0#foo|1#bar"), + + // --- These throw an ArrayIndexOutOfBoundsException + // when attempting to format with them --- + // SubPattern with only a Limit (which is interpreted as a Format) + arguments("0", ""), + // SubPattern with only a Format + arguments("foo", ""), + // empty string + arguments("", "") + }; + } + + // Calling format() with empty limits and formats + // throws an ArrayIndexOutOfBoundsException + @Test + public void emptyLimitsAndFormatsTest() { + var cf1 = new ChoiceFormat(""); + assertThrows(ArrayIndexOutOfBoundsException.class, + () -> cf1.format(1)); + + var cf2 = new ChoiceFormat(new double[]{}, new String[]{}); + assertThrows(ArrayIndexOutOfBoundsException.class, + () -> cf2.format(2)); + } +} diff --git a/test/jdk/java/text/Format/ListFormat/TestListFormat.java b/test/jdk/java/text/Format/ListFormat/TestListFormat.java index 2d260c9a94caf..eee6f6dac83ea 100644 --- a/test/jdk/java/text/Format/ListFormat/TestListFormat.java +++ b/test/jdk/java/text/Format/ListFormat/TestListFormat.java @@ -23,7 +23,7 @@ /* * @test - * @bug 8041488 8316974 + * @bug 8041488 8316974 8318569 * @summary Tests for ListFormat class * @run junit TestListFormat */ @@ -200,6 +200,7 @@ static Arguments[] parseObject_parsePos() { arguments(CUSTOM_PATTERNS_MINIMAL, SAMPLE4), }; } + static Arguments[] getInstance_3Arg_InheritPatterns() { return new Arguments[] { arguments(ListFormat.Type.STANDARD, ListFormat.Style.FULL), @@ -213,6 +214,17 @@ static Arguments[] getInstance_3Arg_InheritPatterns() { arguments(ListFormat.Type.UNIT, ListFormat.Style.NARROW), }; } + + static Arguments[] getLocale_localeDependent() { + return new Arguments[] { + arguments(Locale.ROOT), + arguments(Locale.US), + arguments(Locale.GERMANY), + arguments(Locale.JAPAN), + arguments(Locale.SIMPLIFIED_CHINESE), + }; + } + @ParameterizedTest @MethodSource void getInstance_1Arg(String[] patterns, List input, String expected) throws ParseException { @@ -235,6 +247,33 @@ void getInstance_3Arg(Locale l, ListFormat.Type type, ListFormat.Style style, St compareResult(f, SAMPLE3, expected, roundTrip); } + @Test + void getLocale_invariant() { + var f = ListFormat.getInstance(CUSTOM_PATTERNS_FULL); + assertEquals(Locale.ROOT, f.getLocale()); + } + + @Test + void getLocale_default() { + var f = ListFormat.getInstance(); + assertEquals(Locale.getDefault(Locale.Category.FORMAT), f.getLocale()); + } + + @ParameterizedTest + @MethodSource + void getLocale_localeDependent(Locale l) { + var f = ListFormat.getInstance(l, ListFormat.Type.STANDARD, ListFormat.Style.FULL); + assertEquals(l, f.getLocale()); + } + + @Test + void getPatterns_immutability() { + var f = ListFormat.getInstance(CUSTOM_PATTERNS_FULL); + var p = f.getPatterns(); + p[0] = null; + assertArrayEquals(CUSTOM_PATTERNS_FULL, f.getPatterns()); + } + @Test void format_3Arg() { var f = ListFormat.getInstance(); diff --git a/test/jdk/javax/swing/JFileChooser/FileChooserSymLinkTest.java b/test/jdk/javax/swing/JFileChooser/FileChooserSymLinkTest.java index a161a94d90cfa..ef29b708536b0 100644 --- a/test/jdk/javax/swing/JFileChooser/FileChooserSymLinkTest.java +++ b/test/jdk/javax/swing/JFileChooser/FileChooserSymLinkTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2023, Oracle and/or its affiliates. All rights reserved. * 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,48 +74,61 @@ public void run() { static void initialize() throws InterruptedException, InvocationTargetException { //Initialize the components final String INSTRUCTIONS = """ + Instructions to Test: - 1. Open an elevated Command Prompt. - 2. Paste the following commands: - cd /d C:\\ +

      +
    1. Open an elevated Command Prompt. +
    2. Paste the following commands: +
      cd /d C:\\
                       mkdir FileChooserTest
                       cd FileChooserTest
                       mkdir target
      -                mklink /d link target
      +                mklink /d link target
      - 3. Navigate to C:\\FileChooserTest in the JFileChooser. - 4. Use "Enable Multi-Selection" checkbox to enable/disable - MultiSelection Mode - 5. Single-selection: - Click "link" directory, the absolute path of the symbolic - link should be displayed. If it's null, click FAIL. - Click "target" directory, its absolute path should be - displayed. - - Enable multiple selection by clicking the checkbox. - Multi-selection: - Click "link", press Ctrl and then click "target". - Both should be selected and their absolute paths should be - displayed. - - If "link" can't be selected or if its absolute path is null, - click FAIL. - - If "link" can be selected in both single- and multi-selection modes, - click PASS. - 6. When done with testing, paste the following commands to - remove the 'FileChooserTest' directory: - cd \\ - rmdir /s /q C:\\FileChooserTest +
    3. Navigate to C:\\FileChooserTest in + the JFileChooser. +
    4. Perform testing in single- and multi-selection modes: +
        +
      • Single-selection: +
          +
        1. Ensure Enable multi-selection is cleared + (the default state). +
        2. Click link directory, + the absolute path of the symbolic + link should be displayed.
          + If it's null, click Fail. +
        3. Click target directory, + its absolute path should be displayed. +
        +
      • Multi-selection: +
          +
        1. Select Enable multi-selection. +
        2. Click link, +
        3. Press Ctrl and + then click target. +
        4. Both should be selected and + their absolute paths should be displayed. +
        5. If link can't be selected or + if its absolute path is null, + click Fail. +
        +
      +

      If link can be selected in both + single- and multi-selection modes, click Pass.

      +
    5. When done with testing, paste the following commands to + remove the FileChooserTest directory: +
      cd \\
      +                rmdir /s /q C:\\FileChooserTest
      or use File Explorer to clean it up. +
    """; frame = new JFrame("JFileChooser Symbolic Link test"); panel = new JPanel(new BorderLayout()); multiSelection = new JCheckBox("Enable Multi-Selection"); pathList = new JTextArea(10, 50); jfc = new JFileChooser(new File("C:\\")); - passFailJFrame = new PassFailJFrame("Test Instructions", INSTRUCTIONS, 5L, 35, 40); + passFailJFrame = new PassFailJFrame("Test Instructions", INSTRUCTIONS, 5L, 35, 50); PassFailJFrame.addTestWindow(frame); PassFailJFrame.positionTestWindow(frame, PassFailJFrame.Position.HORIZONTAL); diff --git a/test/jdk/sun/security/krb5/tools/ExitOrNot.java b/test/jdk/sun/security/krb5/tools/ExitOrNot.java new file mode 100644 index 0000000000000..9f3000dcb75ae --- /dev/null +++ b/test/jdk/sun/security/krb5/tools/ExitOrNot.java @@ -0,0 +1,61 @@ +/* + * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. + * 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 8316964 + * @summary check exit code in kinit, klist, and ktab + * @requires os.family == "windows" + * @library /test/lib + * @modules java.security.jgss/sun.security.krb5.internal.tools + */ + +import jdk.test.lib.Asserts; +import jdk.test.lib.Platform; +import jdk.test.lib.SecurityTools; + +public class ExitOrNot { + + private static final int BAD = Platform.isWindows() ? -1 : 255; + + public static void main(String[] args) throws Exception { + + // launching the tool still exits + SecurityTools.kinit("u@R p1 p2") + .shouldHaveExitValue(BAD); + + SecurityTools.klist("-x") + .shouldHaveExitValue(BAD); + + SecurityTools.ktab("-x") + .shouldHaveExitValue(BAD); + + // calling the run() methods returns the exit code + Asserts.assertEQ(new sun.security.krb5.internal.tools.Kinit() + .run("u@R p1 p2".split(" ")), -1); + Asserts.assertEQ(new sun.security.krb5.internal.tools.Klist() + .run("-x".split(" ")), -1); + Asserts.assertEQ(new sun.security.krb5.internal.tools.Ktab() + .run("-x".split(" ")), -1); + } +} diff --git a/test/jdk/sun/security/tools/jarsigner/ExitOrNot.java b/test/jdk/sun/security/tools/jarsigner/ExitOrNot.java new file mode 100644 index 0000000000000..ae55074f3a50c --- /dev/null +++ b/test/jdk/sun/security/tools/jarsigner/ExitOrNot.java @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. + * 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 8316964 + * @summary check exit code in jarsigner and keytool + * @library /test/lib + * @modules java.base/sun.security.tools.keytool + * jdk.jartool/sun.security.tools.jarsigner + */ + +import jdk.test.lib.Asserts; +import jdk.test.lib.SecurityTools; + +public class ExitOrNot { + public static void main(String[] args) throws Exception { + + // launching the tool still exits + SecurityTools.jarsigner("1 2 3") + .shouldHaveExitValue(1); + SecurityTools.keytool("-x") + .shouldHaveExitValue(1); + + // calling the run() methods no longer + Asserts.assertEQ(new sun.security.tools.jarsigner.Main() + .run("1 2 3".split(" ")), 1); + + Asserts.assertEQ(new sun.security.tools.keytool.Main() + .run("-x".split(" "), System.out), 1); + } +} diff --git a/test/jdk/tools/jpackage/macosx/SigningAppImageTest.java b/test/jdk/tools/jpackage/macosx/SigningAppImageTest.java index 6cea5ebd33250..65793baa09672 100644 --- a/test/jdk/tools/jpackage/macosx/SigningAppImageTest.java +++ b/test/jdk/tools/jpackage/macosx/SigningAppImageTest.java @@ -55,28 +55,40 @@ * @build SigningAppImageTest * @modules jdk.jpackage/jdk.jpackage.internal * @requires (os.family == "mac") - * @run main/othervm -Xmx512m jdk.jpackage.test.Main + * @run main/othervm/timeout=720 -Xmx512m jdk.jpackage.test.Main * --jpt-run=SigningAppImageTest */ public class SigningAppImageTest { @Test - @Parameter({"true", "0"}) // ({"sign or not", "certificate index"}) - @Parameter({"true", "1"}) - @Parameter({"false", "-1"}) + // ({"sign or not", "signing-key or sign-identity", "certificate index"}) + // Sign, signing-key and ASCII certificate + @Parameter({"true", "true", SigningBase.ASCII_INDEX}) + // Sign, signing-key and UNICODE certificate + @Parameter({"true", "true", SigningBase.UNICODE_INDEX}) + // Sign, signing-indentity and UNICODE certificate + @Parameter({"true", "false", SigningBase.UNICODE_INDEX}) + // Unsigned + @Parameter({"false", "true", "-1"}) public void test(String... testArgs) throws Exception { boolean doSign = Boolean.parseBoolean(testArgs[0]); - int certIndex = Integer.parseInt(testArgs[1]); + boolean signingKey = Boolean.parseBoolean(testArgs[1]); + int certIndex = Integer.parseInt(testArgs[2]); SigningCheck.checkCertificates(certIndex); JPackageCommand cmd = JPackageCommand.helloAppImage(); if (doSign) { cmd.addArguments("--mac-sign", - "--mac-signing-key-user-name", - SigningBase.getDevName(certIndex), "--mac-signing-keychain", SigningBase.getKeyChain()); + if (signingKey) { + cmd.addArguments("--mac-signing-key-user-name", + SigningBase.getDevName(certIndex)); + } else { + cmd.addArguments("--mac-app-image-sign-identity", + SigningBase.getAppCert(certIndex)); + } } AdditionalLauncher testAL = new AdditionalLauncher("testAL"); testAL.applyTo(cmd); diff --git a/test/jdk/tools/jpackage/macosx/SigningAppImageTwoStepsTest.java b/test/jdk/tools/jpackage/macosx/SigningAppImageTwoStepsTest.java index b5d1030ab95d9..cf479d9ba945b 100644 --- a/test/jdk/tools/jpackage/macosx/SigningAppImageTwoStepsTest.java +++ b/test/jdk/tools/jpackage/macosx/SigningAppImageTwoStepsTest.java @@ -56,15 +56,23 @@ * @build SigningAppImageTwoStepsTest * @modules jdk.jpackage/jdk.jpackage.internal * @requires (os.family == "mac") - * @run main/othervm/timeout=360 -Xmx512m jdk.jpackage.test.Main + * @run main/othervm/timeout=720 -Xmx512m jdk.jpackage.test.Main * --jpt-run=SigningAppImageTwoStepsTest */ public class SigningAppImageTwoStepsTest { @Test - @Parameter("true") - @Parameter("false") - public void test(boolean signAppImage) throws Exception { + // ({"sign or not", "signing-key or sign-identity"}) + // Sign and signing-key + @Parameter({"true", "true"}) + // Sign and sign-identity + @Parameter({"true", "false"}) + // Unsigned + @Parameter({"false", "true"}) + public void test(String... testArgs) throws Exception { + boolean signAppImage = Boolean.parseBoolean(testArgs[0]); + boolean signingKey = Boolean.parseBoolean(testArgs[1]); + SigningCheck.checkCertificates(SigningBase.DEFAULT_INDEX); Path appimageOutput = TKit.createTempDirectory("appimage"); @@ -76,10 +84,15 @@ public void test(boolean signAppImage) throws Exception { .setArgumentValue("--dest", appimageOutput); if (signAppImage) { appImageCmd.addArguments("--mac-sign", - "--mac-signing-key-user-name", - SigningBase.getDevName(SigningBase.DEFAULT_INDEX), "--mac-signing-keychain", SigningBase.getKeyChain()); + if (signingKey) { + appImageCmd.addArguments("--mac-signing-key-user-name", + SigningBase.getDevName(SigningBase.DEFAULT_INDEX)); + } else { + appImageCmd.addArguments("--mac-app-image-sign-identity", + SigningBase.getAppCert(SigningBase.DEFAULT_INDEX)); + } } // Add addtional launcher @@ -97,9 +110,14 @@ public void test(boolean signAppImage) throws Exception { cmd.setPackageType(PackageType.IMAGE) .addArguments("--app-image", appImageCmd.outputBundle().toAbsolutePath()) .addArguments("--mac-sign") - .addArguments("--mac-signing-key-user-name", - SigningBase.getDevName(SigningBase.DEFAULT_INDEX)) .addArguments("--mac-signing-keychain", SigningBase.getKeyChain()); + if (signingKey) { + cmd.addArguments("--mac-signing-key-user-name", + SigningBase.getDevName(SigningBase.DEFAULT_INDEX)); + } else { + cmd.addArguments("--mac-app-image-sign-identity", + SigningBase.getAppCert(SigningBase.DEFAULT_INDEX)); + } cmd.executeAndAssertImageCreated(); // Should be signed app image diff --git a/test/jdk/tools/jpackage/macosx/SigningOptionsTest.java b/test/jdk/tools/jpackage/macosx/SigningOptionsTest.java new file mode 100644 index 0000000000000..10b2dd6c8d258 --- /dev/null +++ b/test/jdk/tools/jpackage/macosx/SigningOptionsTest.java @@ -0,0 +1,115 @@ +/* + * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. + * 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.Collection; +import java.util.List; +import jdk.jpackage.test.Annotations.Parameters; +import jdk.jpackage.test.Annotations.Test; +import jdk.jpackage.test.JPackageCommand; +import jdk.jpackage.test.TKit; + +/* + * @test + * @summary Test jpackage signing options errors + * @library ../helpers + * @build SigningOptionsTest + * @modules jdk.jpackage/jdk.jpackage.internal + * @requires (os.family == "mac") + * @run main/othervm/timeout=360 -Xmx512m jdk.jpackage.test.Main + * --jpt-run=SigningOptionsTest + * --jpt-before-run=jdk.jpackage.test.JPackageCommand.useExecutableByDefault + */ + +/* + * @test + * @summary Test jpackage signing options errors + * @library ../helpers + * @build SigningOptionsTest + * @modules jdk.jpackage/jdk.jpackage.internal + * @requires (os.family == "mac") + * @run main/othervm/timeout=360 -Xmx512m jdk.jpackage.test.Main + * --jpt-run=SigningOptionsTest + * --jpt-before-run=jdk.jpackage.test.JPackageCommand.useToolProviderByDefault + */ + +public final class SigningOptionsTest { + + private final String expectedError; + private final JPackageCommand cmd; + + @Parameters + public static Collection input() { + return List.of(new Object[][]{ + // --mac-signing-key-user-name and --mac-app-image-sign-identity + {"Hello", + new String[]{"--mac-sign", + "--mac-signing-key-user-name", "test-key", + "--mac-app-image-sign-identity", "test-identity"}, + null, + "Mutually exclusive options"}, + // --mac-signing-key-user-name and --mac-installer-sign-identity + {"Hello", + new String[]{"--mac-sign", + "--mac-signing-key-user-name", "test-key", + "--mac-installer-sign-identity", "test-identity"}, + null, + "Mutually exclusive options"}, + // --mac-installer-sign-identity and --type app-image + {"Hello", + new String[]{"--mac-sign", + "--mac-installer-sign-identity", "test-identity"}, + null, + "Option [--mac-installer-sign-identity] is not valid with type"}, + // --mac-installer-sign-identity and --type dmg + {"Hello", + new String[]{"--type", "dmg", + "--mac-sign", + "--mac-installer-sign-identity", "test-identity"}, + new String[]{"--type"}, + "Option [--mac-installer-sign-identity] is not valid with type"}, + }); + } + + public SigningOptionsTest(String javaAppDesc, String[] jpackageArgs, + String[] removeArgs, String expectedError) { + this.expectedError = expectedError; + + cmd = JPackageCommand.helloAppImage(javaAppDesc) + .saveConsoleOutput(true).dumpOutput(true); + if (jpackageArgs != null) { + cmd.addArguments(jpackageArgs); + } if (removeArgs != null) { + for (String arg : removeArgs) { + cmd.removeArgumentWithValue(arg); + } + } + } + + @Test + public void test() { + List output = cmd.execute(1).getOutput(); + TKit.assertNotNull(output, "output is null"); + TKit.assertTextStream(expectedError).apply(output.stream()); + } + +} diff --git a/test/jdk/tools/jpackage/macosx/SigningPackageFromTwoStepAppImageTest.java b/test/jdk/tools/jpackage/macosx/SigningPackageFromTwoStepAppImageTest.java index 861bcecfe0934..48f5dca898640 100644 --- a/test/jdk/tools/jpackage/macosx/SigningPackageFromTwoStepAppImageTest.java +++ b/test/jdk/tools/jpackage/macosx/SigningPackageFromTwoStepAppImageTest.java @@ -72,7 +72,7 @@ private static void verifyPKG(JPackageCommand cmd) { } Path outputBundle = cmd.outputBundle(); - SigningBase.verifyPkgutil(outputBundle, SigningBase.DEFAULT_INDEX); + SigningBase.verifyPkgutil(outputBundle, true, SigningBase.DEFAULT_INDEX); SigningBase.verifySpctl(outputBundle, "install", SigningBase.DEFAULT_INDEX); } @@ -97,9 +97,17 @@ private static void verifyAppImageInDMG(JPackageCommand cmd) { } @Test - @Parameter("true") - @Parameter("false") - public static void test(boolean signAppImage) throws Exception { + // ({"sign or not", "signing-key or sign-identity"}) + // Sign and signing-key + @Parameter({"true", "true"}) + // Sign and sign-identity + @Parameter({"true", "false"}) + // Unsigned + @Parameter({"false", "true"}) + public void test(String... testArgs) throws Exception { + boolean signAppImage = Boolean.parseBoolean(testArgs[0]); + boolean signingKey = Boolean.parseBoolean(testArgs[1]); + SigningCheck.checkCertificates(SigningBase.DEFAULT_INDEX); Path appimageOutput = TKit.createTempDirectory("appimage"); @@ -110,9 +118,15 @@ public static void test(boolean signAppImage) throws Exception { JPackageCommand appImageCmd = JPackageCommand.helloAppImage() .setArgumentValue("--dest", appimageOutput); if (signAppImage) { - appImageCmd.addArguments("--mac-sign", "--mac-signing-key-user-name", - SigningBase.getDevName(SigningBase.DEFAULT_INDEX), + appImageCmd.addArguments("--mac-sign", "--mac-signing-keychain", SigningBase.getKeyChain()); + if (signingKey) { + appImageCmd.addArguments("--mac-signing-key-user-name", + SigningBase.getDevName(SigningBase.DEFAULT_INDEX)); + } else { + appImageCmd.addArguments("--mac-app-image-sign-identity", + SigningBase.getAppCert(SigningBase.DEFAULT_INDEX)); + } } // Generate app image @@ -126,9 +140,14 @@ public static void test(boolean signAppImage) throws Exception { appImageSignedCmd.setPackageType(PackageType.IMAGE) .addArguments("--app-image", appImageCmd.outputBundle().toAbsolutePath()) .addArguments("--mac-sign") - .addArguments("--mac-signing-key-user-name", - SigningBase.getDevName(SigningBase.DEFAULT_INDEX)) .addArguments("--mac-signing-keychain", SigningBase.getKeyChain()); + if (signingKey) { + appImageSignedCmd.addArguments("--mac-signing-key-user-name", + SigningBase.getDevName(SigningBase.DEFAULT_INDEX)); + } else { + appImageSignedCmd.addArguments("--mac-app-image-sign-identity", + SigningBase.getAppCert(SigningBase.DEFAULT_INDEX)); + } appImageSignedCmd.executeAndAssertImageCreated(); // Should be signed app image @@ -141,16 +160,30 @@ public static void test(boolean signAppImage) throws Exception { cmd.removeArgumentWithValue("--input"); if (signAppImage) { cmd.addArguments("--mac-sign", - "--mac-signing-key-user-name", - SigningBase.getDevName(SigningBase.DEFAULT_INDEX), "--mac-signing-keychain", SigningBase.getKeyChain()); + if (signingKey) { + cmd.addArguments("--mac-signing-key-user-name", + SigningBase.getDevName(SigningBase.DEFAULT_INDEX)); + } else { + cmd.addArguments("--mac-installer-sign-identity", + SigningBase.getInstallerCert(SigningBase.DEFAULT_INDEX)); + } } }) .forTypes(PackageType.MAC_PKG) .addBundleVerifier( SigningPackageFromTwoStepAppImageTest::verifyPKG) .forTypes(PackageType.MAC_DMG) + .addInitializer(cmd -> { + if (signAppImage && !signingKey) { + // jpackage throws expected error with + // --mac-installer-sign-identity and DMG type + cmd.removeArgument("--mac-sign"); + cmd.removeArgumentWithValue("--mac-signing-keychain"); + cmd.removeArgumentWithValue("--mac-installer-sign-identity"); + } + }) .addBundleVerifier( SigningPackageFromTwoStepAppImageTest::verifyDMG) .addBundleVerifier( diff --git a/test/jdk/tools/jpackage/macosx/SigningPackageTest.java b/test/jdk/tools/jpackage/macosx/SigningPackageTest.java index d7a2395db2adf..c555b0386cde3 100644 --- a/test/jdk/tools/jpackage/macosx/SigningPackageTest.java +++ b/test/jdk/tools/jpackage/macosx/SigningPackageTest.java @@ -59,15 +59,27 @@ * @build SigningPackageTest * @modules jdk.jpackage/jdk.jpackage.internal * @requires (os.family == "mac") - * @run main/othervm/timeout=360 -Xmx512m jdk.jpackage.test.Main + * @run main/othervm/timeout=720 -Xmx512m jdk.jpackage.test.Main * --jpt-run=SigningPackageTest */ public class SigningPackageTest { + private static boolean isAppImageSigned(JPackageCommand cmd) { + return cmd.hasArgument("--mac-signing-key-user-name") || + cmd.hasArgument("--mac-app-image-sign-identity"); + } + + private static boolean isPKGSigned(JPackageCommand cmd) { + return cmd.hasArgument("--mac-signing-key-user-name") || + cmd.hasArgument("--mac-installer-sign-identity"); + } + private static void verifyPKG(JPackageCommand cmd) { Path outputBundle = cmd.outputBundle(); - SigningBase.verifyPkgutil(outputBundle, getCertIndex(cmd)); - SigningBase.verifySpctl(outputBundle, "install", getCertIndex(cmd)); + SigningBase.verifyPkgutil(outputBundle, isPKGSigned(cmd), getCertIndex(cmd)); + if (isPKGSigned(cmd)) { + SigningBase.verifySpctl(outputBundle, "install", getCertIndex(cmd)); + } } private static void verifyDMG(JPackageCommand cmd) { @@ -82,22 +94,45 @@ private static void verifyAppImageInDMG(JPackageCommand cmd) { // We will be called with all folders in DMG since JDK-8263155, but // we only need to verify app. if (dmgImage.endsWith(cmd.name() + ".app")) { - SigningBase.verifyCodesign(launcherPath, true, getCertIndex(cmd)); - SigningBase.verifyCodesign(dmgImage, true, getCertIndex(cmd)); - SigningBase.verifySpctl(dmgImage, "exec", getCertIndex(cmd)); + SigningBase.verifyCodesign(launcherPath, isAppImageSigned(cmd), + getCertIndex(cmd)); + SigningBase.verifyCodesign(dmgImage, isAppImageSigned(cmd), + getCertIndex(cmd)); + if (isAppImageSigned(cmd)) { + SigningBase.verifySpctl(dmgImage, "exec", getCertIndex(cmd)); + } } }); } private static int getCertIndex(JPackageCommand cmd) { - String devName = cmd.getArgumentValue("--mac-signing-key-user-name"); - return SigningBase.getDevNameIndex(devName); + if (cmd.hasArgument("--mac-signing-key-user-name")) { + String devName = cmd.getArgumentValue("--mac-signing-key-user-name"); + return SigningBase.getDevNameIndex(devName); + } else { + // Signing-indentity + return Integer.valueOf(SigningBase.UNICODE_INDEX); + } } @Test - @Parameter("0") - @Parameter("1") - public static void test(int certIndex) throws Exception { + // ("signing-key or sign-identity", "sign app-image", "sign pkg", "certificate index"}) + // Signing-key and ASCII certificate + @Parameter({"true", "true", "true", SigningBase.ASCII_INDEX}) + // Signing-key and UNICODE certificate + @Parameter({"true", "true", "true", SigningBase.UNICODE_INDEX}) + // Signing-indentity and UNICODE certificate + @Parameter({"false", "true", "true", SigningBase.UNICODE_INDEX}) + // Signing-indentity, but sign app-image only and UNICODE certificate + @Parameter({"false", "true", "false", SigningBase.UNICODE_INDEX}) + // Signing-indentity, but sign pkg only and UNICODE certificate + @Parameter({"false", "false", "true", SigningBase.UNICODE_INDEX}) + public static void test(String... testArgs) throws Exception { + boolean signingKey = Boolean.parseBoolean(testArgs[0]); + boolean signAppImage = Boolean.parseBoolean(testArgs[1]); + boolean signPKG = Boolean.parseBoolean(testArgs[2]); + int certIndex = Integer.parseInt(testArgs[3]); + SigningCheck.checkCertificates(certIndex); new PackageTest() @@ -105,12 +140,39 @@ public static void test(int certIndex) throws Exception { .forTypes(PackageType.MAC) .addInitializer(cmd -> { cmd.addArguments("--mac-sign", - "--mac-signing-key-user-name", SigningBase.getDevName(certIndex), "--mac-signing-keychain", SigningBase.getKeyChain()); + if (signingKey) { + cmd.addArguments("--mac-signing-key-user-name", + SigningBase.getDevName(certIndex)); + } else { + if (signAppImage) { + cmd.addArguments("--mac-app-image-sign-identity", + SigningBase.getAppCert(certIndex)); + } + if (signPKG) { + cmd.addArguments("--mac-installer-sign-identity", + SigningBase.getInstallerCert(certIndex)); + } + } }) .forTypes(PackageType.MAC_PKG) .addBundleVerifier(SigningPackageTest::verifyPKG) .forTypes(PackageType.MAC_DMG) + .addInitializer(cmd -> { + if (!signingKey) { + // jpackage throws expected error with + // --mac-installer-sign-identity and DMG type + cmd.removeArgumentWithValue("--mac-installer-sign-identity"); + // In case of not signing app image and DMG we need to + // remove signing completely, otherwise we will default + // to --mac-signing-key-user-name once + // --mac-installer-sign-identity is removed. + if (!signAppImage) { + cmd.removeArgumentWithValue("--mac-signing-keychain"); + cmd.removeArgument("--mac-sign"); + } + } + }) .addBundleVerifier(SigningPackageTest::verifyDMG) .addBundleVerifier(SigningPackageTest::verifyAppImageInDMG) .run(); diff --git a/test/jdk/tools/jpackage/macosx/SigningPackageTwoStepTest.java b/test/jdk/tools/jpackage/macosx/SigningPackageTwoStepTest.java index 66145a9793bb6..a34f7921b9126 100644 --- a/test/jdk/tools/jpackage/macosx/SigningPackageTwoStepTest.java +++ b/test/jdk/tools/jpackage/macosx/SigningPackageTwoStepTest.java @@ -73,7 +73,7 @@ private static void verifyPKG(JPackageCommand cmd) { } Path outputBundle = cmd.outputBundle(); - SigningBase.verifyPkgutil(outputBundle, SigningBase.DEFAULT_INDEX); + SigningBase.verifyPkgutil(outputBundle, true, SigningBase.DEFAULT_INDEX); SigningBase.verifySpctl(outputBundle, "install", SigningBase.DEFAULT_INDEX); } @@ -101,10 +101,18 @@ private static void verifyAppImageInDMG(JPackageCommand cmd) { } @Test - @Parameter("true") - @Parameter("false") - public static void test(boolean signAppImage) throws Exception { - SigningCheck.checkCertificates(0); + // (Signed, "signing-key or sign-identity"}) + // Signed and signing-key + @Parameter({"true", "true"}) + // Signed and signing-identity + @Parameter({"true", "false"}) + // Unsigned + @Parameter({"false", "true"}) + public static void test(String... testArgs) throws Exception { + boolean signAppImage = Boolean.parseBoolean(testArgs[0]); + boolean signingKey = Boolean.parseBoolean(testArgs[1]); + + SigningCheck.checkCertificates(SigningBase.DEFAULT_INDEX); Path appimageOutput = TKit.createTempDirectory("appimage"); @@ -112,10 +120,15 @@ public static void test(boolean signAppImage) throws Exception { .setArgumentValue("--dest", appimageOutput); if (signAppImage) { appImageCmd.addArguments("--mac-sign") - .addArguments("--mac-signing-key-user-name", - SigningBase.getDevName(0)) - .addArguments("--mac-signing-keychain", - SigningBase.getKeyChain()); + .addArguments("--mac-signing-keychain", + SigningBase.getKeyChain()); + if (signingKey) { + appImageCmd.addArguments("--mac-signing-key-user-name", + SigningBase.getDevName(SigningBase.DEFAULT_INDEX)); + } else { + appImageCmd.addArguments("--mac-app-image-sign-identity", + SigningBase.getAppCert(SigningBase.DEFAULT_INDEX)); + } } new PackageTest() @@ -126,15 +139,31 @@ public static void test(boolean signAppImage) throws Exception { cmd.removeArgumentWithValue("--input"); if (signAppImage) { cmd.addArguments("--mac-sign", - "--mac-signing-key-user-name", - SigningBase.getDevName(0), "--mac-signing-keychain", SigningBase.getKeyChain()); + if (signingKey) { + cmd.addArguments("--mac-signing-key-user-name", + SigningBase.getDevName(SigningBase.DEFAULT_INDEX)); + } else { + cmd.addArguments("--mac-installer-sign-identity", + SigningBase.getInstallerCert(SigningBase.DEFAULT_INDEX)); + } } }) .forTypes(PackageType.MAC_PKG) .addBundleVerifier(SigningPackageTwoStepTest::verifyPKG) .forTypes(PackageType.MAC_DMG) + .addInitializer(cmd -> { + if (signAppImage && !signingKey) { + // jpackage throws expected error with + // --mac-installer-sign-identity and DMG type + cmd.removeArgumentWithValue("--mac-installer-sign-identity"); + // It will do nothing, but it signals test that app + // image itself is signed for verification. + cmd.addArguments("--mac-app-image-sign-identity", + SigningBase.getAppCert(SigningBase.DEFAULT_INDEX)); + } + }) .addBundleVerifier(SigningPackageTwoStepTest::verifyDMG) .addBundleVerifier(SigningPackageTwoStepTest::verifyAppImageInDMG) .run(); diff --git a/test/jdk/tools/jpackage/macosx/base/SigningBase.java b/test/jdk/tools/jpackage/macosx/base/SigningBase.java index 702e7b1f7ae85..15031bc42be57 100644 --- a/test/jdk/tools/jpackage/macosx/base/SigningBase.java +++ b/test/jdk/tools/jpackage/macosx/base/SigningBase.java @@ -33,6 +33,8 @@ public class SigningBase { public static int DEFAULT_INDEX = 0; + public static final String ASCII_INDEX = "0"; + public static final String UNICODE_INDEX = "0"; private static String [] DEV_NAMES = { "jpackage.openjdk.java.net", "jpackage.openjdk.java.net (รถ)", @@ -182,22 +184,30 @@ private static void verifySpctlResult(List output, Path target, checkString(output, lookupString); } - private static List pkgutilResult(Path target) { + private static List pkgutilResult(Path target, boolean signed) { List result = new Executor() .setExecutable("/usr/sbin/pkgutil") .addArguments("--check-signature", target.toString()) - .executeAndGetOutput(); + .saveOutput() + .execute(signed ? 0 : 1) + .getOutput(); return result; } - private static void verifyPkgutilResult(List result, int certIndex) { + private static void verifyPkgutilResult(List result, boolean signed, + int certIndex) { result.stream().forEachOrdered(TKit::trace); - String lookupString = "Status: signed by"; - checkString(result, lookupString); - lookupString = "1. " + getInstallerCert(certIndex); - checkString(result, lookupString); + if (signed) { + String lookupString = "Status: signed by"; + checkString(result, lookupString); + lookupString = "1. " + getInstallerCert(certIndex); + checkString(result, lookupString); + } else { + String lookupString = "Status: no signature"; + checkString(result, lookupString); + } } public static void verifyCodesign(Path target, boolean signed, int certIndex) { @@ -228,9 +238,9 @@ public static void verifySpctl(Path target, String type, int certIndex) { verifySpctlResult(output, target, type, result.getExitCode(), certIndex); } - public static void verifyPkgutil(Path target, int certIndex) { - List result = pkgutilResult(target); - verifyPkgutilResult(result, certIndex); + public static void verifyPkgutil(Path target, boolean signed, int certIndex) { + List result = pkgutilResult(target, signed); + verifyPkgutilResult(result, signed, certIndex); } public static void verifyAppImageSignature(JPackageCommand appImageCmd, @@ -247,7 +257,7 @@ public static void verifyAppImageSignature(JPackageCommand appImageCmd, Path appImage = appImageCmd.outputBundle(); SigningBase.verifyCodesign(appImage, isSigned, SigningBase.DEFAULT_INDEX); if (isSigned) { - SigningBase.verifySpctl(appImage, "exec", 0); + SigningBase.verifySpctl(appImage, "exec", SigningBase.DEFAULT_INDEX); } } diff --git a/test/jdk/tools/jpackage/share/jdk/jpackage/tests/PredefinedAppImageErrorTest.java b/test/jdk/tools/jpackage/share/jdk/jpackage/tests/PredefinedAppImageErrorTest.java index 8fb3e60244971..d03c7cf28df96 100644 --- a/test/jdk/tools/jpackage/share/jdk/jpackage/tests/PredefinedAppImageErrorTest.java +++ b/test/jdk/tools/jpackage/share/jdk/jpackage/tests/PredefinedAppImageErrorTest.java @@ -69,7 +69,7 @@ public static Collection input() throws IOException { }, // --mac-app-store is required {"Hello", - new String[]{"--mac-sign", "--mac-app-store"}, + new String[]{"--mac-sign", "--mac-app-store", "--mac-app-image-sign-identity", "test"}, new String[]{"--input", "--dest", "--name", "--main-jar", "--main-class"}, TKit.isOSX() ? "Option [--mac-app-store] is not valid" : diff --git a/test/langtools/tools/javac/lambda/methodReference/PrivateMethodReferenceWithTypeVarTest.java b/test/langtools/tools/javac/lambda/methodReference/PrivateMethodReferenceWithTypeVarTest.java new file mode 100644 index 0000000000000..b87783416a383 --- /dev/null +++ b/test/langtools/tools/javac/lambda/methodReference/PrivateMethodReferenceWithTypeVarTest.java @@ -0,0 +1,34 @@ +/* + * @test /nodynamiccopyright/ + * @bug 8318160 + * @summary javac does not reject private method reference with type-variable receiver + * @compile/fail/ref=PrivateMethodReferenceWithTypeVarTest.out -XDrawDiagnostics PrivateMethodReferenceWithTypeVarTest.java + */ + +import java.util.function.*; + +class PrivateMethodReferenceWithTypeVarTest { + class Foo { + X get() { return null; } + } + + private String asString() { + return "bar"; + } + + private String asString2(Object o) { + return "bar"; + } + + static Function m1() { + return T::asString; + } + + static Function m2(T t) { + return t::asString2; + } + + static Function m2(Foo foo) { + return foo.get()::asString2; + } +} diff --git a/test/langtools/tools/javac/lambda/methodReference/PrivateMethodReferenceWithTypeVarTest.out b/test/langtools/tools/javac/lambda/methodReference/PrivateMethodReferenceWithTypeVarTest.out new file mode 100644 index 0000000000000..b4dac12a9ae59 --- /dev/null +++ b/test/langtools/tools/javac/lambda/methodReference/PrivateMethodReferenceWithTypeVarTest.out @@ -0,0 +1,4 @@ +PrivateMethodReferenceWithTypeVarTest.java:24:16: compiler.err.report.access: asString(), private, PrivateMethodReferenceWithTypeVarTest +PrivateMethodReferenceWithTypeVarTest.java:28:16: compiler.err.report.access: asString2(java.lang.Object), private, PrivateMethodReferenceWithTypeVarTest +PrivateMethodReferenceWithTypeVarTest.java:32:16: compiler.err.report.access: asString2(java.lang.Object), private, PrivateMethodReferenceWithTypeVarTest +3 errors