diff --git a/make/Hsdis.gmk b/make/Hsdis.gmk index 7496a3a2cf1..6de0e628a52 100644 --- a/make/Hsdis.gmk +++ b/make/Hsdis.gmk @@ -1,5 +1,5 @@ # -# Copyright (c) 2020, 2023, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -38,7 +38,7 @@ HSDIS_OUTPUT_DIR := $(SUPPORT_OUTPUTDIR)/hsdis REAL_HSDIS_NAME := hsdis-$(OPENJDK_TARGET_CPU_LEGACY_LIB)$(SHARED_LIBRARY_SUFFIX) BUILT_HSDIS_LIB := $(HSDIS_OUTPUT_DIR)/$(REAL_HSDIS_NAME) -HSDIS_TOOLCHAIN := TOOLCHAIN_DEFAULT +HSDIS_LINK_TYPE := C HSDIS_TOOLCHAIN_CFLAGS := $(CFLAGS_JDKLIB) HSDIS_TOOLCHAIN_LDFLAGS := $(LDFLAGS_JDKLIB) @@ -59,8 +59,8 @@ endif ifeq ($(HSDIS_BACKEND), llvm) # Use C++ instead of C + HSDIS_LINK_TYPE := C++ HSDIS_TOOLCHAIN_CFLAGS := $(CXXFLAGS_JDKLIB) - HSDIS_TOOLCHAIN := TOOLCHAIN_LINK_CXX ifeq ($(call isTargetOs, linux), true) LLVM_OS := pc-linux-gnu @@ -91,14 +91,11 @@ ifeq ($(HSDIS_BACKEND), binutils) endif endif - $(eval $(call DefineNativeToolchain, TOOLCHAIN_MINGW, \ - CC := $(MINGW_BASE)-gcc, \ - LD := $(MINGW_BASE)-ld, \ - OBJCOPY := $(MINGW_BASE)-objcopy, \ - RC := $(RC), \ - SYSROOT_CFLAGS := --sysroot=$(MINGW_SYSROOT), \ - SYSROOT_LDFLAGS := --sysroot=$(MINGW_SYSROOT), \ - )) + BUILD_HSDIS_CC := $(MINGW_BASE)-gcc + BUILD_HSDIS_LD := $(MINGW_BASE)-ld + BUILD_HSDIS_OBJCOPY := $(MINGW_BASE)-objcopy + BUILD_HSDIS_SYSROOT_CFLAGS := --sysroot=$(MINGW_SYSROOT) + BUILD_HSDIS_SYSROOT_LDFLAGS := --sysroot=$(MINGW_SYSROOT) MINGW_SYSROOT_LIB_PATH := $(MINGW_SYSROOT)/mingw/lib ifeq ($(wildcard $(MINGW_SYSROOT_LIB_PATH)), ) @@ -122,8 +119,8 @@ ifeq ($(HSDIS_BACKEND), binutils) TOOLCHAIN_TYPE := gcc OPENJDK_TARGET_OS := linux + OPENJDK_TARGET_OS_TYPE := unix CC_OUT_OPTION := -o$(SPACE) - LD_OUT_OPTION := -o$(SPACE) GENDEPS_FLAGS := -MMD -MF CFLAGS_DEBUG_SYMBOLS := -g DISABLED_WARNINGS := @@ -131,7 +128,6 @@ ifeq ($(HSDIS_BACKEND), binutils) CFLAGS_WARNINGS_ARE_ERRORS := -Werror SHARED_LIBRARY_FLAGS := -shared - HSDIS_TOOLCHAIN := TOOLCHAIN_MINGW HSDIS_TOOLCHAIN_CFLAGS := HSDIS_TOOLCHAIN_LDFLAGS := -L$(MINGW_GCC_LIB_PATH) -L$(MINGW_SYSROOT_LIB_PATH) MINGW_DLLCRT := $(MINGW_SYSROOT_LIB_PATH)/dllcrt2.o @@ -144,9 +140,9 @@ endif $(eval $(call SetupJdkLibrary, BUILD_HSDIS, \ NAME := hsdis, \ + LINK_TYPE := $(HSDIS_LINK_TYPE), \ SRC := $(TOPDIR)/src/utils/hsdis/$(HSDIS_BACKEND), \ EXTRA_HEADER_DIRS := $(TOPDIR)/src/utils/hsdis, \ - TOOLCHAIN := $(HSDIS_TOOLCHAIN), \ OUTPUT_DIR := $(HSDIS_OUTPUT_DIR), \ OBJECT_DIR := $(HSDIS_OUTPUT_DIR), \ DISABLED_WARNINGS_gcc := undef format-nonliteral sign-compare, \ diff --git a/make/InitSupport.gmk b/make/InitSupport.gmk index 9ea01d375ce..4b14c4f9ad9 100644 --- a/make/InitSupport.gmk +++ b/make/InitSupport.gmk @@ -1,5 +1,5 @@ # -# Copyright (c) 2011, 2022, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2011, 2024, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -427,8 +427,9 @@ else # $(HAS_SPEC)=true # Cleanup after a compare build define CleanupCompareBuild - # If running with a COMPARE_BUILD patch, reverse-apply it - $(if $(COMPARE_BUILD_PATCH), cd $(topdir) && $(PATCH) -R -p1 < $(COMPARE_BUILD_PATCH)) + # If running with a COMPARE_BUILD patch, reverse-apply it, but continue + # even if that fails (can happen with removed files). + $(if $(COMPARE_BUILD_PATCH), cd $(topdir) && $(PATCH) -R -p1 < $(COMPARE_BUILD_PATCH) || true) # Move this build away and restore the original build $(MKDIR) -p $(topdir)/build/compare-build $(MV) $(OUTPUTDIR) $(COMPARE_BUILD_OUTPUTDIR) diff --git a/make/autoconf/buildjdk-spec.gmk.template b/make/autoconf/buildjdk-spec.gmk.template index 993ed503902..924389b94e8 100644 --- a/make/autoconf/buildjdk-spec.gmk.template +++ b/make/autoconf/buildjdk-spec.gmk.template @@ -1,5 +1,5 @@ # -# Copyright (c) 2015, 2023, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -40,6 +40,7 @@ LDCXX := @BUILD_LDCXX@ AS := @BUILD_AS@ NM := @BUILD_NM@ AR := @BUILD_AR@ +LIB := @BUILD_LIB@ OBJCOPY := @BUILD_OBJCOPY@ STRIP := @BUILD_STRIP@ SYSROOT_CFLAGS := @BUILD_SYSROOT_CFLAGS@ diff --git a/make/autoconf/flags-cflags.m4 b/make/autoconf/flags-cflags.m4 index e95f32f4f7d..efc8025a074 100644 --- a/make/autoconf/flags-cflags.m4 +++ b/make/autoconf/flags-cflags.m4 @@ -40,7 +40,6 @@ AC_DEFUN([FLAGS_SETUP_SHARED_LIBS], SET_EXECUTABLE_ORIGIN='-Wl,-rpath,\$$ORIGIN[$]1' SET_SHARED_LIBRARY_ORIGIN="-Wl,-z,origin $SET_EXECUTABLE_ORIGIN" SET_SHARED_LIBRARY_NAME='-Wl,-soname=[$]1' - SET_SHARED_LIBRARY_MAPFILE='-Wl,-version-script=[$]1' elif test "x$TOOLCHAIN_TYPE" = xclang; then if test "x$OPENJDK_TARGET_OS" = xmacosx; then @@ -49,7 +48,6 @@ AC_DEFUN([FLAGS_SETUP_SHARED_LIBS], SET_EXECUTABLE_ORIGIN='-Wl,-rpath,@loader_path$(or [$]1,/.)' SET_SHARED_LIBRARY_ORIGIN="$SET_EXECUTABLE_ORIGIN" SET_SHARED_LIBRARY_NAME='-Wl,-install_name,@rpath/[$]1' - SET_SHARED_LIBRARY_MAPFILE='-Wl,-exported_symbols_list,[$]1' elif test "x$OPENJDK_TARGET_OS" = xaix; then # Linking is different on aix @@ -57,14 +55,12 @@ AC_DEFUN([FLAGS_SETUP_SHARED_LIBS], SET_EXECUTABLE_ORIGIN="" SET_SHARED_LIBRARY_ORIGIN='' SET_SHARED_LIBRARY_NAME='' - SET_SHARED_LIBRARY_MAPFILE='' else # Default works for linux, might work on other platforms as well. SHARED_LIBRARY_FLAGS='-shared' SET_EXECUTABLE_ORIGIN='-Wl,-rpath,\$$ORIGIN[$]1' SET_SHARED_LIBRARY_NAME='-Wl,-soname=[$]1' - SET_SHARED_LIBRARY_MAPFILE='-Wl,-version-script=[$]1' # arm specific settings if test "x$OPENJDK_TARGET_CPU" = "xarm"; then @@ -80,20 +76,17 @@ AC_DEFUN([FLAGS_SETUP_SHARED_LIBS], SET_EXECUTABLE_ORIGIN="" SET_SHARED_LIBRARY_ORIGIN='' SET_SHARED_LIBRARY_NAME='' - SET_SHARED_LIBRARY_MAPFILE='' elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then SHARED_LIBRARY_FLAGS="-dll" SET_EXECUTABLE_ORIGIN='' SET_SHARED_LIBRARY_ORIGIN='' SET_SHARED_LIBRARY_NAME='' - SET_SHARED_LIBRARY_MAPFILE='-def:[$]1' fi AC_SUBST(SET_EXECUTABLE_ORIGIN) AC_SUBST(SET_SHARED_LIBRARY_ORIGIN) AC_SUBST(SET_SHARED_LIBRARY_NAME) - AC_SUBST(SET_SHARED_LIBRARY_MAPFILE) AC_SUBST(SHARED_LIBRARY_FLAGS) ]) @@ -122,6 +115,11 @@ AC_DEFUN([FLAGS_SETUP_DEBUG_SYMBOLS], # Add debug prefix map gcc system include paths, as they cause # non-deterministic debug paths depending on gcc path location. DEBUG_PREFIX_MAP_GCC_INCLUDE_PATHS + + # Add debug prefix map for OUTPUTDIR to handle the scenario when + # it is not located within WORKSPACE_ROOT + outputdir_slash="${OUTPUTDIR%/}/" + DEBUG_PREFIX_CFLAGS="$DEBUG_PREFIX_CFLAGS -fdebug-prefix-map=${outputdir_slash}=" ] ) fi diff --git a/make/autoconf/flags-ldflags.m4 b/make/autoconf/flags-ldflags.m4 index 195c1d34159..58bc4a44bfb 100644 --- a/make/autoconf/flags-ldflags.m4 +++ b/make/autoconf/flags-ldflags.m4 @@ -1,5 +1,5 @@ # -# Copyright (c) 2011, 2023, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2011, 2024, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -93,7 +93,7 @@ AC_DEFUN([FLAGS_SETUP_LDFLAGS_HELPER], BASIC_LDFLAGS_JVM_ONLY="-Wl,-lC_r -bbigtoc" elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then - BASIC_LDFLAGS="-nologo -opt:ref" + BASIC_LDFLAGS="-opt:ref" BASIC_LDFLAGS_JDK_ONLY="-incremental:no" BASIC_LDFLAGS_JVM_ONLY="-opt:icf,8 -subsystem:windows" fi diff --git a/make/autoconf/flags-other.m4 b/make/autoconf/flags-other.m4 index 7e2521ffef3..8d4d405b076 100644 --- a/make/autoconf/flags-other.m4 +++ b/make/autoconf/flags-other.m4 @@ -1,5 +1,5 @@ # -# Copyright (c) 2011, 2023, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2011, 2024, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -33,9 +33,6 @@ AC_DEFUN([FLAGS_SETUP_ARFLAGS], # FIXME: figure out if we should select AR flags depending on OS or toolchain. if test "x$OPENJDK_TARGET_OS" = xaix; then ARFLAGS="-X64" - elif test "x$OPENJDK_TARGET_OS" = xwindows; then - # lib.exe is used as AR to create static libraries. - ARFLAGS="-nologo -NODEFAULTLIB:MSVCRT" else ARFLAGS="" fi @@ -43,6 +40,18 @@ AC_DEFUN([FLAGS_SETUP_ARFLAGS], AC_SUBST(ARFLAGS) ]) +AC_DEFUN([FLAGS_SETUP_LIBFLAGS], +[ + # LIB is used to create static libraries on Windows + if test "x$OPENJDK_TARGET_OS" = xwindows; then + LIBFLAGS="-nodefaultlib:msvcrt" + else + LIBFLAGS="" + fi + + AC_SUBST(LIBFLAGS) +]) + AC_DEFUN([FLAGS_SETUP_STRIPFLAGS], [ ## Setup strip. diff --git a/make/autoconf/flags.m4 b/make/autoconf/flags.m4 index 8c029f7d2f5..147382f398e 100644 --- a/make/autoconf/flags.m4 +++ b/make/autoconf/flags.m4 @@ -1,5 +1,5 @@ # -# Copyright (c) 2011, 2023, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2011, 2024, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -364,24 +364,12 @@ AC_DEFUN([FLAGS_SETUP_TOOLCHAIN_CONTROL], if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then CC_OUT_OPTION=-Fo - LD_OUT_OPTION=-out: - AR_OUT_OPTION=-out: else # The option used to specify the target .o,.a or .so file. # When compiling, how to specify the to be created object file. CC_OUT_OPTION='-o$(SPACE)' - # When linking, how to specify the output - LD_OUT_OPTION='-o$(SPACE)' - # When archiving, how to specify the destination static archive. - if test "x$OPENJDK_TARGET_OS" = xmacosx; then - AR_OUT_OPTION='-r -cs$(SPACE)' - else - AR_OUT_OPTION='-rcs$(SPACE)' - fi fi AC_SUBST(CC_OUT_OPTION) - AC_SUBST(LD_OUT_OPTION) - AC_SUBST(AR_OUT_OPTION) # Generate make dependency files if test "x$TOOLCHAIN_TYPE" = xgcc; then @@ -423,6 +411,7 @@ AC_DEFUN([FLAGS_SETUP_FLAGS], FLAGS_SETUP_LDFLAGS FLAGS_SETUP_ARFLAGS + FLAGS_SETUP_LIBFLAGS FLAGS_SETUP_STRIPFLAGS FLAGS_SETUP_RCFLAGS FLAGS_SETUP_NMFLAGS diff --git a/make/autoconf/spec.gmk.template b/make/autoconf/spec.gmk.template index e9d53fcd77a..863a51eeb4a 100644 --- a/make/autoconf/spec.gmk.template +++ b/make/autoconf/spec.gmk.template @@ -498,8 +498,6 @@ COMPILER_COMMAND_FILE_FLAG := @COMPILER_COMMAND_FILE_FLAG@ COMPILER_BINDCMD_FILE_FLAG := @COMPILER_BINDCMD_FILE_FLAG@ CC_OUT_OPTION := @CC_OUT_OPTION@ -LD_OUT_OPTION := @LD_OUT_OPTION@ -AR_OUT_OPTION := @AR_OUT_OPTION@ # Flags used for overriding the default opt setting for a C/C++ source file. C_O_FLAG_HIGHEST_JVM := @C_O_FLAG_HIGHEST_JVM@ @@ -604,10 +602,10 @@ BUILD_SYSROOT_LDFLAGS := @BUILD_SYSROOT_LDFLAGS@ AS := @AS@ -# AR is used to create a static library (is ar in unix, lib.exe in windows) AR := @AR@ ARFLAGS := @ARFLAGS@ - +LIB := @LIB@ +LIBFLAGS := @LIBFLAGS@ NM := @NM@ NMFLAGS := @NMFLAGS@ STRIP := @STRIP@ @@ -619,10 +617,6 @@ INSTALL_NAME_TOOL := @INSTALL_NAME_TOOL@ METAL := @METAL@ METALLIB := @METALLIB@ -# Options to linker to specify a mapfile. -# (Note absence of := assignment, because we do not want to evaluate the macro body here) -SET_SHARED_LIBRARY_MAPFILE = @SET_SHARED_LIBRARY_MAPFILE@ - # # Options for generating debug symbols COMPILE_WITH_DEBUG_SYMBOLS := @COMPILE_WITH_DEBUG_SYMBOLS@ diff --git a/make/autoconf/toolchain.m4 b/make/autoconf/toolchain.m4 index 7a24815d163..6a29529c5c5 100644 --- a/make/autoconf/toolchain.m4 +++ b/make/autoconf/toolchain.m4 @@ -732,11 +732,10 @@ AC_DEFUN_ONCE([TOOLCHAIN_DETECT_TOOLCHAIN_CORE], AC_SUBST(AS) # - # Setup the archiver (AR) + # Setup tools for creating static libraries (AR/LIB) # if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then - # The corresponding ar tool is lib.exe (used to create static libraries) - UTIL_LOOKUP_TOOLCHAIN_PROGS(AR, lib) + UTIL_LOOKUP_TOOLCHAIN_PROGS(LIB, lib) elif test "x$TOOLCHAIN_TYPE" = xgcc; then UTIL_LOOKUP_TOOLCHAIN_PROGS(AR, ar gcc-ar) else diff --git a/make/common/NativeCompilation.gmk b/make/common/NativeCompilation.gmk index b9ea519cc3f..13b0318b4c7 100644 --- a/make/common/NativeCompilation.gmk +++ b/make/common/NativeCompilation.gmk @@ -40,8 +40,8 @@ include native/CompileFile.gmk include native/DebugSymbols.gmk include native/Flags.gmk include native/Link.gmk +include native/LinkMicrosoft.gmk include native/Paths.gmk -include native/ToolchainDefinitions.gmk ################################################################################ # Setup make rules for creating a native binary (a shared library or an @@ -54,7 +54,8 @@ include native/ToolchainDefinitions.gmk # NAME The base name for the resulting binary, excluding decorations (like *.exe) # TYPE Type of binary (EXECUTABLE, LIBRARY or STATIC_LIBRARY). Default is LIBRARY. # SUFFIX Override the default suffix for the output file -# TOOLCHAIN Name of toolchain setup to use. Defaults to TOOLCHAIN_DEFAULT. +# TARGET_TYPE The type to target, BUILD or TARGET. Defaults to TARGET. +# LINK_TYPE The language to use for the linker, C or C++. Defaults to C. # SRC one or more directory roots to scan for C/C++ files. # CFLAGS the compiler flags to be used, used both for C and C++. # CXXFLAGS the compiler flags to be used for c++, if set overrides CFLAGS. @@ -72,7 +73,8 @@ include native/ToolchainDefinitions.gmk # used both for C and C++. # LIBS__ the libraries to link to for the specified target # OS and toolchain, used both for C and C++. -# ARFLAGS the archiver flags to be used +# ARFLAGS the archiver flags to be used on unix platforms +# LIBFLAGS the flags for the lib tool used on windows # OBJECT_DIR the directory where we store the object files # OUTPUT_DIR the directory where the resulting binary is put # SYMBOLS_DIR the directory where the debug symbols are put, defaults to OUTPUT_DIR @@ -87,11 +89,18 @@ include native/ToolchainDefinitions.gmk # VERSIONINFO_RESOURCE Input file for RC. Setting this implies that RC will be run # RCFLAGS flags for RC. # EMBED_MANIFEST if true, embed manifest on Windows. -# MAPFILE mapfile -# USE_MAPFILE_FOR_SYMBOLS if true and this is a STATIC_BUILD, just copy the -# mapfile for the output symbols file -# CC the compiler to use, default is $(CC) -# LD the linker to use, default is $(LD) +# CC the C compiler to use +# CXX the C++ compiler to use +# LD the Linker to use +# AR the static linker to use +# LIB the Windows lib tool to use for creating static libraries +# AS the assembler to use +# MT the Windows MT tool to use +# RC the Windows RC tool to use +# OBJCOPY the objcopy tool for debug symbol handling +# STRIP the tool to use for stripping debug symbols +# SYSROOT_CFLAGS the compiler flags for using the specific sysroot +# SYSROOT_LDFLAGS the linker flags for using the specific sysroot # OPTIMIZATION sets optimization level to NONE, LOW, HIGH, HIGHEST, HIGHEST_JVM, SIZE # DISABLED_WARNINGS_ Disable the given warnings for the specified toolchain # DISABLED_WARNINGS__ Disable the given warnings for the specified @@ -198,12 +207,18 @@ define SetupNativeCompilationBody # Prepare for linking $$(eval $$(call SetupLinkerFlags,$1)) - $$(eval $$(call SetupLinking,$1)) + ifneq ($(TOOLCHAIN_TYPE), microsoft) + $$(eval $$(call SetupLinking,$1)) + endif $$(eval $$(call SetupObjectFileList,$1)) # Link the individually compiled files into a single unit - $$(eval $$(call CreateLinkedResult,$1)) + ifneq ($(TOOLCHAIN_TYPE), microsoft) + $$(eval $$(call CreateLinkedResult,$1)) + else + $$(eval $$(call CreateLinkedResultMicrosoft,$1)) + endif ifeq ($(GENERATE_COMPILE_COMMANDS_ONLY), true) # Override all targets (this is a hack) @@ -284,6 +299,44 @@ define SetupBasicVariables $1_SAFE_NAME := $$(strip $$(subst /,_, $1)) endef +################################################################################ +# Setup the toolchain variables +define SetupToolchain + ifeq ($$($1_TARGET_TYPE), BUILD) + $$(call SetIfEmpty, $1_CC, $(BUILD_CC)) + $$(call SetIfEmpty, $1_CXX, $(BUILD_CXX)) + $$(call SetIfEmpty, $1_AR, $(BUILD_AR)) + $$(call SetIfEmpty, $1_LIB, $(BUILD_LIB)) + $$(call SetIfEmpty, $1_AS, $(BUILD_AS)) + $$(call SetIfEmpty, $1_OBJCOPY, $(BUILD_OBJCOPY)) + $$(call SetIfEmpty, $1_STRIP, $(BUILD_STRIP)) + $$(call SetIfEmpty, $1_SYSROOT_CFLAGS, $(BUILD_SYSROOT_CFLAGS)) + $$(call SetIfEmpty, $1_SYSROOT_LDFLAGS, $(BUILD_SYSROOT_LDFLAGS)) + ifeq ($$($1_LINK_TYPE), C++) + $$(call SetIfEmpty, $1_LD, $(BUILD_LDCXX)) + else + $$(call SetIfEmpty, $1_LD, $(BUILD_LD)) + endif + else + $$(call SetIfEmpty, $1_CC, $(CC)) + $$(call SetIfEmpty, $1_CXX, $(CXX)) + $$(call SetIfEmpty, $1_AR, $(AR)) + $$(call SetIfEmpty, $1_LIB, $(LIB)) + $$(call SetIfEmpty, $1_AS, $(AS)) + $$(call SetIfEmpty, $1_MT, $(MT)) + $$(call SetIfEmpty, $1_RC, $(RC)) + $$(call SetIfEmpty, $1_OBJCOPY, $(OBJCOPY)) + $$(call SetIfEmpty, $1_STRIP, $(STRIP)) + $$(call SetIfEmpty, $1_SYSROOT_CFLAGS, $(SYSROOT_CFLAGS)) + $$(call SetIfEmpty, $1_SYSROOT_LDFLAGS, $(SYSROOT_LDFLAGS)) + ifeq ($$($1_LINK_TYPE), C++) + $$(call SetIfEmpty, $1_LD, $(LDCXX)) + else + $$(call SetIfEmpty, $1_LD, $(LD)) + endif + endif +endef + ################################################################################ # Setup machinery needed by the build system define SetupBuildSystemSupport diff --git a/make/common/TestFilesCompilation.gmk b/make/common/TestFilesCompilation.gmk index d97d0e6c697..626eb058f0a 100644 --- a/make/common/TestFilesCompilation.gmk +++ b/make/common/TestFilesCompilation.gmk @@ -1,5 +1,5 @@ # -# Copyright (c) 2015, 2023, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -103,6 +103,7 @@ define SetupTestFilesCompilationBody $$(eval $$(call SetupNativeCompilation, BUILD_TEST_$$(name), \ NAME := $$(unprefixed_name), \ TYPE := $$($1_COMPILATION_TYPE), \ + LINK_TYPE := $(if $$(filter %.cpp, $$(file)), C++, C), \ EXTRA_FILES := $$(file) $$($1_EXTRA_FILES), \ OBJECT_DIR := $$($1_OUTPUT_DIR)/support/$$(name), \ OUTPUT_DIR := $$($1_OUTPUT_DIR)/$$($1_OUTPUT_SUBDIR), \ @@ -113,7 +114,6 @@ define SetupTestFilesCompilationBody DISABLED_WARNINGS_clang := undef format-nonliteral \ missing-field-initializers sometimes-uninitialized, \ LIBS := $$($1_LIBS_$$(name)), \ - TOOLCHAIN := $(if $$(filter %.cpp, $$(file)), TOOLCHAIN_LINK_CXX, TOOLCHAIN_DEFAULT), \ OPTIMIZATION := $$(if $$($1_OPTIMIZATION_$$(name)),$$($1_OPTIMIZATION_$$(name)),LOW), \ COPY_DEBUG_SYMBOLS := $$($1_COPY_DEBUG_SYMBOLS), \ STRIP_SYMBOLS := $$(if $$($1_STRIP_SYMBOLS_$$(name)),$$($1_STRIP_SYMBOLS_$$(name)),false), \ diff --git a/make/common/native/Link.gmk b/make/common/native/Link.gmk index 37291d496a6..fb23152d4fb 100644 --- a/make/common/native/Link.gmk +++ b/make/common/native/Link.gmk @@ -27,7 +27,6 @@ # This file contains functionality related to linking a native binary; # creating either a dynamic library, a static library or an executable. - ################################################################################ # GetEntitlementsFile # Find entitlements file for executable when signing on macosx. If no @@ -49,24 +48,15 @@ GetEntitlementsFile = \ ################################################################################ define SetupLinking - ifneq ($(DISABLE_MAPFILES), true) - $1_REAL_MAPFILE := $$($1_MAPFILE) - endif - - ifneq ($$($1_REAL_MAPFILE), ) - $1_EXTRA_LDFLAGS += $(call SET_SHARED_LIBRARY_MAPFILE,$$($1_REAL_MAPFILE)) - endif - # Unless specifically set, stripping should only happen if symbols are also # being copied. $$(call SetIfEmpty, $1_STRIP_SYMBOLS, $$($1_COPY_DEBUG_SYMBOLS)) ifneq ($$($1_STRIP_SYMBOLS), false) - ifneq ($$($1_STRIP), ) - # Default to using the global STRIPFLAGS. Allow for overriding with an empty value - $1_STRIPFLAGS ?= $(STRIPFLAGS) - $1_STRIP_CMD := $$($1_STRIP) $$($1_STRIPFLAGS) $$($1_TARGET) - endif + # Default to using the global STRIPFLAGS. Allow for overriding with an + # empty value + $1_STRIPFLAGS ?= $(STRIPFLAGS) + $1_STRIP_CMD := $$($1_STRIP) $$($1_STRIPFLAGS) $$($1_TARGET) endif endef @@ -81,7 +71,7 @@ endef ################################################################################ define CreateStaticLibrary - # Include partial linking when building the static library with clang on linux. + # Include partial linking when building the static library with clang on linux ifeq ($(call isTargetOs, linux), true) ifneq ($(findstring $(TOOLCHAIN_TYPE), clang), ) $1_ENABLE_PARTIAL_LINKING := true @@ -96,14 +86,7 @@ define CreateStaticLibrary $1_VARDEPS_FILE := $$(call DependOnVariable, $1_VARDEPS, \ $$($1_OBJECT_DIR)/$$($1_NOSUFFIX).vardeps) - # Generating a static library, ie object file archive. - ifeq ($(STATIC_BUILD), true) - ifeq ($$($1_USE_MAPFILE_FOR_SYMBOLS), true) - STATIC_MAPFILE_DEP := $$($1_MAPFILE) - endif - endif - - $1_TARGET_DEPS := $$($1_ALL_OBJS) $$($1_RES) $$($1_VARDEPS_FILE) $$(STATIC_MAPFILE_DEP) + $1_TARGET_DEPS := $$($1_ALL_OBJS) $$($1_VARDEPS_FILE) $1_AR_OBJ_ARG := $$($1_LD_OBJ_ARG) # With clang on linux, partial linking is enabled and 'AR' takes the output @@ -128,36 +111,19 @@ define CreateStaticLibrary $$(call ExecuteWithLog, $$($1_OBJECT_DIR)/$$($1_SAFE_NAME)_partial_link, \ $(if $$($1_LINK_OBJS_RELATIVE), $$(CD) $$(OUTPUTDIR) ; ) \ $$($1_LD) $(LDFLAGS_CXX_PARTIAL_LINKING) $$($1_SYSROOT_LDFLAGS) \ - $(LD_OUT_OPTION)$$($1_TARGET_RELOCATABLE) \ + -o $$($1_TARGET_RELOCATABLE) \ $$($1_LD_OBJ_ARG)) endif $$(call ExecuteWithLog, $$($1_OBJECT_DIR)/$$($1_SAFE_NAME)_link, \ $(if $$($1_LINK_OBJS_RELATIVE), $$(CD) $$(OUTPUTDIR) ; ) \ - $$($1_AR) $$(ARFLAGS) $$($1_ARFLAGS) $(AR_OUT_OPTION)$$($1_TARGET) $$($1_AR_OBJ_ARG) \ - $$($1_RES)) + $$($1_AR) $$(ARFLAGS) $$($1_ARFLAGS) -r -cs $$($1_TARGET) \ + $$($1_AR_OBJ_ARG) $$($1_RES)) ifeq ($(STATIC_BUILD), true) - ifeq ($$($1_USE_MAPFILE_FOR_SYMBOLS), true) - $(CP) $$($1_MAPFILE) $$(@D)/$$(basename $$(@F)).symbols - else - # get the exported symbols from mapfiles and if there - # is no mapfile, get them from the archive - $(RM) $$(@D)/$$(basename $$(@F)).symbols; \ - if [ ! -z $$($1_MAPFILE) -a -e $$($1_MAPFILE) ]; then \ - $(ECHO) "Getting symbols from mapfile $$($1_MAPFILE)"; \ - $(AWK) '/global:/','/local:/' $$($1_MAPFILE) | \ - $(SED) -e 's/#.*//;s/global://;s/local://;s/\;//;s/^[ ]*/_/;/^_$$$$/d' | \ - $(EGREP) -v "JNI_OnLoad|JNI_OnUnload|Agent_OnLoad|Agent_OnUnload|Agent_OnAttach" > \ - $$(@D)/$$(basename $$(@F)).symbols || true; \ - $(NM) $(NMFLAGS) $$($1_TARGET) | $(GREP) " T " | \ - $(EGREP) "JNI_OnLoad|JNI_OnUnload|Agent_OnLoad|Agent_OnUnload|Agent_OnAttach" | \ - $(CUT) -d ' ' -f 3 >> $$(@D)/$$(basename $$(@F)).symbols || true;\ - else \ - $(ECHO) "Getting symbols from nm"; \ - $(NM) $(NMFLAGS) -m $$($1_TARGET) | $(GREP) "__TEXT" | \ - $(EGREP) -v "non-external|private extern|__TEXT,__eh_frame" | \ - $(SED) -e 's/.* //' > $$(@D)/$$(basename $$(@F)).symbols; \ - fi - endif + $(RM) $$(@D)/$$(basename $$(@F)).symbols; \ + $(ECHO) "Getting symbols from nm"; \ + $(NM) $(NMFLAGS) -m $$($1_TARGET) | $(GREP) "__TEXT" | \ + $(EGREP) -v "non-external|private extern|__TEXT,__eh_frame" | \ + $(SED) -e 's/.* //' > $$(@D)/$$(basename $$(@F)).symbols endif endef @@ -174,39 +140,13 @@ define CreateDynamicLibraryOrExecutable endif endif - ifeq ($(call isTargetOs, windows), true) - ifeq ($$($1_EMBED_MANIFEST), true) - $1_EXTRA_LDFLAGS += -manifest:embed - endif - - $1_IMPORT_LIBRARY := $$($1_OBJECT_DIR)/$$($1_NAME).lib - $1_EXTRA_LDFLAGS += "-implib:$$($1_IMPORT_LIBRARY)" - ifeq ($$($1_TYPE), LIBRARY) - # To properly trigger downstream dependants of the import library, just as - # for debug files, we must have a recipe in the rule. To avoid rerunning - # the recipe every time have it touch the target. If an import library - # file is deleted by something external, explicitly delete the target to - # trigger a rebuild of both. - ifneq ($$(wildcard $$($1_IMPORT_LIBRARY)), $$($1_IMPORT_LIBRARY)) - $$(call LogDebug, Deleting $$($1_BASENAME) because import library is missing) - $$(shell $(RM) $$($1_TARGET)) - endif - $$($1_IMPORT_LIBRARY): $$($1_TARGET) - $(TOUCH) $$@ - - $1 += $$($1_IMPORT_LIBRARY) - endif - endif - - $1_VARDEPS := $$($1_LD) $$($1_SYSROOT_LDFLAGS) $$($1_LDFLAGS) $$($1_EXTRA_LDFLAGS) \ - $$($1_LIBS) $$($1_EXTRA_LIBS) $$($1_MT) \ - $$($1_CREATE_DEBUGINFO_CMDS) $$($1_MANIFEST_VERSION) \ - $$($1_STRIP_CMD) $$($1_CREATE_DEBUGLINK_CMDS) + $1_VARDEPS := $$($1_LD) $$($1_SYSROOT_LDFLAGS) $$($1_LDFLAGS) \ + $$($1_EXTRA_LDFLAGS) $$($1_LIBS) $$($1_EXTRA_LIBS) \ + $$($1_CREATE_DEBUGINFO_CMDS) $$($1_STRIP_CMD) $$($1_CREATE_DEBUGLINK_CMDS) $1_VARDEPS_FILE := $$(call DependOnVariable, $1_VARDEPS, \ $$($1_OBJECT_DIR)/$$($1_NOSUFFIX).vardeps) - $1_TARGET_DEPS := $$($1_ALL_OBJS) $$($1_RES) $$($1_MANIFEST) \ - $$($1_REAL_MAPFILE) $$($1_VARDEPS_FILE) + $1_TARGET_DEPS := $$($1_ALL_OBJS) $$($1_VARDEPS_FILE) $$($1_TARGET): $$($1_TARGET_DEPS) ifneq ($$($1_OBJ_FILE_LIST), ) @@ -216,47 +156,27 @@ define CreateDynamicLibraryOrExecutable $$(eval $$(call ListPathsSafely, $1_ALL_OBJS, $$($1_OBJ_FILE_LIST))) endif endif - # Keep as much as possible on one execution line for best performance - # on Windows $$(call LogInfo, Linking $$($1_BASENAME)) $$(call MakeDir, $$($1_OUTPUT_DIR) $$($1_SYMBOLS_DIR)) - ifeq ($(call isTargetOs, windows), true) - $$(call ExecuteWithLog, $$($1_OBJECT_DIR)/$$($1_SAFE_NAME)_link, \ - $$($1_LD) $$($1_LDFLAGS) $$($1_EXTRA_LDFLAGS) $$($1_SYSROOT_LDFLAGS) \ - $(LD_OUT_OPTION)$$($1_TARGET) $$($1_LD_OBJ_ARG) $$($1_RES) \ - $$($1_LIBS) $$($1_EXTRA_LIBS)) \ - | $(GREP) -v "^ Creating library .*\.lib and object .*\.exp" || \ - test "$$$$?" = "1" ; \ - $$($1_CREATE_DEBUGINFO_CMDS) - $$($1_STRIP_CMD) - $$($1_CREATE_DEBUGLINK_CMDS) - ifeq ($(call isBuildOsEnv, windows.wsl2), true) - $$(CHMOD) +x $$($1_TARGET) - endif - else - $$(call ExecuteWithLog, $$($1_OBJECT_DIR)/$$($1_SAFE_NAME)_link, \ - $$(if $$($1_LINK_OBJS_RELATIVE), $$(CD) $$(OUTPUTDIR) ; ) \ - $$($1_LD) $$($1_LDFLAGS) $$($1_EXTRA_LDFLAGS) $$($1_SYSROOT_LDFLAGS) \ - $(LD_OUT_OPTION)$$($1_TARGET) $$($1_LD_OBJ_ARG) $$($1_RES) \ - $$($1_LIBS) $$($1_EXTRA_LIBS)) ; \ - $$($1_CREATE_DEBUGINFO_CMDS) - $$($1_STRIP_CMD) - $$($1_CREATE_DEBUGLINK_CMDS) - endif - ifeq ($(call isTargetOs, windows), true) - ifneq ($$($1_MANIFEST), ) - $$($1_MT) -nologo -manifest $$($1_MANIFEST) -identity:"$$($1_NAME).exe, version=$$($1_MANIFEST_VERSION)" -outputresource:$$@;#1 - endif - endif + $$(call ExecuteWithLog, $$($1_OBJECT_DIR)/$$($1_SAFE_NAME)_link, \ + $$(if $$($1_LINK_OBJS_RELATIVE), $$(CD) $$(OUTPUTDIR) ; ) \ + $$($1_LD) $$($1_LDFLAGS) $$($1_EXTRA_LDFLAGS) \ + $$($1_SYSROOT_LDFLAGS) -o $$($1_TARGET) $$($1_LD_OBJ_ARG) \ + $$($1_LIBS) $$($1_EXTRA_LIBS)) + $$($1_CREATE_DEBUGINFO_CMDS) + $$($1_STRIP_CMD) + $$($1_CREATE_DEBUGLINK_CMDS) # On macosx, optionally run codesign on every binary. # Remove signature explicitly first to avoid warnings if the linker # added a default adhoc signature. ifeq ($(MACOSX_CODESIGN_MODE), hardened) $(CODESIGN) --remove-signature $$@ - $(CODESIGN) -f -s "$(MACOSX_CODESIGN_IDENTITY)" --timestamp --options runtime \ - --entitlements $$(call GetEntitlementsFile, $$@) $$@ + $(CODESIGN) -f -s "$(MACOSX_CODESIGN_IDENTITY)" --timestamp \ + --options runtime --entitlements \ + $$(call GetEntitlementsFile, $$@) $$@ else ifeq ($(MACOSX_CODESIGN_MODE), debug) $(CODESIGN) --remove-signature $$@ - $(CODESIGN) -f -s - --entitlements $$(call GetEntitlementsFile, $$@) $$@ + $(CODESIGN) -f -s - --entitlements \ + $$(call GetEntitlementsFile, $$@) $$@ endif endef diff --git a/make/common/native/LinkMicrosoft.gmk b/make/common/native/LinkMicrosoft.gmk new file mode 100644 index 00000000000..f998bf3d117 --- /dev/null +++ b/make/common/native/LinkMicrosoft.gmk @@ -0,0 +1,112 @@ +# +# Copyright (c) 2011, 2024, Oracle and/or its affiliates. All rights reserved. +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# This code is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License version 2 only, as +# published by the Free Software Foundation. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the LICENSE file that accompanied this code. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# + +################################################################################ +# This file contains functionality related to linking a native binary; +# creating either a dynamic library, a static library or an executable. + +################################################################################ +define CreateLinkedResultMicrosoft + ifeq ($$($1_TYPE), STATIC_LIBRARY) + $$(eval $$(call CreateStaticLibraryMicrosoft,$1)) + else + $$(eval $$(call CreateDynamicLibraryOrExecutableMicrosoft,$1)) + endif +endef + +################################################################################ +define CreateStaticLibraryMicrosoft + $1_VARDEPS := $$($1_LIB) $$(LIBFLAGS) $$($1_LIBFLAGS) $$($1_LIBS) \ + $$($1_EXTRA_LIBS) + $1_VARDEPS_FILE := $$(call DependOnVariable, $1_VARDEPS, \ + $$($1_OBJECT_DIR)/$$($1_NOSUFFIX).vardeps) + + $$($1_TARGET): $$($1_ALL_OBJS) $$($1_RES) $$($1_VARDEPS_FILE) + ifneq ($$($1_OBJ_FILE_LIST), ) + $$(eval $$(call ListPathsSafely, $1_ALL_OBJS, $$($1_OBJ_FILE_LIST))) + endif + $$(call LogInfo, Building static library $$($1_BASENAME)) + $$(call MakeDir, $$($1_OUTPUT_DIR) $$($1_SYMBOLS_DIR)) + $$(call ExecuteWithLog, $$($1_OBJECT_DIR)/$$($1_SAFE_NAME)_link, \ + $$($1_LIB) -nologo $$(LIBFLAGS) $$($1_LIBFLAGS) -out:$$($1_TARGET) \ + $$($1_LD_OBJ_ARG) $$($1_RES)) +endef + +################################################################################ +define CreateDynamicLibraryOrExecutableMicrosoft + ifeq ($$($1_EMBED_MANIFEST), true) + $1_EXTRA_LDFLAGS += -manifest:embed + endif + + $1_IMPORT_LIBRARY := $$($1_OBJECT_DIR)/$$($1_NAME).lib + $1_EXTRA_LDFLAGS += "-implib:$$($1_IMPORT_LIBRARY)" + + ifeq ($$($1_TYPE), LIBRARY) + # To properly trigger downstream dependants of the import library, just as + # for debug files, we must have a recipe in the rule. To avoid rerunning + # the recipe every time have it touch the target. If an import library + # file is deleted by something external, explicitly delete the target to + # trigger a rebuild of both. + ifneq ($$(wildcard $$($1_IMPORT_LIBRARY)), $$($1_IMPORT_LIBRARY)) + $$(call LogDebug, Deleting $$($1_BASENAME) because import library is missing) + $$(shell $(RM) $$($1_TARGET)) + endif + $$($1_IMPORT_LIBRARY): $$($1_TARGET) + $(TOUCH) $$@ + + $1 += $$($1_IMPORT_LIBRARY) + endif + + $1_VARDEPS := $$($1_LD) $$($1_SYSROOT_LDFLAGS) $$($1_LDFLAGS) \ + $$($1_EXTRA_LDFLAGS) $$($1_LIBS) $$($1_EXTRA_LIBS) $$($1_MT) \ + $$($1_MANIFEST_VERSION) + + $1_VARDEPS_FILE := $$(call DependOnVariable, $1_VARDEPS, \ + $$($1_OBJECT_DIR)/$$($1_NOSUFFIX).vardeps) + + $1_TARGET_DEPS := $$($1_ALL_OBJS) $$($1_RES) $$($1_MANIFEST) \ + $$($1_VARDEPS_FILE) + + $$($1_TARGET): $$($1_TARGET_DEPS) + ifneq ($$($1_OBJ_FILE_LIST), ) + $$(eval $$(call ListPathsSafely, $1_ALL_OBJS, $$($1_OBJ_FILE_LIST))) + endif + $$(call LogInfo, Linking $$($1_BASENAME)) + $$(call MakeDir, $$($1_OUTPUT_DIR) $$($1_SYMBOLS_DIR)) + $$(call ExecuteWithLog, $$($1_OBJECT_DIR)/$$($1_SAFE_NAME)_link, \ + $$($1_LD) -nologo $$($1_LDFLAGS) $$($1_EXTRA_LDFLAGS) \ + $$($1_SYSROOT_LDFLAGS) -out:$$($1_TARGET) $$($1_LD_OBJ_ARG) \ + $$($1_RES) $$($1_LIBS) $$($1_EXTRA_LIBS)) \ + | $(GREP) -v "^ Creating library .*\.lib and object .*\.exp" || \ + test "$$$$?" = "1" + ifeq ($(call isBuildOsEnv, windows.wsl2), true) + $$(CHMOD) +x $$($1_TARGET) + endif + ifneq ($$($1_MANIFEST), ) + $$($1_MT) -nologo -manifest $$($1_MANIFEST) \ + -identity:"$$($1_NAME).exe, version=$$($1_MANIFEST_VERSION)" \ + -outputresource:$$@;#1 + endif +endef diff --git a/make/common/native/ToolchainDefinitions.gmk b/make/common/native/ToolchainDefinitions.gmk deleted file mode 100644 index b640df83d6a..00000000000 --- a/make/common/native/ToolchainDefinitions.gmk +++ /dev/null @@ -1,125 +0,0 @@ -# -# Copyright (c) 2011, 2024, Oracle and/or its affiliates. All rights reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. Oracle designates this -# particular file as subject to the "Classpath" exception as provided -# by Oracle in the LICENSE file that accompanied this code. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# - -################################################################################ -# This file contains functionality related to setting up our toolchain -# definition variables. - -################################################################################ -# Define a native toolchain configuration that can be used by -# SetupNativeCompilation calls -# -# Parameter 1 is the name of the toolchain definition -# -# Remaining parameters are named arguments: -# EXTENDS - Optional parent definition to get defaults from -# CC - The C compiler -# CXX - The C++ compiler -# LD - The Linker -# AR - Static linker -# AS - Assembler -# MT - Windows MT tool -# RC - Windows RC tool -# OBJCOPY - The objcopy tool for debug symbol handling -# STRIP - The tool to use for stripping debug symbols -# SYSROOT_CFLAGS - Compiler flags for using the specific sysroot -# SYSROOT_LDFLAGS - Linker flags for using the specific sysroot -DefineNativeToolchain = $(NamedParamsMacroTemplate) -define DefineNativeToolchainBody - # If extending another definition, get default values from that, - # otherwise, nothing more needs to be done as variable assignments - # already happened in NamedParamsMacroTemplate. - ifneq ($$($1_EXTENDS), ) - $$(call SetIfEmpty, $1_CC, $$($$($1_EXTENDS)_CC)) - $$(call SetIfEmpty, $1_CXX, $$($$($1_EXTENDS)_CXX)) - $$(call SetIfEmpty, $1_LD, $$($$($1_EXTENDS)_LD)) - $$(call SetIfEmpty, $1_AR, $$($$($1_EXTENDS)_AR)) - $$(call SetIfEmpty, $1_AS, $$($$($1_EXTENDS)_AS)) - $$(call SetIfEmpty, $1_MT, $$($$($1_EXTENDS)_MT)) - $$(call SetIfEmpty, $1_RC, $$($$($1_EXTENDS)_RC)) - $$(call SetIfEmpty, $1_OBJCOPY, $$($$($1_EXTENDS)_OBJCOPY)) - $$(call SetIfEmpty, $1_STRIP, $$($$($1_EXTENDS)_STRIP)) - $$(call SetIfEmpty, $1_SYSROOT_CFLAGS, $$($$($1_EXTENDS)_SYSROOT_CFLAGS)) - $$(call SetIfEmpty, $1_SYSROOT_LDFLAGS, $$($$($1_EXTENDS)_SYSROOT_LDFLAGS)) - endif -endef - -# Create a default toolchain with the main compiler and linker -$(eval $(call DefineNativeToolchain, TOOLCHAIN_DEFAULT, \ - CC := $(CC), \ - CXX := $(CXX), \ - LD := $(LD), \ - AR := $(AR), \ - AS := $(AS), \ - MT := $(MT), \ - RC := $(RC), \ - OBJCOPY := $(OBJCOPY), \ - STRIP := $(STRIP), \ - SYSROOT_CFLAGS := $(SYSROOT_CFLAGS), \ - SYSROOT_LDFLAGS := $(SYSROOT_LDFLAGS), \ -)) - -# Create a toolchain where linking is done with the C++ linker -$(eval $(call DefineNativeToolchain, TOOLCHAIN_LINK_CXX, \ - EXTENDS := TOOLCHAIN_DEFAULT, \ - LD := $(LDCXX), \ -)) - -# Create a toolchain with the BUILD compiler, used for build tools that -# are to be run during the build. -$(eval $(call DefineNativeToolchain, TOOLCHAIN_BUILD, \ - CC := $(BUILD_CC), \ - CXX := $(BUILD_CXX), \ - LD := $(BUILD_LD), \ - AR := $(BUILD_AR), \ - AS := $(BUILD_AS), \ - OBJCOPY := $(BUILD_OBJCOPY), \ - STRIP := $(BUILD_STRIP), \ - SYSROOT_CFLAGS := $(BUILD_SYSROOT_CFLAGS), \ - SYSROOT_LDFLAGS := $(BUILD_SYSROOT_LDFLAGS), \ -)) - -# BUILD toolchain with the C++ linker -$(eval $(call DefineNativeToolchain, TOOLCHAIN_BUILD_LINK_CXX, \ - EXTENDS := TOOLCHAIN_BUILD, \ - LD := $(BUILD_LDCXX), \ -)) - -################################################################################ -# Setup the toolchain to be used -define SetupToolchain - $$(call SetIfEmpty, $1_TOOLCHAIN, TOOLCHAIN_DEFAULT) - $$(call SetIfEmpty, $1_CC, $$($$($1_TOOLCHAIN)_CC)) - $$(call SetIfEmpty, $1_CXX, $$($$($1_TOOLCHAIN)_CXX)) - $$(call SetIfEmpty, $1_LD, $$($$($1_TOOLCHAIN)_LD)) - $$(call SetIfEmpty, $1_AR, $$($$($1_TOOLCHAIN)_AR)) - $$(call SetIfEmpty, $1_AS, $$($$($1_TOOLCHAIN)_AS)) - $$(call SetIfEmpty, $1_MT, $$($$($1_TOOLCHAIN)_MT)) - $$(call SetIfEmpty, $1_RC, $$($$($1_TOOLCHAIN)_RC)) - $$(call SetIfEmpty, $1_OBJCOPY, $$($$($1_TOOLCHAIN)_OBJCOPY)) - $$(call SetIfEmpty, $1_STRIP, $$($$($1_TOOLCHAIN)_STRIP)) - $$(call SetIfEmpty, $1_SYSROOT_CFLAGS, $$($$($1_TOOLCHAIN)_SYSROOT_CFLAGS)) - $$(call SetIfEmpty, $1_SYSROOT_LDFLAGS, $$($$($1_TOOLCHAIN)_SYSROOT_LDFLAGS)) -endef diff --git a/make/data/hotspot-symbols/symbols-aix b/make/data/hotspot-symbols/symbols-aix deleted file mode 100644 index 1d32104e8a1..00000000000 --- a/make/data/hotspot-symbols/symbols-aix +++ /dev/null @@ -1,26 +0,0 @@ -# -# Copyright (c) 2016, 2022, Oracle and/or its affiliates. All rights reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# 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. -# - -JVM_handle_aix_signal -numa_error -numa_warn diff --git a/make/data/hotspot-symbols/symbols-aix-debug b/make/data/hotspot-symbols/symbols-aix-debug deleted file mode 100644 index 10887ab2b61..00000000000 --- a/make/data/hotspot-symbols/symbols-aix-debug +++ /dev/null @@ -1,26 +0,0 @@ -# -# Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# - -JVM_AccessVMBooleanFlag -JVM_AccessVMIntFlag -JVM_VMBreakPoint diff --git a/make/data/hotspot-symbols/symbols-linux b/make/data/hotspot-symbols/symbols-linux deleted file mode 100644 index d1f258297d8..00000000000 --- a/make/data/hotspot-symbols/symbols-linux +++ /dev/null @@ -1,27 +0,0 @@ -# -# Copyright (c) 2016, 2022, Oracle and/or its affiliates. All rights reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# 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. -# - -JVM_handle_linux_signal -JVM_IsUseContainerSupport -numa_error -numa_warn diff --git a/make/data/hotspot-symbols/symbols-macosx b/make/data/hotspot-symbols/symbols-macosx deleted file mode 100644 index d0243562b67..00000000000 --- a/make/data/hotspot-symbols/symbols-macosx +++ /dev/null @@ -1,24 +0,0 @@ -# -# Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# - -JVM_handle_bsd_signal diff --git a/make/data/hotspot-symbols/symbols-shared b/make/data/hotspot-symbols/symbols-shared deleted file mode 100644 index c5b13ef1ee8..00000000000 --- a/make/data/hotspot-symbols/symbols-shared +++ /dev/null @@ -1,35 +0,0 @@ -# -# 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 -# 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. -# - -AsyncGetCallTrace -jio_fprintf -jio_printf -jio_snprintf -jio_vfprintf -jio_vsnprintf -JNI_CreateJavaVM -JNI_GetCreatedJavaVMs -JNI_GetDefaultJavaVMInitArgs -JVM_IsForeignLinkerSupported -JVM_FindClassFromBootLoader -JVM_InitAgentProperties diff --git a/make/data/hotspot-symbols/symbols-unix b/make/data/hotspot-symbols/symbols-unix deleted file mode 100644 index bdc10add4f2..00000000000 --- a/make/data/hotspot-symbols/symbols-unix +++ /dev/null @@ -1,238 +0,0 @@ -# -# 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 -# 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. -# - -JVM_ActiveProcessorCount -JVM_AreNestMates -JVM_ArrayCopy -JVM_AssertionStatusDirectives -JVM_BeforeHalt -JVM_CallStackWalk -JVM_Clone -JVM_ConstantPoolGetClassAt -JVM_ConstantPoolGetClassAtIfLoaded -JVM_ConstantPoolGetClassRefIndexAt -JVM_ConstantPoolGetDoubleAt -JVM_ConstantPoolGetFieldAt -JVM_ConstantPoolGetFieldAtIfLoaded -JVM_ConstantPoolGetFloatAt -JVM_ConstantPoolGetIntAt -JVM_ConstantPoolGetLongAt -JVM_ConstantPoolGetMemberRefInfoAt -JVM_ConstantPoolGetMethodAt -JVM_ConstantPoolGetMethodAtIfLoaded -JVM_ConstantPoolGetNameAndTypeRefIndexAt -JVM_ConstantPoolGetNameAndTypeRefInfoAt -JVM_ConstantPoolGetSize -JVM_ConstantPoolGetStringAt -JVM_ConstantPoolGetTagAt -JVM_ConstantPoolGetUTF8At -JVM_CurrentCarrierThread -JVM_CurrentThread -JVM_SetCurrentThread -JVM_CurrentTimeMillis -JVM_DefineClass -JVM_DefineClassWithSource -JVM_DesiredAssertionStatus -JVM_DumpAllStacks -JVM_DumpClassListToFile -JVM_DumpDynamicArchive -JVM_DumpThreads -JVM_ExpandStackFrameInfo -JVM_FillInStackTrace -JVM_FindClassFromCaller -JVM_FindClassFromClass -JVM_FindLibraryEntry -JVM_FindLoadedClass -JVM_FindPrimitiveClass -JVM_FindSignal -JVM_FreeMemory -JVM_GC -JVM_GetAllThreads -JVM_GetAndClearReferencePendingList -JVM_GetArrayElement -JVM_GetArrayLength -JVM_GetCallerClass -JVM_GetClassAccessFlags -JVM_GetClassAnnotations -JVM_GetClassConstantPool -JVM_GetClassContext -JVM_GetClassCPEntriesCount -JVM_GetClassCPTypes -JVM_GetClassDeclaredConstructors -JVM_GetClassDeclaredFields -JVM_GetClassDeclaredMethods -JVM_GetClassFieldsCount -JVM_GetClassFileVersion -JVM_GetClassInterfaces -JVM_GetClassMethodsCount -JVM_GetClassModifiers -JVM_GetClassNameUTF -JVM_GetClassSignature -JVM_GetClassSigners -JVM_GetClassTypeAnnotations -JVM_GetCPClassNameUTF -JVM_GetCPFieldClassNameUTF -JVM_GetCPFieldModifiers -JVM_GetCPFieldNameUTF -JVM_GetCPFieldSignatureUTF -JVM_GetCPMethodClassNameUTF -JVM_GetCPMethodModifiers -JVM_GetCPMethodNameUTF -JVM_GetCPMethodSignatureUTF -JVM_GetDeclaredClasses -JVM_GetDeclaringClass -JVM_GetEnclosingMethodInfo -JVM_GetExtendedNPEMessage -JVM_GetFieldIxModifiers -JVM_GetFieldTypeAnnotations -JVM_GetInheritedAccessControlContext -JVM_GetManagement -JVM_GetMethodIxArgsSize -JVM_GetMethodIxByteCode -JVM_GetMethodIxByteCodeLength -JVM_GetMethodIxExceptionIndexes -JVM_GetMethodIxExceptionsCount -JVM_GetMethodIxExceptionTableEntry -JVM_GetMethodIxExceptionTableLength -JVM_GetMethodIxLocalsCount -JVM_GetMethodIxMaxStack -JVM_GetMethodIxModifiers -JVM_GetMethodIxNameUTF -JVM_GetMethodIxSignatureUTF -JVM_GetMethodParameters -JVM_GetMethodTypeAnnotations -JVM_GetNanoTimeAdjustment -JVM_GetNestHost -JVM_GetNestMembers -JVM_GetNextThreadIdOffset -JVM_GetPermittedSubclasses -JVM_GetPrimitiveArrayElement -JVM_GetProperties -JVM_GetProtectionDomain -JVM_GetRandomSeedForDumping -JVM_GetRecordComponents -JVM_GetSimpleBinaryName -JVM_GetStackAccessControlContext -JVM_GetSystemPackage -JVM_GetSystemPackages -JVM_GetTemporaryDirectory -JVM_GetVmArguments -JVM_Halt -JVM_HasReferencePendingList -JVM_HoldsLock -JVM_GetStackTrace -JVM_IHashCode -JVM_InitClassName -JVM_InitStackTraceElement -JVM_InitStackTraceElementArray -JVM_InitializeFromArchive -JVM_InternString -JVM_Interrupt -JVM_InvokeMethod -JVM_IsArrayClass -JVM_IsCDSDumpingEnabled -JVM_IsConstructorIx -JVM_IsDumpingClassList -JVM_IsFinalizationEnabled -JVM_IsHiddenClass -JVM_IsIdentityClass -JVM_IsImplicitlyConstructibleClass -JVM_IsInterface -JVM_IsNullRestrictedArray -JVM_IsPreviewEnabled -JVM_IsValhallaEnabled -JVM_IsContinuationsSupported -JVM_IsPrimitiveClass -JVM_IsRecord -JVM_IsSameClassPackage -JVM_IsSharingEnabled -JVM_IsSupportedJNIVersion -JVM_IsVMGeneratedMethodIx -JVM_LatestUserDefinedLoader -JVM_LoadZipLibrary -JVM_LoadLibrary -JVM_LookupDefineClass -JVM_LookupLambdaProxyClassFromArchive -JVM_LogLambdaFormInvoker -JVM_MaxMemory -JVM_MaxObjectInspectionAge -JVM_MonitorNotify -JVM_MonitorNotifyAll -JVM_MonitorWait -JVM_MoreStackWalk -JVM_NanoTime -JVM_NativePath -JVM_NewArray -JVM_NewInstanceFromConstructor -JVM_NewMultiArray -JVM_NewNullRestrictedArray -JVM_PhantomReferenceRefersTo -JVM_PrintWarningAtDynamicAgentLoad -JVM_RaiseSignal -JVM_RawMonitorCreate -JVM_RawMonitorDestroy -JVM_RawMonitorEnter -JVM_RawMonitorExit -JVM_ReferenceClear -JVM_ReferenceRefersTo -JVM_RegisterContinuationMethods -JVM_RegisterLambdaProxyClassForArchiving -JVM_RegisterSignal -JVM_ReleaseUTF -JVM_ReportFinalizationComplete -JVM_SetArrayElement -JVM_SetClassSigners -JVM_SetNativeThreadName -JVM_SetPrimitiveArrayElement -JVM_SetStackWalkContinuation -JVM_SetThreadPriority -JVM_SleepNanos -JVM_StartThread -JVM_TotalMemory -JVM_UnloadLibrary -JVM_WaitForReferencePendingList -JVM_Yield - -# Module related API's -JVM_AddModuleExports -JVM_AddModuleExportsToAll -JVM_AddModuleExportsToAllUnnamed -JVM_AddReadsModule -JVM_DefineArchivedModules -JVM_DefineModule -JVM_SetBootLoaderUnnamedModule - -# Virtual thread notifications for JVMTI -JVM_VirtualThreadStart -JVM_VirtualThreadEnd -JVM_VirtualThreadMount -JVM_VirtualThreadUnmount -JVM_VirtualThreadHideFrames -JVM_VirtualThreadDisableSuspend - -# Scoped values -JVM_EnsureMaterializedForStackWalk_func -JVM_FindScopedValueBindings -JVM_ScopedValueCache -JVM_SetScopedValueCache -# diff --git a/make/data/hotspot-symbols/version-script.txt b/make/data/hotspot-symbols/version-script.txt new file mode 100644 index 00000000000..29578bf7cb2 --- /dev/null +++ b/make/data/hotspot-symbols/version-script.txt @@ -0,0 +1,11 @@ +SUNWprivate_1.1 { + global: + *; + + local: + __bss_start; + _edata; + _end; + _fini; + _init; +}; diff --git a/make/hotspot/gensrc/GensrcAdlc.gmk b/make/hotspot/gensrc/GensrcAdlc.gmk index bb356476847..f9e09706141 100644 --- a/make/hotspot/gensrc/GensrcAdlc.gmk +++ b/make/hotspot/gensrc/GensrcAdlc.gmk @@ -1,5 +1,5 @@ # -# Copyright (c) 2013, 2023, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -45,7 +45,6 @@ ifeq ($(call check-jvm-feature, compiler2), true) ADLC_CFLAGS := -qnortti -qeh -q64 -DAIX endif else ifeq ($(call isBuildOs, windows), true) - ADLC_LDFLAGS += -nologo ADLC_CFLAGS := -nologo -EHsc ADLC_CFLAGS_WARNINGS := -W3 -D_CRT_SECURE_NO_WARNINGS endif @@ -72,7 +71,8 @@ ifeq ($(call check-jvm-feature, compiler2), true) $(eval $(call SetupNativeCompilation, BUILD_ADLC, \ NAME := adlc, \ TYPE := EXECUTABLE, \ - TOOLCHAIN := TOOLCHAIN_BUILD_LINK_CXX, \ + TARGET_TYPE := BUILD, \ + LINK_TYPE := C++, \ SRC := $(TOPDIR)/src/hotspot/share/adlc, \ EXTRA_FILES := $(TOPDIR)/src/hotspot/share/opto/opcodes.cpp, \ CFLAGS := $(ADLC_CFLAGS) $(ADLC_CFLAGS_WARNINGS), \ diff --git a/make/hotspot/lib/CompileGtest.gmk b/make/hotspot/lib/CompileGtest.gmk index 0d17f7a3be5..a50d1ffac9e 100644 --- a/make/hotspot/lib/CompileGtest.gmk +++ b/make/hotspot/lib/CompileGtest.gmk @@ -1,5 +1,5 @@ # -# Copyright (c) 2016, 2023, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -50,7 +50,7 @@ endif $(eval $(call SetupJdkLibrary, BUILD_GTEST_LIBGTEST, \ NAME := gtest, \ TYPE := STATIC_LIBRARY, \ - TOOLCHAIN := TOOLCHAIN_LINK_CXX, \ + LINK_TYPE := C++, \ OUTPUT_DIR := $(JVM_OUTPUTDIR)/libgtest, \ OBJECT_DIR := $(JVM_OUTPUTDIR)/libgtest/objs, \ SRC := \ @@ -75,25 +75,11 @@ $(eval $(call SetupJdkLibrary, BUILD_GTEST_LIBGTEST, \ TARGETS += $(BUILD_GTEST_LIBGTEST) ################################################################################ - -ifeq ($(call isTargetOs, windows), true) - GTEST_JVM_MAPFILE := $(JVM_MAPFILE) -else - GTEST_JVM_MAPFILE := $(JVM_OUTPUTDIR)/gtest/mapfile - - $(JVM_OUTPUTDIR)/gtest/symbols: $(JVM_OUTPUTDIR)/symbols - $(call MakeDir, $(@D)) - ( $(CAT) $< ; echo "runUnitTests" ) > $@ - - $(GTEST_JVM_MAPFILE): $(JVM_OUTPUTDIR)/gtest/symbols - $(call create-mapfile) -endif - # Additional disabled warnings are due to code in the test source. $(eval $(call SetupJdkLibrary, BUILD_GTEST_LIBJVM, \ NAME := jvm, \ - TOOLCHAIN := TOOLCHAIN_LINK_CXX, \ + LINK_TYPE := C++, \ OUTPUT_DIR := $(JVM_OUTPUTDIR)/gtest, \ OBJECT_DIR := $(JVM_OUTPUTDIR)/gtest/objs, \ SRC := $(GTEST_TEST_SRC), \ @@ -123,8 +109,6 @@ $(eval $(call SetupJdkLibrary, BUILD_GTEST_LIBJVM, \ LIBS_unix := -lgtest, \ LIBS_windows := $(JVM_OUTPUTDIR)/libgtest/gtest.lib, \ OPTIMIZATION := $(JVM_OPTIMIZATION), \ - MAPFILE := $(GTEST_JVM_MAPFILE), \ - USE_MAPFILE_FOR_SYMBOLS := true, \ COPY_DEBUG_SYMBOLS := $(GTEST_COPY_DEBUG_SYMBOLS), \ ZIP_EXTERNAL_DEBUG_SYMBOLS := false, \ STRIP_SYMBOLS := false, \ @@ -134,14 +118,19 @@ $(eval $(call SetupJdkLibrary, BUILD_GTEST_LIBJVM, \ $(BUILD_GTEST_LIBJVM) : $(BUILD_GTEST_LIBGTEST) +ifeq ($(call isTargetOs, windows), true) + $(BUILD_GTEST_LIBJVM_TARGET): $(WIN_EXPORT_FILE) +endif + + TARGETS += $(BUILD_GTEST_LIBJVM) ################################################################################ $(eval $(call SetupJdkExecutable, BUILD_GTEST_LAUNCHER, \ - TOOLCHAIN := TOOLCHAIN_LINK_CXX, \ NAME := gtestLauncher, \ TYPE := EXECUTABLE, \ + LINK_TYPE := C++, \ OUTPUT_DIR := $(JVM_OUTPUTDIR)/gtest, \ EXTRA_FILES := $(GTEST_LAUNCHER_SRC), \ OBJECT_DIR := $(JVM_OUTPUTDIR)/gtest/launcher-objs, \ diff --git a/make/hotspot/lib/CompileJvm.gmk b/make/hotspot/lib/CompileJvm.gmk index 3393d9e00aa..69cd80f5171 100644 --- a/make/hotspot/lib/CompileJvm.gmk +++ b/make/hotspot/lib/CompileJvm.gmk @@ -1,5 +1,5 @@ # -# Copyright (c) 2013, 2023, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -33,7 +33,6 @@ include lib/JvmFlags.gmk # Setup compilation of the main Hotspot native library (libjvm). JVM_OUTPUTDIR := $(JVM_VARIANT_OUTPUTDIR)/libjvm -JVM_MAPFILE := $(JVM_OUTPUTDIR)/mapfile ################################################################################ # Platform independent setup @@ -146,12 +145,28 @@ $(call FillFindCache, $(JVM_SRC_DIRS)) # operator new. LIBJVM_STATIC_EXCLUDE_OBJS := operator_new.o +ifeq ($(call isTargetOs, windows), true) + ifeq ($(STATIC_LIBS), true) + WIN_EXPORT_FILE := $(JVM_OUTPUTDIR)/static-win-exports.def + else + WIN_EXPORT_FILE := $(JVM_OUTPUTDIR)/win-exports.def + endif + + JVM_LDFLAGS += -def:$(WIN_EXPORT_FILE) +endif + +ifeq ($(call isTargetOs, linux), true) + HOTSPOT_VERSION_SCRIPT := $(TOPDIR)/make/data/hotspot-symbols/version-script.txt + + JVM_LDFLAGS += -Wl,--exclude-libs,ALL -Wl,-version-script=$(HOTSPOT_VERSION_SCRIPT) +endif + ################################################################################ # Now set up the actual compilation of the main hotspot native library $(eval $(call SetupJdkLibrary, BUILD_LIBJVM, \ NAME := jvm, \ - TOOLCHAIN := TOOLCHAIN_LINK_CXX, \ + LINK_TYPE := C++, \ OUTPUT_DIR := $(JVM_LIB_OUTPUTDIR), \ SRC := $(JVM_SRC_DIRS), \ EXCLUDES := $(JVM_EXCLUDES), \ @@ -169,6 +184,7 @@ $(eval $(call SetupJdkLibrary, BUILD_LIBJVM, \ DISABLED_WARNINGS_gcc_jvmciCodeInstaller.cpp := stringop-overflow, \ DISABLED_WARNINGS_gcc_jvmtiTagMap.cpp := stringop-overflow, \ DISABLED_WARNINGS_gcc_postaloc.cpp := address, \ + DISABLED_WARNINGS_gcc_shenandoahLock.cpp := stringop-overflow, \ DISABLED_WARNINGS_gcc_synchronizer.cpp := stringop-overflow, \ DISABLED_WARNINGS_clang := $(DISABLED_WARNINGS_clang), \ DISABLED_WARNINGS_clang_arguments.cpp := missing-field-initializers, \ @@ -194,8 +210,6 @@ $(eval $(call SetupJdkLibrary, BUILD_LIBJVM, \ LIBS := $(JVM_LIBS), \ OPTIMIZATION := $(JVM_OPTIMIZATION), \ OBJECT_DIR := $(JVM_OUTPUTDIR)/objs, \ - MAPFILE := $(JVM_MAPFILE), \ - USE_MAPFILE_FOR_SYMBOLS := true, \ STRIPFLAGS := $(JVM_STRIPFLAGS), \ EMBED_MANIFEST := true, \ RC_FILEDESC := $(HOTSPOT_VM_DISTRO) $(OPENJDK_TARGET_CPU_BITS)-Bit $(JVM_VARIANT) VM, \ @@ -204,11 +218,47 @@ $(eval $(call SetupJdkLibrary, BUILD_LIBJVM, \ STATIC_LIB_EXCLUDE_OBJS := $(LIBJVM_STATIC_EXCLUDE_OBJS), \ )) +ifeq ($(call isTargetOs, windows), true) + # The following lines create a list of vftable symbols to be filtered out of + # the symbol file. Removing this line causes the linker to complain about too + # many (> 64K) symbols, so the _guess_ is that this line is here to keep down + # the number of exported symbols below that limit. + # + # Some usages of C++ lambdas require the vftable symbol of classes that use + # the lambda type as a template parameter. The usage of those classes won't + # link if their vftable symbols are removed. That's why there's an exception + # for vftable symbols containing the string 'lambda'. + # + # A very simple example of a lambda usage that fails if the lambda vftable + # symbols are missing in the symbol file: + # + # #include + # std::function f = [](){} + FILTER_SYMBOLS_AWK_SCRIPT := \ + '{ \ + if ($$7 ~ /\?\?_7.*@@6B@/ && $$7 !~ /type_info/ && $$7 !~ /lambda/) print " " $$7; \ + }' + + # A more correct solution would be to send BUILD_LIBJVM_ALL_OBJS instead of + # cd && *.obj, but this will result in very long command lines, which could be + # problematic. + $(WIN_EXPORT_FILE): $(BUILD_LIBJVM_ALL_OBJS) + $(call LogInfo, Generating list of symbols to export from object files) + $(call MakeDir, $(@D)) + $(ECHO) "EXPORTS" > $@.tmp + $(CD) $(BUILD_LIBJVM_OBJECT_DIR) && \ + $(DUMPBIN) -symbols *$(OBJ_SUFFIX) | $(AWK) $(FILTER_SYMBOLS_AWK_SCRIPT) | $(SORT) -u >> $@.tmp + $(RM) $@ + $(MV) $@.tmp $@ + + $(BUILD_LIBJVM_TARGET): $(WIN_EXPORT_FILE) +endif + # Always recompile abstract_vm_version.cpp if libjvm needs to be relinked. This ensures # that the internal vm version is updated as it relies on __DATE__ and __TIME__ # macros. ABSTRACT_VM_VERSION_OBJ := $(JVM_OUTPUTDIR)/objs/abstract_vm_version$(OBJ_SUFFIX) -$(ABSTRACT_VM_VERSION_OBJ): $(filter-out $(ABSTRACT_VM_VERSION_OBJ) $(JVM_MAPFILE), \ +$(ABSTRACT_VM_VERSION_OBJ): $(filter-out $(ABSTRACT_VM_VERSION_OBJ), \ $(BUILD_LIBJVM_TARGET_DEPS)) ifneq ($(GENERATE_COMPILE_COMMANDS_ONLY), true) @@ -236,11 +286,6 @@ endif # 1540-1090 : (I) The destructor of "..." might not be called. # 1540-1639 : (I) The behavior of long type bit fields has changed ... -# Include mapfile generation. It relies on BUILD_LIBJVM_ALL_OBJS which is only -# defined after the above call to BUILD_LIBJVM. Mapfile will be generated -# after all object files are built, but before the jvm library is linked. -include lib/JvmMapfile.gmk - TARGETS += $(BUILD_LIBJVM) ################################################################################ diff --git a/make/hotspot/lib/JvmMapfile.gmk b/make/hotspot/lib/JvmMapfile.gmk deleted file mode 100644 index b2199e7d17c..00000000000 --- a/make/hotspot/lib/JvmMapfile.gmk +++ /dev/null @@ -1,176 +0,0 @@ -# -# Copyright (c) 2013, 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. Oracle designates this -# particular file as subject to the "Classpath" exception as provided -# by Oracle in the LICENSE file that accompanied this code. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# - -$(eval $(call IncludeCustomExtension, hotspot/lib/JvmMapfile.gmk)) - -################################################################################ -# Combine a list of static symbols - -ifeq ($(call And, $(call isTargetOs, windows) $(call isTargetCpu, x86_64)), false) - # On Windows x86_64, we should not have any symbols at all, since that - # results in duplicate warnings from the linker (JDK-8043491). - SYMBOLS_SRC += $(TOPDIR)/make/data/hotspot-symbols/symbols-shared -endif - -ifeq ($(call isTargetOsType, unix), true) - SYMBOLS_SRC += $(TOPDIR)/make/data/hotspot-symbols/symbols-unix -endif - -ifneq ($(wildcard $(TOPDIR)/make/data/hotspot-symbols/symbols-$(OPENJDK_TARGET_OS)), ) - SYMBOLS_SRC += $(TOPDIR)/make/data/hotspot-symbols/symbols-$(OPENJDK_TARGET_OS) -endif - -ifneq ($(findstring debug, $(DEBUG_LEVEL)), ) - ifneq ($(wildcard $(TOPDIR)/make/data/hotspot-symbols/symbols-$(OPENJDK_TARGET_OS)-debug), ) - SYMBOLS_SRC += $(TOPDIR)/make/data/hotspot-symbols/symbols-$(OPENJDK_TARGET_OS)-debug - endif -endif - -################################################################################ -# Create a dynamic list of symbols from the built object files. This is highly -# platform dependent. - -ifeq ($(call isTargetOs, linux), true) - DUMP_SYMBOLS_CMD := $(NM) $(NMFLAGS) --defined-only *$(OBJ_SUFFIX) - ifneq ($(FILTER_SYMBOLS_PATTERN), ) - FILTER_SYMBOLS_PATTERN := $(FILTER_SYMBOLS_PATTERN)| - endif - FILTER_SYMBOLS_PATTERN := $(FILTER_SYMBOLS_PATTERN)^_ZTV|^gHotSpotVM|^UseSharedSpaces$$ - FILTER_SYMBOLS_PATTERN := $(FILTER_SYMBOLS_PATTERN)|^_ZN9Arguments17SharedArchivePathE$$ - FILTER_SYMBOLS_AWK_SCRIPT := \ - '{ \ - if ($$3 ~ /$(FILTER_SYMBOLS_PATTERN)/) print $$3; \ - }' - -else ifeq ($(call isTargetOs, macosx), true) - # nm on macosx prints out "warning: nm: no name list" to stderr for - # files without symbols. Hide this, even at the expense of hiding real errors. - DUMP_SYMBOLS_CMD := $(NM) $(NMFLAGS) -Uj *$(OBJ_SUFFIX) 2> /dev/null - ifneq ($(FILTER_SYMBOLS_PATTERN), ) - FILTER_SYMBOLS_PATTERN := $(FILTER_SYMBOLS_PATTERN)| - endif - FILTER_SYMBOLS_PATTERN := $(FILTER_SYMBOLS_PATTERN)^_ZTV|^gHotSpotVM - FILTER_SYMBOLS_AWK_SCRIPT := \ - '{ \ - if ($$3 ~ /$(FILTER_SYMBOLS_PATTERN)/) print $$3; \ - }' - -# NOTE: The script is from the old build. It is broken and finds no symbols. -# The script below might be what was intended, but it fails to link with tons -# of 'cannot export hidden symbol vtable for X'. -# '{ if ($$1 ~ /^__ZTV/ || $$1 ~ /^_gHotSpotVM/) print substr($$1, 2) }' -else ifeq ($(call isTargetOs, aix), true) - # NOTE: The old build had the solution below. This should to be fixed in - # configure instead. - - # On AIX we have to prevent that we pick up the 'nm' version from the GNU binutils - # which may be installed under /opt/freeware/bin. So better use an absolute path here! - # NM=/usr/bin/nm - - DUMP_SYMBOLS_CMD := $(NM) $(NMFLAGS) -B -C *$(OBJ_SUFFIX) - FILTER_SYMBOLS_AWK_SCRIPT := \ - '{ \ - if (($$2="d" || $$2="D") && ($$3 ~ /^__vft/ || $$3 ~ /^gHotSpotVM/)) print $$3; \ - if ($$3 ~ /^UseSharedSpaces$$/) print $$3; \ - if ($$3 ~ /^SharedArchivePath__9Arguments$$/) print $$3; \ - }' - -else ifeq ($(call isTargetOs, windows), true) - DUMP_SYMBOLS_CMD := $(DUMPBIN) -symbols *$(OBJ_SUFFIX) - - # The following lines create a list of vftable symbols to be filtered out of - # the mapfile. Removing this line causes the linker to complain about too many - # (> 64K) symbols, so the _guess_ is that this line is here to keep down the - # number of exported symbols below that limit. - # - # Some usages of C++ lambdas require the vftable symbol of classes that use - # the lambda type as a template parameter. The usage of those classes won't - # link if their vftable symbols are removed. That's why there's an exception - # for vftable symbols containing the string 'lambda'. - # - # A very simple example of a lambda usage that fails if the lambda vftable - # symbols are missing in the mapfile: - # - # #include - # std::function f = [](){} - - FILTER_SYMBOLS_AWK_SCRIPT := \ - '{ \ - if ($$7 ~ /\?\?_7.*@@6B@/ && $$7 !~ /type_info/ && $$7 !~ /lambda/) print $$7; \ - }' - -else - $(error Unknown target OS $(OPENJDK_TARGET_OS) in JvmMapfile.gmk) -endif - -# A more correct solution would be to send BUILD_LIBJVM_ALL_OBJS instead of -# cd && *.o, but this will result in very long command lines, which is -# problematic on some platforms. -$(JVM_OUTPUTDIR)/symbols-objects: $(BUILD_LIBJVM_ALL_OBJS) - $(call LogInfo, Generating symbol list from object files) - $(CD) $(JVM_OUTPUTDIR)/objs && \ - $(DUMP_SYMBOLS_CMD) | $(AWK) $(FILTER_SYMBOLS_AWK_SCRIPT) | $(SORT) -u > $@ - -SYMBOLS_SRC += $(JVM_OUTPUTDIR)/symbols-objects - -################################################################################ -# Now concatenate all symbol lists into a single file and remove comments. - -$(JVM_OUTPUTDIR)/symbols: $(SYMBOLS_SRC) - $(SED) -e '/^#/d' $^ > $@ - -################################################################################ -# Finally convert the symbol list into a platform-specific mapfile - -ifeq ($(call isTargetOs, macosx), true) - # On macosx, we need to add a leading underscore - define create-mapfile-work - $(AWK) '{ if ($$0 ~ ".") { print " _" $$0 } }' < $^ > $@.tmp - endef -else ifeq ($(call isTargetOs, windows), true) - # On windows, add an 'EXPORTS' header - define create-mapfile-work - $(ECHO) "EXPORTS" > $@.tmp - $(AWK) '{ if ($$0 ~ ".") { print " " $$0 } }' < $^ >> $@.tmp - endef -else - # Assume standard linker script - define create-mapfile-work - $(PRINTF) "SUNWprivate_1.1 { \n global: \n" > $@.tmp - $(AWK) '{ if ($$0 ~ ".") { print " " $$0 ";" } }' < $^ >> $@.tmp - $(PRINTF) " local: \n *; \n }; \n" >> $@.tmp - endef -endif - -define create-mapfile - $(call LogInfo, Creating mapfile) - $(call MakeDir, $(@D)) - $(call create-mapfile-work) - $(RM) $@ - $(MV) $@.tmp $@ -endef - -$(JVM_MAPFILE): $(JVM_OUTPUTDIR)/symbols - $(call create-mapfile) diff --git a/make/modules/java.base/Lib.gmk b/make/modules/java.base/Lib.gmk index 924cb8aae26..54050d07986 100644 --- a/make/modules/java.base/Lib.gmk +++ b/make/modules/java.base/Lib.gmk @@ -1,5 +1,5 @@ # -# Copyright (c) 2011, 2023, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2011, 2024, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -242,7 +242,7 @@ endif ifeq ($(call isTargetOs, linux)+$(call isTargetCpu, x86_64)+$(INCLUDE_COMPILER2)+$(filter $(TOOLCHAIN_TYPE), gcc), true+true+true+gcc) $(eval $(call SetupJdkLibrary, BUILD_LIB_SIMD_SORT, \ NAME := simdsort, \ - TOOLCHAIN := TOOLCHAIN_LINK_CXX, \ + LINK_TYPE := C++, \ OPTIMIZATION := HIGH, \ CFLAGS := $(CFLAGS_JDKLIB), \ CXXFLAGS := $(CXXFLAGS_JDKLIB) -std=c++17, \ diff --git a/make/modules/java.base/lib/CoreLibraries.gmk b/make/modules/java.base/lib/CoreLibraries.gmk index 8904c39449e..b27013536f8 100644 --- a/make/modules/java.base/lib/CoreLibraries.gmk +++ b/make/modules/java.base/lib/CoreLibraries.gmk @@ -1,5 +1,5 @@ # -# Copyright (c) 2011, 2023, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2011, 2024, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -115,7 +115,7 @@ TARGETS += $(BUILD_LIBZIP) $(eval $(call SetupJdkLibrary, BUILD_LIBJIMAGE, \ NAME := jimage, \ - TOOLCHAIN := TOOLCHAIN_LINK_CXX, \ + LINK_TYPE := C++, \ OPTIMIZATION := LOW, \ CFLAGS := $(CFLAGS_JDKLIB), \ CXXFLAGS := $(CXXFLAGS_JDKLIB), \ diff --git a/make/modules/java.desktop/Lib.gmk b/make/modules/java.desktop/Lib.gmk index be1ac3f1fb8..cb831faebf6 100644 --- a/make/modules/java.desktop/Lib.gmk +++ b/make/modules/java.desktop/Lib.gmk @@ -1,5 +1,5 @@ # -# Copyright (c) 2011, 2022, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2011, 2024, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -51,13 +51,14 @@ ifeq ($(call isTargetOs, aix), false) -DUSE_PLATFORM_MIDI_IN=TRUE \ # + LIBJSOUND_LINK_TYPE := C ifeq ($(call isTargetOs, macosx), true) - LIBJSOUND_TOOLCHAIN := TOOLCHAIN_LINK_CXX + LIBJSOUND_LINK_TYPE := C++ endif $(eval $(call SetupJdkLibrary, BUILD_LIBJSOUND, \ NAME := jsound, \ - TOOLCHAIN := $(LIBJSOUND_TOOLCHAIN), \ + LINK_TYPE := $(LIBJSOUND_LINK_TYPE), \ OPTIMIZATION := LOW, \ CFLAGS := $(CFLAGS_JDKLIB) \ $(LIBJSOUND_CFLAGS), \ diff --git a/make/modules/java.desktop/lib/Awt2dLibraries.gmk b/make/modules/java.desktop/lib/Awt2dLibraries.gmk index 6fc9ed2fb2b..aaf98d088fd 100644 --- a/make/modules/java.desktop/lib/Awt2dLibraries.gmk +++ b/make/modules/java.desktop/lib/Awt2dLibraries.gmk @@ -1,5 +1,5 @@ # -# Copyright (c) 2011, 2023, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2011, 2024, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -562,9 +562,9 @@ LIBFONTMANAGER_CFLAGS += $(X_CFLAGS) -DLE_STANDALONE -DHEADLESS # libawt_xawt). See JDK-8196516 for details. $(eval $(call SetupJdkLibrary, BUILD_LIBFONTMANAGER, \ NAME := fontmanager, \ + LINK_TYPE := C++, \ EXCLUDE_FILES := $(LIBFONTMANAGER_EXCLUDE_FILES) \ AccelGlyphCache.c, \ - TOOLCHAIN := TOOLCHAIN_LINK_CXX, \ CFLAGS := $(CFLAGS_JDKLIB) $(LIBFONTMANAGER_CFLAGS), \ CXXFLAGS := $(CXXFLAGS_JDKLIB) $(LIBFONTMANAGER_CFLAGS), \ OPTIMIZATION := $(LIBFONTMANAGER_OPTIMIZATION), \ diff --git a/make/modules/jdk.hotspot.agent/Lib.gmk b/make/modules/jdk.hotspot.agent/Lib.gmk index ebdbfecd461..6d850615837 100644 --- a/make/modules/jdk.hotspot.agent/Lib.gmk +++ b/make/modules/jdk.hotspot.agent/Lib.gmk @@ -45,16 +45,16 @@ else ifeq ($(call isTargetOs, windows), true) endif endif -SA_TOOLCHAIN := $(TOOLCHAIN_DEFAULT) +SA_LINK_TYPE := C ifeq ($(call isTargetOs, linux), true) - SA_TOOLCHAIN := TOOLCHAIN_LINK_CXX + SA_LINK_TYPE := C++ endif ################################################################################ $(eval $(call SetupJdkLibrary, BUILD_LIBSA, \ NAME := saproc, \ - TOOLCHAIN := $(SA_TOOLCHAIN), \ + LINK_TYPE := $(SA_LINK_TYPE), \ OPTIMIZATION := HIGH, \ DISABLED_WARNINGS_gcc := sign-compare, \ DISABLED_WARNINGS_gcc_ps_core.c := pointer-arith, \ diff --git a/make/modules/jdk.internal.le/Lib.gmk b/make/modules/jdk.internal.le/Lib.gmk index 75a2446cc5a..85550e3cc1d 100644 --- a/make/modules/jdk.internal.le/Lib.gmk +++ b/make/modules/jdk.internal.le/Lib.gmk @@ -1,5 +1,5 @@ # -# Copyright (c) 2015, 2023, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -31,7 +31,7 @@ ifeq ($(call isTargetOs, linux macosx windows), true) $(eval $(call SetupJdkLibrary, BUILD_LIBLE, \ NAME := le, \ - TOOLCHAIN := TOOLCHAIN_LINK_CXX, \ + LINK_TYPE := C++, \ OPTIMIZATION := LOW, \ CFLAGS := $(CXXFLAGS_JDKLIB), \ LDFLAGS := $(LDFLAGS_JDKLIB), \ diff --git a/make/modules/jdk.jpackage/Lib.gmk b/make/modules/jdk.jpackage/Lib.gmk index 1d3e27e8a6b..58e40d772e1 100644 --- a/make/modules/jdk.jpackage/Lib.gmk +++ b/make/modules/jdk.jpackage/Lib.gmk @@ -1,5 +1,5 @@ # -# Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -32,13 +32,13 @@ include LauncherCommon.gmk ifeq ($(call isTargetOs, linux), true) JPACKAGE_APPLAUNCHER_SRC := \ $(call FindSrcDirsForComponent, jdk.jpackage, applauncher) - JPACKAGE_APPLAUNCHER_TOOLCHAIN := TOOLCHAIN_DEFAULT + JPACKAGE_APPLAUNCHER_LINK_TYPE := C JPACKAGE_APPLAUNCHER_INCLUDE_FILES := %.c else JPACKAGE_APPLAUNCHER_SRC := \ $(call FindSrcDirsForComponent, jdk.jpackage, applauncher) \ $(call FindSrcDirsForComponent, jdk.jpackage, common) - JPACKAGE_APPLAUNCHER_TOOLCHAIN := TOOLCHAIN_LINK_CXX + JPACKAGE_APPLAUNCHER_LINK_TYPE := C++ endif @@ -59,11 +59,11 @@ JPACKAGE_APPLAUNCHER_INCLUDES := $(addprefix -I, $(JPACKAGE_APPLAUNCHER_SRC)) # Output app launcher executable in resources dir, and symbols in the object dir $(eval $(call SetupJdkExecutable, BUILD_JPACKAGE_APPLAUNCHEREXE, \ NAME := jpackageapplauncher, \ + LINK_TYPE := $(JPACKAGE_APPLAUNCHER_LINK_TYPE), \ OUTPUT_DIR := $(JPACKAGE_OUTPUT_DIR), \ SYMBOLS_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/jpackageapplauncher, \ SRC := $(JPACKAGE_APPLAUNCHER_SRC), \ INCLUDE_FILES := $(JPACKAGE_APPLAUNCHER_INCLUDE_FILES), \ - TOOLCHAIN := $(JPACKAGE_APPLAUNCHER_TOOLCHAIN), \ OPTIMIZATION := LOW, \ DISABLED_WARNINGS_clang_LinuxPackage.c := format-nonliteral, \ DISABLED_WARNINGS_clang_JvmLauncherLib.c := format-nonliteral, \ @@ -103,7 +103,7 @@ ifeq ($(call isTargetOs, linux), true) SYMBOLS_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjpackageapplauncheraux, \ SRC := $(JPACKAGE_LIBAPPLAUNCHER_SRC), \ EXCLUDE_FILES := LinuxLauncher.c LinuxPackage.c, \ - TOOLCHAIN := TOOLCHAIN_LINK_CXX, \ + LINK_TYPE := C++, \ OPTIMIZATION := LOW, \ DISABLED_WARNINGS_clang_JvmLauncherLib.c := format-nonliteral, \ DISABLED_WARNINGS_clang_tstrings.cpp := format-nonliteral, \ @@ -177,10 +177,10 @@ ifeq ($(call isTargetOs, windows), true) # Build non-console version of launcher $(eval $(call SetupJdkExecutable, BUILD_JPACKAGE_APPLAUNCHERWEXE, \ NAME := jpackageapplauncherw, \ + LINK_TYPE := $(BUILD_JPACKAGE_APPLAUNCHEREXE_LINK_TYPE), \ OUTPUT_DIR := $(JPACKAGE_OUTPUT_DIR), \ SYMBOLS_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/jpackageapplauncherw, \ SRC := $(BUILD_JPACKAGE_APPLAUNCHEREXE_SRC), \ - TOOLCHAIN := $(BUILD_JPACKAGE_APPLAUNCHEREXE_TOOLCHAIN), \ OPTIMIZATION := $(BUILD_JPACKAGE_APPLAUNCHEREXE_OPTIMIZATION), \ CXXFLAGS := $(BUILD_JPACKAGE_APPLAUNCHEREXE_CXXFLAGS), \ CXXFLAGS_windows := $(BUILD_JPACKAGE_APPLAUNCHEREXE_CXXFLAGS_windows) -DJP_LAUNCHERW, \ diff --git a/src/hotspot/cpu/aarch64/assembler_aarch64.cpp b/src/hotspot/cpu/aarch64/assembler_aarch64.cpp index c7b867a4207..76f88764416 100644 --- a/src/hotspot/cpu/aarch64/assembler_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/assembler_aarch64.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2014, 2020 Red Hat Inc. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -118,10 +118,6 @@ extern "C" { else Disassembler::decode((address)start, (address)start + len); } - - JNIEXPORT void das1(uintptr_t insn) { - das(insn, 1); - } } #define __ as-> diff --git a/src/hotspot/cpu/aarch64/c1_LIRAssembler_aarch64.cpp b/src/hotspot/cpu/aarch64/c1_LIRAssembler_aarch64.cpp index 78c7eec2e29..746f1376848 100644 --- a/src/hotspot/cpu/aarch64/c1_LIRAssembler_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/c1_LIRAssembler_aarch64.cpp @@ -1259,7 +1259,7 @@ void LIR_Assembler::emit_alloc_array(LIR_OpAllocArray* op) { len, tmp1, tmp2, - arrayOopDesc::header_size(op->type()), + arrayOopDesc::base_offset_in_bytes(op->type()), array_element_size(op->type()), op->klass()->as_register(), *op->stub()->entry()); diff --git a/src/hotspot/cpu/aarch64/c1_MacroAssembler_aarch64.cpp b/src/hotspot/cpu/aarch64/c1_MacroAssembler_aarch64.cpp index 32ea0c3c372..330469032ad 100644 --- a/src/hotspot/cpu/aarch64/c1_MacroAssembler_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/c1_MacroAssembler_aarch64.cpp @@ -202,6 +202,12 @@ void C1_MacroAssembler::initialize_header(Register obj, Register klass, Register if (len->is_valid()) { strw(len, Address(obj, arrayOopDesc::length_offset_in_bytes())); + int base_offset = arrayOopDesc::length_offset_in_bytes() + BytesPerInt; + if (!is_aligned(base_offset, BytesPerWord)) { + assert(is_aligned(base_offset, BytesPerInt), "must be 4-byte aligned"); + // Clear gap/first 4 bytes following the length field. + strw(zr, Address(obj, base_offset)); + } } else if (UseCompressedClassPointers) { store_klass_gap(obj, zr); } @@ -281,7 +287,7 @@ void C1_MacroAssembler::initialize_object(Register obj, Register klass, Register verify_oop(obj); } -void C1_MacroAssembler::allocate_array(Register obj, Register len, Register t1, Register t2, int header_size, int f, Register klass, Label& slow_case) { +void C1_MacroAssembler::allocate_array(Register obj, Register len, Register t1, Register t2, int base_offset_in_bytes, int f, Register klass, Label& slow_case) { assert_different_registers(obj, len, t1, t2, klass); // determine alignment mask @@ -294,7 +300,7 @@ void C1_MacroAssembler::allocate_array(Register obj, Register len, Register t1, const Register arr_size = t2; // okay to be the same // align object end - mov(arr_size, (int32_t)header_size * BytesPerWord + MinObjAlignmentInBytesMask); + mov(arr_size, (int32_t)base_offset_in_bytes + MinObjAlignmentInBytesMask); add(arr_size, arr_size, len, ext::uxtw, f); andr(arr_size, arr_size, ~MinObjAlignmentInBytesMask); @@ -302,8 +308,11 @@ void C1_MacroAssembler::allocate_array(Register obj, Register len, Register t1, initialize_header(obj, klass, len, t1, t2); + // Align-up to word boundary, because we clear the 4 bytes potentially + // following the length field in initialize_header(). + int base_offset = align_up(base_offset_in_bytes, BytesPerWord); // clear rest of allocated space - initialize_body(obj, arr_size, header_size * BytesPerWord, t1, t2); + initialize_body(obj, arr_size, base_offset, t1, t2); if (Compilation::current()->bailed_out()) { return; } diff --git a/src/hotspot/cpu/aarch64/c1_MacroAssembler_aarch64.hpp b/src/hotspot/cpu/aarch64/c1_MacroAssembler_aarch64.hpp index 4aa6206aa60..d210c21d12b 100644 --- a/src/hotspot/cpu/aarch64/c1_MacroAssembler_aarch64.hpp +++ b/src/hotspot/cpu/aarch64/c1_MacroAssembler_aarch64.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2014, 2021, Red Hat Inc. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -100,7 +100,7 @@ using MacroAssembler::null_check; // header_size: size of object header in words // f : element scale factor // slow_case : exit to slow case implementation if fast allocation fails - void allocate_array(Register obj, Register len, Register t, Register t2, int header_size, int f, Register klass, Label& slow_case); + void allocate_array(Register obj, Register len, Register t, Register t2, int base_offset_in_bytes, int f, Register klass, Label& slow_case); int rsp_offset() const { return _rsp_offset; } void set_rsp_offset(int n) { _rsp_offset = n; } diff --git a/src/hotspot/cpu/aarch64/gc/g1/g1BarrierSetAssembler_aarch64.cpp b/src/hotspot/cpu/aarch64/gc/g1/g1BarrierSetAssembler_aarch64.cpp index 0e0d46f2c91..ee210c8363c 100644 --- a/src/hotspot/cpu/aarch64/gc/g1/g1BarrierSetAssembler_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/gc/g1/g1BarrierSetAssembler_aarch64.cpp @@ -28,8 +28,8 @@ #include "gc/g1/g1BarrierSetAssembler.hpp" #include "gc/g1/g1BarrierSetRuntime.hpp" #include "gc/g1/g1CardTable.hpp" +#include "gc/g1/g1HeapRegion.hpp" #include "gc/g1/g1ThreadLocalData.hpp" -#include "gc/g1/heapRegion.hpp" #include "gc/shared/collectedHeap.hpp" #include "interpreter/interp_masm.hpp" #include "runtime/javaThread.hpp" diff --git a/src/hotspot/cpu/aarch64/upcallLinker_aarch64.cpp b/src/hotspot/cpu/aarch64/upcallLinker_aarch64.cpp index 14e97644575..28ec07815be 100644 --- a/src/hotspot/cpu/aarch64/upcallLinker_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/upcallLinker_aarch64.cpp @@ -245,9 +245,13 @@ address UpcallLinker::make_upcall_stub(jobject receiver, Method* entry, __ mov_metadata(rmethod, entry); __ str(rmethod, Address(rthread, JavaThread::callee_target_offset())); // just in case callee is deoptimized + __ push_cont_fastpath(rthread); + __ ldr(rscratch1, Address(rmethod, Method::from_compiled_offset())); __ blr(rscratch1); + __ pop_cont_fastpath(rthread); + // return value shuffle if (!needs_return_buffer) { #ifdef ASSERT diff --git a/src/hotspot/cpu/arm/c1_LIRAssembler_arm.cpp b/src/hotspot/cpu/arm/c1_LIRAssembler_arm.cpp index c0107e12757..a22f6676d94 100644 --- a/src/hotspot/cpu/arm/c1_LIRAssembler_arm.cpp +++ b/src/hotspot/cpu/arm/c1_LIRAssembler_arm.cpp @@ -968,7 +968,7 @@ void LIR_Assembler::emit_alloc_array(LIR_OpAllocArray* op) { op->tmp1()->as_register(), op->tmp2()->as_register(), op->tmp3()->as_register(), - arrayOopDesc::header_size(op->type()), + arrayOopDesc::base_offset_in_bytes(op->type()), type2aelembytes(op->type()), op->klass()->as_register(), *op->stub()->entry()); diff --git a/src/hotspot/cpu/arm/gc/g1/g1BarrierSetAssembler_arm.cpp b/src/hotspot/cpu/arm/gc/g1/g1BarrierSetAssembler_arm.cpp index 3aa71dca8cb..6d724c750aa 100644 --- a/src/hotspot/cpu/arm/gc/g1/g1BarrierSetAssembler_arm.cpp +++ b/src/hotspot/cpu/arm/gc/g1/g1BarrierSetAssembler_arm.cpp @@ -29,8 +29,8 @@ #include "gc/g1/g1BarrierSetRuntime.hpp" #include "gc/g1/g1ThreadLocalData.hpp" #include "gc/g1/g1CardTable.hpp" +#include "gc/g1/g1HeapRegion.hpp" #include "gc/g1/g1ThreadLocalData.hpp" -#include "gc/g1/heapRegion.hpp" #include "interpreter/interp_masm.hpp" #include "runtime/javaThread.hpp" #include "runtime/sharedRuntime.hpp" diff --git a/src/hotspot/cpu/ppc/c1_LIRAssembler_ppc.cpp b/src/hotspot/cpu/ppc/c1_LIRAssembler_ppc.cpp index 223bed6e104..ebf9cbfc952 100644 --- a/src/hotspot/cpu/ppc/c1_LIRAssembler_ppc.cpp +++ b/src/hotspot/cpu/ppc/c1_LIRAssembler_ppc.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2024, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2012, 2023 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -2298,7 +2298,7 @@ void LIR_Assembler::emit_alloc_array(LIR_OpAllocArray* op) { op->tmp1()->as_register(), op->tmp2()->as_register(), op->tmp3()->as_register(), - arrayOopDesc::header_size(op->type()), + arrayOopDesc::base_offset_in_bytes(op->type()), type2aelembytes(op->type()), op->klass()->as_register(), *op->stub()->entry()); diff --git a/src/hotspot/cpu/ppc/c1_MacroAssembler_ppc.cpp b/src/hotspot/cpu/ppc/c1_MacroAssembler_ppc.cpp index b379d4141a3..ba0187d0363 100644 --- a/src/hotspot/cpu/ppc/c1_MacroAssembler_ppc.cpp +++ b/src/hotspot/cpu/ppc/c1_MacroAssembler_ppc.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2012, 2018 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -310,7 +310,7 @@ void C1_MacroAssembler::allocate_array( Register t1, // temp register Register t2, // temp register Register t3, // temp register - int hdr_size, // object header size in words + int base_offset_in_bytes, // elements offset in bytes int elt_size, // element size in bytes Register klass, // object klass Label& slow_case // continuation point if fast allocation fails @@ -342,7 +342,7 @@ void C1_MacroAssembler::allocate_array( sldi(t1, len, log2_elt_size); arr_len_in_bytes = t1; } - addi(arr_size, arr_len_in_bytes, hdr_size * wordSize + MinObjAlignmentInBytesMask); // Add space for header & alignment. + addi(arr_size, arr_len_in_bytes, base_offset_in_bytes + MinObjAlignmentInBytesMask); // Add space for header & alignment. clrrdi(arr_size, arr_size, LogMinObjAlignmentInBytes); // Align array size. // Allocate space & initialize header. @@ -352,8 +352,18 @@ void C1_MacroAssembler::allocate_array( // Initialize body. const Register base = t2; const Register index = t3; - addi(base, obj, hdr_size * wordSize); // compute address of first element - addi(index, arr_size, -(hdr_size * wordSize)); // compute index = number of bytes to clear + addi(base, obj, base_offset_in_bytes); // compute address of first element + addi(index, arr_size, -(base_offset_in_bytes)); // compute index = number of bytes to clear + + // Zero first 4 bytes, if start offset is not word aligned. + if (!is_aligned(base_offset_in_bytes, BytesPerWord)) { + assert(is_aligned(base_offset_in_bytes, BytesPerInt), "must be 4-byte aligned"); + li(t1, 0); + stw(t1, 0, base); + addi(base, base, BytesPerInt); + // Note: initialize_body will align index down, no need to correct it here. + } + initialize_body(base, index); if (CURRENT_ENV->dtrace_alloc_probes()) { diff --git a/src/hotspot/cpu/ppc/c1_MacroAssembler_ppc.hpp b/src/hotspot/cpu/ppc/c1_MacroAssembler_ppc.hpp index 5fa19d5fd5d..ab31431e67d 100644 --- a/src/hotspot/cpu/ppc/c1_MacroAssembler_ppc.hpp +++ b/src/hotspot/cpu/ppc/c1_MacroAssembler_ppc.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2012, 2015 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -80,7 +80,7 @@ Register t1, // temp register Register t2, // temp register Register t3, // temp register - int hdr_size, // object header size in words + int base_offset_in_bytes, // elements offset in bytes int elt_size, // element size in bytes Register klass, // object klass Label& slow_case // continuation point if fast allocation fails diff --git a/src/hotspot/cpu/ppc/gc/g1/g1BarrierSetAssembler_ppc.cpp b/src/hotspot/cpu/ppc/gc/g1/g1BarrierSetAssembler_ppc.cpp index cd2fd355bbb..ab520162d35 100644 --- a/src/hotspot/cpu/ppc/gc/g1/g1BarrierSetAssembler_ppc.cpp +++ b/src/hotspot/cpu/ppc/gc/g1/g1BarrierSetAssembler_ppc.cpp @@ -30,9 +30,9 @@ #include "gc/g1/g1BarrierSetRuntime.hpp" #include "gc/g1/g1CardTable.hpp" #include "gc/g1/g1DirtyCardQueue.hpp" +#include "gc/g1/g1HeapRegion.hpp" #include "gc/g1/g1SATBMarkQueueSet.hpp" #include "gc/g1/g1ThreadLocalData.hpp" -#include "gc/g1/heapRegion.hpp" #include "interpreter/interp_masm.hpp" #include "runtime/jniHandles.hpp" #include "runtime/sharedRuntime.hpp" diff --git a/src/hotspot/cpu/ppc/globals_ppc.hpp b/src/hotspot/cpu/ppc/globals_ppc.hpp index 76e8cadf672..e0b1ce8b756 100644 --- a/src/hotspot/cpu/ppc/globals_ppc.hpp +++ b/src/hotspot/cpu/ppc/globals_ppc.hpp @@ -60,7 +60,7 @@ define_pd_global(bool, VMContinuations, true); // Use large code-entry alignment. define_pd_global(uintx, CodeCacheSegmentSize, 128); -define_pd_global(intx, CodeEntryAlignment, 128); +define_pd_global(intx, CodeEntryAlignment, 64); define_pd_global(intx, OptoLoopAlignment, 16); define_pd_global(intx, InlineSmallCode, 1500); diff --git a/src/hotspot/cpu/ppc/upcallLinker_ppc.cpp b/src/hotspot/cpu/ppc/upcallLinker_ppc.cpp index a1c8f46ce2d..b60fd4f16d1 100644 --- a/src/hotspot/cpu/ppc/upcallLinker_ppc.cpp +++ b/src/hotspot/cpu/ppc/upcallLinker_ppc.cpp @@ -243,10 +243,14 @@ address UpcallLinker::make_upcall_stub(jobject receiver, Method* entry, __ load_const_optimized(R19_method, (intptr_t)entry); __ std(R19_method, in_bytes(JavaThread::callee_target_offset()), R16_thread); + __ push_cont_fastpath(); + __ ld(call_target_address, in_bytes(Method::from_compiled_offset()), R19_method); __ mtctr(call_target_address); __ bctrl(); + __ pop_cont_fastpath(); + // return value shuffle if (!needs_return_buffer) { // CallArranger can pick a return type that goes in the same reg for both CCs. diff --git a/src/hotspot/cpu/riscv/c1_LIRAssembler_riscv.cpp b/src/hotspot/cpu/riscv/c1_LIRAssembler_riscv.cpp index e3ec023aef2..5d0fa3fad3c 100644 --- a/src/hotspot/cpu/riscv/c1_LIRAssembler_riscv.cpp +++ b/src/hotspot/cpu/riscv/c1_LIRAssembler_riscv.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2024, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2014, 2020, Red Hat Inc. All rights reserved. * Copyright (c) 2020, 2023, Huawei Technologies Co., Ltd. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -1020,7 +1020,7 @@ void LIR_Assembler::emit_alloc_array(LIR_OpAllocArray* op) { len, tmp1, tmp2, - arrayOopDesc::header_size(op->type()), + arrayOopDesc::base_offset_in_bytes(op->type()), array_element_size(op->type()), op->klass()->as_register(), *op->stub()->entry()); diff --git a/src/hotspot/cpu/riscv/c1_MacroAssembler_riscv.cpp b/src/hotspot/cpu/riscv/c1_MacroAssembler_riscv.cpp index 2961b1a91ce..770dd6a9d0f 100644 --- a/src/hotspot/cpu/riscv/c1_MacroAssembler_riscv.cpp +++ b/src/hotspot/cpu/riscv/c1_MacroAssembler_riscv.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2014, Red Hat Inc. All rights reserved. * Copyright (c) 2020, 2022, Huawei Technologies Co., Ltd. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -280,7 +280,7 @@ void C1_MacroAssembler::initialize_object(Register obj, Register klass, Register verify_oop(obj); } -void C1_MacroAssembler::allocate_array(Register obj, Register len, Register tmp1, Register tmp2, int header_size, int f, Register klass, Label& slow_case) { +void C1_MacroAssembler::allocate_array(Register obj, Register len, Register tmp1, Register tmp2, int base_offset_in_bytes, int f, Register klass, Label& slow_case) { assert_different_registers(obj, len, tmp1, tmp2, klass); // determine alignment mask @@ -292,7 +292,7 @@ void C1_MacroAssembler::allocate_array(Register obj, Register len, Register tmp1 const Register arr_size = tmp2; // okay to be the same // align object end - mv(arr_size, (int32_t)header_size * BytesPerWord + MinObjAlignmentInBytesMask); + mv(arr_size, (int32_t)base_offset_in_bytes + MinObjAlignmentInBytesMask); shadd(arr_size, len, arr_size, t0, f); andi(arr_size, arr_size, ~(uint)MinObjAlignmentInBytesMask); @@ -300,9 +300,20 @@ void C1_MacroAssembler::allocate_array(Register obj, Register len, Register tmp1 initialize_header(obj, klass, len, tmp1, tmp2); + // Clear leading 4 bytes, if necessary. + // TODO: This could perhaps go into initialize_body() and also clear the leading 4 bytes + // for non-array objects, thereby replacing the klass-gap clearing code in initialize_header(). + int base_offset = base_offset_in_bytes; + if (!is_aligned(base_offset, BytesPerWord)) { + assert(is_aligned(base_offset, BytesPerInt), "must be 4-byte aligned"); + sw(zr, Address(obj, base_offset)); + base_offset += BytesPerInt; + } + assert(is_aligned(base_offset, BytesPerWord), "must be word-aligned"); + // clear rest of allocated space const Register len_zero = len; - initialize_body(obj, arr_size, header_size * BytesPerWord, len_zero); + initialize_body(obj, arr_size, base_offset, len_zero); membar(MacroAssembler::StoreStore); diff --git a/src/hotspot/cpu/riscv/c1_MacroAssembler_riscv.hpp b/src/hotspot/cpu/riscv/c1_MacroAssembler_riscv.hpp index b737a438511..2d7f8d7485d 100644 --- a/src/hotspot/cpu/riscv/c1_MacroAssembler_riscv.hpp +++ b/src/hotspot/cpu/riscv/c1_MacroAssembler_riscv.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2014, 2015, Red Hat Inc. All rights reserved. * Copyright (c) 2020, 2022, Huawei Technologies Co., Ltd. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -101,7 +101,7 @@ using MacroAssembler::null_check; // header_size: size of object header in words // f : element scale factor // slow_case : exit to slow case implementation if fast allocation fails - void allocate_array(Register obj, Register len, Register tmp1, Register tmp2, int header_size, int f, Register klass, Label& slow_case); + void allocate_array(Register obj, Register len, Register tmp1, Register tmp2, int base_offset_in_bytes, int f, Register klass, Label& slow_case); int rsp_offset() const { return _rsp_offset; } diff --git a/src/hotspot/cpu/riscv/gc/g1/g1BarrierSetAssembler_riscv.cpp b/src/hotspot/cpu/riscv/gc/g1/g1BarrierSetAssembler_riscv.cpp index 5d0b0fb4729..fa7df32d7e9 100644 --- a/src/hotspot/cpu/riscv/gc/g1/g1BarrierSetAssembler_riscv.cpp +++ b/src/hotspot/cpu/riscv/gc/g1/g1BarrierSetAssembler_riscv.cpp @@ -29,8 +29,8 @@ #include "gc/g1/g1BarrierSetAssembler.hpp" #include "gc/g1/g1BarrierSetRuntime.hpp" #include "gc/g1/g1CardTable.hpp" +#include "gc/g1/g1HeapRegion.hpp" #include "gc/g1/g1ThreadLocalData.hpp" -#include "gc/g1/heapRegion.hpp" #include "gc/shared/collectedHeap.hpp" #include "interpreter/interp_masm.hpp" #include "runtime/javaThread.hpp" diff --git a/src/hotspot/cpu/riscv/stubGenerator_riscv.cpp b/src/hotspot/cpu/riscv/stubGenerator_riscv.cpp index 4bd33d08f89..bbdafb922cc 100644 --- a/src/hotspot/cpu/riscv/stubGenerator_riscv.cpp +++ b/src/hotspot/cpu/riscv/stubGenerator_riscv.cpp @@ -4809,6 +4809,348 @@ class StubGenerator: public StubCodeGenerator { return (address) start; } + + // ------------------------ SHA-1 intrinsic ------------------------ + + // K't = + // 5a827999, 0 <= t <= 19 + // 6ed9eba1, 20 <= t <= 39 + // 8f1bbcdc, 40 <= t <= 59 + // ca62c1d6, 60 <= t <= 79 + void sha1_prepare_k(Register cur_k, int round) { + assert(round >= 0 && round < 80, "must be"); + + static const int64_t ks[] = {0x5a827999, 0x6ed9eba1, 0x8f1bbcdc, 0xca62c1d6}; + if ((round % 20) == 0) { + __ mv(cur_k, ks[round/20]); + } + } + + // W't = + // M't, 0 <= t <= 15 + // ROTL'1(W't-3 ^ W't-8 ^ W't-14 ^ W't-16), 16 <= t <= 79 + void sha1_prepare_w(Register cur_w, Register ws[], Register buf, int round) { + assert(round >= 0 && round < 80, "must be"); + + if (round < 16) { + // in the first 16 rounds, in ws[], every register contains 2 W't, e.g. + // in ws[0], high part contains W't-0, low part contains W't-1, + // in ws[1], high part contains W't-2, low part contains W't-3, + // ... + // in ws[7], high part contains W't-14, low part contains W't-15. + + if ((round % 2) == 0) { + __ ld(ws[round/2], Address(buf, (round/2) * 8)); + // reverse bytes, as SHA-1 is defined in big-endian. + __ revb(ws[round/2], ws[round/2]); + __ srli(cur_w, ws[round/2], 32); + } else { + __ mv(cur_w, ws[round/2]); + } + + return; + } + + if ((round % 2) == 0) { + int idx = 16; + // W't = ROTL'1(W't-3 ^ W't-8 ^ W't-14 ^ W't-16), 16 <= t <= 79 + __ srli(t1, ws[(idx-8)/2], 32); + __ xorr(t0, ws[(idx-3)/2], t1); + + __ srli(t1, ws[(idx-14)/2], 32); + __ srli(cur_w, ws[(idx-16)/2], 32); + __ xorr(cur_w, cur_w, t1); + + __ xorr(cur_w, cur_w, t0); + __ rolw_imm(cur_w, cur_w, 1, t0); + + // copy the cur_w value to ws[8]. + // now, valid w't values are at: + // w0: ws[0]'s lower 32 bits + // w1 ~ w14: ws[1] ~ ws[7] + // w15: ws[8]'s higher 32 bits + __ slli(ws[idx/2], cur_w, 32); + + return; + } + + int idx = 17; + // W't = ROTL'1(W't-3 ^ W't-8 ^ W't-14 ^ W't-16), 16 <= t <= 79 + __ srli(t1, ws[(idx-3)/2], 32); + __ xorr(t0, t1, ws[(idx-8)/2]); + + __ xorr(cur_w, ws[(idx-16)/2], ws[(idx-14)/2]); + + __ xorr(cur_w, cur_w, t0); + __ rolw_imm(cur_w, cur_w, 1, t0); + + // copy the cur_w value to ws[8] + __ zero_extend(cur_w, cur_w, 32); + __ orr(ws[idx/2], ws[idx/2], cur_w); + + // shift the w't registers, so they start from ws[0] again. + // now, valid w't values are at: + // w0 ~ w15: ws[0] ~ ws[7] + Register ws_0 = ws[0]; + for (int i = 0; i < 16/2; i++) { + ws[i] = ws[i+1]; + } + ws[8] = ws_0; + } + + // f't(x, y, z) = + // Ch(x, y, z) = (x & y) ^ (~x & z) , 0 <= t <= 19 + // Parity(x, y, z) = x ^ y ^ z , 20 <= t <= 39 + // Maj(x, y, z) = (x & y) ^ (x & z) ^ (y & z) , 40 <= t <= 59 + // Parity(x, y, z) = x ^ y ^ z , 60 <= t <= 79 + void sha1_f(Register dst, Register x, Register y, Register z, int round) { + assert(round >= 0 && round < 80, "must be"); + assert_different_registers(dst, x, y, z, t0, t1); + + if (round < 20) { + // (x & y) ^ (~x & z) + __ andr(t0, x, y); + __ andn(dst, z, x); + __ xorr(dst, dst, t0); + } else if (round >= 40 && round < 60) { + // (x & y) ^ (x & z) ^ (y & z) + __ andr(t0, x, y); + __ andr(t1, x, z); + __ andr(dst, y, z); + __ xorr(dst, dst, t0); + __ xorr(dst, dst, t1); + } else { + // x ^ y ^ z + __ xorr(dst, x, y); + __ xorr(dst, dst, z); + } + } + + // T = ROTL'5(a) + f't(b, c, d) + e + K't + W't + // e = d + // d = c + // c = ROTL'30(b) + // b = a + // a = T + void sha1_process_round(Register a, Register b, Register c, Register d, Register e, + Register cur_k, Register cur_w, Register tmp, int round) { + assert(round >= 0 && round < 80, "must be"); + assert_different_registers(a, b, c, d, e, cur_w, cur_k, tmp, t0); + + // T = ROTL'5(a) + f't(b, c, d) + e + K't + W't + + // cur_w will be recalculated at the beginning of each round, + // so, we can reuse it as a temp register here. + Register tmp2 = cur_w; + + // reuse e as a temporary register, as we will mv new value into it later + Register tmp3 = e; + __ add(tmp2, cur_k, tmp2); + __ add(tmp3, tmp3, tmp2); + __ rolw_imm(tmp2, a, 5, t0); + + sha1_f(tmp, b, c, d, round); + + __ add(tmp2, tmp2, tmp); + __ add(tmp2, tmp2, tmp3); + + // e = d + // d = c + // c = ROTL'30(b) + // b = a + // a = T + __ mv(e, d); + __ mv(d, c); + + __ rolw_imm(c, b, 30); + __ mv(b, a); + __ mv(a, tmp2); + } + + // H(i)0 = a + H(i-1)0 + // H(i)1 = b + H(i-1)1 + // H(i)2 = c + H(i-1)2 + // H(i)3 = d + H(i-1)3 + // H(i)4 = e + H(i-1)4 + void sha1_calculate_im_hash(Register a, Register b, Register c, Register d, Register e, + Register prev_ab, Register prev_cd, Register prev_e) { + assert_different_registers(a, b, c, d, e, prev_ab, prev_cd, prev_e); + + __ add(a, a, prev_ab); + __ srli(prev_ab, prev_ab, 32); + __ add(b, b, prev_ab); + + __ add(c, c, prev_cd); + __ srli(prev_cd, prev_cd, 32); + __ add(d, d, prev_cd); + + __ add(e, e, prev_e); + } + + void sha1_preserve_prev_abcde(Register a, Register b, Register c, Register d, Register e, + Register prev_ab, Register prev_cd, Register prev_e) { + assert_different_registers(a, b, c, d, e, prev_ab, prev_cd, prev_e, t0); + + __ slli(t0, b, 32); + __ zero_extend(prev_ab, a, 32); + __ orr(prev_ab, prev_ab, t0); + + __ slli(t0, d, 32); + __ zero_extend(prev_cd, c, 32); + __ orr(prev_cd, prev_cd, t0); + + __ mv(prev_e, e); + } + + // Intrinsic for: + // void sun.security.provider.SHA.implCompress0(byte[] buf, int ofs) + // void sun.security.provider.DigestBase.implCompressMultiBlock0(byte[] b, int ofs, int limit) + // + // Arguments: + // + // Inputs: + // c_rarg0: byte[] src array + offset + // c_rarg1: int[] SHA.state + // - - - - - - below are only for implCompressMultiBlock0 - - - - - - + // c_rarg2: int offset + // c_rarg3: int limit + // + // Outputs: + // - - - - - - below are only for implCompressMultiBlock0 - - - - - - + // c_rarg0: int offset, when (multi_block == true) + // + address generate_sha1_implCompress(bool multi_block, const char *name) { + __ align(CodeEntryAlignment); + StubCodeMark mark(this, "StubRoutines", name); + + address start = __ pc(); + __ enter(); + + RegSet saved_regs = RegSet::range(x18, x27); + if (multi_block) { + // use x9 as src below. + saved_regs += RegSet::of(x9); + } + __ push_reg(saved_regs, sp); + + // c_rarg0 - c_rarg3: x10 - x13 + Register buf = c_rarg0; + Register state = c_rarg1; + Register offset = c_rarg2; + Register limit = c_rarg3; + // use src to contain the original start point of the array. + Register src = x9; + + if (multi_block) { + __ sub(limit, limit, offset); + __ add(limit, limit, buf); + __ sub(src, buf, offset); + } + + // [args-reg]: x14 - x17 + // [temp-reg]: x28 - x31 + // [saved-reg]: x18 - x27 + + // h0/1/2/3/4 + const Register a = x14, b = x15, c = x16, d = x17, e = x28; + // w0, w1, ... w15 + // put two adjecent w's in one register: + // one at high word part, another at low word part + // at different round (even or odd), w't value reside in different items in ws[]. + // w0 ~ w15, either reside in + // ws[0] ~ ws[7], where + // w0 at higher 32 bits of ws[0], + // w1 at lower 32 bits of ws[0], + // ... + // w14 at higher 32 bits of ws[7], + // w15 at lower 32 bits of ws[7]. + // or, reside in + // w0: ws[0]'s lower 32 bits + // w1 ~ w14: ws[1] ~ ws[7] + // w15: ws[8]'s higher 32 bits + Register ws[9] = {x29, x30, x31, x18, + x19, x20, x21, x22, + x23}; // auxiliary register for calculating w's value + // current k't's value + const Register cur_k = x24; + // current w't's value + const Register cur_w = x25; + // values of a, b, c, d, e in the previous round + const Register prev_ab = x26, prev_cd = x27; + const Register prev_e = offset; // reuse offset/c_rarg2 + + // load 5 words state into a, b, c, d, e. + // + // To minimize the number of memory operations, we apply following + // optimization: read the states (a/b/c/d) of 4-byte values in pairs, + // with a single ld, and split them into 2 registers. + // + // And, as the core algorithm of SHA-1 works on 32-bits words, so + // in the following code, it does not care about the content of + // higher 32-bits in a/b/c/d/e. Based on this observation, + // we can apply further optimization, which is to just ignore the + // higher 32-bits in a/c/e, rather than set the higher + // 32-bits of a/c/e to zero explicitly with extra instructions. + __ ld(a, Address(state, 0)); + __ srli(b, a, 32); + __ ld(c, Address(state, 8)); + __ srli(d, c, 32); + __ lw(e, Address(state, 16)); + + Label L_sha1_loop; + if (multi_block) { + __ BIND(L_sha1_loop); + } + + sha1_preserve_prev_abcde(a, b, c, d, e, prev_ab, prev_cd, prev_e); + + for (int round = 0; round < 80; round++) { + // prepare K't value + sha1_prepare_k(cur_k, round); + + // prepare W't value + sha1_prepare_w(cur_w, ws, buf, round); + + // one round process + sha1_process_round(a, b, c, d, e, cur_k, cur_w, t2, round); + } + + // compute the intermediate hash value + sha1_calculate_im_hash(a, b, c, d, e, prev_ab, prev_cd, prev_e); + + if (multi_block) { + int64_t block_bytes = 16 * 4; + __ addi(buf, buf, block_bytes); + + __ bge(limit, buf, L_sha1_loop, true); + } + + // store back the state. + __ zero_extend(a, a, 32); + __ slli(b, b, 32); + __ orr(a, a, b); + __ sd(a, Address(state, 0)); + __ zero_extend(c, c, 32); + __ slli(d, d, 32); + __ orr(c, c, d); + __ sd(c, Address(state, 8)); + __ sw(e, Address(state, 16)); + + // return offset + if (multi_block) { + __ sub(c_rarg0, buf, src); + } + + __ pop_reg(saved_regs, sp); + + __ leave(); + __ ret(); + + return (address) start; + } + + + #ifdef COMPILER2 static const int64_t right_2_bits = right_n_bits(2); @@ -5273,6 +5615,11 @@ static const int64_t right_3_bits = right_n_bits(3); StubRoutines::_chacha20Block = generate_chacha20Block(); } + if (UseSHA1Intrinsics) { + StubRoutines::_sha1_implCompress = generate_sha1_implCompress(false, "sha1_implCompress"); + StubRoutines::_sha1_implCompressMB = generate_sha1_implCompress(true, "sha1_implCompressMB"); + } + #endif // COMPILER2_OR_JVMCI } diff --git a/src/hotspot/cpu/riscv/stubRoutines_riscv.hpp b/src/hotspot/cpu/riscv/stubRoutines_riscv.hpp index 7c604e8c11c..90a7e0967b2 100644 --- a/src/hotspot/cpu/riscv/stubRoutines_riscv.hpp +++ b/src/hotspot/cpu/riscv/stubRoutines_riscv.hpp @@ -39,7 +39,7 @@ enum platform_dependent_constants { // simply increase sizes if too small (assembler will crash if too small) _initial_stubs_code_size = 10000, _continuation_stubs_code_size = 2000, - _compiler_stubs_code_size = 15000 ZGC_ONLY(+5000), + _compiler_stubs_code_size = 25000 ZGC_ONLY(+5000), _final_stubs_code_size = 20000 ZGC_ONLY(+10000) }; diff --git a/src/hotspot/cpu/riscv/upcallLinker_riscv.cpp b/src/hotspot/cpu/riscv/upcallLinker_riscv.cpp index 142d9d63693..8a6557dde93 100644 --- a/src/hotspot/cpu/riscv/upcallLinker_riscv.cpp +++ b/src/hotspot/cpu/riscv/upcallLinker_riscv.cpp @@ -267,9 +267,13 @@ address UpcallLinker::make_upcall_stub(jobject receiver, Method* entry, __ mov_metadata(xmethod, entry); __ sd(xmethod, Address(xthread, JavaThread::callee_target_offset())); // just in case callee is deoptimized + __ push_cont_fastpath(xthread); + __ ld(t0, Address(xmethod, Method::from_compiled_offset())); __ jalr(t0); + __ pop_cont_fastpath(xthread); + // return value shuffle if (!needs_return_buffer) { #ifdef ASSERT diff --git a/src/hotspot/cpu/riscv/vm_version_riscv.cpp b/src/hotspot/cpu/riscv/vm_version_riscv.cpp index 390ba51ee4f..e1711dc5592 100644 --- a/src/hotspot/cpu/riscv/vm_version_riscv.cpp +++ b/src/hotspot/cpu/riscv/vm_version_riscv.cpp @@ -149,16 +149,6 @@ void VM_Version::initialize() { FLAG_SET_DEFAULT(UseAESCTRIntrinsics, false); } - if (UseSHA1Intrinsics) { - warning("Intrinsics for SHA-1 crypto hash functions not available on this CPU."); - FLAG_SET_DEFAULT(UseSHA1Intrinsics, false); - } - - if (UseSHA3Intrinsics) { - warning("Intrinsics for SHA3-224, SHA3-256, SHA3-384 and SHA3-512 crypto hash functions not available on this CPU."); - FLAG_SET_DEFAULT(UseSHA3Intrinsics, false); - } - if (UseCRC32Intrinsics) { warning("CRC32 intrinsics are not available on this CPU."); FLAG_SET_DEFAULT(UseCRC32Intrinsics, false); @@ -260,11 +250,8 @@ void VM_Version::initialize() { // NOTE: Make sure codes dependent on UseRVV are put after c2_initialize(), // as there are extra checks inside it which could disable UseRVV // in some situations. - if (UseZvkn && !UseRVV) { - FLAG_SET_DEFAULT(UseZvkn, false); - warning("Cannot enable Zvkn on cpu without RVV support."); - } + // ChaCha20 if (UseRVV) { if (FLAG_IS_DEFAULT(UseChaCha20Intrinsics)) { FLAG_SET_DEFAULT(UseChaCha20Intrinsics, true); @@ -276,29 +263,65 @@ void VM_Version::initialize() { FLAG_SET_DEFAULT(UseChaCha20Intrinsics, false); } - if (!UseZvkn && UseSHA) { - warning("SHA instructions are not available on this CPU"); - FLAG_SET_DEFAULT(UseSHA, false); - } else if (UseZvkn && FLAG_IS_DEFAULT(UseSHA)) { + // SHA's + if (FLAG_IS_DEFAULT(UseSHA)) { FLAG_SET_DEFAULT(UseSHA, true); } - if (!UseSHA) { + // SHA-1, no RVV required though. + if (UseSHA) { + if (FLAG_IS_DEFAULT(UseSHA1Intrinsics)) { + FLAG_SET_DEFAULT(UseSHA1Intrinsics, true); + } + } else if (UseSHA1Intrinsics) { + warning("Intrinsics for SHA-1 crypto hash functions not available on this CPU."); + FLAG_SET_DEFAULT(UseSHA1Intrinsics, false); + } + + // UseZvkn (depends on RVV) and SHA-2. + if (UseZvkn && !UseRVV) { + FLAG_SET_DEFAULT(UseZvkn, false); + warning("Cannot enable Zvkn on cpu without RVV support."); + } + // SHA-2, depends on Zvkn. + if (UseSHA) { + if (UseZvkn) { + if (FLAG_IS_DEFAULT(UseSHA256Intrinsics)) { + FLAG_SET_DEFAULT(UseSHA256Intrinsics, true); + } + if (FLAG_IS_DEFAULT(UseSHA512Intrinsics)) { + FLAG_SET_DEFAULT(UseSHA512Intrinsics, true); + } + } else { + if (UseSHA256Intrinsics) { + warning("Intrinsics for SHA-224 and SHA-256 crypto hash functions not available on this CPU, UseZvkn needed."); + FLAG_SET_DEFAULT(UseSHA256Intrinsics, false); + } + if (UseSHA512Intrinsics) { + warning("Intrinsics for SHA-384 and SHA-512 crypto hash functions not available on this CPU, UseZvkn needed."); + FLAG_SET_DEFAULT(UseSHA512Intrinsics, false); + } + } + } else { if (UseSHA256Intrinsics) { - warning("Intrinsics for SHA-224 and SHA-256 crypto hash functions not available on this CPU, UseZvkn needed."); + warning("Intrinsics for SHA-224 and SHA-256 crypto hash functions not available on this CPU, as UseSHA disabled."); FLAG_SET_DEFAULT(UseSHA256Intrinsics, false); } if (UseSHA512Intrinsics) { - warning("Intrinsics for SHA-384 and SHA-512 crypto hash functions not available on this CPU, UseZvkn needed."); + warning("Intrinsics for SHA-384 and SHA-512 crypto hash functions not available on this CPU, as UseSHA disabled."); FLAG_SET_DEFAULT(UseSHA512Intrinsics, false); } - } else { - if (FLAG_IS_DEFAULT(UseSHA256Intrinsics)) { - FLAG_SET_DEFAULT(UseSHA256Intrinsics, true); - } - if (FLAG_IS_DEFAULT(UseSHA512Intrinsics)) { - FLAG_SET_DEFAULT(UseSHA512Intrinsics, true); - } + } + + // SHA-3 + if (UseSHA3Intrinsics) { + warning("Intrinsics for SHA3-224, SHA3-256, SHA3-384 and SHA3-512 crypto hash functions not available on this CPU."); + FLAG_SET_DEFAULT(UseSHA3Intrinsics, false); + } + + // UseSHA + if (!(UseSHA1Intrinsics || UseSHA256Intrinsics || UseSHA3Intrinsics || UseSHA512Intrinsics)) { + FLAG_SET_DEFAULT(UseSHA, false); } } diff --git a/src/hotspot/cpu/s390/c1_LIRAssembler_s390.cpp b/src/hotspot/cpu/s390/c1_LIRAssembler_s390.cpp index b3b7e3b830e..a8a17bd7554 100644 --- a/src/hotspot/cpu/s390/c1_LIRAssembler_s390.cpp +++ b/src/hotspot/cpu/s390/c1_LIRAssembler_s390.cpp @@ -2382,7 +2382,7 @@ void LIR_Assembler::emit_alloc_array(LIR_OpAllocArray* op) { op->len()->as_register(), op->tmp1()->as_register(), op->tmp2()->as_register(), - arrayOopDesc::header_size(op->type()), + arrayOopDesc::base_offset_in_bytes(op->type()), type2aelembytes(op->type()), op->klass()->as_register(), *op->stub()->entry()); diff --git a/src/hotspot/cpu/s390/c1_MacroAssembler_s390.cpp b/src/hotspot/cpu/s390/c1_MacroAssembler_s390.cpp index 5dddc7a756f..58bdcee5d5f 100644 --- a/src/hotspot/cpu/s390/c1_MacroAssembler_s390.cpp +++ b/src/hotspot/cpu/s390/c1_MacroAssembler_s390.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2016, 2023 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -271,7 +271,7 @@ void C1_MacroAssembler::allocate_array( Register len, // array length Register t1, // temp register Register t2, // temp register - int hdr_size, // object header size in words + int base_offset_in_bytes, // elements offset in bytes int elt_size, // element size in bytes Register klass, // object klass Label& slow_case // Continuation point if fast allocation fails. @@ -297,8 +297,8 @@ void C1_MacroAssembler::allocate_array( case 8: z_sllg(arr_size, len, 3); break; default: ShouldNotReachHere(); } - add2reg(arr_size, hdr_size * wordSize + MinObjAlignmentInBytesMask); // Add space for header & alignment. - z_nill(arr_size, (~MinObjAlignmentInBytesMask) & 0xffff); // Align array size. + add2reg(arr_size, base_offset_in_bytes + MinObjAlignmentInBytesMask); // Add space for header & alignment. + z_nill(arr_size, (~MinObjAlignmentInBytesMask) & 0xffff); // Align array size. try_allocate(obj, arr_size, 0, t1, slow_case); @@ -308,9 +308,9 @@ void C1_MacroAssembler::allocate_array( Label done; Register object_fields = t1; Register Rzero = Z_R1_scratch; - z_aghi(arr_size, -(hdr_size * BytesPerWord)); + z_aghi(arr_size, -base_offset_in_bytes); z_bre(done); // Jump if size of fields is zero. - z_la(object_fields, hdr_size * BytesPerWord, obj); + z_la(object_fields, base_offset_in_bytes, obj); z_xgr(Rzero, Rzero); initialize_body(object_fields, arr_size, Rzero); bind(done); diff --git a/src/hotspot/cpu/s390/c1_MacroAssembler_s390.hpp b/src/hotspot/cpu/s390/c1_MacroAssembler_s390.hpp index 7a4f76af154..c77258509e1 100644 --- a/src/hotspot/cpu/s390/c1_MacroAssembler_s390.hpp +++ b/src/hotspot/cpu/s390/c1_MacroAssembler_s390.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2016, 2023 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -86,7 +86,7 @@ Register len, // array length Register t1, // temp register Register t2, // temp register - int hdr_size, // object header size in words + int base_offset_in_bytes, // elements offset in bytes int elt_size, // element size in bytes Register klass, // object klass Label& slow_case // Continuation point if fast allocation fails. diff --git a/src/hotspot/cpu/s390/gc/g1/g1BarrierSetAssembler_s390.cpp b/src/hotspot/cpu/s390/gc/g1/g1BarrierSetAssembler_s390.cpp index 3ed99f68c47..8ce9305a865 100644 --- a/src/hotspot/cpu/s390/gc/g1/g1BarrierSetAssembler_s390.cpp +++ b/src/hotspot/cpu/s390/gc/g1/g1BarrierSetAssembler_s390.cpp @@ -31,9 +31,9 @@ #include "gc/g1/g1BarrierSetAssembler.hpp" #include "gc/g1/g1BarrierSetRuntime.hpp" #include "gc/g1/g1DirtyCardQueue.hpp" +#include "gc/g1/g1HeapRegion.hpp" #include "gc/g1/g1SATBMarkQueueSet.hpp" #include "gc/g1/g1ThreadLocalData.hpp" -#include "gc/g1/heapRegion.hpp" #include "interpreter/interp_masm.hpp" #include "runtime/jniHandles.hpp" #include "runtime/sharedRuntime.hpp" diff --git a/src/hotspot/cpu/x86/c1_LIRAssembler_x86.cpp b/src/hotspot/cpu/x86/c1_LIRAssembler_x86.cpp index 6fef703c75e..c7569e6b5cc 100644 --- a/src/hotspot/cpu/x86/c1_LIRAssembler_x86.cpp +++ b/src/hotspot/cpu/x86/c1_LIRAssembler_x86.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -1655,7 +1655,7 @@ void LIR_Assembler::emit_alloc_array(LIR_OpAllocArray* op) { len, tmp1, tmp2, - arrayOopDesc::header_size(op->type()), + arrayOopDesc::base_offset_in_bytes(op->type()), array_element_size(op->type()), op->klass()->as_register(), *op->stub()->entry()); diff --git a/src/hotspot/cpu/x86/c1_MacroAssembler_x86.cpp b/src/hotspot/cpu/x86/c1_MacroAssembler_x86.cpp index 12ac0d9ea41..ef75d953e84 100644 --- a/src/hotspot/cpu/x86/c1_MacroAssembler_x86.cpp +++ b/src/hotspot/cpu/x86/c1_MacroAssembler_x86.cpp @@ -199,6 +199,15 @@ void C1_MacroAssembler::initialize_header(Register obj, Register klass, Register if (len->is_valid()) { movl(Address(obj, arrayOopDesc::length_offset_in_bytes()), len); +#ifdef _LP64 + int base_offset = arrayOopDesc::length_offset_in_bytes() + BytesPerInt; + if (!is_aligned(base_offset, BytesPerWord)) { + assert(is_aligned(base_offset, BytesPerInt), "must be 4-byte aligned"); + // Clear gap/first 4 bytes following the length field. + xorl(t1, t1); + movl(Address(obj, base_offset), t1); + } +#endif } #ifdef _LP64 else if (UseCompressedClassPointers) { @@ -282,7 +291,7 @@ void C1_MacroAssembler::initialize_object(Register obj, Register klass, Register verify_oop(obj); } -void C1_MacroAssembler::allocate_array(Register obj, Register len, Register t1, Register t2, int header_size, Address::ScaleFactor f, Register klass, Label& slow_case) { +void C1_MacroAssembler::allocate_array(Register obj, Register len, Register t1, Register t2, int base_offset_in_bytes, Address::ScaleFactor f, Register klass, Label& slow_case) { assert(obj == rax, "obj must be in rax, for cmpxchg"); assert_different_registers(obj, len, t1, t2, klass); @@ -295,7 +304,7 @@ void C1_MacroAssembler::allocate_array(Register obj, Register len, Register t1, const Register arr_size = t2; // okay to be the same // align object end - movptr(arr_size, header_size * BytesPerWord + MinObjAlignmentInBytesMask); + movptr(arr_size, base_offset_in_bytes + MinObjAlignmentInBytesMask); lea(arr_size, Address(arr_size, len, f)); andptr(arr_size, ~MinObjAlignmentInBytesMask); @@ -305,7 +314,10 @@ void C1_MacroAssembler::allocate_array(Register obj, Register len, Register t1, // clear rest of allocated space const Register len_zero = len; - initialize_body(obj, arr_size, header_size * BytesPerWord, len_zero); + // Align-up to word boundary, because we clear the 4 bytes potentially + // following the length field in initialize_header(). + int base_offset = align_up(base_offset_in_bytes, BytesPerWord); + initialize_body(obj, arr_size, base_offset, len_zero); if (CURRENT_ENV->dtrace_alloc_probes()) { assert(obj == rax, "must be"); diff --git a/src/hotspot/cpu/x86/c1_MacroAssembler_x86.hpp b/src/hotspot/cpu/x86/c1_MacroAssembler_x86.hpp index b3593feb056..ae340e64fb7 100644 --- a/src/hotspot/cpu/x86/c1_MacroAssembler_x86.hpp +++ b/src/hotspot/cpu/x86/c1_MacroAssembler_x86.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -89,7 +89,7 @@ // header_size: size of object header in words // f : element scale factor // slow_case : exit to slow case implementation if fast allocation fails - void allocate_array(Register obj, Register len, Register t, Register t2, int header_size, Address::ScaleFactor f, Register klass, Label& slow_case); + void allocate_array(Register obj, Register len, Register t, Register t2, int base_offset_in_bytes, Address::ScaleFactor f, Register klass, Label& slow_case); int rsp_offset() const { return _rsp_offset; } void set_rsp_offset(int n) { _rsp_offset = n; } diff --git a/src/hotspot/cpu/x86/gc/g1/g1BarrierSetAssembler_x86.cpp b/src/hotspot/cpu/x86/gc/g1/g1BarrierSetAssembler_x86.cpp index c6815bbb476..34e785295a0 100644 --- a/src/hotspot/cpu/x86/gc/g1/g1BarrierSetAssembler_x86.cpp +++ b/src/hotspot/cpu/x86/gc/g1/g1BarrierSetAssembler_x86.cpp @@ -28,8 +28,8 @@ #include "gc/g1/g1BarrierSetAssembler.hpp" #include "gc/g1/g1BarrierSetRuntime.hpp" #include "gc/g1/g1CardTable.hpp" +#include "gc/g1/g1HeapRegion.hpp" #include "gc/g1/g1ThreadLocalData.hpp" -#include "gc/g1/heapRegion.hpp" #include "interpreter/interp_masm.hpp" #include "runtime/sharedRuntime.hpp" #include "utilities/debug.hpp" diff --git a/src/hotspot/cpu/x86/upcallLinker_x86_64.cpp b/src/hotspot/cpu/x86/upcallLinker_x86_64.cpp index 89e7a466264..7b9d49dd461 100644 --- a/src/hotspot/cpu/x86/upcallLinker_x86_64.cpp +++ b/src/hotspot/cpu/x86/upcallLinker_x86_64.cpp @@ -300,8 +300,12 @@ address UpcallLinker::make_upcall_stub(jobject receiver, Method* entry, __ mov_metadata(rbx, entry); __ movptr(Address(r15_thread, JavaThread::callee_target_offset()), rbx); // just in case callee is deoptimized + __ push_cont_fastpath(); + __ call(Address(rbx, Method::from_compiled_offset())); + __ pop_cont_fastpath(); + // return value shuffle if (!needs_return_buffer) { #ifdef ASSERT diff --git a/src/hotspot/cpu/x86/x86_64.ad b/src/hotspot/cpu/x86/x86_64.ad index e470d89373e..eea9a61e96d 100644 --- a/src/hotspot/cpu/x86/x86_64.ad +++ b/src/hotspot/cpu/x86/x86_64.ad @@ -4484,7 +4484,7 @@ instruct loadD(regD dst, memory mem) // max = java.lang.Math.max(float a, float b) instruct maxF_reg(legRegF dst, legRegF a, legRegF b, legRegF tmp, legRegF atmp, legRegF btmp) %{ - predicate(UseAVX > 0 && !SuperWord::is_reduction(n)); + predicate(UseAVX > 0 && !VLoopReductions::is_reduction(n)); match(Set dst (MaxF a b)); effect(USE a, USE b, TEMP tmp, TEMP atmp, TEMP btmp); format %{ "maxF $dst, $a, $b \t! using tmp, atmp and btmp as TEMP" %} @@ -4495,7 +4495,7 @@ instruct maxF_reg(legRegF dst, legRegF a, legRegF b, legRegF tmp, legRegF atmp, %} instruct maxF_reduction_reg(legRegF dst, legRegF a, legRegF b, legRegF xmmt, rRegI tmp, rFlagsReg cr) %{ - predicate(UseAVX > 0 && SuperWord::is_reduction(n)); + predicate(UseAVX > 0 && VLoopReductions::is_reduction(n)); match(Set dst (MaxF a b)); effect(USE a, USE b, TEMP xmmt, TEMP tmp, KILL cr); @@ -4509,7 +4509,7 @@ instruct maxF_reduction_reg(legRegF dst, legRegF a, legRegF b, legRegF xmmt, rRe // max = java.lang.Math.max(double a, double b) instruct maxD_reg(legRegD dst, legRegD a, legRegD b, legRegD tmp, legRegD atmp, legRegD btmp) %{ - predicate(UseAVX > 0 && !SuperWord::is_reduction(n)); + predicate(UseAVX > 0 && !VLoopReductions::is_reduction(n)); match(Set dst (MaxD a b)); effect(USE a, USE b, TEMP atmp, TEMP btmp, TEMP tmp); format %{ "maxD $dst, $a, $b \t! using tmp, atmp and btmp as TEMP" %} @@ -4520,7 +4520,7 @@ instruct maxD_reg(legRegD dst, legRegD a, legRegD b, legRegD tmp, legRegD atmp, %} instruct maxD_reduction_reg(legRegD dst, legRegD a, legRegD b, legRegD xmmt, rRegL tmp, rFlagsReg cr) %{ - predicate(UseAVX > 0 && SuperWord::is_reduction(n)); + predicate(UseAVX > 0 && VLoopReductions::is_reduction(n)); match(Set dst (MaxD a b)); effect(USE a, USE b, TEMP xmmt, TEMP tmp, KILL cr); @@ -4534,7 +4534,7 @@ instruct maxD_reduction_reg(legRegD dst, legRegD a, legRegD b, legRegD xmmt, rRe // min = java.lang.Math.min(float a, float b) instruct minF_reg(legRegF dst, legRegF a, legRegF b, legRegF tmp, legRegF atmp, legRegF btmp) %{ - predicate(UseAVX > 0 && !SuperWord::is_reduction(n)); + predicate(UseAVX > 0 && !VLoopReductions::is_reduction(n)); match(Set dst (MinF a b)); effect(USE a, USE b, TEMP tmp, TEMP atmp, TEMP btmp); format %{ "minF $dst, $a, $b \t! using tmp, atmp and btmp as TEMP" %} @@ -4545,7 +4545,7 @@ instruct minF_reg(legRegF dst, legRegF a, legRegF b, legRegF tmp, legRegF atmp, %} instruct minF_reduction_reg(legRegF dst, legRegF a, legRegF b, legRegF xmmt, rRegI tmp, rFlagsReg cr) %{ - predicate(UseAVX > 0 && SuperWord::is_reduction(n)); + predicate(UseAVX > 0 && VLoopReductions::is_reduction(n)); match(Set dst (MinF a b)); effect(USE a, USE b, TEMP xmmt, TEMP tmp, KILL cr); @@ -4559,7 +4559,7 @@ instruct minF_reduction_reg(legRegF dst, legRegF a, legRegF b, legRegF xmmt, rRe // min = java.lang.Math.min(double a, double b) instruct minD_reg(legRegD dst, legRegD a, legRegD b, legRegD tmp, legRegD atmp, legRegD btmp) %{ - predicate(UseAVX > 0 && !SuperWord::is_reduction(n)); + predicate(UseAVX > 0 && !VLoopReductions::is_reduction(n)); match(Set dst (MinD a b)); effect(USE a, USE b, TEMP tmp, TEMP atmp, TEMP btmp); format %{ "minD $dst, $a, $b \t! using tmp, atmp and btmp as TEMP" %} @@ -4570,7 +4570,7 @@ instruct minD_reg(legRegD dst, legRegD a, legRegD b, legRegD tmp, legRegD atmp, %} instruct minD_reduction_reg(legRegD dst, legRegD a, legRegD b, legRegD xmmt, rRegL tmp, rFlagsReg cr) %{ - predicate(UseAVX > 0 && SuperWord::is_reduction(n)); + predicate(UseAVX > 0 && VLoopReductions::is_reduction(n)); match(Set dst (MinD a b)); effect(USE a, USE b, TEMP xmmt, TEMP tmp, KILL cr); diff --git a/src/hotspot/os/aix/os_aix.cpp b/src/hotspot/os/aix/os_aix.cpp index 5dfe8a7e4d7..0c1c0dbc6dc 100644 --- a/src/hotspot/os/aix/os_aix.cpp +++ b/src/hotspot/os/aix/os_aix.cpp @@ -1127,10 +1127,9 @@ bool os::dll_address_to_library_name(address addr, char* buf, return true; } -void *os::dll_load(const char *filename, char *ebuf, int ebuflen) { +static void* dll_load_library(const char *filename, char *ebuf, int ebuflen) { log_info(os)("attempting shared library load of %s", filename); - if (ebuf && ebuflen > 0) { ebuf[0] = '\0'; ebuf[ebuflen - 1] = '\0'; @@ -1178,6 +1177,26 @@ void *os::dll_load(const char *filename, char *ebuf, int ebuflen) { } return nullptr; } +// Load library named +// If filename matches .so, and loading fails, repeat with .a. +void *os::dll_load(const char *filename, char *ebuf, int ebuflen) { + void* result = nullptr; + char* const file_path = strdup(filename); + char* const pointer_to_dot = strrchr(file_path, '.'); + const char old_extension[] = ".so"; + const char new_extension[] = ".a"; + STATIC_ASSERT(sizeof(old_extension) >= sizeof(new_extension)); + // First try to load the existing file. + result = dll_load_library(filename, ebuf, ebuflen); + // If the load fails,we try to reload by changing the extension to .a for .so files only. + // Shared object in .so format dont have braces, hence they get removed for archives with members. + if (result == nullptr && pointer_to_dot != nullptr && strcmp(pointer_to_dot, old_extension) == 0) { + snprintf(pointer_to_dot, sizeof(old_extension), "%s", new_extension); + result = dll_load_library(file_path, ebuf, ebuflen); + } + FREE_C_HEAP_ARRAY(char, file_path); + return result; +} void os::print_dll_info(outputStream *st) { st->print_cr("Dynamic libraries:"); diff --git a/src/hotspot/os_cpu/bsd_aarch64/copy_bsd_aarch64.S b/src/hotspot/os_cpu/bsd_aarch64/copy_bsd_aarch64.S index 7b286820a9a..187cd20ddbd 100644 --- a/src/hotspot/os_cpu/bsd_aarch64/copy_bsd_aarch64.S +++ b/src/hotspot/os_cpu/bsd_aarch64/copy_bsd_aarch64.S @@ -28,6 +28,11 @@ .global CFUNC(_Copy_conjoint_words) .global CFUNC(_Copy_disjoint_words) +#ifdef __APPLE__ + .private_extern CFUNC(_Copy_conjoint_words) + .private_extern CFUNC(_Copy_disjoint_words) +#endif + s .req x0 d .req x1 count .req x2 diff --git a/src/hotspot/os_cpu/bsd_aarch64/safefetch_bsd_aarch64.S b/src/hotspot/os_cpu/bsd_aarch64/safefetch_bsd_aarch64.S index 34d7b8e34a7..b9b6df9b23a 100644 --- a/src/hotspot/os_cpu/bsd_aarch64/safefetch_bsd_aarch64.S +++ b/src/hotspot/os_cpu/bsd_aarch64/safefetch_bsd_aarch64.S @@ -1,6 +1,6 @@ /* * Copyright (c) 2022 SAP SE. All rights reserved. - * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -39,6 +39,15 @@ .global SYMBOL(_SafeFetch32_fault) .global SYMBOL(_SafeFetch32_continuation) +#ifdef __APPLE__ + .private_extern SYMBOL(SafeFetchN_impl) + .private_extern SYMBOL(_SafeFetchN_fault) + .private_extern SYMBOL(_SafeFetchN_continuation) + .private_extern SYMBOL(SafeFetch32_impl) + .private_extern SYMBOL(_SafeFetch32_fault) + .private_extern SYMBOL(_SafeFetch32_continuation) +#endif + # Support for int SafeFetch32(int* address, int defaultval); # # x0 : address diff --git a/src/hotspot/os_cpu/bsd_x86/bsd_x86_32.S b/src/hotspot/os_cpu/bsd_x86/bsd_x86_32.S index 02231040e15..5cad379df3f 100644 --- a/src/hotspot/os_cpu/bsd_x86/bsd_x86_32.S +++ b/src/hotspot/os_cpu/bsd_x86/bsd_x86_32.S @@ -1,5 +1,5 @@ # -# Copyright (c) 2004, 2022, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -32,6 +32,7 @@ #endif .globl SYMBOL(fixcw) + .globl SYMBOL(SpinPause) # NOTE WELL! The _Copy functions are called directly # from server-compiler-generated code via CallLeafNoFP, @@ -50,6 +51,20 @@ .globl SYMBOL(_Atomic_cmpxchg_long) .globl SYMBOL(_Atomic_move_long) +#ifdef __APPLE__ + .private_extern SYMBOL(fixcw) + .private_extern SYMBOL(SpinPause) + .private_extern SYMBOL(_Copy_arrayof_conjoint_bytes) + .private_extern SYMBOL(_Copy_conjoint_jshorts_atomic) + .private_extern SYMBOL(_Copy_arrayof_conjoint_jshorts) + .private_extern SYMBOL(_Copy_conjoint_jints_atomic) + .private_extern SYMBOL(_Copy_arrayof_conjoint_jints) + .private_extern SYMBOL(_Copy_conjoint_jlongs_atomic) + .private_extern SYMBOL(_mmx_Copy_arrayof_conjoint_jshorts) + .private_extern SYMBOL(_Atomic_cmpxchg_long) + .private_extern SYMBOL(_Atomic_move_long) +#endif + .text # Support for void os::Solaris::init_thread_fpu_state() in os_solaris_i486.cpp @@ -62,7 +77,6 @@ SYMBOL(fixcw): popl %eax ret - .globl SYMBOL(SpinPause) ELF_TYPE(SpinPause,@function) .p2align 4,,15 SYMBOL(SpinPause): diff --git a/src/hotspot/os_cpu/bsd_x86/bsd_x86_64.S b/src/hotspot/os_cpu/bsd_x86/bsd_x86_64.S index 95cea3bf2a3..5e2addc4e6f 100644 --- a/src/hotspot/os_cpu/bsd_x86/bsd_x86_64.S +++ b/src/hotspot/os_cpu/bsd_x86/bsd_x86_64.S @@ -1,5 +1,5 @@ -# -# Copyright (c) 2004, 2013, Oracle and/or its affiliates. All rights reserved. +# +# Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -31,22 +31,33 @@ #endif # NOTE WELL! The _Copy functions are called directly - # from server-compiler-generated code via CallLeafNoFP, - # which means that they *must* either not use floating - # point or use it in the same manner as does the server - # compiler. - + # from server-compiler-generated code via CallLeafNoFP, + # which means that they *must* either not use floating + # point or use it in the same manner as does the server + # compiler. + + .globl SYMBOL(SpinPause) .globl SYMBOL(_Copy_arrayof_conjoint_bytes) - .globl SYMBOL(_Copy_arrayof_conjoint_jshorts) + .globl SYMBOL(_Copy_arrayof_conjoint_jshorts) .globl SYMBOL(_Copy_conjoint_jshorts_atomic) .globl SYMBOL(_Copy_arrayof_conjoint_jints) .globl SYMBOL(_Copy_conjoint_jints_atomic) .globl SYMBOL(_Copy_arrayof_conjoint_jlongs) .globl SYMBOL(_Copy_conjoint_jlongs_atomic) - .text +#ifdef __APPLE__ + .private_extern SYMBOL(SpinPause) + .private_extern SYMBOL(_Copy_arrayof_conjoint_bytes) + .private_extern SYMBOL(_Copy_arrayof_conjoint_jshorts) + .private_extern SYMBOL(_Copy_conjoint_jshorts_atomic) + .private_extern SYMBOL(_Copy_arrayof_conjoint_jints) + .private_extern SYMBOL(_Copy_conjoint_jints_atomic) + .private_extern SYMBOL(_Copy_arrayof_conjoint_jlongs) + .private_extern SYMBOL(_Copy_conjoint_jlongs_atomic) +#endif + + .text - .globl SYMBOL(SpinPause) .p2align 4,,15 ELF_TYPE(SpinPause,@function) SYMBOL(SpinPause): @@ -63,7 +74,7 @@ SYMBOL(SpinPause): # rdx - count, treated as ssize_t # .p2align 4,,15 - ELF_TYPE(_Copy_arrayof_conjoint_bytes,@function) + ELF_TYPE(_Copy_arrayof_conjoint_bytes,@function) SYMBOL(_Copy_arrayof_conjoint_bytes): movq %rdx,%r8 # byte count shrq $3,%rdx # qword count @@ -71,7 +82,7 @@ SYMBOL(_Copy_arrayof_conjoint_bytes): leaq -1(%rdi,%r8,1),%rax # from + bcount*1 - 1 jbe acb_CopyRight cmpq %rax,%rsi - jbe acb_CopyLeft + jbe acb_CopyLeft acb_CopyRight: leaq -8(%rdi,%rdx,8),%rax # from + qcount*8 - 8 leaq -8(%rsi,%rdx,8),%rcx # to + qcount*8 - 8 @@ -165,8 +176,8 @@ acb_CopyLeft: # rdx - count, treated as ssize_t # .p2align 4,,15 - ELF_TYPE(_Copy_arrayof_conjoint_jshorts,@function) - ELF_TYPE(_Copy_conjoint_jshorts_atomic,@function) + ELF_TYPE(_Copy_arrayof_conjoint_jshorts,@function) + ELF_TYPE(_Copy_conjoint_jshorts_atomic,@function) SYMBOL(_Copy_arrayof_conjoint_jshorts): SYMBOL(_Copy_conjoint_jshorts_atomic): movq %rdx,%r8 # word count @@ -175,7 +186,7 @@ SYMBOL(_Copy_conjoint_jshorts_atomic): leaq -2(%rdi,%r8,2),%rax # from + wcount*2 - 2 jbe acs_CopyRight cmpq %rax,%rsi - jbe acs_CopyLeft + jbe acs_CopyLeft acs_CopyRight: leaq -8(%rdi,%rdx,8),%rax # from + qcount*8 - 8 leaq -8(%rsi,%rdx,8),%rcx # to + qcount*8 - 8 @@ -255,8 +266,8 @@ acs_CopyLeft: # rdx - count, treated as ssize_t # .p2align 4,,15 - ELF_TYPE(_Copy_arrayof_conjoint_jints,@function) - ELF_TYPE(_Copy_conjoint_jints_atomic,@function) + ELF_TYPE(_Copy_arrayof_conjoint_jints,@function) + ELF_TYPE(_Copy_conjoint_jints_atomic,@function) SYMBOL(_Copy_arrayof_conjoint_jints): SYMBOL(_Copy_conjoint_jints_atomic): movq %rdx,%r8 # dword count @@ -265,7 +276,7 @@ SYMBOL(_Copy_conjoint_jints_atomic): leaq -4(%rdi,%r8,4),%rax # from + dcount*4 - 4 jbe aci_CopyRight cmpq %rax,%rsi - jbe aci_CopyLeft + jbe aci_CopyLeft aci_CopyRight: leaq -8(%rdi,%rdx,8),%rax # from + qcount*8 - 8 leaq -8(%rsi,%rdx,8),%rcx # to + qcount*8 - 8 @@ -334,15 +345,15 @@ aci_CopyLeft: # rdx - count, treated as ssize_t # .p2align 4,,15 - ELF_TYPE(_Copy_arrayof_conjoint_jlongs,@function) - ELF_TYPE(_Copy_conjoint_jlongs_atomic,@function) + ELF_TYPE(_Copy_arrayof_conjoint_jlongs,@function) + ELF_TYPE(_Copy_conjoint_jlongs_atomic,@function) SYMBOL(_Copy_arrayof_conjoint_jlongs): SYMBOL(_Copy_conjoint_jlongs_atomic): cmpq %rdi,%rsi leaq -8(%rdi,%rdx,8),%rax # from + count*8 - 8 jbe acl_CopyRight cmpq %rax,%rsi - jbe acl_CopyLeft + jbe acl_CopyLeft acl_CopyRight: leaq -8(%rsi,%rdx,8),%rcx # to + count*8 - 8 negq %rdx diff --git a/src/hotspot/os_cpu/bsd_x86/safefetch_bsd_x86_64.S b/src/hotspot/os_cpu/bsd_x86/safefetch_bsd_x86_64.S index 2a75f3dac94..1697f6f03b5 100644 --- a/src/hotspot/os_cpu/bsd_x86/safefetch_bsd_x86_64.S +++ b/src/hotspot/os_cpu/bsd_x86/safefetch_bsd_x86_64.S @@ -1,6 +1,6 @@ # # Copyright (c) 2022 SAP SE. All rights reserved. -# Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -38,13 +38,22 @@ .globl SYMBOL(_SafeFetch32_continuation) .globl SYMBOL(_SafeFetchN_continuation) +#ifdef __APPLE__ + .private_extern SYMBOL(SafeFetch32_impl) + .private_extern SYMBOL(SafeFetchN_impl) + .private_extern SYMBOL(_SafeFetch32_fault) + .private_extern SYMBOL(_SafeFetchN_fault) + .private_extern SYMBOL(_SafeFetch32_continuation) + .private_extern SYMBOL(_SafeFetchN_continuation) +#endif + .text # Support for int SafeFetch32(int* address, int defaultval); # # %rdi : address # %esi : defaultval - ELF_TYPE(SafeFetch32_impl,@function) + ELF_TYPE(SafeFetch32_impl,@function) SYMBOL(SafeFetch32_impl:) SYMBOL(_SafeFetch32_fault:) movl (%rdi), %eax diff --git a/src/hotspot/os_cpu/linux_aarch64/atomic_linux_aarch64.S b/src/hotspot/os_cpu/linux_aarch64/atomic_linux_aarch64.S index 4621e44ca3c..e67206a9d49 100644 --- a/src/hotspot/os_cpu/linux_aarch64/atomic_linux_aarch64.S +++ b/src/hotspot/os_cpu/linux_aarch64/atomic_linux_aarch64.S @@ -24,6 +24,7 @@ .text .globl aarch64_atomic_fetch_add_8_default_impl + .hidden aarch64_atomic_fetch_add_8_default_impl .align 5 aarch64_atomic_fetch_add_8_default_impl: #ifdef __ARM_FEATURE_ATOMICS @@ -40,6 +41,7 @@ aarch64_atomic_fetch_add_8_default_impl: ret .globl aarch64_atomic_fetch_add_4_default_impl + .hidden aarch64_atomic_fetch_add_4_default_impl .align 5 aarch64_atomic_fetch_add_4_default_impl: #ifdef __ARM_FEATURE_ATOMICS @@ -56,6 +58,7 @@ aarch64_atomic_fetch_add_4_default_impl: ret .global aarch64_atomic_fetch_add_8_relaxed_default_impl + .hidden aarch64_atomic_fetch_add_8_relaxed_default_impl .align 5 aarch64_atomic_fetch_add_8_relaxed_default_impl: #ifdef __ARM_FEATURE_ATOMICS @@ -71,6 +74,7 @@ aarch64_atomic_fetch_add_8_relaxed_default_impl: ret .global aarch64_atomic_fetch_add_4_relaxed_default_impl + .hidden aarch64_atomic_fetch_add_4_relaxed_default_impl .align 5 aarch64_atomic_fetch_add_4_relaxed_default_impl: #ifdef __ARM_FEATURE_ATOMICS @@ -86,6 +90,7 @@ aarch64_atomic_fetch_add_4_relaxed_default_impl: ret .globl aarch64_atomic_xchg_4_default_impl + .hidden aarch64_atomic_xchg_4_default_impl .align 5 aarch64_atomic_xchg_4_default_impl: #ifdef __ARM_FEATURE_ATOMICS @@ -101,6 +106,7 @@ aarch64_atomic_xchg_4_default_impl: ret .globl aarch64_atomic_xchg_8_default_impl + .hidden aarch64_atomic_xchg_8_default_impl .align 5 aarch64_atomic_xchg_8_default_impl: #ifdef __ARM_FEATURE_ATOMICS @@ -116,6 +122,7 @@ aarch64_atomic_xchg_8_default_impl: ret .globl aarch64_atomic_cmpxchg_1_default_impl + .hidden aarch64_atomic_cmpxchg_1_default_impl .align 5 aarch64_atomic_cmpxchg_1_default_impl: #ifdef __ARM_FEATURE_ATOMICS @@ -136,6 +143,7 @@ aarch64_atomic_cmpxchg_1_default_impl: ret .globl aarch64_atomic_cmpxchg_4_default_impl + .hidden aarch64_atomic_cmpxchg_4_default_impl .align 5 aarch64_atomic_cmpxchg_4_default_impl: #ifdef __ARM_FEATURE_ATOMICS @@ -155,6 +163,7 @@ aarch64_atomic_cmpxchg_4_default_impl: ret .globl aarch64_atomic_cmpxchg_8_default_impl + .hidden aarch64_atomic_cmpxchg_8_default_impl .align 5 aarch64_atomic_cmpxchg_8_default_impl: #ifdef __ARM_FEATURE_ATOMICS @@ -174,6 +183,7 @@ aarch64_atomic_cmpxchg_8_default_impl: ret .globl aarch64_atomic_cmpxchg_4_release_default_impl + .hidden aarch64_atomic_cmpxchg_4_release_default_impl .align 5 aarch64_atomic_cmpxchg_4_release_default_impl: #ifdef __ARM_FEATURE_ATOMICS @@ -191,6 +201,7 @@ aarch64_atomic_cmpxchg_4_release_default_impl: ret .globl aarch64_atomic_cmpxchg_8_release_default_impl + .hidden aarch64_atomic_cmpxchg_8_release_default_impl .align 5 aarch64_atomic_cmpxchg_8_release_default_impl: #ifdef __ARM_FEATURE_ATOMICS @@ -208,6 +219,7 @@ aarch64_atomic_cmpxchg_8_release_default_impl: ret .globl aarch64_atomic_cmpxchg_4_seq_cst_default_impl + .hidden aarch64_atomic_cmpxchg_4_seq_cst_default_impl .align 5 aarch64_atomic_cmpxchg_4_seq_cst_default_impl: #ifdef __ARM_FEATURE_ATOMICS @@ -225,6 +237,7 @@ aarch64_atomic_cmpxchg_4_seq_cst_default_impl: ret .globl aarch64_atomic_cmpxchg_8_seq_cst_default_impl + .hidden aarch64_atomic_cmpxchg_8_seq_cst_default_impl .align 5 aarch64_atomic_cmpxchg_8_seq_cst_default_impl: #ifdef __ARM_FEATURE_ATOMICS @@ -242,6 +255,7 @@ aarch64_atomic_cmpxchg_8_seq_cst_default_impl: ret .globl aarch64_atomic_cmpxchg_1_relaxed_default_impl +.hidden aarch64_atomic_cmpxchg_1_relaxed_default_impl .align 5 aarch64_atomic_cmpxchg_1_relaxed_default_impl: #ifdef __ARM_FEATURE_ATOMICS @@ -260,6 +274,7 @@ aarch64_atomic_cmpxchg_1_relaxed_default_impl: ret .globl aarch64_atomic_cmpxchg_4_relaxed_default_impl + .hidden aarch64_atomic_cmpxchg_4_relaxed_default_impl .align 5 aarch64_atomic_cmpxchg_4_relaxed_default_impl: #ifdef __ARM_FEATURE_ATOMICS @@ -277,6 +292,7 @@ aarch64_atomic_cmpxchg_4_relaxed_default_impl: ret .globl aarch64_atomic_cmpxchg_8_relaxed_default_impl + .hidden aarch64_atomic_cmpxchg_8_relaxed_default_impl .align 5 aarch64_atomic_cmpxchg_8_relaxed_default_impl: #ifdef __ARM_FEATURE_ATOMICS diff --git a/src/hotspot/os_cpu/linux_aarch64/copy_linux_aarch64.S b/src/hotspot/os_cpu/linux_aarch64/copy_linux_aarch64.S index 4b8ed597c59..ade867ace01 100644 --- a/src/hotspot/os_cpu/linux_aarch64/copy_linux_aarch64.S +++ b/src/hotspot/os_cpu/linux_aarch64/copy_linux_aarch64.S @@ -24,6 +24,9 @@ .global _Copy_conjoint_words .global _Copy_disjoint_words + .hidden _Copy_conjoint_words + .hidden _Copy_disjoint_words + s .req x0 d .req x1 count .req x2 diff --git a/src/hotspot/os_cpu/linux_aarch64/safefetch_linux_aarch64.S b/src/hotspot/os_cpu/linux_aarch64/safefetch_linux_aarch64.S index fcb7e62e6d5..cfbd8f45f28 100644 --- a/src/hotspot/os_cpu/linux_aarch64/safefetch_linux_aarch64.S +++ b/src/hotspot/os_cpu/linux_aarch64/safefetch_linux_aarch64.S @@ -1,6 +1,6 @@ /* * Copyright (c) 2022 SAP SE. All rights reserved. - * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -30,6 +30,13 @@ .globl _SafeFetch32_fault .globl _SafeFetch32_continuation + .hidden SafeFetchN_impl + .hidden _SafeFetchN_fault + .hidden _SafeFetchN_continuation + .hidden SafeFetch32_impl + .hidden _SafeFetch32_fault + .hidden _SafeFetch32_continuation + # Support for int SafeFetch32(int* address, int defaultval); # # x0 : address diff --git a/src/hotspot/os_cpu/linux_aarch64/threadLS_linux_aarch64.S b/src/hotspot/os_cpu/linux_aarch64/threadLS_linux_aarch64.S index ac60d6aa941..f9f5aab2a6b 100644 --- a/src/hotspot/os_cpu/linux_aarch64/threadLS_linux_aarch64.S +++ b/src/hotspot/os_cpu/linux_aarch64/threadLS_linux_aarch64.S @@ -25,22 +25,23 @@ // Clobber x1, flags. // All other registers are preserved, - .global _ZN10JavaThread25aarch64_get_thread_helperEv - .type _ZN10JavaThread25aarch64_get_thread_helperEv, %function + .global _ZN10JavaThread25aarch64_get_thread_helperEv + .hidden _ZN10JavaThread25aarch64_get_thread_helperEv + .type _ZN10JavaThread25aarch64_get_thread_helperEv, %function _ZN10JavaThread25aarch64_get_thread_helperEv: - hint #0x19 // paciasp - stp x29, x30, [sp, -16]! - adrp x0, :tlsdesc:_ZN6Thread12_thr_currentE - ldr x1, [x0, #:tlsdesc_lo12:_ZN6Thread12_thr_currentE] - add x0, x0, :tlsdesc_lo12:_ZN6Thread12_thr_currentE - .tlsdesccall _ZN6Thread12_thr_currentE - blr x1 - mrs x1, tpidr_el0 - add x0, x1, x0 - ldr x0, [x0] - ldp x29, x30, [sp], 16 - hint #0x1d // autiasp - ret + hint #0x19 // paciasp + stp x29, x30, [sp, -16]! + adrp x0, :tlsdesc:_ZN6Thread12_thr_currentE + ldr x1, [x0, #:tlsdesc_lo12:_ZN6Thread12_thr_currentE] + add x0, x0, :tlsdesc_lo12:_ZN6Thread12_thr_currentE + .tlsdesccall _ZN6Thread12_thr_currentE + blr x1 + mrs x1, tpidr_el0 + add x0, x1, x0 + ldr x0, [x0] + ldp x29, x30, [sp], 16 + hint #0x1d // autiasp + ret - .size _ZN10JavaThread25aarch64_get_thread_helperEv, .-_ZN10JavaThread25aarch64_get_thread_helperEv + .size _ZN10JavaThread25aarch64_get_thread_helperEv, .-_ZN10JavaThread25aarch64_get_thread_helperEv diff --git a/src/hotspot/os_cpu/linux_arm/linux_arm_32.S b/src/hotspot/os_cpu/linux_arm/linux_arm_32.S index eb560d8f0c7..ad88c58ce78 100644 --- a/src/hotspot/os_cpu/linux_arm/linux_arm_32.S +++ b/src/hotspot/os_cpu/linux_arm/linux_arm_32.S @@ -1,5 +1,5 @@ # -# Copyright (c) 2008, 2022, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2008, 2024, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -23,38 +23,46 @@ # NOTE WELL! The _Copy functions are called directly - # from server-compiler-generated code via CallLeafNoFP, - # which means that they *must* either not use floating - # point or use it in the same manner as does the server - # compiler. + # from server-compiler-generated code via CallLeafNoFP, + # which means that they *must* either not use floating + # point or use it in the same manner as does the server + # compiler. - .globl _Copy_conjoint_bytes - .type _Copy_conjoint_bytes, %function + .globl SpinPause + .hidden SpinPause + .type SpinPause, %function .globl _Copy_arrayof_conjoint_bytes - .type _Copy_arrayof_conjoint_bytes, %function - .globl _Copy_disjoint_words - .type _Copy_disjoint_words, %function - .globl _Copy_conjoint_words - .type _Copy_conjoint_words, %function + .hidden _Copy_arrayof_conjoint_bytes + .type _Copy_arrayof_conjoint_bytes, %function + .globl _Copy_disjoint_words + .hidden _Copy_disjoint_words + .type _Copy_disjoint_words, %function + .globl _Copy_conjoint_words + .hidden _Copy_conjoint_words + .type _Copy_conjoint_words, %function .globl _Copy_conjoint_jshorts_atomic - .type _Copy_conjoint_jshorts_atomic, %function - .globl _Copy_arrayof_conjoint_jshorts - .type _Copy_arrayof_conjoint_jshorts, %function + .hidden _Copy_conjoint_jshorts_atomic + .type _Copy_conjoint_jshorts_atomic, %function + .globl _Copy_arrayof_conjoint_jshorts + .hidden _Copy_arrayof_conjoint_jshorts + .type _Copy_arrayof_conjoint_jshorts, %function .globl _Copy_conjoint_jints_atomic - .type _Copy_conjoint_jints_atomic, %function + .hidden _Copy_conjoint_jints_atomic + .type _Copy_conjoint_jints_atomic, %function .globl _Copy_arrayof_conjoint_jints - .type _Copy_arrayof_conjoint_jints, %function - .globl _Copy_conjoint_jlongs_atomic - .type _Copy_conjoint_jlongs_atomic, %function - .globl _Copy_arrayof_conjoint_jlongs - .type _Copy_arrayof_conjoint_jlongs, %function + .hidden _Copy_arrayof_conjoint_jints + .type _Copy_arrayof_conjoint_jints, %function + .globl _Copy_conjoint_jlongs_atomic + .hidden _Copy_conjoint_jlongs_atomic + .type _Copy_conjoint_jlongs_atomic, %function + .globl _Copy_arrayof_conjoint_jlongs + .hidden _Copy_arrayof_conjoint_jlongs + .type _Copy_arrayof_conjoint_jlongs, %function from .req r0 to .req r1 - .text - .globl SpinPause - .type SpinPause, %function + .text SpinPause: bx LR @@ -70,7 +78,7 @@ _Copy_arrayof_conjoint_bytes: # size_t count) _Copy_disjoint_words: stmdb sp!, {r3 - r9, ip} - + cmp r2, #0 beq disjoint_words_finish @@ -81,17 +89,17 @@ _Copy_disjoint_words: .align 3 dw_f2b_loop_32: subs r2, #32 - blt dw_f2b_loop_32_finish + blt dw_f2b_loop_32_finish ldmia from!, {r3 - r9, ip} nop - pld [from] + pld [from] stmia to!, {r3 - r9, ip} bgt dw_f2b_loop_32 dw_f2b_loop_32_finish: addlts r2, #32 beq disjoint_words_finish cmp r2, #16 - blt disjoint_words_small + blt disjoint_words_small ldmia from!, {r3 - r6} subge r2, r2, #16 stmia to!, {r3 - r6} @@ -116,8 +124,8 @@ disjoint_words_finish: _Copy_conjoint_words: stmdb sp!, {r3 - r9, ip} - cmp r2, #0 - beq conjoint_words_finish + cmp r2, #0 + beq conjoint_words_finish pld [from, #0] cmp r2, #12 @@ -129,17 +137,17 @@ _Copy_conjoint_words: .align 3 cw_f2b_loop_32: subs r2, #32 - blt cw_f2b_loop_32_finish + blt cw_f2b_loop_32_finish ldmia from!, {r3 - r9, ip} nop - pld [from] + pld [from] stmia to!, {r3 - r9, ip} bgt cw_f2b_loop_32 cw_f2b_loop_32_finish: addlts r2, #32 beq conjoint_words_finish cmp r2, #16 - blt conjoint_words_small + blt conjoint_words_small ldmia from!, {r3 - r6} subge r2, r2, #16 stmia to!, {r3 - r6} @@ -154,7 +162,7 @@ conjoint_words_small: strgt r9, [to], #4 b conjoint_words_finish - # Src and dest overlap, copy in a descending order + # Src and dest overlap, copy in a descending order cw_b2f_copy: add from, r2 pld [from, #-32] @@ -162,17 +170,17 @@ cw_b2f_copy: .align 3 cw_b2f_loop_32: subs r2, #32 - blt cw_b2f_loop_32_finish + blt cw_b2f_loop_32_finish ldmdb from!, {r3-r9,ip} nop - pld [from, #-32] + pld [from, #-32] stmdb to!, {r3-r9,ip} bgt cw_b2f_loop_32 cw_b2f_loop_32_finish: addlts r2, #32 beq conjoint_words_finish cmp r2, #16 - blt cw_b2f_copy_small + blt cw_b2f_copy_small ldmdb from!, {r3 - r6} subge r2, r2, #16 stmdb to!, {r3 - r6} @@ -196,8 +204,8 @@ conjoint_words_finish: _Copy_conjoint_jshorts_atomic: stmdb sp!, {r3 - r9, ip} - cmp r2, #0 - beq conjoint_shorts_finish + cmp r2, #0 + beq conjoint_shorts_finish subs r3, to, from cmphi r2, r3 @@ -210,11 +218,11 @@ _Copy_conjoint_jshorts_atomic: ands r3, from, #3 bne cs_f2b_src_u - # Aligned source address + # Aligned source address .align 3 cs_f2b_loop_32: subs r2, #32 - blt cs_f2b_loop_32_finish + blt cs_f2b_loop_32_finish ldmia from!, {r3 - r9, ip} nop pld [from] @@ -244,14 +252,14 @@ cs_f2b_4: strgth r5, [to], #2 b conjoint_shorts_finish - # Destination not aligned + # Destination not aligned cs_f2b_dest_u: ldrh r3, [from], #2 subs r2, #2 strh r3, [to], #2 beq conjoint_shorts_finish - # Check to see if source is not aligned ether + # Check to see if source is not aligned ether ands r3, from, #3 beq cs_f2b_loop_32 @@ -259,11 +267,11 @@ cs_f2b_src_u: cmp r2, #16 blt cs_f2b_8_u - # Load 2 first bytes to r7 and make src ptr word aligned + # Load 2 first bytes to r7 and make src ptr word aligned bic from, #3 ldr r7, [from], #4 - # Destination aligned, source not + # Destination aligned, source not mov r8, r2, lsr #4 .align 3 cs_f2b_16_u_loop: @@ -306,7 +314,7 @@ cs_f2b_4_u: strgth r5, [to], #2 b conjoint_shorts_finish - # Src and dest overlap, copy in a descending order + # Src and dest overlap, copy in a descending order cs_b2f_copy: add from, r2 pld [from, #-32] @@ -319,7 +327,7 @@ cs_b2f_copy: .align 3 cs_b2f_loop_32: subs r2, #32 - blt cs_b2f_loop_32_finish + blt cs_b2f_loop_32_finish ldmdb from!, {r3-r9,ip} nop pld [from, #-32] @@ -359,16 +367,16 @@ cs_b2f_all_copy: strgth r5, [to, #-2]! b conjoint_shorts_finish - # Destination not aligned + # Destination not aligned cs_b2f_dest_u: ldrh r3, [from, #-2]! strh r3, [to, #-2]! sub r2, #2 - # Check source alignment as well + # Check source alignment as well ands r3, from, #3 beq cs_b2f_loop_32 - # Source not aligned + # Source not aligned cs_b2f_src_u: bic from, #3 .align 3 @@ -393,7 +401,7 @@ cs_b2f_16_loop_u: cs_b2f_16_loop_u_finished: addlts r2, #16 ldr r3, [from] - cmp r2, #10 + cmp r2, #10 blt cs_b2f_2_u_loop ldmdb from!, {r4 - r5} mov r6, r4, lsr #16 @@ -402,7 +410,7 @@ cs_b2f_16_loop_u_finished: orr r7, r7, r3, lsl #16 stmdb to!, {r6-r7} sub r2, #8 - .align 3 + .align 3 cs_b2f_2_u_loop: subs r2, #2 ldrh r3, [from], #-2 @@ -426,7 +434,7 @@ _Copy_arrayof_conjoint_jshorts: _Copy_conjoint_jints_atomic: _Copy_arrayof_conjoint_jints: swi 0x9f0001 - + # Support for void Copy::conjoint_jlongs_atomic(jlong* from, # jlong* to, # size_t count) @@ -434,8 +442,8 @@ _Copy_conjoint_jlongs_atomic: _Copy_arrayof_conjoint_jlongs: stmdb sp!, {r3 - r9, ip} - cmp r2, #0 - beq conjoint_longs_finish + cmp r2, #0 + beq conjoint_longs_finish pld [from, #0] cmp r2, #24 @@ -447,10 +455,10 @@ _Copy_arrayof_conjoint_jlongs: .align 3 cl_f2b_loop_32: subs r2, #32 - blt cl_f2b_loop_32_finish + blt cl_f2b_loop_32_finish ldmia from!, {r3 - r9, ip} nop - pld [from] + pld [from] stmia to!, {r3 - r9, ip} bgt cl_f2b_loop_32 cl_f2b_loop_32_finish: @@ -458,21 +466,21 @@ cl_f2b_loop_32_finish: beq conjoint_longs_finish conjoint_longs_small: cmp r2, #16 - blt cl_f2b_copy_8 - bgt cl_f2b_copy_24 + blt cl_f2b_copy_8 + bgt cl_f2b_copy_24 ldmia from!, {r3 - r6} stmia to!, {r3 - r6} - b conjoint_longs_finish + b conjoint_longs_finish cl_f2b_copy_8: ldmia from!, {r3 - r4} stmia to!, {r3 - r4} b conjoint_longs_finish cl_f2b_copy_24: - ldmia from!, {r3 - r8} + ldmia from!, {r3 - r8} stmia to!, {r3 - r8} b conjoint_longs_finish - # Src and dest overlap, copy in a descending order + # Src and dest overlap, copy in a descending order cl_b2f_copy: add from, r2 pld [from, #-32] @@ -480,31 +488,29 @@ cl_b2f_copy: .align 3 cl_b2f_loop_32: subs r2, #32 - blt cl_b2f_loop_32_finish + blt cl_b2f_loop_32_finish ldmdb from!, {r3 - r9, ip} nop - pld [from] + pld [from] stmdb to!, {r3 - r9, ip} bgt cl_b2f_loop_32 cl_b2f_loop_32_finish: addlts r2, #32 beq conjoint_longs_finish cmp r2, #16 - blt cl_b2f_copy_8 - bgt cl_b2f_copy_24 + blt cl_b2f_copy_8 + bgt cl_b2f_copy_24 ldmdb from!, {r3 - r6} stmdb to!, {r3 - r6} b conjoint_longs_finish cl_b2f_copy_8: - ldmdb from!, {r3 - r4} + ldmdb from!, {r3 - r4} stmdb to!, {r3 - r4} b conjoint_longs_finish cl_b2f_copy_24: - ldmdb from!, {r3 - r8} + ldmdb from!, {r3 - r8} stmdb to!, {r3 - r8} conjoint_longs_finish: ldmia sp!, {r3 - r9, ip} bx lr - - diff --git a/src/hotspot/os_cpu/linux_arm/safefetch_linux_arm.S b/src/hotspot/os_cpu/linux_arm/safefetch_linux_arm.S index 5196b199f05..07e90fa3079 100644 --- a/src/hotspot/os_cpu/linux_arm/safefetch_linux_arm.S +++ b/src/hotspot/os_cpu/linux_arm/safefetch_linux_arm.S @@ -1,6 +1,6 @@ /* * Copyright (c) 2022 SAP SE. All rights reserved. - * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,6 +26,11 @@ .globl SafeFetch32_impl .globl _SafeFetch32_fault .globl _SafeFetch32_continuation + + .hidden SafeFetch32_impl + .hidden _SafeFetch32_fault + .hidden _SafeFetch32_continuation + .type SafeFetch32_impl, %function # Support for int SafeFetch32(int* address, int defaultval); diff --git a/src/hotspot/os_cpu/linux_ppc/safefetch_linux_ppc.S b/src/hotspot/os_cpu/linux_ppc/safefetch_linux_ppc.S index c8d20cc1b43..8c96edf01b4 100644 --- a/src/hotspot/os_cpu/linux_ppc/safefetch_linux_ppc.S +++ b/src/hotspot/os_cpu/linux_ppc/safefetch_linux_ppc.S @@ -1,6 +1,6 @@ /* * Copyright (c) 2022 SAP SE. All rights reserved. - * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -30,6 +30,13 @@ .globl _SafeFetch32_fault .globl _SafeFetch32_continuation + .hidden SafeFetchN_impl + .hidden _SafeFetchN_fault + .hidden _SafeFetchN_continuation + .hidden SafeFetch32_impl + .hidden _SafeFetch32_fault + .hidden _SafeFetch32_continuation + # Support for int SafeFetch32(int* address, int defaultval); # # r3 : address diff --git a/src/hotspot/os_cpu/linux_riscv/safefetch_linux_riscv.S b/src/hotspot/os_cpu/linux_riscv/safefetch_linux_riscv.S index ecf0bac6f9e..150df7567bd 100644 --- a/src/hotspot/os_cpu/linux_riscv/safefetch_linux_riscv.S +++ b/src/hotspot/os_cpu/linux_riscv/safefetch_linux_riscv.S @@ -1,6 +1,6 @@ /* * Copyright (c) 2022 SAP SE. All rights reserved. - * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -30,6 +30,13 @@ .globl _SafeFetch32_fault .globl _SafeFetch32_continuation + .hidden SafeFetchN_impl + .hidden _SafeFetchN_fault + .hidden _SafeFetchN_continuation + .hidden SafeFetch32_impl + .hidden _SafeFetch32_fault + .hidden _SafeFetch32_continuation + # Support for int SafeFetch32(int* address, int defaultval); # # x10 (a0) : address diff --git a/src/hotspot/os_cpu/linux_s390/safefetch_linux_s390.S b/src/hotspot/os_cpu/linux_s390/safefetch_linux_s390.S index 47fe82f5a27..43d50c798e5 100644 --- a/src/hotspot/os_cpu/linux_s390/safefetch_linux_s390.S +++ b/src/hotspot/os_cpu/linux_s390/safefetch_linux_s390.S @@ -1,6 +1,6 @@ /* * Copyright (c) 2022 SAP SE. All rights reserved. - * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -30,6 +30,13 @@ .globl _SafeFetch32_fault .globl _SafeFetch32_continuation + .hidden SafeFetchN_impl + .hidden _SafeFetchN_fault + .hidden _SafeFetchN_continuation + .hidden SafeFetch32_impl + .hidden _SafeFetch32_fault + .hidden _SafeFetch32_continuation + # Support for int SafeFetch32(int* address, int defaultval); # # r2 : address diff --git a/src/hotspot/os_cpu/linux_x86/linux_x86_32.S b/src/hotspot/os_cpu/linux_x86/linux_x86_32.S index 344358172de..e23cd2b9164 100644 --- a/src/hotspot/os_cpu/linux_x86/linux_x86_32.S +++ b/src/hotspot/os_cpu/linux_x86/linux_x86_32.S @@ -1,5 +1,5 @@ # -# Copyright (c) 2004, 2022, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. # 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,28 +21,41 @@ # questions. # + .globl SpinPause # NOTE WELL! The _Copy functions are called directly - # from server-compiler-generated code via CallLeafNoFP, - # which means that they *must* either not use floating - # point or use it in the same manner as does the server - # compiler. + # from server-compiler-generated code via CallLeafNoFP, + # which means that they *must* either not use floating + # point or use it in the same manner as does the server + # compiler. .globl _Copy_arrayof_conjoint_bytes .globl _Copy_conjoint_jshorts_atomic - .globl _Copy_arrayof_conjoint_jshorts + .globl _Copy_arrayof_conjoint_jshorts .globl _Copy_conjoint_jints_atomic .globl _Copy_arrayof_conjoint_jints - .globl _Copy_conjoint_jlongs_atomic - .globl _mmx_Copy_arrayof_conjoint_jshorts + .globl _Copy_conjoint_jlongs_atomic + .globl _mmx_Copy_arrayof_conjoint_jshorts .globl _Atomic_cmpxchg_long .globl _Atomic_move_long - .text + .hidden SpinPause - .globl SpinPause - .type SpinPause,@function + .hidden _Copy_arrayof_conjoint_bytes + .hidden _Copy_conjoint_jshorts_atomic + .hidden _Copy_arrayof_conjoint_jshorts + .hidden _Copy_conjoint_jints_atomic + .hidden _Copy_arrayof_conjoint_jints + .hidden _Copy_conjoint_jlongs_atomic + .hidden _mmx_Copy_arrayof_conjoint_jshorts + + .hidden _Atomic_cmpxchg_long + .hidden _Atomic_move_long + + .text + + .type SpinPause,@function .p2align 4,,15 SpinPause: rep @@ -55,7 +68,7 @@ SpinPause: # size_t count) # .p2align 4,,15 - .type _Copy_arrayof_conjoint_bytes,@function + .type _Copy_arrayof_conjoint_bytes,@function _Copy_arrayof_conjoint_bytes: pushl %esi movl 4+12(%esp),%ecx # count @@ -115,7 +128,7 @@ acb_CopyLeft: jbe 2f # <= 32 dwords rep; smovl jmp 4f - .space 8 + .space 8 2: subl %esi,%edi .p2align 4,,15 3: movl (%esi),%edx @@ -131,7 +144,7 @@ acb_CopyLeft: addl $3,%esi 6: movb (%esi),%dl movb %dl,(%edi,%esi,1) - subl $1,%esi + subl $1,%esi subl $1,%ecx jnz 6b 7: cld @@ -143,7 +156,7 @@ acb_CopyLeft: # void* to, # size_t count) .p2align 4,,15 - .type _Copy_conjoint_jshorts_atomic,@function + .type _Copy_conjoint_jshorts_atomic,@function _Copy_conjoint_jshorts_atomic: pushl %esi movl 4+12(%esp),%ecx # count @@ -230,7 +243,7 @@ cs_CopyLeft: # void* to, # size_t count) .p2align 4,,15 - .type _Copy_arrayof_conjoint_jshorts,@function + .type _Copy_arrayof_conjoint_jshorts,@function _Copy_arrayof_conjoint_jshorts: pushl %esi movl 4+12(%esp),%ecx # count @@ -307,8 +320,8 @@ acs_CopyLeft: # Equivalent to # arrayof_conjoint_jints .p2align 4,,15 - .type _Copy_conjoint_jints_atomic,@function - .type _Copy_arrayof_conjoint_jints,@function + .type _Copy_conjoint_jints_atomic,@function + .type _Copy_arrayof_conjoint_jints,@function _Copy_conjoint_jints_atomic: _Copy_arrayof_conjoint_jints: pushl %esi @@ -384,7 +397,7 @@ ci_CopyLeft: # } */ .p2align 4,,15 - .type _Copy_conjoint_jlongs_atomic,@function + .type _Copy_conjoint_jlongs_atomic,@function _Copy_conjoint_jlongs_atomic: movl 4+8(%esp),%ecx # count movl 4+0(%esp),%eax # from @@ -413,7 +426,7 @@ cla_CopyLeft: # void* to, # size_t count) .p2align 4,,15 - .type _mmx_Copy_arrayof_conjoint_jshorts,@function + .type _mmx_Copy_arrayof_conjoint_jshorts,@function _mmx_Copy_arrayof_conjoint_jshorts: pushl %esi movl 4+12(%esp),%ecx @@ -465,8 +478,8 @@ mmx_acs_CopyRight: cmpl $16,%ecx jge 4b emms - testl %ecx,%ecx - ja 1b + testl %ecx,%ecx + ja 1b 5: andl $1,%eax je 7f 6: movw (%esi),%dx @@ -511,7 +524,7 @@ mmx_acs_CopyLeft: # jlong exchange_value) # .p2align 4,,15 - .type _Atomic_cmpxchg_long,@function + .type _Atomic_cmpxchg_long,@function _Atomic_cmpxchg_long: # 8(%esp) : return PC pushl %ebx # 4(%esp) : old %ebx @@ -530,7 +543,7 @@ _Atomic_cmpxchg_long: # Support for jlong Atomic::load and Atomic::store. # void _Atomic_move_long(const volatile jlong* src, volatile jlong* dst) .p2align 4,,15 - .type _Atomic_move_long,@function + .type _Atomic_move_long,@function _Atomic_move_long: movl 4(%esp), %eax # src fildll (%eax) diff --git a/src/hotspot/os_cpu/linux_x86/linux_x86_64.S b/src/hotspot/os_cpu/linux_x86/linux_x86_64.S index 89d98cb5837..65580a194af 100644 --- a/src/hotspot/os_cpu/linux_x86/linux_x86_64.S +++ b/src/hotspot/os_cpu/linux_x86/linux_x86_64.S @@ -1,5 +1,5 @@ -# -# Copyright (c) 2004, 2013, Oracle and/or its affiliates. All rights reserved. +# +# Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. # 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,24 +21,34 @@ # questions. # + .globl SpinPause # NOTE WELL! The _Copy functions are called directly - # from server-compiler-generated code via CallLeafNoFP, - # which means that they *must* either not use floating - # point or use it in the same manner as does the server - # compiler. - + # from server-compiler-generated code via CallLeafNoFP, + # which means that they *must* either not use floating + # point or use it in the same manner as does the server + # compiler. + .globl _Copy_arrayof_conjoint_bytes - .globl _Copy_arrayof_conjoint_jshorts + .globl _Copy_arrayof_conjoint_jshorts .globl _Copy_conjoint_jshorts_atomic .globl _Copy_arrayof_conjoint_jints .globl _Copy_conjoint_jints_atomic .globl _Copy_arrayof_conjoint_jlongs .globl _Copy_conjoint_jlongs_atomic - .text + .hidden SpinPause + + .hidden _Copy_arrayof_conjoint_bytes + .hidden _Copy_arrayof_conjoint_jshorts + .hidden _Copy_conjoint_jshorts_atomic + .hidden _Copy_arrayof_conjoint_jints + .hidden _Copy_conjoint_jints_atomic + .hidden _Copy_arrayof_conjoint_jlongs + .hidden _Copy_conjoint_jlongs_atomic + + .text - .globl SpinPause .align 16 .type SpinPause,@function SpinPause: @@ -55,7 +65,7 @@ SpinPause: # rdx - count, treated as ssize_t # .p2align 4,,15 - .type _Copy_arrayof_conjoint_bytes,@function + .type _Copy_arrayof_conjoint_bytes,@function _Copy_arrayof_conjoint_bytes: movq %rdx,%r8 # byte count shrq $3,%rdx # qword count @@ -63,7 +73,7 @@ _Copy_arrayof_conjoint_bytes: leaq -1(%rdi,%r8,1),%rax # from + bcount*1 - 1 jbe acb_CopyRight cmpq %rax,%rsi - jbe acb_CopyLeft + jbe acb_CopyLeft acb_CopyRight: leaq -8(%rdi,%rdx,8),%rax # from + qcount*8 - 8 leaq -8(%rsi,%rdx,8),%rcx # to + qcount*8 - 8 @@ -157,8 +167,8 @@ acb_CopyLeft: # rdx - count, treated as ssize_t # .p2align 4,,15 - .type _Copy_arrayof_conjoint_jshorts,@function - .type _Copy_conjoint_jshorts_atomic,@function + .type _Copy_arrayof_conjoint_jshorts,@function + .type _Copy_conjoint_jshorts_atomic,@function _Copy_arrayof_conjoint_jshorts: _Copy_conjoint_jshorts_atomic: movq %rdx,%r8 # word count @@ -167,7 +177,7 @@ _Copy_conjoint_jshorts_atomic: leaq -2(%rdi,%r8,2),%rax # from + wcount*2 - 2 jbe acs_CopyRight cmpq %rax,%rsi - jbe acs_CopyLeft + jbe acs_CopyLeft acs_CopyRight: leaq -8(%rdi,%rdx,8),%rax # from + qcount*8 - 8 leaq -8(%rsi,%rdx,8),%rcx # to + qcount*8 - 8 @@ -247,8 +257,8 @@ acs_CopyLeft: # rdx - count, treated as ssize_t # .p2align 4,,15 - .type _Copy_arrayof_conjoint_jints,@function - .type _Copy_conjoint_jints_atomic,@function + .type _Copy_arrayof_conjoint_jints,@function + .type _Copy_conjoint_jints_atomic,@function _Copy_arrayof_conjoint_jints: _Copy_conjoint_jints_atomic: movq %rdx,%r8 # dword count @@ -257,7 +267,7 @@ _Copy_conjoint_jints_atomic: leaq -4(%rdi,%r8,4),%rax # from + dcount*4 - 4 jbe aci_CopyRight cmpq %rax,%rsi - jbe aci_CopyLeft + jbe aci_CopyLeft aci_CopyRight: leaq -8(%rdi,%rdx,8),%rax # from + qcount*8 - 8 leaq -8(%rsi,%rdx,8),%rcx # to + qcount*8 - 8 @@ -326,15 +336,15 @@ aci_CopyLeft: # rdx - count, treated as ssize_t # .p2align 4,,15 - .type _Copy_arrayof_conjoint_jlongs,@function - .type _Copy_conjoint_jlongs_atomic,@function + .type _Copy_arrayof_conjoint_jlongs,@function + .type _Copy_conjoint_jlongs_atomic,@function _Copy_arrayof_conjoint_jlongs: _Copy_conjoint_jlongs_atomic: cmpq %rdi,%rsi leaq -8(%rdi,%rdx,8),%rax # from + count*8 - 8 jbe acl_CopyRight cmpq %rax,%rsi - jbe acl_CopyLeft + jbe acl_CopyLeft acl_CopyRight: leaq -8(%rsi,%rdx,8),%rcx # to + count*8 - 8 negq %rdx diff --git a/src/hotspot/os_cpu/linux_x86/safefetch_linux_x86_32.S b/src/hotspot/os_cpu/linux_x86/safefetch_linux_x86_32.S index 492b1207db6..54775cb7e8e 100644 --- a/src/hotspot/os_cpu/linux_x86/safefetch_linux_x86_32.S +++ b/src/hotspot/os_cpu/linux_x86/safefetch_linux_x86_32.S @@ -1,6 +1,6 @@ # # Copyright (c) 2022 SAP SE. All rights reserved. -# Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -25,7 +25,11 @@ .globl _SafeFetch32_fault .globl _SafeFetch32_continuation - .text + .hidden SafeFetch32_impl + .hidden _SafeFetch32_fault + .hidden _SafeFetch32_continuation + + .text # Support for int SafeFetch32(int* address, int defaultval); # diff --git a/src/hotspot/os_cpu/linux_x86/safefetch_linux_x86_64.S b/src/hotspot/os_cpu/linux_x86/safefetch_linux_x86_64.S index 617851e8327..1937e717088 100644 --- a/src/hotspot/os_cpu/linux_x86/safefetch_linux_x86_64.S +++ b/src/hotspot/os_cpu/linux_x86/safefetch_linux_x86_64.S @@ -1,6 +1,6 @@ # # Copyright (c) 2022 SAP SE. All rights reserved. -# Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -28,7 +28,14 @@ .globl _SafeFetch32_continuation .globl _SafeFetchN_continuation - .text + .hidden SafeFetch32_impl + .hidden SafeFetchN_impl + .hidden _SafeFetch32_fault + .hidden _SafeFetchN_fault + .hidden _SafeFetch32_continuation + .hidden _SafeFetchN_continuation + + .text # Support for int SafeFetch32(int* address, int defaultval); diff --git a/src/hotspot/share/adlc/archDesc.cpp b/src/hotspot/share/adlc/archDesc.cpp index d27bf086560..93fa7451dc0 100644 --- a/src/hotspot/share/adlc/archDesc.cpp +++ b/src/hotspot/share/adlc/archDesc.cpp @@ -1,5 +1,5 @@ // -// Copyright (c) 1997, 2023, Oracle and/or its affiliates. All rights reserved. +// Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. // DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. // // This code is free software; you can redistribute it and/or modify it @@ -24,6 +24,7 @@ // archDesc.cpp - Internal format for architecture definition +#include #include "adlc.hpp" static FILE *errfile = stderr; @@ -684,6 +685,98 @@ bool ArchDesc::verify() { return true; } +class MarkUsageFormClosure : public FormClosure { +private: + ArchDesc* _ad; + std::unordered_set *_visited; + +public: + MarkUsageFormClosure(ArchDesc* ad, std::unordered_set *visit_map) { + _ad = ad; + _visited = visit_map; + } + virtual ~MarkUsageFormClosure() = default; + + virtual void do_form(Form *form) { + if (_visited->find(form) == _visited->end()) { + _visited->insert(form); + form->forms_do(this); + } + } + + virtual void do_form_by_name(const char* name) { + const Form* form = _ad->globalNames()[name]; + if (form) { + do_form(const_cast(form)); + return; + } + RegisterForm* regs = _ad->get_registers(); + if (regs->getRegClass(name)) { + do_form(regs->getRegClass(name)); + return; + } + } +}; + +// check unused operands +bool ArchDesc::check_usage() { + std::unordered_set visited; + MarkUsageFormClosure callback(this, &visited); + _instructions.reset(); + // iterate all instruction to mark used form + InstructForm* instr; + for ( ; (instr = (InstructForm*)_instructions.iter()) != nullptr; ) { + callback.do_form(instr); + } + + // these forms are coded in OperandForm::is_user_name_for_sReg + // it may happen no instruction use these operands, like stackSlotP in aarch64, + // but we can not desclare they are useless. + callback.do_form_by_name("stackSlotI"); + callback.do_form_by_name("stackSlotP"); + callback.do_form_by_name("stackSlotD"); + callback.do_form_by_name("stackSlotF"); + callback.do_form_by_name("stackSlotL"); + + // sReg* are initial created by adlc in ArchDesc::initBaseOpTypes() + // In ARM, no definition or usage in adfile, but they are reported as unused + callback.do_form_by_name("sRegI"); + callback.do_form_by_name("sRegP"); + callback.do_form_by_name("sRegD"); + callback.do_form_by_name("sRegF"); + callback.do_form_by_name("sRegL"); + + // special generic vector operands only used in Matcher::pd_specialize_generic_vector_operand +#if defined(AARCH64) + callback.do_form_by_name("vecA"); + callback.do_form_by_name("vecD"); + callback.do_form_by_name("vecX"); +#elif defined(AMD64) + callback.do_form_by_name("vecS"); + callback.do_form_by_name("vecD"); + callback.do_form_by_name("vecX"); + callback.do_form_by_name("vecY"); + callback.do_form_by_name("vecZ"); + callback.do_form_by_name("legVecS"); + callback.do_form_by_name("legVecD"); + callback.do_form_by_name("legVecX"); + callback.do_form_by_name("legVecY"); + callback.do_form_by_name("legVecZ"); +#endif + + int cnt = 0; + _operands.reset(); + OperandForm* operand; + for ( ; (operand = (OperandForm*)_operands.iter()) != nullptr; ) { + if(visited.find(operand) == visited.end() && !operand->ideal_only()) { + fprintf(stderr, "\nWarning: unused operand (%s)", operand->_ident); + cnt++; + } + } + if (cnt) fprintf(stderr, "\n-------Warning: total %d unused operands\n", cnt); + + return true; +} void ArchDesc::dump() { _pre_header.dump(); diff --git a/src/hotspot/share/adlc/archDesc.hpp b/src/hotspot/share/adlc/archDesc.hpp index 42369f6c2d1..99e4947e110 100644 --- a/src/hotspot/share/adlc/archDesc.hpp +++ b/src/hotspot/share/adlc/archDesc.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -226,6 +226,7 @@ class ArchDesc { inline void getForm(EncodeForm **ptr) { *ptr = _encode; } bool verify(); + bool check_usage(); void dump(); // Helper utility that gets MatchList components from inside MatchRule diff --git a/src/hotspot/share/adlc/forms.cpp b/src/hotspot/share/adlc/forms.cpp index fd8e5c4fd50..068d745254e 100644 --- a/src/hotspot/share/adlc/forms.cpp +++ b/src/hotspot/share/adlc/forms.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -362,6 +362,15 @@ void FormDict::dump() { _form.print(dumpkey, dumpform); } +void FormDict::forms_do(FormClosure* f) {; + DictI iter(&_form); + for( ; iter.test(); ++iter ) { + Form* form = (Form*) iter._value; + assert(form != nullptr, "sanity"); + f->do_form(form); + } +} + //------------------------------SourceForm------------------------------------- SourceForm::SourceForm(char* code) : _code(code) { }; // Constructor SourceForm::~SourceForm() { @@ -374,3 +383,11 @@ void SourceForm::dump() { // Debug printer void SourceForm::output(FILE *fp) { fprintf(fp,"\n//%s\n%s\n",classname(),(_code?_code:"")); } + +void FormClosure::do_form(Form* form) { + assert(false, "should not reach here"); +} + +void FormClosure::do_form_by_name(const char* name) { + assert(false, "should not reach here"); +} diff --git a/src/hotspot/share/adlc/forms.hpp b/src/hotspot/share/adlc/forms.hpp index c3dd85eb98b..a82b9bbb338 100644 --- a/src/hotspot/share/adlc/forms.hpp +++ b/src/hotspot/share/adlc/forms.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -58,6 +58,7 @@ class Flag; class RewriteRule; class ConstructRule; class FormatRule; +class FormClosure; class Peephole; class EncClass; class Interface; @@ -114,6 +115,8 @@ class FormDict { const Form *operator [](const char *name) const; // Do a lookup void dump(); + // iterate child forms recursively + void forms_do(FormClosure *f); }; // ***** Master Class for ADL Parser Forms ***** @@ -163,6 +166,9 @@ class Form { // Write info to output files virtual void output(FILE *fp) { fprintf(fp,"Form Output"); } + // iterate child forms recursively + virtual void forms_do (FormClosure* f) { return; } + public: // ADLC types, match the last character on ideal operands and instructions enum DataType { @@ -255,6 +261,16 @@ class Form { }; +class FormClosure { +public: + FormClosure() = default; + virtual ~FormClosure() = default; + + virtual void do_form(Form* form); + virtual void do_form_by_name(const char* name); +}; + + //------------------------------FormList--------------------------------------- class FormList { private: diff --git a/src/hotspot/share/adlc/formsopt.cpp b/src/hotspot/share/adlc/formsopt.cpp index 13d29ef3947..e1e4ed96c2e 100644 --- a/src/hotspot/share/adlc/formsopt.cpp +++ b/src/hotspot/share/adlc/formsopt.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -198,6 +198,20 @@ void RegisterForm::output(FILE *fp) { // Write info to output files fprintf(fp,"-------------------- end RegisterForm --------------------\n"); } +void RegisterForm::forms_do(FormClosure *f) { + const char *name = nullptr; + if (_current_ac) f->do_form(_current_ac); + for(_rdefs.reset(); (name = _rdefs.iter()) != nullptr;) { + f->do_form((RegDef*)_regDef[name]); + } + for (_rclasses.reset(); (name = _rclasses.iter()) != nullptr;) { + f->do_form((RegClass*)_regClass[name]); + } + for (_aclasses.reset(); (name = _aclasses.iter()) != nullptr;) { + f->do_form((AllocClass*)_allocClass[name]); + } +} + //------------------------------RegDef----------------------------------------- // Constructor RegDef::RegDef(char *regname, char *callconv, char *c_conv, char * idealtype, char * encode, char * concrete) @@ -322,6 +336,13 @@ void RegClass::output(FILE *fp) { // Write info to output files fprintf(fp,"--- done with entries for reg_class %s\n\n",_classid); } +void RegClass::forms_do(FormClosure *f) { + const char *name = nullptr; + for( _regDefs.reset(); (name = _regDefs.iter()) != nullptr; ) { + f->do_form((RegDef*)_regDef[name]); + } +} + void RegClass::declare_register_masks(FILE* fp) { const char* prefix = ""; const char* rc_name_to_upper = toUpper(_classid); @@ -436,6 +457,14 @@ void AllocClass::output(FILE *fp) { // Write info to output files fprintf(fp,"--- done with entries for alloc_class %s\n\n",_classid); } +void AllocClass::forms_do(FormClosure* f) { + const char *name; + for(_regDefs.reset(); (name = _regDefs.iter()) != nullptr;) { + f->do_form((RegDef*)_regDef[name]); + } + return; +} + //==============================Frame Handling================================= //------------------------------FrameForm-------------------------------------- FrameForm::FrameForm() { @@ -706,6 +735,15 @@ void Peephole::output(FILE *fp) { // Write info to output files if( _next ) _next->output(fp); } +void Peephole::forms_do(FormClosure *f) { + if (_predicate) f->do_form(_predicate); + if (_match) f->do_form(_match); + if (_procedure) f->do_form(_procedure); + if (_constraint) f->do_form(_constraint); + if (_replace) f->do_form(_replace); + return; +} + //----------------------------PeepPredicate------------------------------------ PeepPredicate::PeepPredicate(const char* rule) : _rule(rule) { } diff --git a/src/hotspot/share/adlc/formsopt.hpp b/src/hotspot/share/adlc/formsopt.hpp index 1a2b5dadd30..d183a46b875 100644 --- a/src/hotspot/share/adlc/formsopt.hpp +++ b/src/hotspot/share/adlc/formsopt.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -123,6 +123,7 @@ class RegisterForm : public Form { void dump(); // Debug printer void output(FILE *fp); // Write info to output files + virtual void forms_do(FormClosure* f); }; //------------------------------RegDef----------------------------------------- @@ -199,6 +200,7 @@ class RegClass : public Form { void dump(); // Debug printer void output(FILE *fp); // Write info to output files + virtual void forms_do(FormClosure* f); virtual bool has_stack_version() { return _stack_or_reg; @@ -305,6 +307,11 @@ class ConditionalRegClass : public RegClass { char* condition_code() { return _condition_code; } + + virtual void forms_do(FormClosure* f) { + if (_rclasses[0]) f->do_form(_rclasses[0]); + if (_rclasses[1]) f->do_form(_rclasses[1]); + } }; //------------------------------AllocClass------------------------------------- @@ -325,6 +332,7 @@ class AllocClass : public Form { void dump(); // Debug printer void output(FILE *fp); // Write info to output files + virtual void forms_do(FormClosure* f); }; @@ -568,6 +576,7 @@ class Peephole : public Form { void dump(); // Debug printer void output(FILE *fp); // Write info to output files + virtual void forms_do(FormClosure* f); }; class PeepPredicate : public Form { diff --git a/src/hotspot/share/adlc/formssel.cpp b/src/hotspot/share/adlc/formssel.cpp index d2aa573cecd..34284697444 100644 --- a/src/hotspot/share/adlc/formssel.cpp +++ b/src/hotspot/share/adlc/formssel.cpp @@ -1499,6 +1499,24 @@ void InstructForm::output(FILE *fp) { if (_peephole) _peephole->output(fp); } +void InstructForm::forms_do(FormClosure *f) { + if (_cisc_spill_alternate) f->do_form(_cisc_spill_alternate); + if (_short_branch_form) f->do_form(_short_branch_form); + _localNames.forms_do(f); + if (_matrule) f->do_form(_matrule); + if (_opcode) f->do_form(_opcode); + if (_insencode) f->do_form(_insencode); + if (_constant) f->do_form(_constant); + if (_attribs) f->do_form(_attribs); + if (_predicate) f->do_form(_predicate); + _effects.forms_do(f); + if (_exprule) f->do_form(_exprule); + if (_rewrule) f->do_form(_rewrule); + if (_format) f->do_form(_format); + if (_peephole) f->do_form(_peephole); + assert(_components.count() == 0, "skip components"); +} + void MachNodeForm::dump() { output(stderr); } @@ -1616,6 +1634,14 @@ void EncodeForm::output(FILE *fp) { // Write info to output files } fprintf(fp,"-------------------- end EncodeForm --------------------\n"); } + +void EncodeForm::forms_do(FormClosure* f) { + const char *name; + for (_eclasses.reset(); (name = _eclasses.iter()) != nullptr;) { + f->do_form((EncClass*)_encClass[name]); + } +} + //------------------------------EncClass--------------------------------------- EncClass::EncClass(const char *name) : _localNames(cmpstr,hashstr, Form::arena), _name(name) { @@ -1706,6 +1732,15 @@ void EncClass::output(FILE *fp) { } +void EncClass::forms_do(FormClosure *f) { + _parameter_type.reset(); + const char *type = _parameter_type.iter(); + for ( ; type != nullptr ; type = _parameter_type.iter() ) { + f->do_form_by_name(type); + } + _localNames.forms_do(f); +} + //------------------------------Opcode----------------------------------------- Opcode::Opcode(char *primary, char *secondary, char *tertiary) : _primary(primary), _secondary(secondary), _tertiary(tertiary) { @@ -1836,6 +1871,15 @@ void InsEncode::output(FILE *fp) { fprintf(fp,"\n"); } +void InsEncode::forms_do(FormClosure *f) { + _encoding.reset(); + NameAndList *encoding = (NameAndList*)_encoding.iter(); + for( ; encoding != nullptr; encoding = (NameAndList*)_encoding.iter() ) { + // just check name, other operands will be checked as instruction parameters + f->do_form_by_name(encoding->name()); + } +} + //------------------------------Effect----------------------------------------- static int effect_lookup(const char *name) { if (!strcmp(name, "USE")) return Component::USE; @@ -1969,6 +2013,19 @@ void ExpandRule::output(FILE *fp) { // Write info to output files } } +void ExpandRule::forms_do(FormClosure *f) { + NameAndList *expand_instr = nullptr; + // Iterate over the instructions 'node' expands into + for(reset_instructions(); (expand_instr = iter_instructions()) != nullptr; ) { + f->do_form_by_name(expand_instr->name()); + } + _newopers.reset(); + const char* oper = _newopers.iter(); + for(; oper != nullptr; oper = _newopers.iter()) { + f->do_form_by_name(oper); + } +} + //------------------------------RewriteRule------------------------------------ RewriteRule::RewriteRule(char* params, char* block) : _tempParams(params), _tempBlock(block) { }; // Constructor @@ -1985,6 +2042,12 @@ void RewriteRule::output(FILE *fp) { // Write info to output files (_tempBlock?_tempBlock:"")); } +void RewriteRule::forms_do(FormClosure *f) { + if (_condition) f->do_form(_condition); + if (_instrs) f->do_form(_instrs); + if (_opers) f->do_form(_opers); +} + //==============================MachNodes====================================== //------------------------------MachNodeForm----------------------------------- @@ -2067,6 +2130,13 @@ void OpClassForm::output(FILE *fp) { fprintf(fp,"\n"); } +void OpClassForm::forms_do(FormClosure* f) { + const char *name; + for(_oplst.reset(); (name = _oplst.iter()) != nullptr;) { + f->do_form_by_name(name); + } +} + //==============================Operands======================================= //------------------------------OperandForm------------------------------------ @@ -2692,6 +2762,22 @@ void OperandForm::output(FILE *fp) { if (_format) _format->dump(); } +void OperandForm::forms_do(FormClosure* f) { + if (_matrule) f->do_form(_matrule); + if (_interface) f->do_form(_interface); + if (_attribs) f->do_form(_attribs); + if (_predicate) f->do_form(_predicate); + if (_constraint) f->do_form(_constraint); + if (_construct) f->do_form(_construct); + if (_format) f->do_form(_format); + _localNames.forms_do(f); + const char* opclass = nullptr; + for ( _classes.reset(); (opclass = _classes.iter()) != nullptr; ) { + f->do_form_by_name(opclass); + } + assert(_components.count() == 0, "skip _compnets"); +} + //------------------------------Constraint------------------------------------- Constraint::Constraint(const char *func, const char *arg) : _func(func), _arg(arg) { @@ -2713,6 +2799,10 @@ void Constraint::output(FILE *fp) { // Write info to output files fprintf(fp,"Constraint: %s ( %s )\n", _func, _arg); } +void Constraint::forms_do(FormClosure *f) { + f->do_form_by_name(_arg); +} + //------------------------------Predicate-------------------------------------- Predicate::Predicate(char *pr) : _pred(pr) { @@ -3540,6 +3630,12 @@ void MatchNode::output(FILE *fp) { } } +void MatchNode::forms_do(FormClosure *f) { + f->do_form_by_name(_name); + if (_lChild) f->do_form(_lChild); + if (_rChild) f->do_form(_rChild); +} + int MatchNode::needs_ideal_memory_edge(FormDict &globals) const { static const char *needs_ideal_memory_list[] = { "StoreI","StoreL","StoreP","StoreN","StoreNKlass","StoreD","StoreF" , @@ -3609,6 +3705,7 @@ int InstructForm::needs_base_oop_edge(FormDict &globals) const { } + //-------------------------cisc spilling methods------------------------------- // helper routines and methods for detecting cisc-spilling instructions //-------------------------cisc_spill_merge------------------------------------ @@ -4335,6 +4432,18 @@ void MatchRule::output(FILE *fp) { fprintf(fp,"\n"); } +void MatchRule::forms_do(FormClosure* f) { + // keep sync with MatchNode::forms_do + f->do_form_by_name(_name); + if (_lChild) f->do_form(_lChild); + if (_rChild) f->do_form(_rChild); + + // handle next rule + if (_next) { + f->do_form(_next); + } +} + //------------------------------Attribute-------------------------------------- Attribute::Attribute(char *id, char* val, int type) : _ident(id), _val(val), _atype(type) { diff --git a/src/hotspot/share/adlc/formssel.hpp b/src/hotspot/share/adlc/formssel.hpp index eabd94c323a..61d0fb40f18 100644 --- a/src/hotspot/share/adlc/formssel.hpp +++ b/src/hotspot/share/adlc/formssel.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -310,6 +310,7 @@ class InstructForm : public Form { virtual void dump(); // Debug printer virtual void output(FILE *fp); // Write to output files + virtual void forms_do(FormClosure *f); }; //------------------------------EncodeForm------------------------------------- @@ -333,6 +334,7 @@ class EncodeForm : public Form { void dump(); // Debug printer void output(FILE *fp); // Write info to output files + virtual void forms_do(FormClosure *f); }; //------------------------------EncClass--------------------------------------- @@ -377,6 +379,7 @@ class EncClass : public Form { bool verify(); void dump(); void output(FILE *fp); + virtual void forms_do(FormClosure* f); }; //------------------------------MachNode--------------------------------------- @@ -468,6 +471,7 @@ class InsEncode : public Form { void dump(); void output(FILE *fp); + virtual void forms_do(FormClosure *f); }; //------------------------------Effect----------------------------------------- @@ -515,6 +519,7 @@ class ExpandRule : public Form { void dump(); // Debug printer void output(FILE *fp); // Write info to output files + virtual void forms_do(FormClosure *f); }; //---------------------------------Flag---------------------------------------- @@ -554,6 +559,7 @@ class RewriteRule : public Form { ~RewriteRule(); // Destructor void dump(); // Debug printer void output(FILE *fp); // Write info to output files + virtual void forms_do(FormClosure* f); }; @@ -584,6 +590,7 @@ class OpClassForm : public Form { virtual bool ideal_only() const; virtual void dump(); // Debug printer virtual void output(FILE *fp); // Write to output files + virtual void forms_do(FormClosure* f); }; //------------------------------OperandForm------------------------------------ @@ -711,6 +718,7 @@ class OperandForm : public OpClassForm { virtual void dump(); // Debug printer virtual void output(FILE *fp); // Write to output files + virtual void forms_do(FormClosure* f); }; //------------------------------Constraint------------------------------------- @@ -729,6 +737,7 @@ class Constraint : public Form { void dump(); // Debug printer void output(FILE *fp); // Write info to output files + virtual void forms_do(FormClosure* f); }; //------------------------------Predicate-------------------------------------- @@ -1014,6 +1023,7 @@ class MatchNode : public Form { void dump(); void output(FILE *fp); + virtual void forms_do(FormClosure* f); }; //------------------------------MatchRule-------------------------------------- @@ -1075,6 +1085,7 @@ class MatchRule : public MatchNode { void dump(); void output_short(FILE *fp); void output(FILE *fp); + virtual void forms_do(FormClosure* f); }; //------------------------------Attribute-------------------------------------- diff --git a/src/hotspot/share/adlc/main.cpp b/src/hotspot/share/adlc/main.cpp index 6390e792600..79487a965d8 100644 --- a/src/hotspot/share/adlc/main.cpp +++ b/src/hotspot/share/adlc/main.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -186,6 +186,9 @@ int main(int argc, char *argv[]) // Verify that the results of the parse are consistent AD.verify(); + // Check defined operands are used + AD.check_usage(); + // Prepare to generate the result files: AD.generateMatchLists(); AD.identify_unique_operands(); diff --git a/src/hotspot/share/c1/c1_IR.cpp b/src/hotspot/share/c1/c1_IR.cpp index 6cbfa01709f..8c88e3e5eef 100644 --- a/src/hotspot/share/c1/c1_IR.cpp +++ b/src/hotspot/share/c1/c1_IR.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -308,22 +308,22 @@ void IR::eliminate_null_checks() { } } - -static int sort_pairs(BlockPair** a, BlockPair** b) { - if ((*a)->from() == (*b)->from()) { - return (*a)->to()->block_id() - (*b)->to()->block_id(); - } else { - return (*a)->from()->block_id() - (*b)->from()->block_id(); - } -} - - +// The functionality of this class is to insert a new block between +// the 'from' and 'to' block of a critical edge. +// It first collects the block pairs, and then processes them. +// +// Some instructions may introduce more than one edge between two blocks. +// By checking if the current 'to' block sets critical_edge_split_flag +// (all new blocks set this flag) we can avoid repeated processing. +// This is why BlockPair contains the index rather than the original 'to' block. class CriticalEdgeFinder: public BlockClosure { BlockPairList blocks; - IR* _ir; public: - CriticalEdgeFinder(IR* ir): _ir(ir) {} + CriticalEdgeFinder(IR* ir) { + ir->iterate_preorder(this); + } + void block_do(BlockBegin* bb) { BlockEnd* be = bb->end(); int nos = be->number_of_sux(); @@ -331,20 +331,22 @@ class CriticalEdgeFinder: public BlockClosure { for (int i = 0; i < nos; i++) { BlockBegin* sux = be->sux_at(i); if (sux->number_of_preds() >= 2) { - blocks.append(new BlockPair(bb, sux)); + blocks.append(new BlockPair(bb, i)); } } } } void split_edges() { - BlockPair* last_pair = nullptr; - blocks.sort(sort_pairs); for (int i = 0; i < blocks.length(); i++) { BlockPair* pair = blocks.at(i); - if (last_pair != nullptr && pair->is_same(last_pair)) continue; BlockBegin* from = pair->from(); - BlockBegin* to = pair->to(); + int index = pair->index(); + BlockBegin* to = from->end()->sux_at(index); + if (to->is_set(BlockBegin::critical_edge_split_flag)) { + // inserted + continue; + } BlockBegin* split = from->insert_block_between(to); #ifndef PRODUCT if ((PrintIR || PrintIR1) && Verbose) { @@ -352,15 +354,12 @@ class CriticalEdgeFinder: public BlockClosure { from->block_id(), to->block_id(), split->block_id()); } #endif - last_pair = pair; } } }; void IR::split_critical_edges() { CriticalEdgeFinder cef(this); - - iterate_preorder(&cef); cef.split_edges(); } diff --git a/src/hotspot/share/c1/c1_Instruction.cpp b/src/hotspot/share/c1/c1_Instruction.cpp index b32939ba639..e4f1f622e5e 100644 --- a/src/hotspot/share/c1/c1_Instruction.cpp +++ b/src/hotspot/share/c1/c1_Instruction.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -698,6 +698,8 @@ void BlockBegin::substitute_sux(BlockBegin* old_sux, BlockBegin* new_sux) { // of the inserted block, without recomputing the values of the other blocks // in the CFG. Therefore the value of "depth_first_number" in BlockBegin becomes meaningless. BlockBegin* BlockBegin::insert_block_between(BlockBegin* sux) { + assert(!sux->is_set(critical_edge_split_flag), "sanity check"); + int bci = sux->bci(); // critical edge splitting may introduce a goto after a if and array // bound check elimination may insert a predicate between the if and diff --git a/src/hotspot/share/c1/c1_Instruction.hpp b/src/hotspot/share/c1/c1_Instruction.hpp index 11a8ea0fa1a..aa3c61136e9 100644 --- a/src/hotspot/share/c1/c1_Instruction.hpp +++ b/src/hotspot/share/c1/c1_Instruction.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -2538,15 +2538,11 @@ LEAF(MemBar, Instruction) class BlockPair: public CompilationResourceObj { private: BlockBegin* _from; - BlockBegin* _to; + int _index; // sux index of 'to' block public: - BlockPair(BlockBegin* from, BlockBegin* to): _from(from), _to(to) {} + BlockPair(BlockBegin* from, int index): _from(from), _index(index) {} BlockBegin* from() const { return _from; } - BlockBegin* to() const { return _to; } - bool is_same(BlockBegin* from, BlockBegin* to) const { return _from == from && _to == to; } - bool is_same(BlockPair* p) const { return _from == p->from() && _to == p->to(); } - void set_to(BlockBegin* b) { _to = b; } - void set_from(BlockBegin* b) { _from = b; } + int index() const { return _index; } }; typedef GrowableArray BlockPairList; diff --git a/src/hotspot/share/cds/archiveHeapWriter.cpp b/src/hotspot/share/cds/archiveHeapWriter.cpp index bdafb284c00..2f18838bb9b 100644 --- a/src/hotspot/share/cds/archiveHeapWriter.cpp +++ b/src/hotspot/share/cds/archiveHeapWriter.cpp @@ -44,7 +44,7 @@ #if INCLUDE_G1GC #include "gc/g1/g1CollectedHeap.hpp" -#include "gc/g1/heapRegion.hpp" +#include "gc/g1/g1HeapRegion.hpp" #endif #if INCLUDE_CDS_JAVA_HEAP diff --git a/src/hotspot/share/cds/filemap.cpp b/src/hotspot/share/cds/filemap.cpp index bc740bd8416..65ea6d24ced 100644 --- a/src/hotspot/share/cds/filemap.cpp +++ b/src/hotspot/share/cds/filemap.cpp @@ -71,7 +71,7 @@ #include "utilities/ostream.hpp" #if INCLUDE_G1GC #include "gc/g1/g1CollectedHeap.hpp" -#include "gc/g1/heapRegion.hpp" +#include "gc/g1/g1HeapRegion.hpp" #endif # include diff --git a/src/hotspot/share/cds/metaspaceShared.cpp b/src/hotspot/share/cds/metaspaceShared.cpp index 0bf8ee13241..df49d99c453 100644 --- a/src/hotspot/share/cds/metaspaceShared.cpp +++ b/src/hotspot/share/cds/metaspaceShared.cpp @@ -1333,6 +1333,9 @@ char* MetaspaceShared::reserve_address_space_for_archives(FileMapInfo* static_ma release_reserved_spaces(total_space_rs, archive_space_rs, class_space_rs); return nullptr; } + // NMT: fix up the space tags + MemTracker::record_virtual_memory_type(archive_space_rs.base(), mtClassShared); + MemTracker::record_virtual_memory_type(class_space_rs.base(), mtClass); } else { if (use_archive_base_addr && base_address != nullptr) { total_space_rs = ReservedSpace(total_range_size, archive_space_alignment, @@ -1362,16 +1365,13 @@ char* MetaspaceShared::reserve_address_space_for_archives(FileMapInfo* static_ma (size_t)archive_space_alignment); class_space_rs = total_space_rs.last_part(ccs_begin_offset); MemTracker::record_virtual_memory_split_reserved(total_space_rs.base(), total_space_rs.size(), - ccs_begin_offset); + ccs_begin_offset, mtClassShared, mtClass); } assert(is_aligned(archive_space_rs.base(), archive_space_alignment), "Sanity"); assert(is_aligned(archive_space_rs.size(), archive_space_alignment), "Sanity"); assert(is_aligned(class_space_rs.base(), class_space_alignment), "Sanity"); assert(is_aligned(class_space_rs.size(), class_space_alignment), "Sanity"); - // NMT: fix up the space tags - MemTracker::record_virtual_memory_type(archive_space_rs.base(), mtClassShared); - MemTracker::record_virtual_memory_type(class_space_rs.base(), mtClass); return archive_space_rs.base(); diff --git a/src/hotspot/share/compiler/compilationFailureInfo.cpp b/src/hotspot/share/compiler/compilationFailureInfo.cpp index e3f3353589e..fb94102ef16 100644 --- a/src/hotspot/share/compiler/compilationFailureInfo.cpp +++ b/src/hotspot/share/compiler/compilationFailureInfo.cpp @@ -1,6 +1,6 @@ /* - * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2023, Red Hat, Inc. and/or its affiliates. + * Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 2024, Red Hat, Inc. and/or its affiliates. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -42,11 +42,16 @@ #include "utilities/ostream.hpp" #include "utilities/nativeCallStack.hpp" +int CompilationFailureInfo::current_compile_id_or_0() { + ciEnv* env = ciEnv::current(); + return (env != nullptr) ? env->compile_id() : 0; +} + CompilationFailureInfo::CompilationFailureInfo(const char* failure_reason) : _stack(2), _failure_reason(os::strdup(failure_reason)), _elapsed_seconds(os::elapsedTime()), - _compile_id(ciEnv::current()->task()->compile_id()) + _compile_id(current_compile_id_or_0()) {} CompilationFailureInfo::~CompilationFailureInfo() { diff --git a/src/hotspot/share/compiler/compilationFailureInfo.hpp b/src/hotspot/share/compiler/compilationFailureInfo.hpp index 3de62eb69da..470865a2f66 100644 --- a/src/hotspot/share/compiler/compilationFailureInfo.hpp +++ b/src/hotspot/share/compiler/compilationFailureInfo.hpp @@ -1,6 +1,6 @@ /* - * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2023, Red Hat, Inc. and/or its affiliates. + * Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 2024, Red Hat, Inc. and/or its affiliates. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -40,6 +40,7 @@ class CompilationFailureInfo : public CHeapObj { char* const _failure_reason; const double _elapsed_seconds; const int _compile_id; + static int current_compile_id_or_0(); public: CompilationFailureInfo(const char* failure_reason); ~CompilationFailureInfo(); diff --git a/src/hotspot/share/gc/g1/c1/g1BarrierSetC1.cpp b/src/hotspot/share/gc/g1/c1/g1BarrierSetC1.cpp index ef2f23633b9..53d4aa221f2 100644 --- a/src/hotspot/share/gc/g1/c1/g1BarrierSetC1.cpp +++ b/src/hotspot/share/gc/g1/c1/g1BarrierSetC1.cpp @@ -28,8 +28,8 @@ #include "gc/g1/c1/g1BarrierSetC1.hpp" #include "gc/g1/g1BarrierSet.hpp" #include "gc/g1/g1BarrierSetAssembler.hpp" +#include "gc/g1/g1HeapRegion.hpp" #include "gc/g1/g1ThreadLocalData.hpp" -#include "gc/g1/heapRegion.hpp" #include "utilities/macros.hpp" #ifdef ASSERT diff --git a/src/hotspot/share/gc/g1/c2/g1BarrierSetC2.cpp b/src/hotspot/share/gc/g1/c2/g1BarrierSetC2.cpp index 0d6b5628560..575b4354472 100644 --- a/src/hotspot/share/gc/g1/c2/g1BarrierSetC2.cpp +++ b/src/hotspot/share/gc/g1/c2/g1BarrierSetC2.cpp @@ -29,7 +29,7 @@ #include "gc/g1/g1BarrierSetRuntime.hpp" #include "gc/g1/g1CardTable.hpp" #include "gc/g1/g1ThreadLocalData.hpp" -#include "gc/g1/heapRegion.hpp" +#include "gc/g1/g1HeapRegion.hpp" #include "opto/arraycopynode.hpp" #include "opto/compile.hpp" #include "opto/escape.hpp" diff --git a/src/hotspot/share/gc/g1/g1AllocRegion.hpp b/src/hotspot/share/gc/g1/g1AllocRegion.hpp index 600d1551259..b39a717d3b7 100644 --- a/src/hotspot/share/gc/g1/g1AllocRegion.hpp +++ b/src/hotspot/share/gc/g1/g1AllocRegion.hpp @@ -25,8 +25,8 @@ #ifndef SHARE_GC_G1_G1ALLOCREGION_HPP #define SHARE_GC_G1_G1ALLOCREGION_HPP -#include "gc/g1/heapRegion.hpp" #include "gc/g1/g1EvacStats.hpp" +#include "gc/g1/g1HeapRegion.hpp" #include "gc/g1/g1HeapRegionAttr.hpp" #include "gc/g1/g1NUMA.hpp" diff --git a/src/hotspot/share/gc/g1/g1AllocRegion.inline.hpp b/src/hotspot/share/gc/g1/g1AllocRegion.inline.hpp index 33c402b0087..00ef254e84c 100644 --- a/src/hotspot/share/gc/g1/g1AllocRegion.inline.hpp +++ b/src/hotspot/share/gc/g1/g1AllocRegion.inline.hpp @@ -27,7 +27,7 @@ #include "gc/g1/g1AllocRegion.hpp" -#include "gc/g1/heapRegion.inline.hpp" +#include "gc/g1/g1HeapRegion.inline.hpp" #define assert_alloc_region(p, message) \ do { \ diff --git a/src/hotspot/share/gc/g1/g1Allocator.cpp b/src/hotspot/share/gc/g1/g1Allocator.cpp index ffd2b65f555..3964ad8c8af 100644 --- a/src/hotspot/share/gc/g1/g1Allocator.cpp +++ b/src/hotspot/share/gc/g1/g1Allocator.cpp @@ -28,11 +28,11 @@ #include "gc/g1/g1EvacInfo.hpp" #include "gc/g1/g1EvacStats.inline.hpp" #include "gc/g1/g1CollectedHeap.inline.hpp" +#include "gc/g1/g1HeapRegion.inline.hpp" +#include "gc/g1/g1HeapRegionSet.inline.hpp" +#include "gc/g1/g1HeapRegionType.hpp" #include "gc/g1/g1NUMA.hpp" #include "gc/g1/g1Policy.hpp" -#include "gc/g1/heapRegion.inline.hpp" -#include "gc/g1/heapRegionSet.inline.hpp" -#include "gc/g1/heapRegionType.hpp" #include "gc/shared/tlab_globals.hpp" #include "runtime/mutexLocker.hpp" #include "utilities/align.hpp" diff --git a/src/hotspot/share/gc/g1/g1Arguments.cpp b/src/hotspot/share/gc/g1/g1Arguments.cpp index 5f022bfdc3c..d0d9cd31297 100644 --- a/src/hotspot/share/gc/g1/g1Arguments.cpp +++ b/src/hotspot/share/gc/g1/g1Arguments.cpp @@ -29,10 +29,10 @@ #include "gc/g1/g1CardSet.hpp" #include "gc/g1/g1CardSetContainers.inline.hpp" #include "gc/g1/g1CollectedHeap.inline.hpp" +#include "gc/g1/g1HeapRegion.hpp" +#include "gc/g1/g1HeapRegionBounds.inline.hpp" +#include "gc/g1/g1HeapRegionRemSet.hpp" #include "gc/g1/g1HeapVerifier.hpp" -#include "gc/g1/heapRegion.hpp" -#include "gc/g1/heapRegionBounds.inline.hpp" -#include "gc/g1/heapRegionRemSet.hpp" #include "gc/shared/cardTable.hpp" #include "gc/shared/gcArguments.hpp" #include "gc/shared/workerPolicy.hpp" diff --git a/src/hotspot/share/gc/g1/g1BarrierSet.cpp b/src/hotspot/share/gc/g1/g1BarrierSet.cpp index c2bc7bf5425..448f2f5fccf 100644 --- a/src/hotspot/share/gc/g1/g1BarrierSet.cpp +++ b/src/hotspot/share/gc/g1/g1BarrierSet.cpp @@ -27,10 +27,10 @@ #include "gc/g1/g1BarrierSetAssembler.hpp" #include "gc/g1/g1CardTable.inline.hpp" #include "gc/g1/g1CollectedHeap.inline.hpp" +#include "gc/g1/g1HeapRegion.hpp" #include "gc/g1/g1RegionPinCache.inline.hpp" #include "gc/g1/g1SATBMarkQueueSet.hpp" #include "gc/g1/g1ThreadLocalData.hpp" -#include "gc/g1/heapRegion.hpp" #include "gc/shared/satbMarkQueue.hpp" #include "logging/log.hpp" #include "oops/access.inline.hpp" diff --git a/src/hotspot/share/gc/g1/g1BlockOffsetTable.cpp b/src/hotspot/share/gc/g1/g1BlockOffsetTable.cpp index 71107387564..af47ce92dc5 100644 --- a/src/hotspot/share/gc/g1/g1BlockOffsetTable.cpp +++ b/src/hotspot/share/gc/g1/g1BlockOffsetTable.cpp @@ -25,7 +25,7 @@ #include "precompiled.hpp" #include "gc/g1/g1BlockOffsetTable.inline.hpp" #include "gc/g1/g1CollectedHeap.inline.hpp" -#include "gc/g1/heapRegion.inline.hpp" +#include "gc/g1/g1HeapRegion.inline.hpp" #include "logging/log.hpp" #include "nmt/memTracker.hpp" #include "oops/oop.inline.hpp" diff --git a/src/hotspot/share/gc/g1/g1BlockOffsetTable.inline.hpp b/src/hotspot/share/gc/g1/g1BlockOffsetTable.inline.hpp index a29050c04b3..80697d38f7d 100644 --- a/src/hotspot/share/gc/g1/g1BlockOffsetTable.inline.hpp +++ b/src/hotspot/share/gc/g1/g1BlockOffsetTable.inline.hpp @@ -27,7 +27,7 @@ #include "gc/g1/g1BlockOffsetTable.hpp" -#include "gc/g1/heapRegion.hpp" +#include "gc/g1/g1HeapRegion.hpp" #include "gc/shared/memset_with_concurrent_readers.hpp" #include "runtime/atomic.hpp" #include "oops/oop.inline.hpp" diff --git a/src/hotspot/share/gc/g1/g1CardSet.cpp b/src/hotspot/share/gc/g1/g1CardSet.cpp index e6b2d5029e5..101822dbc44 100644 --- a/src/hotspot/share/gc/g1/g1CardSet.cpp +++ b/src/hotspot/share/gc/g1/g1CardSet.cpp @@ -26,7 +26,7 @@ #include "gc/g1/g1CardSet.inline.hpp" #include "gc/g1/g1CardSetContainers.inline.hpp" #include "gc/g1/g1CardSetMemory.inline.hpp" -#include "gc/g1/heapRegion.inline.hpp" +#include "gc/g1/g1HeapRegion.inline.hpp" #include "gc/shared/gcLogPrecious.hpp" #include "gc/shared/gcTraceTime.inline.hpp" #include "memory/allocation.inline.hpp" diff --git a/src/hotspot/share/gc/g1/g1CardTable.inline.hpp b/src/hotspot/share/gc/g1/g1CardTable.inline.hpp index d48fce6cb9e..0585b68e336 100644 --- a/src/hotspot/share/gc/g1/g1CardTable.inline.hpp +++ b/src/hotspot/share/gc/g1/g1CardTable.inline.hpp @@ -27,7 +27,7 @@ #include "gc/g1/g1CardTable.hpp" -#include "gc/g1/heapRegion.hpp" +#include "gc/g1/g1HeapRegion.hpp" inline uint G1CardTable::region_idx_for(CardValue* p) { size_t const card_idx = pointer_delta(p, _byte_map, sizeof(CardValue)); diff --git a/src/hotspot/share/gc/g1/g1CodeBlobClosure.cpp b/src/hotspot/share/gc/g1/g1CodeBlobClosure.cpp index 77211af4364..5e99b91e76a 100644 --- a/src/hotspot/share/gc/g1/g1CodeBlobClosure.cpp +++ b/src/hotspot/share/gc/g1/g1CodeBlobClosure.cpp @@ -27,8 +27,8 @@ #include "gc/g1/g1CodeBlobClosure.hpp" #include "gc/g1/g1CollectedHeap.inline.hpp" #include "gc/g1/g1ConcurrentMark.inline.hpp" -#include "gc/g1/heapRegion.hpp" -#include "gc/g1/heapRegionRemSet.inline.hpp" +#include "gc/g1/g1HeapRegion.hpp" +#include "gc/g1/g1HeapRegionRemSet.inline.hpp" #include "gc/shared/barrierSetNMethod.hpp" #include "oops/access.inline.hpp" #include "oops/compressedOops.inline.hpp" diff --git a/src/hotspot/share/gc/g1/g1CodeRootSet.cpp b/src/hotspot/share/gc/g1/g1CodeRootSet.cpp index a1eb7b8543a..135c1bca2e3 100644 --- a/src/hotspot/share/gc/g1/g1CodeRootSet.cpp +++ b/src/hotspot/share/gc/g1/g1CodeRootSet.cpp @@ -27,7 +27,7 @@ #include "code/codeCache.hpp" #include "code/nmethod.hpp" #include "gc/g1/g1CodeRootSet.hpp" -#include "gc/g1/heapRegion.hpp" +#include "gc/g1/g1HeapRegion.hpp" #include "memory/allocation.hpp" #include "oops/oop.inline.hpp" #include "runtime/atomic.hpp" diff --git a/src/hotspot/share/gc/g1/g1CollectedHeap.cpp b/src/hotspot/share/gc/g1/g1CollectedHeap.cpp index f4453a7ba0b..ec3d5fa4ecc 100644 --- a/src/hotspot/share/gc/g1/g1CollectedHeap.cpp +++ b/src/hotspot/share/gc/g1/g1CollectedHeap.cpp @@ -46,6 +46,9 @@ #include "gc/g1/g1GCParPhaseTimesTracker.hpp" #include "gc/g1/g1GCPhaseTimes.hpp" #include "gc/g1/g1GCPauseType.hpp" +#include "gc/g1/g1HeapRegion.inline.hpp" +#include "gc/g1/g1HeapRegionRemSet.inline.hpp" +#include "gc/g1/g1HeapRegionSet.inline.hpp" #include "gc/g1/g1HeapSizingPolicy.hpp" #include "gc/g1/g1HeapTransition.hpp" #include "gc/g1/g1HeapVerifier.hpp" @@ -71,9 +74,6 @@ #include "gc/g1/g1VMOperations.hpp" #include "gc/g1/g1YoungCollector.hpp" #include "gc/g1/g1YoungGCAllocationFailureInjector.hpp" -#include "gc/g1/heapRegion.inline.hpp" -#include "gc/g1/heapRegionRemSet.inline.hpp" -#include "gc/g1/heapRegionSet.inline.hpp" #include "gc/shared/classUnloadingContext.hpp" #include "gc/shared/concurrentGCBreakpoints.hpp" #include "gc/shared/gcBehaviours.hpp" diff --git a/src/hotspot/share/gc/g1/g1CollectedHeap.hpp b/src/hotspot/share/gc/g1/g1CollectedHeap.hpp index 189a09fe042..b4157f16493 100644 --- a/src/hotspot/share/gc/g1/g1CollectedHeap.hpp +++ b/src/hotspot/share/gc/g1/g1CollectedHeap.hpp @@ -36,6 +36,8 @@ #include "gc/g1/g1EvacStats.hpp" #include "gc/g1/g1GCPauseType.hpp" #include "gc/g1/g1HeapRegionAttr.hpp" +#include "gc/g1/g1HeapRegionManager.hpp" +#include "gc/g1/g1HeapRegionSet.hpp" #include "gc/g1/g1HeapTransition.hpp" #include "gc/g1/g1HeapVerifier.hpp" #include "gc/g1/g1HRPrinter.hpp" @@ -45,8 +47,6 @@ #include "gc/g1/g1NUMA.hpp" #include "gc/g1/g1SurvivorRegions.hpp" #include "gc/g1/g1YoungGCAllocationFailureInjector.hpp" -#include "gc/g1/heapRegionManager.hpp" -#include "gc/g1/heapRegionSet.hpp" #include "gc/shared/barrierSet.hpp" #include "gc/shared/collectedHeap.hpp" #include "gc/shared/gcHeapSummary.hpp" diff --git a/src/hotspot/share/gc/g1/g1CollectedHeap.inline.hpp b/src/hotspot/share/gc/g1/g1CollectedHeap.inline.hpp index 537b6863fb9..513b0a4505b 100644 --- a/src/hotspot/share/gc/g1/g1CollectedHeap.inline.hpp +++ b/src/hotspot/share/gc/g1/g1CollectedHeap.inline.hpp @@ -31,13 +31,13 @@ #include "gc/g1/g1CollectorState.hpp" #include "gc/g1/g1ConcurrentMark.inline.hpp" #include "gc/g1/g1EvacFailureRegions.hpp" +#include "gc/g1/g1HeapRegion.inline.hpp" +#include "gc/g1/g1HeapRegionManager.inline.hpp" +#include "gc/g1/g1HeapRegionRemSet.hpp" +#include "gc/g1/g1HeapRegionSet.inline.hpp" #include "gc/g1/g1Policy.hpp" #include "gc/g1/g1RegionPinCache.inline.hpp" #include "gc/g1/g1RemSet.hpp" -#include "gc/g1/heapRegion.inline.hpp" -#include "gc/g1/heapRegionManager.inline.hpp" -#include "gc/g1/heapRegionRemSet.hpp" -#include "gc/g1/heapRegionSet.inline.hpp" #include "gc/shared/markBitMap.inline.hpp" #include "gc/shared/taskqueue.inline.hpp" #include "oops/stackChunkOop.hpp" diff --git a/src/hotspot/share/gc/g1/g1CollectionSet.cpp b/src/hotspot/share/gc/g1/g1CollectionSet.cpp index 30787adbe54..3ccd8b69644 100644 --- a/src/hotspot/share/gc/g1/g1CollectionSet.cpp +++ b/src/hotspot/share/gc/g1/g1CollectionSet.cpp @@ -28,11 +28,11 @@ #include "gc/g1/g1CollectionSet.hpp" #include "gc/g1/g1CollectionSetCandidates.hpp" #include "gc/g1/g1CollectorState.hpp" +#include "gc/g1/g1HeapRegion.inline.hpp" +#include "gc/g1/g1HeapRegionRemSet.inline.hpp" +#include "gc/g1/g1HeapRegionSet.hpp" #include "gc/g1/g1ParScanThreadState.hpp" #include "gc/g1/g1Policy.hpp" -#include "gc/g1/heapRegion.inline.hpp" -#include "gc/g1/heapRegionRemSet.inline.hpp" -#include "gc/g1/heapRegionSet.hpp" #include "logging/logStream.hpp" #include "runtime/orderAccess.hpp" #include "utilities/debug.hpp" diff --git a/src/hotspot/share/gc/g1/g1CollectionSetCandidates.cpp b/src/hotspot/share/gc/g1/g1CollectionSetCandidates.cpp index 9f903bc924f..b4649414b10 100644 --- a/src/hotspot/share/gc/g1/g1CollectionSetCandidates.cpp +++ b/src/hotspot/share/gc/g1/g1CollectionSetCandidates.cpp @@ -25,7 +25,7 @@ #include "precompiled.hpp" #include "gc/g1/g1CollectionSetCandidates.hpp" #include "gc/g1/g1CollectionSetChooser.hpp" -#include "gc/g1/heapRegion.inline.hpp" +#include "gc/g1/g1HeapRegion.inline.hpp" #include "utilities/bitMap.inline.hpp" #include "utilities/growableArray.hpp" diff --git a/src/hotspot/share/gc/g1/g1CollectionSetChooser.cpp b/src/hotspot/share/gc/g1/g1CollectionSetChooser.cpp index f19488a49a8..ca7f2b37398 100644 --- a/src/hotspot/share/gc/g1/g1CollectionSetChooser.cpp +++ b/src/hotspot/share/gc/g1/g1CollectionSetChooser.cpp @@ -26,7 +26,7 @@ #include "gc/g1/g1CollectedHeap.inline.hpp" #include "gc/g1/g1CollectionSetCandidates.hpp" #include "gc/g1/g1CollectionSetChooser.hpp" -#include "gc/g1/heapRegionRemSet.inline.hpp" +#include "gc/g1/g1HeapRegionRemSet.inline.hpp" #include "gc/shared/space.inline.hpp" #include "runtime/atomic.hpp" #include "utilities/quickSort.hpp" diff --git a/src/hotspot/share/gc/g1/g1CollectionSetChooser.hpp b/src/hotspot/share/gc/g1/g1CollectionSetChooser.hpp index 5b005205551..62f9b2a5cef 100644 --- a/src/hotspot/share/gc/g1/g1CollectionSetChooser.hpp +++ b/src/hotspot/share/gc/g1/g1CollectionSetChooser.hpp @@ -25,7 +25,7 @@ #ifndef SHARE_GC_G1_G1COLLECTIONSETCHOOSER_HPP #define SHARE_GC_G1_G1COLLECTIONSETCHOOSER_HPP -#include "gc/g1/heapRegion.hpp" +#include "gc/g1/g1HeapRegion.hpp" #include "gc/shared/gc_globals.hpp" #include "memory/allStatic.hpp" #include "runtime/globals.hpp" diff --git a/src/hotspot/share/gc/g1/g1ConcurrentMark.cpp b/src/hotspot/share/gc/g1/g1ConcurrentMark.cpp index cab9f52a009..5d81f49546c 100644 --- a/src/hotspot/share/gc/g1/g1ConcurrentMark.cpp +++ b/src/hotspot/share/gc/g1/g1ConcurrentMark.cpp @@ -34,16 +34,16 @@ #include "gc/g1/g1ConcurrentMarkThread.inline.hpp" #include "gc/g1/g1ConcurrentRebuildAndScrub.hpp" #include "gc/g1/g1DirtyCardQueue.hpp" +#include "gc/g1/g1HeapRegion.inline.hpp" +#include "gc/g1/g1HeapRegionManager.hpp" +#include "gc/g1/g1HeapRegionRemSet.inline.hpp" +#include "gc/g1/g1HeapRegionSet.inline.hpp" #include "gc/g1/g1HeapVerifier.hpp" #include "gc/g1/g1OopClosures.inline.hpp" #include "gc/g1/g1Policy.hpp" #include "gc/g1/g1RegionMarkStatsCache.inline.hpp" #include "gc/g1/g1ThreadLocalData.hpp" #include "gc/g1/g1Trace.hpp" -#include "gc/g1/heapRegion.inline.hpp" -#include "gc/g1/heapRegionManager.hpp" -#include "gc/g1/heapRegionRemSet.inline.hpp" -#include "gc/g1/heapRegionSet.inline.hpp" #include "gc/shared/gcId.hpp" #include "gc/shared/gcTimer.hpp" #include "gc/shared/gcTraceTime.inline.hpp" @@ -152,7 +152,8 @@ G1CMMarkStack::TaskQueueEntryChunk* G1CMMarkStack::ChunkAllocator::allocate_new_ MutexLocker x(MarkStackChunkList_lock, Mutex::_no_safepoint_check_flag); if (Atomic::load_acquire(&_buckets[bucket]) == nullptr) { - if (!expand()) { + size_t desired_capacity = bucket_size(bucket) * 2; + if (!try_expand_to(desired_capacity)) { return nullptr; } } @@ -196,23 +197,28 @@ bool G1CMMarkStack::ChunkAllocator::initialize(size_t initial_capacity, size_t m return true; } -bool G1CMMarkStack::ChunkAllocator::expand() { +bool G1CMMarkStack::ChunkAllocator::try_expand_to(size_t desired_capacity) { if (_capacity == _max_capacity) { log_debug(gc)("Can not expand overflow mark stack further, already at maximum capacity of " SIZE_FORMAT " chunks.", _capacity); return false; } + size_t old_capacity = _capacity; - // Double capacity if possible. - size_t new_capacity = MIN2(old_capacity * 2, _max_capacity); + desired_capacity = MIN2(desired_capacity, _max_capacity); - if (reserve(new_capacity)) { + if (reserve(desired_capacity)) { log_debug(gc)("Expanded the mark stack capacity from " SIZE_FORMAT " to " SIZE_FORMAT " chunks", - old_capacity, new_capacity); + old_capacity, desired_capacity); return true; } return false; } +bool G1CMMarkStack::ChunkAllocator::try_expand() { + size_t new_capacity = _capacity * 2; + return try_expand_to(new_capacity); +} + G1CMMarkStack::ChunkAllocator::~ChunkAllocator() { if (_buckets == nullptr) { return; @@ -234,6 +240,9 @@ bool G1CMMarkStack::ChunkAllocator::reserve(size_t new_capacity) { size_t highest_bucket = get_bucket(new_capacity - 1); size_t i = get_bucket(_capacity); + // Allocate all buckets associated with indexes between the current capacity (_capacity) + // and the new capacity (new_capacity). This step ensures that there are no gaps in the + // array and that the capacity accurately reflects the reserved memory. for (; i <= highest_bucket; i++) { if (Atomic::load_acquire(&_buckets[i]) != nullptr) { continue; // Skip over already allocated buckets. @@ -261,7 +270,7 @@ bool G1CMMarkStack::ChunkAllocator::reserve(size_t new_capacity) { } void G1CMMarkStack::expand() { - _chunk_allocator.expand(); + _chunk_allocator.try_expand(); } void G1CMMarkStack::add_chunk_to_list(TaskQueueEntryChunk* volatile* list, TaskQueueEntryChunk* elem) { diff --git a/src/hotspot/share/gc/g1/g1ConcurrentMark.hpp b/src/hotspot/share/gc/g1/g1ConcurrentMark.hpp index ccd35bed64f..3d9693bed10 100644 --- a/src/hotspot/share/gc/g1/g1ConcurrentMark.hpp +++ b/src/hotspot/share/gc/g1/g1ConcurrentMark.hpp @@ -27,9 +27,9 @@ #include "gc/g1/g1ConcurrentMarkBitMap.hpp" #include "gc/g1/g1ConcurrentMarkObjArrayProcessor.hpp" +#include "gc/g1/g1HeapRegionSet.hpp" #include "gc/g1/g1HeapVerifier.hpp" #include "gc/g1/g1RegionMarkStatsCache.hpp" -#include "gc/g1/heapRegionSet.hpp" #include "gc/shared/gcCause.hpp" #include "gc/shared/taskTerminator.hpp" #include "gc/shared/taskqueue.hpp" @@ -145,7 +145,7 @@ class G1CMMarkStack { // within the bucket. Additionally, each new bucket added to the growable array doubles the capacity of // the growable array. // - // Illustration of the Growable Array data structure. + // Illustration of the growable array data structure. // // +----+ +----+----+ // | |------->| | | @@ -174,7 +174,7 @@ class G1CMMarkStack { size_t bucket_size(size_t bucket) { return (bucket == 0) ? _min_capacity : - _min_capacity * ( 1ULL << (bucket -1)); + _min_capacity * ( 1ULL << (bucket - 1)); } static unsigned int find_highest_bit(uintptr_t mask) { @@ -225,7 +225,9 @@ class G1CMMarkStack { size_t capacity() const { return _capacity; } - bool expand(); + // Expand the mark stack doubling its size. + bool try_expand(); + bool try_expand_to(size_t desired_capacity); TaskQueueEntryChunk* allocate_new_chunk(); }; @@ -559,7 +561,7 @@ class G1ConcurrentMark : public CHeapObj { // Sets the internal top_at_region_start for the given region to current top of the region. inline void update_top_at_rebuild_start(HeapRegion* r); // TARS for the given region during remembered set rebuilding. - inline HeapWord* top_at_rebuild_start(uint region) const; + inline HeapWord* top_at_rebuild_start(HeapRegion* r) const; // Clear statistics gathered during the concurrent cycle for the given region after // it has been reclaimed. diff --git a/src/hotspot/share/gc/g1/g1ConcurrentMark.inline.hpp b/src/hotspot/share/gc/g1/g1ConcurrentMark.inline.hpp index 3601f4529a3..4a05b86ae5a 100644 --- a/src/hotspot/share/gc/g1/g1ConcurrentMark.inline.hpp +++ b/src/hotspot/share/gc/g1/g1ConcurrentMark.inline.hpp @@ -30,12 +30,12 @@ #include "gc/g1/g1CollectedHeap.inline.hpp" #include "gc/g1/g1ConcurrentMarkBitMap.inline.hpp" #include "gc/g1/g1ConcurrentMarkObjArrayProcessor.inline.hpp" +#include "gc/g1/g1HeapRegion.hpp" +#include "gc/g1/g1HeapRegionRemSet.inline.hpp" #include "gc/g1/g1OopClosures.inline.hpp" #include "gc/g1/g1Policy.hpp" #include "gc/g1/g1RegionMarkStatsCache.inline.hpp" #include "gc/g1/g1RemSetTrackingPolicy.hpp" -#include "gc/g1/heapRegionRemSet.inline.hpp" -#include "gc/g1/heapRegion.hpp" #include "gc/shared/suspendibleThreadSet.hpp" #include "gc/shared/taskqueue.inline.hpp" #include "utilities/bitMap.inline.hpp" @@ -184,9 +184,8 @@ inline size_t G1CMTask::scan_objArray(objArrayOop obj, MemRegion mr) { return mr.word_size(); } -inline HeapWord* G1ConcurrentMark::top_at_rebuild_start(uint region) const { - assert(region < _g1h->max_reserved_regions(), "Tried to access TARS for region %u out of bounds", region); - return _top_at_rebuild_starts[region]; +inline HeapWord* G1ConcurrentMark::top_at_rebuild_start(HeapRegion* r) const { + return _top_at_rebuild_starts[r->hrm_index()]; } inline void G1ConcurrentMark::update_top_at_rebuild_start(HeapRegion* r) { diff --git a/src/hotspot/share/gc/g1/g1ConcurrentMarkBitMap.cpp b/src/hotspot/share/gc/g1/g1ConcurrentMarkBitMap.cpp index e2ace6c8c0a..438b58c2c02 100644 --- a/src/hotspot/share/gc/g1/g1ConcurrentMarkBitMap.cpp +++ b/src/hotspot/share/gc/g1/g1ConcurrentMarkBitMap.cpp @@ -25,7 +25,7 @@ #include "precompiled.hpp" #include "gc/g1/g1CollectedHeap.inline.hpp" #include "gc/g1/g1ConcurrentMarkBitMap.inline.hpp" -#include "gc/g1/heapRegion.hpp" +#include "gc/g1/g1HeapRegion.hpp" #include "memory/virtualspace.hpp" G1CMBitMap::G1CMBitMap() : MarkBitMap(), _listener() { diff --git a/src/hotspot/share/gc/g1/g1ConcurrentMarkObjArrayProcessor.cpp b/src/hotspot/share/gc/g1/g1ConcurrentMarkObjArrayProcessor.cpp index 80acada0472..84823f8bf83 100644 --- a/src/hotspot/share/gc/g1/g1ConcurrentMarkObjArrayProcessor.cpp +++ b/src/hotspot/share/gc/g1/g1ConcurrentMarkObjArrayProcessor.cpp @@ -26,7 +26,7 @@ #include "gc/g1/g1CollectedHeap.inline.hpp" #include "gc/g1/g1ConcurrentMark.inline.hpp" #include "gc/g1/g1ConcurrentMarkObjArrayProcessor.inline.hpp" -#include "gc/g1/heapRegion.inline.hpp" +#include "gc/g1/g1HeapRegion.inline.hpp" #include "gc/shared/gc_globals.hpp" #include "memory/memRegion.hpp" #include "utilities/globalDefinitions.hpp" diff --git a/src/hotspot/share/gc/g1/g1ConcurrentRebuildAndScrub.cpp b/src/hotspot/share/gc/g1/g1ConcurrentRebuildAndScrub.cpp index 8cf7601d65a..74e242a0f3f 100644 --- a/src/hotspot/share/gc/g1/g1ConcurrentRebuildAndScrub.cpp +++ b/src/hotspot/share/gc/g1/g1ConcurrentRebuildAndScrub.cpp @@ -28,9 +28,9 @@ #include "gc/g1/g1ConcurrentMark.inline.hpp" #include "gc/g1/g1ConcurrentMarkBitMap.inline.hpp" +#include "gc/g1/g1HeapRegion.inline.hpp" +#include "gc/g1/g1HeapRegionManager.inline.hpp" #include "gc/g1/g1_globals.hpp" -#include "gc/g1/heapRegion.inline.hpp" -#include "gc/g1/heapRegionManager.inline.hpp" #include "gc/shared/suspendibleThreadSet.hpp" #include "gc/shared/workerThread.hpp" #include "logging/log.hpp" @@ -105,7 +105,7 @@ class G1RebuildRSAndScrubTask : public WorkerTask { // - been allocated after rebuild start, or // - been reclaimed by a collection. bool should_rebuild_or_scrub(HeapRegion* hr) const { - return _cm->top_at_rebuild_start(hr->hrm_index()) != nullptr; + return _cm->top_at_rebuild_start(hr) != nullptr; } // Helper used by both humongous objects and when chunking an object larger than the @@ -229,7 +229,7 @@ class G1RebuildRSAndScrubTask : public WorkerTask { assert(should_rebuild_or_scrub(hr), "must be"); log_trace(gc, marking)("Scrub and rebuild region: " HR_FORMAT " pb: " PTR_FORMAT " TARS: " PTR_FORMAT " TAMS: " PTR_FORMAT, - HR_FORMAT_PARAMS(hr), p2i(pb), p2i(_cm->top_at_rebuild_start(hr->hrm_index())), p2i(hr->top_at_mark_start())); + HR_FORMAT_PARAMS(hr), p2i(pb), p2i(_cm->top_at_rebuild_start(hr)), p2i(hr->top_at_mark_start())); if (scan_and_scrub_to_pb(hr, hr->bottom(), pb)) { log_trace(gc, marking)("Scan and scrub aborted for region: %u", hr->hrm_index()); @@ -246,7 +246,7 @@ class G1RebuildRSAndScrubTask : public WorkerTask { hr->note_end_of_scrubbing(); // Rebuild from TAMS (= parsable_bottom) to TARS. - if (scan_from_pb_to_tars(hr, pb, _cm->top_at_rebuild_start(hr->hrm_index()))) { + if (scan_from_pb_to_tars(hr, pb, _cm->top_at_rebuild_start(hr))) { log_trace(gc, marking)("Rebuild aborted for region: %u (%s)", hr->hrm_index(), hr->get_short_type_str()); return true; } @@ -272,7 +272,7 @@ class G1RebuildRSAndScrubTask : public WorkerTask { "Humongous object not live"); log_trace(gc, marking)("Rebuild for humongous region: " HR_FORMAT " pb: " PTR_FORMAT " TARS: " PTR_FORMAT, - HR_FORMAT_PARAMS(hr), p2i(pb), p2i(_cm->top_at_rebuild_start(hr->hrm_index()))); + HR_FORMAT_PARAMS(hr), p2i(pb), p2i(_cm->top_at_rebuild_start(hr))); // Scan the humongous object in chunks from bottom to top to rebuild remembered sets. HeapWord* humongous_end = hr->humongous_start_region()->bottom() + humongous->size(); diff --git a/src/hotspot/share/gc/g1/g1ConcurrentRefine.cpp b/src/hotspot/share/gc/g1/g1ConcurrentRefine.cpp index b2ac4b25e90..9ae9ad793c4 100644 --- a/src/hotspot/share/gc/g1/g1ConcurrentRefine.cpp +++ b/src/hotspot/share/gc/g1/g1ConcurrentRefine.cpp @@ -28,9 +28,9 @@ #include "gc/g1/g1ConcurrentRefine.hpp" #include "gc/g1/g1ConcurrentRefineThread.hpp" #include "gc/g1/g1DirtyCardQueue.hpp" +#include "gc/g1/g1HeapRegion.inline.hpp" +#include "gc/g1/g1HeapRegionRemSet.inline.hpp" #include "gc/g1/g1Policy.hpp" -#include "gc/g1/heapRegion.inline.hpp" -#include "gc/g1/heapRegionRemSet.inline.hpp" #include "gc/shared/gc_globals.hpp" #include "logging/log.hpp" #include "memory/allocation.inline.hpp" diff --git a/src/hotspot/share/gc/g1/g1ConcurrentRefineThreadsNeeded.cpp b/src/hotspot/share/gc/g1/g1ConcurrentRefineThreadsNeeded.cpp index 8767f8e1da9..33943eb5113 100644 --- a/src/hotspot/share/gc/g1/g1ConcurrentRefineThreadsNeeded.cpp +++ b/src/hotspot/share/gc/g1/g1ConcurrentRefineThreadsNeeded.cpp @@ -25,7 +25,7 @@ #include "precompiled.hpp" #include "gc/g1/g1Analytics.hpp" #include "gc/g1/g1ConcurrentRefineThreadsNeeded.hpp" -#include "gc/g1/heapRegion.hpp" +#include "gc/g1/g1HeapRegion.hpp" #include "gc/g1/g1Policy.hpp" #include "utilities/globalDefinitions.hpp" #include diff --git a/src/hotspot/share/gc/g1/g1DirtyCardQueue.cpp b/src/hotspot/share/gc/g1/g1DirtyCardQueue.cpp index 93ff09134bf..67059b6ec1c 100644 --- a/src/hotspot/share/gc/g1/g1DirtyCardQueue.cpp +++ b/src/hotspot/share/gc/g1/g1DirtyCardQueue.cpp @@ -30,10 +30,10 @@ #include "gc/g1/g1ConcurrentRefineThread.hpp" #include "gc/g1/g1DirtyCardQueue.hpp" #include "gc/g1/g1FreeIdSet.hpp" +#include "gc/g1/g1HeapRegionRemSet.inline.hpp" #include "gc/g1/g1RedirtyCardsQueue.hpp" #include "gc/g1/g1RemSet.hpp" #include "gc/g1/g1ThreadLocalData.hpp" -#include "gc/g1/heapRegionRemSet.inline.hpp" #include "gc/shared/bufferNode.hpp" #include "gc/shared/bufferNodeList.hpp" #include "gc/shared/suspendibleThreadSet.hpp" diff --git a/src/hotspot/share/gc/g1/g1EdenRegions.hpp b/src/hotspot/share/gc/g1/g1EdenRegions.hpp index 23b97785ad3..c76099c284a 100644 --- a/src/hotspot/share/gc/g1/g1EdenRegions.hpp +++ b/src/hotspot/share/gc/g1/g1EdenRegions.hpp @@ -26,7 +26,7 @@ #define SHARE_GC_G1_G1EDENREGIONS_HPP #include "gc/g1/g1RegionsOnNodes.hpp" -#include "gc/g1/heapRegion.hpp" +#include "gc/g1/g1HeapRegion.hpp" #include "runtime/globals.hpp" #include "utilities/debug.hpp" diff --git a/src/hotspot/share/gc/g1/g1EvacFailureRegions.cpp b/src/hotspot/share/gc/g1/g1EvacFailureRegions.cpp index a308fe7a393..845868c3e24 100644 --- a/src/hotspot/share/gc/g1/g1EvacFailureRegions.cpp +++ b/src/hotspot/share/gc/g1/g1EvacFailureRegions.cpp @@ -27,7 +27,7 @@ #include "gc/g1/g1BatchedTask.hpp" #include "gc/g1/g1CollectedHeap.inline.hpp" #include "gc/g1/g1EvacFailureRegions.inline.hpp" -#include "gc/g1/heapRegion.hpp" +#include "gc/g1/g1HeapRegion.hpp" #include "memory/allocation.hpp" #include "runtime/atomic.hpp" #include "utilities/bitMap.inline.hpp" diff --git a/src/hotspot/share/gc/g1/g1FullCollector.cpp b/src/hotspot/share/gc/g1/g1FullCollector.cpp index 430d6f32788..81a54a9c31f 100644 --- a/src/hotspot/share/gc/g1/g1FullCollector.cpp +++ b/src/hotspot/share/gc/g1/g1FullCollector.cpp @@ -312,6 +312,13 @@ void G1FullCollector::phase1_mark_live_objects() { reference_processor()->set_active_mt_degree(old_active_mt_degree); } + { + GCTraceTime(Debug, gc, phases) debug("Phase 1: Flush Mark Stats Cache", scope()->timer()); + for (uint i = 0; i < workers(); i++) { + marker(i)->flush_mark_stats_cache(); + } + } + // Weak oops cleanup. { GCTraceTime(Debug, gc, phases) debug("Phase 1: Weak Processing", scope()->timer()); diff --git a/src/hotspot/share/gc/g1/g1FullCollector.inline.hpp b/src/hotspot/share/gc/g1/g1FullCollector.inline.hpp index 9150d2f2ccd..7aa04449bcf 100644 --- a/src/hotspot/share/gc/g1/g1FullCollector.inline.hpp +++ b/src/hotspot/share/gc/g1/g1FullCollector.inline.hpp @@ -28,7 +28,7 @@ #include "gc/g1/g1FullCollector.hpp" #include "gc/g1/g1FullGCHeapRegionAttr.hpp" -#include "gc/g1/heapRegion.inline.hpp" +#include "gc/g1/g1HeapRegion.inline.hpp" #include "oops/oopsHierarchy.hpp" #include "runtime/atomic.hpp" diff --git a/src/hotspot/share/gc/g1/g1FullGCAdjustTask.cpp b/src/hotspot/share/gc/g1/g1FullGCAdjustTask.cpp index 76aebeb7a83..3eca766b2fc 100644 --- a/src/hotspot/share/gc/g1/g1FullGCAdjustTask.cpp +++ b/src/hotspot/share/gc/g1/g1FullGCAdjustTask.cpp @@ -32,7 +32,7 @@ #include "gc/g1/g1FullGCCompactionPoint.hpp" #include "gc/g1/g1FullGCMarker.hpp" #include "gc/g1/g1FullGCOopClosures.inline.hpp" -#include "gc/g1/heapRegion.inline.hpp" +#include "gc/g1/g1HeapRegion.inline.hpp" #include "gc/shared/gcTraceTime.inline.hpp" #include "gc/shared/referenceProcessor.hpp" #include "gc/shared/weakProcessor.inline.hpp" diff --git a/src/hotspot/share/gc/g1/g1FullGCAdjustTask.hpp b/src/hotspot/share/gc/g1/g1FullGCAdjustTask.hpp index c9b190acd06..26ac183d10d 100644 --- a/src/hotspot/share/gc/g1/g1FullGCAdjustTask.hpp +++ b/src/hotspot/share/gc/g1/g1FullGCAdjustTask.hpp @@ -27,8 +27,8 @@ #include "gc/g1/g1FullGCOopClosures.hpp" #include "gc/g1/g1FullGCTask.hpp" +#include "gc/g1/g1HeapRegionManager.hpp" #include "gc/g1/g1RootProcessor.hpp" -#include "gc/g1/heapRegionManager.hpp" #include "gc/shared/weakProcessor.hpp" #include "utilities/ticks.hpp" diff --git a/src/hotspot/share/gc/g1/g1FullGCCompactTask.cpp b/src/hotspot/share/gc/g1/g1FullGCCompactTask.cpp index 2ed6ccd4735..5e3a9687f98 100644 --- a/src/hotspot/share/gc/g1/g1FullGCCompactTask.cpp +++ b/src/hotspot/share/gc/g1/g1FullGCCompactTask.cpp @@ -28,7 +28,7 @@ #include "gc/g1/g1FullCollector.inline.hpp" #include "gc/g1/g1FullGCCompactionPoint.hpp" #include "gc/g1/g1FullGCCompactTask.hpp" -#include "gc/g1/heapRegion.inline.hpp" +#include "gc/g1/g1HeapRegion.inline.hpp" #include "gc/shared/gcTraceTime.inline.hpp" #include "logging/log.hpp" #include "oops/oop.inline.hpp" diff --git a/src/hotspot/share/gc/g1/g1FullGCCompactTask.hpp b/src/hotspot/share/gc/g1/g1FullGCCompactTask.hpp index a7e2ea38c17..7f7f144397b 100644 --- a/src/hotspot/share/gc/g1/g1FullGCCompactTask.hpp +++ b/src/hotspot/share/gc/g1/g1FullGCCompactTask.hpp @@ -28,7 +28,7 @@ #include "gc/g1/g1FullGCCompactionPoint.hpp" #include "gc/g1/g1FullGCScope.hpp" #include "gc/g1/g1FullGCTask.hpp" -#include "gc/g1/heapRegionManager.hpp" +#include "gc/g1/g1HeapRegionManager.hpp" #include "gc/shared/referenceProcessor.hpp" class G1CollectedHeap; diff --git a/src/hotspot/share/gc/g1/g1FullGCCompactionPoint.cpp b/src/hotspot/share/gc/g1/g1FullGCCompactionPoint.cpp index a1db2aa87ba..7b19aa431be 100644 --- a/src/hotspot/share/gc/g1/g1FullGCCompactionPoint.cpp +++ b/src/hotspot/share/gc/g1/g1FullGCCompactionPoint.cpp @@ -25,7 +25,7 @@ #include "precompiled.hpp" #include "gc/g1/g1FullCollector.inline.hpp" #include "gc/g1/g1FullGCCompactionPoint.hpp" -#include "gc/g1/heapRegion.hpp" +#include "gc/g1/g1HeapRegion.hpp" #include "gc/shared/preservedMarks.inline.hpp" #include "oops/oop.inline.hpp" #include "utilities/debug.hpp" diff --git a/src/hotspot/share/gc/g1/g1FullGCMarkTask.cpp b/src/hotspot/share/gc/g1/g1FullGCMarkTask.cpp index 209e89ae4ab..e27439143d9 100644 --- a/src/hotspot/share/gc/g1/g1FullGCMarkTask.cpp +++ b/src/hotspot/share/gc/g1/g1FullGCMarkTask.cpp @@ -56,7 +56,6 @@ void G1FullGCMarkTask::work(uint worker_id) { // Mark stack is populated, now process and drain it. marker->complete_marking(collector()->oop_queue_set(), collector()->array_queue_set(), &_terminator); - marker->flush_mark_stats_cache(); // This is the point where the entire marking should have completed. assert(marker->oop_stack()->is_empty(), "Marking should have completed"); diff --git a/src/hotspot/share/gc/g1/g1FullGCMarkTask.hpp b/src/hotspot/share/gc/g1/g1FullGCMarkTask.hpp index 5e45b65c65f..cf87bcfa7c8 100644 --- a/src/hotspot/share/gc/g1/g1FullGCMarkTask.hpp +++ b/src/hotspot/share/gc/g1/g1FullGCMarkTask.hpp @@ -28,8 +28,8 @@ #include "gc/g1/g1FullGCCompactionPoint.hpp" #include "gc/g1/g1FullGCScope.hpp" #include "gc/g1/g1FullGCTask.hpp" +#include "gc/g1/g1HeapRegionManager.hpp" #include "gc/g1/g1RootProcessor.hpp" -#include "gc/g1/heapRegionManager.hpp" #include "gc/shared/referenceProcessor.hpp" #include "utilities/ticks.hpp" diff --git a/src/hotspot/share/gc/g1/g1FullGCOopClosures.inline.hpp b/src/hotspot/share/gc/g1/g1FullGCOopClosures.inline.hpp index aa194d16203..f10f884b242 100644 --- a/src/hotspot/share/gc/g1/g1FullGCOopClosures.inline.hpp +++ b/src/hotspot/share/gc/g1/g1FullGCOopClosures.inline.hpp @@ -28,10 +28,10 @@ #include "gc/g1/g1FullGCOopClosures.hpp" #include "gc/g1/g1Allocator.inline.hpp" -#include "gc/g1/g1FullCollector.inline.hpp" #include "gc/g1/g1ConcurrentMarkBitMap.inline.hpp" +#include "gc/g1/g1FullCollector.inline.hpp" #include "gc/g1/g1FullGCMarker.inline.hpp" -#include "gc/g1/heapRegionRemSet.inline.hpp" +#include "gc/g1/g1HeapRegionRemSet.inline.hpp" #include "memory/iterator.inline.hpp" #include "memory/universe.hpp" #include "oops/access.inline.hpp" diff --git a/src/hotspot/share/gc/g1/g1FullGCPrepareTask.cpp b/src/hotspot/share/gc/g1/g1FullGCPrepareTask.cpp index 7cef6029397..e116367133d 100644 --- a/src/hotspot/share/gc/g1/g1FullGCPrepareTask.cpp +++ b/src/hotspot/share/gc/g1/g1FullGCPrepareTask.cpp @@ -30,7 +30,7 @@ #include "gc/g1/g1FullGCMarker.hpp" #include "gc/g1/g1FullGCOopClosures.inline.hpp" #include "gc/g1/g1FullGCPrepareTask.inline.hpp" -#include "gc/g1/heapRegion.inline.hpp" +#include "gc/g1/g1HeapRegion.inline.hpp" #include "gc/shared/gcTraceTime.inline.hpp" #include "gc/shared/referenceProcessor.hpp" #include "logging/log.hpp" diff --git a/src/hotspot/share/gc/g1/g1FullGCPrepareTask.hpp b/src/hotspot/share/gc/g1/g1FullGCPrepareTask.hpp index 7f09f0553e9..9618986dcdd 100644 --- a/src/hotspot/share/gc/g1/g1FullGCPrepareTask.hpp +++ b/src/hotspot/share/gc/g1/g1FullGCPrepareTask.hpp @@ -26,7 +26,7 @@ #define SHARE_GC_G1_G1FULLGCPREPARETASK_HPP #include "gc/g1/g1FullGCTask.hpp" -#include "gc/g1/heapRegion.hpp" +#include "gc/g1/g1HeapRegion.hpp" #include "memory/allocation.hpp" class G1CollectedHeap; diff --git a/src/hotspot/share/gc/g1/g1FullGCPrepareTask.inline.hpp b/src/hotspot/share/gc/g1/g1FullGCPrepareTask.inline.hpp index 2a2add76f48..5cff8e5f412 100644 --- a/src/hotspot/share/gc/g1/g1FullGCPrepareTask.inline.hpp +++ b/src/hotspot/share/gc/g1/g1FullGCPrepareTask.inline.hpp @@ -31,7 +31,7 @@ #include "gc/g1/g1FullCollector.hpp" #include "gc/g1/g1FullGCCompactionPoint.hpp" #include "gc/g1/g1FullGCScope.hpp" -#include "gc/g1/heapRegion.inline.hpp" +#include "gc/g1/g1HeapRegion.inline.hpp" void G1DetermineCompactionQueueClosure::free_empty_humongous_region(HeapRegion* hr) { _g1h->free_humongous_region(hr, nullptr); diff --git a/src/hotspot/share/gc/g1/g1FullGCResetMetadataTask.hpp b/src/hotspot/share/gc/g1/g1FullGCResetMetadataTask.hpp index 25745ff0abc..f424906d563 100644 --- a/src/hotspot/share/gc/g1/g1FullGCResetMetadataTask.hpp +++ b/src/hotspot/share/gc/g1/g1FullGCResetMetadataTask.hpp @@ -25,7 +25,7 @@ #ifndef SHARE_GC_G1_G1FULLGCRESETMETADATATASK_HPP #define SHARE_GC_G1_G1FULLGCRESETMETADATATASK_HPP #include "gc/g1/g1FullGCTask.hpp" -#include "gc/g1/heapRegion.hpp" +#include "gc/g1/g1HeapRegion.hpp" class G1FullGCResetMetadataTask : public G1FullGCTask { G1FullCollector* _collector; diff --git a/src/hotspot/share/gc/g1/g1HRPrinter.cpp b/src/hotspot/share/gc/g1/g1HRPrinter.cpp index af83284f061..7ec4f2a0d96 100644 --- a/src/hotspot/share/gc/g1/g1HRPrinter.cpp +++ b/src/hotspot/share/gc/g1/g1HRPrinter.cpp @@ -24,8 +24,8 @@ #include "precompiled.hpp" +#include "gc/g1/g1HeapRegionSet.hpp" #include "gc/g1/g1HRPrinter.hpp" -#include "gc/g1/heapRegionSet.hpp" void G1HRPrinter::cleanup(FreeRegionList* cleanup_list) { if (is_active()) { diff --git a/src/hotspot/share/gc/g1/g1HRPrinter.hpp b/src/hotspot/share/gc/g1/g1HRPrinter.hpp index 876be95f074..9d6d151084f 100644 --- a/src/hotspot/share/gc/g1/g1HRPrinter.hpp +++ b/src/hotspot/share/gc/g1/g1HRPrinter.hpp @@ -25,7 +25,7 @@ #ifndef SHARE_GC_G1_G1HRPRINTER_HPP #define SHARE_GC_G1_G1HRPRINTER_HPP -#include "gc/g1/heapRegion.hpp" +#include "gc/g1/g1HeapRegion.hpp" #include "logging/log.hpp" #define SKIP_RETIRED_FULL_REGIONS 1 diff --git a/src/hotspot/share/gc/g1/heapRegion.cpp b/src/hotspot/share/gc/g1/g1HeapRegion.cpp similarity index 99% rename from src/hotspot/share/gc/g1/heapRegion.cpp rename to src/hotspot/share/gc/g1/g1HeapRegion.cpp index 69040028d98..cb230ee5988 100644 --- a/src/hotspot/share/gc/g1/heapRegion.cpp +++ b/src/hotspot/share/gc/g1/g1HeapRegion.cpp @@ -29,14 +29,14 @@ #include "gc/g1/g1CollectedHeap.inline.hpp" #include "gc/g1/g1CollectionSet.hpp" #include "gc/g1/g1CollectionSetCandidates.inline.hpp" +#include "gc/g1/g1HeapRegion.inline.hpp" +#include "gc/g1/g1HeapRegionBounds.inline.hpp" +#include "gc/g1/g1HeapRegionManager.inline.hpp" +#include "gc/g1/g1HeapRegionRemSet.inline.hpp" +#include "gc/g1/g1HeapRegionTracer.hpp" #include "gc/g1/g1HeapRegionTraceType.hpp" #include "gc/g1/g1NUMA.hpp" #include "gc/g1/g1OopClosures.inline.hpp" -#include "gc/g1/heapRegion.inline.hpp" -#include "gc/g1/heapRegionBounds.inline.hpp" -#include "gc/g1/heapRegionManager.inline.hpp" -#include "gc/g1/heapRegionRemSet.inline.hpp" -#include "gc/g1/heapRegionTracer.hpp" #include "logging/log.hpp" #include "logging/logStream.hpp" #include "memory/iterator.inline.hpp" diff --git a/src/hotspot/share/gc/g1/heapRegion.hpp b/src/hotspot/share/gc/g1/g1HeapRegion.hpp similarity index 99% rename from src/hotspot/share/gc/g1/heapRegion.hpp rename to src/hotspot/share/gc/g1/g1HeapRegion.hpp index 85f4a9e5f9f..b9187ddfddc 100644 --- a/src/hotspot/share/gc/g1/heapRegion.hpp +++ b/src/hotspot/share/gc/g1/g1HeapRegion.hpp @@ -22,14 +22,14 @@ * */ -#ifndef SHARE_GC_G1_HEAPREGION_HPP -#define SHARE_GC_G1_HEAPREGION_HPP +#ifndef SHARE_GC_G1_G1HEAPREGION_HPP +#define SHARE_GC_G1_G1HEAPREGION_HPP #include "gc/g1/g1BlockOffsetTable.hpp" +#include "gc/g1/g1HeapRegionTracer.hpp" #include "gc/g1/g1HeapRegionTraceType.hpp" +#include "gc/g1/g1HeapRegionType.hpp" #include "gc/g1/g1SurvRateGroup.hpp" -#include "gc/g1/heapRegionTracer.hpp" -#include "gc/g1/heapRegionType.hpp" #include "gc/shared/ageTable.hpp" #include "gc/shared/spaceDecorator.hpp" #include "gc/shared/verifyOption.hpp" @@ -622,4 +622,4 @@ class HeapRegionIndexClosure : public StackObj { bool is_complete() { return _is_complete; } }; -#endif // SHARE_GC_G1_HEAPREGION_HPP +#endif // SHARE_GC_G1_G1HEAPREGION_HPP diff --git a/src/hotspot/share/gc/g1/heapRegion.inline.hpp b/src/hotspot/share/gc/g1/g1HeapRegion.inline.hpp similarity index 99% rename from src/hotspot/share/gc/g1/heapRegion.inline.hpp rename to src/hotspot/share/gc/g1/g1HeapRegion.inline.hpp index 608cc2025a2..146f5aff866 100644 --- a/src/hotspot/share/gc/g1/heapRegion.inline.hpp +++ b/src/hotspot/share/gc/g1/g1HeapRegion.inline.hpp @@ -22,10 +22,10 @@ * */ -#ifndef SHARE_GC_G1_HEAPREGION_INLINE_HPP -#define SHARE_GC_G1_HEAPREGION_INLINE_HPP +#ifndef SHARE_GC_G1_G1HEAPREGION_INLINE_HPP +#define SHARE_GC_G1_G1HEAPREGION_INLINE_HPP -#include "gc/g1/heapRegion.hpp" +#include "gc/g1/g1HeapRegion.hpp" #include "classfile/vmClasses.hpp" #include "gc/g1/g1BlockOffsetTable.inline.hpp" @@ -559,4 +559,4 @@ inline void HeapRegion::add_pinned_object_count(size_t value) { Atomic::add(&_pinned_object_count, value, memory_order_relaxed); } -#endif // SHARE_GC_G1_HEAPREGION_INLINE_HPP +#endif // SHARE_GC_G1_G1HEAPREGION_INLINE_HPP diff --git a/src/hotspot/share/gc/g1/g1HeapRegionAttr.hpp b/src/hotspot/share/gc/g1/g1HeapRegionAttr.hpp index e5a10858ed1..c3c7b94e287 100644 --- a/src/hotspot/share/gc/g1/g1HeapRegionAttr.hpp +++ b/src/hotspot/share/gc/g1/g1HeapRegionAttr.hpp @@ -26,7 +26,7 @@ #define SHARE_GC_G1_G1HEAPREGIONATTR_HPP #include "gc/g1/g1BiasedArray.hpp" -#include "gc/g1/heapRegion.hpp" +#include "gc/g1/g1HeapRegion.hpp" // Per-region attributes often used during garbage collection to avoid costly // lookups for that information all over the place. diff --git a/src/hotspot/share/gc/g1/heapRegionBounds.hpp b/src/hotspot/share/gc/g1/g1HeapRegionBounds.hpp similarity index 94% rename from src/hotspot/share/gc/g1/heapRegionBounds.hpp rename to src/hotspot/share/gc/g1/g1HeapRegionBounds.hpp index 5a6db9fac3b..3cde2f77d4a 100644 --- a/src/hotspot/share/gc/g1/heapRegionBounds.hpp +++ b/src/hotspot/share/gc/g1/g1HeapRegionBounds.hpp @@ -22,8 +22,8 @@ * */ -#ifndef SHARE_GC_G1_HEAPREGIONBOUNDS_HPP -#define SHARE_GC_G1_HEAPREGIONBOUNDS_HPP +#ifndef SHARE_GC_G1_G1HEAPREGIONBOUNDS_HPP +#define SHARE_GC_G1_G1HEAPREGIONBOUNDS_HPP #include "memory/allStatic.hpp" #include "utilities/globalDefinitions.hpp" @@ -55,4 +55,4 @@ class HeapRegionBounds : public AllStatic { static inline size_t target_number(); }; -#endif // SHARE_GC_G1_HEAPREGIONBOUNDS_HPP +#endif // SHARE_GC_G1_G1HEAPREGIONBOUNDS_HPP diff --git a/src/hotspot/share/gc/g1/heapRegionBounds.inline.hpp b/src/hotspot/share/gc/g1/g1HeapRegionBounds.inline.hpp similarity index 87% rename from src/hotspot/share/gc/g1/heapRegionBounds.inline.hpp rename to src/hotspot/share/gc/g1/g1HeapRegionBounds.inline.hpp index 73a44bcf179..473057144d3 100644 --- a/src/hotspot/share/gc/g1/heapRegionBounds.inline.hpp +++ b/src/hotspot/share/gc/g1/g1HeapRegionBounds.inline.hpp @@ -22,10 +22,10 @@ * */ -#ifndef SHARE_GC_G1_HEAPREGIONBOUNDS_INLINE_HPP -#define SHARE_GC_G1_HEAPREGIONBOUNDS_INLINE_HPP +#ifndef SHARE_GC_G1_G1HEAPREGIONBOUNDS_INLINE_HPP +#define SHARE_GC_G1_G1HEAPREGIONBOUNDS_INLINE_HPP -#include "gc/g1/heapRegionBounds.hpp" +#include "gc/g1/g1HeapRegionBounds.hpp" size_t HeapRegionBounds::min_size() { return MIN_REGION_SIZE; @@ -43,4 +43,4 @@ size_t HeapRegionBounds::target_number() { return TARGET_REGION_NUMBER; } -#endif // SHARE_GC_G1_HEAPREGIONBOUNDS_INLINE_HPP +#endif // SHARE_GC_G1_G1HEAPREGIONBOUNDS_INLINE_HPP diff --git a/src/hotspot/share/gc/g1/g1HeapRegionEventSender.cpp b/src/hotspot/share/gc/g1/g1HeapRegionEventSender.cpp index 19433e39c32..5dce9b2aa90 100644 --- a/src/hotspot/share/gc/g1/g1HeapRegionEventSender.cpp +++ b/src/hotspot/share/gc/g1/g1HeapRegionEventSender.cpp @@ -24,8 +24,8 @@ #include "precompiled.hpp" #include "gc/g1/g1CollectedHeap.hpp" +#include "gc/g1/g1HeapRegion.hpp" #include "gc/g1/g1HeapRegionEventSender.hpp" -#include "gc/g1/heapRegion.hpp" #include "gc/shared/gc_globals.hpp" #include "jfr/jfrEvents.hpp" #include "runtime/vmThread.hpp" diff --git a/src/hotspot/share/gc/g1/heapRegionManager.cpp b/src/hotspot/share/gc/g1/g1HeapRegionManager.cpp similarity index 99% rename from src/hotspot/share/gc/g1/heapRegionManager.cpp rename to src/hotspot/share/gc/g1/g1HeapRegionManager.cpp index 455aacc0931..0fb8e7499d6 100644 --- a/src/hotspot/share/gc/g1/heapRegionManager.cpp +++ b/src/hotspot/share/gc/g1/g1HeapRegionManager.cpp @@ -27,10 +27,10 @@ #include "gc/g1/g1CollectedHeap.inline.hpp" #include "gc/g1/g1ConcurrentRefine.hpp" #include "gc/g1/g1CommittedRegionMap.inline.hpp" +#include "gc/g1/g1HeapRegion.hpp" +#include "gc/g1/g1HeapRegionManager.inline.hpp" +#include "gc/g1/g1HeapRegionSet.inline.hpp" #include "gc/g1/g1NUMAStats.hpp" -#include "gc/g1/heapRegion.hpp" -#include "gc/g1/heapRegionManager.inline.hpp" -#include "gc/g1/heapRegionSet.inline.hpp" #include "jfr/jfrEvents.hpp" #include "logging/logStream.hpp" #include "memory/allocation.hpp" diff --git a/src/hotspot/share/gc/g1/heapRegionManager.hpp b/src/hotspot/share/gc/g1/g1HeapRegionManager.hpp similarity index 98% rename from src/hotspot/share/gc/g1/heapRegionManager.hpp rename to src/hotspot/share/gc/g1/g1HeapRegionManager.hpp index 0a84010e73c..8ecb5d6d66f 100644 --- a/src/hotspot/share/gc/g1/heapRegionManager.hpp +++ b/src/hotspot/share/gc/g1/g1HeapRegionManager.hpp @@ -22,13 +22,13 @@ * */ -#ifndef SHARE_GC_G1_HEAPREGIONMANAGER_HPP -#define SHARE_GC_G1_HEAPREGIONMANAGER_HPP +#ifndef SHARE_GC_G1_G1HEAPREGIONMANAGER_HPP +#define SHARE_GC_G1_G1HEAPREGIONMANAGER_HPP #include "gc/g1/g1BiasedArray.hpp" #include "gc/g1/g1CommittedRegionMap.hpp" +#include "gc/g1/g1HeapRegionSet.hpp" #include "gc/g1/g1RegionToSpaceMapper.hpp" -#include "gc/g1/heapRegionSet.hpp" #include "memory/allocation.hpp" #include "services/memoryUsage.hpp" @@ -326,4 +326,4 @@ class HeapRegionClaimer : public StackObj { // Claim the given region, returns true if successfully claimed. bool claim_region(uint region_index); }; -#endif // SHARE_GC_G1_HEAPREGIONMANAGER_HPP +#endif // SHARE_GC_G1_G1HEAPREGIONMANAGER_HPP diff --git a/src/hotspot/share/gc/g1/heapRegionManager.inline.hpp b/src/hotspot/share/gc/g1/g1HeapRegionManager.inline.hpp similarity index 91% rename from src/hotspot/share/gc/g1/heapRegionManager.inline.hpp rename to src/hotspot/share/gc/g1/g1HeapRegionManager.inline.hpp index 1bcba292ffa..9768ee358ba 100644 --- a/src/hotspot/share/gc/g1/heapRegionManager.inline.hpp +++ b/src/hotspot/share/gc/g1/g1HeapRegionManager.inline.hpp @@ -22,14 +22,14 @@ * */ -#ifndef SHARE_GC_G1_HEAPREGIONMANAGER_INLINE_HPP -#define SHARE_GC_G1_HEAPREGIONMANAGER_INLINE_HPP +#ifndef SHARE_GC_G1_G1HEAPREGIONMANAGER_INLINE_HPP +#define SHARE_GC_G1_G1HEAPREGIONMANAGER_INLINE_HPP -#include "gc/g1/heapRegionManager.hpp" +#include "gc/g1/g1HeapRegionManager.hpp" #include "gc/g1/g1CommittedRegionMap.inline.hpp" -#include "gc/g1/heapRegion.hpp" -#include "gc/g1/heapRegionSet.inline.hpp" +#include "gc/g1/g1HeapRegion.hpp" +#include "gc/g1/g1HeapRegionSet.inline.hpp" inline bool HeapRegionManager::is_available(uint region) const { return _committed_map.active(region); @@ -83,4 +83,4 @@ inline HeapRegion* HeapRegionManager::allocate_free_regions_starting_at(uint fir return start; } -#endif // SHARE_GC_G1_HEAPREGIONMANAGER_INLINE_HPP +#endif // SHARE_GC_G1_G1HEAPREGIONMANAGER_INLINE_HPP diff --git a/src/hotspot/share/gc/g1/heapRegionRemSet.cpp b/src/hotspot/share/gc/g1/g1HeapRegionRemSet.cpp similarity index 97% rename from src/hotspot/share/gc/g1/heapRegionRemSet.cpp rename to src/hotspot/share/gc/g1/g1HeapRegionRemSet.cpp index 19b383a08a3..88a3e09bd8e 100644 --- a/src/hotspot/share/gc/g1/heapRegionRemSet.cpp +++ b/src/hotspot/share/gc/g1/g1HeapRegionRemSet.cpp @@ -29,8 +29,8 @@ #include "gc/g1/g1CardSetContainers.inline.hpp" #include "gc/g1/g1CollectedHeap.inline.hpp" #include "gc/g1/g1ConcurrentRefine.hpp" -#include "gc/g1/heapRegionManager.inline.hpp" -#include "gc/g1/heapRegionRemSet.inline.hpp" +#include "gc/g1/g1HeapRegionManager.inline.hpp" +#include "gc/g1/g1HeapRegionRemSet.inline.hpp" #include "memory/allocation.hpp" #include "memory/padded.inline.hpp" #include "oops/oop.inline.hpp" diff --git a/src/hotspot/share/gc/g1/heapRegionRemSet.hpp b/src/hotspot/share/gc/g1/g1HeapRegionRemSet.hpp similarity index 97% rename from src/hotspot/share/gc/g1/heapRegionRemSet.hpp rename to src/hotspot/share/gc/g1/g1HeapRegionRemSet.hpp index 2e5ae7b1c30..7e76965835b 100644 --- a/src/hotspot/share/gc/g1/heapRegionRemSet.hpp +++ b/src/hotspot/share/gc/g1/g1HeapRegionRemSet.hpp @@ -22,8 +22,8 @@ * */ -#ifndef SHARE_GC_G1_HEAPREGIONREMSET_HPP -#define SHARE_GC_G1_HEAPREGIONREMSET_HPP +#ifndef SHARE_GC_G1_G1HEAPREGIONREMSET_HPP +#define SHARE_GC_G1_G1HEAPREGIONREMSET_HPP #include "gc/g1/g1CardSet.hpp" #include "gc/g1/g1CardSetMemory.hpp" @@ -185,4 +185,4 @@ class HeapRegionRemSet : public CHeapObj { #endif }; -#endif // SHARE_GC_G1_HEAPREGIONREMSET_HPP +#endif // SHARE_GC_G1_G1HEAPREGIONREMSET_HPP diff --git a/src/hotspot/share/gc/g1/heapRegionRemSet.inline.hpp b/src/hotspot/share/gc/g1/g1HeapRegionRemSet.inline.hpp similarity index 95% rename from src/hotspot/share/gc/g1/heapRegionRemSet.inline.hpp rename to src/hotspot/share/gc/g1/g1HeapRegionRemSet.inline.hpp index ca8f675e6df..78153cc0c30 100644 --- a/src/hotspot/share/gc/g1/heapRegionRemSet.inline.hpp +++ b/src/hotspot/share/gc/g1/g1HeapRegionRemSet.inline.hpp @@ -22,14 +22,14 @@ * */ -#ifndef SHARE_VM_GC_G1_HEAPREGIONREMSET_INLINE_HPP -#define SHARE_VM_GC_G1_HEAPREGIONREMSET_INLINE_HPP +#ifndef SHARE_VM_GC_G1_G1HEAPREGIONREMSET_INLINE_HPP +#define SHARE_VM_GC_G1_G1HEAPREGIONREMSET_INLINE_HPP -#include "gc/g1/heapRegionRemSet.hpp" +#include "gc/g1/g1HeapRegionRemSet.hpp" #include "gc/g1/g1CardSet.inline.hpp" #include "gc/g1/g1CollectedHeap.inline.hpp" -#include "gc/g1/heapRegion.inline.hpp" +#include "gc/g1/g1HeapRegion.inline.hpp" #include "runtime/atomic.hpp" #include "utilities/bitMap.inline.hpp" @@ -144,4 +144,4 @@ void HeapRegionRemSet::print_info(outputStream* st, OopOrNarrowOopStar from) { _card_set.print_info(st, to_card(from)); } -#endif // SHARE_VM_GC_G1_HEAPREGIONREMSET_INLINE_HPP +#endif // SHARE_VM_GC_G1_G1HEAPREGIONREMSET_INLINE_HPP diff --git a/src/hotspot/share/gc/g1/heapRegionSet.cpp b/src/hotspot/share/gc/g1/g1HeapRegionSet.cpp similarity index 99% rename from src/hotspot/share/gc/g1/heapRegionSet.cpp rename to src/hotspot/share/gc/g1/g1HeapRegionSet.cpp index 7243677ede8..832770ddb4c 100644 --- a/src/hotspot/share/gc/g1/heapRegionSet.cpp +++ b/src/hotspot/share/gc/g1/g1HeapRegionSet.cpp @@ -24,9 +24,9 @@ #include "precompiled.hpp" #include "gc/g1/g1CollectedHeap.inline.hpp" +#include "gc/g1/g1HeapRegionRemSet.inline.hpp" +#include "gc/g1/g1HeapRegionSet.inline.hpp" #include "gc/g1/g1NUMA.hpp" -#include "gc/g1/heapRegionRemSet.inline.hpp" -#include "gc/g1/heapRegionSet.inline.hpp" uint FreeRegionList::_unrealistically_long_length = 0; diff --git a/src/hotspot/share/gc/g1/heapRegionSet.hpp b/src/hotspot/share/gc/g1/g1HeapRegionSet.hpp similarity index 98% rename from src/hotspot/share/gc/g1/heapRegionSet.hpp rename to src/hotspot/share/gc/g1/g1HeapRegionSet.hpp index 5db2fbb696a..bfc60992c3d 100644 --- a/src/hotspot/share/gc/g1/heapRegionSet.hpp +++ b/src/hotspot/share/gc/g1/g1HeapRegionSet.hpp @@ -22,10 +22,10 @@ * */ -#ifndef SHARE_GC_G1_HEAPREGIONSET_HPP -#define SHARE_GC_G1_HEAPREGIONSET_HPP +#ifndef SHARE_GC_G1_G1HEAPREGIONSET_HPP +#define SHARE_GC_G1_G1HEAPREGIONSET_HPP -#include "gc/g1/heapRegion.hpp" +#include "gc/g1/g1HeapRegion.hpp" #include "utilities/macros.hpp" #define assert_heap_region_set(p, message) \ @@ -271,4 +271,4 @@ class FreeRegionListIterator : public StackObj { } }; -#endif // SHARE_GC_G1_HEAPREGIONSET_HPP +#endif // SHARE_GC_G1_G1HEAPREGIONSET_HPP diff --git a/src/hotspot/share/gc/g1/heapRegionSet.inline.hpp b/src/hotspot/share/gc/g1/g1HeapRegionSet.inline.hpp similarity index 97% rename from src/hotspot/share/gc/g1/heapRegionSet.inline.hpp rename to src/hotspot/share/gc/g1/g1HeapRegionSet.inline.hpp index 0d7c7ed315d..fbd19466d9f 100644 --- a/src/hotspot/share/gc/g1/heapRegionSet.inline.hpp +++ b/src/hotspot/share/gc/g1/g1HeapRegionSet.inline.hpp @@ -22,10 +22,10 @@ * */ -#ifndef SHARE_GC_G1_HEAPREGIONSET_INLINE_HPP -#define SHARE_GC_G1_HEAPREGIONSET_INLINE_HPP +#ifndef SHARE_GC_G1_G1HEAPREGIONSET_INLINE_HPP +#define SHARE_GC_G1_G1HEAPREGIONSET_INLINE_HPP -#include "gc/g1/heapRegionSet.hpp" +#include "gc/g1/g1HeapRegionSet.hpp" #include "gc/g1/g1NUMA.hpp" @@ -271,4 +271,4 @@ inline uint FreeRegionList::length(uint node_index) const { } } -#endif // SHARE_GC_G1_HEAPREGIONSET_INLINE_HPP +#endif // SHARE_GC_G1_G1HEAPREGIONSET_INLINE_HPP diff --git a/src/hotspot/share/gc/g1/heapRegionTracer.cpp b/src/hotspot/share/gc/g1/g1HeapRegionTracer.cpp similarity index 97% rename from src/hotspot/share/gc/g1/heapRegionTracer.cpp rename to src/hotspot/share/gc/g1/g1HeapRegionTracer.cpp index e039ae219a1..c66ae0cb069 100644 --- a/src/hotspot/share/gc/g1/heapRegionTracer.cpp +++ b/src/hotspot/share/gc/g1/g1HeapRegionTracer.cpp @@ -23,7 +23,7 @@ */ #include "precompiled.hpp" -#include "gc/g1/heapRegionTracer.hpp" +#include "gc/g1/g1HeapRegionTracer.hpp" #include "jfr/jfrEvents.hpp" void HeapRegionTracer::send_region_type_change(uint index, diff --git a/src/hotspot/share/gc/g1/heapRegionTracer.hpp b/src/hotspot/share/gc/g1/g1HeapRegionTracer.hpp similarity index 92% rename from src/hotspot/share/gc/g1/heapRegionTracer.hpp rename to src/hotspot/share/gc/g1/g1HeapRegionTracer.hpp index 647744d0d5e..137bc6189ae 100644 --- a/src/hotspot/share/gc/g1/heapRegionTracer.hpp +++ b/src/hotspot/share/gc/g1/g1HeapRegionTracer.hpp @@ -22,8 +22,8 @@ * */ -#ifndef SHARE_GC_G1_HEAPREGIONTRACER_HPP -#define SHARE_GC_G1_HEAPREGIONTRACER_HPP +#ifndef SHARE_GC_G1_G1HEAPREGIONTRACER_HPP +#define SHARE_GC_G1_G1HEAPREGIONTRACER_HPP #include "gc/g1/g1HeapRegionTraceType.hpp" #include "memory/allStatic.hpp" @@ -38,4 +38,4 @@ class HeapRegionTracer : AllStatic { size_t used); }; -#endif // SHARE_GC_G1_HEAPREGIONTRACER_HPP +#endif // SHARE_GC_G1_G1HEAPREGIONTRACER_HPP diff --git a/src/hotspot/share/gc/g1/heapRegionType.cpp b/src/hotspot/share/gc/g1/g1HeapRegionType.cpp similarity index 98% rename from src/hotspot/share/gc/g1/heapRegionType.cpp rename to src/hotspot/share/gc/g1/g1HeapRegionType.cpp index bb5c4e9392c..e55759b3bf3 100644 --- a/src/hotspot/share/gc/g1/heapRegionType.cpp +++ b/src/hotspot/share/gc/g1/g1HeapRegionType.cpp @@ -24,7 +24,7 @@ #include "precompiled.hpp" #include "gc/g1/g1HeapRegionTraceType.hpp" -#include "gc/g1/heapRegionType.hpp" +#include "gc/g1/g1HeapRegionType.hpp" const HeapRegionType HeapRegionType::Eden = HeapRegionType(EdenTag); const HeapRegionType HeapRegionType::Survivor = HeapRegionType(SurvTag); diff --git a/src/hotspot/share/gc/g1/heapRegionType.hpp b/src/hotspot/share/gc/g1/g1HeapRegionType.hpp similarity index 97% rename from src/hotspot/share/gc/g1/heapRegionType.hpp rename to src/hotspot/share/gc/g1/g1HeapRegionType.hpp index 85a89f77a94..b62699cc3fb 100644 --- a/src/hotspot/share/gc/g1/heapRegionType.hpp +++ b/src/hotspot/share/gc/g1/g1HeapRegionType.hpp @@ -22,8 +22,8 @@ * */ -#ifndef SHARE_GC_G1_HEAPREGIONTYPE_HPP -#define SHARE_GC_G1_HEAPREGIONTYPE_HPP +#ifndef SHARE_GC_G1_G1HEAPREGIONTYPE_HPP +#define SHARE_GC_G1_G1HEAPREGIONTYPE_HPP #include "gc/g1/g1HeapRegionTraceType.hpp" #include "utilities/globalDefinitions.hpp" @@ -167,4 +167,4 @@ friend class VMStructs; static const HeapRegionType Humongous; }; -#endif // SHARE_GC_G1_HEAPREGIONTYPE_HPP +#endif // SHARE_GC_G1_G1HEAPREGIONTYPE_HPP diff --git a/src/hotspot/share/gc/g1/g1HeapVerifier.cpp b/src/hotspot/share/gc/g1/g1HeapVerifier.cpp index 6cca6e8b056..b7484727e1f 100644 --- a/src/hotspot/share/gc/g1/g1HeapVerifier.cpp +++ b/src/hotspot/share/gc/g1/g1HeapVerifier.cpp @@ -27,12 +27,12 @@ #include "gc/g1/g1Allocator.inline.hpp" #include "gc/g1/g1CollectedHeap.inline.hpp" #include "gc/g1/g1ConcurrentMarkThread.hpp" +#include "gc/g1/g1HeapRegion.inline.hpp" +#include "gc/g1/g1HeapRegionRemSet.hpp" #include "gc/g1/g1HeapVerifier.hpp" #include "gc/g1/g1Policy.hpp" #include "gc/g1/g1RemSet.hpp" #include "gc/g1/g1RootProcessor.hpp" -#include "gc/g1/heapRegion.inline.hpp" -#include "gc/g1/heapRegionRemSet.hpp" #include "gc/shared/tlab_globals.hpp" #include "logging/log.hpp" #include "logging/logStream.hpp" diff --git a/src/hotspot/share/gc/g1/g1HeapVerifier.hpp b/src/hotspot/share/gc/g1/g1HeapVerifier.hpp index f10787c528e..221ae957648 100644 --- a/src/hotspot/share/gc/g1/g1HeapVerifier.hpp +++ b/src/hotspot/share/gc/g1/g1HeapVerifier.hpp @@ -25,7 +25,7 @@ #ifndef SHARE_GC_G1_G1HEAPVERIFIER_HPP #define SHARE_GC_G1_G1HEAPVERIFIER_HPP -#include "gc/g1/heapRegionSet.hpp" +#include "gc/g1/g1HeapRegionSet.hpp" #include "gc/shared/verifyOption.hpp" #include "memory/allocation.hpp" #include "utilities/macros.hpp" diff --git a/src/hotspot/share/gc/g1/g1MemoryPool.cpp b/src/hotspot/share/gc/g1/g1MemoryPool.cpp index 428d2db212e..f924e5a7e65 100644 --- a/src/hotspot/share/gc/g1/g1MemoryPool.cpp +++ b/src/hotspot/share/gc/g1/g1MemoryPool.cpp @@ -24,8 +24,8 @@ #include "precompiled.hpp" #include "gc/g1/g1CollectedHeap.hpp" +#include "gc/g1/g1HeapRegion.hpp" #include "gc/g1/g1MemoryPool.hpp" -#include "gc/g1/heapRegion.hpp" #include "gc/shared/gc_globals.hpp" G1MemoryPoolSuper::G1MemoryPoolSuper(G1CollectedHeap* g1h, diff --git a/src/hotspot/share/gc/g1/g1MonotonicArenaFreeMemoryTask.cpp b/src/hotspot/share/gc/g1/g1MonotonicArenaFreeMemoryTask.cpp index 4ba4469bd96..337acfe2405 100644 --- a/src/hotspot/share/gc/g1/g1MonotonicArenaFreeMemoryTask.cpp +++ b/src/hotspot/share/gc/g1/g1MonotonicArenaFreeMemoryTask.cpp @@ -26,10 +26,10 @@ #include "ci/ciUtilities.hpp" #include "gc/g1/g1CardSetMemory.inline.hpp" #include "gc/g1/g1CollectedHeap.hpp" +#include "gc/g1/g1HeapRegionRemSet.hpp" #include "gc/g1/g1MonotonicArenaFreeMemoryTask.hpp" #include "gc/g1/g1MonotonicArenaFreePool.hpp" #include "gc/g1/g1_globals.hpp" -#include "gc/g1/heapRegionRemSet.hpp" #include "gc/shared/gc_globals.hpp" #include "gc/shared/gcTraceTime.inline.hpp" #include "gc/shared/suspendibleThreadSet.hpp" diff --git a/src/hotspot/share/gc/g1/g1MonotonicArenaFreeMemoryTask.hpp b/src/hotspot/share/gc/g1/g1MonotonicArenaFreeMemoryTask.hpp index 88611c63b5c..d55c844037c 100644 --- a/src/hotspot/share/gc/g1/g1MonotonicArenaFreeMemoryTask.hpp +++ b/src/hotspot/share/gc/g1/g1MonotonicArenaFreeMemoryTask.hpp @@ -26,9 +26,9 @@ #define SHARE_GC_G1_G1MONOTONICARENAFREEMEMORYTASK_HPP #include "gc/g1/g1CardSetMemory.hpp" +#include "gc/g1/g1HeapRegionRemSet.hpp" #include "gc/g1/g1MonotonicArenaFreePool.hpp" #include "gc/g1/g1ServiceThread.hpp" -#include "gc/g1/heapRegionRemSet.hpp" #include "utilities/growableArray.hpp" #include "utilities/ticks.hpp" diff --git a/src/hotspot/share/gc/g1/g1NUMA.hpp b/src/hotspot/share/gc/g1/g1NUMA.hpp index acf5a114aeb..cbefab411df 100644 --- a/src/hotspot/share/gc/g1/g1NUMA.hpp +++ b/src/hotspot/share/gc/g1/g1NUMA.hpp @@ -25,8 +25,8 @@ #ifndef SHARE_VM_GC_G1_NUMA_HPP #define SHARE_VM_GC_G1_NUMA_HPP +#include "gc/g1/g1HeapRegion.hpp" #include "gc/g1/g1NUMAStats.hpp" -#include "gc/g1/heapRegion.hpp" #include "memory/allocation.hpp" #include "runtime/os.hpp" diff --git a/src/hotspot/share/gc/g1/g1OldGenAllocationTracker.hpp b/src/hotspot/share/gc/g1/g1OldGenAllocationTracker.hpp index 13890c026b2..eb86b81d2ab 100644 --- a/src/hotspot/share/gc/g1/g1OldGenAllocationTracker.hpp +++ b/src/hotspot/share/gc/g1/g1OldGenAllocationTracker.hpp @@ -25,7 +25,7 @@ #ifndef SHARE_VM_GC_G1_G1OLDGENALLOCATIONTRACKER_HPP #define SHARE_VM_GC_G1_G1OLDGENALLOCATIONTRACKER_HPP -#include "gc/g1/heapRegion.hpp" +#include "gc/g1/g1HeapRegion.hpp" #include "memory/allocation.hpp" class G1AdaptiveIHOPControl; diff --git a/src/hotspot/share/gc/g1/g1OopClosures.inline.hpp b/src/hotspot/share/gc/g1/g1OopClosures.inline.hpp index ea7f690d325..9eebfbd6a86 100644 --- a/src/hotspot/share/gc/g1/g1OopClosures.inline.hpp +++ b/src/hotspot/share/gc/g1/g1OopClosures.inline.hpp @@ -29,10 +29,10 @@ #include "gc/g1/g1CollectedHeap.inline.hpp" #include "gc/g1/g1ConcurrentMark.inline.hpp" +#include "gc/g1/g1HeapRegion.inline.hpp" +#include "gc/g1/g1HeapRegionRemSet.inline.hpp" #include "gc/g1/g1ParScanThreadState.inline.hpp" #include "gc/g1/g1RemSet.hpp" -#include "gc/g1/heapRegion.inline.hpp" -#include "gc/g1/heapRegionRemSet.inline.hpp" #include "logging/log.hpp" #include "logging/logStream.hpp" #include "memory/iterator.inline.hpp" diff --git a/src/hotspot/share/gc/g1/g1Policy.cpp b/src/hotspot/share/gc/g1/g1Policy.cpp index 9e22acc73ca..10227dfe2ad 100644 --- a/src/hotspot/share/gc/g1/g1Policy.cpp +++ b/src/hotspot/share/gc/g1/g1Policy.cpp @@ -34,13 +34,13 @@ #include "gc/g1/g1ConcurrentRefine.hpp" #include "gc/g1/g1ConcurrentRefineStats.hpp" #include "gc/g1/g1CollectionSetChooser.hpp" +#include "gc/g1/g1HeapRegion.inline.hpp" +#include "gc/g1/g1HeapRegionRemSet.inline.hpp" #include "gc/g1/g1IHOPControl.hpp" #include "gc/g1/g1GCPhaseTimes.hpp" #include "gc/g1/g1Policy.hpp" #include "gc/g1/g1SurvivorRegions.hpp" #include "gc/g1/g1YoungGenSizer.hpp" -#include "gc/g1/heapRegion.inline.hpp" -#include "gc/g1/heapRegionRemSet.inline.hpp" #include "gc/shared/concurrentGCBreakpoints.hpp" #include "gc/shared/gcPolicyCounters.hpp" #include "logging/log.hpp" diff --git a/src/hotspot/share/gc/g1/g1RegionPinCache.hpp b/src/hotspot/share/gc/g1/g1RegionPinCache.hpp index 6df1c1793c2..1c04936930a 100644 --- a/src/hotspot/share/gc/g1/g1RegionPinCache.hpp +++ b/src/hotspot/share/gc/g1/g1RegionPinCache.hpp @@ -25,7 +25,7 @@ #ifndef SHARE_GC_G1_G1REGIONPINCACHE_HPP #define SHARE_GC_G1_G1REGIONPINCACHE_HPP -#include "gc/g1/heapRegion.hpp" +#include "gc/g1/g1HeapRegion.hpp" #include "memory/allocation.hpp" #include "utilities/globalDefinitions.hpp" diff --git a/src/hotspot/share/gc/g1/g1RegionsOnNodes.cpp b/src/hotspot/share/gc/g1/g1RegionsOnNodes.cpp index 5ec3c759369..88a4b9611dc 100644 --- a/src/hotspot/share/gc/g1/g1RegionsOnNodes.cpp +++ b/src/hotspot/share/gc/g1/g1RegionsOnNodes.cpp @@ -23,9 +23,9 @@ */ #include "precompiled.hpp" +#include "gc/g1/g1HeapRegion.hpp" #include "gc/g1/g1NUMA.hpp" #include "gc/g1/g1RegionsOnNodes.hpp" -#include "gc/g1/heapRegion.hpp" G1RegionsOnNodes::G1RegionsOnNodes() : _count_per_node(nullptr), _numa(G1NUMA::numa()) { _count_per_node = NEW_C_HEAP_ARRAY(uint, _numa->num_active_nodes(), mtGC); diff --git a/src/hotspot/share/gc/g1/g1RemSet.cpp b/src/hotspot/share/gc/g1/g1RemSet.cpp index d26a77837d7..21127952214 100644 --- a/src/hotspot/share/gc/g1/g1RemSet.cpp +++ b/src/hotspot/share/gc/g1/g1RemSet.cpp @@ -35,14 +35,14 @@ #include "gc/g1/g1FromCardCache.hpp" #include "gc/g1/g1GCParPhaseTimesTracker.hpp" #include "gc/g1/g1GCPhaseTimes.hpp" +#include "gc/g1/g1HeapRegion.inline.hpp" +#include "gc/g1/g1HeapRegionManager.inline.hpp" +#include "gc/g1/g1HeapRegionRemSet.inline.hpp" #include "gc/g1/g1OopClosures.inline.hpp" #include "gc/g1/g1Policy.hpp" #include "gc/g1/g1RootClosures.hpp" #include "gc/g1/g1RemSet.hpp" #include "gc/g1/g1_globals.hpp" -#include "gc/g1/heapRegion.inline.hpp" -#include "gc/g1/heapRegionManager.inline.hpp" -#include "gc/g1/heapRegionRemSet.inline.hpp" #include "gc/shared/bufferNode.hpp" #include "gc/shared/bufferNodeList.hpp" #include "gc/shared/gcTraceTime.inline.hpp" diff --git a/src/hotspot/share/gc/g1/g1RemSet.hpp b/src/hotspot/share/gc/g1/g1RemSet.hpp index 053fc39aa83..f38e5e7f0f4 100644 --- a/src/hotspot/share/gc/g1/g1RemSet.hpp +++ b/src/hotspot/share/gc/g1/g1RemSet.hpp @@ -26,10 +26,10 @@ #define SHARE_GC_G1_G1REMSET_HPP #include "gc/g1/g1CardTable.hpp" -#include "gc/g1/g1OopClosures.hpp" #include "gc/g1/g1GCPhaseTimes.hpp" +#include "gc/g1/g1HeapRegion.hpp" +#include "gc/g1/g1OopClosures.hpp" #include "gc/g1/g1RemSetSummary.hpp" -#include "gc/g1/heapRegion.hpp" #include "memory/allocation.hpp" #include "memory/iterator.hpp" #include "utilities/ticks.hpp" diff --git a/src/hotspot/share/gc/g1/g1RemSetSummary.cpp b/src/hotspot/share/gc/g1/g1RemSetSummary.cpp index 4156e85fbfa..0cd1823a8ee 100644 --- a/src/hotspot/share/gc/g1/g1RemSetSummary.cpp +++ b/src/hotspot/share/gc/g1/g1RemSetSummary.cpp @@ -29,10 +29,10 @@ #include "gc/g1/g1ConcurrentRefine.hpp" #include "gc/g1/g1ConcurrentRefineThread.hpp" #include "gc/g1/g1DirtyCardQueue.hpp" +#include "gc/g1/g1HeapRegion.hpp" +#include "gc/g1/g1HeapRegionRemSet.inline.hpp" #include "gc/g1/g1RemSet.hpp" #include "gc/g1/g1RemSetSummary.hpp" -#include "gc/g1/heapRegion.hpp" -#include "gc/g1/heapRegionRemSet.inline.hpp" #include "memory/allocation.inline.hpp" #include "memory/iterator.hpp" #include "runtime/javaThread.hpp" diff --git a/src/hotspot/share/gc/g1/g1RemSetTrackingPolicy.cpp b/src/hotspot/share/gc/g1/g1RemSetTrackingPolicy.cpp index c227b625b8d..8738e2bc886 100644 --- a/src/hotspot/share/gc/g1/g1RemSetTrackingPolicy.cpp +++ b/src/hotspot/share/gc/g1/g1RemSetTrackingPolicy.cpp @@ -24,9 +24,9 @@ #include "precompiled.hpp" #include "gc/g1/g1CollectionSetChooser.hpp" +#include "gc/g1/g1HeapRegion.inline.hpp" +#include "gc/g1/g1HeapRegionRemSet.inline.hpp" #include "gc/g1/g1RemSetTrackingPolicy.hpp" -#include "gc/g1/heapRegion.inline.hpp" -#include "gc/g1/heapRegionRemSet.inline.hpp" #include "runtime/safepoint.hpp" bool G1RemSetTrackingPolicy::needs_scan_for_rebuild(HeapRegion* r) const { diff --git a/src/hotspot/share/gc/g1/g1RemSetTrackingPolicy.hpp b/src/hotspot/share/gc/g1/g1RemSetTrackingPolicy.hpp index 2c2734d4abf..94ff2734fbf 100644 --- a/src/hotspot/share/gc/g1/g1RemSetTrackingPolicy.hpp +++ b/src/hotspot/share/gc/g1/g1RemSetTrackingPolicy.hpp @@ -25,8 +25,8 @@ #ifndef SHARE_GC_G1_G1REMSETTRACKINGPOLICY_HPP #define SHARE_GC_G1_G1REMSETTRACKINGPOLICY_HPP -#include "gc/g1/heapRegion.hpp" -#include "gc/g1/heapRegionType.hpp" +#include "gc/g1/g1HeapRegion.hpp" +#include "gc/g1/g1HeapRegionType.hpp" #include "memory/allocation.hpp" // The remembered set tracking policy determines for a given region the state of diff --git a/src/hotspot/share/gc/g1/g1RootProcessor.cpp b/src/hotspot/share/gc/g1/g1RootProcessor.cpp index 3a9e30ec403..51a77eccfdf 100644 --- a/src/hotspot/share/gc/g1/g1RootProcessor.cpp +++ b/src/hotspot/share/gc/g1/g1RootProcessor.cpp @@ -32,11 +32,11 @@ #include "gc/g1/g1CollectorState.hpp" #include "gc/g1/g1GCParPhaseTimesTracker.hpp" #include "gc/g1/g1GCPhaseTimes.hpp" +#include "gc/g1/g1HeapRegion.inline.hpp" #include "gc/g1/g1ParScanThreadState.inline.hpp" #include "gc/g1/g1Policy.hpp" #include "gc/g1/g1RootClosures.hpp" #include "gc/g1/g1RootProcessor.hpp" -#include "gc/g1/heapRegion.inline.hpp" #include "gc/shared/oopStorage.inline.hpp" #include "gc/shared/oopStorageSet.hpp" #include "gc/shared/oopStorageSetParState.inline.hpp" diff --git a/src/hotspot/share/gc/g1/g1SATBMarkQueueSet.cpp b/src/hotspot/share/gc/g1/g1SATBMarkQueueSet.cpp index f1cf554ca46..b7790d154d4 100644 --- a/src/hotspot/share/gc/g1/g1SATBMarkQueueSet.cpp +++ b/src/hotspot/share/gc/g1/g1SATBMarkQueueSet.cpp @@ -25,9 +25,9 @@ #include "precompiled.hpp" #include "gc/g1/g1BarrierSet.inline.hpp" #include "gc/g1/g1CollectedHeap.inline.hpp" +#include "gc/g1/g1HeapRegion.hpp" #include "gc/g1/g1SATBMarkQueueSet.hpp" #include "gc/g1/g1ThreadLocalData.hpp" -#include "gc/g1/heapRegion.hpp" #include "gc/shared/satbMarkQueue.hpp" #include "oops/oop.hpp" #include "utilities/debug.hpp" diff --git a/src/hotspot/share/gc/g1/g1SurvRateGroup.cpp b/src/hotspot/share/gc/g1/g1SurvRateGroup.cpp index 2b09dfc668b..48773a6634e 100644 --- a/src/hotspot/share/gc/g1/g1SurvRateGroup.cpp +++ b/src/hotspot/share/gc/g1/g1SurvRateGroup.cpp @@ -24,9 +24,9 @@ #include "precompiled.hpp" #include "gc/g1/g1CollectedHeap.inline.hpp" +#include "gc/g1/g1HeapRegion.hpp" #include "gc/g1/g1Predictions.hpp" #include "gc/g1/g1SurvRateGroup.hpp" -#include "gc/g1/heapRegion.hpp" #include "logging/log.hpp" #include "memory/allocation.hpp" diff --git a/src/hotspot/share/gc/g1/g1SurvivorRegions.cpp b/src/hotspot/share/gc/g1/g1SurvivorRegions.cpp index dc821b13514..fa86f02075d 100644 --- a/src/hotspot/share/gc/g1/g1SurvivorRegions.cpp +++ b/src/hotspot/share/gc/g1/g1SurvivorRegions.cpp @@ -23,8 +23,8 @@ */ #include "precompiled.hpp" +#include "gc/g1/g1HeapRegion.hpp" #include "gc/g1/g1SurvivorRegions.hpp" -#include "gc/g1/heapRegion.hpp" #include "utilities/growableArray.hpp" #include "utilities/debug.hpp" diff --git a/src/hotspot/share/gc/g1/g1YoungGCPostEvacuateTasks.cpp b/src/hotspot/share/gc/g1/g1YoungGCPostEvacuateTasks.cpp index 377f5f550d1..653402b8275 100644 --- a/src/hotspot/share/gc/g1/g1YoungGCPostEvacuateTasks.cpp +++ b/src/hotspot/share/gc/g1/g1YoungGCPostEvacuateTasks.cpp @@ -34,12 +34,12 @@ #include "gc/g1/g1EvacFailureRegions.inline.hpp" #include "gc/g1/g1EvacInfo.hpp" #include "gc/g1/g1EvacStats.inline.hpp" +#include "gc/g1/g1HeapRegion.inline.hpp" +#include "gc/g1/g1HeapRegionRemSet.inline.hpp" #include "gc/g1/g1OopClosures.inline.hpp" #include "gc/g1/g1ParScanThreadState.hpp" #include "gc/g1/g1RemSet.hpp" #include "gc/g1/g1YoungGCPostEvacuateTasks.hpp" -#include "gc/g1/heapRegion.inline.hpp" -#include "gc/g1/heapRegionRemSet.inline.hpp" #include "gc/shared/bufferNode.hpp" #include "gc/shared/preservedMarks.inline.hpp" #include "jfr/jfrEvents.hpp" diff --git a/src/hotspot/share/gc/g1/g1YoungGenSizer.cpp b/src/hotspot/share/gc/g1/g1YoungGenSizer.cpp index 13bbb22252c..30b9c6cb7a1 100644 --- a/src/hotspot/share/gc/g1/g1YoungGenSizer.cpp +++ b/src/hotspot/share/gc/g1/g1YoungGenSizer.cpp @@ -24,8 +24,8 @@ #include "precompiled.hpp" #include "gc/g1/g1Arguments.hpp" +#include "gc/g1/g1HeapRegion.hpp" #include "gc/g1/g1YoungGenSizer.hpp" -#include "gc/g1/heapRegion.hpp" #include "logging/log.hpp" #include "runtime/globals_extension.hpp" diff --git a/src/hotspot/share/gc/g1/jvmFlagConstraintsG1.cpp b/src/hotspot/share/gc/g1/jvmFlagConstraintsG1.cpp index b04c02a3fc9..46c850cb643 100644 --- a/src/hotspot/share/gc/g1/jvmFlagConstraintsG1.cpp +++ b/src/hotspot/share/gc/g1/jvmFlagConstraintsG1.cpp @@ -23,7 +23,7 @@ */ #include "precompiled.hpp" -#include "gc/g1/heapRegionBounds.inline.hpp" +#include "gc/g1/g1HeapRegionBounds.inline.hpp" #include "gc/g1/jvmFlagConstraintsG1.hpp" #include "gc/shared/bufferNode.hpp" #include "gc/shared/ptrQueue.hpp" diff --git a/src/hotspot/share/gc/g1/vmStructs_g1.hpp b/src/hotspot/share/gc/g1/vmStructs_g1.hpp index 9ce61531989..62d91fe3100 100644 --- a/src/hotspot/share/gc/g1/vmStructs_g1.hpp +++ b/src/hotspot/share/gc/g1/vmStructs_g1.hpp @@ -26,8 +26,8 @@ #define SHARE_GC_G1_VMSTRUCTS_G1_HPP #include "gc/g1/g1CollectedHeap.hpp" -#include "gc/g1/heapRegion.hpp" -#include "gc/g1/heapRegionManager.hpp" +#include "gc/g1/g1HeapRegion.hpp" +#include "gc/g1/g1HeapRegionManager.hpp" #include "utilities/macros.hpp" #define VM_STRUCTS_G1GC(nonstatic_field, \ diff --git a/src/hotspot/share/gc/parallel/psCompactionManager.cpp b/src/hotspot/share/gc/parallel/psCompactionManager.cpp index 3f72d86793c..b096982415e 100644 --- a/src/hotspot/share/gc/parallel/psCompactionManager.cpp +++ b/src/hotspot/share/gc/parallel/psCompactionManager.cpp @@ -62,6 +62,7 @@ ParCompactionManager::ParCompactionManager() { reset_bitmap_query_cache(); _deferred_obj_array = new (mtGC) GrowableArray(10, mtGC); + _marking_stats_cache = nullptr; } void ParCompactionManager::initialize(ParMarkBitMap* mbm) { diff --git a/src/hotspot/share/gc/parallel/psCompactionManager.hpp b/src/hotspot/share/gc/parallel/psCompactionManager.hpp index 458d33af74a..b33ad06ee3e 100644 --- a/src/hotspot/share/gc/parallel/psCompactionManager.hpp +++ b/src/hotspot/share/gc/parallel/psCompactionManager.hpp @@ -111,7 +111,35 @@ class ParCompactionManager : public CHeapObj { static RegionTaskQueueSet* region_task_queues() { return _region_task_queues; } OopTaskQueue* oop_stack() { return &_oop_stack; } - public: + // To collect per-region live-words in a worker local cache in order to + // reduce threads contention. + class MarkingStatsCache : public CHeapObj { + constexpr static size_t num_entries = 1024; + static_assert(is_power_of_2(num_entries), "inv"); + static_assert(num_entries > 0, "inv"); + + constexpr static size_t entry_mask = num_entries - 1; + + struct CacheEntry { + size_t region_id; + size_t live_words; + }; + + CacheEntry entries[num_entries] = {}; + + inline void push(size_t region_id, size_t live_words); + + public: + inline void push(oop obj, size_t live_words); + + inline void evict(size_t index); + + inline void evict_all(); + }; + + MarkingStatsCache* _marking_stats_cache; + +public: static const size_t InvalidShadow = ~0; static size_t pop_shadow_region_mt_safe(PSParallelCompact::RegionData* region_ptr); static void push_shadow_region_mt_safe(size_t shadow_region); @@ -198,6 +226,10 @@ class ParCompactionManager : public CHeapObj { virtual void do_void(); }; + inline void create_marking_stats_cache(); + + inline void flush_and_destroy_marking_stats_cache(); + // Called after marking. static void verify_all_marking_stack_empty() NOT_DEBUG_RETURN; diff --git a/src/hotspot/share/gc/parallel/psCompactionManager.inline.hpp b/src/hotspot/share/gc/parallel/psCompactionManager.inline.hpp index c0eb5460228..ae2e449e0b6 100644 --- a/src/hotspot/share/gc/parallel/psCompactionManager.inline.hpp +++ b/src/hotspot/share/gc/parallel/psCompactionManager.inline.hpp @@ -107,6 +107,8 @@ inline void ParCompactionManager::mark_and_push(T* p) { assert(ParallelScavengeHeap::heap()->is_in(obj), "should be in heap"); if (mark_bitmap()->is_unmarked(obj) && PSParallelCompact::mark_obj(obj)) { + assert(_marking_stats_cache != nullptr, "inv"); + _marking_stats_cache->push(obj, obj->size()); push(obj); if (StringDedup::is_enabled() && @@ -174,4 +176,73 @@ inline void ParCompactionManager::follow_contents(oop obj) { } } +inline void ParCompactionManager::MarkingStatsCache::push(size_t region_id, size_t live_words) { + size_t index = (region_id & entry_mask); + if (entries[index].region_id == region_id) { + // Hit + entries[index].live_words += live_words; + return; + } + // Miss + if (entries[index].live_words != 0) { + evict(index); + } + entries[index].region_id = region_id; + entries[index].live_words = live_words; +} + +inline void ParCompactionManager::MarkingStatsCache::push(oop obj, size_t live_words) { + ParallelCompactData& data = PSParallelCompact::summary_data(); + const size_t region_size = ParallelCompactData::RegionSize; + + HeapWord* addr = cast_from_oop(obj); + const size_t start_region_id = data.addr_to_region_idx(addr); + const size_t end_region_id = data.addr_to_region_idx(addr + live_words - 1); + if (start_region_id == end_region_id) { + // Completely inside this region + push(start_region_id, live_words); + return; + } + + // First region + push(start_region_id, region_size - data.region_offset(addr)); + + // Middle regions; bypass cache + for (size_t i = start_region_id + 1; i < end_region_id; ++i) { + data.region(i)->set_partial_obj_size(region_size); + data.region(i)->set_partial_obj_addr(addr); + } + + // Last region; bypass cache + const size_t end_offset = data.region_offset(addr + live_words - 1); + data.region(end_region_id)->set_partial_obj_size(end_offset + 1); + data.region(end_region_id)->set_partial_obj_addr(addr); +} + +inline void ParCompactionManager::MarkingStatsCache::evict(size_t index) { + ParallelCompactData& data = PSParallelCompact::summary_data(); + // flush to global data + data.region(entries[index].region_id)->add_live_obj(entries[index].live_words); +} + +inline void ParCompactionManager::MarkingStatsCache::evict_all() { + for (size_t i = 0; i < num_entries; ++i) { + if (entries[i].live_words != 0) { + evict(i); + entries[i].live_words = 0; + } + } +} + +inline void ParCompactionManager::create_marking_stats_cache() { + assert(_marking_stats_cache == nullptr, "precondition"); + _marking_stats_cache = new MarkingStatsCache(); +} + +inline void ParCompactionManager::flush_and_destroy_marking_stats_cache() { + _marking_stats_cache->evict_all(); + delete _marking_stats_cache; + _marking_stats_cache = nullptr; +} + #endif // SHARE_GC_PARALLEL_PSCOMPACTIONMANAGER_INLINE_HPP diff --git a/src/hotspot/share/gc/parallel/psParallelCompact.cpp b/src/hotspot/share/gc/parallel/psParallelCompact.cpp index 8b8b32f74fd..72783ba05ea 100644 --- a/src/hotspot/share/gc/parallel/psParallelCompact.cpp +++ b/src/hotspot/share/gc/parallel/psParallelCompact.cpp @@ -1970,6 +1970,7 @@ class MarkFromRootsTask : public WorkerTask { virtual void work(uint worker_id) { ParCompactionManager* cm = ParCompactionManager::gc_thread_compaction_manager(worker_id); + cm->create_marking_stats_cache(); PCMarkAndPushClosure mark_and_push_closure(cm); { @@ -2018,6 +2019,13 @@ class ParallelCompactRefProcProxyTask : public RefProcProxyTask { } }; +static void flush_marking_stats_cache(const uint num_workers) { + for (uint i = 0; i < num_workers; ++i) { + ParCompactionManager* cm = ParCompactionManager::gc_thread_compaction_manager(i); + cm->flush_and_destroy_marking_stats_cache(); + } +} + void PSParallelCompact::marking_phase(ParallelOldTracer *gc_tracer) { // Recursively traverse all live objects and mark them GCTraceTime(Info, gc, phases) tm("Marking Phase", &_gc_timer); @@ -2047,6 +2055,12 @@ void PSParallelCompact::marking_phase(ParallelOldTracer *gc_tracer) { pt.print_all_references(); } + { + GCTraceTime(Debug, gc, phases) tm("Flush Marking Stats", &_gc_timer); + + flush_marking_stats_cache(active_gc_threads); + } + // This is the point where the entire marking should have completed. ParCompactionManager::verify_all_marking_stack_empty(); diff --git a/src/hotspot/share/gc/parallel/psParallelCompact.inline.hpp b/src/hotspot/share/gc/parallel/psParallelCompact.inline.hpp index ff6052d5070..bec95c0e13c 100644 --- a/src/hotspot/share/gc/parallel/psParallelCompact.inline.hpp +++ b/src/hotspot/share/gc/parallel/psParallelCompact.inline.hpp @@ -100,7 +100,6 @@ inline void PSParallelCompact::check_new_location(HeapWord* old_addr, HeapWord* inline bool PSParallelCompact::mark_obj(oop obj) { const size_t obj_size = obj->size(); if (mark_bitmap()->mark_obj(obj, obj_size)) { - _summary_data.add_obj(obj, obj_size); ContinuationGCSupport::transform_stack_chunk(obj); return true; } else { diff --git a/src/hotspot/share/gc/shared/collectedHeap.cpp b/src/hotspot/share/gc/shared/collectedHeap.cpp index dbcef1ba575..02d20b92b5c 100644 --- a/src/hotspot/share/gc/shared/collectedHeap.cpp +++ b/src/hotspot/share/gc/shared/collectedHeap.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -402,6 +402,13 @@ void CollectedHeap::set_gc_cause(GCCause::Cause v) { _gc_cause = v; } +// Returns the header size in words aligned to the requirements of the +// array object type. +static int int_array_header_size() { + size_t typesize_in_bytes = arrayOopDesc::header_size_in_bytes(); + return (int)align_up(typesize_in_bytes, HeapWordSize)/HeapWordSize; +} + size_t CollectedHeap::max_tlab_size() const { // TLABs can't be bigger than we can fill with a int[Integer.MAX_VALUE]. // This restriction could be removed by enabling filling with multiple arrays. @@ -411,14 +418,14 @@ size_t CollectedHeap::max_tlab_size() const { // We actually lose a little by dividing first, // but that just makes the TLAB somewhat smaller than the biggest array, // which is fine, since we'll be able to fill that. - size_t max_int_size = typeArrayOopDesc::header_size(T_INT) + + size_t max_int_size = int_array_header_size() + sizeof(jint) * ((juint) max_jint / (size_t) HeapWordSize); return align_down(max_int_size, MinObjAlignment); } size_t CollectedHeap::filler_array_hdr_size() { - return align_object_offset(arrayOopDesc::header_size(T_INT)); // align to Long + return align_object_offset(int_array_header_size()); // align to Long } size_t CollectedHeap::filler_array_min_size() { diff --git a/src/hotspot/share/gc/shared/collectedHeap.hpp b/src/hotspot/share/gc/shared/collectedHeap.hpp index 16529fe559a..ff3231e601b 100644 --- a/src/hotspot/share/gc/shared/collectedHeap.hpp +++ b/src/hotspot/share/gc/shared/collectedHeap.hpp @@ -46,9 +46,6 @@ // class defines the functions that a heap must implement, and contains // infrastructure common to all heaps. -class WorkerTask; -class AdaptiveSizePolicy; -class BarrierSet; class GCHeapLog; class GCHeapSummary; class GCTimer; diff --git a/src/hotspot/share/gc/shared/gc_globals.hpp b/src/hotspot/share/gc/shared/gc_globals.hpp index 4316480e782..25e581cae67 100644 --- a/src/hotspot/share/gc/shared/gc_globals.hpp +++ b/src/hotspot/share/gc/shared/gc_globals.hpp @@ -213,13 +213,13 @@ \ /* where does the range max value of (max_jint - 1) come from? */ \ product(size_t, MarkStackSizeMax, NOT_LP64(4*M) LP64_ONLY(512*M), \ - "Maximum size of marking stack") \ - range(1, (INT_MAX - 1)) \ + "Maximum size of marking stack in bytes.") \ + range(1, (INT_MAX - 1)) \ \ product(size_t, MarkStackSize, NOT_LP64(64*K) LP64_ONLY(4*M), \ - "Size of marking stack") \ + "Size of marking stack in bytes.") \ constraint(MarkStackSizeConstraintFunc,AfterErgo) \ - range(1, (INT_MAX - 1)) \ + range(1, (INT_MAX - 1)) \ \ product(bool, ParallelRefProcEnabled, false, \ "Enable parallel reference processing whenever possible") \ @@ -345,10 +345,6 @@ product(bool, UseAdaptiveSizePolicyWithSystemGC, false, \ "Include statistics from System.gc() for adaptive size policy") \ \ - develop(intx, PSAdaptiveSizePolicyResizeVirtualSpaceAlot, -1, \ - "Resize the virtual spaces of the young or old generations") \ - range(-1, 1) \ - \ product(uint, AdaptiveSizeThroughPutPolicy, 0, \ "Policy for changing generation size for throughput goals") \ range(0, 1) \ diff --git a/src/hotspot/share/gc/shared/space.cpp b/src/hotspot/share/gc/shared/space.cpp index 31ff8a447c7..7d141710d47 100644 --- a/src/hotspot/share/gc/shared/space.cpp +++ b/src/hotspot/share/gc/shared/space.cpp @@ -40,7 +40,9 @@ #include "utilities/globalDefinitions.hpp" #include "utilities/macros.hpp" -ContiguousSpace::ContiguousSpace(): Space(), +ContiguousSpace::ContiguousSpace(): + _bottom(nullptr), + _end(nullptr), _next_compaction_space(nullptr), _top(nullptr) { _mangler = new GenSpaceMangler(this); @@ -75,9 +77,6 @@ void ContiguousSpace::clear(bool mangle_space) { #ifndef PRODUCT -void ContiguousSpace::set_top_for_allocations(HeapWord* v) { - mangler()->set_top_for_allocations(v); -} void ContiguousSpace::set_top_for_allocations() { mangler()->set_top_for_allocations(top()); } @@ -100,35 +99,13 @@ void ContiguousSpace::mangle_unused_area_complete() { } #endif // NOT_PRODUCT - -void Space::print_short() const { print_short_on(tty); } - -void Space::print_short_on(outputStream* st) const { - st->print(" space " SIZE_FORMAT "K, %3d%% used", capacity() / K, - (int) ((double) used() * 100 / capacity())); -} - -void Space::print() const { print_on(tty); } - -void Space::print_on(outputStream* st) const { - print_short_on(st); - st->print_cr(" [" PTR_FORMAT ", " PTR_FORMAT ")", - p2i(bottom()), p2i(end())); -} +void ContiguousSpace::print() const { print_on(tty); } void ContiguousSpace::print_on(outputStream* st) const { - print_short_on(st); - st->print_cr(" [" PTR_FORMAT ", " PTR_FORMAT ", " PTR_FORMAT ")", - p2i(bottom()), p2i(top()), p2i(end())); -} - -#if INCLUDE_SERIALGC -void TenuredSpace::print_on(outputStream* st) const { - print_short_on(st); - st->print_cr(" [" PTR_FORMAT ", " PTR_FORMAT ", " PTR_FORMAT ")", - p2i(bottom()), p2i(top()), p2i(end())); + st->print_cr(" space %zuK, %3d%% used [" PTR_FORMAT ", " PTR_FORMAT ", " PTR_FORMAT ")", + capacity() / K, (int) ((double) used() * 100 / capacity()), + p2i(bottom()), p2i(top()), p2i(end())); } -#endif void ContiguousSpace::verify() const { HeapWord* p = bottom(); diff --git a/src/hotspot/share/gc/shared/space.hpp b/src/hotspot/share/gc/shared/space.hpp index c60952d7b38..6eb8fe9818c 100644 --- a/src/hotspot/share/gc/shared/space.hpp +++ b/src/hotspot/share/gc/shared/space.hpp @@ -45,35 +45,45 @@ // for iterating over objects and free blocks, etc. // Forward decls. -class Space; class ContiguousSpace; class Generation; class ContiguousSpace; class CardTableRS; class DirtyCardToOopClosure; +class GenSpaceMangler; -// A Space describes a heap area. Class Space is an abstract -// base class. -// -// Space supports allocation, size computation and GC support is provided. +// A space in which the free area is contiguous. It therefore supports +// faster allocation, and compaction. // // Invariant: bottom() and end() are on page_size boundaries and // bottom() <= top() <= end() // top() is inclusive and end() is exclusive. - -class Space: public CHeapObj { +class ContiguousSpace: public CHeapObj { friend class VMStructs; - protected: + +private: HeapWord* _bottom; HeapWord* _end; // Used in support of save_marks() HeapWord* _saved_mark_word; - Space(): - _bottom(nullptr), _end(nullptr) { } + ContiguousSpace* _next_compaction_space; + + HeapWord* _top; + // A helper for mangling the unused area of the space in debug builds. + GenSpaceMangler* _mangler; + + GenSpaceMangler* mangler() { return _mangler; } + + // Allocation helpers (return null if full). + inline HeapWord* allocate_impl(size_t word_size); + inline HeapWord* par_allocate_impl(size_t word_size); + +public: + ContiguousSpace(); + ~ContiguousSpace(); - public: // Accessors HeapWord* bottom() const { return _bottom; } HeapWord* end() const { return _end; } @@ -82,10 +92,6 @@ class Space: public CHeapObj { HeapWord* saved_mark_word() const { return _saved_mark_word; } - // Returns a subregion of the space containing only the allocated objects in - // the space. - virtual MemRegion used_region() const = 0; - // Returns a region that is guaranteed to contain (at least) all objects // allocated at the time of the last call to "save_marks". If the space // initializes its DirtyCardToOopClosure's specifying the "contig" option @@ -98,13 +104,6 @@ class Space: public CHeapObj { return MemRegion(bottom(), saved_mark_word()); } - // For detecting GC bugs. Should only be called at GC boundaries, since - // some unused space may be used as scratch space during GC's. - // We also call this when expanding a space to satisfy an allocation - // request. See bug #4668531 - virtual void mangle_unused_area() = 0; - virtual void mangle_unused_area_complete() = 0; - // Testers bool is_empty() const { return used() == 0; } @@ -123,53 +122,12 @@ class Space: public CHeapObj { bool is_in_reserved(const void* p) const { return _bottom <= p && p < _end; } // Size computations. Sizes are in bytes. - size_t capacity() const { return byte_size(bottom(), end()); } - virtual size_t used() const = 0; - virtual size_t free() const = 0; - - // If "p" is in the space, returns the address of the start of the - // "block" that contains "p". We say "block" instead of "object" since - // some heaps may not pack objects densely; a chunk may either be an - // object or a non-object. If "p" is not in the space, return null. - virtual HeapWord* block_start_const(const void* p) const = 0; - - // Allocation (return null if full). Assumes the caller has established - // mutually exclusive access to the space. - virtual HeapWord* allocate(size_t word_size) = 0; - - // Allocation (return null if full). Enforces mutual exclusion internally. - virtual HeapWord* par_allocate(size_t word_size) = 0; + size_t capacity() const { return byte_size(bottom(), end()); } + size_t used() const { return byte_size(bottom(), top()); } + size_t free() const { return byte_size(top(), end()); } void print() const; - virtual void print_on(outputStream* st) const; - void print_short() const; - void print_short_on(outputStream* st) const; -}; - -class GenSpaceMangler; - -// A space in which the free area is contiguous. It therefore supports -// faster allocation, and compaction. -class ContiguousSpace: public Space { - friend class VMStructs; - -private: - ContiguousSpace* _next_compaction_space; - -protected: - HeapWord* _top; - // A helper for mangling the unused area of the space in debug builds. - GenSpaceMangler* _mangler; - - GenSpaceMangler* mangler() { return _mangler; } - - // Allocation helpers (return null if full). - inline HeapWord* allocate_impl(size_t word_size); - inline HeapWord* par_allocate_impl(size_t word_size); - - public: - ContiguousSpace(); - ~ContiguousSpace(); + void print_on(outputStream* st) const; // Initialization. // "initialize" should be called once on a space, before it is used for @@ -206,19 +164,18 @@ class ContiguousSpace: public Space { bool saved_mark_at_top() const { return saved_mark_word() == top(); } - // In debug mode mangle (write it with a particular bit - // pattern) the unused part of a space. - - // Used to save the address in a space for later use during mangling. - void set_top_for_allocations(HeapWord* v) PRODUCT_RETURN; // Used to save the space's current top for later use during mangling. void set_top_for_allocations() PRODUCT_RETURN; + // For detecting GC bugs. Should only be called at GC boundaries, since + // some unused space may be used as scratch space during GC's. + // We also call this when expanding a space to satisfy an allocation + // request. See bug #4668531 // Mangle regions in the space from the current top up to the // previously mangled part of the space. - void mangle_unused_area() override PRODUCT_RETURN; + void mangle_unused_area() PRODUCT_RETURN; // Mangle [top, end) - void mangle_unused_area_complete() override PRODUCT_RETURN; + void mangle_unused_area_complete() PRODUCT_RETURN; // Do some sparse checking on the area that should have been mangled. void check_mangled_unused_area(HeapWord* limit) PRODUCT_RETURN; @@ -226,17 +183,13 @@ class ContiguousSpace: public Space { // This code may be null depending on the macro DEBUG_MANGLING. void check_mangled_unused_area_complete() PRODUCT_RETURN; - // Size computations: sizes in bytes. - size_t used() const override { return byte_size(bottom(), top()); } - size_t free() const override { return byte_size(top(), end()); } - - // In a contiguous space we have a more obvious bound on what parts - // contain objects. - MemRegion used_region() const override { return MemRegion(bottom(), top()); } + MemRegion used_region() const { return MemRegion(bottom(), top()); } - // Allocation (return null if full) - HeapWord* allocate(size_t word_size) override; - HeapWord* par_allocate(size_t word_size) override; + // Allocation (return null if full). Assumes the caller has established + // mutually exclusive access to the space. + virtual HeapWord* allocate(size_t word_size); + // Allocation (return null if full). Enforces mutual exclusion internally. + virtual HeapWord* par_allocate(size_t word_size); // Iteration void object_iterate(ObjectClosure* blk); @@ -251,14 +204,15 @@ class ContiguousSpace: public Space { template void oop_since_save_marks_iterate(OopClosureType* blk); - // Very inefficient implementation. - HeapWord* block_start_const(const void* p) const override; + // If "p" is in the space, returns the address of the start of the + // "block" that contains "p". We say "block" instead of "object" since + // some heaps may not pack objects densely; a chunk may either be an + // object or a non-object. If "p" is not in the space, return null. + virtual HeapWord* block_start_const(const void* p) const; // Addresses for inlined allocation HeapWord** top_addr() { return &_top; } - void print_on(outputStream* st) const override; - // Debugging void verify() const; }; @@ -287,8 +241,6 @@ class TenuredSpace: public ContiguousSpace { inline HeapWord* par_allocate(size_t word_size) override; inline void update_for_block(HeapWord* start, HeapWord* end); - - void print_on(outputStream* st) const override; }; #endif //INCLUDE_SERIALGC diff --git a/src/hotspot/share/gc/shared/vmStructs_gc.hpp b/src/hotspot/share/gc/shared/vmStructs_gc.hpp index 05dbaec5ff5..ae9843c31eb 100644 --- a/src/hotspot/share/gc/shared/vmStructs_gc.hpp +++ b/src/hotspot/share/gc/shared/vmStructs_gc.hpp @@ -98,14 +98,13 @@ nonstatic_field(CollectedHeap, _is_gc_active, bool) \ nonstatic_field(CollectedHeap, _total_collections, unsigned int) \ \ + nonstatic_field(ContiguousSpace, _bottom, HeapWord*) \ + nonstatic_field(ContiguousSpace, _end, HeapWord*) \ nonstatic_field(ContiguousSpace, _top, HeapWord*) \ nonstatic_field(ContiguousSpace, _saved_mark_word, HeapWord*) \ \ nonstatic_field(MemRegion, _start, HeapWord*) \ - nonstatic_field(MemRegion, _word_size, size_t) \ - \ - nonstatic_field(Space, _bottom, HeapWord*) \ - nonstatic_field(Space, _end, HeapWord*) + nonstatic_field(MemRegion, _word_size, size_t) #define VM_TYPES_GC(declare_type, \ declare_toplevel_type, \ @@ -135,8 +134,7 @@ /******************************************/ \ \ declare_toplevel_type(CollectedHeap) \ - declare_toplevel_type(Space) \ - declare_type(ContiguousSpace, Space) \ + declare_toplevel_type(ContiguousSpace) \ declare_toplevel_type(BarrierSet) \ declare_type(ModRefBarrierSet, BarrierSet) \ declare_type(CardTableBarrierSet, ModRefBarrierSet) \ @@ -164,7 +162,6 @@ declare_toplevel_type(HeapWord*) \ declare_toplevel_type(HeapWord* volatile) \ declare_toplevel_type(MemRegion*) \ - declare_toplevel_type(Space*) \ declare_toplevel_type(ThreadLocalAllocBuffer*) \ \ declare_toplevel_type(BarrierSet::FakeRtti) diff --git a/src/hotspot/share/gc/shenandoah/c2/shenandoahSupport.cpp b/src/hotspot/share/gc/shenandoah/c2/shenandoahSupport.cpp index 238f57b1538..317c08cc9a7 100644 --- a/src/hotspot/share/gc/shenandoah/c2/shenandoahSupport.cpp +++ b/src/hotspot/share/gc/shenandoah/c2/shenandoahSupport.cpp @@ -1731,11 +1731,26 @@ bool ShenandoahBarrierC2Support::identical_backtoback_ifs(Node* n, PhaseIdealLoo return true; } +bool ShenandoahBarrierC2Support::merge_point_safe(Node* region) { + for (DUIterator_Fast imax, i = region->fast_outs(imax); i < imax; i++) { + Node* n = region->fast_out(i); + if (n->is_LoadStore()) { + // Splitting a LoadStore node through phi, causes it to lose its SCMemProj: the split if code doesn't have support + // for a LoadStore at the region the if is split through because that's not expected to happen (LoadStore nodes + // should be between barrier nodes). It does however happen with Shenandoah though because barriers can get + // expanded around a LoadStore node. + return false; + } + } + return true; +} + + void ShenandoahBarrierC2Support::merge_back_to_back_tests(Node* n, PhaseIdealLoop* phase) { assert(is_heap_stable_test(n), "no other tests"); if (identical_backtoback_ifs(n, phase)) { Node* n_ctrl = n->in(0); - if (phase->can_split_if(n_ctrl)) { + if (phase->can_split_if(n_ctrl) && merge_point_safe(n_ctrl)) { IfNode* dom_if = phase->idom(n_ctrl)->as_If(); if (is_heap_stable_test(n)) { Node* gc_state_load = n->in(1)->in(1)->in(1)->in(1); diff --git a/src/hotspot/share/gc/shenandoah/c2/shenandoahSupport.hpp b/src/hotspot/share/gc/shenandoah/c2/shenandoahSupport.hpp index 032f338aa88..7a6ed74f563 100644 --- a/src/hotspot/share/gc/shenandoah/c2/shenandoahSupport.hpp +++ b/src/hotspot/share/gc/shenandoah/c2/shenandoahSupport.hpp @@ -65,6 +65,7 @@ class ShenandoahBarrierC2Support : public AllStatic { static void test_in_cset(Node*& ctrl, Node*& not_cset_ctrl, Node* val, Node* raw_mem, PhaseIdealLoop* phase); static void move_gc_state_test_out_of_loop(IfNode* iff, PhaseIdealLoop* phase); static void merge_back_to_back_tests(Node* n, PhaseIdealLoop* phase); + static bool merge_point_safe(Node* region); static bool identical_backtoback_ifs(Node *n, PhaseIdealLoop* phase); static void fix_ctrl(Node* barrier, Node* region, const MemoryGraphFixer& fixer, Unique_Node_List& uses, Unique_Node_List& uses_to_ignore, uint last, PhaseIdealLoop* phase); static IfNode* find_unswitching_candidate(const IdealLoopTree *loop, PhaseIdealLoop* phase); diff --git a/src/hotspot/share/gc/shenandoah/shenandoahFullGC.cpp b/src/hotspot/share/gc/shenandoah/shenandoahFullGC.cpp index 3552669abb6..d66bf052da4 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahFullGC.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahFullGC.cpp @@ -235,12 +235,8 @@ void ShenandoahFullGC::do_it(GCCause::Cause gc_cause) { phase3_update_references(); phase4_compact_objects(worker_slices); - } - { - // Epilogue - _preserved_marks->restore(heap->workers()); - _preserved_marks->reclaim(); + phase5_epilog(); } // Resize metaspace @@ -280,6 +276,8 @@ class ShenandoahPrepareForMarkClosure: public ShenandoahHeapRegionClosure { _ctx->capture_top_at_mark_start(r); r->clear_live_data(); } + + bool is_thread_safe() { return true; } }; void ShenandoahFullGC::phase1_mark_heap() { @@ -289,7 +287,7 @@ void ShenandoahFullGC::phase1_mark_heap() { ShenandoahHeap* heap = ShenandoahHeap::heap(); ShenandoahPrepareForMarkClosure cl; - heap->heap_region_iterate(&cl); + heap->parallel_heap_region_iterate(&cl); heap->set_unload_classes(heap->heuristics()->can_unload_classes()); @@ -328,7 +326,7 @@ class ShenandoahPrepareForCompactionObjectClosure : public ObjectClosure { _from_region = from_region; } - void finish_region() { + void finish() { assert(_to_region != nullptr, "should not happen"); _to_region->set_new_top(_compact_point); } @@ -348,7 +346,7 @@ class ShenandoahPrepareForCompactionObjectClosure : public ObjectClosure { size_t obj_size = p->size(); if (_compact_point + obj_size > _to_region->end()) { - finish_region(); + finish(); // Object doesn't fit. Pick next empty region and start compacting there. ShenandoahHeapRegion* new_to_region; @@ -400,47 +398,61 @@ class ShenandoahPrepareForCompactionTask : public WorkerTask { return r->is_stw_move_allowed() && !r->is_humongous(); } - void work(uint worker_id) { - ShenandoahParallelWorkerSession worker_session(worker_id); - ShenandoahHeapRegionSet* slice = _worker_slices[worker_id]; - ShenandoahHeapRegionSetIterator it(slice); - ShenandoahHeapRegion* from_region = it.next(); - // No work? - if (from_region == nullptr) { - return; - } - - // Sliding compaction. Walk all regions in the slice, and compact them. - // Remember empty regions and reuse them as needed. - ResourceMark rm; + void work(uint worker_id) override; +private: + template + void prepare_for_compaction(ClosureType& cl, + GrowableArray& empty_regions, + ShenandoahHeapRegionSetIterator& it, + ShenandoahHeapRegion* from_region); +}; - GrowableArray empty_regions((int)_heap->num_regions()); +void ShenandoahPrepareForCompactionTask::work(uint worker_id) { + ShenandoahParallelWorkerSession worker_session(worker_id); + ShenandoahHeapRegionSet* slice = _worker_slices[worker_id]; + ShenandoahHeapRegionSetIterator it(slice); + ShenandoahHeapRegion* from_region = it.next(); + // No work? + if (from_region == nullptr) { + return; + } - ShenandoahPrepareForCompactionObjectClosure cl(_preserved_marks->get(worker_id), empty_regions, from_region); + // Sliding compaction. Walk all regions in the slice, and compact them. + // Remember empty regions and reuse them as needed. + ResourceMark rm; - while (from_region != nullptr) { - assert(is_candidate_region(from_region), "Sanity"); + GrowableArray empty_regions((int)_heap->num_regions()); - cl.set_from_region(from_region); - if (from_region->has_live()) { - _heap->marked_object_iterate(from_region, &cl); - } + ShenandoahPrepareForCompactionObjectClosure cl(_preserved_marks->get(worker_id), empty_regions, from_region); + prepare_for_compaction(cl, empty_regions, it, from_region); +} - // Compacted the region to somewhere else? From-region is empty then. - if (!cl.is_compact_same_region()) { - empty_regions.append(from_region); - } - from_region = it.next(); +template +void ShenandoahPrepareForCompactionTask::prepare_for_compaction(ClosureType& cl, + GrowableArray& empty_regions, + ShenandoahHeapRegionSetIterator& it, + ShenandoahHeapRegion* from_region) { + while (from_region != nullptr) { + assert(is_candidate_region(from_region), "Sanity"); + cl.set_from_region(from_region); + if (from_region->has_live()) { + _heap->marked_object_iterate(from_region, &cl); } - cl.finish_region(); - // Mark all remaining regions as empty - for (int pos = cl.empty_regions_pos(); pos < empty_regions.length(); ++pos) { - ShenandoahHeapRegion* r = empty_regions.at(pos); - r->set_new_top(r->bottom()); + // Compacted the region to somewhere else? From-region is empty then. + if (!cl.is_compact_same_region()) { + empty_regions.append(from_region); } + from_region = it.next(); } -}; + cl.finish(); + + // Mark all remaining regions as empty + for (int pos = cl.empty_regions_pos(); pos < empty_regions.length(); ++pos) { + ShenandoahHeapRegion* r = empty_regions.at(pos); + r->set_new_top(r->bottom()); + } +} void ShenandoahFullGC::calculate_target_humongous_objects() { ShenandoahHeap* heap = ShenandoahHeap::heap(); @@ -948,7 +960,7 @@ void ShenandoahFullGC::compact_humongous_objects() { // // This code is serial, because doing the in-slice parallel sliding is tricky. In most cases, // humongous regions are already compacted, and do not require further moves, which alleviates - // sliding costs. We may consider doing this in parallel in future. + // sliding costs. We may consider doing this in parallel in the future. ShenandoahHeap* heap = ShenandoahHeap::heap(); @@ -1054,6 +1066,11 @@ void ShenandoahFullGC::phase4_compact_objects(ShenandoahHeapRegionSet** worker_s ShenandoahGCPhase phase(ShenandoahPhaseTimings::full_gc_copy_objects_humong); compact_humongous_objects(); } +} + +void ShenandoahFullGC::phase5_epilog() { + GCTraceTime(Info, gc, phases) time("Phase 5: Full GC epilog", _gc_timer); + ShenandoahHeap* heap = ShenandoahHeap::heap(); // Reset complete bitmap. We're about to reset the complete-top-at-mark-start pointer // and must ensure the bitmap is in sync. @@ -1066,14 +1083,15 @@ void ShenandoahFullGC::phase4_compact_objects(ShenandoahHeapRegionSet** worker_s // Bring regions in proper states after the collection, and set heap properties. { ShenandoahGCPhase phase(ShenandoahPhaseTimings::full_gc_copy_objects_rebuild); - ShenandoahPostCompactClosure post_compact; heap->heap_region_iterate(&post_compact); heap->set_used(post_compact.get_live()); heap->collection_set()->clear(); heap->free_set()->rebuild(); + heap->clear_cancelled_gc(); } - heap->clear_cancelled_gc(); + _preserved_marks->restore(heap->workers()); + _preserved_marks->reclaim(); } diff --git a/src/hotspot/share/gc/shenandoah/shenandoahFullGC.hpp b/src/hotspot/share/gc/shenandoah/shenandoahFullGC.hpp index 1c1653e59ec..6687116b21f 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahFullGC.hpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahFullGC.hpp @@ -81,6 +81,7 @@ class ShenandoahFullGC : public ShenandoahGC { void phase2_calculate_target_addresses(ShenandoahHeapRegionSet** worker_slices); void phase3_update_references(); void phase4_compact_objects(ShenandoahHeapRegionSet** worker_slices); + void phase5_epilog(); void distribute_slices(ShenandoahHeapRegionSet** worker_slices); void calculate_target_humongous_objects(); diff --git a/src/hotspot/share/gc/x/xObjArrayAllocator.cpp b/src/hotspot/share/gc/x/xObjArrayAllocator.cpp index c2753a9a0a6..a633b774d26 100644 --- a/src/hotspot/share/gc/x/xObjArrayAllocator.cpp +++ b/src/hotspot/share/gc/x/xObjArrayAllocator.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -50,7 +50,17 @@ oop XObjArrayAllocator::initialize(HeapWord* mem) const { // time and time-to-safepoint const size_t segment_max = XUtils::bytes_to_words(64 * K); const BasicType element_type = ArrayKlass::cast(_klass)->element_type(); - const size_t header = arrayOopDesc::header_size(element_type); + + // Clear leading 32 bits, if necessary. + int base_offset = arrayOopDesc::base_offset_in_bytes(element_type); + if (!is_aligned(base_offset, HeapWordSize)) { + assert(is_aligned(base_offset, BytesPerInt), "array base must be 32 bit aligned"); + *reinterpret_cast(reinterpret_cast(mem) + base_offset) = 0; + base_offset += BytesPerInt; + } + assert(is_aligned(base_offset, HeapWordSize), "remaining array base must be 64 bit aligned"); + + const size_t header = heap_word_size(base_offset); const size_t payload_size = _word_size - header; if (payload_size <= segment_max) { diff --git a/src/hotspot/share/gc/z/zObjArrayAllocator.cpp b/src/hotspot/share/gc/z/zObjArrayAllocator.cpp index 581a0798350..d823734a278 100644 --- a/src/hotspot/share/gc/z/zObjArrayAllocator.cpp +++ b/src/hotspot/share/gc/z/zObjArrayAllocator.cpp @@ -51,7 +51,17 @@ oop ZObjArrayAllocator::initialize(HeapWord* mem) const { // time and time-to-safepoint const size_t segment_max = ZUtils::bytes_to_words(64 * K); const BasicType element_type = ArrayKlass::cast(_klass)->element_type(); - const size_t header = arrayOopDesc::header_size(element_type); + + // Clear leading 32 bits, if necessary. + int base_offset = arrayOopDesc::base_offset_in_bytes(element_type); + if (!is_aligned(base_offset, HeapWordSize)) { + assert(is_aligned(base_offset, BytesPerInt), "array base must be 32 bit aligned"); + *reinterpret_cast(reinterpret_cast(mem) + base_offset) = 0; + base_offset += BytesPerInt; + } + assert(is_aligned(base_offset, HeapWordSize), "remaining array base must be 64 bit aligned"); + + const size_t header = heap_word_size(base_offset); const size_t payload_size = _word_size - header; if (payload_size <= segment_max || ArrayKlass::cast(_klass)->is_flatArray_klass()) { diff --git a/src/hotspot/share/jfr/jni/jfrJniMethod.cpp b/src/hotspot/share/jfr/jni/jfrJniMethod.cpp index 59c770eda29..f087e92f527 100644 --- a/src/hotspot/share/jfr/jni/jfrJniMethod.cpp +++ b/src/hotspot/share/jfr/jni/jfrJniMethod.cpp @@ -348,10 +348,10 @@ JVM_ENTRY_NO_ENV(void, jfr_set_force_instrumentation(JNIEnv* env, jclass jvm, jb JfrEventClassTransformer::set_force_instrumentation(force_instrumentation == JNI_TRUE); JVM_END -JVM_ENTRY_NO_ENV(void, jfr_emit_old_object_samples(JNIEnv* env, jclass jvm, jlong cutoff_ticks, jboolean emit_all, jboolean skip_bfs)) +NO_TRANSITION(void, jfr_emit_old_object_samples(JNIEnv* env, jclass jvm, jlong cutoff_ticks, jboolean emit_all, jboolean skip_bfs)) JfrRecorderService service; service.emit_leakprofiler_events(cutoff_ticks, emit_all == JNI_TRUE, skip_bfs == JNI_TRUE); -JVM_END +NO_TRANSITION_END JVM_ENTRY_NO_ENV(void, jfr_exclude_thread(JNIEnv* env, jclass jvm, jobject t)) JfrJavaSupport::exclude(thread, t); diff --git a/src/hotspot/share/jfr/recorder/service/jfrRecorderService.cpp b/src/hotspot/share/jfr/recorder/service/jfrRecorderService.cpp index 8b019cbc8a2..4f879162483 100644 --- a/src/hotspot/share/jfr/recorder/service/jfrRecorderService.cpp +++ b/src/hotspot/share/jfr/recorder/service/jfrRecorderService.cpp @@ -691,13 +691,14 @@ void JfrRecorderService::evaluate_chunk_size_for_rotation() { } void JfrRecorderService::emit_leakprofiler_events(int64_t cutoff_ticks, bool emit_all, bool skip_bfs) { - DEBUG_ONLY(JfrJavaSupport::check_java_thread_in_vm(JavaThread::current())); + DEBUG_ONLY(JfrJavaSupport::check_java_thread_in_native(JavaThread::current())); // Take the rotation lock to exclude flush() during event emits. This is because event emit // also creates a number checkpoint events. Those checkpoint events require a future typeset checkpoint // event for completeness, i.e. to be generated before being flushed to a segment. // The upcoming flush() or rotation() after event emit completes this typeset checkpoint // and serializes all event emit checkpoint events to the same segment. JfrRotationLock lock; + // Take the rotation lock before the transition. + ThreadInVMfromNative transition(JavaThread::current()); LeakProfiler::emit_events(cutoff_ticks, emit_all, skip_bfs); } - diff --git a/src/hotspot/share/jvmci/jvmciCompilerToVM.cpp b/src/hotspot/share/jvmci/jvmciCompilerToVM.cpp index ca091227b0c..2e9093d37e2 100644 --- a/src/hotspot/share/jvmci/jvmciCompilerToVM.cpp +++ b/src/hotspot/share/jvmci/jvmciCompilerToVM.cpp @@ -182,7 +182,7 @@ Handle JavaArgumentUnboxer::next_arg(BasicType expectedType) { // Entry to native method implementation that transitions // current thread to '_thread_in_vm'. #define C2V_VMENTRY(result_type, name, signature) \ - JNIEXPORT result_type JNICALL c2v_ ## name signature { \ + result_type JNICALL c2v_ ## name signature { \ JavaThread* thread = JavaThread::current_or_null(); \ if (thread == nullptr) { \ env->ThrowNew(JNIJVMCI::InternalError::clazz(), \ @@ -193,7 +193,7 @@ Handle JavaArgumentUnboxer::next_arg(BasicType expectedType) { JVMCITraceMark jtm("CompilerToVM::" #name); #define C2V_VMENTRY_(result_type, name, signature, result) \ - JNIEXPORT result_type JNICALL c2v_ ## name signature { \ + result_type JNICALL c2v_ ## name signature { \ JavaThread* thread = JavaThread::current_or_null(); \ if (thread == nullptr) { \ env->ThrowNew(JNIJVMCI::InternalError::clazz(), \ @@ -209,7 +209,7 @@ Handle JavaArgumentUnboxer::next_arg(BasicType expectedType) { // Entry to native method implementation that does not transition // current thread to '_thread_in_vm'. #define C2V_VMENTRY_PREFIX(result_type, name, signature) \ - JNIEXPORT result_type JNICALL c2v_ ## name signature { \ + result_type JNICALL c2v_ ## name signature { \ JavaThread* thread = JavaThread::current_or_null(); #define C2V_END } @@ -2442,7 +2442,7 @@ C2V_END C2V_VMENTRY_0(jint, arrayBaseOffset, (JNIEnv* env, jobject, jchar type_char)) BasicType type = JVMCIENV->typeCharToBasicType(type_char, JVMCI_CHECK_0); - return arrayOopDesc::header_size(type) * HeapWordSize; + return arrayOopDesc::base_offset_in_bytes(type); C2V_END C2V_VMENTRY_0(jint, arrayIndexScale, (JNIEnv* env, jobject, jchar type_char)) diff --git a/src/hotspot/share/jvmci/vmStructs_jvmci.cpp b/src/hotspot/share/jvmci/vmStructs_jvmci.cpp index d6aa818e3c3..f56c452f64a 100644 --- a/src/hotspot/share/jvmci/vmStructs_jvmci.cpp +++ b/src/hotspot/share/jvmci/vmStructs_jvmci.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -43,7 +43,7 @@ #include "runtime/vm_version.hpp" #if INCLUDE_G1GC #include "gc/g1/g1CardTable.hpp" -#include "gc/g1/heapRegion.hpp" +#include "gc/g1/g1HeapRegion.hpp" #include "gc/g1/g1ThreadLocalData.hpp" #endif @@ -1026,14 +1026,6 @@ int JVMCIVMStructs::localHotSpotVMAddresses_count() { return (sizeof(localHotSpotVMAddresses) / sizeof(VMAddressEntry)) - 1; } -extern "C" { -JNIEXPORT VMStructEntry* jvmciHotSpotVMStructs = JVMCIVMStructs::localHotSpotVMStructs; -JNIEXPORT VMTypeEntry* jvmciHotSpotVMTypes = JVMCIVMStructs::localHotSpotVMTypes; -JNIEXPORT VMIntConstantEntry* jvmciHotSpotVMIntConstants = JVMCIVMStructs::localHotSpotVMIntConstants; -JNIEXPORT VMLongConstantEntry* jvmciHotSpotVMLongConstants = JVMCIVMStructs::localHotSpotVMLongConstants; -JNIEXPORT VMAddressEntry* jvmciHotSpotVMAddresses = JVMCIVMStructs::localHotSpotVMAddresses; -} - #ifdef ASSERT // This is used both to check the types of referenced fields and // to ensure that all of the field types are present. diff --git a/src/hotspot/share/memory/memRegion.hpp b/src/hotspot/share/memory/memRegion.hpp index 3d5cf5f06e3..5d3d635c650 100644 --- a/src/hotspot/share/memory/memRegion.hpp +++ b/src/hotspot/share/memory/memRegion.hpp @@ -54,10 +54,6 @@ class MemRegion { _start(start), _word_size(pointer_delta(end, start)) { assert(end >= start, "incorrect constructor arguments"); } - MemRegion(MetaWord* start, MetaWord* end) : - _start((HeapWord*)start), _word_size(pointer_delta(end, start)) { - assert(end >= start, "incorrect constructor arguments"); - } MemRegion intersection(const MemRegion mr2) const; // regions must overlap or be adjacent diff --git a/src/hotspot/share/nmt/memTracker.hpp b/src/hotspot/share/nmt/memTracker.hpp index a863c45a658..c7fbda4713a 100644 --- a/src/hotspot/share/nmt/memTracker.hpp +++ b/src/hotspot/share/nmt/memTracker.hpp @@ -175,12 +175,12 @@ class MemTracker : AllStatic { // // The two new memory regions will be both registered under stack and // memory flags of the original region. - static inline void record_virtual_memory_split_reserved(void* addr, size_t size, size_t split) { + static inline void record_virtual_memory_split_reserved(void* addr, size_t size, size_t split, MEMFLAGS flag, MEMFLAGS split_flag) { assert_post_init(); if (!enabled()) return; if (addr != nullptr) { ThreadCritical tc; - VirtualMemoryTracker::split_reserved_region((address)addr, size, split); + VirtualMemoryTracker::split_reserved_region((address)addr, size, split, flag, split_flag); } } diff --git a/src/hotspot/share/nmt/virtualMemoryTracker.cpp b/src/hotspot/share/nmt/virtualMemoryTracker.cpp index 471c9eafd0e..06f9469f25e 100644 --- a/src/hotspot/share/nmt/virtualMemoryTracker.cpp +++ b/src/hotspot/share/nmt/virtualMemoryTracker.cpp @@ -560,7 +560,7 @@ bool VirtualMemoryTracker::remove_released_region(address addr, size_t size) { // Given an existing memory mapping registered with NMT, split the mapping in // two. The newly created two mappings will be registered under the call // stack and the memory flags of the original section. -bool VirtualMemoryTracker::split_reserved_region(address addr, size_t size, size_t split) { +bool VirtualMemoryTracker::split_reserved_region(address addr, size_t size, size_t split, MEMFLAGS flag, MEMFLAGS split_flag) { ReservedMemoryRegion rgn(addr, size); ReservedMemoryRegion* reserved_rgn = _reserved_regions->find(rgn); @@ -576,8 +576,8 @@ bool VirtualMemoryTracker::split_reserved_region(address addr, size_t size, size log_debug(nmt)("Split region \'%s\' (" INTPTR_FORMAT ", " SIZE_FORMAT ") with size " SIZE_FORMAT, name, p2i(rgn.base()), rgn.size(), split); // Now, create two new regions. - add_reserved_region(addr, split, original_stack, original_flags); - add_reserved_region(addr + split, size - split, original_stack, original_flags); + add_reserved_region(addr, split, original_stack, flag); + add_reserved_region(addr + split, size - split, original_stack, split_flag); return true; } diff --git a/src/hotspot/share/nmt/virtualMemoryTracker.hpp b/src/hotspot/share/nmt/virtualMemoryTracker.hpp index b4dd891f1c2..db49f108c84 100644 --- a/src/hotspot/share/nmt/virtualMemoryTracker.hpp +++ b/src/hotspot/share/nmt/virtualMemoryTracker.hpp @@ -390,7 +390,7 @@ class VirtualMemoryTracker : AllStatic { // Given an existing memory mapping registered with NMT, split the mapping in // two. The newly created two mappings will be registered under the call // stack and the memory flags of the original section. - static bool split_reserved_region(address addr, size_t size, size_t split); + static bool split_reserved_region(address addr, size_t size, size_t split, MEMFLAGS flag, MEMFLAGS split_flag); // Walk virtual memory data structure for creating baseline, etc. static bool walk_virtual_memory(VirtualMemoryWalker* walker); diff --git a/src/hotspot/share/oops/accessBackend.cpp b/src/hotspot/share/oops/accessBackend.cpp index 853f42f6f7e..be191316f25 100644 --- a/src/hotspot/share/oops/accessBackend.cpp +++ b/src/hotspot/share/oops/accessBackend.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -32,6 +32,12 @@ #include "utilities/debug.hpp" #include "utilities/vmError.hpp" +#if defined(TARGET_COMPILER_gcc) +#define HIDDEN __attribute__ ((visibility ("hidden"))) +#else +#define HIDDEN +#endif + namespace AccessInternal { // These forward copying calls to Copy without exposing the Copy type in headers unnecessarily @@ -58,102 +64,102 @@ namespace AccessInternal { reinterpret_cast(dst), length); } - template<> + template<> HIDDEN void arraycopy_conjoint(jboolean* src, jboolean* dst, size_t length) { Copy::conjoint_jbytes(reinterpret_cast(src), reinterpret_cast(dst), length); } - template<> + template<> HIDDEN void arraycopy_conjoint(jbyte* src, jbyte* dst, size_t length) { Copy::conjoint_jbytes(src, dst, length); } - template<> + template<> HIDDEN void arraycopy_conjoint(jchar* src, jchar* dst, size_t length) { Copy::conjoint_jshorts_atomic(reinterpret_cast(src), reinterpret_cast(dst), length); } - template<> + template<> HIDDEN void arraycopy_conjoint(jshort* src, jshort* dst, size_t length) { Copy::conjoint_jshorts_atomic(src, dst, length); } - template<> + template<> HIDDEN void arraycopy_conjoint(jint* src, jint* dst, size_t length) { Copy::conjoint_jints_atomic(src, dst, length); } - template<> + template<> HIDDEN void arraycopy_conjoint(jfloat* src, jfloat* dst, size_t length) { Copy::conjoint_jints_atomic(reinterpret_cast(src), reinterpret_cast(dst), length); } - template<> + template<> HIDDEN void arraycopy_conjoint(jlong* src, jlong* dst, size_t length) { Copy::conjoint_jlongs_atomic(src, dst, length); } - template<> + template<> HIDDEN void arraycopy_conjoint(jdouble* src, jdouble* dst, size_t length) { Copy::conjoint_jlongs_atomic(reinterpret_cast(src), reinterpret_cast(dst), length); } - template<> + template<> HIDDEN void arraycopy_arrayof_conjoint(jbyte* src, jbyte* dst, size_t length) { Copy::arrayof_conjoint_jbytes(reinterpret_cast(src), reinterpret_cast(dst), length); } - template<> + template<> HIDDEN void arraycopy_arrayof_conjoint(jshort* src, jshort* dst, size_t length) { Copy::arrayof_conjoint_jshorts(reinterpret_cast(src), reinterpret_cast(dst), length); } - template<> + template<> HIDDEN void arraycopy_arrayof_conjoint(jint* src, jint* dst, size_t length) { Copy::arrayof_conjoint_jints(reinterpret_cast(src), reinterpret_cast(dst), length); } - template<> + template<> HIDDEN void arraycopy_arrayof_conjoint(jlong* src, jlong* dst, size_t length) { Copy::arrayof_conjoint_jlongs(reinterpret_cast(src), reinterpret_cast(dst), length); } - template<> + template<> HIDDEN void arraycopy_conjoint(void* src, void* dst, size_t length) { Copy::conjoint_jbytes(reinterpret_cast(src), reinterpret_cast(dst), length); } - template<> + template<> HIDDEN void arraycopy_conjoint_atomic(jbyte* src, jbyte* dst, size_t length) { Copy::conjoint_jbytes_atomic(src, dst, length); } - template<> + template<> HIDDEN void arraycopy_conjoint_atomic(jshort* src, jshort* dst, size_t length) { Copy::conjoint_jshorts_atomic(src, dst, length); } - template<> + template<> HIDDEN void arraycopy_conjoint_atomic(jint* src, jint* dst, size_t length) { Copy::conjoint_jints_atomic(src, dst, length); } - template<> + template<> HIDDEN void arraycopy_conjoint_atomic(jlong* src, jlong* dst, size_t length) { Copy::conjoint_jlongs_atomic(src, dst, length); } - template<> + template<> HIDDEN void arraycopy_conjoint_atomic(void* src, void* dst, size_t length) { Copy::conjoint_memory_atomic(src, dst, length); } diff --git a/src/hotspot/share/oops/arrayOop.hpp b/src/hotspot/share/oops/arrayOop.hpp index 703bb2e7e52..cf215ce8820 100644 --- a/src/hotspot/share/oops/arrayOop.hpp +++ b/src/hotspot/share/oops/arrayOop.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,6 +27,7 @@ #include "oops/oop.hpp" #include "utilities/align.hpp" +#include "utilities/globalDefinitions.hpp" // arrayOopDesc is the abstract baseclass for all arrays. It doesn't // declare pure virtual to enforce this because that would allocate a vtbl @@ -44,37 +45,39 @@ class arrayOopDesc : public oopDesc { friend class arrayOopDescTest; // Interpreter/Compiler offsets -protected: - // Header size computation. - // The header is considered the oop part of this type plus the length. - // Returns the aligned header_size_in_bytes. This is not equivalent to - // sizeof(arrayOopDesc) which should not appear in the code. - static int header_size_in_bytes() { - size_t hs = align_up(length_offset_in_bytes() + sizeof(int), - HeapWordSize); -#ifdef ASSERT - // make sure it isn't called before UseCompressedOops is initialized. - static size_t arrayoopdesc_hs = 0; - if (arrayoopdesc_hs == 0) arrayoopdesc_hs = hs; - assert(arrayoopdesc_hs == hs, "header size can't change"); -#endif // ASSERT - return (int)hs; - } +private: // Returns the address of the length "field". See length_offset_in_bytes(). static int* length_addr_impl(void* obj_ptr) { char* ptr = static_cast(obj_ptr); return reinterpret_cast(ptr + length_offset_in_bytes()); } - // Check whether an element of a typeArrayOop with the given type must be - // aligned 0 mod 8. The typeArrayOop itself must be aligned at least this - // strongly. + // Given a type, return true if elements of that type must be aligned to 64-bit. static bool element_type_should_be_aligned(BasicType type) { +#ifdef _LP64 + if (type == T_OBJECT || type == T_ARRAY || type == T_PRIMITIVE_OBJECT) { + return !UseCompressedOops; + } +#endif return type == T_DOUBLE || type == T_LONG || type == T_PRIMITIVE_OBJECT; } public: + // Header size computation. + // The header is considered the oop part of this type plus the length. + // This is not equivalent to sizeof(arrayOopDesc) which should not appear in the code. + static int header_size_in_bytes() { + size_t hs = length_offset_in_bytes() + sizeof(int); +#ifdef ASSERT + // make sure it isn't called before UseCompressedOops is initialized. + static size_t arrayoopdesc_hs = 0; + if (arrayoopdesc_hs == 0) arrayoopdesc_hs = hs; + assert(arrayoopdesc_hs == hs, "header size can't change"); +#endif // ASSERT + return (int)hs; + } + // The _length field is not declared in C++. It is allocated after the // declared nonstatic fields in arrayOopDesc if not compressed, otherwise // it occupies the second half of the _klass field in oopDesc. @@ -85,7 +88,8 @@ class arrayOopDesc : public oopDesc { // Returns the offset of the first element. static int base_offset_in_bytes(BasicType type) { - return header_size(type) * HeapWordSize; + size_t hs = header_size_in_bytes(); + return (int)(element_type_should_be_aligned(type) ? align_up(hs, BytesPerLong) : hs); } // Returns the address of the first element. The elements in the array will not @@ -122,18 +126,7 @@ class arrayOopDesc : public oopDesc { *length_addr_impl(mem) = length; } - // Should only be called with constants as argument - // (will not constant fold otherwise) - // Returns the header size in words aligned to the requirements of the - // array object type. - static int header_size(BasicType type) { - size_t typesize_in_bytes = header_size_in_bytes(); - return (int)(element_type_should_be_aligned(type) - ? align_object_offset(typesize_in_bytes/HeapWordSize) - : typesize_in_bytes/HeapWordSize); - } - - // Return the maximum length of an array of BasicType. The length can passed + // Return the maximum length of an array of BasicType. The length can be passed // to typeArrayOop::object_size(scale, length, header_size) without causing an // overflow. We also need to make sure that this will not overflow a size_t on // 32 bit platforms when we convert it to a byte size. @@ -141,8 +134,12 @@ class arrayOopDesc : public oopDesc { assert(type < T_CONFLICT, "wrong type"); assert(type2aelembytes(type) != 0, "wrong type"); + size_t hdr_size_in_bytes = base_offset_in_bytes(type); + // This is rounded-up and may overlap with the first array elements. + size_t hdr_size_in_words = align_up(hdr_size_in_bytes, HeapWordSize) / HeapWordSize; + const size_t max_element_words_per_size_t = - align_down((SIZE_MAX/HeapWordSize - header_size(type)), MinObjAlignment); + align_down((SIZE_MAX/HeapWordSize - hdr_size_in_words), MinObjAlignment); const size_t max_elements_per_size_t = HeapWordSize * max_element_words_per_size_t / type2aelembytes(type); if ((size_t)max_jint < max_elements_per_size_t) { @@ -150,7 +147,7 @@ class arrayOopDesc : public oopDesc { // (CollectedHeap, Klass::oop_oop_iterate(), and more) uses an int for // passing around the size (in words) of an object. So, we need to avoid // overflowing an int when we add the header. See CRs 4718400 and 7110613. - return align_down(max_jint - header_size(type), MinObjAlignment); + return align_down(max_jint - hdr_size_in_words, MinObjAlignment); } return (int32_t)max_elements_per_size_t; } diff --git a/src/hotspot/share/oops/flatArrayKlass.cpp b/src/hotspot/share/oops/flatArrayKlass.cpp index 54fa59648c0..8441efa1768 100644 --- a/src/hotspot/share/oops/flatArrayKlass.cpp +++ b/src/hotspot/share/oops/flatArrayKlass.cpp @@ -206,7 +206,7 @@ size_t FlatArrayKlass::oop_size(oop obj) const { jint FlatArrayKlass::max_elements() const { // Check the max number of heap words limit first (because of int32_t in oopDesc_oop_size() etc) size_t max_size = max_jint; - max_size -= arrayOopDesc::header_size(T_PRIMITIVE_OBJECT); + max_size -= (arrayOopDesc::base_offset_in_bytes(T_PRIMITIVE_OBJECT) >> LogHeapWordSize); max_size = align_down(max_size, MinObjAlignment); max_size <<= LogHeapWordSize; // convert to max payload size in bytes max_size >>= layout_helper_log2_element_size(_layout_helper); // divide by element size (in bytes) = max elements diff --git a/src/hotspot/share/oops/objArrayOop.hpp b/src/hotspot/share/oops/objArrayOop.hpp index de6d4d3d042..20e2953fee9 100644 --- a/src/hotspot/share/oops/objArrayOop.hpp +++ b/src/hotspot/share/oops/objArrayOop.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -51,32 +51,6 @@ class objArrayOopDesc : public arrayOopDesc { return base_offset_in_bytes() + sizeof(T) * index; } -private: - // Give size of objArrayOop in HeapWords minus the header - static int array_size(int length) { - const uint OopsPerHeapWord = HeapWordSize/heapOopSize; - assert(OopsPerHeapWord >= 1 && (HeapWordSize % heapOopSize == 0), - "Else the following (new) computation would be in error"); - uint res = ((uint)length + OopsPerHeapWord - 1)/OopsPerHeapWord; -#ifdef ASSERT - // The old code is left in for sanity-checking; it'll - // go away pretty soon. XXX - // Without UseCompressedOops, this is simply: - // oop->length() * HeapWordsPerOop; - // With narrowOops, HeapWordsPerOop is 1/2 or equal 0 as an integer. - // The oop elements are aligned up to wordSize - const uint HeapWordsPerOop = heapOopSize/HeapWordSize; - uint old_res; - if (HeapWordsPerOop > 0) { - old_res = length * HeapWordsPerOop; - } else { - old_res = align_up((uint)length, OopsPerHeapWord)/OopsPerHeapWord; - } - assert(res == old_res, "Inconsistency between old and new."); -#endif // ASSERT - return res; - } - public: // Returns the offset of the first element. static int base_offset_in_bytes() { @@ -94,16 +68,15 @@ class objArrayOopDesc : public arrayOopDesc { oop replace_if_null(int index, oop exchange_value); // Sizing - static int header_size() { return arrayOopDesc::header_size(T_OBJECT); } size_t object_size() { return object_size(length()); } static size_t object_size(int length) { // This returns the object size in HeapWords. - uint asz = array_size(length); - uint osz = align_object_size(header_size() + asz); - assert(osz >= asz, "no overflow"); - assert((int)osz > 0, "no overflow"); - return (size_t)osz; + size_t asz = (size_t)length * heapOopSize; + size_t size_words = heap_word_size(base_offset_in_bytes() + asz); + size_t osz = align_object_size(size_words); + assert(osz < max_jint, "no overflow"); + return osz; } Klass* element_klass(); diff --git a/src/hotspot/share/oops/oop.cpp b/src/hotspot/share/oops/oop.cpp index 18fcda151ff..e3f70e70bcb 100644 --- a/src/hotspot/share/oops/oop.cpp +++ b/src/hotspot/share/oops/oop.cpp @@ -43,8 +43,6 @@ void oopDesc::print_on(outputStream* st) const { if (*((juint*)this) == badHeapWordVal) { st->print_cr("BAD WORD"); - } else if (*((juint*)this) == badMetaWordVal) { - st->print_cr("BAD META WORD"); } else { klass()->oop_print_on(cast_to_oop(this), st); } @@ -58,8 +56,6 @@ void oopDesc::print_address_on(outputStream* st) const { void oopDesc::print_name_on(outputStream* st) const { if (*((juint*)this) == badHeapWordVal) { st->print_cr("BAD WORD"); - } else if (*((juint*)this) == badMetaWordVal) { - st->print_cr("BAD META WORD"); } else { st->print_cr("%s", klass()->external_name()); } diff --git a/src/hotspot/share/oops/stackChunkOop.cpp b/src/hotspot/share/oops/stackChunkOop.cpp index 4e771939dc9..e114161625b 100644 --- a/src/hotspot/share/oops/stackChunkOop.cpp +++ b/src/hotspot/share/oops/stackChunkOop.cpp @@ -411,8 +411,6 @@ template void stackChunkOopDesc::fix_thawed_frame(const frame& f, const SmallReg void stackChunkOopDesc::print_on(bool verbose, outputStream* st) const { if (*((juint*)this) == badHeapWordVal) { st->print_cr("BAD WORD"); - } else if (*((juint*)this) == badMetaWordVal) { - st->print_cr("BAD META WORD"); } else { InstanceStackChunkKlass::print_chunk(const_cast(this), verbose, st); } diff --git a/src/hotspot/share/opto/arraycopynode.cpp b/src/hotspot/share/opto/arraycopynode.cpp index 9701afd6689..5c10ea3bfc5 100644 --- a/src/hotspot/share/opto/arraycopynode.cpp +++ b/src/hotspot/share/opto/arraycopynode.cpp @@ -159,7 +159,10 @@ int ArrayCopyNode::get_count(PhaseGVN *phase) const { } Node* ArrayCopyNode::load(BarrierSetC2* bs, PhaseGVN *phase, Node*& ctl, MergeMemNode* mem, Node* adr, const TypePtr* adr_type, const Type *type, BasicType bt) { - DecoratorSet decorators = C2_READ_ACCESS | C2_CONTROL_DEPENDENT_LOAD | IN_HEAP | C2_ARRAY_COPY; + // Pin the load: if this is an array load, it's going to be dependent on a condition that's not a range check for that + // access. If that condition is replaced by an identical dominating one, then an unpinned load would risk floating + // above runtime checks that guarantee it is within bounds. + DecoratorSet decorators = C2_READ_ACCESS | C2_CONTROL_DEPENDENT_LOAD | IN_HEAP | C2_ARRAY_COPY | C2_UNKNOWN_CONTROL_LOAD; C2AccessValuePtr addr(adr, adr_type); C2OptAccess access(*phase, ctl, mem, decorators, bt, adr->in(AddPNode::Base), addr); Node* res = bs->load_at(access, type); diff --git a/src/hotspot/share/opto/callnode.cpp b/src/hotspot/share/opto/callnode.cpp index 1255607cec4..924307976f2 100644 --- a/src/hotspot/share/opto/callnode.cpp +++ b/src/hotspot/share/opto/callnode.cpp @@ -2224,7 +2224,7 @@ Node *LockNode::Ideal(PhaseGVN *phase, bool can_reshape) { // If we are locking an non-escaped object, the lock/unlock is unnecessary // ConnectionGraph *cgr = phase->C->congraph(); - if (cgr != nullptr && cgr->not_global_escape(obj_node())) { + if (cgr != nullptr && cgr->can_eliminate_lock(this)) { assert(!is_eliminated() || is_coarsened(), "sanity"); // The lock could be marked eliminated by lock coarsening // code during first IGVN before EA. Replace coarsened flag @@ -2387,6 +2387,7 @@ bool LockNode::is_nested_lock_region(Compile * c) { obj_node = bs->step_over_gc_barrier(obj_node); BoxLockNode* box_node = sfn->monitor_box(jvms, idx)->as_BoxLock(); if ((box_node->stack_slot() < stk_slot) && obj_node->eqv_uncast(obj)) { + box->set_nested(); return true; } } @@ -2421,7 +2422,7 @@ Node *UnlockNode::Ideal(PhaseGVN *phase, bool can_reshape) { // If we are unlocking an non-escaped object, the lock/unlock is unnecessary. // ConnectionGraph *cgr = phase->C->congraph(); - if (cgr != nullptr && cgr->not_global_escape(obj_node())) { + if (cgr != nullptr && cgr->can_eliminate_lock(this)) { assert(!is_eliminated() || is_coarsened(), "sanity"); // The lock could be marked eliminated by lock coarsening // code during first IGVN before EA. Replace coarsened flag diff --git a/src/hotspot/share/opto/cfgnode.hpp b/src/hotspot/share/opto/cfgnode.hpp index 1ede5c77710..e4ce126053b 100644 --- a/src/hotspot/share/opto/cfgnode.hpp +++ b/src/hotspot/share/opto/cfgnode.hpp @@ -430,6 +430,9 @@ class IfNode : public MultiBranchNode { init_req(0,control); init_req(1,b); } + + static IfNode* make_with_same_profile(IfNode* if_node_profile, Node* ctrl, BoolNode* bol); + virtual int Opcode() const; virtual bool pinned() const { return true; } virtual const Type *bottom_type() const { return TypeTuple::IFBOTH; } diff --git a/src/hotspot/share/opto/compile.cpp b/src/hotspot/share/opto/compile.cpp index 7b6f088121e..2320fa4f9da 100644 --- a/src/hotspot/share/opto/compile.cpp +++ b/src/hotspot/share/opto/compile.cpp @@ -57,6 +57,7 @@ #include "opto/escape.hpp" #include "opto/idealGraphPrinter.hpp" #include "opto/inlinetypenode.hpp" +#include "opto/locknode.hpp" #include "opto/loopnode.hpp" #include "opto/machnode.hpp" #include "opto/macro.hpp" @@ -5395,10 +5396,25 @@ void Compile::add_coarsened_locks(GrowableArray& locks) { if (length > 0) { // Have to keep this list until locks elimination during Macro nodes elimination. Lock_List* locks_list = new (comp_arena()) Lock_List(comp_arena(), length); + AbstractLockNode* alock = locks.at(0); + BoxLockNode* box = alock->box_node()->as_BoxLock(); for (int i = 0; i < length; i++) { AbstractLockNode* lock = locks.at(i); assert(lock->is_coarsened(), "expecting only coarsened AbstractLock nodes, but got '%s'[%d] node", lock->Name(), lock->_idx); locks_list->push(lock); + BoxLockNode* this_box = lock->box_node()->as_BoxLock(); + if (this_box != box) { + // Locking regions (BoxLock) could be Unbalanced here: + // - its coarsened locks were eliminated in earlier + // macro nodes elimination followed by loop unroll + // Preserve Unbalanced status in such cases. + if (!this_box->is_unbalanced()) { + this_box->set_coarsened(); + } + if (!box->is_unbalanced()) { + box->set_coarsened(); + } + } } _coarsened_locks.append(locks_list); } @@ -5476,6 +5492,38 @@ bool Compile::coarsened_locks_consistent() { return true; } +// Mark locking regions (identified by BoxLockNode) as unbalanced if +// locks coarsening optimization removed Lock/Unlock nodes from them. +// Such regions become unbalanced because coarsening only removes part +// of Lock/Unlock nodes in region. As result we can't execute other +// locks elimination optimizations which assume all code paths have +// corresponding pair of Lock/Unlock nodes - they are balanced. +void Compile::mark_unbalanced_boxes() const { + int count = coarsened_count(); + for (int i = 0; i < count; i++) { + Node_List* locks_list = _coarsened_locks.at(i); + uint size = locks_list->size(); + if (size > 0) { + AbstractLockNode* alock = locks_list->at(0)->as_AbstractLock(); + BoxLockNode* box = alock->box_node()->as_BoxLock(); + if (alock->is_coarsened()) { + // coarsened_locks_consistent(), which is called before this method, verifies + // that the rest of Lock/Unlock nodes on locks_list are also coarsened. + assert(!box->is_eliminated(), "regions with coarsened locks should not be marked as eliminated"); + for (uint j = 1; j < size; j++) { + assert(locks_list->at(j)->as_AbstractLock()->is_coarsened(), "only coarsened locks are expected here"); + BoxLockNode* this_box = locks_list->at(j)->as_AbstractLock()->box_node()->as_BoxLock(); + if (box != this_box) { + assert(!this_box->is_eliminated(), "regions with coarsened locks should not be marked as eliminated"); + box->set_unbalanced(); + this_box->set_unbalanced(); + } + } + } + } + } +} + /** * Remove the speculative part of types and clean up the graph */ diff --git a/src/hotspot/share/opto/compile.hpp b/src/hotspot/share/opto/compile.hpp index 995f57495e0..b648a480a53 100644 --- a/src/hotspot/share/opto/compile.hpp +++ b/src/hotspot/share/opto/compile.hpp @@ -799,6 +799,7 @@ class Compile : public Phase { void add_coarsened_locks(GrowableArray& locks); void remove_coarsened_lock(Node* n); bool coarsened_locks_consistent(); + void mark_unbalanced_boxes() const; bool post_loop_opts_phase() { return _post_loop_opts_phase; } void set_post_loop_opts_phase() { _post_loop_opts_phase = true; } diff --git a/src/hotspot/share/opto/escape.cpp b/src/hotspot/share/opto/escape.cpp index 7e4cd2f0cf3..cac962acb9e 100644 --- a/src/hotspot/share/opto/escape.cpp +++ b/src/hotspot/share/opto/escape.cpp @@ -38,6 +38,7 @@ #include "opto/compile.hpp" #include "opto/escape.hpp" #include "opto/macro.hpp" +#include "opto/locknode.hpp" #include "opto/phaseX.hpp" #include "opto/movenode.hpp" #include "opto/rootnode.hpp" @@ -2593,7 +2594,7 @@ void ConnectionGraph::optimize_ideal_graph(GrowableArray& ptr_cmp_worklis AbstractLockNode* alock = n->as_AbstractLock(); if (!alock->is_non_esc_obj()) { const Type* obj_type = igvn->type(alock->obj_node()); - if (not_global_escape(alock->obj_node()) && !obj_type->is_inlinetypeptr()) { + if (can_eliminate_lock(alock) && !obj_type->is_inlinetypeptr()) { assert(!alock->is_eliminated() || alock->is_coarsened(), "sanity"); // The lock could be marked eliminated by lock coarsening // code during first IGVN before EA. Replace coarsened flag @@ -2938,6 +2939,21 @@ bool ConnectionGraph::not_global_escape(Node *n) { return true; } +// Return true if locked object does not escape globally +// and locked code region (identified by BoxLockNode) is balanced: +// all compiled code paths have corresponding Lock/Unlock pairs. +bool ConnectionGraph::can_eliminate_lock(AbstractLockNode* alock) { + BoxLockNode* box = alock->box_node()->as_BoxLock(); + if (!box->is_unbalanced() && not_global_escape(alock->obj_node())) { + if (EliminateNestedLocks) { + // We can mark whole locking region as Local only when only + // one object is used for locking. + box->set_local(); + } + return true; + } + return false; +} // Helper functions diff --git a/src/hotspot/share/opto/escape.hpp b/src/hotspot/share/opto/escape.hpp index 7e6bd87d493..4ed7fb7f054 100644 --- a/src/hotspot/share/opto/escape.hpp +++ b/src/hotspot/share/opto/escape.hpp @@ -112,6 +112,7 @@ class Compile; class Node; +class AbstractLockNode; class CallNode; class PhiNode; class PhaseTransform; @@ -630,6 +631,8 @@ class ConnectionGraph: public ArenaObj { bool not_global_escape(Node *n); + bool can_eliminate_lock(AbstractLockNode* alock); + // To be used by, e.g., BarrierSetC2 impls Node* get_addp_base(Node* addp); diff --git a/src/hotspot/share/opto/ifnode.cpp b/src/hotspot/share/opto/ifnode.cpp index e118c81394d..6cd15d028f6 100644 --- a/src/hotspot/share/opto/ifnode.cpp +++ b/src/hotspot/share/opto/ifnode.cpp @@ -454,6 +454,22 @@ static Node* split_if(IfNode *iff, PhaseIterGVN *igvn) { return new ConINode(TypeInt::ZERO); } +IfNode* IfNode::make_with_same_profile(IfNode* if_node_profile, Node* ctrl, BoolNode* bol) { + // Assert here that we only try to create a clone from an If node with the same profiling if that actually makes sense. + // Some If node subtypes should not be cloned in this way. In theory, we should not clone BaseCountedLoopEndNodes. + // But they can end up being used as normal If nodes when peeling a loop - they serve as zero-trip guard. + // Allow them as well. + assert(if_node_profile->Opcode() == Op_If || if_node_profile->is_RangeCheck() + || if_node_profile->is_BaseCountedLoopEnd(), "should not clone other nodes"); + if (if_node_profile->is_RangeCheck()) { + // RangeCheck nodes could be further optimized. + return new RangeCheckNode(ctrl, bol, if_node_profile->_prob, if_node_profile->_fcnt); + } else { + // Not a RangeCheckNode? Fall back to IfNode. + return new IfNode(ctrl, bol, if_node_profile->_prob, if_node_profile->_fcnt); + } +} + // if this IfNode follows a range check pattern return the projection // for the failed path ProjNode* IfNode::range_check_trap_proj(int& flip_test, Node*& l, Node*& r) { diff --git a/src/hotspot/share/opto/locknode.cpp b/src/hotspot/share/opto/locknode.cpp index 9fe9a5f10c5..ad666c04070 100644 --- a/src/hotspot/share/opto/locknode.cpp +++ b/src/hotspot/share/opto/locknode.cpp @@ -40,7 +40,7 @@ const RegMask &BoxLockNode::out_RegMask() const { uint BoxLockNode::size_of() const { return sizeof(*this); } BoxLockNode::BoxLockNode( int slot ) : Node( Compile::current()->root() ), - _slot(slot), _is_eliminated(false) { + _slot(slot), _kind(BoxLockNode::Regular) { init_class_id(Class_BoxLock); init_flags(Flag_rematerialize); OptoReg::Name reg = OptoReg::stack2reg(_slot); @@ -51,19 +51,48 @@ BoxLockNode::BoxLockNode( int slot ) : Node( Compile::current()->root() ), _inmask.Insert(reg); } -//-----------------------------hash-------------------------------------------- uint BoxLockNode::hash() const { - if (EliminateNestedLocks) + if (EliminateNestedLocks) { return NO_HASH; // Each locked region has own BoxLock node - return Node::hash() + _slot + (_is_eliminated ? Compile::current()->fixed_slots() : 0); + } + return Node::hash() + _slot + (is_eliminated() ? Compile::current()->fixed_slots() : 0); } -//------------------------------cmp-------------------------------------------- bool BoxLockNode::cmp( const Node &n ) const { - if (EliminateNestedLocks) + if (EliminateNestedLocks) { return (&n == this); // Always fail except on self + } const BoxLockNode &bn = (const BoxLockNode &)n; - return bn._slot == _slot && bn._is_eliminated == _is_eliminated; + return (bn._slot == _slot) && (bn.is_eliminated() == is_eliminated()); +} + +Node* BoxLockNode::Identity(PhaseGVN* phase) { + if (!EliminateNestedLocks && !this->is_eliminated()) { + Node* n = phase->hash_find(this); + if (n == nullptr || n == this) { + return this; + } + BoxLockNode* old_box = n->as_BoxLock(); + // Set corresponding status (_kind) when commoning BoxLock nodes. + if (this->_kind != old_box->_kind) { + if (this->is_unbalanced()) { + old_box->set_unbalanced(); + } + if (!old_box->is_unbalanced()) { + // Only Regular or Coarsened status should be here: + // Nested and Local are set only when EliminateNestedLocks is on. + if (old_box->is_regular()) { + assert(this->is_coarsened(),"unexpected kind: %s", _kind_name[(int)this->_kind]); + old_box->set_coarsened(); + } else { + assert(this->is_regular(),"unexpected kind: %s", _kind_name[(int)this->_kind]); + assert(old_box->is_coarsened(),"unexpected kind: %s", _kind_name[(int)old_box->_kind]); + } + } + } + return old_box; + } + return this; } BoxLockNode* BoxLockNode::box_node(Node* box) { @@ -90,6 +119,9 @@ OptoReg::Name BoxLockNode::reg(Node* box) { // Is BoxLock node used for one simple lock region (same box and obj)? bool BoxLockNode::is_simple_lock_region(LockNode** unique_lock, Node* obj, Node** bad_lock) { + if (is_unbalanced()) { + return false; + } LockNode* lock = nullptr; bool has_one_lock = false; for (uint i = 0; i < this->outcnt(); i++) { diff --git a/src/hotspot/share/opto/locknode.hpp b/src/hotspot/share/opto/locknode.hpp index dac6bd3480a..9d0f6b4d5f1 100644 --- a/src/hotspot/share/opto/locknode.hpp +++ b/src/hotspot/share/opto/locknode.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,9 +33,37 @@ class RTMLockingCounters; //------------------------------BoxLockNode------------------------------------ class BoxLockNode : public Node { +private: const int _slot; // stack slot RegMask _inmask; // OptoReg corresponding to stack slot - bool _is_eliminated; // Associated locks were safely eliminated + enum { + Regular = 0, // Normal locking region + Local, // EA found that local not escaping object is used for locking + Nested, // This region is inside other region which use the same object + Coarsened, // Some lock/unlock in region were marked as coarsened + Unbalanced, // This region become unbalanced after coarsened lock/unlock were eliminated + // or it is locking region from OSR when locking is done in Interpreter + Eliminated // All lock/unlock in region were eliminated + } _kind; + +#ifdef ASSERT + const char* _kind_name[6] = { + "Regular", + "Local", + "Nested", + "Coarsened", + "Unbalanced", + "Eliminated" + }; +#endif + + // Allowed transitions of _kind: + // Regular -> Local, Nested, Coarsened + // Local -> Eliminated + // Nested -> Eliminated + // Coarsened -> Local, Nested, Unbalanced + // EA and nested lock elimination can overwrite Coarsened kind. + // Also allow transition to the same kind. public: BoxLockNode( int lock ); @@ -49,6 +77,7 @@ class BoxLockNode : public Node { virtual bool cmp( const Node &n ) const; virtual const class Type *bottom_type() const { return TypeRawPtr::BOTTOM; } virtual uint ideal_reg() const { return Op_RegP; } + virtual Node* Identity(PhaseGVN* phase); static OptoReg::Name reg(Node* box_node); static BoxLockNode* box_node(Node* box_node); @@ -57,9 +86,38 @@ class BoxLockNode : public Node { } int stack_slot() const { return _slot; } - bool is_eliminated() const { return _is_eliminated; } - // mark lock as eliminated. - void set_eliminated() { _is_eliminated = true; } + bool is_regular() const { return _kind == Regular; } + bool is_local() const { return _kind == Local; } + bool is_nested() const { return _kind == Nested; } + bool is_coarsened() const { return _kind == Coarsened; } + bool is_eliminated() const { return _kind == Eliminated; } + bool is_unbalanced() const { return _kind == Unbalanced; } + + void set_local() { + assert((_kind == Regular || _kind == Local || _kind == Coarsened), + "incorrect kind for Local transitioni: %s", _kind_name[(int)_kind]); + _kind = Local; + } + void set_nested() { + assert((_kind == Regular || _kind == Nested || _kind == Coarsened), + "incorrect kind for Nested transition: %s", _kind_name[(int)_kind]); + _kind = Nested; + } + void set_coarsened() { + assert((_kind == Regular || _kind == Coarsened), + "incorrect kind for Coarsened transition: %s", _kind_name[(int)_kind]); + _kind = Coarsened; + } + void set_eliminated() { + assert((_kind == Local || _kind == Nested), + "incorrect kind for Eliminated transition: %s", _kind_name[(int)_kind]); + _kind = Eliminated; + } + void set_unbalanced() { + assert((_kind == Coarsened || _kind == Unbalanced), + "incorrect kind for Unbalanced transition: %s", _kind_name[(int)_kind]); + _kind = Unbalanced; + } // Is BoxLock node used for one simple lock region? bool is_simple_lock_region(LockNode** unique_lock, Node* obj, Node** bad_lock); diff --git a/src/hotspot/share/opto/loopUnswitch.cpp b/src/hotspot/share/opto/loopUnswitch.cpp index 8b6f02de63c..e4007f687c8 100644 --- a/src/hotspot/share/opto/loopUnswitch.cpp +++ b/src/hotspot/share/opto/loopUnswitch.cpp @@ -24,8 +24,8 @@ #include "precompiled.hpp" #include "memory/allocation.inline.hpp" -#include "opto/mulnode.hpp" -#include "opto/addnode.hpp" +#include "opto/castnode.hpp" +#include "opto/cfgnode.hpp" #include "opto/connode.hpp" #include "opto/convertnode.hpp" #include "opto/loopnode.hpp" @@ -33,32 +33,63 @@ #include "opto/predicates.hpp" #include "opto/rootnode.hpp" -//================= Loop Unswitching ===================== +// Loop Unswitching is a loop optimization to move an invariant, non-loop-exiting test in the loop body before the loop. +// Such a test is either always true or always false in all loop iterations and could therefore only be executed once. +// To achieve that, we duplicate the loop and change the original and cloned loop as follows: +// - Original loop -> true-path-loop: +// The true-path of the invariant, non-loop-exiting test in the original loop +// is kept while the false-path is killed. We call this unswitched loop version +// the true-path-loop. +// - Cloned loop -> false-path-loop: +// The false-path of the invariant, non-loop-exiting test in the cloned loop +// is kept while the true-path is killed. We call this unswitched loop version +// the false-path loop. // -// orig: transformed: -// if (invariant-test) then -// predicates predicates -// loop loop -// stmt1 stmt1 -// if (invariant-test) then stmt2 -// stmt2 stmt4 -// else endloop -// stmt3 else -// endif predicates [clone] -// stmt4 loop [clone] -// endloop stmt1 [clone] -// stmt3 -// stmt4 [clone] -// endloop -// endif +// The invariant, non-loop-exiting test can now be moved before both loops (to only execute it once) and turned into a +// loop selector If node to select at runtime which unswitched loop version should be executed. +// - Loop selector true? Execute the true-path-loop. +// - Loop selector false? Execute the false-path-loop. // -// Note: the "else" clause may be empty - - -//------------------------------policy_unswitching----------------------------- -// Return TRUE or FALSE if the loop should be unswitched -// (ie. clone loop with an invariant test that does not exit the loop) -bool IdealLoopTree::policy_unswitching( PhaseIdealLoop *phase ) const { +// Note that even though an invariant test that exits the loop could also be optimized with Loop Unswitching, it is more +// efficient to simply peel the loop which achieves the same result in a simpler manner (also see policy_peeling()). +// +// The following graphs summarizes the Loop Unswitching optimization. +// We start with the original loop: +// +// [Predicates] +// | +// Original Loop +// stmt1 +// if (invariant-test) +// if-path +// else +// else-path +// stmt2 +// Endloop +// +// +// which is unswitched into a true-path-loop and a false-path-loop together with a loop selector: +// +// +// [Initialized Assertion Predicates] +// | +// loop selector If (invariant-test) +// / \ +// true? false? +// / \ +// [Cloned Parse Predicates] [Cloned Parse Predicates] +// [Cloned Template [Cloned Template +// Assertion Predicates] Assertion Predicates] +// | | +// True-Path-Loop False-Path-Loop +// cloned stmt1 cloned stmt1 +// cloned if-path cloned else-path +// cloned stmt2 cloned stmt2 +// Endloop Endloop + + +// Return true if the loop should be unswitched or false otherwise. +bool IdealLoopTree::policy_unswitching(PhaseIdealLoop* phase) const { if (!LoopUnswitching) { return false; } @@ -84,7 +115,7 @@ bool IdealLoopTree::policy_unswitching( PhaseIdealLoop *phase ) const { } Node_List unswitch_iffs; - if (phase->find_unswitching_candidate(this, unswitch_iffs) == nullptr) { + if (phase->find_unswitch_candidate(this, unswitch_iffs) == nullptr) { return false; } @@ -92,13 +123,11 @@ bool IdealLoopTree::policy_unswitching( PhaseIdealLoop *phase ) const { return phase->may_require_nodes(est_loop_clone_sz(2)); } -//------------------------------find_unswitching_candidate----------------------------- -// Find candidate "if" for unswitching -IfNode* PhaseIdealLoop::find_unswitching_candidate(const IdealLoopTree *loop, Node_List& unswitch_iffs) const { - - // Find first invariant test that doesn't exit the loop - LoopNode *head = loop->_head->as_Loop(); - IfNode* unswitch_iff = nullptr; +// Find an invariant test in the loop body that does not exit the loop. If multiple tests are found, we pick the first +// one in the loop body. Return the "unswitch candidate" If to apply Loop Unswitching on. +IfNode* PhaseIdealLoop::find_unswitch_candidate(const IdealLoopTree* loop, Node_List& unswitch_iffs) const { + LoopNode* head = loop->_head->as_Loop(); + IfNode* unswitch_candidate = nullptr; Node* n = head->in(LoopNode::LoopBackControl); while (n != head) { Node* n_dom = idom(n); @@ -111,7 +140,8 @@ IfNode* PhaseIdealLoop::find_unswitching_candidate(const IdealLoopTree *loop, No // If condition is invariant and not a loop exit, // then found reason to unswitch. if (loop->is_invariant(bol) && !loop->is_loop_exit(iff)) { - unswitch_iff = iff; + assert(iff->Opcode() == Op_If || iff->is_RangeCheck() || iff->is_BaseCountedLoopEnd(), "valid ifs"); + unswitch_candidate = iff; } } } @@ -119,143 +149,260 @@ IfNode* PhaseIdealLoop::find_unswitching_candidate(const IdealLoopTree *loop, No } n = n_dom; } - if (unswitch_iff != nullptr) { - unswitch_iffs.push(unswitch_iff); + if (unswitch_candidate != nullptr) { + unswitch_iffs.push(unswitch_candidate); } // Collect all non-flat array checks for unswitching to create a fast loop // without checks (only non-flat array accesses) and a slow loop with checks. - if (unswitch_iff == nullptr || unswitch_iff->is_flat_array_check(&_igvn)) { + if (unswitch_candidate == nullptr || unswitch_candidate->is_flat_array_check(&_igvn)) { for (uint i = 0; i < loop->_body.size(); i++) { IfNode* n = loop->_body.at(i)->isa_If(); - if (n != nullptr && n != unswitch_iff && n->is_flat_array_check(&_igvn) && + if (n != nullptr && n != unswitch_candidate && n->is_flat_array_check(&_igvn) && loop->is_invariant(n->in(1)) && !loop->is_loop_exit(n)) { unswitch_iffs.push(n); - if (unswitch_iff == nullptr) { - unswitch_iff = n; + if (unswitch_candidate == nullptr) { + unswitch_candidate = n; } } } } - return unswitch_iff; + return unswitch_candidate; } -//------------------------------do_unswitching----------------------------- -// Clone loop with an invariant test (that does not exit) and -// insert a clone of the test that selects which version to -// execute. -void PhaseIdealLoop::do_unswitching(IdealLoopTree *loop, Node_List &old_new) { - LoopNode* head = loop->_head->as_Loop(); - if (has_control_dependencies_from_predicates(head)) { - return; +// This class creates an If node (i.e. loop selector) that selects if the true-path-loop or the false-path-loop should be +// executed at runtime. This is done by finding an invariant and non-loop-exiting unswitch candidate If node (guaranteed +// to exist at this point) to perform Loop Unswitching on. +class UnswitchedLoopSelector : public StackObj { + PhaseIdealLoop* const _phase; + IdealLoopTree* const _outer_loop; + Node* const _original_loop_entry; + Node_List _unswitch_iffs; + IfNode* const _unswitch_candidate; + const bool _flat_array_checks; + IfNode* const _selector; + IfTrueNode* const _true_path_loop_proj; + IfFalseNode* const _false_path_loop_proj; + + enum PathToLoop { TRUE_PATH, FALSE_PATH }; + + public: + UnswitchedLoopSelector(IdealLoopTree* loop) + : _phase(loop->_phase), + _outer_loop(loop->skip_strip_mined()->_parent), + _original_loop_entry(loop->_head->as_Loop()->skip_strip_mined()->in(LoopNode::EntryControl)), + _unswitch_iffs(), + _unswitch_candidate(find_unswitch_candidate(loop)), + _flat_array_checks(_unswitch_iffs.size() > 1), + _selector(create_selector_if()), + _true_path_loop_proj(create_proj_to_loop(TRUE_PATH)->as_IfTrue()), + _false_path_loop_proj(create_proj_to_loop(FALSE_PATH)->as_IfFalse()) { + } + NONCOPYABLE(UnswitchedLoopSelector); + + private: + IfNode* find_unswitch_candidate(IdealLoopTree* loop) { + IfNode* unswitch_candidate = _phase->find_unswitch_candidate(loop, _unswitch_iffs); + assert(unswitch_candidate != nullptr, "guaranteed to exist by policy_unswitching"); + assert(_phase->is_member(loop, unswitch_candidate), "must be inside original loop"); + return unswitch_candidate; } - // Find first invariant test that doesn't exit the loop - Node_List unswitch_iffs; - IfNode* unswitch_iff = find_unswitching_candidate((const IdealLoopTree *)loop, unswitch_iffs); - assert(unswitch_iff != nullptr && unswitch_iff == unswitch_iffs.at(0), "should be at least one"); - bool flat_array_checks = unswitch_iffs.size() > 1; - -#ifndef PRODUCT - if (TraceLoopOpts) { - tty->print("Unswitch %d ", head->unswitch_count()+1); - loop->dump_head(); - for (uint i = 0; i < unswitch_iffs.size(); i++) { - unswitch_iffs.at(i)->dump(3); - tty->cr(); + IfNode* create_selector_if() const { + IfNode* unswitch_iff = _unswitch_iffs.at(0)->as_If(); + BoolNode* bol = unswitch_iff->in(1)->as_Bool(); + if (_unswitch_iffs.size() > 1) { + // Flat array checks are used on array access to switch between + // a legacy object array access and a flat inline type array + // access. We want the performance impact on legacy accesses to be + // as small as possible so we make two copies of the loop: a fast + // one where all accesses are known to be legacy, a slow one where + // some accesses are to flat arrays. Flat array checks + // can be removed from the fast loop (true proj) but not from the + // slow loop (false proj) as it can have a mix of flat/legacy accesses. + assert(bol->_test._test == BoolTest::ne, "IfTrue proj must point to flat array"); + bol = bol->clone()->as_Bool(); + _phase->register_new_node(bol, _original_loop_entry); + FlatArrayCheckNode* cmp = bol->in(1)->clone()->as_FlatArrayCheck(); + _phase->register_new_node(cmp, _original_loop_entry); + bol->set_req(1, cmp); + // Combine all checks into a single one that fails if one array is a flat array + assert(cmp->req() == 3, "unexpected number of inputs for FlatArrayCheck"); + cmp->add_req_batch(_phase->C->top(), _unswitch_iffs.size() - 1); + for (uint i = 0; i < _unswitch_iffs.size(); i++) { + Node* array = _unswitch_iffs.at(i)->in(1)->in(1)->in(FlatArrayCheckNode::ArrayOrKlass); + cmp->set_req(FlatArrayCheckNode::ArrayOrKlass + i, array); + } } + + const uint dom_depth = _phase->dom_depth(_original_loop_entry); + _phase->igvn().rehash_node_delayed(_original_loop_entry); + IfNode* selector_if = IfNode::make_with_same_profile(_unswitch_candidate, _original_loop_entry, bol); + _phase->register_node(selector_if, _outer_loop, _original_loop_entry, dom_depth); + return selector_if; } -#endif - C->print_method(PHASE_BEFORE_LOOP_UNSWITCHING, 4, head); - - // Need to revert back to normal loop - if (head->is_CountedLoop() && !head->as_CountedLoop()->is_normal_loop()) { - head->as_CountedLoop()->set_normal_loop(); - } - - IfNode* invar_iff = create_slow_version_of_loop(loop, old_new, unswitch_iffs, CloneIncludesStripMined); - ProjNode* proj_true = invar_iff->proj_out(1); - verify_fast_loop(head, proj_true); - - // Increment unswitch count - LoopNode* head_clone = old_new[head->_idx]->as_Loop(); - int nct = head->unswitch_count() + 1; - head->set_unswitch_count(nct); - head_clone->set_unswitch_count(nct); - - // Hoist invariant casts out of each loop to the appropriate control projection. - Node_List worklist; - for (uint i = 0; i < unswitch_iffs.size(); i++) { - IfNode* iff = unswitch_iffs.at(i)->as_If(); - for (DUIterator_Fast imax, i = iff->fast_outs(imax); i < imax; i++) { - ProjNode* proj = iff->fast_out(i)->as_Proj(); - // Copy to a worklist for easier manipulation - for (DUIterator_Fast jmax, j = proj->fast_outs(jmax); j < jmax; j++) { - Node* use = proj->fast_out(j); - if (use->Opcode() == Op_CheckCastPP && loop->is_invariant(use->in(1))) { - worklist.push(use); - } - } - ProjNode* invar_proj = invar_iff->proj_out(proj->_con)->as_Proj(); - while (worklist.size() > 0) { - Node* use = worklist.pop(); - Node* nuse = use->clone(); - nuse->set_req(0, invar_proj); - _igvn.replace_input_of(use, 1, nuse); - register_new_node(nuse, invar_proj); - // Same for the clone if we are removing checks from the slow loop - if (!flat_array_checks) { - Node* use_clone = old_new[use->_idx]; - _igvn.replace_input_of(use_clone, 1, nuse); - } - } + IfProjNode* create_proj_to_loop(const PathToLoop path_to_loop) { + const uint dom_depth = _phase->dom_depth(_original_loop_entry); + IfProjNode* proj_to_loop; + if (path_to_loop == TRUE_PATH) { + proj_to_loop = new IfTrueNode(_selector); + } else { + proj_to_loop = new IfFalseNode(_selector); } + _phase->register_node(proj_to_loop, _outer_loop, _selector, dom_depth); + return proj_to_loop; } - // Hardwire the control paths in the loops into if(true) and if(false) - for (uint i = 0; i < unswitch_iffs.size(); i++) { - IfNode* iff = unswitch_iffs.at(i)->as_If(); - _igvn.rehash_node_delayed(iff); - dominated_by(proj_true->as_IfProj(), iff); + public: + IfNode* unswitch_candidate() const { + return _unswitch_candidate; } - IfNode* unswitch_iff_clone = old_new[unswitch_iff->_idx]->as_If(); - if (!flat_array_checks) { - ProjNode* proj_false = invar_iff->proj_out(0)->as_Proj(); - _igvn.rehash_node_delayed(unswitch_iff_clone); - dominated_by(proj_false->as_IfProj(), unswitch_iff_clone); - } else { - // Leave the flat array checks in the slow loop and - // prevent it from being unswitched again based on these checks. - head_clone->mark_flat_arrays(); + + IfNode* selector() const { + return _selector; } - // Reoptimize loops - loop->record_for_igvn(); - for(int i = loop->_body.size() - 1; i >= 0 ; i--) { - Node *n = loop->_body[i]; - Node *n_clone = old_new[n->_idx]; - _igvn._worklist.push(n_clone); + IfTrueNode* true_path_loop_proj() const { + return _true_path_loop_proj; } -#ifndef PRODUCT - if (TraceLoopUnswitching) { + IfFalseNode* false_path_loop_proj() const { + return _false_path_loop_proj; + } + + bool has_flat_array_checks() const { + return _flat_array_checks; + } + + const Node_List& unswitch_iffs() const { + return _unswitch_iffs; + } +}; + +// Class to unswitch the original loop and create Predicates at the new unswitched loop versions. The newly cloned loop +// becomes the false-path-loop while original loop becomes the true-path-loop. +class OriginalLoop : public StackObj { + LoopNode* const _loop_head; // OuterStripMinedLoopNode if loop strip mined, else just the loop head. + IdealLoopTree* const _loop; + Node_List& _old_new; + PhaseIdealLoop* const _phase; + + public: + OriginalLoop(IdealLoopTree* loop, Node_List& old_new) + : _loop_head(loop->_head->as_Loop()->skip_strip_mined()), + _loop(loop), + _old_new(old_new), + _phase(loop->_phase) {} + NONCOPYABLE(OriginalLoop); + + private: + void fix_loop_entries(IfProjNode* true_path_loop_entry, IfProjNode* false_path_loop_entry) { + _phase->replace_loop_entry(_loop_head, true_path_loop_entry); + LoopNode* false_path_loop_strip_mined_head = old_to_new(_loop_head)->as_Loop(); + _phase->replace_loop_entry(false_path_loop_strip_mined_head, false_path_loop_entry); + } + + Node* old_to_new(const Node* old) const { + return _old_new[old->_idx]; + } + +#ifdef ASSERT + void verify_unswitched_loop_versions(LoopNode* true_path_loop_head, + const UnswitchedLoopSelector& unswitched_loop_selector) const { + verify_unswitched_loop_version(true_path_loop_head, unswitched_loop_selector.true_path_loop_proj()); + verify_unswitched_loop_version(old_to_new(true_path_loop_head)->as_Loop(), + unswitched_loop_selector.false_path_loop_proj()); + } + + static void verify_unswitched_loop_version(LoopNode* loop_head, IfProjNode* loop_selector_if_proj) { + Node* entry = loop_head->skip_strip_mined()->in(LoopNode::EntryControl); + const Predicates predicates(entry); + // When skipping all predicates, we should end up at 'loop_selector_if_proj'. + assert(loop_selector_if_proj == predicates.entry(), "should end up at loop selector If"); + } +#endif // ASSERT + + // Remove the unswitch candidate If nodes in both unswitched loop versions which are now dominated by the loop selector + // If node. Keep the true-path-path in the true-path-loop and the false-path-path in the false-path-loop by setting + // the bool input accordingly. The unswitch candidate If nodes are folded in the next IGVN round. + void remove_unswitch_candidate_from_loops(const UnswitchedLoopSelector& unswitched_loop_selector) { + const Node_List& unswitch_iffs = unswitched_loop_selector.unswitch_iffs(); for (uint i = 0; i < unswitch_iffs.size(); i++) { - tty->print_cr("Loop unswitching orig: %d @ %d new: %d @ %d", - head->_idx, unswitch_iffs.at(i)->_idx, - old_new[head->_idx]->_idx, old_new[unswitch_iffs.at(i)->_idx]->_idx); + IfNode* iff = unswitch_iffs.at(i)->as_If(); + _phase->igvn().rehash_node_delayed(iff); + _phase->dominated_by(unswitched_loop_selector.true_path_loop_proj(), iff); + } + + if (unswitched_loop_selector.has_flat_array_checks()) { + // Leave the flat array checks in the slow loop and + // prevent it from being unswitched again based on these checks. + old_to_new(_loop_head)->as_Loop()->mark_flat_arrays(); + } else { + IfNode* unswitching_candidate_clone = _old_new[unswitched_loop_selector.unswitch_candidate()->_idx]->as_If(); + _phase->igvn().rehash_node_delayed(unswitching_candidate_clone); + _phase->dominated_by(unswitched_loop_selector.false_path_loop_proj(), unswitching_candidate_clone); } } -#endif - C->print_method(PHASE_AFTER_LOOP_UNSWITCHING, 4, head_clone); + public: + // Unswitch the original loop on the invariant loop selector by creating a true-path-loop and a false-path-loop. + // Remove the unswitch candidate If from both unswitched loop versions which are now covered by the loop selector If. + void unswitch(const UnswitchedLoopSelector& unswitched_loop_selector) { + _phase->clone_loop(_loop, _old_new, _phase->dom_depth(_loop_head), + PhaseIdealLoop::CloneIncludesStripMined, unswitched_loop_selector.selector()); + + // At this point, the selector If projections are the corresponding loop entries. + // clone_parse_and_assertion_predicates_to_unswitched_loop() could clone additional predicates after the selector + // If projections. The loop entries are updated accordingly. + IfProjNode* true_path_loop_entry = unswitched_loop_selector.true_path_loop_proj(); + IfProjNode* false_path_loop_entry = unswitched_loop_selector.false_path_loop_proj(); + _phase->clone_parse_and_assertion_predicates_to_unswitched_loop(_loop, _old_new, + true_path_loop_entry, false_path_loop_entry); + + fix_loop_entries(true_path_loop_entry, false_path_loop_entry); + + DEBUG_ONLY(verify_unswitched_loop_versions(_loop->_head->as_Loop(), unswitched_loop_selector);) + + _phase->recompute_dom_depth(); + remove_unswitch_candidate_from_loops(unswitched_loop_selector); + } +}; + +// See comments below file header for more information about Loop Unswitching. +void PhaseIdealLoop::do_unswitching(IdealLoopTree* loop, Node_List& old_new) { + assert(LoopUnswitching, "LoopUnswitching must be enabled"); + + LoopNode* original_head = loop->_head->as_Loop(); + if (has_control_dependencies_from_predicates(original_head)) { + NOT_PRODUCT(trace_loop_unswitching_impossible(original_head);) + return; + } + + const UnswitchedLoopSelector unswitched_loop_selector(loop); + + NOT_PRODUCT(trace_loop_unswitching_count(loop, original_head, unswitched_loop_selector.unswitch_iffs());) + C->print_method(PHASE_BEFORE_LOOP_UNSWITCHING, 4, original_head); + revert_to_normal_loop(original_head); + + OriginalLoop original_loop(loop, old_new); + original_loop.unswitch(unswitched_loop_selector); + + hoist_invariant_check_casts(loop, old_new, unswitched_loop_selector); + add_unswitched_loop_version_bodies_to_igvn(loop, old_new); + + LoopNode* new_head = old_new[original_head->_idx]->as_Loop(); + increment_unswitch_counts(original_head, new_head); + + NOT_PRODUCT(trace_loop_unswitching_result(unswitched_loop_selector, original_head, new_head, old_new);) + C->print_method(PHASE_AFTER_LOOP_UNSWITCHING, 4, new_head); C->set_major_progress(); } -bool PhaseIdealLoop::has_control_dependencies_from_predicates(LoopNode* head) const { +bool PhaseIdealLoop::has_control_dependencies_from_predicates(LoopNode* head) { Node* entry = head->skip_strip_mined()->in(LoopNode::EntryControl); - Predicates predicates(entry); + const Predicates predicates(entry); if (predicates.has_any()) { assert(entry->is_IfProj(), "sanity - must be ifProj since there is at least one predicate"); if (entry->outcnt() > 1) { @@ -268,95 +415,105 @@ bool PhaseIdealLoop::has_control_dependencies_from_predicates(LoopNode* head) co return false; } -//-------------------------create_slow_version_of_loop------------------------ -// Create a slow version of the loop by cloning the loop -// and inserting an if to select fast-slow versions. -// Return the inserted if. -IfNode* PhaseIdealLoop::create_slow_version_of_loop(IdealLoopTree *loop, - Node_List &old_new, - Node_List &unswitch_iffs, - CloneLoopMode mode) { - LoopNode* head = loop->_head->as_Loop(); - bool counted_loop = head->is_CountedLoop(); - Node* entry = head->skip_strip_mined()->in(LoopNode::EntryControl); - _igvn.rehash_node_delayed(entry); - IdealLoopTree* outer_loop = loop->_parent; - - head->verify_strip_mined(1); - - // Add test to new "if" outside of loop - IfNode* unswitch_iff = unswitch_iffs.at(0)->as_If(); - BoolNode* bol = unswitch_iff->in(1)->as_Bool(); - if (unswitch_iffs.size() > 1) { - // Flat array checks are used on array access to switch between - // a legacy object array access and a flat inline type array - // access. We want the performance impact on legacy accesses to be - // as small as possible so we make two copies of the loop: a fast - // one where all accesses are known to be legacy, a slow one where - // some accesses are to flat arrays. Flat array checks - // can be removed from the fast loop (true proj) but not from the - // slow loop (false proj) as it can have a mix of flat/legacy accesses. - assert(bol->_test._test == BoolTest::ne, "IfTrue proj must point to flat array"); - bol = bol->clone()->as_Bool(); - register_new_node(bol, entry); - FlatArrayCheckNode* cmp = bol->in(1)->clone()->as_FlatArrayCheck(); - register_new_node(cmp, entry); - bol->set_req(1, cmp); - // Combine all checks into a single one that fails if one array is a flat array - assert(cmp->req() == 3, "unexpected number of inputs for FlatArrayCheck"); - cmp->add_req_batch(C->top(), unswitch_iffs.size() - 1); +#ifndef PRODUCT +void PhaseIdealLoop::trace_loop_unswitching_impossible(const LoopNode* original_head) { + if (TraceLoopUnswitching) { + tty->print_cr("Loop Unswitching \"%d %s\" not possible due to control dependencies", + original_head->_idx, original_head->Name()); + } +} + +void PhaseIdealLoop::trace_loop_unswitching_count(IdealLoopTree* loop, LoopNode* original_head, + const Node_List& unswitch_iffs) { + if (TraceLoopOpts) { + tty->print("Unswitch %d ", original_head->unswitch_count() + 1); + loop->dump_head(); for (uint i = 0; i < unswitch_iffs.size(); i++) { - Node* array = unswitch_iffs.at(i)->in(1)->in(1)->in(FlatArrayCheckNode::ArrayOrKlass); - cmp->set_req(FlatArrayCheckNode::ArrayOrKlass + i, array); + unswitch_iffs.at(i)->dump(3); + tty->cr(); } } +} - IfNode* iff = (unswitch_iff->Opcode() == Op_RangeCheck) ? new RangeCheckNode(entry, bol, unswitch_iff->_prob, unswitch_iff->_fcnt) : - new IfNode(entry, bol, unswitch_iff->_prob, unswitch_iff->_fcnt); - register_node(iff, outer_loop, entry, dom_depth(entry)); - IfProjNode* iffast = new IfTrueNode(iff); - register_node(iffast, outer_loop, iff, dom_depth(iff)); - IfProjNode* ifslow = new IfFalseNode(iff); - register_node(ifslow, outer_loop, iff, dom_depth(iff)); - - // Clone the loop body. The clone becomes the slow loop. The - // original pre-header will (illegally) have 3 control users - // (old & new loops & new if). - clone_loop(loop, old_new, dom_depth(head->skip_strip_mined()), mode, iff); - assert(old_new[head->_idx]->is_Loop(), "" ); - - // Fast (true) and Slow (false) control - IfProjNode* iffast_pred = iffast; - IfProjNode* ifslow_pred = ifslow; - clone_parse_and_assertion_predicates_to_unswitched_loop(loop, old_new, iffast_pred, ifslow_pred); - - Node* l = head->skip_strip_mined(); - _igvn.replace_input_of(l, LoopNode::EntryControl, iffast_pred); - set_idom(l, iffast_pred, dom_depth(l)); - LoopNode* slow_l = old_new[head->_idx]->as_Loop()->skip_strip_mined(); - _igvn.replace_input_of(slow_l, LoopNode::EntryControl, ifslow_pred); - set_idom(slow_l, ifslow_pred, dom_depth(l)); +void PhaseIdealLoop::trace_loop_unswitching_result(const UnswitchedLoopSelector& unswitched_loop_selector, + const LoopNode* original_head, const LoopNode* new_head, + const Node_List& old_new) { + if (TraceLoopUnswitching) { + IfNode* unswitch_candidate = unswitched_loop_selector.unswitch_candidate(); + IfNode* loop_selector = unswitched_loop_selector.selector(); + tty->print_cr("Loop Unswitching:"); + tty->print_cr("- Unswitch-Candidate-If: %d %s", unswitch_candidate->_idx, unswitch_candidate->Name()); + tty->print_cr("- Loop-Selector-If: %d %s", loop_selector->_idx, loop_selector->Name()); + tty->print_cr("- True-Path-Loop (=Orig): %d %s", original_head->_idx, original_head->Name()); + tty->print_cr("- False-Path-Loop (=Clone): %d %s", new_head->_idx, new_head->Name()); + if (unswitched_loop_selector.has_flat_array_checks()) { + const Node_List& unswitch_iffs = unswitched_loop_selector.unswitch_iffs(); + tty->print_cr("- Unswitched Flat Array Checks:"); + for (uint i = 0; i < unswitch_iffs.size(); i++) { + Node* unswitch_iff = unswitch_iffs.at(i); + Node* cloned_unswitch_iff = old_new[unswitch_iff->_idx]; + assert(cloned_unswitch_iff != nullptr, "must exist"); + tty->print_cr(" - %d %s -> %d %s", unswitch_iff->_idx, unswitch_iff->Name(), + cloned_unswitch_iff->_idx, cloned_unswitch_iff->Name()); + } + } + } +} +#endif - recompute_dom_depth(); +// When unswitching a counted loop, we need to convert it back to a normal loop since it's not a proper pre, main or, +// post loop anymore after loop unswitching. +void PhaseIdealLoop::revert_to_normal_loop(const LoopNode* loop_head) { + CountedLoopNode* cl = loop_head->isa_CountedLoop(); + if (cl != nullptr && !cl->is_normal_loop()) { + cl->set_normal_loop(); + } +} - return iff; +// Hoist invariant CheckCastPPNodes out of each unswitched loop version to the appropriate loop selector If projection. +void PhaseIdealLoop::hoist_invariant_check_casts(const IdealLoopTree* loop, const Node_List& old_new, + const UnswitchedLoopSelector& unswitched_loop_selector) { + IfNode* unswitch_candidate = unswitched_loop_selector.unswitch_candidate(); + IfNode* loop_selector = unswitched_loop_selector.selector(); + ResourceMark rm; + GrowableArray loop_invariant_check_casts; + for (DUIterator_Fast imax, i = unswitch_candidate->fast_outs(imax); i < imax; i++) { + IfProjNode* proj = unswitch_candidate->fast_out(i)->as_IfProj(); + // Copy to a worklist for easier manipulation + for (DUIterator_Fast jmax, j = proj->fast_outs(jmax); j < jmax; j++) { + CheckCastPPNode* check_cast = proj->fast_out(j)->isa_CheckCastPP(); + if (check_cast != nullptr && loop->is_invariant(check_cast->in(1))) { + loop_invariant_check_casts.push(check_cast); + } + } + IfProjNode* loop_selector_if_proj = loop_selector->proj_out(proj->_con)->as_IfProj(); + while (loop_invariant_check_casts.length() > 0) { + CheckCastPPNode* cast = loop_invariant_check_casts.pop(); + Node* cast_clone = cast->clone(); + cast_clone->set_req(0, loop_selector_if_proj); + _igvn.replace_input_of(cast, 1, cast_clone); + register_new_node(cast_clone, loop_selector_if_proj); + // Same for the clone + if (!unswitched_loop_selector.has_flat_array_checks()) { + Node* use_clone = old_new[cast->_idx]; + _igvn.replace_input_of(use_clone, 1, cast_clone); + } + } + } } -#ifdef ASSERT -void PhaseIdealLoop::verify_fast_loop(LoopNode* head, const ProjNode* proj_true) const { - assert(proj_true->is_IfTrue(), "must be true projection"); - Node* entry = head->skip_strip_mined()->in(LoopNode::EntryControl); - Predicates predicates(entry); - if (!predicates.has_any()) { - // No Parse Predicate. - Node* uniqc = proj_true->unique_ctrl_out(); - assert((uniqc == head && !head->is_strip_mined()) || (uniqc == head->in(LoopNode::EntryControl) - && head->is_strip_mined()), "must hold by construction if no predicates"); - } else { - // There is at least one Parse Predicate. When skipping all predicates/predicate blocks, we should end up - // at 'proj_true'. - assert(proj_true == predicates.entry(), "must hold by construction if at least one Parse Predicate"); +// Enable more optimizations possibilities in the next IGVN round. +void PhaseIdealLoop::add_unswitched_loop_version_bodies_to_igvn(IdealLoopTree* loop, const Node_List& old_new) { + loop->record_for_igvn(); + for(int i = loop->_body.size() - 1; i >= 0 ; i--) { + Node* n = loop->_body[i]; + Node* n_clone = old_new[n->_idx]; + _igvn._worklist.push(n_clone); } } -#endif // ASSERT +void PhaseIdealLoop::increment_unswitch_counts(LoopNode* original_head, LoopNode* new_head) { + const int unswitch_count = original_head->unswitch_count() + 1; + original_head->set_unswitch_count(unswitch_count); + new_head->set_unswitch_count(unswitch_count); +} diff --git a/src/hotspot/share/opto/loopnode.hpp b/src/hotspot/share/opto/loopnode.hpp index 17765bd20fa..dff3c716644 100644 --- a/src/hotspot/share/opto/loopnode.hpp +++ b/src/hotspot/share/opto/loopnode.hpp @@ -42,6 +42,7 @@ class OuterStripMinedLoopEndNode; class PredicateBlock; class PathFrequency; class PhaseIdealLoop; +class UnswitchedLoopSelector; class VectorSet; class VSharedData; class Invariance; @@ -773,6 +774,12 @@ class IdealLoopTree : public ResourceObj { return _has_range_checks; } + // Return the parent's IdealLoopTree for a strip mined loop which is the outer strip mined loop. + // In all other cases, return this. + IdealLoopTree* skip_strip_mined() { + return _head->as_Loop()->is_strip_mined() ? _parent : this; + } + #ifndef PRODUCT void dump_head(); // Dump loop head only void dump(); // Dump this loop recursively @@ -1352,6 +1359,11 @@ class PhaseIdealLoop : public PhaseTransform { public: void register_control(Node* n, IdealLoopTree *loop, Node* pred, bool update_body = true); + void replace_loop_entry(LoopNode* loop_head, Node* new_entry) { + _igvn.replace_input_of(loop_head, LoopNode::EntryControl, new_entry); + set_idom(loop_head, new_entry, dom_depth(new_entry)); + } + // Construct a range check for a predicate if BoolNode* rc_predicate(IdealLoopTree* loop, Node* ctrl, int scale, Node* offset, Node* init, Node* limit, jint stride, Node* range, bool upper, bool& overflow); @@ -1391,8 +1403,6 @@ class PhaseIdealLoop : public PhaseTransform { void eliminate_useless_zero_trip_guard(); - bool has_control_dependencies_from_predicates(LoopNode* head) const; - void verify_fast_loop(LoopNode* head, const ProjNode* proj_true) const NOT_DEBUG_RETURN; public: // Change the control input of expensive nodes to allow commoning by // IGVN when it is guaranteed to not result in a more frequent @@ -1407,21 +1417,32 @@ class PhaseIdealLoop : public PhaseTransform { // Eliminate range-checks and other trip-counter vs loop-invariant tests. void do_range_check(IdealLoopTree *loop, Node_List &old_new); - // Create a slow version of the loop by cloning the loop - // and inserting an if to select fast-slow versions. - // Return the inserted if. - IfNode* create_slow_version_of_loop(IdealLoopTree *loop, - Node_List &old_new, - Node_List &unswitch_iffs, - CloneLoopMode mode); - // Clone loop with an invariant test (that does not exit) and // insert a clone of the test that selects which version to // execute. - void do_unswitching (IdealLoopTree *loop, Node_List &old_new); + void do_unswitching(IdealLoopTree* loop, Node_List& old_new); // Find candidate "if" for unswitching - IfNode* find_unswitching_candidate(const IdealLoopTree *loop, Node_List& unswitch_iffs) const; + IfNode* find_unswitch_candidate(const IdealLoopTree* loop, Node_List& unswitch_iffs) const; + + private: + static bool has_control_dependencies_from_predicates(LoopNode* head); + static void revert_to_normal_loop(const LoopNode* loop_head); + + void hoist_invariant_check_casts(const IdealLoopTree* loop, const Node_List& old_new, + const UnswitchedLoopSelector& unswitched_loop_selector); + void add_unswitched_loop_version_bodies_to_igvn(IdealLoopTree* loop, const Node_List& old_new); + static void increment_unswitch_counts(LoopNode* original_head, LoopNode* new_head); + void remove_unswitch_candidate_from_loops(const Node_List& old_new, const UnswitchedLoopSelector& unswitched_loop_selector); +#ifndef PRODUCT + static void trace_loop_unswitching_count(IdealLoopTree* loop, LoopNode* original_head, const Node_List& unswitch_iffs); + static void trace_loop_unswitching_impossible(const LoopNode* original_head); + static void trace_loop_unswitching_result(const UnswitchedLoopSelector& unswitched_loop_selector, + const LoopNode* original_head, const LoopNode* new_head, + const Node_List& old_new); +#endif + + public: // Range Check Elimination uses this function! // Constrain the main loop iterations so the affine function: @@ -1630,9 +1651,11 @@ class PhaseIdealLoop : public PhaseTransform { _nodes_required = UINT_MAX; } + public: // Clone Parse Predicates to slow and fast loop when unswitching a loop void clone_parse_and_assertion_predicates_to_unswitched_loop(IdealLoopTree* loop, Node_List& old_new, IfProjNode*& iffast_pred, IfProjNode*& ifslow_pred); + private: void clone_loop_predication_predicates_to_unswitched_loop(IdealLoopTree* loop, const Node_List& old_new, const PredicateBlock* predicate_block, Deoptimization::DeoptReason reason, IfProjNode*& iffast_pred, @@ -1749,6 +1772,8 @@ class PhaseIdealLoop : public PhaseTransform { void update_addp_chain_base(Node* x, Node* old_base, Node* new_base); bool can_move_to_inner_loop(Node* n, LoopNode* n_loop, Node* x); + + void pin_array_access_nodes_dependent_on(Node* ctrl); }; diff --git a/src/hotspot/share/opto/loopopts.cpp b/src/hotspot/share/opto/loopopts.cpp index 2b2b7103e77..3c7e293f975 100644 --- a/src/hotspot/share/opto/loopopts.cpp +++ b/src/hotspot/share/opto/loopopts.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -578,8 +578,8 @@ Node* PhaseIdealLoop::remix_address_expressions(Node* n) { } // Replace ((I1 +p V) +p I2) with ((I1 +p I2) +p V), - // but not if I2 is a constant. - if (n_op == Op_AddP) { + // but not if I2 is a constant. Skip for irreducible loops. + if (n_op == Op_AddP && n_loop->_head->is_Loop()) { if (n2_loop == n_loop && n3_loop != n_loop) { if (n->in(2)->Opcode() == Op_AddP && !n->in(3)->is_Con()) { Node* n22_ctrl = get_ctrl(n->in(2)->in(2)); @@ -1657,7 +1657,16 @@ void PhaseIdealLoop::split_if_with_blocks_post(Node *n) { // Replace the dominated test with an obvious true or false. // Place it on the IGVN worklist for later cleanup. C->set_major_progress(); - dominated_by(prevdom->as_IfProj(), n->as_If()); + // Split if: pin array accesses that are control dependent on a range check and moved to a regular if, + // to prevent an array load from floating above its range check. There are three cases: + // 1. Move from RangeCheck "a" to RangeCheck "b": don't need to pin. If we ever remove b, then we pin + // all its array accesses at that point. + // 2. We move from RangeCheck "a" to regular if "b": need to pin. If we ever remove b, then its array + // accesses would start to float, since we don't pin at that point. + // 3. If we move from regular if: don't pin. All array accesses are already assumed to be pinned. + bool pin_array_access_nodes = n->Opcode() == Op_RangeCheck && + prevdom->in(0)->Opcode() != Op_RangeCheck; + dominated_by(prevdom->as_IfProj(), n->as_If(), false, pin_array_access_nodes); DEBUG_ONLY( if (VerifyLoopOptimizations) { verify(); } ); return; } @@ -1836,7 +1845,20 @@ void PhaseIdealLoop::try_sink_out_of_loop(Node* n) { // n has a control input inside a loop but get_ctrl() is member of an outer loop. This could happen, for example, // for Div nodes inside a loop (control input inside loop) without a use except for an UCT (outside the loop). // Rewire control of n to right outside of the loop, regardless if its input(s) are later sunk or not. - _igvn.replace_input_of(n, 0, place_outside_loop(n_ctrl, loop_ctrl)); + Node* maybe_pinned_n = n; + Node* outside_ctrl = place_outside_loop(n_ctrl, loop_ctrl); + if (n->depends_only_on_test()) { + Node* pinned_clone = n->pin_array_access_node(); + if (pinned_clone != nullptr) { + // Pin array access nodes: if this is an array load, it's going to be dependent on a condition that's not a + // range check for that access. If that condition is replaced by an identical dominating one, then an + // unpinned load would risk floating above its range check. + register_new_node(pinned_clone, n_ctrl); + maybe_pinned_n = pinned_clone; + _igvn.replace_node(n, pinned_clone); + } + } + _igvn.replace_input_of(maybe_pinned_n, 0, outside_ctrl); } } if (n_loop != _ltree_root && n->outcnt() > 1) { @@ -1850,7 +1872,16 @@ void PhaseIdealLoop::try_sink_out_of_loop(Node* n) { for (DUIterator_Last jmin, j = n->last_outs(jmin); j >= jmin;) { Node* u = n->last_out(j); // Clone private computation per use _igvn.rehash_node_delayed(u); - Node* x = n->clone(); // Clone computation + Node* x = nullptr; + if (n->depends_only_on_test()) { + // Pin array access nodes: if this is an array load, it's going to be dependent on a condition that's not a + // range check for that access. If that condition is replaced by an identical dominating one, then an + // unpinned load would risk floating above its range check. + x = n->pin_array_access_node(); + } + if (x == nullptr) { + x = n->clone(); + } Node* x_ctrl = nullptr; if (u->is_Phi()) { // Replace all uses of normal nodes. Replace Phi uses @@ -2408,6 +2439,20 @@ void PhaseIdealLoop::clone_loop_handle_data_uses(Node* old, Node_List &old_new, // We notify all uses of old, including use, and the indirect uses, // that may now be optimized because we have replaced old with phi. _igvn.add_users_to_worklist(old); + if (idx == 0 && + use->depends_only_on_test()) { + Node* pinned_clone = use->pin_array_access_node(); + if (pinned_clone != nullptr) { + // Pin array access nodes: control is updated here to a region. If, after some transformations, only one path + // into the region is left, an array load could become dependent on a condition that's not a range check for + // that access. If that condition is replaced by an identical dominating one, then an unpinned load would risk + // floating above its range check. + pinned_clone->set_req(0, phi); + register_new_node(pinned_clone, get_ctrl(use)); + _igvn.replace_node(use, pinned_clone); + continue; + } + } _igvn.replace_input_of(use, idx, phi); if( use->_idx >= new_counter ) { // If updating new phis // Not needed for correctness, but prevents a weak assert @@ -3047,8 +3092,7 @@ ProjNode* PhaseIdealLoop::insert_if_before_proj(Node* left, bool Signed, BoolTes int opcode = iff->Opcode(); assert(opcode == Op_If || opcode == Op_RangeCheck, "unexpected opcode"); - IfNode* new_if = (opcode == Op_If) ? new IfNode(proj2, bol, iff->_prob, iff->_fcnt): - new RangeCheckNode(proj2, bol, iff->_prob, iff->_fcnt); + IfNode* new_if = IfNode::make_with_same_profile(iff, proj2, bol); register_node(new_if, loop, proj2, ddepth); proj->set_req(0, new_if); // reattach @@ -4043,6 +4087,19 @@ bool PhaseIdealLoop::partial_peel( IdealLoopTree *loop, Node_List &old_new ) { if (!n->is_CFG() && n->in(0) != nullptr && not_peel.test(n->_idx) && peel.test(n->in(0)->_idx)) { Node* n_clone = old_new[n->_idx]; + if (n_clone->depends_only_on_test()) { + // Pin array access nodes: control is updated here to the loop head. If, after some transformations, the + // backedge is removed, an array load could become dependent on a condition that's not a range check for that + // access. If that condition is replaced by an identical dominating one, then an unpinned load would risk + // floating above its range check. + Node* pinned_clone = n_clone->pin_array_access_node(); + if (pinned_clone != nullptr) { + register_new_node(pinned_clone, get_ctrl(n_clone)); + old_new.map(n->_idx, pinned_clone); + _igvn.replace_node(n_clone, pinned_clone); + n_clone = pinned_clone; + } + } _igvn.replace_input_of(n_clone, 0, new_head_clone); } } @@ -4373,7 +4430,8 @@ bool PhaseIdealLoop::duplicate_loop_backedge(IdealLoopTree *loop, Node_List &old Node_List *split_if_set = nullptr; Node_List *split_bool_set = nullptr; Node_List *split_cex_set = nullptr; - fix_data_uses(wq, loop, ControlAroundStripMined, head->is_strip_mined() ? loop->_parent : loop, new_counter, old_new, worklist, split_if_set, split_bool_set, split_cex_set); + fix_data_uses(wq, loop, ControlAroundStripMined, loop->skip_strip_mined(), new_counter, old_new, worklist, + split_if_set, split_bool_set, split_cex_set); finish_clone_loop(split_if_set, split_bool_set, split_cex_set); @@ -4412,7 +4470,12 @@ PhaseIdealLoop::auto_vectorize(IdealLoopTree* lpt, VSharedData &vshared) { // Ensure the shared data is cleared before each use vshared.clear(); - SuperWord sw(vloop, vshared); + const VLoopAnalyzer vloop_analyzer(vloop, vshared); + if (!vloop_analyzer.success()) { + return AutoVectorizeStatus::TriedAndFailed; + } + + SuperWord sw(vloop_analyzer); if (!sw.transform_loop()) { return AutoVectorizeStatus::TriedAndFailed; } diff --git a/src/hotspot/share/opto/macro.cpp b/src/hotspot/share/opto/macro.cpp index ccbdbd85286..ae6282407d6 100644 --- a/src/hotspot/share/opto/macro.cpp +++ b/src/hotspot/share/opto/macro.cpp @@ -2108,10 +2108,12 @@ void PhaseMacroExpand::expand_allocate_array(AllocateArrayNode *alloc) { // marked for elimination since new obj has no escape information. // Mark all associated (same box and obj) lock and unlock nodes for // elimination if some of them marked already. -void PhaseMacroExpand::mark_eliminated_box(Node* oldbox, Node* obj) { - if (oldbox->as_BoxLock()->is_eliminated()) { +void PhaseMacroExpand::mark_eliminated_box(Node* box, Node* obj) { + BoxLockNode* oldbox = box->as_BoxLock(); + if (oldbox->is_eliminated()) { return; // This BoxLock node was processed already. } + assert(!oldbox->is_unbalanced(), "this should not be called for unbalanced region"); // New implementation (EliminateNestedLocks) has separate BoxLock // node for each locked region so mark all associated locks/unlocks as // eliminated even if different objects are referenced in one locked region @@ -2119,8 +2121,9 @@ void PhaseMacroExpand::mark_eliminated_box(Node* oldbox, Node* obj) { if (EliminateNestedLocks || oldbox->as_BoxLock()->is_simple_lock_region(nullptr, obj, nullptr)) { // Box is used only in one lock region. Mark this box as eliminated. + oldbox->set_local(); // This verifies correct state of BoxLock _igvn.hash_delete(oldbox); - oldbox->as_BoxLock()->set_eliminated(); // This changes box's hash value + oldbox->set_eliminated(); // This changes box's hash value _igvn.hash_insert(oldbox); for (uint i = 0; i < oldbox->outcnt(); i++) { @@ -2147,6 +2150,7 @@ void PhaseMacroExpand::mark_eliminated_box(Node* oldbox, Node* obj) { // Note: BoxLock node is marked eliminated only here and it is used // to indicate that all associated lock and unlock nodes are marked // for elimination. + newbox->set_local(); // This verifies correct state of BoxLock newbox->set_eliminated(); transform_later(newbox); @@ -2202,6 +2206,9 @@ void PhaseMacroExpand::mark_eliminated_box(Node* oldbox, Node* obj) { //-----------------------mark_eliminated_locking_nodes----------------------- void PhaseMacroExpand::mark_eliminated_locking_nodes(AbstractLockNode *alock) { + if (alock->box_node()->as_BoxLock()->is_unbalanced()) { + return; // Can't do any more elimination for this locking region + } if (EliminateNestedLocks) { if (alock->is_nested()) { assert(alock->box_node()->as_BoxLock()->is_eliminated(), "sanity"); @@ -2842,6 +2849,11 @@ void PhaseMacroExpand::eliminate_macro_nodes() { // Re-marking may break consistency of Coarsened locks. if (!C->coarsened_locks_consistent()) { return; // recompile without Coarsened locks if broken + } else { + // After coarsened locks are eliminated locking regions + // become unbalanced. We should not execute any more + // locks elimination optimizations on them. + C->mark_unbalanced_boxes(); } // First, attempt to eliminate locks diff --git a/src/hotspot/share/opto/memnode.cpp b/src/hotspot/share/opto/memnode.cpp index a2619fea1d6..941b2e51701 100644 --- a/src/hotspot/share/opto/memnode.cpp +++ b/src/hotspot/share/opto/memnode.cpp @@ -3483,6 +3483,7 @@ Node *MemBarNode::Ideal(PhaseGVN *phase, bool can_reshape) { my_mem = load_node; } else { assert(my_mem->unique_out() == this, "sanity"); + assert(!trailing_load_store(), "load store node can't be eliminated"); del_req(Precedent); phase->is_IterGVN()->_worklist.push(my_mem); // remove dead node later my_mem = nullptr; diff --git a/src/hotspot/share/opto/runtime.cpp b/src/hotspot/share/opto/runtime.cpp index 1a0b033fae6..651adbe1094 100644 --- a/src/hotspot/share/opto/runtime.cpp +++ b/src/hotspot/share/opto/runtime.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -34,7 +34,7 @@ #include "code/vtableStubs.hpp" #include "compiler/compileBroker.hpp" #include "compiler/oopMap.hpp" -#include "gc/g1/heapRegion.hpp" +#include "gc/g1/g1HeapRegion.hpp" #include "gc/shared/barrierSet.hpp" #include "gc/shared/collectedHeap.hpp" #include "gc/shared/gcLocker.hpp" @@ -324,14 +324,17 @@ JRT_BLOCK_ENTRY(void, OptoRuntime::new_array_nozero_C(Klass* array_type, int len // Zero array here if the caller is deoptimized. const size_t size = TypeArrayKlass::cast(array_type)->oop_size(result); BasicType elem_type = TypeArrayKlass::cast(array_type)->element_type(); - const size_t hs = arrayOopDesc::header_size(elem_type); - // Align to next 8 bytes to avoid trashing arrays's length. - const size_t aligned_hs = align_object_offset(hs); + size_t hs_bytes = arrayOopDesc::base_offset_in_bytes(elem_type); + assert(is_aligned(hs_bytes, BytesPerInt), "must be 4 byte aligned"); HeapWord* obj = cast_from_oop(result); - if (aligned_hs > hs) { - Copy::zero_to_words(obj+hs, aligned_hs-hs); + if (!is_aligned(hs_bytes, BytesPerLong)) { + *reinterpret_cast(reinterpret_cast(obj) + hs_bytes) = 0; + hs_bytes += BytesPerInt; } + // Optimized zeroing. + assert(is_aligned(hs_bytes, BytesPerLong), "must be 8-byte aligned"); + const size_t aligned_hs = hs_bytes / BytesPerLong; Copy::fill_to_aligned_words(obj+aligned_hs, size-aligned_hs); } diff --git a/src/hotspot/share/opto/split_if.cpp b/src/hotspot/share/opto/split_if.cpp index 38c371085a2..87bd6ffb5c9 100644 --- a/src/hotspot/share/opto/split_if.cpp +++ b/src/hotspot/share/opto/split_if.cpp @@ -727,6 +727,14 @@ void PhaseIdealLoop::do_split_if(Node* iff, RegionNode** new_false_region, Regio } // End of while merge point has phis _igvn.remove_dead_node(region); + if (iff->Opcode() == Op_RangeCheck) { + // Pin array access nodes: control is updated here to a region. If, after some transformations, only one path + // into the region is left, an array load could become dependent on a condition that's not a range check for + // that access. If that condition is replaced by an identical dominating one, then an unpinned load would risk + // floating above its range check. + pin_array_access_nodes_dependent_on(new_true); + pin_array_access_nodes_dependent_on(new_false); + } if (new_false_region != nullptr) { *new_false_region = new_false; @@ -737,3 +745,18 @@ void PhaseIdealLoop::do_split_if(Node* iff, RegionNode** new_false_region, Regio DEBUG_ONLY( if (VerifyLoopOptimizations) { verify(); } ); } + +void PhaseIdealLoop::pin_array_access_nodes_dependent_on(Node* ctrl) { + for (DUIterator i = ctrl->outs(); ctrl->has_out(i); i++) { + Node* use = ctrl->out(i); + if (!use->depends_only_on_test()) { + continue; + } + Node* pinned_clone = use->pin_array_access_node(); + if (pinned_clone != nullptr) { + register_new_node(pinned_clone, get_ctrl(use)); + _igvn.replace_node(use, pinned_clone); + --i; + } + } +} diff --git a/src/hotspot/share/opto/superword.cpp b/src/hotspot/share/opto/superword.cpp index eb92f58024c..75b5e53f279 100644 --- a/src/hotspot/share/opto/superword.cpp +++ b/src/hotspot/share/opto/superword.cpp @@ -38,20 +38,15 @@ #include "opto/movenode.hpp" #include "utilities/powerOfTwo.hpp" -SuperWord::SuperWord(const VLoop &vloop, VSharedData &vshared) : - _vloop(vloop), +SuperWord::SuperWord(const VLoopAnalyzer &vloop_analyzer) : + _vloop_analyzer(vloop_analyzer), + _vloop(vloop_analyzer.vloop()), _arena(mtCompiler), _packset(arena(), 8, 0, nullptr), // packs for the current block - _bb_idx(vshared.node_idx_to_loop_body_idx()), // node idx to index in bb - _block(arena(), vloop.estimated_body_length(), 0, nullptr), // nodes in current block - _mem_slice_head(arena(), 8, 0, nullptr), // memory slice heads - _mem_slice_tail(arena(), 8, 0, nullptr), // memory slice tails - _node_info(arena(), vloop.estimated_body_length(), 0, SWNodeInfo::initial), // info needed per node + _node_info(arena(), _vloop.estimated_body_length(), 0, SWNodeInfo::initial), // info needed per node _clone_map(phase()->C->clone_map()), // map of nodes created in cloning _align_to_ref(nullptr), // memory reference to align vectors to _dg(arena()), // dependence graph - _nlist(arena(), vloop.estimated_body_length(), 0, nullptr), // scratch list of nodes - _loop_reductions(arena()), // reduction nodes in the current loop _race_possible(false), // cases where SDMU is true _do_vector_loop(phase()->C->do_vector_loop()), // whether to do vectorization/simd style _num_work_vecs(0), // amount of vector work we have @@ -255,7 +250,7 @@ void SuperWord::unrolling_analysis(const VLoop &vloop, int &local_loop_unroll_fa } } -bool SuperWord::is_reduction(const Node* n) { +bool VLoopReductions::is_reduction(const Node* n) { if (!is_reduction_operator(n)) { return false; } @@ -269,12 +264,12 @@ bool SuperWord::is_reduction(const Node* n) { return false; } -bool SuperWord::is_reduction_operator(const Node* n) { +bool VLoopReductions::is_reduction_operator(const Node* n) { int opc = n->Opcode(); return (opc != ReductionNode::opcode(opc, n->bottom_type()->basic_type())); } -bool SuperWord::in_reduction_cycle(const Node* n, uint input) { +bool VLoopReductions::in_reduction_cycle(const Node* n, uint input) { // First find input reduction path to phi node. auto has_my_opcode = [&](const Node* m){ return m->Opcode() == n->Opcode(); }; PathEnd path_to_phi = find_in_path(n, input, LoopMaxUnroll, has_my_opcode, @@ -291,7 +286,7 @@ bool SuperWord::in_reduction_cycle(const Node* n, uint input) { return path_from_phi.first != nullptr; } -Node* SuperWord::original_input(const Node* n, uint i) { +Node* VLoopReductions::original_input(const Node* n, uint i) { if (n->has_swapped_edges()) { assert(n->is_Add() || n->is_Mul(), "n should be commutative"); if (i == 1) { @@ -303,21 +298,21 @@ Node* SuperWord::original_input(const Node* n, uint i) { return n->in(i); } -void SuperWord::mark_reductions() { - - _loop_reductions.clear(); +void VLoopReductions::mark_reductions() { + assert(_loop_reductions.is_empty(), "must not yet be computed"); + CountedLoopNode* cl = _vloop.cl(); // Iterate through all phi nodes associated to the loop and search for // reduction cycles in the basic block. - for (DUIterator_Fast imax, i = cl()->fast_outs(imax); i < imax; i++) { - const Node* phi = cl()->fast_out(i); + for (DUIterator_Fast imax, i = cl->fast_outs(imax); i < imax; i++) { + const Node* phi = cl->fast_out(i); if (!phi->is_Phi()) { continue; } if (phi->outcnt() == 0) { continue; } - if (phi == iv()) { + if (phi == _vloop.iv()) { continue; } // The phi's loop-back is considered the first node in the reduction cycle. @@ -341,8 +336,9 @@ void SuperWord::mark_reductions() { // to the phi node following edge index 'input'. PathEnd path = find_in_path( - first, input, lpt()->_body.size(), - [&](const Node* n) { return n->Opcode() == first->Opcode() && in_bb(n); }, + first, input, _vloop.lpt()->_body.size(), + [&](const Node* n) { return n->Opcode() == first->Opcode() && + _vloop.in_bb(n); }, [&](const Node* n) { return n == phi; }); if (path.first != nullptr) { reduction_input = input; @@ -361,7 +357,7 @@ void SuperWord::mark_reductions() { for (int i = 0; i < path_nodes; i++) { for (DUIterator_Fast jmax, j = current->fast_outs(jmax); j < jmax; j++) { Node* u = current->fast_out(j); - if (!in_bb(u)) { + if (!_vloop.in_bb(u)) { continue; } if (u == succ) { @@ -399,16 +395,6 @@ bool SuperWord::transform_loop() { } #endif - // Skip any loop that has not been assigned max unroll by analysis - if (SuperWordLoopUnrollAnalysis && vloop().cl()->slp_max_unroll() == 0) { -#ifndef PRODUCT - if (is_trace_superword_any()) { - tty->print_cr("\nSuperWord::transform_loop failed: slp max unroll analysis was not already done"); - } -#endif - return false; - } - if (!SLP_extract()) { #ifndef PRODUCT if (is_trace_superword_any()) { @@ -463,35 +449,6 @@ bool SuperWord::transform_loop() { bool SuperWord::SLP_extract() { assert(cl()->is_main_loop(), "SLP should only work on main loops"); - if (SuperWordReductions) { - mark_reductions(); - } - - // Find memory slices - find_memory_slices(); - - if (!is_marked_reduction_loop() && - _mem_slice_head.is_empty()) { -#ifndef PRODUCT - if (is_trace_superword_any()) { - tty->print_cr("\nNo reductions or memory slices found, abort SuperWord."); - tty->cr(); - } -#endif - return false; - } - - // Ready the block - if (!construct_bb()) { -#ifndef PRODUCT - if (is_trace_superword_any()) { - tty->print_cr("\nSuperWord::construct_bb failed: abort SuperWord"); - tty->cr(); - } -#endif - return false; - } - // Ensure extra info is allocated. initialize_node_info(); @@ -501,9 +458,6 @@ bool SuperWord::SLP_extract() { // compute function depth(Node*) compute_max_depth(); - // Compute vector element types - compute_vector_element_type(); - // Attempt vectorization find_adjacent_refs(); @@ -546,8 +500,8 @@ bool SuperWord::SLP_extract() { void SuperWord::find_adjacent_refs() { // Get list of memory operations Node_List memops; - for (int i = 0; i < _block.length(); i++) { - Node* n = _block.at(i); + for (int i = 0; i < body().length(); i++) { + Node* n = body().at(i); if (n->is_Mem() && !n->is_LoadStore() && in_bb(n) && is_java_primitive(n->as_Mem()->memory_type())) { int align = memory_alignment(n->as_Mem(), 0); @@ -580,13 +534,13 @@ void SuperWord::find_adjacent_refs() { set_align_to_ref(align_to_mem_ref); } - VPointer align_to_ref_p(mem_ref, vloop()); + VPointer align_to_ref_p(mem_ref, _vloop); // Set alignment relative to "align_to_ref" for all related memory operations. for (int i = memops.size() - 1; i >= 0; i--) { MemNode* s = memops.at(i)->as_Mem(); if (isomorphic(s, mem_ref) && (!_do_vector_loop || same_origin_idx(s, mem_ref))) { - VPointer p2(s, vloop()); + VPointer p2(s, _vloop); if (p2.comparable(align_to_ref_p)) { int align = memory_alignment(s, iv_adjustment); set_alignment(s, align); @@ -645,11 +599,11 @@ MemNode* SuperWord::find_align_to_ref(Node_List &memops, int &idx) { // Count number of comparable memory ops for (uint i = 0; i < memops.size(); i++) { MemNode* s1 = memops.at(i)->as_Mem(); - VPointer p1(s1, vloop()); + VPointer p1(s1, _vloop); for (uint j = i+1; j < memops.size(); j++) { MemNode* s2 = memops.at(j)->as_Mem(); if (isomorphic(s1, s2)) { - VPointer p2(s2, vloop()); + VPointer p2(s2, _vloop); if (p1.comparable(p2)) { (*cmp_ct.adr_at(i))++; (*cmp_ct.adr_at(j))++; @@ -670,7 +624,7 @@ MemNode* SuperWord::find_align_to_ref(Node_List &memops, int &idx) { if (s->is_Store()) { int vw = vector_width_in_bytes(s); assert(vw > 1, "sanity"); - VPointer p(s, vloop()); + VPointer p(s, _vloop); if ( cmp_ct.at(j) > max_ct || (cmp_ct.at(j) == max_ct && ( vw > max_vw || @@ -693,7 +647,7 @@ MemNode* SuperWord::find_align_to_ref(Node_List &memops, int &idx) { if (s->is_Load()) { int vw = vector_width_in_bytes(s); assert(vw > 1, "sanity"); - VPointer p(s, vloop()); + VPointer p(s, _vloop); if ( cmp_ct.at(j) > max_ct || (cmp_ct.at(j) == max_ct && ( vw > max_vw || @@ -766,7 +720,7 @@ int SuperWord::get_vw_bytes_special(MemNode* s) { //---------------------------get_iv_adjustment--------------------------- // Calculate loop's iv adjustment for this memory ops. int SuperWord::get_iv_adjustment(MemNode* mem_ref) { - VPointer align_to_ref_p(mem_ref, vloop()); + VPointer align_to_ref_p(mem_ref, _vloop); int offset = align_to_ref_p.offset_in_bytes(); int scale = align_to_ref_p.scale_in_bytes(); int elt_size = align_to_ref_p.memory_size(); @@ -804,23 +758,29 @@ void SuperWord::dependence_graph() { assert(cl->is_main_loop(), "SLP should only work on main loops"); // First, assign a dependence node to each memory node - for (int i = 0; i < _block.length(); i++ ) { - Node *n = _block.at(i); + for (int i = 0; i < body().length(); i++ ) { + Node* n = body().at(i); if (n->is_Mem() || n->is_memory_phi()) { _dg.make_node(n); } } + const GrowableArray& mem_slice_head = _vloop_analyzer.memory_slices().heads(); + const GrowableArray& mem_slice_tail = _vloop_analyzer.memory_slices().tails(); + + ResourceMark rm; + GrowableArray slice_nodes; + // For each memory slice, create the dependences - for (int i = 0; i < _mem_slice_head.length(); i++) { - Node* n = _mem_slice_head.at(i); - Node* n_tail = _mem_slice_tail.at(i); + for (int i = 0; i < mem_slice_head.length(); i++) { + PhiNode* head = mem_slice_head.at(i); + MemNode* tail = mem_slice_tail.at(i); // Get slice in predecessor order (last is first) - mem_slice_preds(n_tail, n, _nlist); + _vloop_analyzer.memory_slices().get_slice_in_reverse_order(head, tail, slice_nodes); // Make the slice dependent on the root - DepMem* slice = _dg.dep(n); + DepMem* slice = _dg.dep(head); _dg.make_edge(_dg.root(), slice); // Create a sink for the slice @@ -828,20 +788,20 @@ void SuperWord::dependence_graph() { _dg.make_edge(slice_sink, _dg.tail()); // Now visit each pair of memory ops, creating the edges - for (int j = _nlist.length() - 1; j >= 0 ; j--) { - Node* s1 = _nlist.at(j); + for (int j = slice_nodes.length() - 1; j >= 0 ; j--) { + Node* s1 = slice_nodes.at(j); // If no dependency yet, use slice if (_dg.dep(s1)->in_cnt() == 0) { _dg.make_edge(slice, s1); } - VPointer p1(s1->as_Mem(), vloop()); + VPointer p1(s1->as_Mem(), _vloop); bool sink_dependent = true; for (int k = j - 1; k >= 0; k--) { - Node* s2 = _nlist.at(k); + Node* s2 = slice_nodes.at(k); if (s1->is_Load() && s2->is_Load()) continue; - VPointer p2(s2->as_Mem(), vloop()); + VPointer p2(s2->as_Mem(), _vloop); int cmp = p1.cmp(p2); if (!VPointer::not_equal(cmp)) { @@ -857,68 +817,68 @@ void SuperWord::dependence_graph() { #ifndef PRODUCT if (is_trace_superword_dependence_graph()) { - tty->print_cr("\nDependence graph for slice: %d", n->_idx); - for (int q = 0; q < _nlist.length(); q++) { - _dg.print(_nlist.at(q)); + tty->print_cr("\nDependence graph for slice: %d", head->_idx); + for (int q = 0; q < slice_nodes.length(); q++) { + _dg.print(slice_nodes.at(q)); } tty->cr(); } #endif - _nlist.clear(); + slice_nodes.clear(); } } -void SuperWord::find_memory_slices() { - assert(_mem_slice_head.length() == 0, "mem_slice_head is empty"); - assert(_mem_slice_tail.length() == 0, "mem_slice_tail is empty"); +void VLoopMemorySlices::find_memory_slices() { + assert(_heads.is_empty(), "not yet computed"); + assert(_tails.is_empty(), "not yet computed"); + CountedLoopNode* cl = _vloop.cl(); // Iterate over all memory phis - for (DUIterator_Fast imax, i = cl()->fast_outs(imax); i < imax; i++) { - PhiNode* phi = cl()->fast_out(i)->isa_Phi(); - if (phi != nullptr && in_bb(phi) && phi->is_memory_phi()) { + for (DUIterator_Fast imax, i = cl->fast_outs(imax); i < imax; i++) { + PhiNode* phi = cl->fast_out(i)->isa_Phi(); + if (phi != nullptr && _vloop.in_bb(phi) && phi->is_memory_phi()) { Node* phi_tail = phi->in(LoopNode::LoopBackControl); if (phi_tail != phi->in(LoopNode::EntryControl)) { - _mem_slice_head.push(phi); - _mem_slice_tail.push(phi_tail->as_Mem()); + _heads.push(phi); + _tails.push(phi_tail->as_Mem()); } } } - NOT_PRODUCT( if (is_trace_superword_memory_slices()) { print_memory_slices(); } ) + NOT_PRODUCT( if (_vloop.is_trace_memory_slices()) { print(); } ) } #ifndef PRODUCT -void SuperWord::print_memory_slices() { - tty->print_cr("\nSuperWord::print_memory_slices: %s", - _mem_slice_head.length() > 0 ? "" : "NONE"); - for (int m = 0; m < _mem_slice_head.length(); m++) { - tty->print("%6d ", m); _mem_slice_head.at(m)->dump(); - tty->print(" "); _mem_slice_tail.at(m)->dump(); +void VLoopMemorySlices::print() const { + tty->print_cr("\nVLoopMemorySlices::print: %s", + heads().length() > 0 ? "" : "NONE"); + for (int m = 0; m < heads().length(); m++) { + tty->print("%6d ", m); heads().at(m)->dump(); + tty->print(" "); tails().at(m)->dump(); } } #endif -//---------------------------mem_slice_preds--------------------------- -// Return a memory slice (node list) in predecessor order starting at "start" -void SuperWord::mem_slice_preds(Node* start, Node* stop, GrowableArray &preds) { - assert(preds.length() == 0, "start empty"); - Node* n = start; +// Get all memory nodes of a slice, in reverse order +void VLoopMemorySlices::get_slice_in_reverse_order(PhiNode* head, MemNode* tail, GrowableArray &slice) const { + assert(slice.is_empty(), "start empty"); + Node* n = tail; Node* prev = nullptr; while (true) { - assert(in_bb(n), "must be in block"); + assert(_vloop.in_bb(n), "must be in block"); for (DUIterator_Fast imax, i = n->fast_outs(imax); i < imax; i++) { Node* out = n->fast_out(i); if (out->is_Load()) { - if (in_bb(out)) { - preds.push(out); + if (_vloop.in_bb(out)) { + slice.push(out); } } else { // FIXME - if (out->is_MergeMem() && !in_bb(out)) { + if (out->is_MergeMem() && !_vloop.in_bb(out)) { // Either unrolling is causing a memory edge not to disappear, // or need to run igvn.optimize() again before SLP - } else if (out->is_memory_phi() && !in_bb(out)) { + } else if (out->is_memory_phi() && !_vloop.in_bb(out)) { // Ditto. Not sure what else to check further. } else if (out->Opcode() == Op_StoreCM && out->in(MemNode::OopStore) == n) { // StoreCM has an input edge used as a precedence edge. @@ -928,19 +888,19 @@ void SuperWord::mem_slice_preds(Node* start, Node* stop, GrowableArray &p } }//else }//for - if (n == stop) break; - preds.push(n); + if (n == head) { break; } + slice.push(n); prev = n; assert(n->is_Mem(), "unexpected node %s", n->Name()); n = n->in(MemNode::Memory); } #ifndef PRODUCT - if (is_trace_superword_memory_slices()) { - tty->print_cr("\nSuperWord::mem_slice_preds:"); - stop->dump(); - for (int j = preds.length() - 1; j >= 0 ; j--) { - preds.at(j)->dump(); + if (_vloop.is_trace_memory_slices()) { + tty->print_cr("\nVLoopMemorySlices::get_slice_in_reverse_order:"); + head->dump(); + for (int j = slice.length() - 1; j >= 0 ; j--) { + slice.at(j)->dump(); } } #endif @@ -1011,8 +971,8 @@ bool SuperWord::are_adjacent_refs(Node* s1, Node* s2) { // Adjacent memory references must have the same base, be comparable // and have the correct distance between them. - VPointer p1(s1->as_Mem(), vloop()); - VPointer p2(s2->as_Mem(), vloop()); + VPointer p1(s1->as_Mem(), _vloop); + VPointer p2(s2->as_Mem(), _vloop); if (p1.base() != p2.base() || !p1.comparable(p2)) return false; int diff = p2.offset_in_bytes() - p1.offset_in_bytes(); return diff == data_size(s1); @@ -1134,26 +1094,19 @@ bool SuperWord::have_similar_inputs(Node* s1, Node* s2) { return true; } -//------------------------------reduction--------------------------- -// Is there a data path between s1 and s2 and the nodes reductions? -bool SuperWord::reduction(Node* s1, Node* s2) { - bool retValue = false; - int d1 = depth(s1); - int d2 = depth(s2); - if (d2 > d1) { - if (is_marked_reduction(s1) && is_marked_reduction(s2)) { - // This is an ordered set, so s1 should define s2 - for (DUIterator_Fast imax, i = s1->fast_outs(imax); i < imax; i++) { - Node* t1 = s1->fast_out(i); - if (t1 == s2) { - // both nodes are reductions and connected - retValue = true; - } +bool VLoopReductions::is_marked_reduction_pair(Node* s1, Node* s2) const { + if (is_marked_reduction(s1) && + is_marked_reduction(s2)) { + // This is an ordered set, so s1 should define s2 + for (DUIterator_Fast imax, i = s1->fast_outs(imax); i < imax; i++) { + Node* t1 = s1->fast_out(i); + if (t1 == s2) { + // both nodes are reductions and connected + return true; } } } - - return retValue; + return false; } //------------------------------set_alignment--------------------------- @@ -1166,13 +1119,6 @@ void SuperWord::set_alignment(Node* s1, Node* s2, int align) { } } -//------------------------------data_size--------------------------- -int SuperWord::data_size(Node* s) { - int bsize = type2aelembytes(velt_basic_type(s)); - assert(bsize != 0, "valid size"); - return bsize; -} - // Extend packset by following use->def and def->use links from pack members. void SuperWord::extend_packset_with_more_pairs_by_following_use_and_def() { bool changed; @@ -1657,8 +1603,8 @@ const AlignmentSolution* SuperWord::pack_alignment_solution(const Node_List* pac assert(pack != nullptr && (pack->at(0)->is_Load() || pack->at(0)->is_Store()), "only load/store packs"); const MemNode* mem_ref = pack->at(0)->as_Mem(); - VPointer mem_ref_p(mem_ref, vloop()); - const CountedLoopEndNode* pre_end = vloop().pre_loop_end(); + VPointer mem_ref_p(mem_ref, _vloop); + const CountedLoopEndNode* pre_end = _vloop.pre_loop_end(); assert(pre_end->stride_is_con(), "pre loop stride is constant"); AlignmentSolver solver(pack->at(0)->as_Mem(), @@ -1923,9 +1869,8 @@ bool SuperWord::profitable(const Node_List* p) { Node* second_in = p0->in(2); Node_List* second_pk = my_pack(second_in); if ((second_pk == nullptr) || (_num_work_vecs == _num_reductions)) { - // Unmark reduction if no parent pack or if not enough work + // No parent pack or not enough work // to cover reduction expansion overhead - _loop_reductions.remove(p0->_idx); return false; } else if (second_pk->size() != p->size()) { return false; @@ -2028,8 +1973,8 @@ void SuperWord::verify_packs() { } // Check that no other node has my_pack set. - for (int i = 0; i < _block.length(); i++) { - Node* n = _block.at(i); + for (int i = 0; i < body().length(); i++) { + Node* n = body().at(i); if (!processed.member(n)) { assert(my_pack(n) == nullptr, "should not have pack if not in packset"); } @@ -2112,9 +2057,9 @@ class PacksetGraph { // Create nodes (from packs and scalar-nodes), and add edges, based on DepPreds. void build() { - const GrowableArray &packset = _slp->packset(); - const GrowableArray &block = _slp->block(); - const DepGraph &dg = _slp->dg(); + const GrowableArray& packset = _slp->packset(); + const GrowableArray& body = _slp->body(); + const DepGraph& dg = _slp->dg(); // Map nodes in packsets for (int i = 0; i < packset.length(); i++) { Node_List* p = packset.at(i); @@ -2129,8 +2074,8 @@ class PacksetGraph { int max_pid_packset = _max_pid; // Map nodes not in packset - for (int i = 0; i < block.length(); i++) { - Node* n = block.at(i); + for (int i = 0; i < body.length(); i++) { + Node* n = body.at(i); if (n->is_Phi() || n->is_CFG()) { continue; // ignore control flow } @@ -2157,7 +2102,7 @@ class PacksetGraph { if (pred_pid == pid && _slp->is_marked_reduction(n)) { continue; // reduction -> self-cycle is not a cyclic dependency } - // Only add edges once, and only for mapped nodes (in block) + // Only add edges once, and only for mapped nodes (in body) if (pred_pid > 0 && !set.test_set(pred_pid)) { incnt_set(pid, incnt(pid) + 1); // increment out(pred_pid).push(pid); @@ -2167,8 +2112,8 @@ class PacksetGraph { } // Map edges for nodes not in packset - for (int i = 0; i < block.length(); i++) { - Node* n = block.at(i); + for (int i = 0; i < body.length(); i++) { + Node* n = body.at(i); int pid = get_pid_or_zero(n); // zero for Phi or CFG if (pid <= max_pid_packset) { continue; // Only scalar-nodes @@ -2176,7 +2121,7 @@ class PacksetGraph { for (DepPreds preds(n, dg); !preds.done(); preds.next()) { Node* pred = preds.current(); int pred_pid = get_pid_or_zero(pred); - // Only add edges for mapped nodes (in block) + // Only add edges for mapped nodes (in body) if (pred_pid > 0) { incnt_set(pid, incnt(pid) + 1); // increment out(pred_pid).push(pid); @@ -2237,7 +2182,7 @@ class PacksetGraph { // print_nodes = true: print all C2 nodes beloning to PacksetGrahp node. // print_zero_incnt = false: do not print nodes that have no in-edges (any more). void print(bool print_nodes, bool print_zero_incnt) { - const GrowableArray &block = _slp->block(); + const GrowableArray &body = _slp->body(); tty->print_cr("PacksetGraph"); for (int pid = 1; pid <= _max_pid; pid++) { if (incnt(pid) == 0 && !print_zero_incnt) { @@ -2250,8 +2195,8 @@ class PacksetGraph { tty->print_cr("]"); #ifndef PRODUCT if (print_nodes) { - for (int i = 0; i < block.length(); i++) { - Node* n = block.at(i); + for (int i = 0; i < body.length(); i++) { + Node* n = body.at(i); if (get_pid_or_zero(n) == pid) { tty->print(" "); n->dump(); @@ -2329,9 +2274,11 @@ void SuperWord::schedule_reorder_memops(Node_List &memops_schedule) { // loop we may have a different last store, and we need to adjust the uses accordingly. GrowableArray old_last_store_in_slice(max_slices, max_slices, nullptr); + const GrowableArray& mem_slice_head = _vloop_analyzer.memory_slices().heads(); + // (1) Set up the initial memory state from Phi. And find the old last store. - for (int i = 0; i < _mem_slice_head.length(); i++) { - Node* phi = _mem_slice_head.at(i); + for (int i = 0; i < mem_slice_head.length(); i++) { + Node* phi = mem_slice_head.at(i); assert(phi->is_Phi(), "must be phi"); int alias_idx = phase()->C->get_alias_index(phi->adr_type()); current_state_in_slice.at_put(alias_idx, phi); @@ -2366,8 +2313,8 @@ void SuperWord::schedule_reorder_memops(Node_List &memops_schedule) { // in the Phi. Further, we replace uses of the old last store // with uses of the new last store (current_state). Node_List uses_after_loop; - for (int i = 0; i < _mem_slice_head.length(); i++) { - Node* phi = _mem_slice_head.at(i); + for (int i = 0; i < mem_slice_head.length(); i++) { + Node* phi = mem_slice_head.at(i); int alias_idx = phase()->C->get_alias_index(phi->adr_type()); Node* current_state = current_state_in_slice.at(alias_idx); assert(current_state != nullptr, "slice is mapped"); @@ -2429,8 +2376,8 @@ bool SuperWord::output() { uint max_vlen_in_bytes = 0; uint max_vlen = 0; - for (int i = 0; i < _block.length(); i++) { - Node* n = _block.at(i); + for (int i = 0; i < body().length(); i++) { + Node* n = body().at(i); Node_List* p = my_pack(n); if (p != nullptr && n == p->at(p->size()-1)) { // After schedule_reorder_memops, we know that the memops have the same order in the pack @@ -2448,7 +2395,7 @@ bool SuperWord::output() { // Walk up the memory chain, and ignore any StoreVector that provably // does not have any memory dependency. while (mem->is_StoreVector()) { - VPointer p_store(mem->as_Mem(), vloop()); + VPointer p_store(mem->as_Mem(), _vloop); if (p_store.overlap_possible_with_any_in(p)) { break; } else { @@ -2702,7 +2649,6 @@ bool SuperWord::output() { } #endif - _block.at_put(i, vn); igvn().register_new_node_with_optimizer(vn); phase()->set_ctrl(vn, phase()->get_ctrl(first)); for (uint j = 0; j < p->size(); j++) { @@ -2719,7 +2665,7 @@ bool SuperWord::output() { } VectorNode::trace_new_vector(vn, "SuperWord"); } - }//for (int i = 0; i < _block.length(); i++) + }//for (int i = 0; i < body().length(); i++) if (max_vlen_in_bytes > C->max_vector_size()) { C->set_max_vector_size(max_vlen_in_bytes); @@ -2983,33 +2929,32 @@ bool SuperWord::is_vector_use(Node* use, int u_idx) { return true; } -//------------------------------construct_bb--------------------------- -// Construct reverse postorder list of block members -bool SuperWord::construct_bb() { - assert(_block.length() == 0, "block is empty"); +// Return nullptr if success, else failure message +VStatus VLoopBody::construct() { + assert(_body.is_empty(), "body is empty"); // First pass over loop body: // (1) Check that there are no unwanted nodes (LoadStore, MergeMem, data Proj). // (2) Count number of nodes, and create a temporary map (_idx -> bb_idx). // (3) Verify that all non-ctrl nodes have an input inside the loop. - int block_count = 0; - for (uint i = 0; i < lpt()->_body.size(); i++) { - Node* n = lpt()->_body.at(i); + int body_count = 0; + for (uint i = 0; i < _vloop.lpt()->_body.size(); i++) { + Node* n = _vloop.lpt()->_body.at(i); set_bb_idx(n, i); // Create a temporary map - if (in_bb(n)) { - block_count++; + if (_vloop.in_bb(n)) { + body_count++; if (n->is_LoadStore() || n->is_MergeMem() || (n->is_Proj() && !n->as_Proj()->is_CFG())) { // Bailout if the loop has LoadStore, MergeMem or data Proj // nodes. Superword optimization does not work with them. #ifndef PRODUCT - if (is_trace_superword_any()) { - tty->print_cr("SuperWord::construct_bb: fails because of unhandled node:"); + if (_vloop.is_trace_body()) { + tty->print_cr("VLoopBody::construct: fails because of unhandled node:"); n->dump(); } #endif - return false; + return VStatus::make_failure(VLoopBody::FAILURE_NODE_NOT_ALLOWED); } #ifdef ASSERT @@ -3017,7 +2962,7 @@ bool SuperWord::construct_bb() { bool found = false; for (uint j = 0; j < n->req(); j++) { Node* def = n->in(j); - if (def != nullptr && in_bb(def)) { + if (def != nullptr && _vloop.in_bb(def)) { found = true; break; } @@ -3028,17 +2973,17 @@ bool SuperWord::construct_bb() { } } - // Create a reverse-post-order list of nodes in block + // Create a reverse-post-order list of nodes in body ResourceMark rm; GrowableArray stack; VectorSet visited; VectorSet post_visited; - visited.set(bb_idx(cl())); - stack.push(cl()); + visited.set(bb_idx(_vloop.cl())); + stack.push(_vloop.cl()); // Do a depth first walk over out edges - int rpo_idx = block_count - 1; + int rpo_idx = body_count - 1; while (!stack.is_empty()) { Node* n = stack.top(); // Leave node on stack if (!visited.test_set(bb_idx(n))) { @@ -3048,9 +2993,9 @@ bool SuperWord::construct_bb() { const int old_length = stack.length(); for (DUIterator_Fast imax, i = n->fast_outs(imax); i < imax; i++) { Node* use = n->fast_out(i); - if (in_bb(use) && !visited.test(bb_idx(use)) && + if (_vloop.in_bb(use) && !visited.test(bb_idx(use)) && // Don't go around backedge - (!use->is_Phi() || n == cl())) { + (!use->is_Phi() || n == _vloop.cl())) { stack.push(use); } } @@ -3058,7 +3003,7 @@ bool SuperWord::construct_bb() { // There were no additional uses, post visit node now stack.pop(); // Remove node from stack assert(rpo_idx >= 0, "must still have idx to pass out"); - _block.at_put_grow(rpo_idx, n); + _body.at_put_grow(rpo_idx, n); rpo_idx--; post_visited.set(bb_idx(n)); assert(rpo_idx >= 0 || stack.is_empty(), "still have idx left or are finished"); @@ -3068,25 +3013,25 @@ bool SuperWord::construct_bb() { } } - // Create real map of block indices for nodes - for (int j = 0; j < _block.length(); j++) { - Node* n = _block.at(j); + // Create real map of body indices for nodes + for (int j = 0; j < _body.length(); j++) { + Node* n = _body.at(j); set_bb_idx(n, j); } #ifndef PRODUCT - if (is_trace_superword_info()) { - print_bb(); + if (_vloop.is_trace_body()) { + print(); } #endif - assert(rpo_idx == -1 && block_count == _block.length(), "all block members found"); - return true; + assert(rpo_idx == -1 && body_count == _body.length(), "all body members found"); + return VStatus::make_success(); } // Initialize per node info void SuperWord::initialize_node_info() { - Node* last = _block.at(_block.length() - 1); + Node* last = body().at(body().length() - 1); grow_node_info(bb_idx(last)); } @@ -3098,8 +3043,8 @@ void SuperWord::compute_max_depth() { bool again; do { again = false; - for (int i = 0; i < _block.length(); i++) { - Node* n = _block.at(i); + for (int i = 0; i < body().length(); i++) { + Node* n = body().at(i); if (!n->is_Phi()) { int d_orig = depth(n); int d_in = 0; @@ -3174,30 +3119,29 @@ int SuperWord::max_vector_size_in_def_use_chain(Node* n) { return max < 2 ? Matcher::max_vector_size_auto_vectorization(bt) : max; } -//-------------------------compute_vector_element_type----------------------- -// Compute necessary vector element type for expressions -// This propagates backwards a narrower integer type when the -// upper bits of the value are not needed. -// Example: char a,b,c; a = b + c; -// Normally the type of the add is integer, but for packed character -// operations the type of the add needs to be char. -void SuperWord::compute_vector_element_type() { +void VLoopTypes::compute_vector_element_type() { #ifndef PRODUCT - if (is_trace_superword_vector_element_type()) { - tty->print_cr("\ncompute_velt_type:"); + if (_vloop.is_trace_vector_element_type()) { + tty->print_cr("\nVLoopTypes::compute_vector_element_type:"); } #endif + const GrowableArray& body = _body.body(); + + assert(_velt_type.is_empty(), "must not yet be computed"); + // reserve space + _velt_type.at_put_grow(body.length()-1, nullptr); + // Initial type - for (int i = 0; i < _block.length(); i++) { - Node* n = _block.at(i); + for (int i = 0; i < body.length(); i++) { + Node* n = body.at(i); set_velt_type(n, container_type(n)); } // Propagate integer narrowed type backwards through operations // that don't depend on higher order bits - for (int i = _block.length() - 1; i >= 0; i--) { - Node* n = _block.at(i); + for (int i = body.length() - 1; i >= 0; i--) { + Node* n = body.at(i); // Only integer types need be examined const Type* vtn = velt_type(n); if (vtn->basic_type() == T_INT) { @@ -3207,12 +3151,14 @@ void SuperWord::compute_vector_element_type() { for (uint j = start; j < end; j++) { Node* in = n->in(j); // Don't propagate through a memory - if (!in->is_Mem() && in_bb(in) && velt_type(in)->basic_type() == T_INT && + if (!in->is_Mem() && + _vloop.in_bb(in) && + velt_type(in)->basic_type() == T_INT && data_size(n) < data_size(in)) { bool same_type = true; for (DUIterator_Fast kmax, k = in->fast_outs(kmax); k < kmax; k++) { Node *use = in->fast_out(k); - if (!in_bb(use) || !same_velt_type(use, n)) { + if (!_vloop.in_bb(use) || !same_velt_type(use, n)) { same_type = false; break; } @@ -3229,7 +3175,9 @@ void SuperWord::compute_vector_element_type() { int op = in->Opcode(); if (VectorNode::is_shift_opcode(op) || op == Op_AbsI || op == Op_ReverseBytesI) { Node* load = in->in(1); - if (load->is_Load() && in_bb(load) && (velt_type(load)->basic_type() == T_INT)) { + if (load->is_Load() && + _vloop.in_bb(load) && + (velt_type(load)->basic_type() == T_INT)) { // Only Load nodes distinguish signed (LoadS/LoadB) and unsigned // (LoadUS/LoadUB) values. Store nodes only have one version. vt = velt_type(load); @@ -3245,16 +3193,17 @@ void SuperWord::compute_vector_element_type() { } } } - for (int i = 0; i < _block.length(); i++) { - Node* n = _block.at(i); + for (int i = 0; i < body.length(); i++) { + Node* n = body.at(i); Node* nn = n; if (nn->is_Bool() && nn->in(0) == nullptr) { nn = nn->in(1); assert(nn->is_Cmp(), "always have Cmp above Bool"); } if (nn->is_Cmp() && nn->in(0) == nullptr) { - assert(in_bb(nn->in(1)) || in_bb(nn->in(2)), "one of the inputs must be in the loop too"); - if (in_bb(nn->in(1))) { + assert(_vloop.in_bb(nn->in(1)) || _vloop.in_bb(nn->in(2)), + "one of the inputs must be in the loop, too"); + if (_vloop.in_bb(nn->in(1))) { set_velt_type(n, velt_type(nn->in(1))); } else { set_velt_type(n, velt_type(nn->in(2))); @@ -3262,9 +3211,9 @@ void SuperWord::compute_vector_element_type() { } } #ifndef PRODUCT - if (is_trace_superword_vector_element_type()) { - for (int i = 0; i < _block.length(); i++) { - Node* n = _block.at(i); + if (_vloop.is_trace_vector_element_type()) { + for (int i = 0; i < body.length(); i++) { + Node* n = body.at(i); velt_type(n)->dump(); tty->print("\t"); n->dump(); @@ -3281,7 +3230,7 @@ int SuperWord::memory_alignment(MemNode* s, int iv_adjust) { tty->print("SuperWord::memory_alignment within a vector memory reference for %d: ", s->_idx); s->dump(); } #endif - VPointer p(s, vloop()); + VPointer p(s, _vloop); if (!p.valid()) { NOT_PRODUCT(if(is_trace_superword_alignment()) tty->print_cr("SuperWord::memory_alignment: VPointer p invalid, return bottom_align");) return bottom_align; @@ -3303,9 +3252,8 @@ int SuperWord::memory_alignment(MemNode* s, int iv_adjust) { return off_mod; } -//---------------------------container_type--------------------------- // Smallest type containing range of values -const Type* SuperWord::container_type(Node* n) { +const Type* VLoopTypes::container_type(Node* n) const { if (n->is_Mem()) { BasicType bt = n->as_Mem()->memory_type(); if (n->is_Store() && (bt == T_CHAR)) { @@ -3322,7 +3270,7 @@ const Type* SuperWord::container_type(Node* n) { } return Type::get_const_basic_type(bt); } - const Type* t = igvn().type(n); + const Type* t = _vloop.phase()->igvn().type(n); if (t->basic_type() == T_INT) { // A narrow type of arithmetic operations will be determined by // propagating the type of memory operations. @@ -3331,18 +3279,9 @@ const Type* SuperWord::container_type(Node* n) { return t; } -bool SuperWord::same_velt_type(Node* n1, Node* n2) { - const Type* vt1 = velt_type(n1); - const Type* vt2 = velt_type(n2); - if (vt1->basic_type() == T_INT && vt2->basic_type() == T_INT) { - // Compare vectors element sizes for integer types. - return data_size(n1) == data_size(n2); - } - return vt1 == vt2; -} - -bool SuperWord::same_memory_slice(MemNode* best_align_to_mem_ref, MemNode* mem_ref) const { - return phase()->C->get_alias_index(mem_ref->adr_type()) == phase()->C->get_alias_index(best_align_to_mem_ref->adr_type()); +bool VLoopMemorySlices::same_memory_slice(MemNode* m1, MemNode* m2) const { + return _vloop.phase()->C->get_alias_index(m1->adr_type()) == + _vloop.phase()->C->get_alias_index(m2->adr_type()); } //------------------------------in_packset--------------------------- @@ -3425,19 +3364,19 @@ void SuperWord::adjust_pre_loop_limit_to_align_main_loop_vectors() { assert(cl()->is_main_loop(), "can only do alignment for main loop"); // The opaque node for the limit, where we adjust the input - Opaque1Node* pre_opaq = vloop().pre_loop_end()->limit()->as_Opaque1(); + Opaque1Node* pre_opaq = _vloop.pre_loop_end()->limit()->as_Opaque1(); // Current pre-loop limit. Node* old_limit = pre_opaq->in(1); // Where we put new limit calculations. - Node* pre_ctrl = vloop().pre_loop_head()->in(LoopNode::EntryControl); + Node* pre_ctrl = _vloop.pre_loop_head()->in(LoopNode::EntryControl); // Ensure the original loop limit is available from the pre-loop Opaque1 node. Node* orig_limit = pre_opaq->original_loop_limit(); assert(orig_limit != nullptr && igvn().type(orig_limit) != Type::TOP, ""); - VPointer align_to_ref_p(align_to_ref, vloop()); + VPointer align_to_ref_p(align_to_ref, _vloop); assert(align_to_ref_p.valid(), "sanity"); // For the main-loop, we want the address of align_to_ref to be memory aligned @@ -3763,19 +3702,18 @@ void SuperWord::print_pack(Node_List* p) { } } -//------------------------------print_bb--------------------------- -void SuperWord::print_bb() { #ifndef PRODUCT +void VLoopBody::print() const { tty->print_cr("\nBlock"); - for (int i = 0; i < _block.length(); i++) { - Node* n = _block.at(i); + for (int i = 0; i < body().length(); i++) { + Node* n = body().at(i); tty->print("%d ", i); - if (n) { + if (n != nullptr) { n->dump(); } } -#endif } +#endif //------------------------------print_stmt--------------------------- void SuperWord::print_stmt(Node* s) { diff --git a/src/hotspot/share/opto/superword.hpp b/src/hotspot/share/opto/superword.hpp index 8813284e351..00a8c915ac7 100644 --- a/src/hotspot/share/opto/superword.hpp +++ b/src/hotspot/share/opto/superword.hpp @@ -26,7 +26,6 @@ #include "opto/vectorization.hpp" #include "utilities/growableArray.hpp" -#include "utilities/pair.hpp" // // S U P E R W O R D T R A N S F O R M @@ -188,10 +187,9 @@ class SWNodeInfo { public: int _alignment; // memory alignment for a node int _depth; // Max expression (DAG) depth from block start - const Type* _velt_type; // vector element type Node_List* _my_pack; // pack containing this node - SWNodeInfo() : _alignment(-1), _depth(0), _velt_type(nullptr), _my_pack(nullptr) {} + SWNodeInfo() : _alignment(-1), _depth(0), _my_pack(nullptr) {} static const SWNodeInfo initial; }; @@ -199,7 +197,8 @@ class SWNodeInfo { // Transforms scalar operations into packed (superword) operations. class SuperWord : public ResourceObj { private: - const VLoop& _vloop; + const VLoopAnalyzer& _vloop_analyzer; + const VLoop& _vloop; // Arena for small data structures. Large data structures are allocated in // VSharedData, and reused over many AutoVectorizations. @@ -209,22 +208,14 @@ class SuperWord : public ResourceObj { GrowableArray _packset; // Packs for the current block - GrowableArray &_bb_idx; // Map from Node _idx to index within block - - GrowableArray _block; // Nodes in current block - GrowableArray _mem_slice_head; // Memory slice head nodes - GrowableArray _mem_slice_tail; // Memory slice tail nodes GrowableArray _node_info; // Info needed per node CloneMap& _clone_map; // map of nodes created in cloning MemNode const* _align_to_ref; // Memory reference that pre-loop will align to DepGraph _dg; // Dependence graph - // Scratch pads - GrowableArray _nlist; // List of nodes - public: - SuperWord(const VLoop &vloop, VSharedData &vshared); + SuperWord(const VLoopAnalyzer &vloop_analyzer); // Attempt to run the SuperWord algorithm on the loop. Return true if we succeed. bool transform_loop(); @@ -233,78 +224,113 @@ class SuperWord : public ResourceObj { static void unrolling_analysis(const VLoop &vloop, int &local_loop_unroll_factor); // VLoop Accessors - const VLoop& vloop() const { return _vloop; } - PhaseIdealLoop* phase() const { return vloop().phase(); } - PhaseIterGVN& igvn() const { return vloop().phase()->igvn(); } - IdealLoopTree* lpt() const { return vloop().lpt(); } - CountedLoopNode* cl() const { return vloop().cl(); } - PhiNode* iv() const { return vloop().iv(); } + PhaseIdealLoop* phase() const { return _vloop.phase(); } + PhaseIterGVN& igvn() const { return _vloop.phase()->igvn(); } + IdealLoopTree* lpt() const { return _vloop.lpt(); } + CountedLoopNode* cl() const { return _vloop.cl(); } + PhiNode* iv() const { return _vloop.iv(); } int iv_stride() const { return cl()->stride_con(); } - bool in_bb(const Node* n) const { return vloop().in_bb(n); } + bool in_bb(const Node* n) const { return _vloop.in_bb(n); } -#ifndef PRODUCT - // TraceAutoVectorization and TraceSuperWord - bool is_trace_superword_vector_element_type() const { - // Too verbose for TraceSuperWord - return vloop().vtrace().is_trace(TraceAutoVectorizationTag::SW_TYPES); + // VLoopReductions Accessors + bool is_marked_reduction(const Node* n) const { + return _vloop_analyzer.reductions().is_marked_reduction(n); } - bool is_trace_superword_alignment() const { - // Too verbose for TraceSuperWord - return vloop().vtrace().is_trace(TraceAutoVectorizationTag::SW_ALIGNMENT); + bool reduction(Node* n1, Node* n2) const { + return _vloop_analyzer.reductions().is_marked_reduction_pair(n1, n2); } - bool is_trace_superword_memory_slices() const { - return TraceSuperWord || - vloop().vtrace().is_trace(TraceAutoVectorizationTag::SW_MEMORY_SLICES); + // VLoopMemorySlices Accessors + bool same_memory_slice(MemNode* n1, MemNode* n2) const { + return _vloop_analyzer.memory_slices().same_memory_slice(n1, n2); + } + + // VLoopBody Accessors + const GrowableArray& body() const { + return _vloop_analyzer.body().body(); + } + + int bb_idx(const Node* n) const { + return _vloop_analyzer.body().bb_idx(n); + } + + // VLoopTypes Accessors + const Type* velt_type(Node* n) const { + return _vloop_analyzer.types().velt_type(n); + } + + BasicType velt_basic_type(Node* n) const { + return _vloop_analyzer.types().velt_basic_type(n); + } + + bool same_velt_type(Node* n1, Node* n2) const { + return _vloop_analyzer.types().same_velt_type(n1, n2); + } + + int data_size(Node* n) const { + return _vloop_analyzer.types().data_size(n); + } + + int vector_width(Node* n) const { + return _vloop_analyzer.types().vector_width(n); + } + + int vector_width_in_bytes(const Node* n) const { + return _vloop_analyzer.types().vector_width_in_bytes(n); + } + +#ifndef PRODUCT + // TraceAutoVectorization and TraceSuperWord + bool is_trace_superword_alignment() const { + // Too verbose for TraceSuperWord + return _vloop.vtrace().is_trace(TraceAutoVectorizationTag::SW_ALIGNMENT); } bool is_trace_superword_dependence_graph() const { return TraceSuperWord || - vloop().vtrace().is_trace(TraceAutoVectorizationTag::SW_DEPENDENCE_GRAPH); + _vloop.vtrace().is_trace(TraceAutoVectorizationTag::SW_DEPENDENCE_GRAPH); } bool is_trace_superword_adjacent_memops() const { return TraceSuperWord || - vloop().vtrace().is_trace(TraceAutoVectorizationTag::SW_ADJACENT_MEMOPS); + _vloop.vtrace().is_trace(TraceAutoVectorizationTag::SW_ADJACENT_MEMOPS); } bool is_trace_superword_rejections() const { return TraceSuperWord || - vloop().vtrace().is_trace(TraceAutoVectorizationTag::SW_REJECTIONS); + _vloop.vtrace().is_trace(TraceAutoVectorizationTag::SW_REJECTIONS); } bool is_trace_superword_packset() const { return TraceSuperWord || - vloop().vtrace().is_trace(TraceAutoVectorizationTag::SW_PACKSET); + _vloop.vtrace().is_trace(TraceAutoVectorizationTag::SW_PACKSET); } bool is_trace_superword_info() const { return TraceSuperWord || - vloop().vtrace().is_trace(TraceAutoVectorizationTag::SW_INFO); + _vloop.vtrace().is_trace(TraceAutoVectorizationTag::SW_INFO); } bool is_trace_superword_verbose() const { // Too verbose for TraceSuperWord - return vloop().vtrace().is_trace(TraceAutoVectorizationTag::SW_VERBOSE); + return _vloop.vtrace().is_trace(TraceAutoVectorizationTag::SW_VERBOSE); } bool is_trace_superword_any() const { return TraceSuperWord || is_trace_align_vector() || - vloop().vtrace().is_trace(TraceAutoVectorizationTag::SW_TYPES) || - vloop().vtrace().is_trace(TraceAutoVectorizationTag::SW_ALIGNMENT) || - vloop().vtrace().is_trace(TraceAutoVectorizationTag::SW_MEMORY_SLICES) || - vloop().vtrace().is_trace(TraceAutoVectorizationTag::SW_DEPENDENCE_GRAPH) || - vloop().vtrace().is_trace(TraceAutoVectorizationTag::SW_ADJACENT_MEMOPS) || - vloop().vtrace().is_trace(TraceAutoVectorizationTag::SW_REJECTIONS) || - vloop().vtrace().is_trace(TraceAutoVectorizationTag::SW_PACKSET) || - vloop().vtrace().is_trace(TraceAutoVectorizationTag::SW_INFO) || - vloop().vtrace().is_trace(TraceAutoVectorizationTag::SW_VERBOSE); + _vloop.vtrace().is_trace(TraceAutoVectorizationTag::SW_ALIGNMENT) || + _vloop.vtrace().is_trace(TraceAutoVectorizationTag::SW_DEPENDENCE_GRAPH) || + _vloop.vtrace().is_trace(TraceAutoVectorizationTag::SW_ADJACENT_MEMOPS) || + _vloop.vtrace().is_trace(TraceAutoVectorizationTag::SW_REJECTIONS) || + _vloop.vtrace().is_trace(TraceAutoVectorizationTag::SW_PACKSET) || + _vloop.vtrace().is_trace(TraceAutoVectorizationTag::SW_INFO) || + _vloop.vtrace().is_trace(TraceAutoVectorizationTag::SW_VERBOSE); } bool is_trace_align_vector() const { - return vloop().vtrace().is_trace(TraceAutoVectorizationTag::ALIGN_VECTOR) || + return _vloop.vtrace().is_trace(TraceAutoVectorizationTag::ALIGN_VECTOR) || is_trace_superword_verbose(); } #endif @@ -312,10 +338,8 @@ class SuperWord : public ResourceObj { bool do_vector_loop() { return _do_vector_loop; } const GrowableArray& packset() const { return _packset; } - const GrowableArray& block() const { return _block; } const DepGraph& dg() const { return _dg; } private: - VectorSet _loop_reductions; // Reduction nodes in the current loop bool _race_possible; // In cases where SDMU is true bool _do_vector_loop; // whether to do vectorization/simd style int _num_work_vecs; // Number of non memory vector operations @@ -324,24 +348,10 @@ class SuperWord : public ResourceObj { // Accessors Arena* arena() { return &_arena; } - int vector_width(const Node* n) const { - BasicType bt = velt_basic_type(n); - return MIN2(ABS(iv_stride()), Matcher::max_vector_size(bt)); - } - int vector_width_in_bytes(const Node* n) const { - BasicType bt = velt_basic_type(n); - return vector_width(n)*type2aelembytes(bt); - } int get_vw_bytes_special(MemNode* s); const MemNode* align_to_ref() const { return _align_to_ref; } void set_align_to_ref(const MemNode* m) { _align_to_ref = m; } - // block accessors - public: - int bb_idx(const Node* n) const { assert(in_bb(n), "must be"); return _bb_idx.at(n->_idx); } - private: - void set_bb_idx(Node* n, int i) { _bb_idx.at_put_grow(n->_idx, i); } - // Ensure node_info contains element "i" void grow_node_info(int i) { if (i >= _node_info.length()) _node_info.at_put_grow(i, SWNodeInfo::initial); } @@ -356,13 +366,6 @@ class SuperWord : public ResourceObj { int depth(Node* n) const { return _node_info.adr_at(bb_idx(n))->_depth; } void set_depth(Node* n, int d) { int i = bb_idx(n); grow_node_info(i); _node_info.adr_at(i)->_depth = d; } - // vector element type - const Type* velt_type(const Node* n) const { return _node_info.adr_at(bb_idx(n))->_velt_type; } - BasicType velt_basic_type(const Node* n) const { return velt_type(n)->array_element_basic_type(); } - void set_velt_type(Node* n, const Type* t) { int i = bb_idx(n); grow_node_info(i); _node_info.adr_at(i)->_velt_type = t; } - bool same_velt_type(Node* n1, Node* n2); - bool same_memory_slice(MemNode* best_align_to_mem_ref, MemNode* mem_ref) const; - // my_pack public: Node_List* my_pack(Node* n) { return !in_bb(n) ? nullptr : _node_info.adr_at(bb_idx(n))->_my_pack; } @@ -376,65 +379,7 @@ class SuperWord : public ResourceObj { bool same_origin_idx(Node* a, Node* b) const; bool same_generation(Node* a, Node* b) const; - // methods - - typedef const Pair PathEnd; - - // Search for a path P = (n_1, n_2, ..., n_k) such that: - // - original_input(n_i, input) = n_i+1 for all 1 <= i < k, - // - path(n) for all n in P, - // - k <= max, and - // - there exists a node e such that original_input(n_k, input) = e and end(e). - // Return , if P is found, or otherwise. - // Note that original_input(n, i) has the same behavior as n->in(i) except - // that it commutes the inputs of binary nodes whose edges have been swapped. - template - static PathEnd find_in_path(const Node *n1, uint input, int max, - NodePredicate1 path, NodePredicate2 end) { - const PathEnd no_path(nullptr, -1); - const Node* current = n1; - int k = 0; - for (int i = 0; i <= max; i++) { - if (current == nullptr) { - return no_path; - } - if (end(current)) { - return PathEnd(current, k); - } - if (!path(current)) { - return no_path; - } - current = original_input(current, input); - k++; - } - return no_path; - } - -public: - // Whether n is a reduction operator and part of a reduction cycle. - // This function can be used for individual queries outside the SLP analysis, - // e.g. to inform matching in target-specific code. Otherwise, the - // almost-equivalent but faster SuperWord::mark_reductions() is preferable. - static bool is_reduction(const Node* n); - // Whether n is marked as a reduction node. - bool is_marked_reduction(Node* n) { return _loop_reductions.test(n->_idx); } - // Whether the current loop has any reduction node. - bool is_marked_reduction_loop() { return !_loop_reductions.is_empty(); } private: - // Whether n is a standard reduction operator. - static bool is_reduction_operator(const Node* n); - // Whether n is part of a reduction cycle via the 'input' edge index. To bound - // the search, constrain the size of reduction cycles to LoopMaxUnroll. - static bool in_reduction_cycle(const Node* n, uint input); - // Reference to the i'th input node of n, commuting the inputs of binary nodes - // whose edges have been swapped. Assumes n is a commutative operation. - static Node* original_input(const Node* n, uint i); - // Find and mark reductions in a loop. Running mark_reductions() is similar to - // querying is_reduction(n) for every n in the SuperWord loop, but stricter in - // that it assumes counted loops and requires that reduction nodes are not - // used within the loop except by their reduction cycle predecessors. - void mark_reductions(); - // Extract the superword level parallelism bool SLP_extract(); // Find the adjacent memory references and create pack pairs for them. void find_adjacent_refs(); @@ -445,12 +390,6 @@ class SuperWord : public ResourceObj { // Construct dependency graph. void dependence_graph(); - // Analyze the memory slices - void find_memory_slices(); - NOT_PRODUCT( void print_memory_slices(); ) - // Return a memory slice (node list) in predecessor order starting at "start" - void mem_slice_preds(Node* start, Node* stop, GrowableArray &preds); - // Can s1 and s2 be in a pack with s1 immediately preceding s2 and s1 aligned at "align" bool stmts_can_pack(Node* s1, Node* s2, int align); // Does s exist in a pack at position pos? @@ -466,10 +405,7 @@ class SuperWord : public ResourceObj { // For a node pair (s1, s2) which is isomorphic and independent, // do s1 and s2 have similar input edges? bool have_similar_inputs(Node* s1, Node* s2); - // Is there a data path between s1 and s2 and both are reductions? - bool reduction(Node* s1, Node* s2); void set_alignment(Node* s1, Node* s2, int align); - int data_size(Node* s); // Extend packset by following use->def and def->use links from pack members. void extend_packset_with_more_pairs_by_following_use_and_def(); int adjust_alignment_for_type_conversion(Node* s, Node* t, int align); @@ -529,8 +465,6 @@ class SuperWord : public ResourceObj { DEBUG_ONLY(void verify_no_extract();) // Is use->in(u_idx) a vector use? bool is_vector_use(Node* use, int u_idx); - // Construct reverse postorder list of block members - bool construct_bb(); // Initialize per node info void initialize_node_info(); // Compute max depth for expressions from beginning of block @@ -539,8 +473,6 @@ class SuperWord : public ResourceObj { BasicType longer_type_for_conversion(Node* n); // Find the longest type in def-use chain for packed nodes, and then compute the max vector size. int max_vector_size_in_def_use_chain(Node* n); - // Compute necessary vector element type for expressions - void compute_vector_element_type(); // Are s1 and s2 in a pack pair and ordered as s1,s2? bool in_packset(Node* s1, Node* s2); // Remove the pack at position pos in the packset @@ -548,8 +480,6 @@ class SuperWord : public ResourceObj { static LoadNode::ControlDependency control_dependency(Node_List* p); // Alignment within a vector memory reference int memory_alignment(MemNode* s, int iv_adjust); - // Smallest type containing range of values - const Type* container_type(Node* n); // Ensure that the main loop vectors are aligned by adjusting the pre loop limit. void adjust_pre_loop_limit_to_align_main_loop_vectors(); // Is the use of d1 in u1 at the same operand position as d2 in u2? @@ -558,7 +488,6 @@ class SuperWord : public ResourceObj { // print methods void print_packset(); void print_pack(Node_List* p); - void print_bb(); void print_stmt(Node* s); void packset_sort(int n); diff --git a/src/hotspot/share/opto/traceAutoVectorizationTag.hpp b/src/hotspot/share/opto/traceAutoVectorizationTag.hpp index 79157aca309..615f9230f3a 100644 --- a/src/hotspot/share/opto/traceAutoVectorizationTag.hpp +++ b/src/hotspot/share/opto/traceAutoVectorizationTag.hpp @@ -31,9 +31,11 @@ #define COMPILER_TRACE_AUTO_VECTORIZATION_TAG(flags) \ flags(POINTER_ANALYSIS, "Trace VPointer") \ flags(PRECONDITIONS, "Trace VLoop::check_preconditions") \ - flags(SW_TYPES, "Trace SuperWord::compute_vector_element_type") \ + flags(LOOP_ANALYZER, "Trace VLoopAnalyzer::setup_submodules") \ + flags(MEMORY_SLICES, "Trace VLoopMemorySlices") \ + flags(BODY, "Trace VLoopBody") \ + flags(TYPES, "Trace VLoopTypes") \ flags(SW_ALIGNMENT, "Trace SuperWord alignment analysis") \ - flags(SW_MEMORY_SLICES, "Trace SuperWord memory slices") \ flags(SW_DEPENDENCE_GRAPH, "Trace SuperWord::dependence_graph") \ flags(SW_ADJACENT_MEMOPS, "Trace SuperWord::find_adjacent_refs") \ flags(SW_REJECTIONS, "Trace SuperWord rejections (non vectorizations)") \ @@ -112,9 +114,7 @@ class TraceAutoVectorizationTagValidator { } else if (ALL == tag) { _tags.set_range(0, TRACE_AUTO_VECTORIZATION_TAG_NUM); } else if (SW_VERBOSE == tag) { - _tags.at_put(SW_TYPES, set_bit); _tags.at_put(SW_ALIGNMENT, set_bit); - _tags.at_put(SW_MEMORY_SLICES, set_bit); _tags.at_put(SW_DEPENDENCE_GRAPH, set_bit); _tags.at_put(SW_ADJACENT_MEMOPS, set_bit); _tags.at_put(SW_REJECTIONS, set_bit); @@ -122,7 +122,6 @@ class TraceAutoVectorizationTagValidator { _tags.at_put(SW_INFO, set_bit); _tags.at_put(SW_VERBOSE, set_bit); } else if (SW_INFO == tag) { - _tags.at_put(SW_MEMORY_SLICES, set_bit); _tags.at_put(SW_DEPENDENCE_GRAPH, set_bit); _tags.at_put(SW_ADJACENT_MEMOPS, set_bit); _tags.at_put(SW_REJECTIONS, set_bit); diff --git a/src/hotspot/share/opto/type.cpp b/src/hotspot/share/opto/type.cpp index e1b2913e6dd..43e8ffbfc8a 100644 --- a/src/hotspot/share/opto/type.cpp +++ b/src/hotspot/share/opto/type.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -5489,18 +5489,17 @@ void TypeAryPtr::dump2( Dict &d, uint depth, outputStream *st ) const { st->print(":null_free"); } if (offset() != 0) { - int header_size = objArrayOopDesc::header_size() * wordSize; + BasicType basic_elem_type = elem()->basic_type(); + int header_size = arrayOopDesc::base_offset_in_bytes(basic_elem_type); if( _offset == Offset::top ) st->print("+undefined"); else if( _offset == Offset::bottom ) st->print("+any"); else if( offset() < header_size ) st->print("+%d", offset()); else { - BasicType basic_elem_type = elem()->basic_type(); if (basic_elem_type == T_ILLEGAL) { st->print("+any"); } else { - int array_base = arrayOopDesc::base_offset_in_bytes(basic_elem_type); int elem_size = type2aelembytes(basic_elem_type); - st->print("[%d]", (offset() - array_base)/elem_size); + st->print("[%d]", (offset() - header_size)/elem_size); } } } diff --git a/src/hotspot/share/opto/vectorization.cpp b/src/hotspot/share/opto/vectorization.cpp index a8374cbcd20..4acbaedd21d 100644 --- a/src/hotspot/share/opto/vectorization.cpp +++ b/src/hotspot/share/opto/vectorization.cpp @@ -40,40 +40,38 @@ bool VLoop::check_preconditions() { } #endif - const char* return_state = check_preconditions_helper(); - assert(return_state != nullptr, "must have return state"); - if (return_state == VLoop::SUCCESS) { - return true; // success - } - + VStatus status = check_preconditions_helper(); + if (!status.is_success()) { #ifndef PRODUCT - if (is_trace_preconditions()) { - tty->print_cr("VLoop::check_preconditions: failed: %s", return_state); - } + if (is_trace_preconditions()) { + tty->print_cr("VLoop::check_preconditions: failed: %s", status.failure_reason()); + } #endif - return false; // failure + return false; // failure + } + return true; // success } -const char* VLoop::check_preconditions_helper() { +VStatus VLoop::check_preconditions_helper() { // Only accept vector width that is power of 2 int vector_width = Matcher::vector_width_in_bytes(T_BYTE); if (vector_width < 2 || !is_power_of_2(vector_width)) { - return VLoop::FAILURE_VECTOR_WIDTH; + return VStatus::make_failure(VLoop::FAILURE_VECTOR_WIDTH); } // Only accept valid counted loops (int) if (!_lpt->_head->as_Loop()->is_valid_counted_loop(T_INT)) { - return VLoop::FAILURE_VALID_COUNTED_LOOP; + return VStatus::make_failure(VLoop::FAILURE_VALID_COUNTED_LOOP); } _cl = _lpt->_head->as_CountedLoop(); _iv = _cl->phi()->as_Phi(); if (_cl->is_vectorized_loop()) { - return VLoop::FAILURE_ALREADY_VECTORIZED; + return VStatus::make_failure(VLoop::FAILURE_ALREADY_VECTORIZED); } if (_cl->is_unroll_only()) { - return VLoop::FAILURE_UNROLL_ONLY; + return VStatus::make_failure(VLoop::FAILURE_UNROLL_ONLY); } // Check for control flow in the body @@ -89,12 +87,12 @@ const char* VLoop::check_preconditions_helper() { _lpt->dump_head(); } #endif - return VLoop::FAILURE_CONTROL_FLOW; + return VStatus::make_failure(VLoop::FAILURE_CONTROL_FLOW); } // Make sure the are no extra control users of the loop backedge if (_cl->back_control()->outcnt() != 1) { - return VLoop::FAILURE_BACKEDGE; + return VStatus::make_failure(VLoop::FAILURE_BACKEDGE); } // To align vector memory accesses in the main-loop, we will have to adjust @@ -102,16 +100,68 @@ const char* VLoop::check_preconditions_helper() { if (_cl->is_main_loop()) { CountedLoopEndNode* pre_end = _cl->find_pre_loop_end(); if (pre_end == nullptr) { - return VLoop::FAILURE_PRE_LOOP_LIMIT; + return VStatus::make_failure(VLoop::FAILURE_PRE_LOOP_LIMIT); } Node* pre_opaq1 = pre_end->limit(); if (pre_opaq1->Opcode() != Op_Opaque1) { - return VLoop::FAILURE_PRE_LOOP_LIMIT; + return VStatus::make_failure(VLoop::FAILURE_PRE_LOOP_LIMIT); } _pre_loop_end = pre_end; } - return VLoop::SUCCESS; + return VStatus::make_success(); +} + +// Return true iff all submodules are loaded successfully +bool VLoopAnalyzer::setup_submodules() { +#ifndef PRODUCT + if (_vloop.is_trace_loop_analyzer()) { + tty->print_cr("\nVLoopAnalyzer::setup_submodules"); + _vloop.lpt()->dump_head(); + _vloop.cl()->dump(); + } +#endif + + VStatus status = setup_submodules_helper(); + if (!status.is_success()) { +#ifndef PRODUCT + if (_vloop.is_trace_loop_analyzer()) { + tty->print_cr("\nVLoopAnalyze::setup_submodules: failed: %s", status.failure_reason()); + } +#endif + return false; // failed + } + return true; // success +} + +VStatus VLoopAnalyzer::setup_submodules_helper() { + // Skip any loop that has not been assigned max unroll by analysis. + if (SuperWordLoopUnrollAnalysis && _vloop.cl()->slp_max_unroll() == 0) { + return VStatus::make_failure(VLoopAnalyzer::FAILURE_NO_MAX_UNROLL); + } + + if (SuperWordReductions) { + _reductions.mark_reductions(); + } + + _memory_slices.find_memory_slices(); + + // If there is no memory slice detected, it means there is no store. + // If there is no reduction and no store, then we give up, because + // vectorization is not possible anyway (given current limitations). + if (!_reductions.is_marked_reduction_loop() && + _memory_slices.heads().is_empty()) { + return VStatus::make_failure(VLoopAnalyzer::FAILURE_NO_REDUCTION_OR_STORE); + } + + VStatus body_status = _body.construct(); + if (!body_status.is_success()) { + return body_status; + } + + _types.compute_vector_element_type(); + + return VStatus::make_success(); } #ifndef PRODUCT @@ -234,7 +284,7 @@ bool VPointer::invariant(Node* n) const { // main loop (Illegal invariant happens when n_c is a CastII node that // prevents data nodes to flow above the main loop). Node* n_c = phase()->get_ctrl(n); - return phase()->is_dominator(n_c, vloop().pre_loop_head()); + return phase()->is_dominator(n_c, _vloop.pre_loop_head()); } } return is_not_member; diff --git a/src/hotspot/share/opto/vectorization.hpp b/src/hotspot/share/opto/vectorization.hpp index 7aff58db4bb..3f897010d9d 100644 --- a/src/hotspot/share/opto/vectorization.hpp +++ b/src/hotspot/share/opto/vectorization.hpp @@ -28,10 +28,33 @@ #include "opto/node.hpp" #include "opto/loopnode.hpp" #include "opto/traceAutoVectorizationTag.hpp" +#include "utilities/pair.hpp" // Code in this file and the vectorization.cpp contains shared logics and // utilities for C2's loop auto-vectorization. +class VStatus : public StackObj { +private: + const char* _failure_reason; + + VStatus(const char* failure_reason) : _failure_reason(failure_reason) {} + +public: + static VStatus make_success() { return VStatus(nullptr); } + + static VStatus make_failure(const char* failure_reason) { + assert(failure_reason != nullptr, "must have reason"); + return VStatus(failure_reason); + } + + bool is_success() const { return _failure_reason == nullptr; } + + const char* failure_reason() const { + assert(!is_success(), "only failures have reason"); + return _failure_reason; + } +}; + #ifndef PRODUCT // Access to TraceAutoVectorization tags class VTrace : public StackObj { @@ -61,7 +84,6 @@ class VLoop : public StackObj { NOT_PRODUCT(VTrace _vtrace;) - static constexpr char const* SUCCESS = "success"; static constexpr char const* FAILURE_ALREADY_VECTORIZED = "loop already vectorized"; static constexpr char const* FAILURE_UNROLL_ONLY = "loop only wants to be unrolled"; static constexpr char const* FAILURE_VECTOR_WIDTH = "vector_width must be power of 2"; @@ -108,11 +130,27 @@ class VLoop : public StackObj { const VTrace& vtrace() const { return _vtrace; } bool is_trace_preconditions() const { - return vtrace().is_trace(TraceAutoVectorizationTag::PRECONDITIONS); + return _vtrace.is_trace(TraceAutoVectorizationTag::PRECONDITIONS); + } + + bool is_trace_loop_analyzer() const { + return _vtrace.is_trace(TraceAutoVectorizationTag::LOOP_ANALYZER); + } + + bool is_trace_memory_slices() const { + return _vtrace.is_trace(TraceAutoVectorizationTag::MEMORY_SLICES); + } + + bool is_trace_body() const { + return _vtrace.is_trace(TraceAutoVectorizationTag::BODY); + } + + bool is_trace_vector_element_type() const { + return _vtrace.is_trace(TraceAutoVectorizationTag::TYPES); } bool is_trace_pointer_analysis() const { - return vtrace().is_trace(TraceAutoVectorizationTag::POINTER_ANALYSIS); + return _vtrace.is_trace(TraceAutoVectorizationTag::POINTER_ANALYSIS); } #endif @@ -128,7 +166,7 @@ class VLoop : public StackObj { bool check_preconditions(); private: - const char* check_preconditions_helper(); + VStatus check_preconditions_helper(); }; // Optimization to keep allocation of large arrays in AutoVectorization low. @@ -166,6 +204,292 @@ class VSharedData : public StackObj { } }; +// Submodule of VLoopAnalyzer. +// Identify and mark all reductions in the loop. +class VLoopReductions : public StackObj { +private: + typedef const Pair PathEnd; + + const VLoop& _vloop; + VectorSet _loop_reductions; + +public: + VLoopReductions(Arena* arena, const VLoop& vloop) : + _vloop(vloop), + _loop_reductions(arena){}; + + NONCOPYABLE(VLoopReductions); + +private: + // Search for a path P = (n_1, n_2, ..., n_k) such that: + // - original_input(n_i, input) = n_i+1 for all 1 <= i < k, + // - path(n) for all n in P, + // - k <= max, and + // - there exists a node e such that original_input(n_k, input) = e and end(e). + // Return , if P is found, or otherwise. + // Note that original_input(n, i) has the same behavior as n->in(i) except + // that it commutes the inputs of binary nodes whose edges have been swapped. + template + static PathEnd find_in_path(const Node* n1, uint input, int max, + NodePredicate1 path, NodePredicate2 end) { + const PathEnd no_path(nullptr, -1); + const Node* current = n1; + int k = 0; + for (int i = 0; i <= max; i++) { + if (current == nullptr) { + return no_path; + } + if (end(current)) { + return PathEnd(current, k); + } + if (!path(current)) { + return no_path; + } + current = original_input(current, input); + k++; + } + return no_path; + } + +public: + // Find and mark reductions in a loop. Running mark_reductions() is similar to + // querying is_reduction(n) for every node in the loop, but stricter in + // that it assumes counted loops and requires that reduction nodes are not + // used within the loop except by their reduction cycle predecessors. + void mark_reductions(); + + // Whether n is a reduction operator and part of a reduction cycle. + // This function can be used for individual queries outside auto-vectorization, + // e.g. to inform matching in target-specific code. Otherwise, the + // almost-equivalent but faster mark_reductions() is preferable. + static bool is_reduction(const Node* n); + + // Whether n is marked as a reduction node. + bool is_marked_reduction(const Node* n) const { return _loop_reductions.test(n->_idx); } + + bool is_marked_reduction_loop() const { return !_loop_reductions.is_empty(); } + + // Are s1 and s2 reductions with a data path between them? + bool is_marked_reduction_pair(Node* s1, Node* s2) const; + +private: + // Whether n is a standard reduction operator. + static bool is_reduction_operator(const Node* n); + + // Whether n is part of a reduction cycle via the 'input' edge index. To bound + // the search, constrain the size of reduction cycles to LoopMaxUnroll. + static bool in_reduction_cycle(const Node* n, uint input); + + // Reference to the i'th input node of n, commuting the inputs of binary nodes + // whose edges have been swapped. Assumes n is a commutative operation. + static Node* original_input(const Node* n, uint i); +}; + +// Submodule of VLoopAnalyzer. +// Find the memory slices in the loop. +class VLoopMemorySlices : public StackObj { +private: + const VLoop& _vloop; + + GrowableArray _heads; + GrowableArray _tails; + +public: + VLoopMemorySlices(Arena* arena, const VLoop& vloop) : + _vloop(vloop), + _heads(arena, 8, 0, nullptr), + _tails(arena, 8, 0, nullptr) {}; + NONCOPYABLE(VLoopMemorySlices); + + void find_memory_slices(); + + const GrowableArray& heads() const { return _heads; } + const GrowableArray& tails() const { return _tails; } + + // Get all memory nodes of a slice, in reverse order + void get_slice_in_reverse_order(PhiNode* head, MemNode* tail, GrowableArray& slice) const; + + bool same_memory_slice(MemNode* m1, MemNode* m2) const; + +#ifndef PRODUCT + void print() const; +#endif +}; + +// Submodule of VLoopAnalyzer. +// Finds all nodes in the body, and creates a mapping node->_idx to a body_idx. +// This mapping is used so that subsequent datastructures sizes only grow with +// the body size, and not the number of all nodes in the compilation. +class VLoopBody : public StackObj { +private: + static constexpr char const* FAILURE_NODE_NOT_ALLOWED = "encontered unhandled node"; + + const VLoop& _vloop; + + // Mapping body_idx -> Node* + GrowableArray _body; + + // Mapping node->_idx -> body_idx + // Can be very large, and thus lives in VSharedData + GrowableArray& _body_idx; + +public: + VLoopBody(Arena* arena, const VLoop& vloop, VSharedData& vshared) : + _vloop(vloop), + _body(arena, vloop.estimated_body_length(), 0, nullptr), + _body_idx(vshared.node_idx_to_loop_body_idx()) {} + + NONCOPYABLE(VLoopBody); + + VStatus construct(); + const GrowableArray& body() const { return _body; } + NOT_PRODUCT( void print() const; ) + + int bb_idx(const Node* n) const { + assert(_vloop.in_bb(n), "must be in basic block"); + return _body_idx.at(n->_idx); + } + +private: + void set_bb_idx(Node* n, int i) { + _body_idx.at_put_grow(n->_idx, i); + } +}; + +// Submodule of VLoopAnalyzer. +// Compute the vector element type for every node in the loop body. +// We need to do this to be able to vectorize the narrower integer +// types (byte, char, short). In the C2 IR, their operations are +// done with full int type with 4 byte precision (e.g. AddI, MulI). +// Example: char a,b,c; a = (char)(b + c); +// However, if we can prove the the upper bits are only truncated, +// and the lower bits for the narrower type computed correctly, we +// can compute the operations in the narrower type directly (e.g we +// perform the AddI or MulI with 1 or 2 bytes). This allows us to +// fit more operations in a vector, and can remove the otherwise +// required conversion (int <-> narrower type). +// We compute the types backwards (use-to-def): If all use nodes +// only require the lower bits, then the def node can do the operation +// with only the lower bits, and we propagate the narrower type to it. +class VLoopTypes : public StackObj { +private: + const VLoop& _vloop; + const VLoopBody& _body; + + // bb_idx -> vector element type + GrowableArray _velt_type; + +public: + VLoopTypes(Arena* arena, + const VLoop& vloop, + const VLoopBody& body) : + _vloop(vloop), + _body(body), + _velt_type(arena, vloop.estimated_body_length(), 0, nullptr) {} + NONCOPYABLE(VLoopTypes); + + void compute_vector_element_type(); + NOT_PRODUCT( void print() const; ) + + const Type* velt_type(const Node* n) const { + assert(_vloop.in_bb(n), "only call on nodes in loop"); + const Type* t = _velt_type.at(_body.bb_idx(n)); + assert(t != nullptr, "must have type"); + return t; + } + + BasicType velt_basic_type(const Node* n) const { + return velt_type(n)->array_element_basic_type(); + } + + int data_size(Node* s) const { + int bsize = type2aelembytes(velt_basic_type(s)); + assert(bsize != 0, "valid size"); + return bsize; + } + + bool same_velt_type(Node* n1, Node* n2) const { + const Type* vt1 = velt_type(n1); + const Type* vt2 = velt_type(n2); + if (vt1->basic_type() == T_INT && vt2->basic_type() == T_INT) { + // Compare vectors element sizes for integer types. + return data_size(n1) == data_size(n2); + } + return vt1 == vt2; + } + + int vector_width(const Node* n) const { + BasicType bt = velt_basic_type(n); + return MIN2(ABS(_vloop.iv_stride()), Matcher::max_vector_size(bt)); + } + + int vector_width_in_bytes(const Node* n) const { + BasicType bt = velt_basic_type(n); + return vector_width(n) * type2aelembytes(bt); + } + +private: + void set_velt_type(Node* n, const Type* t) { + assert(t != nullptr, "cannot set nullptr"); + assert(_vloop.in_bb(n), "only call on nodes in loop"); + _velt_type.at_put(_body.bb_idx(n), t); + } + + // Smallest type containing range of values + const Type* container_type(Node* n) const; +}; + +// Analyze the loop in preparation for auto-vectorization. This class is +// deliberately structured into many submodules, which are as independent +// as possible, though some submodules do require other submodules. +class VLoopAnalyzer : StackObj { +private: + static constexpr char const* FAILURE_NO_MAX_UNROLL = "slp max unroll analysis required"; + static constexpr char const* FAILURE_NO_REDUCTION_OR_STORE = "no reduction and no store in loop"; + + const VLoop& _vloop; + + // Arena for all submodules + Arena _arena; + + // If all submodules are setup successfully, we set this flag at the + // end of the constructor + bool _success; + + // Submodules + VLoopReductions _reductions; + VLoopMemorySlices _memory_slices; + VLoopBody _body; + VLoopTypes _types; + +public: + VLoopAnalyzer(const VLoop& vloop, VSharedData& vshared) : + _vloop(vloop), + _arena(mtCompiler), + _success(false), + _reductions (&_arena, vloop), + _memory_slices (&_arena, vloop), + _body (&_arena, vloop, vshared), + _types (&_arena, vloop, _body) + { + _success = setup_submodules(); + } + NONCOPYABLE(VLoopAnalyzer); + + bool success() const { return _success; } + + // Read-only accessors for submodules + const VLoop& vloop() const { return _vloop; } + const VLoopReductions& reductions() const { return _reductions; } + const VLoopMemorySlices& memory_slices() const { return _memory_slices; } + const VLoopBody& body() const { return _body; } + const VLoopTypes& types() const { return _types; } + +private: + bool setup_submodules(); + VStatus setup_submodules_helper(); +}; + // A vectorization pointer (VPointer) has information about an address for // dependence checking and vector alignment. It's usually bound to a memory // operation in a counted loop for vectorizable analysis. @@ -190,10 +514,9 @@ class VPointer : public ArenaObj { bool _analyze_only; // Used in loop unrolling only for vpointer trace uint _stack_idx; // Used in loop unrolling only for vpointer trace - const VLoop& vloop() const { return _vloop; } - PhaseIdealLoop* phase() const { return vloop().phase(); } - IdealLoopTree* lpt() const { return vloop().lpt(); } - PhiNode* iv() const { return vloop().iv(); } + PhaseIdealLoop* phase() const { return _vloop.phase(); } + IdealLoopTree* lpt() const { return _vloop.lpt(); } + PhiNode* iv() const { return _vloop.iv(); } bool is_loop_member(Node* n) const; bool invariant(Node* n) const; @@ -266,7 +589,7 @@ class VPointer : public ArenaObj { bool overlap_possible_with_any_in(Node_List* p) { for (uint k = 0; k < p->size(); k++) { MemNode* mem = p->at(k)->as_Mem(); - VPointer p_mem(mem, vloop()); + VPointer p_mem(mem, _vloop); // Only if we know that we have Less or Greater can we // be sure that there can never be an overlap between // the two memory regions. diff --git a/src/hotspot/share/prims/jvmtiAgentList.cpp b/src/hotspot/share/prims/jvmtiAgentList.cpp index a32eeb7076c..2a0f7172888 100644 --- a/src/hotspot/share/prims/jvmtiAgentList.cpp +++ b/src/hotspot/share/prims/jvmtiAgentList.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -124,11 +124,11 @@ void JvmtiAgentList::add(JvmtiAgent* agent) { } while (Atomic::cmpxchg(&_list, next, agent) != next); } -void JvmtiAgentList::add(const char* name, char* options, bool absolute_path) { +void JvmtiAgentList::add(const char* name, const char* options, bool absolute_path) { add(new JvmtiAgent(name, options, absolute_path)); } -void JvmtiAgentList::add_xrun(const char* name, char* options, bool absolute_path) { +void JvmtiAgentList::add_xrun(const char* name, const char* options, bool absolute_path) { JvmtiAgent* agent = new JvmtiAgent(name, options, absolute_path); agent->set_xrun(); add(agent); @@ -198,18 +198,14 @@ void JvmtiAgentList::load_xrun_agents() { } // Invokes Agent_OnAttach for agents loaded dynamically during runtime. -jint JvmtiAgentList::load_agent(const char* agent_name, const char* absParam, - const char* options, outputStream* st) { - // The abs parameter should be "true" or "false" - const bool is_absolute_path = (absParam != nullptr) && (strcmp(absParam, "true") == 0); +void JvmtiAgentList::load_agent(const char* agent_name, bool is_absolute_path, + const char* options, outputStream* st) { JvmtiAgent* const agent = new JvmtiAgent(agent_name, options, is_absolute_path, /* dynamic agent */ true); if (agent->load(st)) { add(agent); } else { delete agent; } - // Agent_OnAttach executed so completion status is JNI_OK - return JNI_OK; } // Send any Agent_OnUnload notifications diff --git a/src/hotspot/share/prims/jvmtiAgentList.hpp b/src/hotspot/share/prims/jvmtiAgentList.hpp index cf698c69c01..c4a497dfa9e 100644 --- a/src/hotspot/share/prims/jvmtiAgentList.hpp +++ b/src/hotspot/share/prims/jvmtiAgentList.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -65,14 +65,15 @@ class JvmtiAgentList : AllStatic { static void initialize(); static void convert_xrun_agents(); - public: static void add(JvmtiAgent* agent) NOT_JVMTI_RETURN; - static void add(const char* name, char* options, bool absolute_path) NOT_JVMTI_RETURN; - static void add_xrun(const char* name, char* options, bool absolute_path) NOT_JVMTI_RETURN; + + public: + static void add(const char* name, const char* options, bool absolute_path) NOT_JVMTI_RETURN; + static void add_xrun(const char* name, const char* options, bool absolute_path) NOT_JVMTI_RETURN; static void load_agents() NOT_JVMTI_RETURN; - static jint load_agent(const char* agent, const char* absParam, - const char* options, outputStream* st) NOT_JVMTI_RETURN_(0); + static void load_agent(const char* agent, bool is_absolute_path, + const char* options, outputStream* st) NOT_JVMTI_RETURN; static void load_xrun_agents() NOT_JVMTI_RETURN; static void unload_agents() NOT_JVMTI_RETURN; diff --git a/src/hotspot/share/prims/stackwalk.cpp b/src/hotspot/share/prims/stackwalk.cpp index 04a50ff611f..20f7ecefe11 100644 --- a/src/hotspot/share/prims/stackwalk.cpp +++ b/src/hotspot/share/prims/stackwalk.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -544,7 +544,11 @@ jint StackWalk::fetchNextBatch(Handle stackStream, jint mode, jlong magic, // the continuation and it returns to let Java side set the continuation. // Now this batch starts right at the first frame of another continuation. if (last_batch_count > 0) { - log_debug(stackwalk)("advanced past %s", stream.method()->external_name()); + // It is not always safe to dig out the name of the last frame + // here, i.e. stream.method()->external_name(), since it may + // have been reclaimed by HandleMark::pop_and_restore() together + // with the rest of the previous batch. + log_debug(stackwalk)("advanced past last frame decoded in the previous batch"); stream.next(); } diff --git a/src/hotspot/share/prims/unsafe.cpp b/src/hotspot/share/prims/unsafe.cpp index 5bbc71d1102..dcd0b3a7419 100644 --- a/src/hotspot/share/prims/unsafe.cpp +++ b/src/hotspot/share/prims/unsafe.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -73,7 +73,7 @@ #define MAX_OBJECT_SIZE \ - ( arrayOopDesc::header_size(T_DOUBLE) * HeapWordSize \ + ( arrayOopDesc::base_offset_in_bytes(T_DOUBLE) \ + ((julong)max_jint * sizeof(double)) ) #define UNSAFE_ENTRY(result_type, header) \ diff --git a/src/hotspot/share/prims/whitebox.cpp b/src/hotspot/share/prims/whitebox.cpp index 52e4c50c420..7981c95b822 100644 --- a/src/hotspot/share/prims/whitebox.cpp +++ b/src/hotspot/share/prims/whitebox.cpp @@ -109,8 +109,8 @@ #include "gc/g1/g1CollectedHeap.inline.hpp" #include "gc/g1/g1ConcurrentMark.hpp" #include "gc/g1/g1ConcurrentMarkThread.inline.hpp" -#include "gc/g1/heapRegionManager.hpp" -#include "gc/g1/heapRegionRemSet.inline.hpp" +#include "gc/g1/g1HeapRegionManager.hpp" +#include "gc/g1/g1HeapRegionRemSet.inline.hpp" #endif // INCLUDE_G1GC #if INCLUDE_PARALLELGC #include "gc/parallel/parallelScavengeHeap.inline.hpp" diff --git a/src/hotspot/share/runtime/continuationFreezeThaw.cpp b/src/hotspot/share/runtime/continuationFreezeThaw.cpp index c9ddfa900dd..ec6adf5cb67 100644 --- a/src/hotspot/share/runtime/continuationFreezeThaw.cpp +++ b/src/hotspot/share/runtime/continuationFreezeThaw.cpp @@ -390,7 +390,7 @@ class FreezeBase : public StackObj { inline int size_if_fast_freeze_available(); #ifdef ASSERT - bool interpreted_native_or_deoptimized_on_stack(); + bool check_valid_fast_path(); #endif protected: @@ -1514,7 +1514,10 @@ static bool monitors_on_stack(JavaThread* thread) { return false; } -bool FreezeBase::interpreted_native_or_deoptimized_on_stack() { +// There are no interpreted frames if we're not called from the interpreter and we haven't ancountered an i2c +// adapter or called Deoptimization::unpack_frames. As for native frames, upcalls from JNI also go through the +// interpreter (see JavaCalls::call_helper), while the UpcallLinker explicitly sets cont_fastpath. +bool FreezeBase::check_valid_fast_path() { ContinuationEntry* ce = _thread->last_continuation(); RegisterMap map(_thread, RegisterMap::UpdateMap::skip, @@ -1522,11 +1525,11 @@ bool FreezeBase::interpreted_native_or_deoptimized_on_stack() { RegisterMap::WalkContinuation::skip); map.set_include_argument_oops(false); for (frame f = freeze_start_frame(); Continuation::is_frame_in_continuation(ce, f); f = f.sender(&map)) { - if (f.is_interpreted_frame() || f.is_native_frame() || f.is_deoptimized_frame()) { - return true; + if (!f.is_compiled_frame() || f.is_deoptimized_frame()) { + return false; } } - return false; + return true; } #endif // ASSERT @@ -1588,11 +1591,7 @@ static inline int freeze_internal(JavaThread* current, intptr_t* const sp) { Freeze freeze(current, cont, sp); - // There are no interpreted frames if we're not called from the interpreter and we haven't ancountered an i2c - // adapter or called Deoptimization::unpack_frames. Calls from native frames also go through the interpreter - // (see JavaCalls::call_helper). - assert(!current->cont_fastpath() - || (current->cont_fastpath_thread_state() && !freeze.interpreted_native_or_deoptimized_on_stack()), ""); + assert(!current->cont_fastpath() || freeze.check_valid_fast_path(), ""); bool fast = UseContinuationFastPath && current->cont_fastpath(); if (fast && freeze.size_if_fast_freeze_available() > 0) { freeze.freeze_fast_existing_chunk(); diff --git a/src/hotspot/share/services/attachListener.cpp b/src/hotspot/share/services/attachListener.cpp index 545563ba8ec..40b1a744018 100644 --- a/src/hotspot/share/services/attachListener.cpp +++ b/src/hotspot/share/services/attachListener.cpp @@ -135,7 +135,12 @@ static jint load_agent(AttachOperation* op, outputStream* out) { } } - return JvmtiAgentList::load_agent(agent, absParam, options, out); + // The abs parameter should be "true" or "false". + const bool is_absolute_path = (absParam != nullptr) && (strcmp(absParam, "true") == 0); + JvmtiAgentList::load_agent(agent, is_absolute_path, options, out); + + // Agent_OnAttach result or error message is written to 'out'. + return JNI_OK; } // Implementation of "properties" command. diff --git a/src/hotspot/share/services/diagnosticCommand.cpp b/src/hotspot/share/services/diagnosticCommand.cpp index d597a44c84a..03636700c1a 100644 --- a/src/hotspot/share/services/diagnosticCommand.cpp +++ b/src/hotspot/share/services/diagnosticCommand.cpp @@ -308,7 +308,7 @@ void JVMTIAgentLoadDCmd::execute(DCmdSource source, TRAPS) { if (is_java_agent) { if (_option.value() == nullptr) { - JvmtiAgentList::load_agent("instrument", "false", _libpath.value(), output()); + JvmtiAgentList::load_agent("instrument", false, _libpath.value(), output()); } else { size_t opt_len = strlen(_libpath.value()) + strlen(_option.value()) + 2; if (opt_len > 4096) { @@ -325,12 +325,12 @@ void JVMTIAgentLoadDCmd::execute(DCmdSource source, TRAPS) { } jio_snprintf(opt, opt_len, "%s=%s", _libpath.value(), _option.value()); - JvmtiAgentList::load_agent("instrument", "false", opt, output()); + JvmtiAgentList::load_agent("instrument", false, opt, output()); os::free(opt); } } else { - JvmtiAgentList::load_agent(_libpath.value(), "true", _option.value(), output()); + JvmtiAgentList::load_agent(_libpath.value(), true, _option.value(), output()); } } diff --git a/src/hotspot/share/utilities/debug.cpp b/src/hotspot/share/utilities/debug.cpp index 913d1ba4ce4..9a15a5bdba6 100644 --- a/src/hotspot/share/utilities/debug.cpp +++ b/src/hotspot/share/utilities/debug.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/hotspot/share/utilities/globalDefinitions.hpp b/src/hotspot/share/utilities/globalDefinitions.hpp index 65982633cbc..896801b8be1 100644 --- a/src/hotspot/share/utilities/globalDefinitions.hpp +++ b/src/hotspot/share/utilities/globalDefinitions.hpp @@ -1054,7 +1054,6 @@ const int uninitBlockPad = 0xF1; // value used to zap const juint uninitMetaWordVal = 0xf7f7f7f7; // value used to zap newly allocated metachunk const jubyte heapPaddingByteVal = 0xBD; // value used to zap object padding in the heap const juint badHeapWordVal = 0xBAADBABE; // value used to zap heap after GC -const juint badMetaWordVal = 0xBAADFADE; // value used to zap metadata heap after GC const int badCodeHeapNewVal = 0xCC; // value used to zap Code heap at allocation const int badCodeHeapFreeVal = 0xDD; // value used to zap Code heap at deallocation const intptr_t badDispHeaderDeopt = 0xDE0BD000; // value to fill unused displaced header during deoptimization diff --git a/src/hotspot/share/utilities/vmError.cpp b/src/hotspot/share/utilities/vmError.cpp index d40504d6d20..156a0fd2ec6 100644 --- a/src/hotspot/share/utilities/vmError.cpp +++ b/src/hotspot/share/utilities/vmError.cpp @@ -489,6 +489,10 @@ void VMError::print_native_stack(outputStream* st, frame fr, Thread* t, bool pri static void print_oom_reasons(outputStream* st) { st->print_cr("# Possible reasons:"); st->print_cr("# The system is out of physical RAM or swap space"); +#ifdef LINUX + st->print_cr("# This process has exceeded the maximum number of memory mappings (check below"); + st->print_cr("# for `/proc/sys/vm/max_map_count` and `Total number of mappings`)"); +#endif if (UseCompressedOops) { st->print_cr("# This process is running with CompressedOops enabled, and the Java Heap may be blocking the growth of the native heap"); } diff --git a/src/java.base/share/classes/java/io/DataInputStream.java b/src/java.base/share/classes/java/io/DataInputStream.java index 7192b30d5f2..88cd4edc411 100644 --- a/src/java.base/share/classes/java/io/DataInputStream.java +++ b/src/java.base/share/classes/java/io/DataInputStream.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1994, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1994, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -571,10 +571,10 @@ public final String readUTF() throws IOException { * valid modified UTF-8 encoding of a Unicode string. * @see java.io.DataInputStream#readUnsignedShort() */ - public static final String readUTF(DataInput in) throws IOException { + public static String readUTF(DataInput in) throws IOException { int utflen = in.readUnsignedShort(); - byte[] bytearr = null; - char[] chararr = null; + byte[] bytearr; + char[] chararr; if (in instanceof DataInputStream dis) { if (dis.bytearr.length < utflen) { dis.bytearr = new byte[utflen*2]; diff --git a/src/java.base/share/classes/java/io/ObjectInputStream.java b/src/java.base/share/classes/java/io/ObjectInputStream.java index 33f322270b8..f2f78923c64 100644 --- a/src/java.base/share/classes/java/io/ObjectInputStream.java +++ b/src/java.base/share/classes/java/io/ObjectInputStream.java @@ -33,6 +33,7 @@ import java.lang.reflect.InvocationHandler; import java.lang.reflect.Modifier; import java.lang.reflect.Proxy; +import java.nio.charset.StandardCharsets; import java.security.AccessControlContext; import java.security.AccessController; import java.security.PrivilegedAction; @@ -42,6 +43,7 @@ import java.util.Map; import java.util.Objects; +import jdk.internal.access.JavaLangAccess; import jdk.internal.access.SharedSecrets; import jdk.internal.event.DeserializationEvent; import jdk.internal.misc.Unsafe; @@ -3022,6 +3024,8 @@ private class BlockDataInputStream private static final int CHAR_BUF_SIZE = 256; /** readBlockHeader() return value indicating header read may block */ private static final int HEADER_BLOCKED = -2; + /** access to internal methods to count ASCII and inflate latin1/ASCII bytes to char */ + private static final JavaLangAccess JLA = SharedSecrets.getJavaLangAccess(); /** buffer for reading general/block data */ private final byte[] buf = new byte[MAX_BLOCK_SIZE]; @@ -3698,8 +3702,32 @@ String readLongUTF() throws IOException { * utflen bytes. */ private String readUTFBody(long utflen) throws IOException { + if (!blkmode) { + end = pos = 0; + } + StringBuilder sbuf; if (utflen > 0 && utflen < Integer.MAX_VALUE) { + // Scan for leading ASCII chars + int avail = end - pos; + int ascii = JLA.countPositives(buf, pos, Math.min(avail, (int)utflen)); + if (ascii == utflen) { + // Complete match, consume the buf[pos ... pos + ascii] range and return. + // Modified UTF-8 and ISO-8859-1 are both ASCII-compatible encodings bytes + // thus we can treat the range as ISO-8859-1 and avoid a redundant scan + // in the String constructor + String utf = new String(buf, pos, ascii, StandardCharsets.ISO_8859_1); + pos += ascii; + return utf; + } + // Avoid allocating a StringBuilder if there's enough data in buf and + // cbuf is large enough + if (avail >= utflen && utflen <= CHAR_BUF_SIZE) { + JLA.inflateBytesToChars(buf, pos, cbuf, 0, ascii); + pos += ascii; + int cbufPos = readUTFSpan(ascii, utflen - ascii); + return new String(cbuf, 0, cbufPos); + } // a reasonable initial capacity based on the UTF length int initialCapacity = Math.min((int)utflen, 0xFFFF); sbuf = new StringBuilder(initialCapacity); @@ -3707,14 +3735,14 @@ private String readUTFBody(long utflen) throws IOException { sbuf = new StringBuilder(); } - if (!blkmode) { - end = pos = 0; - } - while (utflen > 0) { int avail = end - pos; if (avail >= 3 || (long) avail == utflen) { - utflen -= readUTFSpan(sbuf, utflen); + int cbufPos = readUTFSpan(0, utflen); + // pos has advanced: adjust utflen by the difference in + // available bytes + utflen -= avail - (end - pos); + sbuf.append(cbuf, 0, cbufPos); } else { if (blkmode) { // near block boundary, read one byte at a time @@ -3736,18 +3764,17 @@ private String readUTFBody(long utflen) throws IOException { /** * Reads span of UTF-encoded characters out of internal buffer - * (starting at offset pos and ending at or before offset end), - * consuming no more than utflen bytes. Appends read characters to - * sbuf. Returns the number of bytes consumed. + * (starting at offset pos), consuming no more than utflen bytes. + * Appends read characters to cbuf. Returns the current position + * in cbuf. */ - private long readUTFSpan(StringBuilder sbuf, long utflen) + private int readUTFSpan(int cpos, long utflen) throws IOException { - int cpos = 0; int start = pos; int avail = Math.min(end - pos, CHAR_BUF_SIZE); // stop short of last char unless all of utf bytes in buffer - int stop = pos + ((utflen > avail) ? avail - 2 : (int) utflen); + int stop = start + ((utflen > avail) ? avail - 2 : (int) utflen); boolean outOfBounds = false; try { @@ -3792,9 +3819,7 @@ private long readUTFSpan(StringBuilder sbuf, long utflen) throw new UTFDataFormatException(); } } - - sbuf.append(cbuf, 0, cpos); - return pos - start; + return cpos; } /** diff --git a/src/java.base/share/classes/java/lang/Math.java b/src/java.base/share/classes/java/lang/Math.java index 11c636c8434..fa45b6436c7 100644 --- a/src/java.base/share/classes/java/lang/Math.java +++ b/src/java.base/share/classes/java/lang/Math.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1994, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1994, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -212,7 +212,7 @@ public static double cos(double a) { *
  • If the argument is zero, then the result is a zero with the * same sign as the argument. * - *

    The computed result must be within 1 ulp of the exact result. + *

    The computed result must be within 1.25 ulps of the exact result. * Results must be semi-monotonic. * * @param a an angle, in radians. diff --git a/src/java.base/share/classes/java/text/ChoiceFormat.java b/src/java.base/share/classes/java/text/ChoiceFormat.java index d9f7557dded..b9aad971aa5 100644 --- a/src/java.base/share/classes/java/text/ChoiceFormat.java +++ b/src/java.base/share/classes/java/text/ChoiceFormat.java @@ -41,7 +41,9 @@ import java.io.InvalidObjectException; import java.io.IOException; import java.io.ObjectInputStream; +import java.util.ArrayList; import java.util.Arrays; +import java.util.Objects; /** * {@code ChoiceFormat} is a concrete subclass of {@code NumberFormat} that @@ -238,6 +240,7 @@ public class ChoiceFormat extends NumberFormat { * @see #ChoiceFormat(String) */ public void applyPattern(String newPattern) { + Objects.requireNonNull(newPattern, "newPattern must not be null"); applyPatternImpl(newPattern); } @@ -249,86 +252,92 @@ public void applyPattern(String newPattern) { * further understanding of certain special characters: "#", "<", "\u2264", "|". */ private void applyPatternImpl(String newPattern) { - StringBuilder[] segments = new StringBuilder[2]; - for (int i = 0; i < segments.length; ++i) { - segments[i] = new StringBuilder(); - } - double[] newChoiceLimits = new double[30]; - String[] newChoiceFormats = new String[30]; - int count = 0; - int part = 0; // 0 denotes limit, 1 denotes format - double startValue = 0; - double oldStartValue = Double.NaN; + // Set up components + ArrayList limits = new ArrayList<>(); + ArrayList formats = new ArrayList<>(); + StringBuilder[] segments = new StringBuilder[]{new StringBuilder(), + new StringBuilder()}; + int part = 0; // 0 denotes LIMIT. 1 denotes FORMAT. + double limit = 0; boolean inQuote = false; + + // Parse the string, alternating the value of part for (int i = 0; i < newPattern.length(); ++i) { char ch = newPattern.charAt(i); - if (ch=='\'') { - // Check for "''" indicating a literal quote - if ((i+1) d).toArray(); + choiceFormats = formats.toArray(new String[0]); + } + + /** + * Converts a string value to its double representation; this is used + * to create the limit segment while applying a pattern. + * Handles "\u221E", as specified by the pattern syntax. + */ + private static double stringToNum(String str) { + return switch (str) { + case "\u221E" -> Double.POSITIVE_INFINITY; + case "-\u221E" -> Double.NEGATIVE_INFINITY; + default -> Double.parseDouble(str); + }; } /** @@ -402,6 +411,7 @@ public String toPattern() { * @see #applyPattern */ public ChoiceFormat(String newPattern) { + Objects.requireNonNull(newPattern, "newPattern must not be null"); applyPatternImpl(newPattern); } @@ -574,6 +584,24 @@ public static final double nextDouble (double d) { return Math.nextUp(d); } + /** + * Finds the least double greater than {@code d} (if {@code positive} is + * {@code true}), or the greatest double less than {@code d} (if + * {@code positive} is {@code false}). + * If {@code NaN}, returns same value. + * + * @implNote This is equivalent to calling + * {@code positive ? Math.nextUp(d) : Math.nextDown(d)} + * + * @param d the reference value + * @param positive {@code true} if the least double is desired; + * {@code false} otherwise + * @return the least or greater double value + */ + public static double nextDouble (double d, boolean positive) { + return positive ? Math.nextUp(d) : Math.nextDown(d); + } + /** * Finds the greatest double less than {@code d}. * If {@code NaN}, returns same value. @@ -593,8 +621,7 @@ public static final double previousDouble (double d) { * Overrides Cloneable */ @Override - public Object clone() - { + public Object clone() { ChoiceFormat other = (ChoiceFormat) super.clone(); // for primitives or immutables, shallow clone is enough other.choiceLimits = choiceLimits.clone(); @@ -685,37 +712,4 @@ private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundE * @serial */ private String[] choiceFormats; - - /** - * Finds the least double greater than {@code d} (if {@code positive} is - * {@code true}), or the greatest double less than {@code d} (if - * {@code positive} is {@code false}). - * If {@code NaN}, returns same value. - * - * @implNote This is equivalent to calling - * {@code positive ? Math.nextUp(d) : Math.nextDown(d)} - * - * @param d the reference value - * @param positive {@code true} if the least double is desired; - * {@code false} otherwise - * @return the least or greater double value - */ - public static double nextDouble (double d, boolean positive) { - return positive ? Math.nextUp(d) : Math.nextDown(d); - } - - private static double[] doubleArraySize(double[] array) { - int oldSize = array.length; - double[] newArray = new double[oldSize * 2]; - System.arraycopy(array, 0, newArray, 0, oldSize); - return newArray; - } - - private String[] doubleArraySize(String[] array) { - int oldSize = array.length; - String[] newArray = new String[oldSize * 2]; - System.arraycopy(array, 0, newArray, 0, oldSize); - return newArray; - } - } diff --git a/src/java.base/share/classes/java/text/DateFormat.java b/src/java.base/share/classes/java/text/DateFormat.java index 335fe1105a6..d7a4b5a39b7 100644 --- a/src/java.base/share/classes/java/text/DateFormat.java +++ b/src/java.base/share/classes/java/text/DateFormat.java @@ -482,6 +482,31 @@ public Object parseObject(String source, ParsePosition pos) { */ public static final int DEFAULT = MEDIUM; + /** + * A DateFormat style. + * {@code Style} is an enum which corresponds to the DateFormat style + * constants. Use {@code getValue()} to retrieve the associated int style + * value. + */ + enum Style { + + FULL(DateFormat.FULL), + LONG(DateFormat.LONG), + MEDIUM(DateFormat.MEDIUM), + SHORT(DateFormat.SHORT), + DEFAULT(DateFormat.MEDIUM); + + private final int value; + + Style(int value){ + this.value = value; + } + + int getValue() { + return value; + } + } + /** * Gets the time formatter with the default formatting style * for the default {@link java.util.Locale.Category#FORMAT FORMAT} locale. diff --git a/src/java.base/share/classes/java/text/MessageFormat.java b/src/java.base/share/classes/java/text/MessageFormat.java index c309801bf0c..8f939f8af26 100644 --- a/src/java.base/share/classes/java/text/MessageFormat.java +++ b/src/java.base/share/classes/java/text/MessageFormat.java @@ -38,10 +38,10 @@ package java.text; -import java.io.InvalidObjectException; import java.io.IOException; +import java.io.InvalidObjectException; import java.io.ObjectInputStream; -import java.text.DecimalFormat; +import java.time.format.DateTimeFormatter; import java.util.ArrayList; import java.util.Arrays; import java.util.Date; @@ -52,7 +52,7 @@ /** * {@code MessageFormat} provides a means to produce concatenated - * messages in a language-neutral way. Use this to construct messages + * messages in a language-neutral way. Use this class to construct messages * displayed for end users. * *

    @@ -82,8 +82,16 @@ * { ArgumentIndex , FormatType } * { ArgumentIndex , FormatType , FormatStyle } * - * FormatType: one of - * number date time choice + * FormatType: + * number + * dtf_date + * dtf_time + * dtf_datetime + * pre-defined DateTimeFormatter(s) + * date + * time + * choice + * list * * FormatStyle: * short @@ -93,48 +101,13 @@ * integer * currency * percent + * compact_short + * compact_long + * or + * unit * SubformatPattern * * - *

    Within a String, a pair of single quotes can be used to - * quote any arbitrary characters except single quotes. For example, - * pattern string "'{0}'" represents string - * "{0}", not a FormatElement. A single quote itself - * must be represented by doubled single quotes {@code ''} throughout a - * String. For example, pattern string "'{''}'" is - * interpreted as a sequence of '{ (start of quoting and a - * left curly brace), {@code ''} (a single quote), and - * }' (a right curly brace and end of quoting), - * not '{' and '}' (quoted left and - * right curly braces): representing string "{'}", - * not "{}". - * - *

    A SubformatPattern is interpreted by its corresponding - * subformat, and subformat-dependent pattern rules apply. For example, - * pattern string "{1,number,$'#',##}" - * (SubformatPattern with underline) will produce a number format - * with the pound-sign quoted, with a result such as: {@code - * "$#31,45"}. Refer to each {@code Format} subclass documentation for - * details. - * - *

    Any unmatched quote is treated as closed at the end of the given - * pattern. For example, pattern string {@code "'{0}"} is treated as - * pattern {@code "'{0}'"}. - * - *

    Any curly braces within an unquoted pattern must be balanced. For - * example, "ab {0} de" and "ab '}' de" are - * valid patterns, but "ab {0'}' de", "ab } de" - * and "''{''" are not. - * - *

    Warning:
    The rules for using quotes within message - * format patterns unfortunately have shown to be somewhat confusing. - * In particular, it isn't always obvious to localizers whether single - * quotes need to be doubled or not. Make sure to inform localizers about - * the rules, and tell them (for example, by using comments in resource - * bundle source files) which strings will be processed by {@code MessageFormat}. - * Note that localizers may need to use single quotes in translated - * strings where the original version doesn't have them. - *
    *

    * The ArgumentIndex value is a non-negative integer written * using the digits {@code '0'} through {@code '9'}, and represents an index into the @@ -143,8 +116,9 @@ *

    * The FormatType and FormatStyle values are used to create * a {@code Format} instance for the format element. The following - * table shows how the values map to {@code Format} instances. Combinations not - * shown in the table are illegal. A SubformatPattern must + * table shows how the values map to {@code Format} instances. These values + * are case-insensitive when passed to {@link #applyPattern(String)}. Combinations + * not shown in the table are illegal. A SubformatPattern must * be a valid pattern string for the {@code Format} subclass used. * * @@ -161,7 +135,7 @@ * - * @@ -174,109 +148,254 @@ * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * * + * * * * * * * * * * * * * * + * + * + * *
    (none) * {@code null} *
    {@code number} + * {@code number} * (none) * {@link NumberFormat#getInstance(Locale) NumberFormat.getInstance}{@code (getLocale())} *
    {@code percent} * {@link NumberFormat#getPercentInstance(Locale) NumberFormat.getPercentInstance}{@code (getLocale())} *
    {@code compact_short} + * {@link NumberFormat#getCompactNumberInstance(Locale, NumberFormat.Style) + * NumberFormat.getCompactNumberInstance}{@code (getLocale(),} {@link NumberFormat.Style#SHORT}) + *
    {@code compact_long} + * {@link NumberFormat#getCompactNumberInstance(Locale, NumberFormat.Style) + * NumberFormat.getCompactNumberInstance}{@code (getLocale(),} {@link NumberFormat.Style#LONG}) + *
    SubformatPattern + * {@code new} {@link DecimalFormat#DecimalFormat(String,DecimalFormatSymbols) + * DecimalFormat}{@code (subformatPattern,} {@link DecimalFormatSymbols#getInstance(Locale) + * DecimalFormatSymbols.getInstance}{@code (getLocale()))} + *
    {@code dtf_date} + * (none) + * {@link DateTimeFormatter#ofLocalizedDate(java.time.format.FormatStyle) + * DateTimeFormatter.ofLocalizedDate(}{@link java.time.format.FormatStyle#MEDIUM}{@code ).withLocale(getLocale())} + *
    {@code short} + * {@link DateTimeFormatter#ofLocalizedDate(java.time.format.FormatStyle) + * DateTimeFormatter.ofLocalizedDate(}{@link java.time.format.FormatStyle#SHORT}{@code ).withLocale(getLocale())} + *
    {@code medium} + * {@link DateTimeFormatter#ofLocalizedDate(java.time.format.FormatStyle) + * DateTimeFormatter.ofLocalizedDate(}{@link java.time.format.FormatStyle#MEDIUM}{@code ).withLocale(getLocale())} + *
    {@code long} + * {@link DateTimeFormatter#ofLocalizedDate(java.time.format.FormatStyle) + * DateTimeFormatter.ofLocalizedDate(}{@link java.time.format.FormatStyle#LONG}{@code ).withLocale(getLocale())} + *
    {@code full} + * {@link DateTimeFormatter#ofLocalizedDate(java.time.format.FormatStyle) + * DateTimeFormatter.ofLocalizedDate(}{@link java.time.format.FormatStyle#FULL}{@code ).withLocale(getLocale())} + *
    SubformatPattern + * {@link DateTimeFormatter#ofPattern(String, Locale) + * DateTimeFormatter.ofPattern}{@code (subformatPattern, getLocale())} + *
    {@code dtf_time} + * (none) + * {@link DateTimeFormatter#ofLocalizedTime(java.time.format.FormatStyle) + * DateTimeFormatter.ofLocalizedTime(}{@link java.time.format.FormatStyle#MEDIUM}{@code ).withLocale(getLocale())} + *
    {@code short} + * {@link DateTimeFormatter#ofLocalizedTime(java.time.format.FormatStyle) + * DateTimeFormatter.ofLocalizedTime(}{@link java.time.format.FormatStyle#SHORT}{@code ).withLocale(getLocale())} + *
    {@code medium} + * {@link DateTimeFormatter#ofLocalizedTime(java.time.format.FormatStyle) + * DateTimeFormatter.ofLocalizedTime(}{@link java.time.format.FormatStyle#MEDIUM}{@code ).withLocale(getLocale())} + *
    {@code long} + * {@link DateTimeFormatter#ofLocalizedTime(java.time.format.FormatStyle) + * DateTimeFormatter.ofLocalizedTime(}{@link java.time.format.FormatStyle#LONG}{@code ).withLocale(getLocale())} + *
    {@code full} + * {@link DateTimeFormatter#ofLocalizedTime(java.time.format.FormatStyle) + * DateTimeFormatter.ofLocalizedTime(}{@link java.time.format.FormatStyle#FULL}{@code ).withLocale(getLocale())} + *
    SubformatPattern + * {@link DateTimeFormatter#ofPattern(String, Locale) DateTimeFormatter.ofPattern}{@code (subformatPattern, getLocale())} + *
    {@code dtf_datetime} + * (none) + * {@link DateTimeFormatter#ofLocalizedDateTime(java.time.format.FormatStyle) + * DateTimeFormatter.ofLocalizedDateTime(}{@link java.time.format.FormatStyle#MEDIUM}{@code ).withLocale(getLocale())} + *
    {@code short} + * {@link DateTimeFormatter#ofLocalizedDateTime(java.time.format.FormatStyle) + * DateTimeFormatter.ofLocalizedDateTime(}{@link java.time.format.FormatStyle#SHORT}{@code ).withLocale(getLocale())} + *
    {@code medium} + * {@link DateTimeFormatter#ofLocalizedDateTime(java.time.format.FormatStyle) + * DateTimeFormatter.ofLocalizedDateTime(}{@link java.time.format.FormatStyle#MEDIUM}{@code ).withLocale(getLocale())} + *
    {@code long} + * {@link DateTimeFormatter#ofLocalizedDateTime(java.time.format.FormatStyle) + * DateTimeFormatter.ofLocalizedDateTime(}{@link java.time.format.FormatStyle#LONG}{@code ).withLocale(getLocale())} + *
    {@code full} + * {@link DateTimeFormatter#ofLocalizedDateTime(java.time.format.FormatStyle) + * DateTimeFormatter.ofLocalizedDateTime(}{@link java.time.format.FormatStyle#FULL}{@code ).withLocale(getLocale())} + *
    SubformatPattern - * {@code new} {@link DecimalFormat#DecimalFormat(String,DecimalFormatSymbols) DecimalFormat}{@code (subformatPattern,} {@link DecimalFormatSymbols#getInstance(Locale) DecimalFormatSymbols.getInstance}{@code (getLocale()))} + * {@link DateTimeFormatter#ofPattern(String, Locale) + * DateTimeFormatter.ofPattern}{@code (subformatPattern, getLocale())} + *
    {@code pre-defined DateTimeFormatter(s)} + * (none) + * The {@code pre-defined DateTimeFormatter(s)} are used as a {@code FormatType} : + * {@link DateTimeFormatter#BASIC_ISO_DATE BASIC_ISO_DATE}, + * {@link DateTimeFormatter#ISO_LOCAL_DATE ISO_LOCAL_DATE}, + * {@link DateTimeFormatter#ISO_OFFSET_DATE ISO_OFFSET_DATE}, + * {@link DateTimeFormatter#ISO_DATE ISO_DATE}, + * {@link DateTimeFormatter#ISO_LOCAL_TIME ISO_LOCAL_TIME}, + * {@link DateTimeFormatter#ISO_OFFSET_TIME ISO_OFFSET_TIME}, + * {@link DateTimeFormatter#ISO_TIME ISO_TIME}, + * {@link DateTimeFormatter#ISO_LOCAL_DATE_TIME ISO_LOCAL_DATE_TIME}, + * {@link DateTimeFormatter#ISO_OFFSET_DATE_TIME ISO_OFFSET_DATE_TIME}, + * {@link DateTimeFormatter#ISO_ZONED_DATE_TIME ISO_ZONED_DATE_TIME}, + * {@link DateTimeFormatter#ISO_DATE_TIME ISO_DATE_TIME}, + * {@link DateTimeFormatter#ISO_ORDINAL_DATE ISO_ORDINAL_DATE}, + * {@link DateTimeFormatter#ISO_WEEK_DATE ISO_WEEK_DATE}, + * {@link DateTimeFormatter#ISO_INSTANT ISO_INSTANT}, + * {@link DateTimeFormatter#RFC_1123_DATE_TIME RFC_1123_DATE_TIME} *
    {@code date} * (none) - * {@link DateFormat#getDateInstance(int,Locale) DateFormat.getDateInstance}{@code (}{@link DateFormat#DEFAULT}{@code , getLocale())} + * {@link DateFormat#getDateInstance(int,Locale) + * DateFormat.getDateInstance}{@code (}{@link DateFormat#DEFAULT}{@code , getLocale())} *
    {@code short} - * {@link DateFormat#getDateInstance(int,Locale) DateFormat.getDateInstance}{@code (}{@link DateFormat#SHORT}{@code , getLocale())} + * {@link DateFormat#getDateInstance(int,Locale) + * DateFormat.getDateInstance}{@code (}{@link DateFormat#SHORT}{@code , getLocale())} *
    {@code medium} - * {@link DateFormat#getDateInstance(int,Locale) DateFormat.getDateInstance}{@code (}{@link DateFormat#DEFAULT}{@code , getLocale())} + * {@link DateFormat#getDateInstance(int,Locale) + * DateFormat.getDateInstance}{@code (}{@link DateFormat#MEDIUM}{@code , getLocale())} *
    {@code long} - * {@link DateFormat#getDateInstance(int,Locale) DateFormat.getDateInstance}{@code (}{@link DateFormat#LONG}{@code , getLocale())} + * {@link DateFormat#getDateInstance(int,Locale) + * DateFormat.getDateInstance}{@code (}{@link DateFormat#LONG}{@code , getLocale())} *
    {@code full} - * {@link DateFormat#getDateInstance(int,Locale) DateFormat.getDateInstance}{@code (}{@link DateFormat#FULL}{@code , getLocale())} + * {@link DateFormat#getDateInstance(int,Locale) + * DateFormat.getDateInstance}{@code (}{@link DateFormat#FULL}{@code , getLocale())} *
    SubformatPattern - * {@code new} {@link SimpleDateFormat#SimpleDateFormat(String,Locale) SimpleDateFormat}{@code (subformatPattern, getLocale())} + * {@code new} {@link SimpleDateFormat#SimpleDateFormat(String,Locale) + * SimpleDateFormat}{@code (subformatPattern, getLocale())} *
    {@code time} * (none) - * {@link DateFormat#getTimeInstance(int,Locale) DateFormat.getTimeInstance}{@code (}{@link DateFormat#DEFAULT}{@code , getLocale())} + * {@link DateFormat#getTimeInstance(int,Locale) + * DateFormat.getTimeInstance}{@code (}{@link DateFormat#DEFAULT}{@code , getLocale())} *
    {@code short} - * {@link DateFormat#getTimeInstance(int,Locale) DateFormat.getTimeInstance}{@code (}{@link DateFormat#SHORT}{@code , getLocale())} + * {@link DateFormat#getTimeInstance(int,Locale) + * DateFormat.getTimeInstance}{@code (}{@link DateFormat#SHORT}{@code , getLocale())} *
    {@code medium} - * {@link DateFormat#getTimeInstance(int,Locale) DateFormat.getTimeInstance}{@code (}{@link DateFormat#DEFAULT}{@code , getLocale())} + * {@link DateFormat#getTimeInstance(int,Locale) + * DateFormat.getTimeInstance}{@code (}{@link DateFormat#MEDIUM}{@code , getLocale())} *
    {@code long} - * {@link DateFormat#getTimeInstance(int,Locale) DateFormat.getTimeInstance}{@code (}{@link DateFormat#LONG}{@code , getLocale())} + * {@link DateFormat#getTimeInstance(int,Locale) + * DateFormat.getTimeInstance}{@code (}{@link DateFormat#LONG}{@code , getLocale())} *
    {@code full} - * {@link DateFormat#getTimeInstance(int,Locale) DateFormat.getTimeInstance}{@code (}{@link DateFormat#FULL}{@code , getLocale())} + * {@link DateFormat#getTimeInstance(int,Locale) + * DateFormat.getTimeInstance}{@code (}{@link DateFormat#FULL}{@code , getLocale())} *
    SubformatPattern - * {@code new} {@link SimpleDateFormat#SimpleDateFormat(String,Locale) SimpleDateFormat}{@code (subformatPattern, getLocale())} + * {@code new} {@link SimpleDateFormat#SimpleDateFormat(String,Locale) + * SimpleDateFormat}{@code (subformatPattern, getLocale())} *
    {@code choice} * SubformatPattern * {@code new} {@link ChoiceFormat#ChoiceFormat(String) ChoiceFormat}{@code (subformatPattern)} + *
    {@code list} + * (none) + * {@link ListFormat#getInstance(Locale, ListFormat.Type, ListFormat.Style) + * ListFormat.getInstance}{@code (getLocale()}, {@link ListFormat.Type#STANDARD}, {@link ListFormat.Style#FULL}) + *
    {@code or} + * {@link ListFormat#getInstance(Locale, ListFormat.Type, ListFormat.Style) + * ListFormat.getInstance}{@code (getLocale()}, {@link ListFormat.Type#OR}, {@link ListFormat.Style#FULL}) + *
    {@code unit} + * {@link ListFormat#getInstance(Locale, ListFormat.Type, ListFormat.Style) + * ListFormat.getInstance}{@code (getLocale()}, {@link ListFormat.Type#UNIT}, {@link ListFormat.Style#FULL}} *
    * - *

    Usage Information

    + *

    Quoting Rules in Patterns

    + * + *

    Within a String, a pair of single quotes can be used to + * quote any arbitrary characters except single quotes. For example, + * pattern string "'{0}'" represents string + * "{0}", not a FormatElement. A single quote itself + * must be represented by doubled single quotes {@code ''} throughout a + * String. For example, pattern string "'{''}'" is + * interpreted as a sequence of '{ (start of quoting and a + * left curly brace), {@code ''} (a single quote), and + * }' (a right curly brace and end of quoting), + * not '{' and '}' (quoted left and + * right curly braces): representing string "{'}", + * not "{}". + * + *

    A SubformatPattern is interpreted by its corresponding + * subformat, and subformat-dependent pattern rules apply. For example, + * pattern string "{1,number,$'#',##}" + * (SubformatPattern with underline) will produce a number format + * with the pound-sign quoted, with a result such as: {@code + * "$#31,45"}. Refer to each {@code Format} subclass documentation for + * details. + * + *

    Any unmatched quote is treated as closed at the end of the given + * pattern. For example, pattern string {@code "'{0}"} is treated as + * pattern {@code "'{0}'"}. + * + *

    Any curly braces within an unquoted pattern must be balanced. For + * example, "ab {0} de" and "ab '}' de" are + * valid patterns, but "ab {0'}' de", "ab } de" + * and "''{''" are not. + * + *

    Warning:
    The rules for using quotes within message + * format patterns unfortunately have shown to be somewhat confusing. + * In particular, it isn't always obvious to localizers whether single + * quotes need to be doubled or not. Make sure to inform localizers about + * the rules, and tell them (for example, by using comments in resource + * bundle source files) which strings will be processed by {@code MessageFormat}. + * Note that localizers may need to use single quotes in translated + * strings where the original version doesn't have them. + *
    + * + *

    Usage Information

    * *

    - * Here are some examples of usage. - * In real internationalized programs, the message format pattern and other - * static strings will, of course, be obtained from resource bundles. - * Other parameters will be dynamically determined at runtime. + * The following example demonstrates a general usage of {@code MessageFormat}. + * In internationalized programs, the message format pattern and other + * static strings will likely be obtained from resource bundles. + * *

    - * The first example uses the static method {@code MessageFormat.format}, - * which internally creates a {@code MessageFormat} for one-time use: * {@snippet lang=java : * int planet = 7; * String event = "a disturbance in the Force"; - * * String result = MessageFormat.format( * "At {1,time} on {1,date}, there was {2} on planet {0,number,integer}.", - * planet, new Date(), event); + * planet, new GregorianCalendar(2053, Calendar.JULY, 3, 12, 30).getTime(), event); * } - * The output is: - *

    - * At 12:30 PM on Jul 3, 2053, there was a disturbance in the Force on planet 7.
    - * 
    - * - *

    - * The following example creates a {@code MessageFormat} instance that - * can be used repeatedly: - * {@snippet lang=java : - * int fileCount = 1273; - * String diskName = "MyDisk"; - * Object[] testArgs = {Long.valueOf(fileCount), diskName}; * - * MessageFormat form = new MessageFormat( - * "The disk \"{1}\" contains {0} file(s)."); - * - * System.out.println(form.format(testArgs)); - * } - * The output with different values for {@code fileCount}: + * {@code result} returns the following: *

    - * The disk "MyDisk" contains 0 file(s).
    - * The disk "MyDisk" contains 1 file(s).
    - * The disk "MyDisk" contains 1,273 file(s).
    + * At 12:30:00 PM on Jul 3, 2053, there was a disturbance in the Force on planet 7.
      * 
    * *

    * For more sophisticated patterns, {@link ChoiceFormat} can be used with * {@code MessageFormat} to produce accurate forms for singular and plural: * {@snippet lang=java : - * MessageFormat msgFmt = new MessageFormat("The disk \"{0}\" contains {1}."); - * double[] fileLimits = {0,1,2}; - * String[] filePart = {"no files","one file","{1,number} files"}; - * ChoiceFormat fileChoices = new ChoiceFormat(fileLimits, filePart); - * msgFmt.setFormatByArgumentIndex(1, fileChoices); - * Object[] args = {"MyDisk", 1273}; - * System.out.println(msgFmt.format(args)); + * MessageFormat msgFmt = new MessageFormat("The disk \"{0}\" contains {1,choice,0#no files|1#one file|1< {1,number,integer} files}."); + * Object[] args = {"MyDisk", fileCount}; + * String result = msgFmt.format(args); * } - * The output with different values for {@code fileCount}: + * + * {@code result} with different values for {@code fileCount}, returns the following: *

      * The disk "MyDisk" contains no files.
      * The disk "MyDisk" contains one file.
    @@ -284,15 +403,6 @@
      * 
    * *

    - * You can create the {@code ChoiceFormat} programmatically, as in the - * above example, or by using a pattern. See {@link ChoiceFormat} - * for more information. - * {@snippet lang=java : - * msgFmt.applyPattern( - * "There {0,choice,0#are no files|1#is one file|1 * Notes: As seen in the previous snippet, * the string produced by a {@code ChoiceFormat} in {@code MessageFormat} is * treated as special; occurrences of '{' are used to indicate subformats, and @@ -304,6 +414,35 @@ * If you create both a {@code MessageFormat} and {@code ChoiceFormat} * programmatically (instead of using the string patterns), then be careful not to * produce a format that recurses on itself, which will cause an infinite loop. + * + *

    Formatting Date and Time

    + * + * MessageFormat provides patterns that support the date/time formatters in the + * {@link java.time.format} and {@link java.text} packages. Consider the following three examples, + * with a date of 11/16/2023: + * + *

    1) a date {@code FormatType} with a full {@code FormatStyle}, + * {@snippet lang=java : + * Object[] arg = {new GregorianCalendar(2023, Calendar.NOVEMBER, 16).getTime()}; + * var fmt = new MessageFormat("The date was {0,date,full}"); + * fmt.format(arg); // returns "The date was Thursday, November 16, 2023" + * } + * + *

    2) a dtf_date {@code FormatType} with a full {@code FormatStyle}, + * {@snippet lang=java : + * Object[] arg = {LocalDate.of(2023, 11, 16)}; + * var fmt = new MessageFormat("The date was {0,dtf_date,full}"); + * fmt.format(arg); // returns "The date was Thursday, November 16, 2023" + * } + * + *

    3) an ISO_LOCAL_DATE {@code FormatType}, + * {@snippet lang=java : + * Object[] arg = {LocalDate.of(2023, 11, 16)}; + * var fmt = new MessageFormat("The date was {0,ISO_LOCAL_DATE}"); + * fmt.format(arg); // returns "The date was 2023-11-16" + * } + * + *

    Parsing

    *

    * When a single argument is parsed more than once in the string, the last match * will be the final result of the parsing. For example, @@ -343,6 +482,7 @@ * @see ChoiceFormat * @see DateFormat * @see SimpleDateFormat + * @see DateTimeFormatter * * @author Mark Davis * @since 1.1 @@ -513,7 +653,7 @@ private void applyPatternImpl(String pattern) { if (braceStack == 0) { part = SEG_RAW; // Set the subformat - makeFormat(i, formatNumber, segments); + setFormatFromPattern(i, formatNumber, segments); formatNumber++; // throw away other segments segments[SEG_INDEX] = null; @@ -549,16 +689,18 @@ private void applyPatternImpl(String pattern) { /** - * Returns a pattern representing the current state of the message format. + * {@return a String pattern adhering to the {@link ##patterns patterns section} that + * represents the current state of this {@code MessageFormat}} + * * The string is constructed from internal information and therefore * does not necessarily equal the previously applied pattern. * * @implSpec The implementation in {@link MessageFormat} returns a * string that, when passed to a {@code MessageFormat()} constructor * or {@link #applyPattern applyPattern()}, produces an instance that - * is semantically equivalent to this instance. - * - * @return a pattern representing the current state of the message format + * is semantically equivalent to this instance. If a subformat cannot be + * converted to a String pattern, the {@code FormatType} and {@code FormatStyle} + * will be omitted from the {@code FormatElement}. */ public String toPattern() { // later, make this more extensible @@ -567,72 +709,77 @@ public String toPattern() { for (int i = 0; i <= maxOffset; ++i) { copyAndFixQuotes(pattern, lastOffset, offsets[i], result); lastOffset = offsets[i]; - result.append('{').append(argumentNumbers[i]); - Format fmt = formats[i]; - String subformatPattern = null; - if (fmt == null) { - // do nothing, string format - } else if (fmt instanceof NumberFormat) { - if (fmt.equals(NumberFormat.getInstance(locale))) { - result.append(",number"); - } else if (fmt.equals(NumberFormat.getCurrencyInstance(locale))) { - result.append(",number,currency"); - } else if (fmt.equals(NumberFormat.getPercentInstance(locale))) { - result.append(",number,percent"); - } else if (fmt.equals(NumberFormat.getIntegerInstance(locale))) { - result.append(",number,integer"); - } else { - if (fmt instanceof DecimalFormat dfmt) { - result.append(",number"); - subformatPattern = dfmt.toPattern(); - } else if (fmt instanceof ChoiceFormat cfmt) { - result.append(",choice"); - subformatPattern = cfmt.toPattern(); - } else { - // UNKNOWN - } - } - } else if (fmt instanceof DateFormat) { - int index; - for (index = MODIFIER_DEFAULT; index < DATE_TIME_MODIFIERS.length; index++) { - DateFormat df = DateFormat.getDateInstance(DATE_TIME_MODIFIERS[index], - locale); - if (fmt.equals(df)) { - result.append(",date"); - break; - } - df = DateFormat.getTimeInstance(DATE_TIME_MODIFIERS[index], - locale); - if (fmt.equals(df)) { - result.append(",time"); - break; - } + result.append('{') + .append(argumentNumbers[i]) + .append(patternFromFormat(formats[i])) + .append('}'); + } + copyAndFixQuotes(pattern, lastOffset, pattern.length(), result); + return result.toString(); + } + + /** + * This method converts a Format into a {@code FormatType} and {@code + * FormatStyle}, if applicable. For each Format, this method will + * first check against the pre-defined styles established in the + * {@link ##patterns patterns section}. Any "default"/"medium" styles + * are omitted according to the specification. + * If a Format does not match to a pre-defined style, it will provide the + * {@code SubformatPattern}, if the Format class can provide one. The + * following subformats do not provide a {@code SubformatPattern}: + * CompactNumberFormat, ListFormat, and DateTimeFormatter (ClassicFormat). + * + *

    In addition, since DateTimeFormatter and ClassicFormat do not implement {@code equals()}, + * there is not a means to compare {@code fmt} to a ClassicFormat for equality, + * and thus we don't have enough info to represent it as a pattern since there is no way to check + * if {@code fmt} is equal to some, (for example, "long" style) pre-defined ClassicFormat. + * Even if ClassicFormat implemented equals(), it is a wrapper class for + * DateTimeFormatter, which would require DTF to implement equals() as well to effectively + * compare the two ClassicFormats. + */ + private String patternFromFormat(Format fmt) { + if (fmt instanceof NumberFormat nFmt) { + // Check nFmt factory instances + String nStyle = NumberFormat.matchToStyle(nFmt, locale); + if (nStyle != null) { + return ",number" + (nStyle.isEmpty() ? nStyle : "," + nStyle); + } + // Check SubformatPattern + if (fmt instanceof DecimalFormat dFmt) { + // Quote eligible mFmt pattern characters: '{' and '}' + // Here, and in other subformatPattern instances + return ",number," + copyAndQuoteBraces(dFmt.toPattern()); + } else if (fmt instanceof ChoiceFormat cFmt) { + return ",choice," + copyAndQuoteBraces(cFmt.toPattern()); + } + } else if (fmt instanceof DateFormat) { + // Check dFmt factory instances + for (DateFormat.Style style : DateFormat.Style.values()) { + if (fmt.equals(DateFormat.getDateInstance(style.getValue(), locale))) { + return ",date" + ((style.getValue() != DateFormat.DEFAULT) + ? "," + style.name().toLowerCase(Locale.ROOT) : ""); } - if (index >= DATE_TIME_MODIFIERS.length) { - if (fmt instanceof SimpleDateFormat sdfmt) { - result.append(",date"); - subformatPattern = sdfmt.toPattern(); - } else { - // UNKNOWN - } - } else if (index != MODIFIER_DEFAULT) { - result.append(',').append(DATE_TIME_MODIFIER_KEYWORDS[index]); + if (fmt.equals(DateFormat.getTimeInstance(style.getValue(), locale))) { + return ",time" + ((style.getValue() != DateFormat.DEFAULT) + ? "," + style.name().toLowerCase(Locale.ROOT) : ""); } - } else { - //result.append(", unknown"); } - if (subformatPattern != null) { - result.append(','); - - // The subformat pattern comes already quoted, but only for those characters that are - // special to the subformat. Therefore, we may need to quote additional characters. - // The ones we care about at the MessageFormat level are '{' and '}'. - copyAndQuoteBraces(subformatPattern, result); + // Check SubformatPattern + if (fmt instanceof SimpleDateFormat sdFmt) { + return ",date," + copyAndQuoteBraces(sdFmt.toPattern()); + } + } else if (fmt instanceof ListFormat) { + // Check lFmt factory instances + for (ListFormat.Type type : ListFormat.Type.values()) { + if (fmt.equals(ListFormat.getInstance(locale, type, ListFormat.Style.FULL))) { + return ",list" + ((type != ListFormat.Type.STANDARD) + ? "," + type.name().toLowerCase(Locale.ROOT) : ""); + } } - result.append('}'); } - copyAndFixQuotes(pattern, lastOffset, pattern.length(), result); - return result.toString(); + // By here, this is an instanceof Format that is unknown to MessageFormat. + // Since it is unknown, nothing can be done. + return ""; } /** @@ -694,9 +841,8 @@ public void setFormats(Format[] newFormats) { if (runsToCopy > maxOffset + 1) { runsToCopy = maxOffset + 1; } - for (int i = 0; i < runsToCopy; i++) { - formats[i] = newFormats[i]; - } + if (runsToCopy >= 0) + System.arraycopy(newFormats, 0, formats, 0, runsToCopy); } /** @@ -1063,7 +1209,7 @@ public Object[] parse(String source, ParsePosition pos) { return null; // leave index as is to signal error } else { String strValue= source.substring(sourceOffset,next); - if (!strValue.equals("{"+argumentNumbers[i]+"}")) + if (!strValue.equals("{" + argumentNumbers[i] + "}")) resultArray[argumentNumbers[i]] = source.substring(sourceOffset,next); sourceOffset = next; @@ -1450,65 +1596,21 @@ private void append(StringBuffer result, CharacterIterator iterator) { } // Indices for segments - private static final int SEG_RAW = 0; - private static final int SEG_INDEX = 1; - private static final int SEG_TYPE = 2; - private static final int SEG_MODIFIER = 3; // modifier or subformat - - // Indices for type keywords - private static final int TYPE_NULL = 0; - private static final int TYPE_NUMBER = 1; - private static final int TYPE_DATE = 2; - private static final int TYPE_TIME = 3; - private static final int TYPE_CHOICE = 4; - - private static final String[] TYPE_KEYWORDS = { - "", - "number", - "date", - "time", - "choice" - }; - - // Indices for number modifiers - private static final int MODIFIER_DEFAULT = 0; // common in number and date-time - private static final int MODIFIER_CURRENCY = 1; - private static final int MODIFIER_PERCENT = 2; - private static final int MODIFIER_INTEGER = 3; - - private static final String[] NUMBER_MODIFIER_KEYWORDS = { - "", - "currency", - "percent", - "integer" - }; - - // Indices for date-time modifiers - private static final int MODIFIER_SHORT = 1; - private static final int MODIFIER_MEDIUM = 2; - private static final int MODIFIER_LONG = 3; - private static final int MODIFIER_FULL = 4; - - private static final String[] DATE_TIME_MODIFIER_KEYWORDS = { - "", - "short", - "medium", - "long", - "full" - }; - - // Date-time style values corresponding to the date-time modifiers. - private static final int[] DATE_TIME_MODIFIERS = { - DateFormat.DEFAULT, - DateFormat.SHORT, - DateFormat.MEDIUM, - DateFormat.LONG, - DateFormat.FULL, - }; - - private void makeFormat(int position, int offsetNumber, - StringBuilder[] textSegments) - { + private static final int SEG_RAW = 0; // String in MessageFormatPattern + private static final int SEG_INDEX = 1; // ArgumentIndex + private static final int SEG_TYPE = 2; // FormatType + private static final int SEG_MODIFIER = 3; // FormatStyle + + /** + * This method sets a Format in the {@code formats} array for the + * corresponding {@code argumentNumber} based on the pattern supplied. + * If the pattern supplied does not contain a {@code FormatType}, null + * is stored in the {@code formats} array. + */ + private void setFormatFromPattern(int position, int offsetNumber, + StringBuilder[] textSegments) { + + // Convert any null values in textSegments to empty string String[] segments = new String[textSegments.length]; for (int i = 0; i < textSegments.length; i++) { StringBuilder oneseg = textSegments[i]; @@ -1541,104 +1643,205 @@ private void makeFormat(int position, int offsetNumber, offsets = newOffsets; argumentNumbers = newArgumentNumbers; } + int oldMaxOffset = maxOffset; maxOffset = offsetNumber; offsets[offsetNumber] = segments[SEG_RAW].length(); argumentNumbers[offsetNumber] = argumentNumber; - // now get the format - Format newFormat = null; + // Only search for corresponding type/style if type is not empty if (!segments[SEG_TYPE].isEmpty()) { - int type = findKeyword(segments[SEG_TYPE], TYPE_KEYWORDS); - switch (type) { - case TYPE_NULL: - // Type "" is allowed. e.g., "{0,}", "{0,,}", and "{0,,#}" - // are treated as "{0}". - break; - - case TYPE_NUMBER: - switch (findKeyword(segments[SEG_MODIFIER], NUMBER_MODIFIER_KEYWORDS)) { - case MODIFIER_DEFAULT: - newFormat = NumberFormat.getInstance(locale); - break; - case MODIFIER_CURRENCY: - newFormat = NumberFormat.getCurrencyInstance(locale); - break; - case MODIFIER_PERCENT: - newFormat = NumberFormat.getPercentInstance(locale); - break; - case MODIFIER_INTEGER: - newFormat = NumberFormat.getIntegerInstance(locale); - break; - default: // DecimalFormat pattern - try { - newFormat = new DecimalFormat(segments[SEG_MODIFIER], - DecimalFormatSymbols.getInstance(locale)); - } catch (IllegalArgumentException e) { - maxOffset = oldMaxOffset; - throw e; - } - break; - } - break; - - case TYPE_DATE: - case TYPE_TIME: - int mod = findKeyword(segments[SEG_MODIFIER], DATE_TIME_MODIFIER_KEYWORDS); - if (mod >= 0 && mod < DATE_TIME_MODIFIER_KEYWORDS.length) { - if (type == TYPE_DATE) { - newFormat = DateFormat.getDateInstance(DATE_TIME_MODIFIERS[mod], - locale); - } else { - newFormat = DateFormat.getTimeInstance(DATE_TIME_MODIFIERS[mod], - locale); - } - } else { - // SimpleDateFormat pattern - try { - newFormat = new SimpleDateFormat(segments[SEG_MODIFIER], locale); - } catch (IllegalArgumentException e) { - maxOffset = oldMaxOffset; - throw e; - } - } - break; - - case TYPE_CHOICE: - try { - // ChoiceFormat pattern - newFormat = new ChoiceFormat(segments[SEG_MODIFIER]); - } catch (Exception e) { - maxOffset = oldMaxOffset; - throw new IllegalArgumentException("Choice Pattern incorrect: " - + segments[SEG_MODIFIER], e); - } - break; - - default: + try { + formats[offsetNumber] = formatFromPattern(segments[SEG_TYPE], segments[SEG_MODIFIER]); + } catch (Exception e) { + // Catch to reset maxOffset maxOffset = oldMaxOffset; - throw new IllegalArgumentException("unknown format type: " + - segments[SEG_TYPE]); + throw e; } + } else { + // Type "" is allowed. e.g., "{0,}", "{0,,}", and "{0,,#}" + // are treated as "{0}". + formats[offsetNumber] = null; } - formats[offsetNumber] = newFormat; } - private static int findKeyword(String s, String[] list) { - for (int i = 0; i < list.length; ++i) { - if (s.equals(list[i])) - return i; + /** + * This method converts a {@code FormatType} and {@code FormatStyle} to a + * {@code Format} value. The String parameters are converted + * to their corresponding enum values FormatType and FormatStyle which are used + * to return a {@code Format}. See the patterns section in the class + * description for further detail on a MessageFormat pattern. + * + * @param type the {@code FormatType} in {@code FormatElement} + * @param style the {@code FormatStyle} in {@code FormatElement} + * @return a Format that corresponds to the corresponding {@code formatType} + * and {@code formatStyle} + * @throws IllegalArgumentException if a Format cannot be produced from the + * type and style provided + */ + private Format formatFromPattern(String type, String style) { + // Get the type, if it's valid + FormatType fType; + try { + fType = FormatType.valueOf(type.trim().toUpperCase(Locale.ROOT)); + } catch (IllegalArgumentException iae) { + // Invalid type throws exception + throw new IllegalArgumentException("unknown format type: " + type); + } + // Get the style if recognized, otherwise treat style as a SubformatPattern + FormatStyle fStyle; + try { + fStyle = FormatStyle.fromString(style); + } catch (IllegalArgumentException iae) { + fStyle = FormatStyle.SUBFORMATPATTERN; } + return switch (fType) { + case NUMBER -> switch (fStyle) { + case DEFAULT -> NumberFormat.getInstance(locale); + case CURRENCY -> + NumberFormat.getCurrencyInstance(locale); + case PERCENT -> + NumberFormat.getPercentInstance(locale); + case INTEGER -> + NumberFormat.getIntegerInstance(locale); + case COMPACT_SHORT -> + NumberFormat.getCompactNumberInstance(locale, NumberFormat.Style.SHORT); + case COMPACT_LONG -> + NumberFormat.getCompactNumberInstance(locale, NumberFormat.Style.LONG); + default -> formatFromSubformatPattern(fType, style); + }; + case DATE -> switch (fStyle) { + case DEFAULT -> + DateFormat.getDateInstance(DateFormat.DEFAULT, locale); + case SHORT -> + DateFormat.getDateInstance(DateFormat.SHORT, locale); + case MEDIUM -> + DateFormat.getDateInstance(DateFormat.MEDIUM, locale); + case LONG -> + DateFormat.getDateInstance(DateFormat.LONG, locale); + case FULL -> + DateFormat.getDateInstance(DateFormat.FULL, locale); + default -> formatFromSubformatPattern(fType, style); + }; + case TIME -> switch (fStyle) { + case DEFAULT -> + DateFormat.getTimeInstance(DateFormat.DEFAULT, locale); + case SHORT -> + DateFormat.getTimeInstance(DateFormat.SHORT, locale); + case MEDIUM -> + DateFormat.getTimeInstance(DateFormat.MEDIUM, locale); + case LONG -> + DateFormat.getTimeInstance(DateFormat.LONG, locale); + case FULL -> + DateFormat.getTimeInstance(DateFormat.FULL, locale); + default -> formatFromSubformatPattern(fType, style); + }; + case DTF_DATE -> switch (fStyle) { + case DEFAULT, MEDIUM -> + DateTimeFormatter.ofLocalizedDate(java.time.format.FormatStyle.MEDIUM).withLocale(locale).toFormat(); + case SHORT -> + DateTimeFormatter.ofLocalizedDate(java.time.format.FormatStyle.SHORT).withLocale(locale).toFormat(); + case LONG -> + DateTimeFormatter.ofLocalizedDate(java.time.format.FormatStyle.LONG).withLocale(locale).toFormat(); + case FULL -> + DateTimeFormatter.ofLocalizedDate(java.time.format.FormatStyle.FULL).withLocale(locale).toFormat(); + default -> formatFromSubformatPattern(fType, style); + }; + case DTF_TIME -> switch (fStyle) { + case DEFAULT, MEDIUM -> + DateTimeFormatter.ofLocalizedTime(java.time.format.FormatStyle.MEDIUM).withLocale(locale).toFormat(); + case SHORT -> + DateTimeFormatter.ofLocalizedTime(java.time.format.FormatStyle.SHORT).withLocale(locale).toFormat(); + case LONG -> + DateTimeFormatter.ofLocalizedTime(java.time.format.FormatStyle.LONG).withLocale(locale).toFormat(); + case FULL -> + DateTimeFormatter.ofLocalizedTime(java.time.format.FormatStyle.FULL).withLocale(locale).toFormat(); + default -> formatFromSubformatPattern(fType, style); + }; + case DTF_DATETIME -> switch (fStyle) { + case DEFAULT, MEDIUM -> + DateTimeFormatter.ofLocalizedDateTime(java.time.format.FormatStyle.MEDIUM).withLocale(locale).toFormat(); + case SHORT -> + DateTimeFormatter.ofLocalizedDateTime(java.time.format.FormatStyle.SHORT).withLocale(locale).toFormat(); + case LONG -> + DateTimeFormatter.ofLocalizedDateTime(java.time.format.FormatStyle.LONG).withLocale(locale).toFormat(); + case FULL -> + DateTimeFormatter.ofLocalizedDateTime(java.time.format.FormatStyle.FULL).withLocale(locale).toFormat(); + default -> formatFromSubformatPattern(fType, style); + }; + case CHOICE -> formatFromSubformatPattern(fType, style); + case LIST -> switch (fStyle) { + case DEFAULT -> + ListFormat.getInstance(locale, ListFormat.Type.STANDARD, ListFormat.Style.FULL); + case OR -> + ListFormat.getInstance(locale, ListFormat.Type.OR, ListFormat.Style.FULL); + case UNIT -> + ListFormat.getInstance(locale, ListFormat.Type.UNIT, ListFormat.Style.FULL); + // ListFormat does not provide a String pattern method/constructor + default -> formatFromSubformatPattern(fType, style); + }; + // The DateTimeFormatter constants are only given as a type + // Regardless of style, return the corresponding DTF constant + case BASIC_ISO_DATE -> DateTimeFormatter.BASIC_ISO_DATE.toFormat(); + case ISO_LOCAL_DATE -> DateTimeFormatter.ISO_LOCAL_DATE.toFormat(); + case ISO_OFFSET_DATE -> DateTimeFormatter.ISO_OFFSET_DATE.toFormat(); + case ISO_DATE -> DateTimeFormatter.ISO_DATE.toFormat(); + case ISO_LOCAL_TIME -> DateTimeFormatter.ISO_LOCAL_TIME.toFormat(); + case ISO_OFFSET_TIME -> DateTimeFormatter.ISO_OFFSET_TIME.toFormat(); + case ISO_TIME -> DateTimeFormatter.ISO_TIME.toFormat(); + case ISO_LOCAL_DATE_TIME -> DateTimeFormatter.ISO_LOCAL_DATE_TIME.toFormat(); + case ISO_OFFSET_DATE_TIME -> DateTimeFormatter.ISO_OFFSET_DATE_TIME.toFormat(); + case ISO_ZONED_DATE_TIME -> DateTimeFormatter.ISO_ZONED_DATE_TIME.toFormat(); + case ISO_DATE_TIME -> DateTimeFormatter.ISO_DATE_TIME.toFormat(); + case ISO_ORDINAL_DATE -> DateTimeFormatter.ISO_ORDINAL_DATE.toFormat(); + case ISO_WEEK_DATE -> DateTimeFormatter.ISO_WEEK_DATE.toFormat(); + case ISO_INSTANT -> DateTimeFormatter.ISO_INSTANT.toFormat(); + case RFC_1123_DATE_TIME -> DateTimeFormatter.RFC_1123_DATE_TIME.toFormat(); + }; + } - // Try trimmed lowercase. - String ls = s.trim().toLowerCase(Locale.ROOT); - if (ls != s) { - for (int i = 0; i < list.length; ++i) { - if (ls.equals(list[i])) - return i; + /** + * This method will attempt to return a subformat produced with the provided + * SubformatPattern applied. If the subformat does not support SubformatPatterns + * or the SubformatPattern is illegal to the subformat, an IllegalArgumentException + * is thrown. To adhere to the specification, this method ensures if an underlying + * exception is thrown, it is rethrown as an IllegalArgumentException unless + * the underlying exception is itself an IAE, or an NPE. + * + * @param fType the enum type of the subformat + * @param pattern the SubformatPattern to be applied + * @return a Format that corresponds to the corresponding {@code fType} + * and {@code pattern} + * @throws IllegalArgumentException if a Format cannot be produced from the + * type and SubformatPattern provided + */ + private Format formatFromSubformatPattern(FormatType fType, String pattern) { + // Modified for neater exception value if needed + String type = fType.name().charAt(0) + fType.name().substring(1).toLowerCase(Locale.ROOT); + try { + return switch (fType) { + case NUMBER -> new DecimalFormat(pattern, DecimalFormatSymbols.getInstance(locale)); + case DATE, TIME -> new SimpleDateFormat(pattern, locale); + case DTF_DATE, DTF_TIME, DTF_DATETIME -> + DateTimeFormatter.ofPattern(pattern).toFormat(); + case CHOICE -> new ChoiceFormat(pattern); + // These classe(s) do not support String patterns + default -> throw new IllegalArgumentException(String.format( + "Unexpected modifier for %s: %s", type, pattern)); + }; + } catch (Exception e) { + // getClass check over separate catch block to not catch the IAE subclasses + // For example, ChoiceFormat can throw a NumberFormatException + if (e.getClass() == IllegalArgumentException.class + || e.getClass() == NullPointerException.class) { + // If IAE no need to wrap with another IAE + // If NPE, it should be thrown as is (as specified) + throw e; + } else { + throw new IllegalArgumentException(String.format( + "%s pattern incorrect: %s", type, pattern), e); } } - return -1; } private static void copyAndFixQuotes(String source, int start, int end, @@ -1668,14 +1871,17 @@ private static void copyAndFixQuotes(String source, int start, int end, } } - // Copy the text, but add quotes around any quotables that aren't already quoted - private static void copyAndQuoteBraces(String source, StringBuilder target) { + // The subformat pattern comes already quoted, but only for those characters that are + // special to the subformat. Therefore, we may need to quote additional characters. + // The ones we care about at the MessageFormat level are '{' and '}'. + private static String copyAndQuoteBraces(String source) { // Analyze existing string for already quoted and newly quotable characters record Qchar(char ch, boolean quoted) { }; ArrayList qchars = new ArrayList<>(); boolean quoted = false; boolean anyChangeNeeded = false; + StringBuilder quotedSource = new StringBuilder(); for (int i = 0; i < source.length(); i++) { char ch = source.charAt(i); if (ch == '\'') { @@ -1694,8 +1900,7 @@ record Qchar(char ch, boolean quoted) { }; // Was any change needed? if (!anyChangeNeeded) { - target.append(source); - return; + return source; } // Build new string, automatically consolidating adjacent runs of quoted chars @@ -1703,15 +1908,85 @@ record Qchar(char ch, boolean quoted) { }; for (Qchar qchar : qchars) { char ch = qchar.ch; if (ch == '\'') { - target.append(ch); // doubling works whether quoted or not + quotedSource.append(ch); // doubling works whether quoted or not } else if (qchar.quoted() != quoted) { - target.append('\''); + quotedSource.append('\''); quoted = qchar.quoted(); } - target.append(ch); + quotedSource.append(ch); } if (quoted) { - target.append('\''); + quotedSource.append('\''); + } + + return quotedSource.toString(); + } + + // Corresponding to the FormatType pattern + private enum FormatType { + NUMBER, + DATE, + TIME, + DTF_DATE, + DTF_TIME, + DTF_DATETIME, + CHOICE, + LIST, + + // Pre-defined DateTimeFormatter types + BASIC_ISO_DATE, + ISO_LOCAL_DATE, + ISO_OFFSET_DATE , + ISO_DATE, + ISO_LOCAL_TIME, + ISO_OFFSET_TIME, + ISO_TIME, + ISO_LOCAL_DATE_TIME, + ISO_OFFSET_DATE_TIME, + ISO_ZONED_DATE_TIME, + ISO_DATE_TIME, + ISO_ORDINAL_DATE, + ISO_WEEK_DATE, + ISO_INSTANT, + RFC_1123_DATE_TIME; + } + + // Corresponding to the FormatStyle pattern + private enum FormatStyle { + DEFAULT(""), + SHORT("short"), + MEDIUM("medium"), + LONG("long"), + FULL("full"), + INTEGER("integer"), + CURRENCY("currency"), + PERCENT("percent"), + COMPACT_SHORT("compact_short"), + COMPACT_LONG("compact_long"), + OR("or"), + UNIT("unit"), + SUBFORMATPATTERN(null); + + private final String text; + + // Differs from FormatType in that the text String is + // not guaranteed to match the Enum name, thus a text field is used + FormatStyle(String text) { + this.text = text; + } + + // This method returns a FormatStyle (excluding SUBFORMATPATTERN) + // that matches the passed String. If no FormatStyle is found, + // an IllegalArgumentException is thrown + private static FormatStyle fromString(String text) { + for (FormatStyle style : values()) { + // Also check trimmed case-insensitive for historical reasons + if (style != FormatStyle.SUBFORMATPATTERN && + text.trim().compareToIgnoreCase(style.text) == 0) { + return style; + } + } + throw new IllegalArgumentException(); } } diff --git a/src/java.base/share/classes/java/text/NumberFormat.java b/src/java.base/share/classes/java/text/NumberFormat.java index 2f448950bea..716cfb710c4 100644 --- a/src/java.base/share/classes/java/text/NumberFormat.java +++ b/src/java.base/share/classes/java/text/NumberFormat.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -677,6 +677,33 @@ public static NumberFormat getCompactNumberInstance(Locale locale, return getInstance(locale, formatStyle, COMPACTSTYLE); } + /** + * This method compares the passed NumberFormat to a number of pre-defined + * style NumberFormat instances, (created with the passed locale). Returns a + * matching FormatStyle string if found, otherwise null. + * This method is used by MessageFormat to provide string pattens for NumberFormat + * Subformats. Any future pre-defined NumberFormat styles should be added to this method. + */ + static String matchToStyle(NumberFormat fmt, Locale locale) { + if (fmt.equals(NumberFormat.getInstance(locale))) { + return ""; + } else if (fmt.equals(NumberFormat.getCurrencyInstance(locale))) { + return "currency"; + } else if (fmt.equals(NumberFormat.getPercentInstance(locale))) { + return "percent"; + } else if (fmt.equals(NumberFormat.getIntegerInstance(locale))) { + return "integer"; + } else if (fmt.equals(NumberFormat.getCompactNumberInstance(locale, + NumberFormat.Style.SHORT))) { + return "compact_short"; + } else if (fmt.equals(NumberFormat.getCompactNumberInstance(locale, + NumberFormat.Style.LONG))) { + return "compact_long"; + } else { + return null; + } + } + /** * Returns an array of all locales for which the * {@code get*Instance} methods of this class can return diff --git a/src/java.base/share/classes/java/util/ImmutableCollections.java b/src/java.base/share/classes/java/util/ImmutableCollections.java index 398ebb14a54..525cdf15ecd 100644 --- a/src/java.base/share/classes/java/util/ImmutableCollections.java +++ b/src/java.base/share/classes/java/util/ImmutableCollections.java @@ -161,7 +161,7 @@ abstract static class AbstractImmutableCollection extends AbstractCollection< * Null argument or null elements in the argument will result in NPE. * * @param the List's element type - * @param input the input array + * @param coll the input collection * @return the new list */ @SuppressWarnings("unchecked") diff --git a/src/java.base/share/classes/java/util/concurrent/locks/AbstractQueuedLongSynchronizer.java b/src/java.base/share/classes/java/util/concurrent/locks/AbstractQueuedLongSynchronizer.java index c7631dc76cc..f4d7d0c08c0 100644 --- a/src/java.base/share/classes/java/util/concurrent/locks/AbstractQueuedLongSynchronizer.java +++ b/src/java.base/share/classes/java/util/concurrent/locks/AbstractQueuedLongSynchronizer.java @@ -1127,13 +1127,18 @@ public ConditionObject() { } private void doSignal(ConditionNode first, boolean all) { while (first != null) { ConditionNode next = first.nextWaiter; + if ((firstWaiter = next) == null) lastWaiter = null; + else + first.nextWaiter = null; // GC assistance + if ((first.getAndUnsetStatus(COND) & COND) != 0) { enqueue(first); if (!all) break; } + first = next; } } diff --git a/src/java.base/share/classes/java/util/concurrent/locks/AbstractQueuedSynchronizer.java b/src/java.base/share/classes/java/util/concurrent/locks/AbstractQueuedSynchronizer.java index 36d21d3fcfc..1f51419f94c 100644 --- a/src/java.base/share/classes/java/util/concurrent/locks/AbstractQueuedSynchronizer.java +++ b/src/java.base/share/classes/java/util/concurrent/locks/AbstractQueuedSynchronizer.java @@ -1506,13 +1506,18 @@ public ConditionObject() { } private void doSignal(ConditionNode first, boolean all) { while (first != null) { ConditionNode next = first.nextWaiter; + if ((firstWaiter = next) == null) lastWaiter = null; + else + first.nextWaiter = null; // GC assistance + if ((first.getAndUnsetStatus(COND) & COND) != 0) { enqueue(first); if (!all) break; } + first = next; } } diff --git a/src/java.base/share/classes/java/util/jar/JarFile.java b/src/java.base/share/classes/java/util/jar/JarFile.java index ca8c726129e..77dfed3b84f 100644 --- a/src/java.base/share/classes/java/util/jar/JarFile.java +++ b/src/java.base/share/classes/java/util/jar/JarFile.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -826,7 +826,7 @@ private byte[] getBytes(ZipEntry ze) throws IOException { /** * Returns an input stream for reading the contents of the specified - * zip file entry. + * ZIP file entry. * * @apiNote The {@code InputStream} returned by this method can wrap an * {@link java.util.zip.InflaterInputStream InflaterInputStream}, whose @@ -834,11 +834,11 @@ private byte[] getBytes(ZipEntry ze) throws IOException { * read(byte[], int, int)} method can modify any element of the output * buffer. * - * @param ze the zip file entry + * @param ze the ZIP file entry * @return an input stream for reading the contents of the specified - * zip file entry or null if the zip file entry does not exist + * ZIP file entry or null if the ZIP file entry does not exist * within the jar file - * @throws ZipException if a zip file format error has occurred + * @throws ZipException if a ZIP file format error has occurred * @throws IOException if an I/O error has occurred * @throws SecurityException if any of the jar file entries * are incorrectly signed. diff --git a/src/java.base/share/classes/java/util/zip/GZIPOutputStream.java b/src/java.base/share/classes/java/util/zip/GZIPOutputStream.java index d3880c2f4d7..cea0880fca6 100644 --- a/src/java.base/share/classes/java/util/zip/GZIPOutputStream.java +++ b/src/java.base/share/classes/java/util/zip/GZIPOutputStream.java @@ -212,7 +212,9 @@ private void writeHeader() throws IOException { */ private void writeTrailer(byte[] buf, int offset) throws IOException { writeInt((int)crc.getValue(), buf, offset); // CRC-32 of uncompr. data - writeInt(def.getTotalIn(), buf, offset + 4); // Number of uncompr. bytes + // RFC 1952: Size of the original (uncompressed) input data modulo 2^32 + int iSize = (int) def.getBytesRead(); + writeInt(iSize, buf, offset + 4); } /* diff --git a/src/java.base/share/classes/java/util/zip/ZipCoder.java b/src/java.base/share/classes/java/util/zip/ZipCoder.java index 8696d2a797e..6eb97308832 100644 --- a/src/java.base/share/classes/java/util/zip/ZipCoder.java +++ b/src/java.base/share/classes/java/util/zip/ZipCoder.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -38,7 +38,7 @@ import sun.nio.cs.UTF_8; /** - * Utility class for zipfile name and comment decoding and encoding + * Utility class for ZIP file entry name and comment decoding and encoding */ class ZipCoder { diff --git a/src/java.base/share/classes/java/util/zip/ZipConstants.java b/src/java.base/share/classes/java/util/zip/ZipConstants.java index 9eac888abc9..b3f07f901ab 100644 --- a/src/java.base/share/classes/java/util/zip/ZipConstants.java +++ b/src/java.base/share/classes/java/util/zip/ZipConstants.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1995, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1995, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -230,7 +230,7 @@ interface ZipConstants { static final int ENDOFF = 16; /** - * End of central directory (END) header zip file comment length field offset. + * End of central directory (END) header ZIP file comment length field offset. */ static final int ENDCOM = 20; } diff --git a/src/java.base/share/classes/java/util/zip/ZipEntry.java b/src/java.base/share/classes/java/util/zip/ZipEntry.java index 7a09836fa83..85bd6155fa8 100644 --- a/src/java.base/share/classes/java/util/zip/ZipEntry.java +++ b/src/java.base/share/classes/java/util/zip/ZipEntry.java @@ -93,7 +93,7 @@ public class ZipEntry implements ZipConstants, Cloneable { 128L * 365 * 24 * 60 * 60 * 1000; /** - * Creates a new zip entry with the specified name. + * Creates a new ZIP entry with the specified name. * * @param name * The entry name @@ -111,11 +111,11 @@ public ZipEntry(String name) { } /** - * Creates a new zip entry with fields taken from the specified - * zip entry. + * Creates a new ZIP entry with fields taken from the specified + * ZIP entry. * * @param e - * A zip Entry object + * A ZIP Entry object * * @throws NullPointerException if the entry object is null */ @@ -150,7 +150,7 @@ public String getName() { * *

    If the entry is output to a ZIP file or ZIP file formatted * output stream the last modification time set by this method will - * be stored into the {@code date and time fields} of the zip file + * be stored into the {@code date and time fields} of the ZIP file * entry and encoded in standard {@code MS-DOS date and time format}. * The {@link java.util.TimeZone#getDefault() default TimeZone} is * used to convert the epoch time to the MS-DOS date and time. @@ -183,7 +183,7 @@ public void setTime(long time) { * *

    If the entry is read from a ZIP file or ZIP file formatted * input stream, this is the last modification time from the {@code - * date and time fields} of the zip file entry. The + * date and time fields} of the ZIP file entry. The * {@link java.util.TimeZone#getDefault() default TimeZone} is used * to convert the standard MS-DOS formatted date and time to the * epoch time. @@ -206,11 +206,11 @@ public long getTime() { * *

    If the entry is output to a ZIP file or ZIP file formatted * output stream the last modification time set by this method will - * be stored into the {@code date and time fields} of the zip file + * be stored into the {@code date and time fields} of the ZIP file * entry and encoded in standard {@code MS-DOS date and time format}. * If the date-time set is out of the range of the standard {@code * MS-DOS date and time format}, the time will also be stored into - * zip file entry's extended timestamp fields in {@code optional + * ZIP file entry's extended timestamp fields in {@code optional * extra data} in UTC time. The {@link java.time.ZoneId#systemDefault() * system default TimeZone} is used to convert the local date-time * to UTC time. @@ -285,13 +285,13 @@ public LocalDateTime getTimeLocal() { * *

    When output to a ZIP file or ZIP file formatted output stream * the last modification time set by this method will be stored into - * zip file entry's {@code date and time fields} in {@code standard + * ZIP file entry's {@code date and time fields} in {@code standard * MS-DOS date and time format}), and the extended timestamp fields * in {@code optional extra data} in UTC time. * * @param time * The last modification time of the entry - * @return This zip entry + * @return This ZIP entry * * @throws NullPointerException if the {@code time} is null * @@ -337,7 +337,7 @@ public FileTime getLastModifiedTime() { * * @param time * The last access time of the entry - * @return This zip entry + * @return This ZIP entry * * @throws NullPointerException if the {@code time} is null * @@ -373,7 +373,7 @@ public FileTime getLastAccessTime() { * * @param time * The creation time of the entry - * @return This zip entry + * @return This ZIP entry * * @throws NullPointerException if the {@code time} is null * diff --git a/src/java.base/share/classes/java/util/zip/ZipException.java b/src/java.base/share/classes/java/util/zip/ZipException.java index 45048a4254b..8c4f96ccbb7 100644 --- a/src/java.base/share/classes/java/util/zip/ZipException.java +++ b/src/java.base/share/classes/java/util/zip/ZipException.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1995, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1995, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,7 +28,7 @@ import java.io.IOException; /** - * Signals that a Zip exception of some sort has occurred. + * Signals that a ZIP exception of some sort has occurred. * * @see java.io.IOException * @since 1.1 diff --git a/src/java.base/share/classes/java/util/zip/ZipFile.java b/src/java.base/share/classes/java/util/zip/ZipFile.java index 7064d4bf868..4f4c410a83e 100644 --- a/src/java.base/share/classes/java/util/zip/ZipFile.java +++ b/src/java.base/share/classes/java/util/zip/ZipFile.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1995, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1995, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -76,7 +76,7 @@ import static java.util.zip.ZipUtils.*; /** - * This class is used to read entries from a zip file. + * This class is used to read entries from a ZIP file. * *

    Unless otherwise noted, passing a {@code null} argument to a constructor * or method in this class will cause a {@link NullPointerException} to be @@ -95,27 +95,27 @@ */ public class ZipFile implements ZipConstants, Closeable { - private final String filePath; // zip file path + private final String filePath; // ZIP file path private final String fileName; // name of the file private volatile boolean closeRequested; - // The "resource" used by this zip file that needs to be + // The "resource" used by this ZIP file that needs to be // cleaned after use. // a) the input streams that need to be closed // b) the list of cached Inflater objects - // c) the "native" source of this zip file. + // c) the "native" source of this ZIP file. private final @Stable CleanableResource res; private static final int STORED = ZipEntry.STORED; private static final int DEFLATED = ZipEntry.DEFLATED; /** - * Mode flag to open a zip file for reading. + * Mode flag to open a ZIP file for reading. */ public static final int OPEN_READ = 0x1; /** - * Mode flag to open a zip file and mark it for deletion. The file will be + * Mode flag to open a ZIP file and mark it for deletion. The file will be * deleted some time between the moment that it is opened and the moment * that it is closed, but its contents will remain accessible via the * {@code ZipFile} object until either the close method is invoked or the @@ -131,7 +131,7 @@ public class ZipFile implements ZipConstants, Closeable { getDisableZip64ExtraFieldValidation(); /** - * Opens a zip file for reading. + * Opens a ZIP file for reading. * *

    First, if there is a security manager, its {@code checkRead} * method is called with the {@code name} argument as its argument @@ -140,7 +140,7 @@ public class ZipFile implements ZipConstants, Closeable { *

    The UTF-8 {@link java.nio.charset.Charset charset} is used to * decode the entry names and comments. * - * @param name the name of the zip file + * @param name the name of the ZIP file * @throws ZipException if a ZIP format error has occurred * @throws IOException if an I/O error has occurred * @throws SecurityException if a security manager exists and its @@ -258,13 +258,13 @@ public ZipFile(File file, int mode, Charset charset) throws IOException } /** - * Opens a zip file for reading. + * Opens a ZIP file for reading. * *

    First, if there is a security manager, its {@code checkRead} * method is called with the {@code name} argument as its argument * to ensure the read is allowed. * - * @param name the name of the zip file + * @param name the name of the ZIP file * @param charset * the {@linkplain java.nio.charset.Charset charset} to * be used to decode the ZIP entry name and comment that are not @@ -308,11 +308,13 @@ public ZipFile(File file, Charset charset) throws IOException } /** - * Returns the zip file comment, or null if none. + * Returns the ZIP file comment. If a comment does not exist or an error is + * encountered decoding the comment using the charset specified + * when opening the ZIP file, then {@code null} is returned. * - * @return the comment string for the zip file, or null if none + * @return the comment string for the ZIP file, or null if none * - * @throws IllegalStateException if the zip file has been closed + * @throws IllegalStateException if the ZIP file has been closed * * @since 1.7 */ @@ -322,17 +324,23 @@ public String getComment() { if (res.zsrc.comment == null) { return null; } - return res.zsrc.zc.toString(res.zsrc.comment); + // If there is a problem decoding the byte array which represents + // the ZIP file comment, return null; + try { + return res.zsrc.zc.toString(res.zsrc.comment); + } catch (IllegalArgumentException iae) { + return null; + } } } /** - * Returns the zip file entry for the specified name, or null + * Returns the ZIP file entry for the specified name, or null * if not found. * * @param name the name of the entry - * @return the zip file entry, or null if not found - * @throws IllegalStateException if the zip file has been closed + * @return the ZIP file entry, or null if not found + * @throws IllegalStateException if the ZIP file has been closed */ public ZipEntry getEntry(String name) { Objects.requireNonNull(name, "name"); @@ -349,7 +357,7 @@ public ZipEntry getEntry(String name) { /** * Returns an input stream for reading the contents of the specified - * zip file entry. + * ZIP file entry. *

    * Closing this ZIP file will, in turn, close all input streams that * have been returned by invocations of this method. @@ -360,13 +368,13 @@ public ZipEntry getEntry(String name) { * read(byte[], int, int)} method can modify any element of the output * buffer. * - * @param entry the zip file entry + * @param entry the ZIP file entry * @return the input stream for reading the contents of the specified - * zip file entry or null if the zip file entry does not exist - * within the zip file. + * ZIP file entry or null if the ZIP file entry does not exist + * within the ZIP file. * @throws ZipException if a ZIP format error has occurred * @throws IOException if an I/O error has occurred - * @throws IllegalStateException if the zip file has been closed + * @throws IllegalStateException if the ZIP file has been closed */ public InputStream getInputStream(ZipEntry entry) throws IOException { Objects.requireNonNull(entry, "entry"); @@ -545,7 +553,7 @@ public Iterator asIterator() { /** * Returns an enumeration of the ZIP file entries. * @return an enumeration of the ZIP file entries - * @throws IllegalStateException if the zip file has been closed + * @throws IllegalStateException if the ZIP file has been closed */ public Enumeration entries() { synchronized (this) { @@ -597,7 +605,7 @@ public boolean tryAdvance(Consumer action) { * the central directory of the ZIP file. * * @return an ordered {@code Stream} of entries in this ZIP file - * @throws IllegalStateException if the zip file has been closed + * @throws IllegalStateException if the ZIP file has been closed * @since 1.8 */ public Stream stream() { @@ -616,13 +624,13 @@ private String getEntryName(int pos) { } /* - * Returns an ordered {@code Stream} over the zip file entry names. + * Returns an ordered {@code Stream} over the ZIP file entry names. * * Entry names appear in the {@code Stream} in the order they appear in * the central directory of the ZIP file. * - * @return an ordered {@code Stream} of entry names in this zip file - * @throws IllegalStateException if the zip file has been closed + * @return an ordered {@code Stream} of entry names in this ZIP file + * @throws IllegalStateException if the ZIP file has been closed * @since 10 */ private Stream entryNameStream() { @@ -634,13 +642,13 @@ private Stream entryNameStream() { } /* - * Returns an ordered {@code Stream} over the zip file entries. + * Returns an ordered {@code Stream} over the ZIP file entries. * * Entries appear in the {@code Stream} in the order they appear in * the central directory of the jar file. * - * @return an ordered {@code Stream} of entries in this zip file - * @throws IllegalStateException if the zip file has been closed + * @return an ordered {@code Stream} of entries in this ZIP file + * @throws IllegalStateException if the ZIP file has been closed * @since 10 */ private Stream jarStream() { @@ -709,7 +717,7 @@ private ZipEntry getZipEntry(String name, int pos) { * Returns the number of entries in the ZIP file. * * @return the number of entries in the ZIP file - * @throws IllegalStateException if the zip file has been closed + * @throws IllegalStateException if the ZIP file has been closed */ public int size() { synchronized (this) { @@ -809,7 +817,7 @@ public void run() { } } - // Release zip src + // Release ZIP src if (zsrc != null) { synchronized (zsrc) { try { @@ -844,7 +852,7 @@ public void close() throws IOException { synchronized (this) { // Close streams, release their inflaters, release cached inflaters - // and release zip source + // and release ZIP source try { res.clean(); } catch (UncheckedIOException ioe) { @@ -870,7 +878,7 @@ private void ensureOpenOrZipException() throws IOException { /* * Inner class implementing the input stream used to read a - * (possibly compressed) zip file entry. + * (possibly compressed) ZIP file entry. */ private class ZipFileInputStream extends InputStream { private volatile boolean closeRequested; @@ -883,7 +891,7 @@ private class ZipFileInputStream extends InputStream { rem = CENSIZ(cen, cenpos); size = CENLEN(cen, cenpos); pos = CENOFF(cen, cenpos); - // zip64 + // ZIP64 if (rem == ZIP64_MAGICVAL || size == ZIP64_MAGICVAL || pos == ZIP64_MAGICVAL) { checkZIP64(cen, cenpos); @@ -930,7 +938,7 @@ private void checkZIP64(byte[] cen, int cenpos) { } /* - * The Zip file spec explicitly allows the LOC extra data size to + * The ZIP file spec explicitly allows the LOC extra data size to * be different from the CEN extra data size. Since we cannot trust * the CEN extra data size, we need to read the LOC to determine * the entry data offset. @@ -1178,20 +1186,20 @@ private static class Source { private static final int[] EMPTY_META_VERSIONS = new int[0]; private final Key key; // the key in files - private final @Stable ZipCoder zc; // zip coder used to decode/encode + private final @Stable ZipCoder zc; // ZIP coder used to decode/encode private int refs = 1; - private RandomAccessFile zfile; // zfile of the underlying zip file + private RandomAccessFile zfile; // zfile of the underlying ZIP file private byte[] cen; // CEN & ENDHDR private long locpos; // position of first LOC header (usually 0) - private byte[] comment; // zip file comment + private byte[] comment; // ZIP file comment // list of meta entries in META-INF dir private int manifestPos = -1; // position of the META-INF/MANIFEST.MF, if exists private int manifestNum = 0; // number of META-INF/MANIFEST.MF, case insensitive private int[] signatureMetaNames; // positions of signature related entries, if such exist private int[] metaVersions; // list of unique versions found in META-INF/versions/ - private final boolean startsWithLoc; // true, if zip file starts with LOCSIG (usually true) + private final boolean startsWithLoc; // true, if ZIP file starts with LOCSIG (usually true) // A Hashmap for all entries. // @@ -1446,10 +1454,10 @@ private static boolean isZip64ExtBlockSizeValid(int blockSize, long csize, private int tablelen; // number of hash heads /** - * A class representing a key to a zip file. A key is based + * A class representing a key to a ZIP file. A key is based * on the file key if available, or the path value if the * file key is not available. The key is also based on the - * file's last modified time to allow for cases where a zip + * file's last modified time to allow for cases where a ZIP * file is re-opened after it has been modified. */ private static class Key { @@ -1671,7 +1679,7 @@ private End findEND() throws IOException { zerror("zip comment read failed"); } } - // must check for a zip64 end record; it is always permitted to be present + // must check for a ZIP64 end record; it is always permitted to be present try { byte[] loc64 = new byte[ZIP64_LOCHDR]; if (end.endpos < ZIP64_LOCHDR || @@ -1700,7 +1708,7 @@ private End findEND() throws IOException { end.cenoff = cenoff64; end.centot = (int)centot64; // assume total < 2g end.endpos = end64pos; - } catch (IOException x) {} // no zip64 loc/end + } catch (IOException x) {} // no ZIP64 loc/end return end; } } @@ -1708,7 +1716,7 @@ private End findEND() throws IOException { throw new ZipException("zip END header not found"); } - // Reads zip file central directory. + // Reads ZIP file central directory. private void initCEN(int knownTotal) throws IOException { // Prefer locals for better performance during startup byte[] cen; @@ -1725,7 +1733,7 @@ private void initCEN(int knownTotal) throws IOException { zerror("invalid END header (bad central directory size)"); long cenpos = end.endpos - end.cenlen; // position of CEN table // Get position of first local file (LOC) header, taking into - // account that there may be a stub prefixed to the zip file. + // account that there may be a stub prefixed to the ZIP file. locpos = cenpos - end.cenoff; if (locpos < 0) { zerror("invalid END header (bad central directory offset)"); @@ -1768,7 +1776,7 @@ private void initCEN(int knownTotal) throws IOException { manifestNum = 0; while (entryPos <= limit) { if (idx >= entriesLength) { - // This will only happen if the zip file has an incorrect + // This will only happen if the ZIP file has an incorrect // ENDTOT field, which usually means it contains more than // 65535 entries. initCEN(countCENHeaders(cen, limit)); @@ -1841,7 +1849,7 @@ private static void zerror(String msg) throws ZipException { } /* - * Returns the {@code pos} of the zip cen entry corresponding to the + * Returns the {@code pos} of the ZIP cen entry corresponding to the * specified entry name, or -1 if not found. */ private int getEntryPos(String name, boolean addSlash) { @@ -2029,9 +2037,9 @@ private int getMetaVersion(int off, int len) { /** * Returns the number of CEN headers in a central directory. - * Will not throw, even if the zip file is corrupt. + * Will not throw, even if the ZIP file is corrupt. * - * @param cen copy of the bytes in a zip file's central directory + * @param cen copy of the bytes in a ZIP file's central directory * @param size number of bytes in central directory */ private static int countCENHeaders(byte[] cen, int size) { diff --git a/src/java.base/share/classes/java/util/zip/ZipInputStream.java b/src/java.base/share/classes/java/util/zip/ZipInputStream.java index 89fe159d575..26f78b395c5 100644 --- a/src/java.base/share/classes/java/util/zip/ZipInputStream.java +++ b/src/java.base/share/classes/java/util/zip/ZipInputStream.java @@ -66,7 +66,7 @@ * } * } * @apiNote - * The LOC header contains metadata about the Zip file entry. {@code ZipInputStream} + * The LOC header contains metadata about the ZIP file entry. {@code ZipInputStream} * does not read the Central directory (CEN) header for the entry and therefore * will not have access to its metadata such as the external file attributes. * {@linkplain ZipFile} may be used when the information stored within @@ -515,9 +515,16 @@ private ZipEntry readLOC() throws IOException { } readFully(b, 0, len); // Force to use UTF-8 if the USE_UTF8 bit is ON - ZipEntry e = createZipEntry(((flag & USE_UTF8) != 0) - ? ZipCoder.toStringUTF8(b, len) - : zc.toString(b, len)); + String entryName; + try { + entryName = ((flag & USE_UTF8) != 0) ? + ZipCoder.toStringUTF8(b, len) + : zc.toString(b, len); + } catch (Exception ex) { + throw (ZipException) new ZipException( + "invalid LOC header (bad entry name)").initCause(ex); + } + ZipEntry e = createZipEntry(entryName); // now get the remaining fields for the entry if ((flag & 1) == 1) { throw new ZipException("encrypted ZIP entry not supported"); @@ -572,7 +579,7 @@ protected ZipEntry createZipEntry(String name) { * data descriptor, and that data descriptor may optionally contain a * leading signature (EXTSIG). * - * From the zip spec http://www.pkware.com/documents/casestudies/APPNOTE.TXT + * From the ZIP spec http://www.pkware.com/documents/casestudies/APPNOTE.TXT * * """Although not originally assigned a signature, the value 0x08074b50 * has commonly been adopted as a signature value for the data descriptor diff --git a/src/java.base/share/classes/java/util/zip/ZipOutputStream.java b/src/java.base/share/classes/java/util/zip/ZipOutputStream.java index d87a18c8c44..e1d40355860 100644 --- a/src/java.base/share/classes/java/util/zip/ZipOutputStream.java +++ b/src/java.base/share/classes/java/util/zip/ZipOutputStream.java @@ -49,10 +49,10 @@ public class ZipOutputStream extends DeflaterOutputStream implements ZipConstants { /** - * Whether to use ZIP64 for zip files with more than 64k entries. - * Until ZIP64 support in zip implementations is ubiquitous, this - * system property allows the creation of zip files which can be - * read by legacy zip implementations which tolerate "incorrect" + * Whether to use ZIP64 for ZIP files with more than 64k entries. + * Until ZIP64 support in ZIP implementations is ubiquitous, this + * system property allows the creation of ZIP files which can be + * read by legacy ZIP implementations which tolerate "incorrect" * total entry count fields, such as the ones in jdk6, and even * some in jdk7. */ @@ -233,7 +233,7 @@ public void putNextEntry(ZipEntry e) throws IOException { // descriptor immediately following the compressed entry data. // Ignore the compressed size of a ZipEntry if it was implcitely set // while reading that ZipEntry from a ZipFile or ZipInputStream because - // we can't know the compression level of the source zip file/stream. + // we can't know the compression level of the source ZIP file/stream. if (e.size == -1 || e.csize == -1 || e.crc == -1 || !e.csizeSet) { e.flag = 8; } @@ -734,7 +734,7 @@ private void writeEND(long off, long len) throws IOException { writeShort(count); // total number of directory entries writeInt(xlen); // length of central directory writeInt(xoff); // offset of central directory - if (comment != null) { // zip file comment + if (comment != null) { // ZIP file comment writeShort(comment.length); writeBytes(comment, 0, comment.length); } else { diff --git a/src/java.base/share/classes/java/util/zip/ZipUtils.java b/src/java.base/share/classes/java/util/zip/ZipUtils.java index 0cbc2e28795..ab37fc03a56 100644 --- a/src/java.base/share/classes/java/util/zip/ZipUtils.java +++ b/src/java.base/share/classes/java/util/zip/ZipUtils.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -252,7 +252,7 @@ static final long GETSIG(byte[] b) { static final int ENDTOT(byte[] b) { return SH(b, 10);} // total number of entries static final long ENDSIZ(byte[] b) { return LG(b, 12);} // central directory size static final long ENDOFF(byte[] b) { return LG(b, 16);} // central directory offset - static final int ENDCOM(byte[] b) { return SH(b, 20);} // size of zip file comment + static final int ENDCOM(byte[] b) { return SH(b, 20);} // size of ZIP file comment static final int ENDCOM(byte[] b, int off) { return SH(b, off + 20);} // zip64 end of central directory recoder fields @@ -287,7 +287,7 @@ static final long GETSIG(byte[] b) { static final int READBLOCKSZ = 128; /** - * Loads zip native library, if not already loaded + * Loads ZIP native library, if not already loaded */ static void loadLibrary() { jdk.internal.loader.BootLoader.loadLibrary("zip"); diff --git a/src/java.base/share/classes/java/util/zip/package-info.java b/src/java.base/share/classes/java/util/zip/package-info.java index 9f2b39f0a52..f271a468b11 100644 --- a/src/java.base/share/classes/java/util/zip/package-info.java +++ b/src/java.base/share/classes/java/util/zip/package-info.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -39,12 +39,12 @@ * are based. *

  • An implementation may optionally support the * ZIP64(tm) format extensions defined by the - * + * * PKWARE ZIP File Format Specification. The ZIP64(tm) format * extensions are used to overcome the size limitations of the * original ZIP format. *
  • APPENDIX D of - * + * * PKWARE ZIP File Format Specification - Language Encoding Flag * to encode ZIP entry filename and comment fields using UTF-8. *
  • diff --git a/src/java.base/share/classes/jdk/internal/reflect/ClassFileAssembler.java b/src/java.base/share/classes/jdk/internal/reflect/ClassFileAssembler.java index aeef5e62f12..312616d79ed 100644 --- a/src/java.base/share/classes/jdk/internal/reflect/ClassFileAssembler.java +++ b/src/java.base/share/classes/jdk/internal/reflect/ClassFileAssembler.java @@ -25,6 +25,8 @@ package jdk.internal.reflect; +import sun.nio.cs.UTF_8; + class ClassFileAssembler implements ClassFileConstants { private ByteVector vec; private short cpIdx = 0; @@ -98,9 +100,7 @@ public short cpi() { } public void emitConstantPoolUTF8(String str) { - // NOTE: can not use str.getBytes("UTF-8") here because of - // bootstrapping issues with the character set converters. - byte[] bytes = UTF8.encode(str); + byte[] bytes = str.getBytes(UTF_8.INSTANCE); emitByte(CONSTANT_Utf8); emitShort((short) bytes.length); for (int i = 0; i < bytes.length; i++) { diff --git a/src/java.base/share/classes/jdk/internal/reflect/UTF8.java b/src/java.base/share/classes/jdk/internal/reflect/UTF8.java deleted file mode 100644 index 446060dba8b..00000000000 --- a/src/java.base/share/classes/jdk/internal/reflect/UTF8.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package jdk.internal.reflect; - -/** It is necessary to use a "bootstrap" UTF-8 encoder for encoding - constant pool entries because the character set converters rely on - Class.newInstance(). */ - -class UTF8 { - // This encoder is not quite correct. It does not handle surrogate pairs. - static byte[] encode(String str) { - int len = str.length(); - byte[] res = new byte[utf8Length(str)]; - int utf8Idx = 0; - try { - for (int i = 0; i < len; i++) { - int c = str.charAt(i) & 0xFFFF; - if (c >= 0x0001 && c <= 0x007F) { - res[utf8Idx++] = (byte) c; - } else if (c == 0x0000 || - (c >= 0x0080 && c <= 0x07FF)) { - res[utf8Idx++] = (byte) (0xC0 + (c >> 6)); - res[utf8Idx++] = (byte) (0x80 + (c & 0x3F)); - } else { - res[utf8Idx++] = (byte) (0xE0 + (c >> 12)); - res[utf8Idx++] = (byte) (0x80 + ((c >> 6) & 0x3F)); - res[utf8Idx++] = (byte) (0x80 + (c & 0x3F)); - } - } - } catch (ArrayIndexOutOfBoundsException e) { - throw new InternalError - ("Bug in sun.reflect bootstrap UTF-8 encoder", e); - } - return res; - } - - private static int utf8Length(String str) { - int len = str.length(); - int utf8Len = 0; - for (int i = 0; i < len; i++) { - int c = str.charAt(i) & 0xFFFF; - if (c >= 0x0001 && c <= 0x007F) { - utf8Len += 1; - } else if (c == 0x0000 || - (c >= 0x0080 && c <= 0x07FF)) { - utf8Len += 2; - } else { - utf8Len += 3; - } - } - return utf8Len; - } -} diff --git a/src/java.base/share/classes/sun/security/ssl/Alert.java b/src/java.base/share/classes/sun/security/ssl/Alert.java index 8706c7cfa70..4e1ccf385c7 100644 --- a/src/java.base/share/classes/sun/security/ssl/Alert.java +++ b/src/java.base/share/classes/sun/security/ssl/Alert.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -123,13 +123,13 @@ SSLException createSSLException(String reason, Throwable cause) { } if (cause instanceof IOException) { - return new SSLException(reason, cause); + return new SSLException("(" + description + ") " + reason, cause); } else if ((this == UNEXPECTED_MESSAGE)) { - return new SSLProtocolException(reason, cause); + return new SSLProtocolException("(" + description + ") " + reason, cause); } else if (handshakeOnly) { - return new SSLHandshakeException(reason, cause); + return new SSLHandshakeException("(" + description + ") " + reason, cause); } else { - return new SSLException(reason, cause); + return new SSLException("(" + description + ") " + reason, cause); } } diff --git a/src/java.base/share/classes/sun/security/ssl/CertificateMessage.java b/src/java.base/share/classes/sun/security/ssl/CertificateMessage.java index b43ea3835af..cdb65bd329a 100644 --- a/src/java.base/share/classes/sun/security/ssl/CertificateMessage.java +++ b/src/java.base/share/classes/sun/security/ssl/CertificateMessage.java @@ -385,7 +385,7 @@ private void onCertificate(ServerHandshakeContext shc, if (shc.sslConfig.clientAuthType != ClientAuthType.CLIENT_AUTH_REQUESTED) { // unexpected or require client authentication - throw shc.conContext.fatal(Alert.BAD_CERTIFICATE, + throw shc.conContext.fatal(Alert.HANDSHAKE_FAILURE, "Empty client certificate chain"); } else { return; @@ -1162,7 +1162,7 @@ private void onConsumeCertificate(ServerHandshakeContext shc, shc.handshakeConsumers.remove( SSLHandshake.CERTIFICATE_VERIFY.id); if (shc.sslConfig.clientAuthType == CLIENT_AUTH_REQUIRED) { - throw shc.conContext.fatal(Alert.BAD_CERTIFICATE, + throw shc.conContext.fatal(Alert.CERTIFICATE_REQUIRED, "Empty client certificate chain"); } else { // optional client authentication @@ -1186,7 +1186,7 @@ private void onConsumeCertificate(ClientHandshakeContext chc, T13CertificateMessage certificateMessage )throws IOException { if (certificateMessage.certEntries == null || certificateMessage.certEntries.isEmpty()) { - throw chc.conContext.fatal(Alert.BAD_CERTIFICATE, + throw chc.conContext.fatal(Alert.DECODE_ERROR, "Empty server certificate chain"); } diff --git a/src/java.base/share/classes/sun/security/util/SignatureUtil.java b/src/java.base/share/classes/sun/security/util/SignatureUtil.java index 3d415814ba4..155adc198d0 100644 --- a/src/java.base/share/classes/sun/security/util/SignatureUtil.java +++ b/src/java.base/share/classes/sun/security/util/SignatureUtil.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -297,6 +297,9 @@ public static String extractKeyAlgFromDwithE(String signatureAlgorithm) { } else { keyAlgorithm = signatureAlgorithm.substring(with + 4); } + if (keyAlgorithm.endsWith("INP1363FORMAT")) { + keyAlgorithm = keyAlgorithm.substring(0, keyAlgorithm.length() - 13); + } if (keyAlgorithm.equalsIgnoreCase("ECDSA")) { keyAlgorithm = "EC"; } diff --git a/src/java.base/unix/native/libjava/childproc.c b/src/java.base/unix/native/libjava/childproc.c index 175128e4f63..52769ec642f 100644 --- a/src/java.base/unix/native/libjava/childproc.c +++ b/src/java.base/unix/native/libjava/childproc.c @@ -36,7 +36,7 @@ const char * const *parentPathv; -int +static int restartableDup2(int fd_from, int fd_to) { int err; @@ -50,7 +50,7 @@ closeSafely(int fd) return (fd == -1) ? 0 : close(fd); } -int +static int isAsciiDigit(char c) { return c >= '0' && c <= '9'; @@ -65,7 +65,7 @@ isAsciiDigit(char c) #define FD_DIR "/proc/self/fd" #endif -int +static int closeDescriptors(void) { DIR *dp; @@ -103,7 +103,7 @@ closeDescriptors(void) return 1; } -int +static int moveDescriptor(int fd_from, int fd_to) { if (fd_from != fd_to) { @@ -209,7 +209,7 @@ initVectorFromBlock(const char**vector, const char* block, int count) * misfeature, but compatibility wins over sanity. The original support for * this was imported accidentally from execvp(). */ -void +static void execve_as_traditional_shell_script(const char *file, const char *argv[], const char *const envp[]) @@ -232,7 +232,7 @@ execve_as_traditional_shell_script(const char *file, * Like execve(2), except that in case of ENOEXEC, FILE is assumed to * be a shell script and the system default shell is invoked to run it. */ -void +static void execve_with_shell_fallback(int mode, const char *file, const char *argv[], const char *const envp[]) @@ -256,7 +256,7 @@ execve_with_shell_fallback(int mode, const char *file, * JDK_execvpe is identical to execvp, except that the child environment is * specified via the 3rd argument instead of being inherited from environ. */ -void +static void JDK_execvpe(int mode, const char *file, const char *argv[], const char *const envp[]) diff --git a/src/java.base/unix/native/libjava/childproc.h b/src/java.base/unix/native/libjava/childproc.h index e39126aa119..49026b388c9 100644 --- a/src/java.base/unix/native/libjava/childproc.h +++ b/src/java.base/unix/native/libjava/childproc.h @@ -128,24 +128,11 @@ typedef struct _SpawnInfo { extern const char * const *parentPathv; ssize_t writeFully(int fd, const void *buf, size_t count); -int restartableDup2(int fd_from, int fd_to); int closeSafely(int fd); -int isAsciiDigit(char c); -int closeDescriptors(void); -int moveDescriptor(int fd_from, int fd_to); int magicNumber(); ssize_t readFully(int fd, void *buf, size_t nbyte); void initVectorFromBlock(const char**vector, const char* block, int count); -void execve_as_traditional_shell_script(const char *file, - const char *argv[], - const char *const envp[]); -void execve_with_shell_fallback(int mode, const char *file, - const char *argv[], - const char *const envp[]); -void JDK_execvpe(int mode, const char *file, - const char *argv[], - const char *const envp[]); int childProcess(void *arg); #ifdef DEBUG diff --git a/src/java.security.jgss/share/native/libj2gss/GSSLibStub.c b/src/java.security.jgss/share/native/libj2gss/GSSLibStub.c index b0862bed690..90f5016e647 100644 --- a/src/java.security.jgss/share/native/libj2gss/GSSLibStub.c +++ b/src/java.security.jgss/share/native/libj2gss/GSSLibStub.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -196,7 +196,10 @@ gss_channel_bindings_t newGSSCB(JNIEnv *env, jobject jcb) { return GSS_C_NO_CHANNEL_BINDINGS; } - cb = malloc(sizeof(struct gss_channel_bindings_struct)); + // initialize cb as zeroes to avoid uninitialized pointer being + // freed when deleteGSSCB is called at cleanup. + cb = calloc(1, sizeof(struct gss_channel_bindings_struct)); + if (cb == NULL) { gssThrowOutOfMemoryError(env, NULL); return NULL; @@ -216,9 +219,6 @@ gss_channel_bindings_t newGSSCB(JNIEnv *env, jobject jcb) { cb->initiator_addrtype = GSS_C_AF_NULLADDR; cb->acceptor_addrtype = GSS_C_AF_NULLADDR; } - // addresses needs to be initialized to empty - memset(&cb->initiator_address, 0, sizeof(cb->initiator_address)); - memset(&cb->acceptor_address, 0, sizeof(cb->acceptor_address)); /* set up initiator address */ jinetAddr = (*env)->CallObjectMethod(env, jcb, diff --git a/src/jdk.attach/share/classes/sun/tools/attach/HotSpotVirtualMachine.java b/src/jdk.attach/share/classes/sun/tools/attach/HotSpotVirtualMachine.java index 2c2e865a086..93656cdf513 100644 --- a/src/jdk.attach/share/classes/sun/tools/attach/HotSpotVirtualMachine.java +++ b/src/jdk.attach/share/classes/sun/tools/attach/HotSpotVirtualMachine.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -96,13 +96,14 @@ private void loadAgentLibrary(String agentLibrary, boolean isAbsolute, String op } String msgPrefix = "return code: "; - InputStream in = execute("load", - agentLibrary, - isAbsolute ? "true" : "false", - options); - try (BufferedReader reader = new BufferedReader(new InputStreamReader(in))) { - String result = reader.readLine(); - if (result == null) { + String errorMsg = "Failed to load agent library"; + try { + InputStream in = execute("load", + agentLibrary, + isAbsolute ? "true" : "false", + options); + String result = readErrorMessage(in); + if (result.isEmpty()) { throw new AgentLoadException("Target VM did not respond"); } else if (result.startsWith(msgPrefix)) { int retCode = Integer.parseInt(result.substring(msgPrefix.length())); @@ -110,8 +111,15 @@ private void loadAgentLibrary(String agentLibrary, boolean isAbsolute, String op throw new AgentInitializationException("Agent_OnAttach failed", retCode); } } else { - throw new AgentLoadException(result); + if (!result.isEmpty()) { + errorMsg += ": " + result; + } + throw new AgentLoadException(errorMsg); } + } catch (AttachOperationFailedException ex) { + // execute() throws AttachOperationFailedException if attach agent reported error. + // Convert it to AgentLoadException. + throw new AgentLoadException(errorMsg + ": " + ex.getMessage()); } } @@ -364,6 +372,9 @@ String readErrorMessage(InputStream in) throws IOException { StringBuilder message = new StringBuilder(); BufferedReader br = new BufferedReader(new InputStreamReader(in)); while ((s = br.readLine()) != null) { + if (message.length() > 0) { + message.append(' '); + } message.append(s); } return message.toString(); @@ -399,20 +410,10 @@ void processCompletionStatus(IOException ioe, String cmd, InputStream sis) throw throw new IOException("Protocol mismatch with target VM"); } - // Special-case the "load" command so that the right exception is - // thrown. - if (cmd.equals("load")) { - String msg = "Failed to load agent library"; - if (!message.isEmpty()) { - msg += ": " + message; - } - throw new AgentLoadException(msg); - } else { - if (message.isEmpty()) { - message = "Command failed in target VM"; - } - throw new AttachOperationFailedException(message); + if (message.isEmpty()) { + message = "Command failed in target VM"; } + throw new AttachOperationFailedException(message); } } diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Flow.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Flow.java index 4491d12245c..a1b008b6e65 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Flow.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Flow.java @@ -815,6 +815,7 @@ private boolean exhausts(JCExpression selector, List cases) { } } Set patterns = patternSet; + boolean genericPatternsExpanded = false; try { boolean repeat = true; while (repeat) { @@ -824,10 +825,22 @@ private boolean exhausts(JCExpression selector, List cases) { updatedPatterns = reduceRecordPatterns(updatedPatterns); updatedPatterns = removeCoveredRecordPatterns(updatedPatterns); repeat = !updatedPatterns.equals(patterns); - patterns = updatedPatterns; if (checkCovered(selector.type, patterns)) { return true; } + if (!repeat && !genericPatternsExpanded) { + //there may be situation like: + //class B extends S1, S2 + //patterns: R(S1, B), R(S2, S2) + //this should be joined to R(B, S2), + //but hashing in reduceNestedPatterns will not allow that + //attempt to once expand all types to their transitive permitted types, + //on all depth of nesting: + updatedPatterns = expandGenericPatterns(updatedPatterns); + genericPatternsExpanded = true; + repeat = !updatedPatterns.equals(patterns); + } + patterns = updatedPatterns; } return checkCovered(selector.type, patterns); } catch (CompletionFailure cf) { @@ -1130,6 +1143,40 @@ private PatternDescription reduceRecordPattern(PatternDescription pattern) { return pattern; } + private Set expandGenericPatterns(Set patterns) { + var newPatterns = new HashSet(patterns); + boolean modified; + do { + modified = false; + for (PatternDescription pd : patterns) { + if (pd instanceof RecordPattern rpOne) { + for (int i = 0; i < rpOne.nested.length; i++) { + Set toExpand = Set.of(rpOne.nested[i]); + Set expanded = expandGenericPatterns(toExpand); + if (expanded != toExpand) { + expanded.removeAll(toExpand); + for (PatternDescription exp : expanded) { + PatternDescription[] newNested = Arrays.copyOf(rpOne.nested, rpOne.nested.length); + newNested[i] = exp; + modified |= newPatterns.add(new RecordPattern(rpOne.recordType(), rpOne.fullComponentTypes(), newNested)); + } + } + } + } else if (pd instanceof BindingPattern bp) { + Set permittedSymbols = allPermittedSubTypes((ClassSymbol) bp.type.tsym, cs -> true); + + if (!permittedSymbols.isEmpty()) { + for (Symbol permitted : permittedSymbols) { + //TODO infer.instantiatePatternType(selectorType, csym); (?) + modified |= newPatterns.add(new BindingPattern(permitted.type)); + } + } + } + } + } while (modified); + return newPatterns; + } + private Set removeCoveredRecordPatterns(Set patterns) { Set existingBindings = patterns.stream() .filter(pd -> pd instanceof BindingPattern) diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/TransPatterns.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/TransPatterns.java index 089d9236dec..5628fc119cc 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/TransPatterns.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/TransPatterns.java @@ -988,6 +988,7 @@ public void resolve(VarSymbol commonBinding, commonBinding.type.tsym == currentBinding.type.tsym && commonBinding.isUnnamedVariable() == currentBinding.isUnnamedVariable() && !previousNullable && + !currentNullable && new TreeDiffer(List.of(commonBinding), List.of(currentBinding)) .scan(commonNestedExpression, currentNestedExpression)) { accummulator.add(c.head); diff --git a/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11Key.java b/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11Key.java index 4d8a33c07d4..837a3a3dba1 100644 --- a/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11Key.java +++ b/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11Key.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -1532,7 +1532,12 @@ void releaseKeyID() { // destroy this.keyID = 0; - this.ref.removeNativeKey(); + try { + this.ref.removeNativeKey(); + } finally { + // prevent enqueuing SessionKeyRef until removeNativeKey is done + Reference.reachabilityFence(this); + } } else { if (cnt < 0) { // should never happen as we start count at 1 and pair get/release calls diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/serial/SerialHeap.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/serial/SerialHeap.java index 2640da35ac1..397d0e0b762 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/serial/SerialHeap.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/serial/SerialHeap.java @@ -46,8 +46,6 @@ public CollectedHeapName kind() { private static AddressField youngGenField; private static AddressField oldGenField; - private static GenerationFactory genFactory; - static { VM.registerVMInitializedObserver(new Observer() { public void update(Observable o, Object data) { @@ -61,8 +59,6 @@ private static synchronized void initialize(TypeDataBase db) { youngGenField = type.getAddressField("_young_gen"); oldGenField = type.getAddressField("_old_gen"); - - genFactory = new GenerationFactory(); } public DefNewGeneration youngGen() { diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/shared/ContiguousSpace.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/shared/ContiguousSpace.java index 20881a9300b..d6bf39775bb 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/shared/ContiguousSpace.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/shared/ContiguousSpace.java @@ -34,7 +34,17 @@ import sun.jvm.hotspot.utilities.Observable; import sun.jvm.hotspot.utilities.Observer; -public class ContiguousSpace extends Space implements LiveRegionsProvider { +/**

    A ContiguousSpace describes a heap area.

    + +

    Invariant: bottom() and end() are on page_size boundaries and:

    + +

    bottom() <= top() <= end()

    + +

    top() is inclusive and end() is exclusive.

    */ + +public class ContiguousSpace extends VMObject implements LiveRegionsProvider { + private static AddressField bottomField; + private static AddressField endField; private static AddressField topField; static { @@ -48,6 +58,8 @@ public void update(Observable o, Object data) { private static synchronized void initialize(TypeDataBase db) { Type type = db.lookupType("ContiguousSpace"); + bottomField = type.getAddressField("_bottom"); + endField = type.getAddressField("_end"); topField = type.getAddressField("_top"); } @@ -55,24 +67,30 @@ public ContiguousSpace(Address addr) { super(addr); } - public Address top() { - return topField.getValue(addr); - } + public Address bottom() { return bottomField.getValue(addr); } + public Address end() { return endField.getValue(addr); } + public Address top() { return topField.getValue(addr); } - /** In bytes */ - public long capacity() { - return end().minus(bottom()); + /** Support for iteration over heap -- not sure how this will + interact with GC in reflective system, but necessary for the + debugging mechanism */ + public OopHandle bottomAsOopHandle() { + return bottomField.getOopHandle(addr); } - /** In bytes */ - public long used() { - return top().minus(bottom()); + /** Support for iteration over heap -- not sure how this will + interact with GC in reflective system, but necessary for the + debugging mechanism */ + public OopHandle nextOopHandle(OopHandle handle, long size) { + return handle.addOffsetToAsOopHandle(size); } - /** In bytes */ - public long free() { - return end().minus(top()); - } + /** Returned value is in bytes */ + public long capacity() { return end().minus(bottom()); } + public long used() { return top().minus(bottom()); } + public long free() { return end().minus(top()); } + + public void print() { printOn(System.out); } /** In a contiguous space we have a more obvious bound on what parts contain objects. */ @@ -95,6 +113,10 @@ public boolean contains(Address p) { public void printOn(PrintStream tty) { tty.print(" [" + bottom() + "," + top() + "," + end() + ")"); - super.printOn(tty); + tty.print(" space capacity = "); + tty.print(capacity()); + tty.print(", "); + tty.print((double) used() * 100.0/ capacity()); + tty.print(" used"); } } diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/shared/GenerationFactory.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/shared/GenerationFactory.java deleted file mode 100644 index 307054e5a4e..00000000000 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/shared/GenerationFactory.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.gc.shared; - -import java.util.*; - -import sun.jvm.hotspot.debugger.*; -import sun.jvm.hotspot.gc.serial.*; -import sun.jvm.hotspot.runtime.*; -import sun.jvm.hotspot.types.*; -import sun.jvm.hotspot.utilities.Observable; -import sun.jvm.hotspot.utilities.Observer; - -/** Factory containing a VirtualConstructor suitable for instantiating - wrapper objects for all types of generations */ - -public class GenerationFactory { - private static VirtualConstructor ctor; - - static { - VM.registerVMInitializedObserver(new Observer() { - public void update(Observable o, Object data) { - initialize(VM.getVM().getTypeDataBase()); - } - }); - } - - private static synchronized void initialize(TypeDataBase db) { - ctor = new VirtualConstructor(db); - - ctor.addMapping("DefNewGeneration", DefNewGeneration.class); - ctor.addMapping("TenuredGeneration", TenuredGeneration.class); - } - - public static Generation newObject(Address addr) { - try { - return (Generation) ctor.instantiateWrapperFor(addr); - } catch (WrongTypeException e) { - return new Generation(addr) { - public String name() { - return "unknown generation type"; - } - public void spaceIterate(SpaceClosure blk, boolean usedOnly) { - } - public void liveRegionsIterate(LiveRegionsClosure closure) { - } - public void printOn(java.io.PrintStream tty) { - tty.println("unknown subtype of Generation @ " + getAddress() + " (" + - virtualSpace().low() + "," + virtualSpace().high() + ")"); - } - public long used() { - return 0; - } - public long free() { - return 0; - } - public long capacity() { - return 0; - } - public long contiguousAvailable() { - return 0; - } - - }; - } - } -} diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/shared/Space.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/shared/Space.java deleted file mode 100644 index 3318d8bf270..00000000000 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/shared/Space.java +++ /dev/null @@ -1,114 +0,0 @@ -/* - * Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.gc.shared; - -import java.io.*; -import java.util.*; -import sun.jvm.hotspot.debugger.*; -import sun.jvm.hotspot.memory.*; -import sun.jvm.hotspot.runtime.*; -import sun.jvm.hotspot.types.*; -import sun.jvm.hotspot.utilities.Observable; -import sun.jvm.hotspot.utilities.Observer; - -/**

    A Space describes a heap area. Class Space is an abstract base - class.

    - -

    Space supports allocation, size computation and GC support is - provided.

    - -

    Invariant: bottom() and end() are on page_size boundaries and:

    - -

    bottom() <= top() <= end()

    - -

    top() is inclusive and end() is exclusive.

    */ - -public abstract class Space extends VMObject { - private static AddressField bottomField; - private static AddressField endField; - - static { - VM.registerVMInitializedObserver(new Observer() { - public void update(Observable o, Object data) { - initialize(VM.getVM().getTypeDataBase()); - } - }); - } - - private static synchronized void initialize(TypeDataBase db) { - Type type = db.lookupType("Space"); - - bottomField = type.getAddressField("_bottom"); - endField = type.getAddressField("_end"); - } - - public Space(Address addr) { - super(addr); - } - - public Address bottom() { return bottomField.getValue(addr); } - public Address end() { return endField.getValue(addr); } - - /** Returns a subregion of the space containing all the objects in - the space. */ - public MemRegion usedRegion() { - return new MemRegion(bottom(), end()); - } - - /** Support for iteration over heap -- not sure how this will - interact with GC in reflective system, but necessary for the - debugging mechanism */ - public OopHandle bottomAsOopHandle() { - return bottomField.getOopHandle(addr); - } - - /** Support for iteration over heap -- not sure how this will - interact with GC in reflective system, but necessary for the - debugging mechanism */ - public OopHandle nextOopHandle(OopHandle handle, long size) { - return handle.addOffsetToAsOopHandle(size); - } - - /** Returned value is in bytes */ - public long capacity() { return end().minus(bottom()); } - /** Returned value is in bytes */ - public abstract long used(); - /** Returned value is in bytes */ - public abstract long free(); - - /** Testers */ - public boolean contains(Address p) { - return (bottom().lessThanOrEqual(p) && end().greaterThan(p)); - } - - public void print() { printOn(System.out); } - public void printOn(PrintStream tty) { - tty.print(" space capacity = "); - tty.print(capacity()); - tty.print(", "); - tty.print((double) used() * 100.0/ capacity()); - tty.print(" used"); - } -} diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/shared/SpaceClosure.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/shared/SpaceClosure.java deleted file mode 100644 index c8ef40f98ab..00000000000 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/shared/SpaceClosure.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.gc.shared; - -public interface SpaceClosure { - public void doSpace(Space s); -} diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/memory/Universe.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/memory/Universe.java index f2f5422ad04..c4ab8e32c0b 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/memory/Universe.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/memory/Universe.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -116,13 +116,6 @@ public void printOn(PrintStream tty) { heap().printOn(tty); } - // Check whether an element of a typeArrayOop with the given type must be - // aligned 0 mod 8. The typeArrayOop itself must be aligned at least this - // strongly. - public static boolean elementTypeShouldBeAligned(BasicType type) { - return type == BasicType.T_DOUBLE || type == BasicType.T_LONG; - } - // Check whether an object field (static/non-static) of the given type must be // aligned 0 mod 8. public static boolean fieldTypeShouldBeAligned(BasicType type) { diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/Array.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/Array.java index 6ba23c9ea40..3f96f72cf04 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/Array.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/Array.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -57,28 +57,27 @@ private static void initialize(TypeDataBase db) throws WrongTypeException { private static long lengthOffsetInBytes=0; private static long typeSize; + // Check whether an element of a arrayOop with the given type must be + // aligned 0 mod 8. The arrayOop itself must be aligned at least this + // strongly. + private static boolean elementTypeShouldBeAligned(BasicType type) { + if (VM.getVM().isLP64()) { + if (type == BasicType.T_OBJECT || type == BasicType.T_ARRAY) { + return !VM.getVM().isCompressedOopsEnabled(); + } + } + return type == BasicType.T_DOUBLE || type == BasicType.T_LONG; + } + private static long headerSizeInBytes() { if (headerSize != 0) { return headerSize; } - if (VM.getVM().isCompressedKlassPointersEnabled()) { - headerSize = typeSize; - } else { - headerSize = VM.getVM().alignUp(typeSize + VM.getVM().getIntSize(), - VM.getVM().getHeapWordSize()); - } + headerSize = lengthOffsetInBytes() + VM.getVM().getIntSize(); return headerSize; } - private static long headerSize(BasicType type) { - if (Universe.elementTypeShouldBeAligned(type)) { - return alignObjectSize(headerSizeInBytes())/VM.getVM().getHeapWordSize(); - } else { - return headerSizeInBytes()/VM.getVM().getHeapWordSize(); - } - } - - private long lengthOffsetInBytes() { + private static long lengthOffsetInBytes() { if (lengthOffsetInBytes != 0) { return lengthOffsetInBytes; } @@ -108,7 +107,13 @@ public long getObjectSize() { } public static long baseOffsetInBytes(BasicType type) { - return headerSize(type) * VM.getVM().getHeapWordSize(); + long typeSizeInBytes = headerSizeInBytes(); + if (elementTypeShouldBeAligned(type)) { + VM vm = VM.getVM(); + return vm.alignUp(typeSizeInBytes, vm.getVM().getHeapWordSize()); + } else { + return typeSizeInBytes; + } } public boolean isArray() { return true; } diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ClassUseWriter.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ClassUseWriter.java index ddc8710e517..589854cacd6 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ClassUseWriter.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ClassUseWriter.java @@ -60,6 +60,9 @@ public class ClassUseWriter extends SubWriterHolderWriter { final TypeElement typeElement; Set pkgToPackageAnnotations = null; final Map> pkgToClassTypeParameter; + final Map> pkgToSubclassTypeParameter; + final Map> pkgToSubinterfaceTypeParameter; + final Map> pkgToImplementsTypeParameter; final Map> pkgToClassAnnotations; final Map> pkgToMethodTypeParameter; final Map> pkgToMethodArgTypeParameter; @@ -105,6 +108,9 @@ public ClassUseWriter(HtmlConfiguration configuration, configuration.currentTypeElement = typeElement; this.pkgSet = new TreeSet<>(comparators.packageComparator()); this.pkgToClassTypeParameter = pkgDivide(mapper.classToClassTypeParam); + this.pkgToSubclassTypeParameter = pkgDivide(mapper.classToSubclassTypeParam); + this.pkgToSubinterfaceTypeParameter = pkgDivide(mapper.classToSubinterfaceTypeParam); + this.pkgToImplementsTypeParameter = pkgDivide(mapper.classToImplementsTypeParam); this.pkgToClassAnnotations = pkgDivide(mapper.classToClassAnnotations); this.pkgToMethodTypeParameter = pkgDivide(mapper.classToMethodTypeParam); this.pkgToMethodArgTypeParameter = pkgDivide(mapper.classToMethodArgTypeParam); @@ -338,6 +344,15 @@ protected void addClassUse(PackageElement pkg, Content content) { classSubWriter.addUseInfo(pkgToImplementingClass.get(pkg), contents.getContent("doclet.ClassUse_ImplementingClass", classLink, pkgLink), content); + classSubWriter.addUseInfo(pkgToSubclassTypeParameter.get(pkg), + contents.getContent("doclet.ClassUse_SubclassTypeParameter", classLink, + pkgLink), content); + classSubWriter.addUseInfo(pkgToSubinterfaceTypeParameter.get(pkg), + contents.getContent("doclet.ClassUse_SubinterfaceTypeParameter", classLink, + pkgLink), content); + classSubWriter.addUseInfo(pkgToImplementsTypeParameter.get(pkg), + contents.getContent("doclet.ClassUse_ImplementsTypeParameter", classLink, + pkgLink), content); fieldSubWriter.addUseInfo(pkgToField.get(pkg), contents.getContent("doclet.ClassUse_Field", classLink, pkgLink), content); diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/Navigation.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/Navigation.java index 032cc9c40f7..a3456127598 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/Navigation.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/Navigation.java @@ -480,8 +480,7 @@ private void addSearch(Content target) { var inputText = HtmlTree.INPUT(HtmlAttr.InputType.TEXT, HtmlIds.SEARCH_INPUT) .put(HtmlAttr.PLACEHOLDER, resources.getText("doclet.search_placeholder")) .put(HtmlAttr.ARIA_LABEL, resources.getText("doclet.search_in_documentation")) - .put(HtmlAttr.AUTOCOMPLETE, "off") - .put(HtmlAttr.AUTOCAPITALIZE, "off"); + .put(HtmlAttr.AUTOCOMPLETE, "off"); var inputReset = HtmlTree.INPUT(HtmlAttr.InputType.RESET, HtmlIds.RESET_SEARCH) .put(HtmlAttr.VALUE, resources.getText("doclet.search_reset")); var searchDiv = HtmlTree.DIV(HtmlStyle.navListSearch) diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SearchWriter.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SearchWriter.java index feee351870b..8a2f0e29109 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SearchWriter.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SearchWriter.java @@ -84,8 +84,7 @@ protected void addSearchFileContents(Content contentTree) { .add(HtmlTree.DIV(HtmlTree.INPUT(HtmlAttr.InputType.TEXT, HtmlId.of("page-search-input")) .put(HtmlAttr.PLACEHOLDER, resources.getText("doclet.search_placeholder")) .put(HtmlAttr.ARIA_LABEL, resources.getText("doclet.search_in_documentation")) - .put(HtmlAttr.AUTOCOMPLETE, "off") - .put(HtmlAttr.AUTOCAPITALIZE, "off")) + .put(HtmlAttr.AUTOCOMPLETE, "off")) .add(HtmlTree.INPUT(HtmlAttr.InputType.RESET, HtmlId.of("page-search-reset")) .put(HtmlAttr.VALUE, resources.getText("doclet.search_reset")) .put(HtmlAttr.STYLE, "margin: 6px;")) diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/TableOfContents.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/TableOfContents.java index 8d478f8fa02..7cfbffb6cee 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/TableOfContents.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/TableOfContents.java @@ -95,8 +95,7 @@ protected Content toContent(boolean hasFilterInput) { .add(HtmlTree.INPUT(HtmlAttr.InputType.TEXT, HtmlStyle.filterInput) .put(HtmlAttr.PLACEHOLDER, writer.resources.getText("doclet.filter_label")) .put(HtmlAttr.ARIA_LABEL, writer.resources.getText("doclet.filter_table_of_contents")) - .put(HtmlAttr.AUTOCOMPLETE, "off") - .put(HtmlAttr.AUTOCAPITALIZE, "off")) + .put(HtmlAttr.AUTOCOMPLETE, "off")) .add(HtmlTree.INPUT(HtmlAttr.InputType.RESET, HtmlStyle.resetFilter) .put(HtmlAttr.VALUE, writer.resources.getText("doclet.filter_reset"))); } diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlAttr.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlAttr.java index 8fe06640907..1d0d54a0525 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlAttr.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlAttr.java @@ -39,7 +39,6 @@ public enum HtmlAttr { ARIA_ORIENTATION("aria-orientation"), ARIA_SELECTED("aria-selected"), AUTOCOMPLETE, - AUTOCAPITALIZE, CHECKED, CLASS, CLEAR, diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/script.js.template b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/script.js.template index e08ff5db68c..e14a2ef34cb 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/script.js.template +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/script.js.template @@ -246,6 +246,7 @@ document.addEventListener("DOMContentLoaded", function(e) { } document.querySelectorAll("input.filter-input").forEach(function(input) { input.removeAttribute("disabled"); + input.setAttribute("autocapitalize", "off"); input.value = ""; input.addEventListener("input", function(e) { const pattern = input.value ? input.value.trim() diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/search-page.js b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/search-page.js index 5b5b4659acd..bcbd9b59f31 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/search-page.js +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/search-page.js @@ -244,6 +244,7 @@ $(window).on("load", function() { setSearchUrl(); }); input.prop("disabled", false); + input.attr("autocapitalize", "off"); reset.prop("disabled", false); var urlParams = new URLSearchParams(window.location.search); @@ -263,4 +264,4 @@ $(window).on("load", function() { notify.html(messages.enterTerm); } input.select().focus(); -}); \ No newline at end of file +}); diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/search.js.template b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/search.js.template index debdeb38d58..c82964fa685 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/search.js.template +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/search.js.template @@ -426,6 +426,7 @@ $(function() { }); search.val(''); search.prop("disabled", false); + search.attr("autocapitalize", "off"); reset.prop("disabled", false); reset.click(function() { search.val('').focus(); diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/standard.properties b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/standard.properties index b83768ea31a..23bf1f3c194 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/standard.properties +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/standard.properties @@ -1,5 +1,5 @@ # -# Copyright (c) 2010, 2022, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2010, 2024, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -277,12 +277,14 @@ doclet.help.other_files.body=\ doclet.help.use.head=\ Use doclet.help.use.body=\ - Each documented package, class and interface has its own Use page. This page describes what \ - packages, classes, methods, constructors and fields use any part of the given class or \ - package. Given a class or interface A, its Use page includes subclasses of A, fields declared \ - as A, methods that return A, and methods and constructors with parameters of type A. \ - You can access this page by first going to the package, class or interface, then clicking on \ - the USE link in the navigation bar. + Each documented package, class or interface has its own Use page, which lists \ + packages, classes, interfaces, methods, constructors and fields that use any \ + part of that package, class or interface. Given a class or interface A, its \ + Use page includes subclasses or subinterfaces of A, fields declared as A, \ + methods that return A, methods and constructors with parameters of type A, \ + and subclasses or subinterfaces with parameters of type A. You can access \ + this page by first going to the package, class or interface, then clicking \ + on the USE link in the navigation bar. doclet.help.tree.head=\ Tree (Class Hierarchy) # 0: link to main Class Hierarchy page; 1: java.lang.Object @@ -380,6 +382,9 @@ doclet.ClassUse_Classes.in.0.used.by.1=Classes in {0} used by {1} doclet.ClassUse_PackageAnnotation=Packages with annotations of type {0} doclet.ClassUse_Annotation=Classes in {1} with annotations of type {0} doclet.ClassUse_TypeParameter=Classes in {1} with type parameters of type {0} +doclet.ClassUse_SubclassTypeParameter=Subclasses with type arguments of type {0} in {1} +doclet.ClassUse_SubinterfaceTypeParameter=Subinterfaces with type arguments of type {0} in {1} +doclet.ClassUse_ImplementsTypeParameter=Classes in {1} that implement interfaces with type arguments of type {0} doclet.ClassUse_MethodTypeParameter=Methods in {1} with type parameters of type {0} doclet.ClassUse_FieldTypeParameter=Fields in {1} with type parameters of type {0} doclet.ClassUse_FieldAnnotations=Fields in {1} with annotations of type {0} diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/ClassUseMapper.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/ClassUseMapper.java index 3f16e3458fb..00a6f6d86ab 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/ClassUseMapper.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/ClassUseMapper.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2024, Oracle and/or its affiliates. All rights reserved. * 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,7 +92,22 @@ public class ClassUseMapper { /** * Mapping of TypeElements to list of TypeElements which implement this interface. */ - public Map> classToImplementingClass = new HashMap<>(); + public final Map> classToImplementingClass = new HashMap<>(); + + /** + * Mapping of TypeElements to list of TypeElements which use them in superclass type parameters. + */ + public final Map> classToSubclassTypeParam = new HashMap<>(); + + /** + * Mapping of TypeElements to list of TypeElements which use them in superinterface type parameters. + */ + public final Map> classToSubinterfaceTypeParam = new HashMap<>(); + + /** + * Mapping of TypeElements to list of TypeElements which use them in implemented interface type parameters. + */ + public final Map> classToImplementsTypeParam = new HashMap<>(); /** * Mapping of TypeElements to list of VariableElements declared as that class. @@ -214,6 +229,18 @@ public ClassUseMapper(BaseConfiguration configuration, ClassTree classTree) { PackageElement pkg = elementUtils.getPackageOf(aClass); mapAnnotations(classToPackageAnnotations, pkg, pkg); mapTypeParameters(classToClassTypeParam, aClass, aClass); + mapTypeParameters(classToSubclassTypeParam, aClass.getSuperclass(), aClass); + + if (utils.isInterface(aClass)) { + for (var superinterface : aClass.getInterfaces()) { + mapTypeParameters(classToSubinterfaceTypeParam, superinterface, aClass); + } + } else { + for (var superinterface : aClass.getInterfaces()) { + mapTypeParameters(classToImplementsTypeParam, superinterface, aClass); + } + } + mapAnnotations(classToClassAnnotations, aClass, aClass); VisibleMemberTable vmt = configuration.getVisibleMemberTable(aClass); diff --git a/src/jdk.jdwp.agent/unix/native/libjdwp/exec_md.c b/src/jdk.jdwp.agent/unix/native/libjdwp/exec_md.c index be868ba0687..a694bba93c4 100644 --- a/src/jdk.jdwp.agent/unix/native/libjdwp/exec_md.c +++ b/src/jdk.jdwp.agent/unix/native/libjdwp/exec_md.c @@ -62,7 +62,7 @@ static char *skipNonWhitespace(char *p) { // input/output/error file descriptors will not be closed // by this function. This function returns 0 on failure // and 1 on success. -int +static int closeDescriptors(void) { DIR *dp; @@ -115,7 +115,7 @@ closeDescriptors(void) // Does necessary housekeeping of a forked child process // (like closing copied file descriptors) before // execing the child process. This function never returns. -void +static void forkedChildProcess(const char *file, char *const argv[]) { /* Close all file descriptors that have been copied over diff --git a/src/jdk.jfr/share/classes/jdk/jfr/internal/dcmd/DCmdDump.java b/src/jdk.jfr/share/classes/jdk/jfr/internal/dcmd/DCmdDump.java index 6163c8c98ad..594e78bdbbf 100644 --- a/src/jdk.jfr/share/classes/jdk/jfr/internal/dcmd/DCmdDump.java +++ b/src/jdk.jfr/share/classes/jdk/jfr/internal/dcmd/DCmdDump.java @@ -201,59 +201,59 @@ public String[] printHelp() { Options: - begin (Optional) Specify the time from which recording data will be included - in the dump file. The format is specified as local time. - (STRING, no default value) + begin (Optional) Specify the time from which recording data will be + included in the dump file. The format is specified as local time. + (STRING, no default value) - end (Optional) Specify the time to which recording data will be included - in the dump file. The format is specified as local time. - (STRING, no default value) + end (Optional) Specify the time to which recording data will be included + in the dump file. The format is specified as local time. + (STRING, no default value) - Note: For both begin and end, the time must be in a format that can - be read by any of these methods: + Note: For both begin and end, the time must be in a format that can + be read by any of these methods: - java.time.LocalTime::parse(String), - java.time.LocalDateTime::parse(String) - java.time.Instant::parse(String) + java.time.LocalTime::parse(String), + java.time.LocalDateTime::parse(String) + java.time.Instant::parse(String) - For example, "13:20:15", "2020-03-17T09:00:00" or - "2020-03-17T09:00:00Z". + For example, "13:20:15", "2020-03-17T09:00:00" or + "2020-03-17T09:00:00Z". - Note: begin and end times correspond to the timestamps found within - the recorded information in the flight recording data. + Note: begin and end times correspond to the timestamps found within + the recorded information in the flight recording data. - Another option is to use a time relative to the current time that is - specified by a negative integer followed by "s", "m" or "h". - For example, "-12h", "-15m" or "-30s" + Another option is to use a time relative to the current time that is + specified by a negative integer followed by "s", "m" or "h". + For example, "-12h", "-15m" or "-30s" - filename (Optional) Name of the file to which the flight recording data is - dumped. If no filename is given, a filename is generated from the PID - and the current date. The filename may also be a directory in which - case, the filename is generated from the PID and the current date in - the specified directory. (STRING, no default value) + filename (Optional) Name of the file to which the flight recording data is + dumped. If no filename is given, a filename is generated from the PID + and the current date. The filename may also be a directory in which + case, the filename is generated from the PID and the current date in + the specified directory. (STRING, no default value) - Note: If a filename is given, '%%p' in the filename will be - replaced by the PID, and '%%t' will be replaced by the time in - 'yyyy_MM_dd_HH_mm_ss' format. + Note: If a filename is given, '%%p' in the filename will be + replaced by the PID, and '%%t' will be replaced by the time in + 'yyyy_MM_dd_HH_mm_ss' format. - maxage (Optional) Length of time for dumping the flight recording data to a - file. (INTEGER followed by 's' for seconds 'm' for minutes or 'h' for - hours, no default value) + maxage (Optional) Length of time for dumping the flight recording data to a + file. (INTEGER followed by 's' for seconds 'm' for minutes or 'h' for + hours, no default value) - maxsize (Optional) Maximum size for the amount of data to dump from a flight - recording in bytes if one of the following suffixes is not used: - 'm' or 'M' for megabytes OR 'g' or 'G' for gigabytes. - (STRING, no default value) + maxsize (Optional) Maximum size for the amount of data to dump from a flight + recording in bytes if one of the following suffixes is not used: + 'm' or 'M' for megabytes OR 'g' or 'G' for gigabytes. + (STRING, no default value) - name (Optional) Name of the recording. If no name is given, data from all - recordings is dumped. (STRING, no default value) + name (Optional) Name of the recording. If no name is given, data from all + recordings is dumped. (STRING, no default value) - path-to-gc-root (Optional) Flag for saving the path to garbage collection (GC) roots - at the time the recording data is dumped. The path information is - useful for finding memory leaks but collecting it can cause the - application to pause for a short period of time. Turn on this flag - only when you have an application that you suspect has a memory - leak. (BOOLEAN, false) + path-to-gc-roots (Optional) Flag for saving the path to garbage collection (GC) roots + at the time the recording data is dumped. The path information is + useful for finding memory leaks but collecting it can cause the + application to pause for a short period of time. Turn on this flag + only when you have an application that you suspect has a memory + leak. (BOOLEAN, false) Options must be specified using the or = syntax. @@ -265,7 +265,7 @@ public String[] printHelp() { $ jcmd JFR.dump name=1 filename=%s $ jcmd JFR.dump maxage=1h $ jcmd JFR.dump maxage=1h maxsize=50M - $ jcmd JFR.dump fillename=leaks.jfr path-to-gc-root=true + $ jcmd JFR.dump filename=leaks.jfr path-to-gc-roots=true $ jcmd JFR.dump begin=13:15 $ jcmd JFR.dump begin=13:15 end=21:30:00 $ jcmd JFR.dump end=18:00 maxage=10m diff --git a/src/jdk.jfr/share/classes/jdk/jfr/internal/dcmd/DCmdStart.java b/src/jdk.jfr/share/classes/jdk/jfr/internal/dcmd/DCmdStart.java index a7e423e549a..5f83dee1182 100644 --- a/src/jdk.jfr/share/classes/jdk/jfr/internal/dcmd/DCmdStart.java +++ b/src/jdk.jfr/share/classes/jdk/jfr/internal/dcmd/DCmdStart.java @@ -319,82 +319,82 @@ private boolean hasJDKEvents(Map settings) { @Override public String[] printHelp() { - // 0123456789001234567890012345678900123456789001234567890012345678900123456789001234567890 + // 0123456789001234567890012345678900123456789001234567890012345678900123456789001234567890 return """ Syntax : JFR.start [options] Options: - delay (Optional) Length of time to wait before starting to record - (INTEGER followed by 's' for seconds 'm' for minutes or h' for - hours, 0s) - - disk (Optional) Flag for also writing the data to disk while recording - (BOOLEAN, true) - - dumponexit (Optional) Flag for writing the recording to disk when the Java - Virtual Machine (JVM) shuts down. If set to 'true' and no value - is given for filename, the recording is written to a file in the - directory where the process was started. The file name is a - system-generated name that contains the process ID, the recording - ID and the current time stamp. (For example: - id-1-2021_09_14_09_00.jfr) (BOOLEAN, false) - - duration (Optional) Length of time to record. Note that 0s means forever - (INTEGER followed by 's' for seconds 'm' for minutes or 'h' for - hours, 0s) - - filename (Optional) Name of the file to which the flight recording data is - written when the recording is stopped. If no filename is given, a - filename is generated from the PID and the current date and is - placed in the directory where the process was started. The - filename may also be a directory in which case, the filename is - generated from the PID and the current date in the specified - directory. (STRING, no default value) - - Note: If a filename is given, '%%p' in the filename will be - replaced by the PID, and '%%t' will be replaced by the time in - 'yyyy_MM_dd_HH_mm_ss' format. - - maxage (Optional) Maximum time to keep the recorded data on disk. This - parameter is valid only when the disk parameter is set to true. - Note 0s means forever. (INTEGER followed by 's' for seconds 'm' - for minutes or 'h' for hours, 0s) - - maxsize (Optional) Maximum size of the data to keep on disk in bytes if - one of the following suffixes is not used: 'm' or 'M' for - megabytes OR 'g' or 'G' for gigabytes. This parameter is valid - only when the disk parameter is set to 'true'. The value must not - be less than the value for the maxchunksize parameter set with - the JFR.configure command. (STRING, 0 (no max size)) - - name (Optional) Name of the recording. If no name is provided, a name - is generated. Make note of the generated name that is shown in - the response to the command so that you can use it with other - commands. (STRING, system-generated default name) - - path-to-gc-root (Optional) Flag for saving the path to garbage collection (GC) - roots at the end of a recording. The path information is useful - for finding memory leaks but collecting it is time consuming. - Turn on this flag only when you have an application that you - suspect has a memory leak. If the settings parameter is set to - 'profile', then the information collected includes the stack - trace from where the potential leaking object was allocated. - (BOOLEAN, false) - - settings (Optional) Name of the settings file that identifies which events - to record. To specify more than one file, use the settings - parameter repeatedly. Include the path if the file is not in - JAVA-HOME/lib/jfr. The following profiles are included with the - JDK in the JAVA-HOME/lib/jfr directory: 'default.jfc': collects a - predefined set of information with low overhead, so it has minimal - impact on performance and can be used with recordings that run - continuously; 'profile.jfc': Provides more data than the - 'default.jfc' profile, but with more overhead and impact on - performance. Use this configuration for short periods of time - when more information is needed. Use none to start a recording - without a predefined configuration file. (STRING, - JAVA-HOME/lib/jfr/default.jfc) + delay (Optional) Length of time to wait before starting to record + (INTEGER followed by 's' for seconds 'm' for minutes or h' for + hours, 0s) + + disk (Optional) Flag for also writing the data to disk while recording + (BOOLEAN, true) + + dumponexit (Optional) Flag for writing the recording to disk when the Java + Virtual Machine (JVM) shuts down. If set to 'true' and no value + is given for filename, the recording is written to a file in the + directory where the process was started. The file name is a + system-generated name that contains the process ID, the recording + ID and the current time stamp. (For example: + id-1-2021_09_14_09_00.jfr) (BOOLEAN, false) + + duration (Optional) Length of time to record. Note that 0s means forever + (INTEGER followed by 's' for seconds 'm' for minutes or 'h' for + hours, 0s) + + filename (Optional) Name of the file to which the flight recording data is + written when the recording is stopped. If no filename is given, a + filename is generated from the PID and the current date and is + placed in the directory where the process was started. The + filename may also be a directory in which case, the filename is + generated from the PID and the current date in the specified + directory. (STRING, no default value) + + Note: If a filename is given, '%%p' in the filename will be + replaced by the PID, and '%%t' will be replaced by the time in + 'yyyy_MM_dd_HH_mm_ss' format. + + maxage (Optional) Maximum time to keep the recorded data on disk. This + parameter is valid only when the disk parameter is set to true. + Note 0s means forever. (INTEGER followed by 's' for seconds 'm' + for minutes or 'h' for hours, 0s) + + maxsize (Optional) Maximum size of the data to keep on disk in bytes if + one of the following suffixes is not used: 'm' or 'M' for + megabytes OR 'g' or 'G' for gigabytes. This parameter is valid + only when the disk parameter is set to 'true'. The value must not + be less than the value for the maxchunksize parameter set with + the JFR.configure command. (STRING, 0 (no max size)) + + name (Optional) Name of the recording. If no name is provided, a name + is generated. Make note of the generated name that is shown in + the response to the command so that you can use it with other + commands. (STRING, system-generated default name) + + path-to-gc-roots (Optional) Flag for saving the path to garbage collection (GC) + roots at the end of a recording. The path information is useful + for finding memory leaks but collecting it is time consuming. + Turn on this flag only when you have an application that you + suspect has a memory leak. If the settings parameter is set to + 'profile', then the information collected includes the stack + trace from where the potential leaking object was allocated. + (BOOLEAN, false) + + settings (Optional) Name of the settings file that identifies which events + to record. To specify more than one file, use the settings + parameter repeatedly. Include the path if the file is not in + JAVA-HOME/lib/jfr. The following profiles are included with the + JDK in the JAVA-HOME/lib/jfr directory: 'default.jfc': collects a + predefined set of information with low overhead, so it has minimal + impact on performance and can be used with recordings that run + continuously; 'profile.jfc': Provides more data than the + 'default.jfc' profile, but with more overhead and impact on + performance. Use this configuration for short periods of time + when more information is needed. Use none to start a recording + without a predefined configuration file. (STRING, + JAVA-HOME/lib/jfr/default.jfc) Event settings and .jfc options can also be specified using the following syntax: @@ -418,9 +418,9 @@ Virtual Machine (JVM) shuts down. If set to 'true' and no value $ jcmd JFR.start filename=dump.jfr $ jcmd JFR.start filename=%s $ jcmd JFR.start dumponexit=true - $ jcmd JFR.start maxage=1h,maxsize=1000M + $ jcmd JFR.start maxage=1h maxsize=1000M $ jcmd JFR.start settings=profile - $ jcmd JFR.start delay=5m,settings=my.jfc + $ jcmd JFR.start delay=5m settings=my.jfc $ jcmd JFR.start gc=high method-profiling=high $ jcmd JFR.start jdk.JavaMonitorEnter#threshold=1ms $ jcmd JFR.start +HelloWorld#enabled=true +HelloWorld#stackTrace=true diff --git a/src/jdk.jfr/share/classes/jdk/jfr/internal/tool/Summary.java b/src/jdk.jfr/share/classes/jdk/jfr/internal/tool/Summary.java index a092cf69094..12a468b2e89 100644 --- a/src/jdk.jfr/share/classes/jdk/jfr/internal/tool/Summary.java +++ b/src/jdk.jfr/share/classes/jdk/jfr/internal/tool/Summary.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -144,6 +144,7 @@ private void printInformation(Path p) throws IOException { println(" Start: " + DATE_FORMAT.format(Instant.ofEpochSecond(epochSeconds, adjustNanos)) + " (UTC)"); println(" Duration: " + (totalDuration + 500_000_000) / 1_000_000_000 + " s"); List statsList = new ArrayList<>(stats.values()); + statsList.sort((u, v) -> u.name.compareTo(v.name)); statsList.sort((u, v) -> Long.compare(v.count, u.count)); println(); String header = " Count Size (bytes) "; diff --git a/src/jdk.security.jgss/share/classes/com/sun/security/jgss/AuthorizationDataEntry.java b/src/jdk.security.jgss/share/classes/com/sun/security/jgss/AuthorizationDataEntry.java index eabaac94ad5..3bb51f1ccb2 100644 --- a/src/jdk.security.jgss/share/classes/com/sun/security/jgss/AuthorizationDataEntry.java +++ b/src/jdk.security.jgss/share/classes/com/sun/security/jgss/AuthorizationDataEntry.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,6 +27,8 @@ /** * Kerberos 5 AuthorizationData entry. + * + * @since 1.7 */ public final class AuthorizationDataEntry { diff --git a/src/jdk.security.jgss/share/classes/com/sun/security/jgss/ExtendedGSSContext.java b/src/jdk.security.jgss/share/classes/com/sun/security/jgss/ExtendedGSSContext.java index 7011f5d8dc0..8daa300ea5d 100644 --- a/src/jdk.security.jgss/share/classes/com/sun/security/jgss/ExtendedGSSContext.java +++ b/src/jdk.security.jgss/share/classes/com/sun/security/jgss/ExtendedGSSContext.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -31,6 +31,8 @@ * The extended GSSContext interface for supporting additional * functionalities not defined by {@code org.ietf.jgss.GSSContext}, * such as querying context-specific attributes. + * + * @since 1.7 */ public interface ExtendedGSSContext extends GSSContext { diff --git a/src/jdk.security.jgss/share/classes/com/sun/security/jgss/GSSUtil.java b/src/jdk.security.jgss/share/classes/com/sun/security/jgss/GSSUtil.java index b94e2877f08..0aca9771d6d 100644 --- a/src/jdk.security.jgss/share/classes/com/sun/security/jgss/GSSUtil.java +++ b/src/jdk.security.jgss/share/classes/com/sun/security/jgss/GSSUtil.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -32,6 +32,8 @@ /** * GSS-API Utilities for using in conjunction with Sun Microsystem's * implementation of Java GSS-API. + * + * @since 1.4 */ public class GSSUtil { /** diff --git a/src/jdk.security.jgss/share/classes/com/sun/security/jgss/InquireSecContextPermission.java b/src/jdk.security.jgss/share/classes/com/sun/security/jgss/InquireSecContextPermission.java index 618d3c74752..33ac51e8d51 100644 --- a/src/jdk.security.jgss/share/classes/com/sun/security/jgss/InquireSecContextPermission.java +++ b/src/jdk.security.jgss/share/classes/com/sun/security/jgss/InquireSecContextPermission.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -34,6 +34,8 @@ * method. * *

    The target name is the {@link InquireType} allowed. + * + * @since 1.7 */ public final class InquireSecContextPermission extends BasicPermission { private static final long serialVersionUID = -7131173349668647297L; diff --git a/src/jdk.security.jgss/share/classes/com/sun/security/jgss/InquireType.java b/src/jdk.security.jgss/share/classes/com/sun/security/jgss/InquireType.java index 6240f0d3ddf..b7f285bf836 100644 --- a/src/jdk.security.jgss/share/classes/com/sun/security/jgss/InquireType.java +++ b/src/jdk.security.jgss/share/classes/com/sun/security/jgss/InquireType.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,6 +28,8 @@ /** * Attribute types that can be specified as an argument of * {@link com.sun.security.jgss.ExtendedGSSContext#inquireSecContext} + * + * @since 1.7 */ public enum InquireType { /** diff --git a/src/jdk.security.jgss/share/classes/com/sun/security/jgss/package-info.java b/src/jdk.security.jgss/share/classes/com/sun/security/jgss/package-info.java index bb5a4f2b38c..b7010b2e740 100644 --- a/src/jdk.security.jgss/share/classes/com/sun/security/jgss/package-info.java +++ b/src/jdk.security.jgss/share/classes/com/sun/security/jgss/package-info.java @@ -26,5 +26,7 @@ /** * This package defines classes and interfaces for the JDK extensions * to the GSS-API. + * + * @since 1.4 */ package com.sun.security.jgss; diff --git a/src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipCoder.java b/src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipCoder.java index 9589b460a41..023e071c48e 100644 --- a/src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipCoder.java +++ b/src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipCoder.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -38,7 +38,7 @@ import static java.nio.charset.StandardCharsets.UTF_8; /** - * Utility class for zipfile name and comment decoding and encoding + * Utility class for ZIP file entry name and comment decoding and encoding * * @author Xueming Shen */ diff --git a/src/jdk.zipfs/share/classes/module-info.java b/src/jdk.zipfs/share/classes/module-info.java index b996006b4fe..52a5aed98f9 100644 --- a/src/jdk.zipfs/share/classes/module-info.java +++ b/src/jdk.zipfs/share/classes/module-info.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,28 +33,28 @@ import java.util.Set; /** - * Provides the implementation of the Zip file system provider. - * The Zip file system provider treats the contents of a Zip or JAR file as a file system. + * Provides the implementation of the ZIP file system provider. + * The ZIP file system provider treats the contents of a ZIP or JAR file as a file system. * - *

    Accessing a Zip File System

    + *

    Accessing a ZIP File System

    * * The {@linkplain java.nio.file.FileSystems FileSystems} {@code newFileSystem} * static factory methods can be used to: *
      - *
    • Create a Zip file system
    • - *
    • Open an existing file as a Zip file system
    • + *
    • Create a ZIP file system
    • + *
    • Open an existing file as a ZIP file system
    • *
    * - * The Zip file system provider does not support opening an existing Zip file + * The ZIP file system provider does not support opening an existing ZIP file * that contains entries with "." or ".." in its name elements. * - *

    URI Scheme Used to Identify the Zip File System

    + *

    URI Scheme Used to Identify the ZIP File System

    * * The URI {@link java.net.URI#getScheme scheme} that identifies the ZIP file system is {@code jar}. * *

    POSIX file attributes

    * - * A Zip file system supports a file attribute {@link FileAttributeView view} + * A ZIP file system supports a file attribute {@link FileAttributeView view} * named "{@code zip}" that defines the following file attribute: * *
    @@ -76,8 +76,8 @@ *
    * * The "permissions" attribute is the set of access permissions that are optionally - * stored for entries in a Zip file. The value of the attribute is {@code null} - * for entries that do not have access permissions. Zip file systems do not + * stored for entries in a ZIP file. The value of the attribute is {@code null} + * for entries that do not have access permissions. ZIP file systems do not * enforce access permissions. * *

    The "permissions" attribute may be read and set using the @@ -92,12 +92,12 @@ * } * } * - *

    In addition to the "{@code zip}" view, a Zip file system optionally supports + *

    In addition to the "{@code zip}" view, a ZIP file system optionally supports * the {@link PosixFileAttributeView} ("{@code posix}"). * This view extends the "{@code basic}" view with type safe access to the * {@link PosixFileAttributes#owner() owner}, {@link PosixFileAttributes#group() group-owner}, * and {@link PosixFileAttributes#permissions() permissions} attributes. The - * "{@code posix}" view is only supported when the Zip file system is created with + * "{@code posix}" view is only supported when the ZIP file system is created with * the provider property "{@code enablePosixFileAttributes}" set to "{@code true}". * The following creates a file system with this property and reads the access * permissions of a file: @@ -110,16 +110,16 @@ * } * *

    The file owner and group owner attributes are not persisted, meaning they are - * not stored in the zip file. The "{@code defaultOwner}" and "{@code defaultGroup}" + * not stored in the ZIP file. The "{@code defaultOwner}" and "{@code defaultGroup}" * provider properties (listed below) can be used to configure the default values * for these attributes. If these properties are not set then the file owner - * defaults to the owner of the zip file, and the group owner defaults to the - * zip file's group owner (or the file owner on platforms that don't support a + * defaults to the owner of the ZIP file, and the group owner defaults to the + * ZIP file's group owner (or the file owner on platforms that don't support a * group owner). * *

    The "{@code permissions}" attribute is not optional in the "{@code posix}" * view so a default set of permissions are used for entries that do not have - * access permissions stored in the Zip file. The default set of permissions + * access permissions stored in the ZIP file. The default set of permissions * are *

      *
    • {@link PosixFilePermission#OWNER_READ OWNER_READ}
    • @@ -129,14 +129,14 @@ * The default permissions can be configured with the "{@code defaultPermissions}" * property described below. * - *

      Zip File System Properties

      + *

      ZIP File System Properties

      * * The following properties may be specified when creating a Zip * file system: * * * * @@ -153,8 +153,8 @@ * * * * * @@ -163,7 +163,7 @@ * * * * @@ -171,7 +171,7 @@ * * * * @@ -181,7 +181,7 @@ * {@link java.lang.String} * * * @@ -191,7 +191,7 @@ * {@link java.lang.String} * * * @@ -201,7 +201,7 @@ * or {@link java.lang.String} * * @@ -212,16 +212,16 @@ * *
      * Configurable properties that may be specified when creating - * a new Zip file system + * a new ZIP file system *
      {@link java.lang.String} or {@link java.lang.Boolean}false - * If the value is {@code true}, the Zip file system provider - * creates a new Zip or JAR file if it does not exist. + * If the value is {@code true}, the ZIP file system provider + * creates a new ZIP or JAR file if it does not exist. *
      UTF-8 * The value indicates the encoding scheme for the - * names of the entries in the Zip or JAR file. + * names of the entries in the ZIP or JAR file. *
      {@link java.lang.String} or {@link java.lang.Boolean}false - * If the value is {@code true}, the Zip file system will support + * If the value is {@code true}, the ZIP file system will support * the {@link java.nio.file.attribute.PosixFileAttributeView PosixFileAttributeView}. *
      null/unset - * Override the default owner for entries in the Zip file system.
      + * Override the default owner for entries in the ZIP file system.
      * The value can be a UserPrincipal or a String value that is used as the UserPrincipal's name. *
      null/unset - * Override the default group for entries in the Zip file system.
      + * Override the default group for entries in the ZIP file system.
      * The value can be a GroupPrincipal or a String value that is used as the GroupPrincipal's name. *
      null/unset - * Override the default Set of permissions for entries in the Zip file system.
      + * Override the default Set of permissions for entries in the ZIP file system.
      * The value can be a {@link java.util.Set Set}<{@link java.nio.file.attribute.PosixFilePermission PosixFilePermission}> or
      * a String that is parsed by {@link java.nio.file.attribute.PosixFilePermissions#fromString PosixFilePermissions::fromString} *
      "DEFLATED" * The value representing the compression method to use when writing entries - * to the Zip file system. + * to the ZIP file system. *
        *
      • - * If the value is {@code "STORED"}, the Zip file system provider will - * not compress entries when writing to the Zip file system. + * If the value is {@code "STORED"}, the ZIP file system provider will + * not compress entries when writing to the ZIP file system. *
      • *
      • * If the value is {@code "DEFLATED"} or the property is not set, - * the Zip file system provider will use data compression when - * writing entries to the Zip file system. + * the ZIP file system provider will use data compression when + * writing entries to the ZIP file system. *
      • *
      • * If the value is not {@code "STORED"} or {@code "DEFLATED"}, an @@ -270,7 +270,7 @@ * *

        Examples:

        * - * Construct a new Zip file system that is identified by a URI. If the Zip file does not exist, + * Construct a new ZIP file system that is identified by a URI. If the ZIP file does not exist, * it will be created: *
          * {@code
        @@ -281,7 +281,7 @@
          * }
          * 
        * - * Construct a new Zip file system that is identified by specifying a path + * Construct a new ZIP file system that is identified by specifying a path * and using automatic file type detection. Iterate from the root of the JAR displaying each * found entry: *
        diff --git a/test/hotspot/gtest/gc/g1/test_freeRegionList.cpp b/test/hotspot/gtest/gc/g1/test_freeRegionList.cpp
        index 1ad21b0d9a0..2e665e98c00 100644
        --- a/test/hotspot/gtest/gc/g1/test_freeRegionList.cpp
        +++ b/test/hotspot/gtest/gc/g1/test_freeRegionList.cpp
        @@ -25,9 +25,9 @@
         #include "gc/g1/g1BlockOffsetTable.inline.hpp"
         #include "gc/g1/g1CardSet.inline.hpp"
         #include "gc/g1/g1CollectedHeap.inline.hpp"
        +#include "gc/g1/g1HeapRegion.inline.hpp"
        +#include "gc/g1/g1HeapRegionSet.hpp"
         #include "gc/g1/g1RegionToSpaceMapper.hpp"
        -#include "gc/g1/heapRegion.inline.hpp"
        -#include "gc/g1/heapRegionSet.hpp"
         #include "memory/allocation.hpp"
         #include "memory/memRegion.hpp"
         #include "memory/virtualspace.hpp"
        diff --git a/test/hotspot/gtest/gc/g1/test_g1CardSet.cpp b/test/hotspot/gtest/gc/g1/test_g1CardSet.cpp
        index c455deacb26..69c1cab037a 100644
        --- a/test/hotspot/gtest/gc/g1/test_g1CardSet.cpp
        +++ b/test/hotspot/gtest/gc/g1/test_g1CardSet.cpp
        @@ -25,8 +25,8 @@
         #include "gc/g1/g1CardSet.inline.hpp"
         #include "gc/g1/g1CardSetContainers.hpp"
         #include "gc/g1/g1CardSetMemory.hpp"
        +#include "gc/g1/g1HeapRegionRemSet.hpp"
         #include "gc/g1/g1MonotonicArenaFreePool.hpp"
        -#include "gc/g1/heapRegionRemSet.hpp"
         #include "gc/shared/gcTraceTime.inline.hpp"
         #include "gc/shared/workerThread.hpp"
         #include "logging/log.hpp"
        diff --git a/test/hotspot/gtest/gc/g1/test_g1CardSetContainers.cpp b/test/hotspot/gtest/gc/g1/test_g1CardSetContainers.cpp
        index 0ad3aed18cc..21ae6e9c1da 100644
        --- a/test/hotspot/gtest/gc/g1/test_g1CardSetContainers.cpp
        +++ b/test/hotspot/gtest/gc/g1/test_g1CardSetContainers.cpp
        @@ -23,7 +23,7 @@
         
         #include "precompiled.hpp"
         #include "gc/g1/g1CardSetContainers.inline.hpp"
        -#include "gc/g1/heapRegionBounds.inline.hpp"
        +#include "gc/g1/g1HeapRegionBounds.inline.hpp"
         #include "gc/shared/cardTable.hpp"
         #include "memory/allocation.inline.hpp"
         #include "utilities/globalDefinitions.hpp"
        diff --git a/test/hotspot/gtest/gc/g1/test_heapRegion.cpp b/test/hotspot/gtest/gc/g1/test_heapRegion.cpp
        index 80ebe1b0c21..e329a2b80ae 100644
        --- a/test/hotspot/gtest/gc/g1/test_heapRegion.cpp
        +++ b/test/hotspot/gtest/gc/g1/test_heapRegion.cpp
        @@ -25,7 +25,7 @@
         #include "gc/g1/g1BlockOffsetTable.hpp"
         #include "gc/g1/g1CollectedHeap.hpp"
         #include "gc/g1/g1ConcurrentMarkBitMap.inline.hpp"
        -#include "gc/g1/heapRegion.inline.hpp"
        +#include "gc/g1/g1HeapRegion.inline.hpp"
         #include "gc/shared/referenceProcessor.hpp"
         #include "runtime/interfaceSupport.inline.hpp"
         #include "runtime/vmOperations.hpp"
        diff --git a/test/hotspot/gtest/oops/test_arrayOop.cpp b/test/hotspot/gtest/oops/test_arrayOop.cpp
        index 84063813be3..e67e6e6c13b 100644
        --- a/test/hotspot/gtest/oops/test_arrayOop.cpp
        +++ b/test/hotspot/gtest/oops/test_arrayOop.cpp
        @@ -1,5 +1,5 @@
         /*
        - * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
        + * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved.
          * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
          *
          * This code is free software; you can redistribute it and/or modify it
        @@ -27,19 +27,11 @@
         #include "unittest.hpp"
         #include "utilities/globalDefinitions.hpp"
         
        -class arrayOopDescTest {
        - public:
        -
        -  static int header_size_in_bytes() {
        -    return arrayOopDesc::header_size_in_bytes();
        -  }
        -};
        -
         static bool check_max_length_overflow(BasicType type) {
           julong length = arrayOopDesc::max_array_length(type);
           julong bytes_per_element = type2aelembytes(type);
           julong bytes = length * bytes_per_element
        -          + arrayOopDescTest::header_size_in_bytes();
        +          + arrayOopDesc::base_offset_in_bytes(type);
           return (julong) (size_t) bytes == bytes;
         }
         
        @@ -87,3 +79,47 @@ TEST_VM(arrayOopDesc, narrowOop) {
           ASSERT_PRED1(check_max_length_overflow, T_NARROWOOP);
         }
         // T_VOID and T_ADDRESS are not supported by max_array_length()
        +
        +TEST_VM(arrayOopDesc, base_offset) {
        +#ifdef _LP64
        +  if (UseCompressedClassPointers) {
        +    EXPECT_EQ(arrayOopDesc::base_offset_in_bytes(T_BOOLEAN), 16);
        +    EXPECT_EQ(arrayOopDesc::base_offset_in_bytes(T_BYTE),    16);
        +    EXPECT_EQ(arrayOopDesc::base_offset_in_bytes(T_SHORT),   16);
        +    EXPECT_EQ(arrayOopDesc::base_offset_in_bytes(T_CHAR),    16);
        +    EXPECT_EQ(arrayOopDesc::base_offset_in_bytes(T_INT),     16);
        +    EXPECT_EQ(arrayOopDesc::base_offset_in_bytes(T_FLOAT),   16);
        +    EXPECT_EQ(arrayOopDesc::base_offset_in_bytes(T_LONG),    16);
        +    EXPECT_EQ(arrayOopDesc::base_offset_in_bytes(T_DOUBLE),  16);
        +    EXPECT_EQ(arrayOopDesc::base_offset_in_bytes(T_OBJECT),  16);
        +    EXPECT_EQ(arrayOopDesc::base_offset_in_bytes(T_ARRAY),   16);
        +  } else {
        +    EXPECT_EQ(arrayOopDesc::base_offset_in_bytes(T_BOOLEAN), 20);
        +    EXPECT_EQ(arrayOopDesc::base_offset_in_bytes(T_BYTE),    20);
        +    EXPECT_EQ(arrayOopDesc::base_offset_in_bytes(T_SHORT),   20);
        +    EXPECT_EQ(arrayOopDesc::base_offset_in_bytes(T_CHAR),    20);
        +    EXPECT_EQ(arrayOopDesc::base_offset_in_bytes(T_INT),     20);
        +    EXPECT_EQ(arrayOopDesc::base_offset_in_bytes(T_FLOAT),   20);
        +    EXPECT_EQ(arrayOopDesc::base_offset_in_bytes(T_LONG),    24);
        +    EXPECT_EQ(arrayOopDesc::base_offset_in_bytes(T_DOUBLE),  24);
        +    if (UseCompressedOops) {
        +      EXPECT_EQ(arrayOopDesc::base_offset_in_bytes(T_OBJECT), 20);
        +      EXPECT_EQ(arrayOopDesc::base_offset_in_bytes(T_ARRAY),  20);
        +    } else {
        +      EXPECT_EQ(arrayOopDesc::base_offset_in_bytes(T_OBJECT), 24);
        +      EXPECT_EQ(arrayOopDesc::base_offset_in_bytes(T_ARRAY),  24);
        +    }
        +  }
        +#else
        +  EXPECT_EQ(arrayOopDesc::base_offset_in_bytes(T_BOOLEAN), 12);
        +  EXPECT_EQ(arrayOopDesc::base_offset_in_bytes(T_BYTE),    12);
        +  EXPECT_EQ(arrayOopDesc::base_offset_in_bytes(T_SHORT),   12);
        +  EXPECT_EQ(arrayOopDesc::base_offset_in_bytes(T_CHAR),    12);
        +  EXPECT_EQ(arrayOopDesc::base_offset_in_bytes(T_INT),     12);
        +  EXPECT_EQ(arrayOopDesc::base_offset_in_bytes(T_FLOAT),   12);
        +  EXPECT_EQ(arrayOopDesc::base_offset_in_bytes(T_LONG),    16);
        +  EXPECT_EQ(arrayOopDesc::base_offset_in_bytes(T_DOUBLE),  16);
        +  EXPECT_EQ(arrayOopDesc::base_offset_in_bytes(T_OBJECT),  12);
        +  EXPECT_EQ(arrayOopDesc::base_offset_in_bytes(T_ARRAY),   12);
        +#endif
        +}
        diff --git a/test/hotspot/gtest/oops/test_objArrayOop.cpp b/test/hotspot/gtest/oops/test_objArrayOop.cpp
        new file mode 100644
        index 00000000000..60cf6242dd5
        --- /dev/null
        +++ b/test/hotspot/gtest/oops/test_objArrayOop.cpp
        @@ -0,0 +1,57 @@
        +/*
        + * Copyright Amazon.com Inc. or its affiliates. All rights reserved.
        + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
        + *
        + * This code is free software; you can redistribute it and/or modify it
        + * under the terms of the GNU General Public License version 2 only, as
        + * published by the Free Software Foundation.
        + *
        + * This code is distributed in the hope that it will be useful, but WITHOUT
        + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
        + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
        + * version 2 for more details (a copy is included in the LICENSE file that
        + * accompanied this code).
        + *
        + * You should have received a copy of the GNU General Public License version
        + * 2 along with this work; if not, write to the Free Software Foundation,
        + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
        + *
        + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
        + * or visit www.oracle.com if you need additional information or have any
        + * questions.
        + */
        +
        +#include "precompiled.hpp"
        +#include "oops/objArrayOop.hpp"
        +#include "unittest.hpp"
        +#include "utilities/globalDefinitions.hpp"
        +
        +TEST_VM(objArrayOop, osize) {
        +  static const struct {
        +    int objal; bool ccp; bool coops; int result;
        +  } x[] = {
        +//    ObjAligInB, UseCCP, UseCoops, object size in heap words
        +#ifdef _LP64
        +    { 8,          false,  false,    4 },  // 20 byte header, 8 byte oops
        +    { 8,          false,  true,     3 },  // 20 byte header, 4 byte oops
        +    { 8,          true,   false,    3 },  // 16 byte header, 8 byte oops
        +    { 8,          true,   true,     3 },  // 16 byte header, 4 byte oops
        +    { 16,         false,  false,    4 },  // 20 byte header, 8 byte oops, 16-byte align
        +    { 16,         false,  true,     4 },  // 20 byte header, 4 byte oops, 16-byte align
        +    { 16,         true,   false,    4 },  // 16 byte header, 8 byte oops, 16-byte align
        +    { 16,         true,   true,     4 },  // 16 byte header, 4 byte oops, 16-byte align
        +    { 256,        false,  false,    32 }, // 20 byte header, 8 byte oops, 256-byte align
        +    { 256,        false,  true,     32 }, // 20 byte header, 4 byte oops, 256-byte align
        +    { 256,        true,   false,    32 }, // 16 byte header, 8 byte oops, 256-byte align
        +    { 256,        true,   true,     32 }, // 16 byte header, 4 byte oops, 256-byte align
        +#else
        +    { 8,          false,  false,    4 }, // 12 byte header, 4 byte oops, wordsize 4
        +#endif
        +    { -1,         false,  false,   -1 }
        +  };
        +  for (int i = 0; x[i].result != -1; i++) {
        +    if (x[i].objal == (int)ObjectAlignmentInBytes && x[i].ccp == UseCompressedClassPointers && x[i].coops == UseCompressedOops) {
        +      EXPECT_EQ(objArrayOopDesc::object_size(1), (size_t)x[i].result);
        +    }
        +  }
        +}
        diff --git a/test/hotspot/jtreg/ProblemList.txt b/test/hotspot/jtreg/ProblemList.txt
        index 336a342b5a9..87d3f130ca6 100644
        --- a/test/hotspot/jtreg/ProblemList.txt
        +++ b/test/hotspot/jtreg/ProblemList.txt
        @@ -76,6 +76,8 @@ compiler/jvmci/TestUncaughtErrorInCompileMethod.java 8309073 generic-all
         compiler/floatingpoint/TestSubnormalFloat.java 8317810 generic-i586
         compiler/floatingpoint/TestSubnormalDouble.java 8317810 generic-i586
         
        +compiler/startup/StartupOutput.java 8326615 generic-x64
        +
         #############################################################################
         
         # :hotspot_gc
        diff --git a/test/hotspot/jtreg/compiler/locks/TestCoarsenedAndNestedLocksElimination.java b/test/hotspot/jtreg/compiler/locks/TestCoarsenedAndNestedLocksElimination.java
        new file mode 100644
        index 00000000000..d1b7a2eda9b
        --- /dev/null
        +++ b/test/hotspot/jtreg/compiler/locks/TestCoarsenedAndNestedLocksElimination.java
        @@ -0,0 +1,82 @@
        +/*
        + * Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved.
        + * 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 8324969
        + * @summary C2 incorrectly marks unbalanced (after coarsened locks were eliminated)
        + *          nested locks for elimination.
        + * @requires vm.compMode != "Xint"
        + * @run main/othervm -XX:-BackgroundCompilation TestCoarsenedAndNestedLocksElimination
        + */
        +
        +public class TestCoarsenedAndNestedLocksElimination {
        +
        +    public static void main(String[] strArr) {
        +        for (int i = 0; i < 12000; ++i) {
        +            test1(-1);
        +            test2(-1);
        +        }
        +    }
        +
        +    static synchronized int methodA(int var) {
        +        return var;
        +    }
        +
        +    static synchronized int methodB(int var) {
        +        return var;
        +    }
        +
        +    static int varA = 0;
        +    static int varB = 0;
        +
        +    static void test1(int var) {
        +        synchronized (TestNestedLocksElimination.class) {
        +            for (int i2 = 0; i2 < 3; i2++) { // Fully unrolled
        +                 varA = methodA(i2);         // Nested synchronized methods also use
        +                 varB = i2 + methodB(var);   // TestNestedLocksElimination.class for lock
        +            }
        +        }
        +        TestNestedLocksElimination t = new TestNestedLocksElimination(); // Triggers EA
        +    }
        +
        +    static boolean test2(int var) {
        +        synchronized (TestNestedLocksElimination.class) {
        +            for (int i1 = 0; i1 < 100; i1++) {
        +                switch (42) {
        +                case 42:
        +                    short[] sArr = new short[256]; // Big enough to avoid scalarization checks
        +                case 50:
        +                    for (int i2 = 2; i2 < 8; i2 += 2) { // Fully unrolled
        +                        for (int i3 = 1;;) {
        +                            int var1 = methodA(i2);
        +                            int var2 = i2 + methodB(i3);
        +                            break;
        +                        }
        +                    }
        +                }
        +            }
        +        }
        +        return var > 0;
        +    }
        +}
        diff --git a/test/hotspot/jtreg/compiler/loopopts/TestBaseCountedEndLoopUnswitchCandidate.java b/test/hotspot/jtreg/compiler/loopopts/TestBaseCountedEndLoopUnswitchCandidate.java
        new file mode 100644
        index 00000000000..62b7378ea85
        --- /dev/null
        +++ b/test/hotspot/jtreg/compiler/loopopts/TestBaseCountedEndLoopUnswitchCandidate.java
        @@ -0,0 +1,100 @@
        +/*
        + * Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved.
        + * 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 8325746
        + * @summary Test Loop Unswitching with BaseCountedLoopEnd nodes as unswitch candidate.
        + * @requires vm.compiler2.enabled
        + * @run main/othervm -XX:CompileCommand=compileonly,compiler.loopopts.TestBaseCountedEndLoopUnswitchCandidate::test*
        + *                   -Xcomp -XX:LoopMaxUnroll=0 -XX:-UseLoopPredicate -XX:-RangeCheckElimination
        + *                   compiler.loopopts.TestBaseCountedEndLoopUnswitchCandidate
        + * @run main compiler.loopopts.TestBaseCountedEndLoopUnswitchCandidate
        + */
        +
        +package compiler.loopopts;
        +
        +public class TestBaseCountedEndLoopUnswitchCandidate {
        +    static int iFld;
        +    static long lFld;
        +    static A a = new A();
        +    static boolean flag;
        +
        +    public static void main(String[] k) {
        +        for (int i = 0; i < 10000; i++) {
        +            testLongCountedLoopEnd();
        +            testCountedLoopEnd();
        +        }
        +    }
        +
        +    public static void testLongCountedLoopEnd() {
        +        long limit = lFld;
        +        for (int i = 0; i < 100; i++) {
        +
        +            // After peeling & IGNV:
        +            //      LongCountedEndLoop
        +            //           /      \
        +            //         True    False
        +            //        / \       /
        +            //  Store    Region
        +            //
        +            // LongCountedEndLoop has both paths inside loop and is therefore selected as unswitch candidate If in
        +            // Loop Unswitching.
        +
        +            // Use stride > Integer.MAX_VALUE such that LongCountedLoopNode is not split further into loop nests.
        +            for (long j = 0; j < limit; j+=2147483648L) {
        +                a.i += 34; // NullCheck with trap on false path -> reason to peel
        +                if (j > 0) { // After peeling: j > 0 always true -> loop folded away
        +                    break;
        +                }
        +            }
        +        }
        +    }
        +
        +    public static void testCountedLoopEnd() {
        +        int limit = iFld;
        +        for (int i = 0; i < 100; i++) {
        +
        +            // After peeling & IGNV:
        +            //        CountedLoopEnd
        +            //           /      \
        +            //         True    False
        +            //        / \       /
        +            //  Store    Region
        +            //
        +            // CountedEndLoop has both paths inside loop and is therefore selected as unswitch candidate If in
        +            // Loop Unswitching.
        +
        +            for (int j = 0; j < limit; j++) {
        +                a.i += 34; // NullCheck with trap on false path -> reason to peel
        +                if (j > 0) { // After peeling: j > 0 always true -> loop folded away
        +                    break;
        +                }
        +            }
        +        }
        +    }
        +}
        +
        +class A {
        +    int i;
        +}
        diff --git a/test/hotspot/jtreg/compiler/loopopts/TestRemixAddressExpressionsWithIrreducibleLoop.java b/test/hotspot/jtreg/compiler/loopopts/TestRemixAddressExpressionsWithIrreducibleLoop.java
        new file mode 100644
        index 00000000000..ff7be96007d
        --- /dev/null
        +++ b/test/hotspot/jtreg/compiler/loopopts/TestRemixAddressExpressionsWithIrreducibleLoop.java
        @@ -0,0 +1,57 @@
        +/*
        + * Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved.
        + * 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 8326638
        + * @summary Test handling of irreducible loops in PhaseIdealLoop::remix_address_expressions.
        + * @run main/othervm -XX:-TieredCompilation -Xbatch
        + *                   -XX:CompileCommand=compileonly,TestRemixAddressExpressionsWithIrreducibleLoop::test
        + *                   TestRemixAddressExpressionsWithIrreducibleLoop
        + */
        +
        +public class TestRemixAddressExpressionsWithIrreducibleLoop {
        +
        +    public static void main(String[] args) {
        +        test("4");
        +    }
        +
        +    public static void test(String arg) {
        +        for (int i = 0; i < 100_000; ++i) {
        +            int j = 0;
        +            while (true) {
        +                boolean tmp = "1\ufff0".startsWith(arg, 2 - arg.length());
        +                if (j++ > 100)
        +                    break;
        +            }
        +        loop:
        +            while (i >= 100) {
        +                for (int i2 = 0; i2 < 1; i2 = 1)
        +                    if (j > 300)
        +                        break loop;
        +                j++;
        +            }
        +        }
        +    }
        +}
        diff --git a/test/hotspot/jtreg/compiler/rangechecks/TestArrayAccessAboveRCAfterPartialPeeling.java b/test/hotspot/jtreg/compiler/rangechecks/TestArrayAccessAboveRCAfterPartialPeeling.java
        new file mode 100644
        index 00000000000..c5b99593c62
        --- /dev/null
        +++ b/test/hotspot/jtreg/compiler/rangechecks/TestArrayAccessAboveRCAfterPartialPeeling.java
        @@ -0,0 +1,130 @@
        +/*
        + * Copyright (c) 2024, Red Hat, Inc. All rights reserved.
        + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
        + *
        + * This code is free software; you can redistribute it and/or modify it
        + * under the terms of the GNU General Public License version 2 only, as
        + * published by the Free Software Foundation.
        + *
        + * This code is distributed in the hope that it will be useful, but WITHOUT
        + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
        + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
        + * version 2 for more details (a copy is included in the LICENSE file that
        + * accompanied this code).
        + *
        + * You should have received a copy of the GNU General Public License version
        + * 2 along with this work; if not, write to the Free Software Foundation,
        + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
        + *
        + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
        + * or visit www.oracle.com if you need additional information or have any
        + * questions.
        + */
        +
        +/*
        + * @test
        + * @bug 8323274
        + * @summary partial peeling loop can cause an array load to become dependent on a test other than its range check
        + * @run main/othervm -XX:-UseOnStackReplacement -XX:-TieredCompilation -XX:-BackgroundCompilation TestArrayAccessAboveRCAfterPartialPeeling
        + */
        +
        +public class TestArrayAccessAboveRCAfterPartialPeeling {
        +    private static volatile int volatileField;
        +
        +    public static void main(String[] args) {
        +        int[] array = new int[100];
        +        for (int i = 0; i < 20_000; i++) {
        +            test(array, 2, true, 1);
        +            test(array, 2, false, 1);
        +            inlined(array, 2, 42, true, 42, 1, 1);
        +            inlined(array, 2, 42, false, 42, 1, 1);
        +        }
        +        try {
        +            test(array, 2, true, -1);
        +        } catch (ArrayIndexOutOfBoundsException arrayIndexOutOfBoundsException) {
        +        }
        +    }
        +
        +    private static int test(int[] array, int k, boolean flag, int j) {
        +        int l;
        +        for (l = 1; l < 2; l *= 2) {
        +
        +        }
        +        int m;
        +        for (m = 0; m < 42; m += l) {
        +
        +        }
        +        int n;
        +        for (n = 0; n < 10; n += m/42) {
        +
        +        }
        +        return inlined(array, k, l, flag, m, n/10, j);
        +    }
        +
        +    private static int inlined(int[] array, int k, int l, boolean flag, int m, int n, int j) {
        +        if (array == null) {
        +        }
        +        int[] otherArray = new int[100];
        +        int i = 0;
        +        int v = 0;
        +        if (k == m) {
        +        }
        +
        +        if (flag) {
        +            v += array[j];
        +            v += otherArray[i];
        +
        +            for (; ; ) {
        +                synchronized (new Object()) {
        +                }
        +                if (j >= 100) {
        +                    break;
        +                }
        +                if (k == 42) {
        +                }
        +                v += array[j];
        +                v += otherArray[i];
        +                if (i >= n) {
        +                    otherArray[i] = v;
        +                }
        +                v += array[j];
        +                if (l == 2) {
        +                    break;
        +                }
        +                i++;
        +                j *= 2;
        +                volatileField = 42;
        +                k = 2;
        +                l = 42;
        +            }
        +        } else {
        +            v += array[j];
        +            v += otherArray[i];
        +
        +            for (; ; ) {
        +                synchronized (new Object()) {
        +                }
        +                if (j >= 100) {
        +                    break;
        +                }
        +                if (k == 42) {
        +                }
        +                v += array[j];
        +                v += otherArray[i];
        +                if (i >= n) {
        +                    otherArray[i] = v;
        +                }
        +                v += array[j];
        +                if (l == 2) {
        +                    break;
        +                }
        +                i++;
        +                j *= 2;
        +                volatileField = 42;
        +                k = 2;
        +                l = 42;
        +            }
        +        }
        +        return v;
        +    }
        +}
        diff --git a/test/hotspot/jtreg/compiler/rangechecks/TestArrayAccessAboveRCAfterSinking.java b/test/hotspot/jtreg/compiler/rangechecks/TestArrayAccessAboveRCAfterSinking.java
        new file mode 100644
        index 00000000000..a06fb40db29
        --- /dev/null
        +++ b/test/hotspot/jtreg/compiler/rangechecks/TestArrayAccessAboveRCAfterSinking.java
        @@ -0,0 +1,132 @@
        +/*
        + * Copyright (c) 2024, Red Hat, Inc. All rights reserved.
        + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
        + *
        + * This code is free software; you can redistribute it and/or modify it
        + * under the terms of the GNU General Public License version 2 only, as
        + * published by the Free Software Foundation.
        + *
        + * This code is distributed in the hope that it will be useful, but WITHOUT
        + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
        + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
        + * version 2 for more details (a copy is included in the LICENSE file that
        + * accompanied this code).
        + *
        + * You should have received a copy of the GNU General Public License version
        + * 2 along with this work; if not, write to the Free Software Foundation,
        + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
        + *
        + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
        + * or visit www.oracle.com if you need additional information or have any
        + * questions.
        + */
        +
        +/*
        + * @test
        + * @bug 8323274
        + * @summary sinking an array load out of loop can cause it to become dependent on a test other than its range check
        + * @run main/othervm -XX:-UseOnStackReplacement -XX:-TieredCompilation -XX:-BackgroundCompilation TestArrayAccessAboveRCAfterSinking
        + */
        +
        +
        +import java.util.Arrays;
        +
        +public class TestArrayAccessAboveRCAfterSinking {
        +    public static void main(String[] args) {
        +        boolean[] allFalse = new boolean[100];
        +        boolean[] allTrue = new boolean[100];
        +        Arrays.fill(allTrue, true);
        +        int[] array = new int[100];
        +        for (int i = 0; i < 20_000; i++) {
        +            test1(allTrue, array, 0, true, 0);
        +            test1(allTrue, array, 0, false, 0);
        +            inlined1(allFalse, array, 2, 0);
        +            inlined1(allFalse, array, 42, 0);
        +            inlined1(allTrue, array, 2, 0);
        +            test2(allTrue, array, 0, true, 0);
        +            test2(allTrue, array, 0, false, 0);
        +            inlined2(allFalse, array, 2, 0);
        +            inlined2(allFalse, array, 42, 0);
        +            inlined2(allTrue, array, 2, 0);
        +        }
        +        try {
        +            test1(allTrue, array, -1, true, 0);
        +        } catch (ArrayIndexOutOfBoundsException arrayIndexOutOfBoundsException) {
        +        }
        +        try {
        +            test2(allTrue, array, -1, true, 0);
        +        } catch (ArrayIndexOutOfBoundsException arrayIndexOutOfBoundsException) {
        +        }
        +    }
        +
        +    private static int test1(boolean[] flags, int[] array, int k, boolean flag, int v) {
        +        if (flags == null) {
        +        }
        +        if (array == null) {
        +        }
        +        int j = 1;
        +        for (; j < 2; j *= 2) {
        +        }
        +        int i;
        +        for (i = 0; i < 10; i += j) {
        +
        +        }
        +        if (flags[i - 10]) {
        +            if (flag) {
        +                return inlined1(flags, array, j, k);
        +            } else {
        +                return inlined1(flags, array, j, k) + v;
        +            }
        +        }
        +        return 0;
        +    }
        +
        +    private static int inlined1(boolean[] flags, int[] array, int j, int k) {
        +        for (int i = 0; i < 100; i++) {
        +            final boolean flag = flags[i & (j - 3)];
        +            int v = array[i + k];
        +            if (flag) {
        +                return v;
        +            }
        +            if (j + (i & (j - 2)) == 2) {
        +                break;
        +            }
        +        }
        +        return 0;
        +    }
        +
        +    private static int test2(boolean[] flags, int[] array, int k, boolean flag, int v) {
        +        if (flags == null) {
        +        }
        +        if (array == null) {
        +        }
        +        int j = 1;
        +        for (; j < 2; j *= 2) {
        +        }
        +        int i;
        +        for (i = 0; i < 10; i += j) {
        +
        +        }
        +        if (flags[i - 10]) {
        +            if (flag) {
        +                return inlined2(flags, array, j, k);
        +            } else {
        +                return inlined2(flags, array, j, k) + v;
        +            }
        +        }
        +        return 0;
        +    }
        +
        +    private static int inlined2(boolean[] flags, int[] array, int j, int k) {
        +        for (int i = 0; i < 100; i++) {
        +            int v = array[i + k];
        +            if (flags[i & (j - 3)]) {
        +                return v;
        +            }
        +            if (j + (i & (j - 2)) == 2) {
        +                break;
        +            }
        +        }
        +        return 0;
        +    }
        +}
        diff --git a/test/hotspot/jtreg/compiler/rangechecks/TestArrayAccessAboveRCAfterSplitIf.java b/test/hotspot/jtreg/compiler/rangechecks/TestArrayAccessAboveRCAfterSplitIf.java
        new file mode 100644
        index 00000000000..e1e3969cfcd
        --- /dev/null
        +++ b/test/hotspot/jtreg/compiler/rangechecks/TestArrayAccessAboveRCAfterSplitIf.java
        @@ -0,0 +1,161 @@
        +/*
        + * Copyright (c) 2024, Red Hat, Inc. All rights reserved.
        + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
        + *
        + * This code is free software; you can redistribute it and/or modify it
        + * under the terms of the GNU General Public License version 2 only, as
        + * published by the Free Software Foundation.
        + *
        + * This code is distributed in the hope that it will be useful, but WITHOUT
        + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
        + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
        + * version 2 for more details (a copy is included in the LICENSE file that
        + * accompanied this code).
        + *
        + * You should have received a copy of the GNU General Public License version
        + * 2 along with this work; if not, write to the Free Software Foundation,
        + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
        + *
        + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
        + * or visit www.oracle.com if you need additional information or have any
        + * questions.
        + */
        +
        +/*
        + * @test
        + * @bug 8323274
        + * @summary split if can cause an array load to become dependent on a test other than its range check
        + * @run main/othervm -XX:-TieredCompilation -XX:-BackgroundCompilation TestArrayAccessAboveRCAfterSplitIf
        + */
        +
        +public class TestArrayAccessAboveRCAfterSplitIf {
        +    private static volatile int volatileField;
        +
        +    public static void main(String[] args) {
        +        int[] array = new int[1000];
        +        for (int i = 0; i < 20_000; i++) {
        +            test1(array, array, 0, 2, true);
        +            inlined1(42, array, array, 0, 2, 10, true);
        +            inlined1(2, array, array, 0, 2, 10, true);
        +            inlined1(42, array, array, 0, 2, 10, false);
        +            inlined1(2, array, array, 0, 2, 10, false);
        +            test2(array, array, 0, 2, true);
        +            inlined2(42, array, array, 0, 2, 10, true);
        +            inlined2(2, array, array, 0, 2, 10, true);
        +            inlined2(42, array, array, 0, 2, 10, false);
        +            inlined2(2, array, array, 0, 2, 10, false);
        +        }
        +        try {
        +            test1(array, array, -1, 2, true);
        +        } catch (ArrayIndexOutOfBoundsException arrayIndexOutOfBoundsException) {
        +        }
        +        try {
        +            test2(array, array, -1, 2, true);
        +        } catch (ArrayIndexOutOfBoundsException arrayIndexOutOfBoundsException) {
        +        }
        +    }
        +
        +    private static int test1(int[] array1, int[] array2, int i, int l, boolean flag) {
        +        for (int j = 0; j < 10; j++) {
        +        }
        +        int k;
        +        for (k = 1; k < 2; k *= 2) {
        +
        +        }
        +        int m;
        +        for (m = 0; m < 10; m+=k) {
        +
        +        }
        +        return inlined1(k, array1, array2, i, l, m, flag);
        +    }
        +
        +    private static int inlined1(int k, int[] array1, int[] array2, int i, int l, int m, boolean flag) {
        +        int v;
        +        int[] array;
        +        if (array1 == null) {
        +        }
        +        if (l == 10) {
        +
        +        }
        +        if (flag) {
        +            if (k == 2) {
        +                v = array1[i];
        +                array = array1;
        +                if (l == m) {
        +                }
        +            } else {
        +                v = array2[i];
        +                array = array2;
        +            }
        +            v += array[i];
        +            v += array2[i];
        +        } else {
        +            if (k == 2) {
        +                v = array1[i];
        +                array = array1;
        +                if (l == m) {
        +                }
        +            } else {
        +                v = array2[i];
        +                array = array2;
        +            }
        +            v += array[i];
        +            v += array2[i];
        +        }
        +        return v;
        +    }
        +
        +    private static int test2(int[] array1, int[] array2, int i, int l, boolean flag) {
        +        for (int j = 0; j < 10; j++) {
        +        }
        +        int k;
        +        for (k = 1; k < 2; k *= 2) {
        +
        +        }
        +        int m;
        +        for (m = 0; m < 10; m+=k) {
        +
        +        }
        +        return inlined2(k, array1, array2, i, l, m, flag);
        +    }
        +
        +    private static int inlined2(int k, int[] array1, int[] array2, int i, int l, int m, boolean flag) {
        +        int v;
        +        int[] array;
        +        if (array1 == null) {
        +        }
        +        if (l == 10) {
        +
        +        }
        +        if (flag) {
        +            if (k == 2) {
        +                v = array1[i];
        +                array = array1;
        +                if (l == m) {
        +                }
        +            } else {
        +                v = array2[i];
        +                array = array2;
        +            }
        +            if (Integer.compareUnsigned(i, array.length) >= 0) {
        +            }
        +            v += array[i];
        +            v += array2[i];
        +        } else {
        +            if (k == 2) {
        +                v = array1[i];
        +                array = array1;
        +                if (l == m) {
        +                }
        +            } else {
        +                v = array2[i];
        +                array = array2;
        +            }
        +            if (Integer.compareUnsigned(i, array.length) >= 0) {
        +            }
        +            v += array[i];
        +            v += array2[i];
        +        }
        +        return v;
        +    }
        +}
        diff --git a/test/hotspot/jtreg/compiler/rangechecks/TestArrayAccessAboveRCAfterUnswitching.java b/test/hotspot/jtreg/compiler/rangechecks/TestArrayAccessAboveRCAfterUnswitching.java
        new file mode 100644
        index 00000000000..1fc7111ff82
        --- /dev/null
        +++ b/test/hotspot/jtreg/compiler/rangechecks/TestArrayAccessAboveRCAfterUnswitching.java
        @@ -0,0 +1,103 @@
        +/*
        + * Copyright (c) 2024, Red Hat, Inc. All rights reserved.
        + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
        + *
        + * This code is free software; you can redistribute it and/or modify it
        + * under the terms of the GNU General Public License version 2 only, as
        + * published by the Free Software Foundation.
        + *
        + * This code is distributed in the hope that it will be useful, but WITHOUT
        + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
        + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
        + * version 2 for more details (a copy is included in the LICENSE file that
        + * accompanied this code).
        + *
        + * You should have received a copy of the GNU General Public License version
        + * 2 along with this work; if not, write to the Free Software Foundation,
        + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
        + *
        + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
        + * or visit www.oracle.com if you need additional information or have any
        + * questions.
        + */
        +
        +/*
        + * @test
        + * @bug 8323274
        + * @summary loop unswitching can cause an array load to become dependent on a test other than its range check
        + * @run main/othervm -XX:-TieredCompilation -XX:-BackgroundCompilation -XX:CompileOnly=TestArrayAccessAboveRCAfterUnswitching::test
        + *                   -XX:+UnlockDiagnosticVMOptions -XX:+StressGCM -XX:StressSeed=148059521 TestArrayAccessAboveRCAfterUnswitching
        + * @run main/othervm -XX:-TieredCompilation -XX:-BackgroundCompilation -XX:CompileOnly=TestArrayAccessAboveRCAfterUnswitching::test
        + *                   -XX:+UnlockDiagnosticVMOptions -XX:+StressGCM TestArrayAccessAboveRCAfterUnswitching
        + */
        +
        +import java.util.Arrays;
        +
        +public class TestArrayAccessAboveRCAfterUnswitching {
        +    private static int field;
        +
        +    public static void main(String[] args) {
        +        int[] array = new int[1000];
        +        boolean[] allFalse = new boolean[1000];
        +        boolean[] allTrue = new boolean[1000];
        +        Arrays.fill(allTrue, true);
        +        for (int i = 0; i < 20_000; i++) {
        +            inlined(array, allFalse, 42, 2, 2, 0);
        +            inlined(array, allFalse, 2, 42, 2, 0);
        +            inlined(array, allFalse, 2, 2, 2, 0);
        +            inlined(array, allFalse, 2, 2, 42, 0);
        +            inlined(array, allTrue, 2, 2, 2, 0);
        +            test(array, allTrue, 0);
        +        }
        +        try {
        +            test(array, allTrue, -1);
        +        } catch (ArrayIndexOutOfBoundsException aioobe) {
        +        }
        +    }
        +
        +    private static int test(int[] array, boolean[] flags, int start) {
        +        if (flags == null) {
        +        }
        +        if (array == null) {
        +        }
        +        int j = 1;
        +        for (; j < 2; j *= 2) {
        +        }
        +        int k = 1;
        +        for (; k < 2; k *= 2) {
        +        }
        +        int l = 1;
        +        for (; l < 2; l *= 2) {
        +        }
        +        int i;
        +        for (i = 0; i < 10; i += l) {
        +
        +        }
        +        if (flags[i - 10]) {
        +            return inlined(array, flags, j, k, l, start);
        +        }
        +        return 0;
        +    }
        +
        +    private static int inlined(int[] array, boolean[] flags, int j, int k, int l, int start) {
        +        for (int i = 0; i < 100; i++) {
        +            final boolean flag = flags[i & (j - 3)];
        +            int v = array[(i + start) & (j - 3)];
        +            if (flag) {
        +                return v;
        +            }
        +            if (j != 2) {
        +                field = v;
        +            } else {
        +                if (k != 2) {
        +                    field = 42;
        +                } else {
        +                    if (l == 2) {
        +                        break;
        +                    }
        +                }
        +            }
        +        }
        +        return 0;
        +    }
        +}
        diff --git a/test/hotspot/jtreg/compiler/rangechecks/TestArrayAccessAboveRCForArrayCopyLoad.java b/test/hotspot/jtreg/compiler/rangechecks/TestArrayAccessAboveRCForArrayCopyLoad.java
        new file mode 100644
        index 00000000000..46438579f4a
        --- /dev/null
        +++ b/test/hotspot/jtreg/compiler/rangechecks/TestArrayAccessAboveRCForArrayCopyLoad.java
        @@ -0,0 +1,56 @@
        +/*
        + * Copyright (c) 2024, Red Hat, Inc. All rights reserved.
        + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
        + *
        + * This code is free software; you can redistribute it and/or modify it
        + * under the terms of the GNU General Public License version 2 only, as
        + * published by the Free Software Foundation.
        + *
        + * This code is distributed in the hope that it will be useful, but WITHOUT
        + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
        + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
        + * version 2 for more details (a copy is included in the LICENSE file that
        + * accompanied this code).
        + *
        + * You should have received a copy of the GNU General Public License version
        + * 2 along with this work; if not, write to the Free Software Foundation,
        + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
        + *
        + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
        + * or visit www.oracle.com if you need additional information or have any
        + * questions.
        + */
        +
        +/*
        + * @test
        + * @bug 8323274
        + * @summary converting an array copy to a series of loads/stores add loads that can float
        + * @run main/othervm -XX:-UseOnStackReplacement -XX:-TieredCompilation -XX:-BackgroundCompilation TestArrayAccessAboveRCForArrayCopyLoad
        + */
        +
        +public class TestArrayAccessAboveRCForArrayCopyLoad {
        +    public static void main(String[] args) {
        +        int[] array = new int[10];
        +        for (int i = 0; i < 20_000; i++) {
        +            test(array, 0, array, 1, false);
        +            test(array, 0, array, 1, true);
        +        }
        +        try {
        +            test(array, -1, array, 0, true);
        +        } catch (ArrayIndexOutOfBoundsException arrayIndexOutOfBoundsException) {
        +
        +        }
        +    }
        +
        +    private static void test(int[] src, int srcPos, int[] dst, int dstPos, boolean flag) {
        +        if (src == null) {
        +        }
        +        if (srcPos < dstPos) {
        +            if (flag) {
        +                System.arraycopy(src, srcPos, dst, dstPos, 2);
        +            } else {
        +                System.arraycopy(src, srcPos, dst, dstPos, 2);
        +            }
        +        }
        +    }
        +}
        diff --git a/test/hotspot/jtreg/compiler/startup/StartupOutput.java b/test/hotspot/jtreg/compiler/startup/StartupOutput.java
        index d97bcd0019a..f74a03b226f 100644
        --- a/test/hotspot/jtreg/compiler/startup/StartupOutput.java
        +++ b/test/hotspot/jtreg/compiler/startup/StartupOutput.java
        @@ -1,5 +1,5 @@
         /*
        - * Copyright (c) 2013, 2023, Oracle and/or its affiliates. All rights reserved.
        + * Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved.
          * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
          *
          * This code is free software; you can redistribute it and/or modify it
        @@ -55,5 +55,14 @@ public static void main(String[] args) throws Exception {
                 if (exitCode != 1 && exitCode != 0) {
                     throw new Exception("VM crashed with exit code " + exitCode);
                 }
        +
        +        pb = ProcessTools.createLimitedTestJavaProcessBuilder("-XX:InitialCodeCacheSize=1024K", "-XX:ReservedCodeCacheSize=1200k", "-version");
        +        out = new OutputAnalyzer(pb.start());
        +        // The VM should not crash but will probably fail with a "CodeCache is full. Compiler has been disabled." message
        +        out.stdoutShouldNotContain("# A fatal error");
        +        exitCode = out.getExitValue();
        +        if (exitCode != 1 && exitCode != 0) {
        +            throw new Exception("VM crashed with exit code " + exitCode);
        +        }
             }
         }
        diff --git a/test/hotspot/jtreg/compiler/testlibrary/sha/predicate/IntrinsicPredicates.java b/test/hotspot/jtreg/compiler/testlibrary/sha/predicate/IntrinsicPredicates.java
        index d5bf13e8fc2..b6246f423e4 100644
        --- a/test/hotspot/jtreg/compiler/testlibrary/sha/predicate/IntrinsicPredicates.java
        +++ b/test/hotspot/jtreg/compiler/testlibrary/sha/predicate/IntrinsicPredicates.java
        @@ -69,7 +69,8 @@ public class IntrinsicPredicates {
         
             public static final BooleanSupplier SHA1_INSTRUCTION_AVAILABLE
                     = new OrPredicate(new CPUSpecificPredicate("aarch64.*", new String[] { "sha1" }, null),
        -              new OrPredicate(new CPUSpecificPredicate("riscv64.*", new String[] { "sha1" }, null),
        +              // SHA-1 intrinsic is implemented with scalar instructions on riscv64
        +              new OrPredicate(new CPUSpecificPredicate("riscv64.*", null, null),
                       new OrPredicate(new CPUSpecificPredicate("s390.*",    new String[] { "sha1" }, null),
                       // x86 variants
                       new OrPredicate(new CPUSpecificPredicate("amd64.*",   new String[] { "sha" },  null),
        diff --git a/test/hotspot/jtreg/compiler/vectorapi/reshape/utils/TestCastMethods.java b/test/hotspot/jtreg/compiler/vectorapi/reshape/utils/TestCastMethods.java
        index 032ed40de98..ce27fe13062 100644
        --- a/test/hotspot/jtreg/compiler/vectorapi/reshape/utils/TestCastMethods.java
        +++ b/test/hotspot/jtreg/compiler/vectorapi/reshape/utils/TestCastMethods.java
        @@ -62,7 +62,6 @@ public class TestCastMethods {
                     makePair(FSPEC128, ISPEC128),
                     makePair(FSPEC64, DSPEC128),
                     makePair(FSPEC128, DSPEC256),
        -            makePair(FSPEC128, ISPEC128),
                     makePair(FSPEC128, SSPEC64),
                     makePair(DSPEC128, FSPEC64),
                     makePair(DSPEC256, FSPEC128),
        diff --git a/test/hotspot/jtreg/gc/shenandoah/compiler/TestUnsafeLoadStoreMergedHeapStableTests.java b/test/hotspot/jtreg/gc/shenandoah/compiler/TestUnsafeLoadStoreMergedHeapStableTests.java
        new file mode 100644
        index 00000000000..e7f9c777ef8
        --- /dev/null
        +++ b/test/hotspot/jtreg/gc/shenandoah/compiler/TestUnsafeLoadStoreMergedHeapStableTests.java
        @@ -0,0 +1,82 @@
        +/*
        + * Copyright (c) 2024, Red Hat, Inc. All rights reserved.
        + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
        + *
        + * This code is free software; you can redistribute it and/or modify it
        + * under the terms of the GNU General Public License version 2 only, as
        + * published by the Free Software Foundation.
        + *
        + * This code is distributed in the hope that it will be useful, but WITHOUT
        + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
        + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
        + * version 2 for more details (a copy is included in the LICENSE file that
        + * accompanied this code).
        + *
        + * You should have received a copy of the GNU General Public License version
        + * 2 along with this work; if not, write to the Free Software Foundation,
        + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
        + *
        + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
        + * or visit www.oracle.com if you need additional information or have any
        + * questions.
        + */
        +
        +/**
        + * @test
        + * @bug 8325372
        + * @summary fusion of heap stable test causes GetAndSet node to be removed
        + * @requires vm.gc.Shenandoah
        + * @modules java.base/jdk.internal.misc:+open
        + *
        + * @run main/othervm -XX:+UseShenandoahGC -XX:-BackgroundCompilation TestUnsafeLoadStoreMergedHeapStableTests
        + */
        +
        +import jdk.internal.misc.Unsafe;
        +
        +import java.lang.reflect.Field;
        +
        +public class TestUnsafeLoadStoreMergedHeapStableTests {
        +
        +    static final jdk.internal.misc.Unsafe UNSAFE = Unsafe.getUnsafe();
        +    static long F_OFFSET;
        +
        +    static class A {
        +        Object f;
        +    }
        +
        +    static {
        +        try {
        +            Field fField = A.class.getDeclaredField("f");
        +            F_OFFSET = UNSAFE.objectFieldOffset(fField);
        +        } catch (Exception e) {
        +            throw new RuntimeException(e);
        +        }
        +    }
        +
        +    static Object testHelper(boolean flag, Object o, long offset, Object x) {
        +        if (flag) {
        +            return UNSAFE.getAndSetObject(o, offset, x);
        +        }
        +        return null;
        +    }
        +
        +    static Object field;
        +
        +
        +    static Object test1(boolean flag, Object o, long offset) {
        +        return testHelper(flag, null, offset, field);
        +    }
        +
        +    static Object test2(Object o, long offset) {
        +        return UNSAFE.getAndSetObject(o, offset, field);
        +    }
        +
        +    static public void main(String[] args) {
        +        A a = new A();
        +        for (int i = 0; i < 20_000; i++) {
        +            testHelper(true, a, F_OFFSET, null);
        +            test1(false, a, F_OFFSET);
        +            test2(a, F_OFFSET);
        +        }
        +    }
        +}
        diff --git a/test/hotspot/jtreg/gtest/ArrayTests.java b/test/hotspot/jtreg/gtest/ArrayTests.java
        new file mode 100644
        index 00000000000..b1afa4795d2
        --- /dev/null
        +++ b/test/hotspot/jtreg/gtest/ArrayTests.java
        @@ -0,0 +1,56 @@
        +/*
        + * Copyright Amazon.com Inc. or its affiliates. All rights reserved.
        + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
        + *
        + * This code is free software; you can redistribute it and/or modify it
        + * 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.
        + *
        + */
        +
        +/*
        + * This tests object array sizes by running gtests with different settings.
        + */
        +
        +/* @test id=with-coops-with-ccp
        + * @summary Run object array size tests with compressed oops and compressed class pointers
        + * @library /test/lib
        + * @modules java.base/jdk.internal.misc
        + *          java.xml
        + * @run main/native GTestWrapper --gtest_filter=arrayOop -XX:+UseCompressedClassPointers -XX:+UseCompressedOops
        + */
        +/* @test id=with-coops-no-ccp
        + * @summary Run object array size tests with compressed oops and compressed class pointers
        + * @library /test/lib
        + * @modules java.base/jdk.internal.misc
        + *          java.xml
        + * @run main/native GTestWrapper --gtest_filter=arrayOop -XX:-UseCompressedClassPointers -XX:+UseCompressedOops
        + */
        +/* @test id=no-coops-with-ccp
        + * @summary Run object array size tests with compressed oops and compressed class pointers
        + * @library /test/lib
        + * @modules java.base/jdk.internal.misc
        + *          java.xml
        + * @run main/native GTestWrapper --gtest_filter=arrayOop -XX:+UseCompressedClassPointers -XX:-UseCompressedOops
        + */
        +/* @test id=no-coops-no-ccp
        + * @summary Run object array size tests with compressed oops and compressed class pointers
        + * @library /test/lib
        + * @modules java.base/jdk.internal.misc
        + *          java.xml
        + * @run main/native GTestWrapper --gtest_filter=arrayOop -XX:-UseCompressedClassPointers -XX:-UseCompressedOops
        + */
        diff --git a/test/hotspot/jtreg/gtest/ObjArrayTests.java b/test/hotspot/jtreg/gtest/ObjArrayTests.java
        new file mode 100644
        index 00000000000..baae1840417
        --- /dev/null
        +++ b/test/hotspot/jtreg/gtest/ObjArrayTests.java
        @@ -0,0 +1,85 @@
        +/*
        + * Copyright Amazon.com Inc. or its affiliates. All rights reserved.
        + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
        + *
        + * This code is free software; you can redistribute it and/or modify it
        + * 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.
        + *
        + */
        +
        +/*
        + * This tests object array sizes by running gtests with different settings.
        + */
        +
        +/* @test id=with-coops-with-ccp
        + * @summary Run object array size tests with compressed oops and compressed class pointers
        + * @library /test/lib
        + * @modules java.base/jdk.internal.misc
        + *          java.xml
        + * @run main/native GTestWrapper --gtest_filter=objArrayOop -XX:+UseCompressedClassPointers -XX:+UseCompressedOops
        + */
        +/* @test id=with-coops-no-ccp
        + * @summary Run object array size tests with compressed oops and compressed class pointers
        + * @library /test/lib
        + * @modules java.base/jdk.internal.misc
        + *          java.xml
        + * @run main/native GTestWrapper --gtest_filter=objArrayOop -XX:-UseCompressedClassPointers -XX:+UseCompressedOops
        + */
        +/* @test id=no-coops-with-ccp
        + * @summary Run object array size tests with compressed oops and compressed class pointers
        + * @library /test/lib
        + * @modules java.base/jdk.internal.misc
        + *          java.xml
        + * @run main/native GTestWrapper --gtest_filter=objArrayOop -XX:+UseCompressedClassPointers -XX:-UseCompressedOops
        + */
        +/* @test id=no-coops-no-ccp
        + * @summary Run object array size tests with compressed oops and compressed class pointers
        + * @library /test/lib
        + * @modules java.base/jdk.internal.misc
        + *          java.xml
        + * @run main/native GTestWrapper --gtest_filter=objArrayOop -XX:-UseCompressedClassPointers -XX:-UseCompressedOops
        + */
        +
        +/* @test id=with-coops-with-ccp-large-align
        + * @summary Run object array size tests with compressed oops and compressed class pointers
        + * @library /test/lib
        + * @modules java.base/jdk.internal.misc
        + *          java.xml
        + * @run main/native GTestWrapper --gtest_filter=objArrayOop -XX:+UseCompressedClassPointers -XX:+UseCompressedOops -XX:ObjAlignmentInBytes=256
        + */
        +/* @test id=with-coops-no-ccp-large-align
        + * @summary Run object array size tests with compressed oops and compressed class pointers
        + * @library /test/lib
        + * @modules java.base/jdk.internal.misc
        + *          java.xml
        + * @run main/native GTestWrapper --gtest_filter=objArrayOop -XX:-UseCompressedClassPointers -XX:+UseCompressedOops -XX:ObjAlignmentInBytes=256
        + */
        +/* @test id=no-coops-with-ccp-large-align
        + * @summary Run object array size tests with compressed oops and compressed class pointers
        + * @library /test/lib
        + * @modules java.base/jdk.internal.misc
        + *          java.xml
        + * @run main/native GTestWrapper --gtest_filter=objArrayOop -XX:+UseCompressedClassPointers -XX:-UseCompressedOops -XX:ObjAlignmentInBytes=256
        + */
        +/* @test id=no-coops-no-ccp-large-align
        + * @summary Run object array size tests with compressed oops and compressed class pointers
        + * @library /test/lib
        + * @modules java.base/jdk.internal.misc
        + *          java.xml
        + * @run main/native GTestWrapper --gtest_filter=objArrayOop -XX:-UseCompressedClassPointers -XX:-UseCompressedOops -XX:ObjAlignmentInBytes=256
        + */
        diff --git a/test/hotspot/jtreg/runtime/FieldLayout/ArrayBaseOffsets.java b/test/hotspot/jtreg/runtime/FieldLayout/ArrayBaseOffsets.java
        new file mode 100644
        index 00000000000..b679e866ac8
        --- /dev/null
        +++ b/test/hotspot/jtreg/runtime/FieldLayout/ArrayBaseOffsets.java
        @@ -0,0 +1,113 @@
        +/*
        + * Copyright Amazon.com Inc. or its affiliates. All rights reserved.
        + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
        + *
        + * This code is free software; you can redistribute it and/or modify it
        + * 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 id=with-coops-no-ccp
        + * @library /test/lib
        + * @requires vm.bits == "64"
        + * @modules java.base/jdk.internal.misc
        + * @run main/othervm -XX:+UseCompressedOops -XX:-UseCompressedClassPointers ArrayBaseOffsets
        + */
        +/*
        + * @test id=with-coops-with-ccp
        + * @library /test/lib
        + * @requires vm.bits == "64"
        + * @requires vm.opt.UseCompressedClassPointers != false
        + * @modules java.base/jdk.internal.misc
        + * @run main/othervm -XX:+UseCompressedOops -XX:+UseCompressedClassPointers ArrayBaseOffsets
        + */
        +/*
        + * @test id=no-coops-no-ccp
        + * @library /test/lib
        + * @requires vm.bits == "64"
        + * @modules java.base/jdk.internal.misc
        + * @run main/othervm -XX:-UseCompressedOops -XX:-UseCompressedClassPointers ArrayBaseOffsets
        + */
        +/*
        + * @test id=no-coops-with-ccp
        + * @library /test/lib
        + * @requires vm.bits == "64"
        + * @requires vm.opt.UseCompressedClassPointers != false
        + * @modules java.base/jdk.internal.misc
        + * @run main/othervm -XX:-UseCompressedOops -XX:+UseCompressedClassPointers ArrayBaseOffsets
        + */
        +/*
        + * @test id=32bit
        + * @library /test/lib
        + * @requires vm.bits == "32"
        + * @modules java.base/jdk.internal.misc
        + * @run main/othervm ArrayBaseOffsets
        + */
        +
        +import jdk.internal.misc.Unsafe;
        +
        +import java.lang.management.ManagementFactory;
        +import java.lang.management.RuntimeMXBean;
        +import java.util.List;
        +
        +import jdk.test.lib.Asserts;
        +import jdk.test.lib.Platform;
        +
        +public class ArrayBaseOffsets {
        +
        +    private static final boolean COOP;
        +    private static final boolean CCP;
        +
        +    static {
        +        if (Platform.is64bit()) {
        +            RuntimeMXBean runtime = ManagementFactory.getRuntimeMXBean();
        +            List vmargs = runtime.getInputArguments();
        +            CCP = !vmargs.contains("-XX:-UseCompressedClassPointers");
        +            COOP = System.getProperty("java.vm.compressedOopsMode") != null;
        +        } else {
        +            COOP = CCP = false;
        +        }
        +    }
        +
        +    static public void main(String[] args) {
        +        Unsafe unsafe = Unsafe.getUnsafe();
        +        int intOffset, longOffset;
        +        if (Platform.is64bit()) {
        +            if (CCP) {
        +                intOffset = 16;
        +                longOffset = 16;
        +            } else {
        +                intOffset = 20;
        +                longOffset = 24;
        +            }
        +        } else {
        +            intOffset = 12;
        +            longOffset = 16;
        +        }
        +        Asserts.assertEquals(unsafe.arrayBaseOffset(boolean[].class), intOffset,  "Misplaced boolean array base");
        +        Asserts.assertEquals(unsafe.arrayBaseOffset(byte[].class),    intOffset,  "Misplaced byte    array base");
        +        Asserts.assertEquals(unsafe.arrayBaseOffset(char[].class),    intOffset,  "Misplaced char    array base");
        +        Asserts.assertEquals(unsafe.arrayBaseOffset(short[].class),   intOffset,  "Misplaced short   array base");
        +        Asserts.assertEquals(unsafe.arrayBaseOffset(int[].class),     intOffset,  "Misplaced int     array base");
        +        Asserts.assertEquals(unsafe.arrayBaseOffset(long[].class),    longOffset, "Misplaced long    array base");
        +        Asserts.assertEquals(unsafe.arrayBaseOffset(float[].class),   intOffset,  "Misplaced float   array base");
        +        Asserts.assertEquals(unsafe.arrayBaseOffset(double[].class),  longOffset, "Misplaced double  array base");
        +        int expectedObjArrayOffset = (COOP || !Platform.is64bit()) ? intOffset : longOffset;
        +        Asserts.assertEquals(unsafe.arrayBaseOffset(Object[].class),  expectedObjArrayOffset, "Misplaced object  array base");
        +    }
        +}
        diff --git a/test/hotspot/jtreg/runtime/Thread/ThreadCountLimit.java b/test/hotspot/jtreg/runtime/Thread/ThreadCountLimit.java
        index 1afd6c1898f..20d93cbfdbe 100644
        --- a/test/hotspot/jtreg/runtime/Thread/ThreadCountLimit.java
        +++ b/test/hotspot/jtreg/runtime/Thread/ThreadCountLimit.java
        @@ -26,6 +26,7 @@
          * @summary Stress test that reaches the process limit for thread count, or time limit.
          * @requires os.family != "aix"
          * @key stress
        + * @library /test/lib
          * @run main/othervm -Xmx1g ThreadCountLimit
          */
         
        @@ -34,12 +35,17 @@
          * @summary Stress test that reaches the process limit for thread count, or time limit.
          * @requires os.family == "aix"
          * @key stress
        + * @library /test/lib
          * @run main/othervm -Xmx1g -XX:MaxExpectedDataSegmentSize=16g ThreadCountLimit
          */
         
         import java.util.concurrent.CountDownLatch;
         import java.util.ArrayList;
         
        +import jdk.test.lib.Platform;
        +import jdk.test.lib.process.OutputAnalyzer;
        +import jdk.test.lib.process.ProcessTools;
        +
         public class ThreadCountLimit {
         
           static final int TIME_LIMIT_MS = 5000; // Create as many threads as possible in 5 sec
        @@ -61,21 +67,42 @@ public void run() {
             }
           }
         
        -  public static void main(String[] args) {
        +  public static void main(String[] args) throws Exception {
        +    if (args.length == 0) {
        +      // Called from the driver process so exec a new JVM on Linux.
        +      if (Platform.isLinux()) {
        +        // On Linux this test sometimes hits the limit for the maximum number of memory mappings,
        +        // which leads to various other failure modes. Run this test with a limit on how many
        +        // threads the process is allowed to create, so we hit that limit first.
        +
        +        final String ULIMIT_CMD = "ulimit -u 4096";
        +        ProcessBuilder pb = ProcessTools.createTestJavaProcessBuilder(ThreadCountLimit.class.getName());
        +        String javaCmd = ProcessTools.getCommandLine(pb);
        +        // Relaunch the test with args.length > 0, and the ulimit set
        +        ProcessTools.executeCommand("bash", "-c", ULIMIT_CMD + " && " + javaCmd + " dummy")
        +                    .shouldHaveExitValue(0);
        +      } else {
        +        // Not Linux so run directly.
        +        test();
        +      }
        +    } else {
        +      // This is the exec'd process so run directly.
        +      test();
        +    }
        +  }
        +
        +  static void test() {
             CountDownLatch startSignal = new CountDownLatch(1);
             ArrayList workers = new ArrayList();
         
        -    boolean reachedTimeLimit = false;
             boolean reachedNativeOOM = false;
        -    int countAtTimeLimit = -1;
        -    int countAtNativeOOM = -1;
         
             // This is dangerous loop: it depletes system resources,
             // so doing additional things there that may end up allocating
             // Java/native memory risks failing the VM prematurely.
             // Avoid doing unnecessary calls, printouts, etc.
         
        -    int count = 1;
        +    int count = 0;
             long start = System.currentTimeMillis();
             try {
               while (true) {
        @@ -86,16 +113,15 @@ public static void main(String[] args) {
         
                 long end = System.currentTimeMillis();
                 if ((end - start) > TIME_LIMIT_MS) {
        -          reachedTimeLimit = true;
        -          countAtTimeLimit = count;
        +          // Windows always gets here, but we also get here if
        +          // ulimit is set high enough.
                   break;
                 }
               }
             } catch (OutOfMemoryError e) {
               if (e.getMessage().contains("unable to create native thread")) {
        -        // Linux, macOS path
        +        // Linux, macOS path if we hit ulimit
                 reachedNativeOOM = true;
        -        countAtNativeOOM = count;
               } else {
                 throw e;
               }
        @@ -113,13 +139,12 @@ public static void main(String[] args) {
         
             // Now that all threads have joined, we are away from dangerous
             // VM state and have enough memory to perform any other things.
        -    if (reachedTimeLimit) {
        -       // Windows path or a system with very large ulimit
        -       System.out.println("INFO: reached the time limit " + TIME_LIMIT_MS +
        -                          " ms, with " + countAtTimeLimit + " threads created");
        -    } else if (reachedNativeOOM) {
        -       System.out.println("INFO: reached this process thread count limit with " +
        -                           countAtNativeOOM + " threads created");
        +    if (reachedNativeOOM) {
        +      System.out.println("INFO: reached this process thread count limit with " +
        +                         count + " threads created");
        +    } else {
        +      System.out.println("INFO: reached the time limit " + TIME_LIMIT_MS +
        +                         " ms, with " + count + " threads created");
             }
           }
         }
        diff --git a/test/hotspot/jtreg/serviceability/jvmti/DynamicCodeGenerated/libDynamicCodeGenerated.cpp b/test/hotspot/jtreg/serviceability/jvmti/DynamicCodeGenerated/libDynamicCodeGenerated.cpp
        index f13ba00aa41..5e8e026dbba 100644
        --- a/test/hotspot/jtreg/serviceability/jvmti/DynamicCodeGenerated/libDynamicCodeGenerated.cpp
        +++ b/test/hotspot/jtreg/serviceability/jvmti/DynamicCodeGenerated/libDynamicCodeGenerated.cpp
        @@ -23,7 +23,7 @@
         
         #include 
         #include 
        -#include "jvmti_common.h"
        +#include "jvmti_common.hpp"
         
         static jvmtiEnv* jvmti = nullptr;
         
        diff --git a/test/hotspot/jtreg/serviceability/jvmti/FollowReferences/FieldIndices/libFieldIndicesTest.cpp b/test/hotspot/jtreg/serviceability/jvmti/FollowReferences/FieldIndices/libFieldIndicesTest.cpp
        index 042edbc6792..b8d83eb5085 100644
        --- a/test/hotspot/jtreg/serviceability/jvmti/FollowReferences/FieldIndices/libFieldIndicesTest.cpp
        +++ b/test/hotspot/jtreg/serviceability/jvmti/FollowReferences/FieldIndices/libFieldIndicesTest.cpp
        @@ -24,7 +24,7 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "jvmti_common.h"
        +#include "jvmti_common.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/serviceability/jvmti/GetClassFields/FilteredFields/libFilteredFieldsTest.cpp b/test/hotspot/jtreg/serviceability/jvmti/GetClassFields/FilteredFields/libFilteredFieldsTest.cpp
        index 24c36444ac2..28bfaaa03bd 100644
        --- a/test/hotspot/jtreg/serviceability/jvmti/GetClassFields/FilteredFields/libFilteredFieldsTest.cpp
        +++ b/test/hotspot/jtreg/serviceability/jvmti/GetClassFields/FilteredFields/libFilteredFieldsTest.cpp
        @@ -24,7 +24,7 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "jvmti_common.h"
        +#include "jvmti_common.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/serviceability/jvmti/GetLocalVariable/libGetSetLocalUnsuspended.cpp b/test/hotspot/jtreg/serviceability/jvmti/GetLocalVariable/libGetSetLocalUnsuspended.cpp
        index 9ae5005ee6c..79ab3dd0ad8 100644
        --- a/test/hotspot/jtreg/serviceability/jvmti/GetLocalVariable/libGetSetLocalUnsuspended.cpp
        +++ b/test/hotspot/jtreg/serviceability/jvmti/GetLocalVariable/libGetSetLocalUnsuspended.cpp
        @@ -23,7 +23,7 @@
         
         #include 
         #include "jvmti.h"
        -#include "jvmti_common.h"
        +#include "jvmti_common.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/serviceability/jvmti/SuspendWithCurrentThread/libSuspendWithCurrentThread.cpp b/test/hotspot/jtreg/serviceability/jvmti/SuspendWithCurrentThread/libSuspendWithCurrentThread.cpp
        index 61d41a33835..7e12be32d21 100644
        --- a/test/hotspot/jtreg/serviceability/jvmti/SuspendWithCurrentThread/libSuspendWithCurrentThread.cpp
        +++ b/test/hotspot/jtreg/serviceability/jvmti/SuspendWithCurrentThread/libSuspendWithCurrentThread.cpp
        @@ -24,7 +24,7 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "jvmti_common.h"
        +#include "jvmti_common.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/serviceability/jvmti/events/Breakpoint/breakpoint01/libbreakpoint01.cpp b/test/hotspot/jtreg/serviceability/jvmti/events/Breakpoint/breakpoint01/libbreakpoint01.cpp
        index 2f4917c13f9..9f6c4f941de 100644
        --- a/test/hotspot/jtreg/serviceability/jvmti/events/Breakpoint/breakpoint01/libbreakpoint01.cpp
        +++ b/test/hotspot/jtreg/serviceability/jvmti/events/Breakpoint/breakpoint01/libbreakpoint01.cpp
        @@ -27,7 +27,7 @@
         #include "jni_md.h"
         #include "jvmti.h"
         
        -#include "jvmti_common.h"
        +#include "jvmti_common.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/serviceability/jvmti/events/ClassLoad/classload01/libclassload01.cpp b/test/hotspot/jtreg/serviceability/jvmti/events/ClassLoad/classload01/libclassload01.cpp
        index 8766b2047a9..f8d8af90e9e 100644
        --- a/test/hotspot/jtreg/serviceability/jvmti/events/ClassLoad/classload01/libclassload01.cpp
        +++ b/test/hotspot/jtreg/serviceability/jvmti/events/ClassLoad/classload01/libclassload01.cpp
        @@ -27,7 +27,7 @@
         
         #include 
         
        -#include "jvmti_common.h"
        +#include "jvmti_common.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/serviceability/jvmti/events/ClassPrepare/classprep01/libclassprep01.cpp b/test/hotspot/jtreg/serviceability/jvmti/events/ClassPrepare/classprep01/libclassprep01.cpp
        index 607b1d2792f..934ccaf4e3c 100644
        --- a/test/hotspot/jtreg/serviceability/jvmti/events/ClassPrepare/classprep01/libclassprep01.cpp
        +++ b/test/hotspot/jtreg/serviceability/jvmti/events/ClassPrepare/classprep01/libclassprep01.cpp
        @@ -26,7 +26,7 @@
         #include 
         #include "jvmti.h"
         
        -#include "jvmti_common.h"
        +#include "jvmti_common.hpp"
         
         
         extern "C" {
        diff --git a/test/hotspot/jtreg/serviceability/jvmti/events/Exception/exception01/libexception01.cpp b/test/hotspot/jtreg/serviceability/jvmti/events/Exception/exception01/libexception01.cpp
        index ebb086adcaa..0910053dfe2 100644
        --- a/test/hotspot/jtreg/serviceability/jvmti/events/Exception/exception01/libexception01.cpp
        +++ b/test/hotspot/jtreg/serviceability/jvmti/events/Exception/exception01/libexception01.cpp
        @@ -24,7 +24,7 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "jvmti_common.h"
        +#include "jvmti_common.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/serviceability/jvmti/events/ExceptionCatch/excatch01/libexcatch01.cpp b/test/hotspot/jtreg/serviceability/jvmti/events/ExceptionCatch/excatch01/libexcatch01.cpp
        index f7d74e6f2bf..8c600ed61e6 100644
        --- a/test/hotspot/jtreg/serviceability/jvmti/events/ExceptionCatch/excatch01/libexcatch01.cpp
        +++ b/test/hotspot/jtreg/serviceability/jvmti/events/ExceptionCatch/excatch01/libexcatch01.cpp
        @@ -24,7 +24,7 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "jvmti_common.h"
        +#include "jvmti_common.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/serviceability/jvmti/events/FieldAccess/fieldacc01/libfieldacc01.cpp b/test/hotspot/jtreg/serviceability/jvmti/events/FieldAccess/fieldacc01/libfieldacc01.cpp
        index cad086cb7ef..2b34dc48e93 100644
        --- a/test/hotspot/jtreg/serviceability/jvmti/events/FieldAccess/fieldacc01/libfieldacc01.cpp
        +++ b/test/hotspot/jtreg/serviceability/jvmti/events/FieldAccess/fieldacc01/libfieldacc01.cpp
        @@ -25,7 +25,7 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "jvmti_common.h"
        +#include "jvmti_common.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/serviceability/jvmti/events/FieldAccess/fieldacc02/libfieldacc02.cpp b/test/hotspot/jtreg/serviceability/jvmti/events/FieldAccess/fieldacc02/libfieldacc02.cpp
        index c733fb1cbc7..240f38a8186 100644
        --- a/test/hotspot/jtreg/serviceability/jvmti/events/FieldAccess/fieldacc02/libfieldacc02.cpp
        +++ b/test/hotspot/jtreg/serviceability/jvmti/events/FieldAccess/fieldacc02/libfieldacc02.cpp
        @@ -25,7 +25,7 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "jvmti_common.h"
        +#include "jvmti_common.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/serviceability/jvmti/events/FieldAccess/fieldacc03/libfieldacc03.cpp b/test/hotspot/jtreg/serviceability/jvmti/events/FieldAccess/fieldacc03/libfieldacc03.cpp
        index 769a26c9c7d..6529adaceac 100644
        --- a/test/hotspot/jtreg/serviceability/jvmti/events/FieldAccess/fieldacc03/libfieldacc03.cpp
        +++ b/test/hotspot/jtreg/serviceability/jvmti/events/FieldAccess/fieldacc03/libfieldacc03.cpp
        @@ -25,7 +25,7 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "jvmti_common.h"
        +#include "jvmti_common.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/serviceability/jvmti/events/FieldAccess/fieldacc04/libfieldacc04.cpp b/test/hotspot/jtreg/serviceability/jvmti/events/FieldAccess/fieldacc04/libfieldacc04.cpp
        index 2239294c52c..e699d90671d 100644
        --- a/test/hotspot/jtreg/serviceability/jvmti/events/FieldAccess/fieldacc04/libfieldacc04.cpp
        +++ b/test/hotspot/jtreg/serviceability/jvmti/events/FieldAccess/fieldacc04/libfieldacc04.cpp
        @@ -25,7 +25,7 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "jvmti_common.h"
        +#include "jvmti_common.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/serviceability/jvmti/events/FieldModification/fieldmod01/libfieldmod01.cpp b/test/hotspot/jtreg/serviceability/jvmti/events/FieldModification/fieldmod01/libfieldmod01.cpp
        index 26da8fedefb..0e8f5c0417e 100644
        --- a/test/hotspot/jtreg/serviceability/jvmti/events/FieldModification/fieldmod01/libfieldmod01.cpp
        +++ b/test/hotspot/jtreg/serviceability/jvmti/events/FieldModification/fieldmod01/libfieldmod01.cpp
        @@ -25,7 +25,7 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "jvmti_common.h"
        +#include "jvmti_common.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/serviceability/jvmti/events/FieldModification/fieldmod02/libfieldmod02.cpp b/test/hotspot/jtreg/serviceability/jvmti/events/FieldModification/fieldmod02/libfieldmod02.cpp
        index 23e3c5f22d9..a2c21182391 100644
        --- a/test/hotspot/jtreg/serviceability/jvmti/events/FieldModification/fieldmod02/libfieldmod02.cpp
        +++ b/test/hotspot/jtreg/serviceability/jvmti/events/FieldModification/fieldmod02/libfieldmod02.cpp
        @@ -25,7 +25,7 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "jvmti_common.h"
        +#include "jvmti_common.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/serviceability/jvmti/events/FramePop/framepop01/libframepop01.cpp b/test/hotspot/jtreg/serviceability/jvmti/events/FramePop/framepop01/libframepop01.cpp
        index 04eb17d6d4c..8da891b2779 100644
        --- a/test/hotspot/jtreg/serviceability/jvmti/events/FramePop/framepop01/libframepop01.cpp
        +++ b/test/hotspot/jtreg/serviceability/jvmti/events/FramePop/framepop01/libframepop01.cpp
        @@ -25,7 +25,7 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "jvmti_common.h"
        +#include "jvmti_common.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/serviceability/jvmti/events/FramePop/framepop02/libframepop02.cpp b/test/hotspot/jtreg/serviceability/jvmti/events/FramePop/framepop02/libframepop02.cpp
        index 21e8f4e7e06..61c9a91184b 100644
        --- a/test/hotspot/jtreg/serviceability/jvmti/events/FramePop/framepop02/libframepop02.cpp
        +++ b/test/hotspot/jtreg/serviceability/jvmti/events/FramePop/framepop02/libframepop02.cpp
        @@ -26,7 +26,7 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "jvmti_common.h"
        +#include "jvmti_common.hpp"
         
         
         extern "C" {
        diff --git a/test/hotspot/jtreg/serviceability/jvmti/events/MethodEntry/mentry01/libmentry01.cpp b/test/hotspot/jtreg/serviceability/jvmti/events/MethodEntry/mentry01/libmentry01.cpp
        index b5dec318029..8bed8ac6ecb 100644
        --- a/test/hotspot/jtreg/serviceability/jvmti/events/MethodEntry/mentry01/libmentry01.cpp
        +++ b/test/hotspot/jtreg/serviceability/jvmti/events/MethodEntry/mentry01/libmentry01.cpp
        @@ -25,7 +25,7 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "jvmti_common.h"
        +#include "jvmti_common.hpp"
         
         
         extern "C" {
        diff --git a/test/hotspot/jtreg/serviceability/jvmti/events/MethodEntry/mentry02/libmentry02.cpp b/test/hotspot/jtreg/serviceability/jvmti/events/MethodEntry/mentry02/libmentry02.cpp
        index 43202de0ad7..4895771a92e 100644
        --- a/test/hotspot/jtreg/serviceability/jvmti/events/MethodEntry/mentry02/libmentry02.cpp
        +++ b/test/hotspot/jtreg/serviceability/jvmti/events/MethodEntry/mentry02/libmentry02.cpp
        @@ -24,7 +24,7 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "jvmti_common.h"
        +#include "jvmti_common.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/serviceability/jvmti/events/MethodExit/mexit01/libmexit01.cpp b/test/hotspot/jtreg/serviceability/jvmti/events/MethodExit/mexit01/libmexit01.cpp
        index c6980f10484..079b5ec3023 100644
        --- a/test/hotspot/jtreg/serviceability/jvmti/events/MethodExit/mexit01/libmexit01.cpp
        +++ b/test/hotspot/jtreg/serviceability/jvmti/events/MethodExit/mexit01/libmexit01.cpp
        @@ -25,7 +25,7 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "jvmti_common.h"
        +#include "jvmti_common.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/serviceability/jvmti/events/MethodExit/mexit02/libmexit02.cpp b/test/hotspot/jtreg/serviceability/jvmti/events/MethodExit/mexit02/libmexit02.cpp
        index d7d24a3f4e6..54e4e6ea680 100644
        --- a/test/hotspot/jtreg/serviceability/jvmti/events/MethodExit/mexit02/libmexit02.cpp
        +++ b/test/hotspot/jtreg/serviceability/jvmti/events/MethodExit/mexit02/libmexit02.cpp
        @@ -25,7 +25,7 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "jvmti_common.h"
        +#include "jvmti_common.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/serviceability/jvmti/events/MonitorContendedEnter/mcontenter01/libmcontenter01.cpp b/test/hotspot/jtreg/serviceability/jvmti/events/MonitorContendedEnter/mcontenter01/libmcontenter01.cpp
        index 77ea808dc23..4dbb9f71969 100644
        --- a/test/hotspot/jtreg/serviceability/jvmti/events/MonitorContendedEnter/mcontenter01/libmcontenter01.cpp
        +++ b/test/hotspot/jtreg/serviceability/jvmti/events/MonitorContendedEnter/mcontenter01/libmcontenter01.cpp
        @@ -26,8 +26,8 @@
         #include 
         #include 
         
        -#include "jvmti_common.h"
        -#include "jvmti_thread.h"
        +#include "jvmti_common.hpp"
        +#include "jvmti_thread.hpp"
         
         
         extern "C" {
        diff --git a/test/hotspot/jtreg/serviceability/jvmti/events/MonitorContendedEntered/mcontentered01/libmcontentered01.cpp b/test/hotspot/jtreg/serviceability/jvmti/events/MonitorContendedEntered/mcontentered01/libmcontentered01.cpp
        index c46ccac6933..207ceeb6ac3 100644
        --- a/test/hotspot/jtreg/serviceability/jvmti/events/MonitorContendedEntered/mcontentered01/libmcontentered01.cpp
        +++ b/test/hotspot/jtreg/serviceability/jvmti/events/MonitorContendedEntered/mcontentered01/libmcontentered01.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include 
        -#include "jvmti_common.h"
        -#include "jvmti_thread.h"
        +#include "jvmti_common.hpp"
        +#include "jvmti_thread.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/serviceability/jvmti/events/MonitorWait/monitorwait01/libmonitorwait01.cpp b/test/hotspot/jtreg/serviceability/jvmti/events/MonitorWait/monitorwait01/libmonitorwait01.cpp
        index b85fa20ca16..6e3b86b941f 100644
        --- a/test/hotspot/jtreg/serviceability/jvmti/events/MonitorWait/monitorwait01/libmonitorwait01.cpp
        +++ b/test/hotspot/jtreg/serviceability/jvmti/events/MonitorWait/monitorwait01/libmonitorwait01.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include 
        -#include "jvmti_common.h"
        -#include "jvmti_thread.h"
        +#include "jvmti_common.hpp"
        +#include "jvmti_thread.hpp"
         
         
         extern "C" {
        diff --git a/test/hotspot/jtreg/serviceability/jvmti/events/MonitorWaited/monitorwaited01/libmonitorwaited01.cpp b/test/hotspot/jtreg/serviceability/jvmti/events/MonitorWaited/monitorwaited01/libmonitorwaited01.cpp
        index 013dbd66d81..8f66851a084 100644
        --- a/test/hotspot/jtreg/serviceability/jvmti/events/MonitorWaited/monitorwaited01/libmonitorwaited01.cpp
        +++ b/test/hotspot/jtreg/serviceability/jvmti/events/MonitorWaited/monitorwaited01/libmonitorwaited01.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include 
        -#include "jvmti_common.h"
        -#include "jvmti_thread.h"
        +#include "jvmti_common.hpp"
        +#include "jvmti_thread.hpp"
         
         
         extern "C" {
        diff --git a/test/hotspot/jtreg/serviceability/jvmti/events/NativeMethodBind/nativemethbind01/libnativemethbind01.cpp b/test/hotspot/jtreg/serviceability/jvmti/events/NativeMethodBind/nativemethbind01/libnativemethbind01.cpp
        index c0f7261b38f..09d3ec41334 100644
        --- a/test/hotspot/jtreg/serviceability/jvmti/events/NativeMethodBind/nativemethbind01/libnativemethbind01.cpp
        +++ b/test/hotspot/jtreg/serviceability/jvmti/events/NativeMethodBind/nativemethbind01/libnativemethbind01.cpp
        @@ -24,7 +24,7 @@
         #include 
         #include 
         #include 
        -#include "jvmti_common.h"
        +#include "jvmti_common.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/serviceability/jvmti/events/NativeMethodBind/nativemethbind02/libnativemethbind02.cpp b/test/hotspot/jtreg/serviceability/jvmti/events/NativeMethodBind/nativemethbind02/libnativemethbind02.cpp
        index 747952d4a10..1a8806f0bb9 100644
        --- a/test/hotspot/jtreg/serviceability/jvmti/events/NativeMethodBind/nativemethbind02/libnativemethbind02.cpp
        +++ b/test/hotspot/jtreg/serviceability/jvmti/events/NativeMethodBind/nativemethbind02/libnativemethbind02.cpp
        @@ -24,7 +24,7 @@
         #include 
         #include 
         #include 
        -#include "jvmti_common.h"
        +#include "jvmti_common.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/serviceability/jvmti/events/NativeMethodBind/nativemethbind03/libnativemethbind03.cpp b/test/hotspot/jtreg/serviceability/jvmti/events/NativeMethodBind/nativemethbind03/libnativemethbind03.cpp
        index d637f7dc713..5fd58a3a43b 100644
        --- a/test/hotspot/jtreg/serviceability/jvmti/events/NativeMethodBind/nativemethbind03/libnativemethbind03.cpp
        +++ b/test/hotspot/jtreg/serviceability/jvmti/events/NativeMethodBind/nativemethbind03/libnativemethbind03.cpp
        @@ -24,7 +24,7 @@
         #include 
         #include 
         #include 
        -#include "jvmti_common.h"
        +#include "jvmti_common.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/serviceability/jvmti/events/NativeMethodBind/nativemethbind04/libnativemethbind04.cpp b/test/hotspot/jtreg/serviceability/jvmti/events/NativeMethodBind/nativemethbind04/libnativemethbind04.cpp
        index 871028423ef..49645af7528 100644
        --- a/test/hotspot/jtreg/serviceability/jvmti/events/NativeMethodBind/nativemethbind04/libnativemethbind04.cpp
        +++ b/test/hotspot/jtreg/serviceability/jvmti/events/NativeMethodBind/nativemethbind04/libnativemethbind04.cpp
        @@ -24,7 +24,7 @@
         #include 
         #include 
         #include 
        -#include "jvmti_common.h"
        +#include "jvmti_common.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/serviceability/jvmti/events/SingleStep/singlestep01/libsinglestep01.cpp b/test/hotspot/jtreg/serviceability/jvmti/events/SingleStep/singlestep01/libsinglestep01.cpp
        index 7c4d6ef2ea7..87da7a6bf22 100644
        --- a/test/hotspot/jtreg/serviceability/jvmti/events/SingleStep/singlestep01/libsinglestep01.cpp
        +++ b/test/hotspot/jtreg/serviceability/jvmti/events/SingleStep/singlestep01/libsinglestep01.cpp
        @@ -1,6 +1,5 @@
         /*
        - * Copyright (c) 200
        - * git 3, 2022, Oracle and/or its affiliates. All rights reserved.
        + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved.
          * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
          *
          * This code is free software; you can redistribute it and/or modify it
        @@ -25,7 +24,7 @@
         #include 
         #include 
         #include 
        -#include "jvmti_common.h"
        +#include "jvmti_common.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/serviceability/jvmti/events/SingleStep/singlestep02/libsinglestep02.cpp b/test/hotspot/jtreg/serviceability/jvmti/events/SingleStep/singlestep02/libsinglestep02.cpp
        index f5437de1f3d..984454dfbaf 100644
        --- a/test/hotspot/jtreg/serviceability/jvmti/events/SingleStep/singlestep02/libsinglestep02.cpp
        +++ b/test/hotspot/jtreg/serviceability/jvmti/events/SingleStep/singlestep02/libsinglestep02.cpp
        @@ -25,7 +25,7 @@
         #include 
         #include 
         #include 
        -#include "jvmti_common.h"
        +#include "jvmti_common.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/serviceability/jvmti/events/SingleStep/singlestep03/libsinglestep03.cpp b/test/hotspot/jtreg/serviceability/jvmti/events/SingleStep/singlestep03/libsinglestep03.cpp
        index 51ac700efad..ddc1e8f73e5 100644
        --- a/test/hotspot/jtreg/serviceability/jvmti/events/SingleStep/singlestep03/libsinglestep03.cpp
        +++ b/test/hotspot/jtreg/serviceability/jvmti/events/SingleStep/singlestep03/libsinglestep03.cpp
        @@ -24,7 +24,7 @@
         #include 
         #include 
         #include 
        -#include "jvmti_common.h"
        +#include "jvmti_common.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/serviceability/jvmti/events/ThreadEnd/threadend01/libthreadend01.cpp b/test/hotspot/jtreg/serviceability/jvmti/events/ThreadEnd/threadend01/libthreadend01.cpp
        index b39276eeb00..69e76d6d92e 100644
        --- a/test/hotspot/jtreg/serviceability/jvmti/events/ThreadEnd/threadend01/libthreadend01.cpp
        +++ b/test/hotspot/jtreg/serviceability/jvmti/events/ThreadEnd/threadend01/libthreadend01.cpp
        @@ -25,7 +25,7 @@
         #include 
         #include 
         #include 
        -#include "jvmti_common.h"
        +#include "jvmti_common.hpp"
         
         
         extern "C" {
        diff --git a/test/hotspot/jtreg/serviceability/jvmti/events/ThreadEnd/threadend02/libthreadend02.cpp b/test/hotspot/jtreg/serviceability/jvmti/events/ThreadEnd/threadend02/libthreadend02.cpp
        index 2ffc67d3d8e..48f9da3785e 100644
        --- a/test/hotspot/jtreg/serviceability/jvmti/events/ThreadEnd/threadend02/libthreadend02.cpp
        +++ b/test/hotspot/jtreg/serviceability/jvmti/events/ThreadEnd/threadend02/libthreadend02.cpp
        @@ -25,8 +25,8 @@
         #include 
         #include 
         #include 
        -#include "jvmti_common.h"
        -#include "jvmti_thread.h"
        +#include "jvmti_common.hpp"
        +#include "jvmti_thread.hpp"
         
         
         extern "C" {
        diff --git a/test/hotspot/jtreg/serviceability/jvmti/events/ThreadStart/threadstart01/libthreadstart01.cpp b/test/hotspot/jtreg/serviceability/jvmti/events/ThreadStart/threadstart01/libthreadstart01.cpp
        index 2ebaf2d9f0f..abf2e0e2bc3 100644
        --- a/test/hotspot/jtreg/serviceability/jvmti/events/ThreadStart/threadstart01/libthreadstart01.cpp
        +++ b/test/hotspot/jtreg/serviceability/jvmti/events/ThreadStart/threadstart01/libthreadstart01.cpp
        @@ -25,7 +25,7 @@
         #include 
         #include 
         #include 
        -#include "jvmti_common.h"
        +#include "jvmti_common.hpp"
         
         
         extern "C" {
        diff --git a/test/hotspot/jtreg/serviceability/jvmti/events/ThreadStart/threadstart02/libthreadstart02.cpp b/test/hotspot/jtreg/serviceability/jvmti/events/ThreadStart/threadstart02/libthreadstart02.cpp
        index 1ab67b64603..061d6cf376a 100644
        --- a/test/hotspot/jtreg/serviceability/jvmti/events/ThreadStart/threadstart02/libthreadstart02.cpp
        +++ b/test/hotspot/jtreg/serviceability/jvmti/events/ThreadStart/threadstart02/libthreadstart02.cpp
        @@ -25,7 +25,7 @@
         #include 
         #include 
         #include 
        -#include "jvmti_common.h"
        +#include "jvmti_common.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/serviceability/jvmti/events/ThreadStart/threadstart03/libthreadstart03.cpp b/test/hotspot/jtreg/serviceability/jvmti/events/ThreadStart/threadstart03/libthreadstart03.cpp
        index 6373f8df19c..560a1c77ee2 100644
        --- a/test/hotspot/jtreg/serviceability/jvmti/events/ThreadStart/threadstart03/libthreadstart03.cpp
        +++ b/test/hotspot/jtreg/serviceability/jvmti/events/ThreadStart/threadstart03/libthreadstart03.cpp
        @@ -25,7 +25,7 @@
         #include 
         #include 
         #include 
        -#include "jvmti_common.h"
        +#include "jvmti_common.hpp"
         
         
         extern "C" {
        diff --git a/test/hotspot/jtreg/serviceability/jvmti/events/VMObjectAlloc/vmobjalloc01/libvmobjalloc01.cpp b/test/hotspot/jtreg/serviceability/jvmti/events/VMObjectAlloc/vmobjalloc01/libvmobjalloc01.cpp
        index 46006b00ad4..82c0ac8b54a 100644
        --- a/test/hotspot/jtreg/serviceability/jvmti/events/VMObjectAlloc/vmobjalloc01/libvmobjalloc01.cpp
        +++ b/test/hotspot/jtreg/serviceability/jvmti/events/VMObjectAlloc/vmobjalloc01/libvmobjalloc01.cpp
        @@ -23,8 +23,8 @@
         
         #include 
         #include "jvmti.h"
        -#include "jvmti_common.h"
        -#include "jvmti_thread.h"
        +#include "jvmti_common.hpp"
        +#include "jvmti_thread.hpp"
         
         
         extern "C" {
        diff --git a/test/hotspot/jtreg/serviceability/jvmti/negative/GetAllThreadsNullTest/libGetAllThreadsNullTest.cpp b/test/hotspot/jtreg/serviceability/jvmti/negative/GetAllThreadsNullTest/libGetAllThreadsNullTest.cpp
        index 1231a9e1ce1..1dd9713ce34 100644
        --- a/test/hotspot/jtreg/serviceability/jvmti/negative/GetAllThreadsNullTest/libGetAllThreadsNullTest.cpp
        +++ b/test/hotspot/jtreg/serviceability/jvmti/negative/GetAllThreadsNullTest/libGetAllThreadsNullTest.cpp
        @@ -24,7 +24,7 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "jvmti_common.h"
        +#include "jvmti_common.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/serviceability/jvmti/negative/contmon03/libcontmon03.cpp b/test/hotspot/jtreg/serviceability/jvmti/negative/contmon03/libcontmon03.cpp
        index f9188a371ff..b51cb079ae9 100644
        --- a/test/hotspot/jtreg/serviceability/jvmti/negative/contmon03/libcontmon03.cpp
        +++ b/test/hotspot/jtreg/serviceability/jvmti/negative/contmon03/libcontmon03.cpp
        @@ -24,7 +24,7 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "jvmti_common.h"
        +#include "jvmti_common.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/serviceability/jvmti/negative/framecnt02/libframecnt02.cpp b/test/hotspot/jtreg/serviceability/jvmti/negative/framecnt02/libframecnt02.cpp
        index 0b4286991f7..7b860ab4d22 100644
        --- a/test/hotspot/jtreg/serviceability/jvmti/negative/framecnt02/libframecnt02.cpp
        +++ b/test/hotspot/jtreg/serviceability/jvmti/negative/framecnt02/libframecnt02.cpp
        @@ -24,7 +24,7 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "jvmti_common.h"
        +#include "jvmti_common.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/serviceability/jvmti/negative/framecnt03/libframecnt03.cpp b/test/hotspot/jtreg/serviceability/jvmti/negative/framecnt03/libframecnt03.cpp
        index b72c7b87ab1..4747ad3c692 100644
        --- a/test/hotspot/jtreg/serviceability/jvmti/negative/framecnt03/libframecnt03.cpp
        +++ b/test/hotspot/jtreg/serviceability/jvmti/negative/framecnt03/libframecnt03.cpp
        @@ -24,7 +24,7 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "jvmti_common.h"
        +#include "jvmti_common.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/serviceability/jvmti/negative/frameloc03/libframeloc03.cpp b/test/hotspot/jtreg/serviceability/jvmti/negative/frameloc03/libframeloc03.cpp
        index b763d0433ee..e7791751442 100644
        --- a/test/hotspot/jtreg/serviceability/jvmti/negative/frameloc03/libframeloc03.cpp
        +++ b/test/hotspot/jtreg/serviceability/jvmti/negative/frameloc03/libframeloc03.cpp
        @@ -24,7 +24,7 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "jvmti_common.h"
        +#include "jvmti_common.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/serviceability/jvmti/negative/getstacktr02/libgetstacktr02.cpp b/test/hotspot/jtreg/serviceability/jvmti/negative/getstacktr02/libgetstacktr02.cpp
        index b12b322bba4..9e98b584a31 100644
        --- a/test/hotspot/jtreg/serviceability/jvmti/negative/getstacktr02/libgetstacktr02.cpp
        +++ b/test/hotspot/jtreg/serviceability/jvmti/negative/getstacktr02/libgetstacktr02.cpp
        @@ -24,7 +24,7 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "jvmti_common.h"
        +#include "jvmti_common.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/serviceability/jvmti/negative/getstacktr09/libgetstacktr09.cpp b/test/hotspot/jtreg/serviceability/jvmti/negative/getstacktr09/libgetstacktr09.cpp
        index bdac7128c3b..b8b65cc7546 100644
        --- a/test/hotspot/jtreg/serviceability/jvmti/negative/getstacktr09/libgetstacktr09.cpp
        +++ b/test/hotspot/jtreg/serviceability/jvmti/negative/getstacktr09/libgetstacktr09.cpp
        @@ -24,7 +24,7 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "jvmti_common.h"
        +#include "jvmti_common.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/serviceability/jvmti/negative/thrinfo02/libthrinfo02.cpp b/test/hotspot/jtreg/serviceability/jvmti/negative/thrinfo02/libthrinfo02.cpp
        index 6ab0c456704..7bb8bd861bc 100644
        --- a/test/hotspot/jtreg/serviceability/jvmti/negative/thrinfo02/libthrinfo02.cpp
        +++ b/test/hotspot/jtreg/serviceability/jvmti/negative/thrinfo02/libthrinfo02.cpp
        @@ -24,7 +24,7 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "jvmti_common.h"
        +#include "jvmti_common.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/serviceability/jvmti/negative/thrstat04/libthrstat04.cpp b/test/hotspot/jtreg/serviceability/jvmti/negative/thrstat04/libthrstat04.cpp
        index b63e84d0c49..ebc957deab2 100644
        --- a/test/hotspot/jtreg/serviceability/jvmti/negative/thrstat04/libthrstat04.cpp
        +++ b/test/hotspot/jtreg/serviceability/jvmti/negative/thrstat04/libthrstat04.cpp
        @@ -24,7 +24,7 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "jvmti_common.h"
        +#include "jvmti_common.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/serviceability/jvmti/stress/StackTrace/NotSuspended/libGetStackTraceNotSuspendedStress.cpp b/test/hotspot/jtreg/serviceability/jvmti/stress/StackTrace/NotSuspended/libGetStackTraceNotSuspendedStress.cpp
        index ee2dc9d2859..903a76d4acf 100644
        --- a/test/hotspot/jtreg/serviceability/jvmti/stress/StackTrace/NotSuspended/libGetStackTraceNotSuspendedStress.cpp
        +++ b/test/hotspot/jtreg/serviceability/jvmti/stress/StackTrace/NotSuspended/libGetStackTraceNotSuspendedStress.cpp
        @@ -23,8 +23,8 @@
         
         #include 
         #include "jvmti.h"
        -#include "jvmti_common.h"
        -#include "jvmti_thread.h"
        +#include "jvmti_common.hpp"
        +#include "jvmti_thread.hpp"
         
         #define MAX_FRAME_COUNT 80
         
        diff --git a/test/hotspot/jtreg/serviceability/jvmti/stress/StackTrace/Suspended/libGetStackTraceSuspendedStress.cpp b/test/hotspot/jtreg/serviceability/jvmti/stress/StackTrace/Suspended/libGetStackTraceSuspendedStress.cpp
        index 639b40d4839..037448a6428 100644
        --- a/test/hotspot/jtreg/serviceability/jvmti/stress/StackTrace/Suspended/libGetStackTraceSuspendedStress.cpp
        +++ b/test/hotspot/jtreg/serviceability/jvmti/stress/StackTrace/Suspended/libGetStackTraceSuspendedStress.cpp
        @@ -23,8 +23,8 @@
         
         #include 
         #include "jvmti.h"
        -#include "jvmti_common.h"
        -#include "jvmti_thread.h"
        +#include "jvmti_common.hpp"
        +#include "jvmti_thread.hpp"
         
         #define MAX_FRAME_COUNT 80
         
        diff --git a/test/hotspot/jtreg/serviceability/jvmti/stress/ThreadLocalStorage/SetGetThreadLocalStorageStressTest/libSetGetThreadLocalStorageStress.cpp b/test/hotspot/jtreg/serviceability/jvmti/stress/ThreadLocalStorage/SetGetThreadLocalStorageStressTest/libSetGetThreadLocalStorageStress.cpp
        index 1c09fac92ba..a8faa71970d 100644
        --- a/test/hotspot/jtreg/serviceability/jvmti/stress/ThreadLocalStorage/SetGetThreadLocalStorageStressTest/libSetGetThreadLocalStorageStress.cpp
        +++ b/test/hotspot/jtreg/serviceability/jvmti/stress/ThreadLocalStorage/SetGetThreadLocalStorageStressTest/libSetGetThreadLocalStorageStress.cpp
        @@ -23,8 +23,8 @@
         
         #include 
         #include "jvmti.h"
        -#include "jvmti_common.h"
        -#include "jvmti_thread.h"
        +#include "jvmti_common.hpp"
        +#include "jvmti_thread.hpp"
         
         
         /* constant names */
        diff --git a/test/hotspot/jtreg/serviceability/jvmti/thread/GetAllThreads/allthr01/liballthr01.cpp b/test/hotspot/jtreg/serviceability/jvmti/thread/GetAllThreads/allthr01/liballthr01.cpp
        index 442913b4ea2..611711a0f7e 100644
        --- a/test/hotspot/jtreg/serviceability/jvmti/thread/GetAllThreads/allthr01/liballthr01.cpp
        +++ b/test/hotspot/jtreg/serviceability/jvmti/thread/GetAllThreads/allthr01/liballthr01.cpp
        @@ -25,7 +25,7 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "jvmti_common.h"
        +#include "jvmti_common.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/serviceability/jvmti/thread/GetCurrentContendedMonitor/contmon01/libcontmon01.cpp b/test/hotspot/jtreg/serviceability/jvmti/thread/GetCurrentContendedMonitor/contmon01/libcontmon01.cpp
        index e3d95e113a0..992fb9a96cc 100644
        --- a/test/hotspot/jtreg/serviceability/jvmti/thread/GetCurrentContendedMonitor/contmon01/libcontmon01.cpp
        +++ b/test/hotspot/jtreg/serviceability/jvmti/thread/GetCurrentContendedMonitor/contmon01/libcontmon01.cpp
        @@ -24,7 +24,7 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "jvmti_common.h"
        +#include "jvmti_common.hpp"
         
         
         extern "C" {
        diff --git a/test/hotspot/jtreg/serviceability/jvmti/thread/GetCurrentContendedMonitor/contmon02/libcontmon02.cpp b/test/hotspot/jtreg/serviceability/jvmti/thread/GetCurrentContendedMonitor/contmon02/libcontmon02.cpp
        index 65a2211a004..39190270a30 100644
        --- a/test/hotspot/jtreg/serviceability/jvmti/thread/GetCurrentContendedMonitor/contmon02/libcontmon02.cpp
        +++ b/test/hotspot/jtreg/serviceability/jvmti/thread/GetCurrentContendedMonitor/contmon02/libcontmon02.cpp
        @@ -24,7 +24,7 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "jvmti_common.h"
        +#include "jvmti_common.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/serviceability/jvmti/thread/GetFrameCount/framecnt01/libframecnt01.cpp b/test/hotspot/jtreg/serviceability/jvmti/thread/GetFrameCount/framecnt01/libframecnt01.cpp
        index c9dd399138a..ced257caef2 100644
        --- a/test/hotspot/jtreg/serviceability/jvmti/thread/GetFrameCount/framecnt01/libframecnt01.cpp
        +++ b/test/hotspot/jtreg/serviceability/jvmti/thread/GetFrameCount/framecnt01/libframecnt01.cpp
        @@ -23,7 +23,7 @@
         
         #include 
         #include "jvmti.h"
        -#include "jvmti_common.h"
        +#include "jvmti_common.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/serviceability/jvmti/thread/GetFrameLocation/frameloc01/libframeloc01.cpp b/test/hotspot/jtreg/serviceability/jvmti/thread/GetFrameLocation/frameloc01/libframeloc01.cpp
        index 89855a8d66e..5922ee0400c 100644
        --- a/test/hotspot/jtreg/serviceability/jvmti/thread/GetFrameLocation/frameloc01/libframeloc01.cpp
        +++ b/test/hotspot/jtreg/serviceability/jvmti/thread/GetFrameLocation/frameloc01/libframeloc01.cpp
        @@ -24,7 +24,7 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "jvmti_common.h"
        +#include "jvmti_common.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/serviceability/jvmti/thread/GetFrameLocation/frameloc02/libframeloc02.cpp b/test/hotspot/jtreg/serviceability/jvmti/thread/GetFrameLocation/frameloc02/libframeloc02.cpp
        index 53e9378fc8d..4fd96984a7b 100644
        --- a/test/hotspot/jtreg/serviceability/jvmti/thread/GetFrameLocation/frameloc02/libframeloc02.cpp
        +++ b/test/hotspot/jtreg/serviceability/jvmti/thread/GetFrameLocation/frameloc02/libframeloc02.cpp
        @@ -24,7 +24,7 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "jvmti_common.h"
        +#include "jvmti_common.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/serviceability/jvmti/thread/GetStackTrace/GetStackTraceAndRetransformTest/libGetStackTraceAndRetransformTest.cpp b/test/hotspot/jtreg/serviceability/jvmti/thread/GetStackTrace/GetStackTraceAndRetransformTest/libGetStackTraceAndRetransformTest.cpp
        index eea96df83f7..3e7b2fa950d 100644
        --- a/test/hotspot/jtreg/serviceability/jvmti/thread/GetStackTrace/GetStackTraceAndRetransformTest/libGetStackTraceAndRetransformTest.cpp
        +++ b/test/hotspot/jtreg/serviceability/jvmti/thread/GetStackTrace/GetStackTraceAndRetransformTest/libGetStackTraceAndRetransformTest.cpp
        @@ -1,4 +1,5 @@
         /*
        + * Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved.
          * Copyright (c) 2023, Datadog, Inc. All rights reserved.
          * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
          *
        @@ -24,7 +25,7 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "jvmti_common.h"
        +#include "jvmti_common.hpp"
         #include "../get_stack_trace.hpp"
         
         
        diff --git a/test/hotspot/jtreg/serviceability/jvmti/thread/GetStackTrace/GetStackTraceCurrentThreadTest/libGetStackTraceCurrentThreadTest.cpp b/test/hotspot/jtreg/serviceability/jvmti/thread/GetStackTrace/GetStackTraceCurrentThreadTest/libGetStackTraceCurrentThreadTest.cpp
        index 17e721a151e..d58c952fe84 100644
        --- a/test/hotspot/jtreg/serviceability/jvmti/thread/GetStackTrace/GetStackTraceCurrentThreadTest/libGetStackTraceCurrentThreadTest.cpp
        +++ b/test/hotspot/jtreg/serviceability/jvmti/thread/GetStackTrace/GetStackTraceCurrentThreadTest/libGetStackTraceCurrentThreadTest.cpp
        @@ -24,7 +24,7 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "jvmti_common.h"
        +#include "jvmti_common.hpp"
         #include "../get_stack_trace.hpp"
         
         
        diff --git a/test/hotspot/jtreg/serviceability/jvmti/thread/GetStackTrace/getstacktr03/libgetstacktr03.cpp b/test/hotspot/jtreg/serviceability/jvmti/thread/GetStackTrace/getstacktr03/libgetstacktr03.cpp
        index 51c6f5dc4c4..78224f7f12e 100644
        --- a/test/hotspot/jtreg/serviceability/jvmti/thread/GetStackTrace/getstacktr03/libgetstacktr03.cpp
        +++ b/test/hotspot/jtreg/serviceability/jvmti/thread/GetStackTrace/getstacktr03/libgetstacktr03.cpp
        @@ -24,7 +24,7 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "jvmti_common.h"
        +#include "jvmti_common.hpp"
         #include "../get_stack_trace.hpp"
         
         extern "C" {
        diff --git a/test/hotspot/jtreg/serviceability/jvmti/thread/GetStackTrace/getstacktr04/libgetstacktr04.cpp b/test/hotspot/jtreg/serviceability/jvmti/thread/GetStackTrace/getstacktr04/libgetstacktr04.cpp
        index 0cdbb7d0271..3a7bb8b1f06 100644
        --- a/test/hotspot/jtreg/serviceability/jvmti/thread/GetStackTrace/getstacktr04/libgetstacktr04.cpp
        +++ b/test/hotspot/jtreg/serviceability/jvmti/thread/GetStackTrace/getstacktr04/libgetstacktr04.cpp
        @@ -24,7 +24,7 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "jvmti_common.h"
        +#include "jvmti_common.hpp"
         #include "../get_stack_trace.hpp"
         
         extern "C" {
        diff --git a/test/hotspot/jtreg/serviceability/jvmti/thread/GetStackTrace/getstacktr05/libgetstacktr05.cpp b/test/hotspot/jtreg/serviceability/jvmti/thread/GetStackTrace/getstacktr05/libgetstacktr05.cpp
        index 19c6eb3967e..094fc6a64c7 100644
        --- a/test/hotspot/jtreg/serviceability/jvmti/thread/GetStackTrace/getstacktr05/libgetstacktr05.cpp
        +++ b/test/hotspot/jtreg/serviceability/jvmti/thread/GetStackTrace/getstacktr05/libgetstacktr05.cpp
        @@ -24,7 +24,7 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "jvmti_common.h"
        +#include "jvmti_common.hpp"
         #include "../get_stack_trace.hpp"
         
         extern "C" {
        diff --git a/test/hotspot/jtreg/serviceability/jvmti/thread/GetStackTrace/getstacktr06/libgetstacktr06.cpp b/test/hotspot/jtreg/serviceability/jvmti/thread/GetStackTrace/getstacktr06/libgetstacktr06.cpp
        index f0f17d50b17..7b687b03ea9 100644
        --- a/test/hotspot/jtreg/serviceability/jvmti/thread/GetStackTrace/getstacktr06/libgetstacktr06.cpp
        +++ b/test/hotspot/jtreg/serviceability/jvmti/thread/GetStackTrace/getstacktr06/libgetstacktr06.cpp
        @@ -24,7 +24,7 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "jvmti_common.h"
        +#include "jvmti_common.hpp"
         #include "../get_stack_trace.hpp"
         
         
        diff --git a/test/hotspot/jtreg/serviceability/jvmti/thread/GetStackTrace/getstacktr07/libgetstacktr07.cpp b/test/hotspot/jtreg/serviceability/jvmti/thread/GetStackTrace/getstacktr07/libgetstacktr07.cpp
        index baa5f8e90d9..b7f383ed232 100644
        --- a/test/hotspot/jtreg/serviceability/jvmti/thread/GetStackTrace/getstacktr07/libgetstacktr07.cpp
        +++ b/test/hotspot/jtreg/serviceability/jvmti/thread/GetStackTrace/getstacktr07/libgetstacktr07.cpp
        @@ -24,7 +24,7 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "jvmti_common.h"
        +#include "jvmti_common.hpp"
         #include "../get_stack_trace.hpp"
         
         extern "C" {
        diff --git a/test/hotspot/jtreg/serviceability/jvmti/thread/GetStackTrace/getstacktr08/libgetstacktr08.cpp b/test/hotspot/jtreg/serviceability/jvmti/thread/GetStackTrace/getstacktr08/libgetstacktr08.cpp
        index c3f6ad667b1..2543d1ceaf2 100644
        --- a/test/hotspot/jtreg/serviceability/jvmti/thread/GetStackTrace/getstacktr08/libgetstacktr08.cpp
        +++ b/test/hotspot/jtreg/serviceability/jvmti/thread/GetStackTrace/getstacktr08/libgetstacktr08.cpp
        @@ -24,7 +24,7 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "jvmti_common.h"
        +#include "jvmti_common.hpp"
         #include "../get_stack_trace.hpp"
         
         extern "C" {
        diff --git a/test/hotspot/jtreg/serviceability/jvmti/thread/GetThreadInfo/thrinfo01/libthrinfo01.cpp b/test/hotspot/jtreg/serviceability/jvmti/thread/GetThreadInfo/thrinfo01/libthrinfo01.cpp
        index e040b88ba88..1695071929d 100644
        --- a/test/hotspot/jtreg/serviceability/jvmti/thread/GetThreadInfo/thrinfo01/libthrinfo01.cpp
        +++ b/test/hotspot/jtreg/serviceability/jvmti/thread/GetThreadInfo/thrinfo01/libthrinfo01.cpp
        @@ -24,7 +24,7 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "jvmti_common.h"
        +#include "jvmti_common.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/serviceability/jvmti/thread/GetThreadState/thrstat01/libthrstat01.cpp b/test/hotspot/jtreg/serviceability/jvmti/thread/GetThreadState/thrstat01/libthrstat01.cpp
        index 4d54648a73f..41f9b2a8d66 100644
        --- a/test/hotspot/jtreg/serviceability/jvmti/thread/GetThreadState/thrstat01/libthrstat01.cpp
        +++ b/test/hotspot/jtreg/serviceability/jvmti/thread/GetThreadState/thrstat01/libthrstat01.cpp
        @@ -24,7 +24,7 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "jvmti_common.h"
        +#include "jvmti_common.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/serviceability/jvmti/thread/GetThreadState/thrstat02/libthrstat02.cpp b/test/hotspot/jtreg/serviceability/jvmti/thread/GetThreadState/thrstat02/libthrstat02.cpp
        index 588b2268f6d..3f12a04e82d 100644
        --- a/test/hotspot/jtreg/serviceability/jvmti/thread/GetThreadState/thrstat02/libthrstat02.cpp
        +++ b/test/hotspot/jtreg/serviceability/jvmti/thread/GetThreadState/thrstat02/libthrstat02.cpp
        @@ -24,7 +24,7 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "jvmti_common.h"
        +#include "jvmti_common.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/serviceability/jvmti/thread/GetThreadState/thrstat03/libthrstat03.cpp b/test/hotspot/jtreg/serviceability/jvmti/thread/GetThreadState/thrstat03/libthrstat03.cpp
        index 36a632ff32c..817ae62cc8b 100644
        --- a/test/hotspot/jtreg/serviceability/jvmti/thread/GetThreadState/thrstat03/libthrstat03.cpp
        +++ b/test/hotspot/jtreg/serviceability/jvmti/thread/GetThreadState/thrstat03/libthrstat03.cpp
        @@ -24,7 +24,7 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "jvmti_common.h"
        +#include "jvmti_common.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/serviceability/jvmti/thread/GetThreadState/thrstat05/libthrstat05.cpp b/test/hotspot/jtreg/serviceability/jvmti/thread/GetThreadState/thrstat05/libthrstat05.cpp
        index 3fd9b535de4..fef814a0a7d 100644
        --- a/test/hotspot/jtreg/serviceability/jvmti/thread/GetThreadState/thrstat05/libthrstat05.cpp
        +++ b/test/hotspot/jtreg/serviceability/jvmti/thread/GetThreadState/thrstat05/libthrstat05.cpp
        @@ -26,7 +26,7 @@
         
         #include 
         #include "jvmti.h"
        -#include "jvmti_common.h"
        +#include "jvmti_common.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/serviceability/jvmti/thread/ResumeThread/resumethrd01/libresumethrd01.cpp b/test/hotspot/jtreg/serviceability/jvmti/thread/ResumeThread/resumethrd01/libresumethrd01.cpp
        index d3b2f5745b5..37d52e43d07 100644
        --- a/test/hotspot/jtreg/serviceability/jvmti/thread/ResumeThread/resumethrd01/libresumethrd01.cpp
        +++ b/test/hotspot/jtreg/serviceability/jvmti/thread/ResumeThread/resumethrd01/libresumethrd01.cpp
        @@ -23,8 +23,8 @@
         
         #include 
         #include "jvmti.h"
        -#include "jvmti_common.h"
        -#include "jvmti_thread.h"
        +#include "jvmti_common.hpp"
        +#include "jvmti_thread.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/serviceability/jvmti/thread/ResumeThread/resumethrd02/libresumethrd02.cpp b/test/hotspot/jtreg/serviceability/jvmti/thread/ResumeThread/resumethrd02/libresumethrd02.cpp
        index 665c1a4da93..83ced2ded6a 100644
        --- a/test/hotspot/jtreg/serviceability/jvmti/thread/ResumeThread/resumethrd02/libresumethrd02.cpp
        +++ b/test/hotspot/jtreg/serviceability/jvmti/thread/ResumeThread/resumethrd02/libresumethrd02.cpp
        @@ -23,8 +23,8 @@
         
         #include 
         #include "jvmti.h"
        -#include "jvmti_common.h"
        -#include "jvmti_thread.h"
        +#include "jvmti_common.hpp"
        +#include "jvmti_thread.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/serviceability/jvmti/thread/ResumeThreadList/resumethrdlst01/libresumethrdlst01.cpp b/test/hotspot/jtreg/serviceability/jvmti/thread/ResumeThreadList/resumethrdlst01/libresumethrdlst01.cpp
        index 42c4a4579fe..cc1708340a6 100644
        --- a/test/hotspot/jtreg/serviceability/jvmti/thread/ResumeThreadList/resumethrdlst01/libresumethrdlst01.cpp
        +++ b/test/hotspot/jtreg/serviceability/jvmti/thread/ResumeThreadList/resumethrdlst01/libresumethrdlst01.cpp
        @@ -23,8 +23,8 @@
         
         #include 
         #include "jvmti.h"
        -#include "jvmti_common.h"
        -#include "jvmti_thread.h"
        +#include "jvmti_common.hpp"
        +#include "jvmti_thread.hpp"
         
         
         
        diff --git a/test/hotspot/jtreg/serviceability/jvmti/thread/ResumeThreadList/resumethrdlst02/libresumethrdlst02.cpp b/test/hotspot/jtreg/serviceability/jvmti/thread/ResumeThreadList/resumethrdlst02/libresumethrdlst02.cpp
        index 5d622b926db..91a0dc79175 100644
        --- a/test/hotspot/jtreg/serviceability/jvmti/thread/ResumeThreadList/resumethrdlst02/libresumethrdlst02.cpp
        +++ b/test/hotspot/jtreg/serviceability/jvmti/thread/ResumeThreadList/resumethrdlst02/libresumethrdlst02.cpp
        @@ -23,8 +23,8 @@
         
         #include 
         #include "jvmti.h"
        -#include "jvmti_common.h"
        -#include "jvmti_thread.h"
        +#include "jvmti_common.hpp"
        +#include "jvmti_thread.hpp"
         
         
         
        diff --git a/test/hotspot/jtreg/serviceability/jvmti/thread/SuspendThread/suspendthrd01/libsuspendthrd01.cpp b/test/hotspot/jtreg/serviceability/jvmti/thread/SuspendThread/suspendthrd01/libsuspendthrd01.cpp
        index 300a479d4ce..053023529cd 100644
        --- a/test/hotspot/jtreg/serviceability/jvmti/thread/SuspendThread/suspendthrd01/libsuspendthrd01.cpp
        +++ b/test/hotspot/jtreg/serviceability/jvmti/thread/SuspendThread/suspendthrd01/libsuspendthrd01.cpp
        @@ -23,8 +23,8 @@
         
         #include 
         #include "jvmti.h"
        -#include "jvmti_common.h"
        -#include "jvmti_thread.h"
        +#include "jvmti_common.hpp"
        +#include "jvmti_thread.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/serviceability/jvmti/thread/SuspendThread/suspendthrd02/libsuspendthrd02.cpp b/test/hotspot/jtreg/serviceability/jvmti/thread/SuspendThread/suspendthrd02/libsuspendthrd02.cpp
        index 9ab8e053a51..0f8316f3c74 100644
        --- a/test/hotspot/jtreg/serviceability/jvmti/thread/SuspendThread/suspendthrd02/libsuspendthrd02.cpp
        +++ b/test/hotspot/jtreg/serviceability/jvmti/thread/SuspendThread/suspendthrd02/libsuspendthrd02.cpp
        @@ -23,8 +23,8 @@
         
         #include 
         #include "jvmti.h"
        -#include "jvmti_common.h"
        -#include "jvmti_thread.h"
        +#include "jvmti_common.hpp"
        +#include "jvmti_thread.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/serviceability/jvmti/thread/SuspendThreadList/suspendthrdlst01/libsuspendthrdlst01.cpp b/test/hotspot/jtreg/serviceability/jvmti/thread/SuspendThreadList/suspendthrdlst01/libsuspendthrdlst01.cpp
        index 30fb104beff..70cfb81f10f 100644
        --- a/test/hotspot/jtreg/serviceability/jvmti/thread/SuspendThreadList/suspendthrdlst01/libsuspendthrdlst01.cpp
        +++ b/test/hotspot/jtreg/serviceability/jvmti/thread/SuspendThreadList/suspendthrdlst01/libsuspendthrdlst01.cpp
        @@ -23,8 +23,8 @@
         
         #include 
         #include "jvmti.h"
        -#include "jvmti_common.h"
        -#include "jvmti_thread.h"
        +#include "jvmti_common.hpp"
        +#include "jvmti_thread.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/serviceability/jvmti/thread/SuspendThreadList/suspendthrdlst02/libsuspendthrdlst02.cpp b/test/hotspot/jtreg/serviceability/jvmti/thread/SuspendThreadList/suspendthrdlst02/libsuspendthrdlst02.cpp
        index 2ccc96c2596..8982b95b514 100644
        --- a/test/hotspot/jtreg/serviceability/jvmti/thread/SuspendThreadList/suspendthrdlst02/libsuspendthrdlst02.cpp
        +++ b/test/hotspot/jtreg/serviceability/jvmti/thread/SuspendThreadList/suspendthrdlst02/libsuspendthrdlst02.cpp
        @@ -23,8 +23,8 @@
         
         #include 
         #include "jvmti.h"
        -#include "jvmti_common.h"
        -#include "jvmti_thread.h"
        +#include "jvmti_common.hpp"
        +#include "jvmti_thread.hpp"
         
         #include 
         
        diff --git a/test/hotspot/jtreg/serviceability/jvmti/vthread/BoundVThreadTest/libBoundVThreadTest.cpp b/test/hotspot/jtreg/serviceability/jvmti/vthread/BoundVThreadTest/libBoundVThreadTest.cpp
        index 0fa0f065ae8..ff332ae454c 100644
        --- a/test/hotspot/jtreg/serviceability/jvmti/vthread/BoundVThreadTest/libBoundVThreadTest.cpp
        +++ b/test/hotspot/jtreg/serviceability/jvmti/vthread/BoundVThreadTest/libBoundVThreadTest.cpp
        @@ -1,5 +1,5 @@
         /*
        - * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved.
        + * Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved.
          * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
          *
          * This code is free software; you can redistribute it and/or modify it
        @@ -23,7 +23,7 @@
         
         #include 
         #include "jvmti.h"
        -#include "jvmti_common.h"
        +#include "jvmti_common.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/serviceability/jvmti/vthread/BreakpointInYieldTest/libBreakpointInYieldTest.cpp b/test/hotspot/jtreg/serviceability/jvmti/vthread/BreakpointInYieldTest/libBreakpointInYieldTest.cpp
        index aa9f3bbd52a..0e647672c21 100644
        --- a/test/hotspot/jtreg/serviceability/jvmti/vthread/BreakpointInYieldTest/libBreakpointInYieldTest.cpp
        +++ b/test/hotspot/jtreg/serviceability/jvmti/vthread/BreakpointInYieldTest/libBreakpointInYieldTest.cpp
        @@ -23,7 +23,7 @@
         
         #include 
         #include "jvmti.h"
        -#include "jvmti_common.h"
        +#include "jvmti_common.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/serviceability/jvmti/vthread/ContFramePopTest/libContFramePopTest.cpp b/test/hotspot/jtreg/serviceability/jvmti/vthread/ContFramePopTest/libContFramePopTest.cpp
        index 1840b6ccac7..9b8ab8b7af2 100644
        --- a/test/hotspot/jtreg/serviceability/jvmti/vthread/ContFramePopTest/libContFramePopTest.cpp
        +++ b/test/hotspot/jtreg/serviceability/jvmti/vthread/ContFramePopTest/libContFramePopTest.cpp
        @@ -23,7 +23,7 @@
         
         #include 
         #include "jvmti.h"
        -#include "jvmti_common.h"
        +#include "jvmti_common.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/serviceability/jvmti/vthread/ContStackDepthTest/libContStackDepthTest.cpp b/test/hotspot/jtreg/serviceability/jvmti/vthread/ContStackDepthTest/libContStackDepthTest.cpp
        index 9bafe3bd5d0..60a3f17fbb0 100644
        --- a/test/hotspot/jtreg/serviceability/jvmti/vthread/ContStackDepthTest/libContStackDepthTest.cpp
        +++ b/test/hotspot/jtreg/serviceability/jvmti/vthread/ContStackDepthTest/libContStackDepthTest.cpp
        @@ -23,7 +23,7 @@
         
         #include 
         #include "jvmti.h"
        -#include "jvmti_common.h"
        +#include "jvmti_common.hpp"
         
         
         extern "C" {
        diff --git a/test/hotspot/jtreg/serviceability/jvmti/vthread/ContYieldBreakPointTest/libContYieldBreakPointTest.cpp b/test/hotspot/jtreg/serviceability/jvmti/vthread/ContYieldBreakPointTest/libContYieldBreakPointTest.cpp
        index e8ac3886461..7a9af14f478 100644
        --- a/test/hotspot/jtreg/serviceability/jvmti/vthread/ContYieldBreakPointTest/libContYieldBreakPointTest.cpp
        +++ b/test/hotspot/jtreg/serviceability/jvmti/vthread/ContYieldBreakPointTest/libContYieldBreakPointTest.cpp
        @@ -23,7 +23,7 @@
         
         #include 
         #include "jvmti.h"
        -#include "jvmti_common.h"
        +#include "jvmti_common.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/serviceability/jvmti/vthread/ContinuationTest/libContinuationTest.cpp b/test/hotspot/jtreg/serviceability/jvmti/vthread/ContinuationTest/libContinuationTest.cpp
        index 81cc1368ad8..c647fcfb469 100644
        --- a/test/hotspot/jtreg/serviceability/jvmti/vthread/ContinuationTest/libContinuationTest.cpp
        +++ b/test/hotspot/jtreg/serviceability/jvmti/vthread/ContinuationTest/libContinuationTest.cpp
        @@ -23,7 +23,7 @@
         
         #include 
         #include "jvmti.h"
        -#include "jvmti_common.h"
        +#include "jvmti_common.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/serviceability/jvmti/vthread/FollowReferences/libVThreadStackRefTest.cpp b/test/hotspot/jtreg/serviceability/jvmti/vthread/FollowReferences/libVThreadStackRefTest.cpp
        index 3034e9e1475..9946364deee 100644
        --- a/test/hotspot/jtreg/serviceability/jvmti/vthread/FollowReferences/libVThreadStackRefTest.cpp
        +++ b/test/hotspot/jtreg/serviceability/jvmti/vthread/FollowReferences/libVThreadStackRefTest.cpp
        @@ -1,5 +1,5 @@
         /*
        - * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved.
        + * Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved.
          * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
          *
          * This code is free software; you can redistribute it and/or modify it
        @@ -23,7 +23,7 @@
         
         #include 
         #include 
        -#include 
        +#include 
         #include 
         #include 
         
        diff --git a/test/hotspot/jtreg/serviceability/jvmti/vthread/ForceEarlyReturnTest/libForceEarlyReturnTest.cpp b/test/hotspot/jtreg/serviceability/jvmti/vthread/ForceEarlyReturnTest/libForceEarlyReturnTest.cpp
        index 4407c5d074d..e659bd304f8 100644
        --- a/test/hotspot/jtreg/serviceability/jvmti/vthread/ForceEarlyReturnTest/libForceEarlyReturnTest.cpp
        +++ b/test/hotspot/jtreg/serviceability/jvmti/vthread/ForceEarlyReturnTest/libForceEarlyReturnTest.cpp
        @@ -24,7 +24,7 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "jvmti_common.h"
        +#include "jvmti_common.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/serviceability/jvmti/vthread/GetSetLocalTest/libGetSetLocalTest.cpp b/test/hotspot/jtreg/serviceability/jvmti/vthread/GetSetLocalTest/libGetSetLocalTest.cpp
        index 20b2edb1e9d..46cce443f4d 100644
        --- a/test/hotspot/jtreg/serviceability/jvmti/vthread/GetSetLocalTest/libGetSetLocalTest.cpp
        +++ b/test/hotspot/jtreg/serviceability/jvmti/vthread/GetSetLocalTest/libGetSetLocalTest.cpp
        @@ -23,7 +23,7 @@
         
         #include 
         #include "jvmti.h"
        -#include "jvmti_common.h"
        +#include "jvmti_common.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/serviceability/jvmti/vthread/GetThreadStateMountedTest/libGetThreadStateMountedTest.cpp b/test/hotspot/jtreg/serviceability/jvmti/vthread/GetThreadStateMountedTest/libGetThreadStateMountedTest.cpp
        index 4de5ebe1e89..e6ee99eb23f 100644
        --- a/test/hotspot/jtreg/serviceability/jvmti/vthread/GetThreadStateMountedTest/libGetThreadStateMountedTest.cpp
        +++ b/test/hotspot/jtreg/serviceability/jvmti/vthread/GetThreadStateMountedTest/libGetThreadStateMountedTest.cpp
        @@ -1,5 +1,5 @@
         /*
        - * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved.
        + * Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved.
          * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
          *
          * This code is free software; you can redistribute it and/or modify it
        @@ -23,7 +23,7 @@
         
         #include 
         #include 
        -#include 
        +#include 
         #include 
         
         static jvmtiEnv *jvmti = nullptr;
        diff --git a/test/hotspot/jtreg/serviceability/jvmti/vthread/InterruptThreadTest/libInterruptThreadTest.cpp b/test/hotspot/jtreg/serviceability/jvmti/vthread/InterruptThreadTest/libInterruptThreadTest.cpp
        index 6be49bfb456..8208e9bb1b4 100644
        --- a/test/hotspot/jtreg/serviceability/jvmti/vthread/InterruptThreadTest/libInterruptThreadTest.cpp
        +++ b/test/hotspot/jtreg/serviceability/jvmti/vthread/InterruptThreadTest/libInterruptThreadTest.cpp
        @@ -25,7 +25,7 @@
         #include 
         
         #include "jvmti.h"
        -#include "jvmti_common.h"
        +#include "jvmti_common.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/serviceability/jvmti/vthread/MethodExitTest/libMethodExitTest.cpp b/test/hotspot/jtreg/serviceability/jvmti/vthread/MethodExitTest/libMethodExitTest.cpp
        index fb6b0bab587..78e14223377 100644
        --- a/test/hotspot/jtreg/serviceability/jvmti/vthread/MethodExitTest/libMethodExitTest.cpp
        +++ b/test/hotspot/jtreg/serviceability/jvmti/vthread/MethodExitTest/libMethodExitTest.cpp
        @@ -23,7 +23,7 @@
         
         #include 
         #include "jvmti.h"
        -#include "jvmti_common.h"
        +#include "jvmti_common.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/serviceability/jvmti/vthread/NullAsCurrentThreadTest/libNullAsCurrentThreadTest.cpp b/test/hotspot/jtreg/serviceability/jvmti/vthread/NullAsCurrentThreadTest/libNullAsCurrentThreadTest.cpp
        index 82c51dfed75..ec808cfc058 100644
        --- a/test/hotspot/jtreg/serviceability/jvmti/vthread/NullAsCurrentThreadTest/libNullAsCurrentThreadTest.cpp
        +++ b/test/hotspot/jtreg/serviceability/jvmti/vthread/NullAsCurrentThreadTest/libNullAsCurrentThreadTest.cpp
        @@ -23,7 +23,7 @@
         
         #include 
         #include "jvmti.h"
        -#include "jvmti_common.h"
        +#include "jvmti_common.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/serviceability/jvmti/vthread/PinnedTaskTest/libPinnedTaskTest.cpp b/test/hotspot/jtreg/serviceability/jvmti/vthread/PinnedTaskTest/libPinnedTaskTest.cpp
        index d50d1ab4b8b..91f5e6fecc2 100644
        --- a/test/hotspot/jtreg/serviceability/jvmti/vthread/PinnedTaskTest/libPinnedTaskTest.cpp
        +++ b/test/hotspot/jtreg/serviceability/jvmti/vthread/PinnedTaskTest/libPinnedTaskTest.cpp
        @@ -22,7 +22,7 @@
          */
         
         #include "jvmti.h"
        -#include "jvmti_common.h"
        +#include "jvmti_common.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/serviceability/jvmti/vthread/PopFrameTest/libPopFrameTest.cpp b/test/hotspot/jtreg/serviceability/jvmti/vthread/PopFrameTest/libPopFrameTest.cpp
        index 327b7d1cb2a..4001296e967 100644
        --- a/test/hotspot/jtreg/serviceability/jvmti/vthread/PopFrameTest/libPopFrameTest.cpp
        +++ b/test/hotspot/jtreg/serviceability/jvmti/vthread/PopFrameTest/libPopFrameTest.cpp
        @@ -24,7 +24,7 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "jvmti_common.h"
        +#include "jvmti_common.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/serviceability/jvmti/vthread/RawMonitorTest/libRawMonitorTest.cpp b/test/hotspot/jtreg/serviceability/jvmti/vthread/RawMonitorTest/libRawMonitorTest.cpp
        index 1e7c49af7a9..1903e256392 100644
        --- a/test/hotspot/jtreg/serviceability/jvmti/vthread/RawMonitorTest/libRawMonitorTest.cpp
        +++ b/test/hotspot/jtreg/serviceability/jvmti/vthread/RawMonitorTest/libRawMonitorTest.cpp
        @@ -25,7 +25,7 @@
         #include 
         
         #include "jvmti.h"
        -#include "jvmti_common.h"
        +#include "jvmti_common.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/serviceability/jvmti/vthread/SelfSuspendDisablerTest/libSelfSuspendDisablerTest.cpp b/test/hotspot/jtreg/serviceability/jvmti/vthread/SelfSuspendDisablerTest/libSelfSuspendDisablerTest.cpp
        index 74a1a3efc0d..a7d61b90e51 100644
        --- a/test/hotspot/jtreg/serviceability/jvmti/vthread/SelfSuspendDisablerTest/libSelfSuspendDisablerTest.cpp
        +++ b/test/hotspot/jtreg/serviceability/jvmti/vthread/SelfSuspendDisablerTest/libSelfSuspendDisablerTest.cpp
        @@ -23,7 +23,7 @@
         
         #include 
         #include "jvmti.h"
        -#include "jvmti_common.h"
        +#include "jvmti_common.hpp"
         
         static jvmtiEnv *jvmti = nullptr;
         
        diff --git a/test/hotspot/jtreg/serviceability/jvmti/vthread/StopThreadTest/libStopThreadTest.cpp b/test/hotspot/jtreg/serviceability/jvmti/vthread/StopThreadTest/libStopThreadTest.cpp
        index ade0e7fb67c..36f70a971a0 100644
        --- a/test/hotspot/jtreg/serviceability/jvmti/vthread/StopThreadTest/libStopThreadTest.cpp
        +++ b/test/hotspot/jtreg/serviceability/jvmti/vthread/StopThreadTest/libStopThreadTest.cpp
        @@ -24,7 +24,7 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "jvmti_common.h"
        +#include "jvmti_common.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/serviceability/jvmti/vthread/SuspendResume1/libSuspendResume1.cpp b/test/hotspot/jtreg/serviceability/jvmti/vthread/SuspendResume1/libSuspendResume1.cpp
        index 9854008c142..f05e619e0bd 100644
        --- a/test/hotspot/jtreg/serviceability/jvmti/vthread/SuspendResume1/libSuspendResume1.cpp
        +++ b/test/hotspot/jtreg/serviceability/jvmti/vthread/SuspendResume1/libSuspendResume1.cpp
        @@ -23,8 +23,8 @@
         
         #include 
         #include "jvmti.h"
        -#include "jvmti_common.h"
        -#include "jvmti_thread.h"
        +#include "jvmti_common.hpp"
        +#include "jvmti_thread.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/serviceability/jvmti/vthread/SuspendResume2/libSuspendResume2.cpp b/test/hotspot/jtreg/serviceability/jvmti/vthread/SuspendResume2/libSuspendResume2.cpp
        index 97cae4f0f0c..68066c04575 100644
        --- a/test/hotspot/jtreg/serviceability/jvmti/vthread/SuspendResume2/libSuspendResume2.cpp
        +++ b/test/hotspot/jtreg/serviceability/jvmti/vthread/SuspendResume2/libSuspendResume2.cpp
        @@ -23,8 +23,8 @@
         
         #include 
         #include "jvmti.h"
        -#include "jvmti_common.h"
        -#include "jvmti_thread.h"
        +#include "jvmti_common.hpp"
        +#include "jvmti_thread.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/serviceability/jvmti/vthread/SuspendResumeAll/libSuspendResumeAll.cpp b/test/hotspot/jtreg/serviceability/jvmti/vthread/SuspendResumeAll/libSuspendResumeAll.cpp
        index 4aef71c8737..e53484b575b 100644
        --- a/test/hotspot/jtreg/serviceability/jvmti/vthread/SuspendResumeAll/libSuspendResumeAll.cpp
        +++ b/test/hotspot/jtreg/serviceability/jvmti/vthread/SuspendResumeAll/libSuspendResumeAll.cpp
        @@ -23,8 +23,8 @@
         
         #include 
         #include "jvmti.h"
        -#include "jvmti_common.h"
        -#include "jvmti_thread.h"
        +#include "jvmti_common.hpp"
        +#include "jvmti_thread.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/serviceability/jvmti/vthread/ThreadListStackTracesTest/libThreadListStackTracesTest.cpp b/test/hotspot/jtreg/serviceability/jvmti/vthread/ThreadListStackTracesTest/libThreadListStackTracesTest.cpp
        index 3edb2871cc2..918f547375b 100644
        --- a/test/hotspot/jtreg/serviceability/jvmti/vthread/ThreadListStackTracesTest/libThreadListStackTracesTest.cpp
        +++ b/test/hotspot/jtreg/serviceability/jvmti/vthread/ThreadListStackTracesTest/libThreadListStackTracesTest.cpp
        @@ -25,7 +25,7 @@
         #include 
         #include 
         #include 
        -#include "jvmti_common.h"
        +#include "jvmti_common.hpp"
         
         static jvmtiEnv* jvmti = nullptr;
         static const jint MAX_FRAME_COUNT = 32;
        diff --git a/test/hotspot/jtreg/serviceability/jvmti/vthread/ThreadStateTest/libThreadStateTest.cpp b/test/hotspot/jtreg/serviceability/jvmti/vthread/ThreadStateTest/libThreadStateTest.cpp
        index c07b0924cfe..10dfdfda347 100644
        --- a/test/hotspot/jtreg/serviceability/jvmti/vthread/ThreadStateTest/libThreadStateTest.cpp
        +++ b/test/hotspot/jtreg/serviceability/jvmti/vthread/ThreadStateTest/libThreadStateTest.cpp
        @@ -25,7 +25,7 @@
         #include 
         #include 
         #include 
        -#include "jvmti_common.h"
        +#include "jvmti_common.hpp"
         
         // set by Agent_OnLoad
         static jvmtiEnv* jvmti = nullptr;
        diff --git a/test/hotspot/jtreg/serviceability/jvmti/vthread/ToggleNotifyJvmtiTest/libToggleNotifyJvmtiTest.cpp b/test/hotspot/jtreg/serviceability/jvmti/vthread/ToggleNotifyJvmtiTest/libToggleNotifyJvmtiTest.cpp
        index 9ecece684ab..b09565f886a 100644
        --- a/test/hotspot/jtreg/serviceability/jvmti/vthread/ToggleNotifyJvmtiTest/libToggleNotifyJvmtiTest.cpp
        +++ b/test/hotspot/jtreg/serviceability/jvmti/vthread/ToggleNotifyJvmtiTest/libToggleNotifyJvmtiTest.cpp
        @@ -24,7 +24,7 @@
         #include 
         #include 
         #include 
        -#include "jvmti_common.h"
        +#include "jvmti_common.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/serviceability/jvmti/vthread/VThreadEventTest/libVThreadEventTest.cpp b/test/hotspot/jtreg/serviceability/jvmti/vthread/VThreadEventTest/libVThreadEventTest.cpp
        index 24b678eb18e..afd06e66b32 100644
        --- a/test/hotspot/jtreg/serviceability/jvmti/vthread/VThreadEventTest/libVThreadEventTest.cpp
        +++ b/test/hotspot/jtreg/serviceability/jvmti/vthread/VThreadEventTest/libVThreadEventTest.cpp
        @@ -1,5 +1,5 @@
         /*
        - * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved.
        + * Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved.
          * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
          *
          * This code is free software; you can redistribute it and/or modify it
        @@ -24,7 +24,7 @@
         #include 
         #include 
         #include 
        -#include "jvmti_common.h"
        +#include "jvmti_common.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/serviceability/jvmti/vthread/VThreadMonitorTest/libVThreadMonitorTest.cpp b/test/hotspot/jtreg/serviceability/jvmti/vthread/VThreadMonitorTest/libVThreadMonitorTest.cpp
        index c05404658fe..af0861ee031 100644
        --- a/test/hotspot/jtreg/serviceability/jvmti/vthread/VThreadMonitorTest/libVThreadMonitorTest.cpp
        +++ b/test/hotspot/jtreg/serviceability/jvmti/vthread/VThreadMonitorTest/libVThreadMonitorTest.cpp
        @@ -25,7 +25,7 @@
         #include 
         #include "jvmti.h"
         #include "jni.h"
        -#include "jvmti_common.h"
        +#include "jvmti_common.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/serviceability/jvmti/vthread/VThreadNotifyFramePopTest/libVThreadNotifyFramePopTest.cpp b/test/hotspot/jtreg/serviceability/jvmti/vthread/VThreadNotifyFramePopTest/libVThreadNotifyFramePopTest.cpp
        index d5254293ab1..30382a87ee9 100644
        --- a/test/hotspot/jtreg/serviceability/jvmti/vthread/VThreadNotifyFramePopTest/libVThreadNotifyFramePopTest.cpp
        +++ b/test/hotspot/jtreg/serviceability/jvmti/vthread/VThreadNotifyFramePopTest/libVThreadNotifyFramePopTest.cpp
        @@ -23,7 +23,7 @@
         
         #include 
         #include "jvmti.h"
        -#include "jvmti_common.h"
        +#include "jvmti_common.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/serviceability/jvmti/vthread/VThreadTLSTest/libVThreadTLSTest.cpp b/test/hotspot/jtreg/serviceability/jvmti/vthread/VThreadTLSTest/libVThreadTLSTest.cpp
        index ac4da3a76a7..278f4499503 100644
        --- a/test/hotspot/jtreg/serviceability/jvmti/vthread/VThreadTLSTest/libVThreadTLSTest.cpp
        +++ b/test/hotspot/jtreg/serviceability/jvmti/vthread/VThreadTLSTest/libVThreadTLSTest.cpp
        @@ -1,5 +1,5 @@
         /*
        - * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved.
        + * Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved.
          * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
          *
          * This code is free software; you can redistribute it and/or modify it
        @@ -24,7 +24,7 @@
         #include 
         #include 
         #include 
        -#include "jvmti_common.h"
        +#include "jvmti_common.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/serviceability/jvmti/vthread/VThreadTest/libVThreadTest.cpp b/test/hotspot/jtreg/serviceability/jvmti/vthread/VThreadTest/libVThreadTest.cpp
        index 701797bcfc2..9433a4dcfaf 100644
        --- a/test/hotspot/jtreg/serviceability/jvmti/vthread/VThreadTest/libVThreadTest.cpp
        +++ b/test/hotspot/jtreg/serviceability/jvmti/vthread/VThreadTest/libVThreadTest.cpp
        @@ -23,7 +23,7 @@
         
         #include 
         #include "jvmti.h"
        -#include "jvmti_common.h"
        +#include "jvmti_common.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/serviceability/jvmti/vthread/VThreadUnsupportedTest/libVThreadUnsupportedTest.cpp b/test/hotspot/jtreg/serviceability/jvmti/vthread/VThreadUnsupportedTest/libVThreadUnsupportedTest.cpp
        index 5b299a46f48..eb5ea872b91 100644
        --- a/test/hotspot/jtreg/serviceability/jvmti/vthread/VThreadUnsupportedTest/libVThreadUnsupportedTest.cpp
        +++ b/test/hotspot/jtreg/serviceability/jvmti/vthread/VThreadUnsupportedTest/libVThreadUnsupportedTest.cpp
        @@ -25,7 +25,7 @@
         #include 
         
         #include "jvmti.h"
        -#include "jvmti_common.h"
        +#include "jvmti_common.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/serviceability/jvmti/vthread/VirtualStackTraceTest/libVirtualStackTraceTest.cpp b/test/hotspot/jtreg/serviceability/jvmti/vthread/VirtualStackTraceTest/libVirtualStackTraceTest.cpp
        index 744e75ac29f..9e613d5b0f9 100644
        --- a/test/hotspot/jtreg/serviceability/jvmti/vthread/VirtualStackTraceTest/libVirtualStackTraceTest.cpp
        +++ b/test/hotspot/jtreg/serviceability/jvmti/vthread/VirtualStackTraceTest/libVirtualStackTraceTest.cpp
        @@ -24,7 +24,7 @@
         #include 
         #include 
         #include 
        -#include "jvmti_common.h"
        +#include "jvmti_common.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/serviceability/jvmti/vthread/VirtualThreadStartTest/libVirtualThreadStartTest.cpp b/test/hotspot/jtreg/serviceability/jvmti/vthread/VirtualThreadStartTest/libVirtualThreadStartTest.cpp
        index 262712dfb0c..711edaff9d3 100644
        --- a/test/hotspot/jtreg/serviceability/jvmti/vthread/VirtualThreadStartTest/libVirtualThreadStartTest.cpp
        +++ b/test/hotspot/jtreg/serviceability/jvmti/vthread/VirtualThreadStartTest/libVirtualThreadStartTest.cpp
        @@ -24,7 +24,7 @@
         #include 
         #include 
         #include 
        -#include "jvmti_common.h"
        +#include "jvmti_common.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/serviceability/jvmti/vthread/WaitNotifySuspendedVThreadTest/libWaitNotifySuspendedVThread.cpp b/test/hotspot/jtreg/serviceability/jvmti/vthread/WaitNotifySuspendedVThreadTest/libWaitNotifySuspendedVThread.cpp
        index 44b931c0ff9..bcaa1d605f7 100644
        --- a/test/hotspot/jtreg/serviceability/jvmti/vthread/WaitNotifySuspendedVThreadTest/libWaitNotifySuspendedVThread.cpp
        +++ b/test/hotspot/jtreg/serviceability/jvmti/vthread/WaitNotifySuspendedVThreadTest/libWaitNotifySuspendedVThread.cpp
        @@ -23,7 +23,7 @@
         
         #include 
         #include "jvmti.h"
        -#include "jvmti_common.h"
        +#include "jvmti_common.hpp"
         
         jrawMonitorID monitor;
         jrawMonitorID monitor_completed;
        diff --git a/test/hotspot/jtreg/testlibrary/jvmti/libJvmtiUtils.cpp b/test/hotspot/jtreg/testlibrary/jvmti/libJvmtiUtils.cpp
        index 28afafda3a7..a5b2b268ff1 100644
        --- a/test/hotspot/jtreg/testlibrary/jvmti/libJvmtiUtils.cpp
        +++ b/test/hotspot/jtreg/testlibrary/jvmti/libJvmtiUtils.cpp
        @@ -23,7 +23,7 @@
         
         #include 
         #include "jvmti.h"
        -#include "jvmti_common.h"
        +#include "jvmti_common.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/aod/VirtualMachine/VirtualMachine07/agent00.cpp b/test/hotspot/jtreg/vmTestbase/nsk/aod/VirtualMachine/VirtualMachine07/agent00.cpp
        index 5d819851e4b..a4c5eafd87f 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/aod/VirtualMachine/VirtualMachine07/agent00.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/aod/VirtualMachine/VirtualMachine07/agent00.cpp
        @@ -24,7 +24,7 @@
         #include 
         #include 
         #include 
        -#include 
        +#include 
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/aod/VirtualMachine/VirtualMachine07/agent01.cpp b/test/hotspot/jtreg/vmTestbase/nsk/aod/VirtualMachine/VirtualMachine07/agent01.cpp
        index d2c5f13cd34..5209cfd393d 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/aod/VirtualMachine/VirtualMachine07/agent01.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/aod/VirtualMachine/VirtualMachine07/agent01.cpp
        @@ -24,7 +24,7 @@
         #include 
         #include 
         #include 
        -#include 
        +#include 
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/aod/VirtualMachine/VirtualMachine07/agent02.cpp b/test/hotspot/jtreg/vmTestbase/nsk/aod/VirtualMachine/VirtualMachine07/agent02.cpp
        index 257511c60f3..f8e5b20c18e 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/aod/VirtualMachine/VirtualMachine07/agent02.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/aod/VirtualMachine/VirtualMachine07/agent02.cpp
        @@ -24,7 +24,7 @@
         #include 
         #include 
         #include 
        -#include 
        +#include 
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/aod/VirtualMachine/VirtualMachine07/agent03.cpp b/test/hotspot/jtreg/vmTestbase/nsk/aod/VirtualMachine/VirtualMachine07/agent03.cpp
        index 66bbc6a990a..f2d3586ee6b 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/aod/VirtualMachine/VirtualMachine07/agent03.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/aod/VirtualMachine/VirtualMachine07/agent03.cpp
        @@ -24,7 +24,7 @@
         #include 
         #include 
         #include 
        -#include 
        +#include 
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/aod/VirtualMachine/VirtualMachine09/agent00.cpp b/test/hotspot/jtreg/vmTestbase/nsk/aod/VirtualMachine/VirtualMachine09/agent00.cpp
        index e7e6452603f..799a34d26d0 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/aod/VirtualMachine/VirtualMachine09/agent00.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/aod/VirtualMachine/VirtualMachine09/agent00.cpp
        @@ -24,7 +24,7 @@
         #include 
         #include 
         #include 
        -#include 
        +#include 
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AddCapabilities/addcaps001/addcaps001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AddCapabilities/addcaps001/addcaps001.cpp
        index 65ff008a046..711ceda69cc 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AddCapabilities/addcaps001/addcaps001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AddCapabilities/addcaps001/addcaps001.cpp
        @@ -24,9 +24,9 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "jni_tools.h"
        -#include "jvmti_tools.h"
        +#include "agent_common.hpp"
        +#include "jni_tools.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AddCapabilities/addcaps002/addcaps002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AddCapabilities/addcaps002/addcaps002.cpp
        index 5853d3db13e..b15f99e15d5 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AddCapabilities/addcaps002/addcaps002.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AddCapabilities/addcaps002/addcaps002.cpp
        @@ -24,9 +24,9 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "jni_tools.h"
        -#include "jvmti_tools.h"
        +#include "agent_common.hpp"
        +#include "jni_tools.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AddCapabilities/addcaps003/addcaps003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AddCapabilities/addcaps003/addcaps003.cpp
        index 742d50aaf8e..bfbb0048ae2 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AddCapabilities/addcaps003/addcaps003.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AddCapabilities/addcaps003/addcaps003.cpp
        @@ -23,9 +23,9 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "jni_tools.h"
        -#include "jvmti_tools.h"
        +#include "agent_common.hpp"
        +#include "jni_tools.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/Agent_OnLoad/agentonload001/agentonload001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/Agent_OnLoad/agentonload001/agentonload001.cpp
        index b74de21db4e..68701a3365b 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/Agent_OnLoad/agentonload001/agentonload001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/Agent_OnLoad/agentonload001/agentonload001.cpp
        @@ -22,8 +22,8 @@
          */
         
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "jvmti_tools.h"
        +#include "agent_common.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/Agent_OnLoad/agentonload002/agentonload002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/Agent_OnLoad/agentonload002/agentonload002.cpp
        index abec073b2f8..959f3bb4fe6 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/Agent_OnLoad/agentonload002/agentonload002.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/Agent_OnLoad/agentonload002/agentonload002.cpp
        @@ -24,7 +24,7 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        +#include "agent_common.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/Agent_OnLoad/agentonload003/agentonload003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/Agent_OnLoad/agentonload003/agentonload003.cpp
        index 271bf79be5b..e701b3dbac1 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/Agent_OnLoad/agentonload003/agentonload003.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/Agent_OnLoad/agentonload003/agentonload003.cpp
        @@ -24,7 +24,7 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        +#include "agent_common.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/Agent_OnUnload/agentonunload001/agentonunload001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/Agent_OnUnload/agentonunload001/agentonunload001.cpp
        index 89161f0b677..27970b4d8ca 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/Agent_OnUnload/agentonunload001/agentonunload001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/Agent_OnUnload/agentonunload001/agentonunload001.cpp
        @@ -1,5 +1,5 @@
         /*
        - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
        + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved.
          * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
          *
          * This code is free software; you can redistribute it and/or modify it
        @@ -22,8 +22,8 @@
          */
         
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "jvmti_tools.h"
        +#include "agent_common.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/Allocate/alloc001/alloc001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/Allocate/alloc001/alloc001.cpp
        index 77402be9a4d..9500c40b747 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/Allocate/alloc001/alloc001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/Allocate/alloc001/alloc001.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach002/attach002Agent00.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach002/attach002Agent00.cpp
        index a9a7ff072c8..068aab82e45 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach002/attach002Agent00.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach002/attach002Agent00.cpp
        @@ -25,7 +25,7 @@
         #include 
         #include 
         #include 
        -#include 
        +#include 
         #include 
         #include "ExceptionCheckingJniEnv.hpp"
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach002a/attach002aAgent00.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach002a/attach002aAgent00.cpp
        index 8c98faca1cd..638189059a2 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach002a/attach002aAgent00.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach002a/attach002aAgent00.cpp
        @@ -25,7 +25,7 @@
         #include 
         #include 
         #include 
        -#include 
        +#include 
         #include 
         
         extern "C" {
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach008/attach008Agent00.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach008/attach008Agent00.cpp
        index bd14beb64e5..d3b809707fd 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach008/attach008Agent00.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach008/attach008Agent00.cpp
        @@ -25,7 +25,7 @@
         #include 
         #include 
         #include 
        -#include 
        +#include 
         #include 
         
         extern "C" {
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach009/attach009Agent00.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach009/attach009Agent00.cpp
        index f64b04a584b..6df1e963fad 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach009/attach009Agent00.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach009/attach009Agent00.cpp
        @@ -25,7 +25,7 @@
         #include 
         #include 
         #include 
        -#include 
        +#include 
         #include 
         
         extern "C" {
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach012/attach012Agent00.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach012/attach012Agent00.cpp
        index 00d0a2136df..202cbd3f7bc 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach012/attach012Agent00.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach012/attach012Agent00.cpp
        @@ -25,7 +25,7 @@
         #include 
         #include 
         #include 
        -#include 
        +#include 
         #include 
         
         extern "C" {
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach014/attach014Agent00.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach014/attach014Agent00.cpp
        index dca2fafa6ce..5fcecea31d3 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach014/attach014Agent00.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach014/attach014Agent00.cpp
        @@ -25,7 +25,7 @@
         #include 
         #include 
         #include 
        -#include 
        +#include 
         #include 
         
         extern "C" {
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach015/attach015Agent00.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach015/attach015Agent00.cpp
        index aba296f123e..64e5a4ae9a4 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach015/attach015Agent00.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach015/attach015Agent00.cpp
        @@ -25,7 +25,7 @@
         #include 
         #include 
         #include 
        -#include 
        +#include 
         #include 
         
         extern "C" {
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach015/attach015Agent01.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach015/attach015Agent01.cpp
        index 1e0afaf8a5f..3f76856bb22 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach015/attach015Agent01.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach015/attach015Agent01.cpp
        @@ -25,7 +25,7 @@
         #include 
         #include 
         #include 
        -#include 
        +#include 
         #include 
         
         extern "C" {
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach015/attach015Target.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach015/attach015Target.cpp
        index 06d120b09c9..1054cc239af 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach015/attach015Target.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach015/attach015Target.cpp
        @@ -25,7 +25,7 @@
         #include 
         #include 
         #include 
        -#include 
        +#include 
         #include 
         
         extern "C" {
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach020/attach020Agent00.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach020/attach020Agent00.cpp
        index afbdc2362c0..c4aad94da9a 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach020/attach020Agent00.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach020/attach020Agent00.cpp
        @@ -25,7 +25,7 @@
         #include 
         #include 
         #include 
        -#include 
        +#include 
         #include 
         
         extern "C" {
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach021/attach021Agent00.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach021/attach021Agent00.cpp
        index e1d8e169f1c..77af92fecb8 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach021/attach021Agent00.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach021/attach021Agent00.cpp
        @@ -25,7 +25,7 @@
         #include 
         #include 
         #include 
        -#include 
        +#include 
         #include 
         #include "ExceptionCheckingJniEnv.hpp"
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach022/attach022Agent00.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach022/attach022Agent00.cpp
        index 2b786563c22..fb6cb99a555 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach022/attach022Agent00.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach022/attach022Agent00.cpp
        @@ -25,7 +25,7 @@
         #include 
         #include 
         #include 
        -#include 
        +#include 
         #include 
         #include "ExceptionCheckingJniEnv.hpp"
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach037/attach037Agent00.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach037/attach037Agent00.cpp
        index a3c06877749..a81f6d7f65c 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach037/attach037Agent00.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach037/attach037Agent00.cpp
        @@ -25,7 +25,7 @@
         #include 
         #include 
         #include 
        -#include 
        +#include 
         #include 
         
         extern "C" {
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach038/attach038Agent00.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach038/attach038Agent00.cpp
        index 7bffa508ebe..f6ac9354880 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach038/attach038Agent00.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach038/attach038Agent00.cpp
        @@ -25,7 +25,7 @@
         #include 
         #include 
         #include 
        -#include 
        +#include 
         #include 
         
         extern "C" {
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach039/attach039Agent00.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach039/attach039Agent00.cpp
        index 5ce7b2d3da1..52d86335c11 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach039/attach039Agent00.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach039/attach039Agent00.cpp
        @@ -25,7 +25,7 @@
         #include 
         #include 
         #include 
        -#include 
        +#include 
         #include 
         
         extern "C" {
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach040/attach040Agent00.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach040/attach040Agent00.cpp
        index 797bb765bb6..cabc1c43b63 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach040/attach040Agent00.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach040/attach040Agent00.cpp
        @@ -25,7 +25,7 @@
         #include 
         #include 
         #include 
        -#include 
        +#include 
         #include 
         
         extern "C" {
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach041/attach041Agent00.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach041/attach041Agent00.cpp
        index 926e4f7075f..db4b44f6751 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach041/attach041Agent00.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach041/attach041Agent00.cpp
        @@ -25,7 +25,7 @@
         #include 
         #include 
         #include 
        -#include 
        +#include 
         #include 
         
         extern "C" {
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach042/attach042Agent00.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach042/attach042Agent00.cpp
        index 9901cfa12a6..4682f1c4088 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach042/attach042Agent00.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach042/attach042Agent00.cpp
        @@ -25,7 +25,7 @@
         #include 
         #include 
         #include 
        -#include 
        +#include 
         #include 
         
         extern "C" {
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach045/attach045Agent00.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach045/attach045Agent00.cpp
        index 9535d3b3a32..5a486492799 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach045/attach045Agent00.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach045/attach045Agent00.cpp
        @@ -25,7 +25,7 @@
         #include 
         #include 
         #include 
        -#include 
        +#include 
         #include 
         
         extern "C" {
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach045/attach045Agent01.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach045/attach045Agent01.cpp
        index 79319560a5c..8843c19d338 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach045/attach045Agent01.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach045/attach045Agent01.cpp
        @@ -25,7 +25,7 @@
         #include 
         #include 
         #include 
        -#include 
        +#include 
         #include 
         
         extern "C" {
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach045/attach045Agent02.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach045/attach045Agent02.cpp
        index 0f98fd83c5e..f0ce8965cda 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach045/attach045Agent02.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach045/attach045Agent02.cpp
        @@ -25,7 +25,7 @@
         #include 
         #include 
         #include 
        -#include 
        +#include 
         #include 
         
         extern "C" {
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach045/attach045Agent03.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach045/attach045Agent03.cpp
        index e25fd5ae9de..3834e868a7b 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach045/attach045Agent03.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach045/attach045Agent03.cpp
        @@ -25,7 +25,7 @@
         #include 
         #include 
         #include 
        -#include 
        +#include 
         #include 
         
         extern "C" {
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach046/attach046Agent00.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach046/attach046Agent00.cpp
        index fdb98860ff9..4b5c9e7d56f 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach046/attach046Agent00.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach046/attach046Agent00.cpp
        @@ -25,7 +25,7 @@
         #include 
         #include 
         #include 
        -#include 
        +#include 
         #include 
         
         extern "C" {
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach050/attach050Agent00.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach050/attach050Agent00.cpp
        index 535b2327d32..e9cc956557b 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach050/attach050Agent00.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach050/attach050Agent00.cpp
        @@ -25,7 +25,7 @@
         #include 
         #include 
         #include 
        -#include 
        +#include 
         #include 
         
         #define ON_UNLOAD_MARKER "attach050.on_unload"
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/sharedAgents/simpleAgent00.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/sharedAgents/simpleAgent00.cpp
        index f94f22b0dd7..0c1fc89de01 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/sharedAgents/simpleAgent00.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/sharedAgents/simpleAgent00.cpp
        @@ -25,7 +25,7 @@
         #include 
         #include 
         #include 
        -#include 
        +#include 
         #include 
         
         extern "C" {
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk001/classfloadhk001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk001/classfloadhk001.cpp
        index e204e5aedf5..49faf6b32b6 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk001/classfloadhk001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk001/classfloadhk001.cpp
        @@ -27,11 +27,11 @@
         #include 
         
         #include 
        -#include "agent_common.h"
        +#include "agent_common.hpp"
         
        -#include "nsk_tools.h"
        -#include "JVMTITools.h"
        -#include "jvmti_tools.h"
        +#include "nsk_tools.hpp"
        +#include "JVMTITools.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk002/classfloadhk002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk002/classfloadhk002.cpp
        index 976a53cc1c8..510eddb4b1d 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk002/classfloadhk002.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk002/classfloadhk002.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "jni_tools.h"
        -#include "jvmti_tools.h"
        +#include "agent_common.hpp"
        +#include "jni_tools.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk003/classfloadhk003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk003/classfloadhk003.cpp
        index d254e93b833..96ca8df0d17 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk003/classfloadhk003.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk003/classfloadhk003.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "jni_tools.h"
        -#include "jvmti_tools.h"
        +#include "agent_common.hpp"
        +#include "jni_tools.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk004/classfloadhk004.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk004/classfloadhk004.cpp
        index e587e45c1da..1c0152913d0 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk004/classfloadhk004.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk004/classfloadhk004.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "jni_tools.h"
        -#include "jvmti_tools.h"
        +#include "agent_common.hpp"
        +#include "jni_tools.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk005/classfloadhk005.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk005/classfloadhk005.cpp
        index 112f0dda0e9..81b0a68267e 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk005/classfloadhk005.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk005/classfloadhk005.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "jni_tools.h"
        -#include "jvmti_tools.h"
        +#include "agent_common.hpp"
        +#include "jni_tools.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk006/classfloadhk006.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk006/classfloadhk006.cpp
        index 31414b4ed90..2870eec7f49 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk006/classfloadhk006.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk006/classfloadhk006.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "jni_tools.h"
        -#include "jvmti_tools.h"
        +#include "agent_common.hpp"
        +#include "jni_tools.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk007/classfloadhk007.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk007/classfloadhk007.cpp
        index 7107ccfdf41..9d2a20d3eb7 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk007/classfloadhk007.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk007/classfloadhk007.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "jni_tools.h"
        -#include "jvmti_tools.h"
        +#include "agent_common.hpp"
        +#include "jni_tools.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk008/classfloadhk008.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk008/classfloadhk008.cpp
        index 01ea3da04a6..fd0de631d3b 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk008/classfloadhk008.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk008/classfloadhk008.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "jni_tools.h"
        -#include "jvmti_tools.h"
        +#include "agent_common.hpp"
        +#include "jni_tools.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk009/classfloadhk009.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk009/classfloadhk009.cpp
        index 296c10cb84a..4115a078c3a 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk009/classfloadhk009.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk009/classfloadhk009.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "jni_tools.h"
        -#include "jvmti_tools.h"
        +#include "agent_common.hpp"
        +#include "jni_tools.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClearBreakpoint/clrbrk001/clrbrk001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClearBreakpoint/clrbrk001/clrbrk001.cpp
        index cae177d2537..21328b3be6d 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClearBreakpoint/clrbrk001/clrbrk001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClearBreakpoint/clrbrk001/clrbrk001.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClearBreakpoint/clrbrk002/clrbrk002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClearBreakpoint/clrbrk002/clrbrk002.cpp
        index e61a953186d..bd13e4ea6d5 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClearBreakpoint/clrbrk002/clrbrk002.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClearBreakpoint/clrbrk002/clrbrk002.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClearBreakpoint/clrbrk005/clrbrk005.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClearBreakpoint/clrbrk005/clrbrk005.cpp
        index d845833d94b..8433c0cf366 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClearBreakpoint/clrbrk005/clrbrk005.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClearBreakpoint/clrbrk005/clrbrk005.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClearFieldAccessWatch/clrfldw001/clrfldw001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClearFieldAccessWatch/clrfldw001/clrfldw001.cpp
        index 09561cd971b..c3c70ee070d 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClearFieldAccessWatch/clrfldw001/clrfldw001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClearFieldAccessWatch/clrfldw001/clrfldw001.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClearFieldAccessWatch/clrfldw002/clrfldw002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClearFieldAccessWatch/clrfldw002/clrfldw002.cpp
        index 4ae421245ee..c3a91f338b7 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClearFieldAccessWatch/clrfldw002/clrfldw002.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClearFieldAccessWatch/clrfldw002/clrfldw002.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClearFieldModificationWatch/clrfmodw001/clrfmodw001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClearFieldModificationWatch/clrfmodw001/clrfmodw001.cpp
        index eaf686e623e..c155a06075f 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClearFieldModificationWatch/clrfmodw001/clrfmodw001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClearFieldModificationWatch/clrfmodw001/clrfmodw001.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClearFieldModificationWatch/clrfmodw002/clrfmodw002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClearFieldModificationWatch/clrfmodw002/clrfmodw002.cpp
        index 329e8c32a2c..e35eed1d1e7 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClearFieldModificationWatch/clrfmodw002/clrfmodw002.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClearFieldModificationWatch/clrfmodw002/clrfmodw002.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/CompiledMethodLoad/compmethload001/compmethload001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/CompiledMethodLoad/compmethload001/compmethload001.cpp
        index f70ded6238a..66e49496316 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/CompiledMethodLoad/compmethload001/compmethload001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/CompiledMethodLoad/compmethload001/compmethload001.cpp
        @@ -24,11 +24,11 @@
         #include 
         #include 
         #include 
        -#include "agent_common.h"
        +#include "agent_common.hpp"
         
        -#include "nsk_tools.h"
        -#include "JVMTITools.h"
        -#include "jvmti_tools.h"
        +#include "nsk_tools.hpp"
        +#include "JVMTITools.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/CompiledMethodUnload/compmethunload001/compmethunload001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/CompiledMethodUnload/compmethunload001/compmethunload001.cpp
        index e3b50a0474e..28766be6202 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/CompiledMethodUnload/compmethunload001/compmethunload001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/CompiledMethodUnload/compmethunload001/compmethunload001.cpp
        @@ -24,11 +24,11 @@
         #include 
         #include 
         #include 
        -#include "agent_common.h"
        +#include "agent_common.hpp"
         
        -#include "nsk_tools.h"
        -#include "JVMTITools.h"
        -#include "jvmti_tools.h"
        +#include "nsk_tools.hpp"
        +#include "JVMTITools.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/CreateRawMonitor/crrawmon001/crrawmon001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/CreateRawMonitor/crrawmon001/crrawmon001.cpp
        index d2a0073b2ae..d3f37f0c65a 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/CreateRawMonitor/crrawmon001/crrawmon001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/CreateRawMonitor/crrawmon001/crrawmon001.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/CreateRawMonitor/crrawmon002/crrawmon002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/CreateRawMonitor/crrawmon002/crrawmon002.cpp
        index 12519a57c2a..a0089d51297 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/CreateRawMonitor/crrawmon002/crrawmon002.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/CreateRawMonitor/crrawmon002/crrawmon002.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/DataDumpRequest/datadumpreq001/datadumpreq001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/DataDumpRequest/datadumpreq001/datadumpreq001.cpp
        index 5a8843e6e38..bce556cbac8 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/DataDumpRequest/datadumpreq001/datadumpreq001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/DataDumpRequest/datadumpreq001/datadumpreq001.cpp
        @@ -25,12 +25,12 @@
         #include 
         #include 
         #include 
        -#include "agent_common.h"
        +#include "agent_common.hpp"
         
        -#include "nsk_tools.h"
        -#include "JVMTITools.h"
        -#include "jvmti_tools.h"
        -#include "jni_tools.h"
        +#include "nsk_tools.hpp"
        +#include "JVMTITools.hpp"
        +#include "jvmti_tools.hpp"
        +#include "jni_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/Deallocate/dealloc001/dealloc001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/Deallocate/dealloc001/dealloc001.cpp
        index 82ea6825b63..1d6e7a571db 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/Deallocate/dealloc001/dealloc001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/Deallocate/dealloc001/dealloc001.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/DestroyRawMonitor/drrawmon001/drrawmon001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/DestroyRawMonitor/drrawmon001/drrawmon001.cpp
        index 341da0a65b3..f065e61f086 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/DestroyRawMonitor/drrawmon001/drrawmon001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/DestroyRawMonitor/drrawmon001/drrawmon001.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/DestroyRawMonitor/drrawmon003/drrawmon003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/DestroyRawMonitor/drrawmon003/drrawmon003.cpp
        index 22765b973d8..0a96421133a 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/DestroyRawMonitor/drrawmon003/drrawmon003.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/DestroyRawMonitor/drrawmon003/drrawmon003.cpp
        @@ -25,8 +25,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/DestroyRawMonitor/drrawmon004/drrawmon004.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/DestroyRawMonitor/drrawmon004/drrawmon004.cpp
        index 154e98fe12f..61e002b9af7 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/DestroyRawMonitor/drrawmon004/drrawmon004.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/DestroyRawMonitor/drrawmon004/drrawmon004.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/DisposeEnvironment/disposeenv001/disposeenv001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/DisposeEnvironment/disposeenv001/disposeenv001.cpp
        index b652a8259dd..8b73fd6d6e5 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/DisposeEnvironment/disposeenv001/disposeenv001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/DisposeEnvironment/disposeenv001/disposeenv001.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "jni_tools.h"
        -#include "jvmti_tools.h"
        +#include "agent_common.hpp"
        +#include "jni_tools.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/DisposeEnvironment/disposeenv002/disposeenv002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/DisposeEnvironment/disposeenv002/disposeenv002.cpp
        index 220243ae1a2..3a57006677b 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/DisposeEnvironment/disposeenv002/disposeenv002.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/DisposeEnvironment/disposeenv002/disposeenv002.cpp
        @@ -24,9 +24,9 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "jni_tools.h"
        -#include "jvmti_tools.h"
        +#include "agent_common.hpp"
        +#include "jni_tools.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/DynamicCodeGenerated/dyncodgen001/dyncodgen001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/DynamicCodeGenerated/dyncodgen001/dyncodgen001.cpp
        index 676fd762a7a..5c5a6a50b99 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/DynamicCodeGenerated/dyncodgen001/dyncodgen001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/DynamicCodeGenerated/dyncodgen001/dyncodgen001.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "jni_tools.h"
        -#include "jvmti_tools.h"
        +#include "agent_common.hpp"
        +#include "jni_tools.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ForceEarlyReturn/ForceEarlyReturn001/ForceEarlyReturn001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ForceEarlyReturn/ForceEarlyReturn001/ForceEarlyReturn001.cpp
        index 29df3168b9b..6ea09a5cfda 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ForceEarlyReturn/ForceEarlyReturn001/ForceEarlyReturn001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ForceEarlyReturn/ForceEarlyReturn001/ForceEarlyReturn001.cpp
        @@ -23,9 +23,9 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include 
        -#include "JVMTITools.h"
        -#include "agent_common.h"
        +#include 
        +#include "JVMTITools.hpp"
        +#include "agent_common.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ForceGarbageCollection/forcegc001/forcegc001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ForceGarbageCollection/forcegc001/forcegc001.cpp
        index eb956244fe5..e4c8dc2a375 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ForceGarbageCollection/forcegc001/forcegc001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ForceGarbageCollection/forcegc001/forcegc001.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "jni_tools.h"
        -#include "jvmti_tools.h"
        +#include "agent_common.hpp"
        +#include "jni_tools.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ForceGarbageCollection/forcegc002/forcegc002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ForceGarbageCollection/forcegc002/forcegc002.cpp
        index 5332beb8397..1df20dcdecf 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ForceGarbageCollection/forcegc002/forcegc002.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ForceGarbageCollection/forcegc002/forcegc002.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "jni_tools.h"
        -#include "jvmti_tools.h"
        +#include "agent_common.hpp"
        +#include "jni_tools.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GarbageCollectionFinish/gcfinish001/gcfinish001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GarbageCollectionFinish/gcfinish001/gcfinish001.cpp
        index 819aa9189aa..970e4ff57c1 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GarbageCollectionFinish/gcfinish001/gcfinish001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GarbageCollectionFinish/gcfinish001/gcfinish001.cpp
        @@ -25,11 +25,11 @@
         #include 
         #include 
         #include 
        -#include "agent_common.h"
        +#include "agent_common.hpp"
         
        -#include "nsk_tools.h"
        -#include "JVMTITools.h"
        -#include "jvmti_tools.h"
        +#include "nsk_tools.hpp"
        +#include "JVMTITools.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GarbageCollectionStart/gcstart001/gcstart001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GarbageCollectionStart/gcstart001/gcstart001.cpp
        index ff8e837f277..9e4d2d7f0f0 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GarbageCollectionStart/gcstart001/gcstart001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GarbageCollectionStart/gcstart001/gcstart001.cpp
        @@ -25,11 +25,11 @@
         #include 
         #include 
         #include 
        -#include "agent_common.h"
        +#include "agent_common.hpp"
         
        -#include "nsk_tools.h"
        -#include "JVMTITools.h"
        -#include "jvmti_tools.h"
        +#include "nsk_tools.hpp"
        +#include "JVMTITools.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GarbageCollectionStart/gcstart002/gcstart002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GarbageCollectionStart/gcstart002/gcstart002.cpp
        index ba134f06ed8..792c326a96a 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GarbageCollectionStart/gcstart002/gcstart002.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GarbageCollectionStart/gcstart002/gcstart002.cpp
        @@ -25,11 +25,11 @@
         #include 
         #include 
         #include 
        -#include "agent_common.h"
        +#include "agent_common.hpp"
         
        -#include "nsk_tools.h"
        -#include "JVMTITools.h"
        -#include "jvmti_tools.h"
        +#include "nsk_tools.hpp"
        +#include "JVMTITools.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GenerateEvents/genevents001/genevents001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GenerateEvents/genevents001/genevents001.cpp
        index 02228b3021a..13de99039af 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GenerateEvents/genevents001/genevents001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GenerateEvents/genevents001/genevents001.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "jni_tools.h"
        -#include "jvmti_tools.h"
        +#include "agent_common.hpp"
        +#include "jni_tools.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetArgumentsSize/argsize001/argsize001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetArgumentsSize/argsize001/argsize001.cpp
        index 25d72ff3ba6..3c0afdfb62d 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetArgumentsSize/argsize001/argsize001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetArgumentsSize/argsize001/argsize001.cpp
        @@ -23,8 +23,8 @@
         
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetArgumentsSize/argsize002/argsize002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetArgumentsSize/argsize002/argsize002.cpp
        index f2d9f76e219..e957529cc02 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetArgumentsSize/argsize002/argsize002.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetArgumentsSize/argsize002/argsize002.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetAvailableProcessors/getavailproc001/getavailproc001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetAvailableProcessors/getavailproc001/getavailproc001.cpp
        index f374cef29ae..5b24e64edcc 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetAvailableProcessors/getavailproc001/getavailproc001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetAvailableProcessors/getavailproc001/getavailproc001.cpp
        @@ -24,9 +24,9 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "jni_tools.h"
        -#include "jvmti_tools.h"
        +#include "agent_common.hpp"
        +#include "jni_tools.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetBytecodes/bytecodes001/bytecodes001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetBytecodes/bytecodes001/bytecodes001.cpp
        index b0971242418..9743c8f762d 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetBytecodes/bytecodes001/bytecodes001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetBytecodes/bytecodes001/bytecodes001.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetBytecodes/bytecodes002/bytecodes002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetBytecodes/bytecodes002/bytecodes002.cpp
        index 63a0a3c866a..4dfb24d5140 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetBytecodes/bytecodes002/bytecodes002.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetBytecodes/bytecodes002/bytecodes002.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetBytecodes/bytecodes003/bytecodes003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetBytecodes/bytecodes003/bytecodes003.cpp
        index 4d7ed6978de..7167631a5e4 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetBytecodes/bytecodes003/bytecodes003.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetBytecodes/bytecodes003/bytecodes003.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetCapabilities/getcaps001/getcaps001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetCapabilities/getcaps001/getcaps001.cpp
        index 74adc9187a8..a81afef8275 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetCapabilities/getcaps001/getcaps001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetCapabilities/getcaps001/getcaps001.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetCapabilities/getcaps002/getcaps002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetCapabilities/getcaps002/getcaps002.cpp
        index 90bab14b567..fa03fb1b34f 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetCapabilities/getcaps002/getcaps002.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetCapabilities/getcaps002/getcaps002.cpp
        @@ -24,9 +24,9 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "jni_tools.h"
        -#include "jvmti_tools.h"
        +#include "agent_common.hpp"
        +#include "jni_tools.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassFields/getclfld005/getclfld005.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassFields/getclfld005/getclfld005.cpp
        index cd178863545..a41634ea25d 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassFields/getclfld005/getclfld005.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassFields/getclfld005/getclfld005.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassFields/getclfld006/getclfld006.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassFields/getclfld006/getclfld006.cpp
        index 1c786d84908..e1b17bf6420 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassFields/getclfld006/getclfld006.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassFields/getclfld006/getclfld006.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassFields/getclfld007/getclfld007.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassFields/getclfld007/getclfld007.cpp
        index c3f5a53daa5..3cd33384330 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassFields/getclfld007/getclfld007.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassFields/getclfld007/getclfld007.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassLoader/getclsldr001/getclsldr001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassLoader/getclsldr001/getclsldr001.cpp
        index 9d2d8a449d3..90ece1bd2ce 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassLoader/getclsldr001/getclsldr001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassLoader/getclsldr001/getclsldr001.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassLoader/getclsldr002/getclsldr002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassLoader/getclsldr002/getclsldr002.cpp
        index 968158cc087..f46e0bb13da 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassLoader/getclsldr002/getclsldr002.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassLoader/getclsldr002/getclsldr002.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassLoader/getclsldr003/getclsldr003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassLoader/getclsldr003/getclsldr003.cpp
        index 3bd7008a32d..43961c06bd1 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassLoader/getclsldr003/getclsldr003.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassLoader/getclsldr003/getclsldr003.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassLoaderClasses/clsldrclss001/clsldrclss001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassLoaderClasses/clsldrclss001/clsldrclss001.cpp
        index af3a2e0b162..938c50a5606 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassLoaderClasses/clsldrclss001/clsldrclss001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassLoaderClasses/clsldrclss001/clsldrclss001.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassLoaderClasses/clsldrclss002/clsldrclss002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassLoaderClasses/clsldrclss002/clsldrclss002.cpp
        index f389a9d56e1..50e6207e57f 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassLoaderClasses/clsldrclss002/clsldrclss002.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassLoaderClasses/clsldrclss002/clsldrclss002.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include 
        -#include "jni_tools.h"
        -#include "agent_common.h"
        -#include "jvmti_tools.h"
        +#include "jni_tools.hpp"
        +#include "agent_common.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassMethods/getclmthd005/getclmthd005.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassMethods/getclmthd005/getclmthd005.cpp
        index 5a39a2bf549..e4327bdb890 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassMethods/getclmthd005/getclmthd005.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassMethods/getclmthd005/getclmthd005.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassMethods/getclmthd006/getclmthd006.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassMethods/getclmthd006/getclmthd006.cpp
        index 3435c915a48..b0f1add000b 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassMethods/getclmthd006/getclmthd006.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassMethods/getclmthd006/getclmthd006.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassMethods/getclmthd007/getclmthd007.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassMethods/getclmthd007/getclmthd007.cpp
        index e5e75b5d9b1..79e5d144d0d 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassMethods/getclmthd007/getclmthd007.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassMethods/getclmthd007/getclmthd007.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassModifiers/getclmdf004/getclmdf004.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassModifiers/getclmdf004/getclmdf004.cpp
        index f929d466d9c..21334b3801b 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassModifiers/getclmdf004/getclmdf004.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassModifiers/getclmdf004/getclmdf004.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassModifiers/getclmdf005/getclmdf005.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassModifiers/getclmdf005/getclmdf005.cpp
        index 8cdaff36314..3716402cc10 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassModifiers/getclmdf005/getclmdf005.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassModifiers/getclmdf005/getclmdf005.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassModifiers/getclmdf006/getclmdf006.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassModifiers/getclmdf006/getclmdf006.cpp
        index 14d7a0b2e29..de562a2a2b9 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassModifiers/getclmdf006/getclmdf006.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassModifiers/getclmdf006/getclmdf006.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassModifiers/getclmdf007/getclmdf007.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassModifiers/getclmdf007/getclmdf007.cpp
        index 5315c795dba..cd698d4af9e 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassModifiers/getclmdf007/getclmdf007.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassModifiers/getclmdf007/getclmdf007.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassSignature/getclsig004/getclsig004.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassSignature/getclsig004/getclsig004.cpp
        index d01bf625873..ceb349091aa 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassSignature/getclsig004/getclsig004.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassSignature/getclsig004/getclsig004.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassSignature/getclsig005/getclsig005.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassSignature/getclsig005/getclsig005.cpp
        index 919bd50b940..2c60d39dc18 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassSignature/getclsig005/getclsig005.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassSignature/getclsig005/getclsig005.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassSignature/getclsig006/getclsig006.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassSignature/getclsig006/getclsig006.cpp
        index 56b79a1cdf1..246823d67ea 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassSignature/getclsig006/getclsig006.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassSignature/getclsig006/getclsig006.cpp
        @@ -24,12 +24,12 @@
         #include 
         #include 
         #include 
        -#include "agent_common.h"
        +#include "agent_common.hpp"
         
        -#include "nsk_tools.h"
        -#include "jni_tools.h"
        -#include "JVMTITools.h"
        -#include "jvmti_tools.h"
        +#include "nsk_tools.hpp"
        +#include "jni_tools.hpp"
        +#include "JVMTITools.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassStatus/getclstat005/getclstat005.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassStatus/getclstat005/getclstat005.cpp
        index 7bc57e7082b..ba6b1a19746 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassStatus/getclstat005/getclstat005.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassStatus/getclstat005/getclstat005.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassStatus/getclstat006/getclstat006.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassStatus/getclstat006/getclstat006.cpp
        index 72fb949f9b0..666fa3e0db0 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassStatus/getclstat006/getclstat006.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassStatus/getclstat006/getclstat006.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassStatus/getclstat007/getclstat007.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassStatus/getclstat007/getclstat007.cpp
        index 4daaed64594..4958e015c3a 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassStatus/getclstat007/getclstat007.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassStatus/getclstat007/getclstat007.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetCurrentThreadCpuTime/curthrcputime001/curthrcputime001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetCurrentThreadCpuTime/curthrcputime001/curthrcputime001.cpp
        index b883c0b682f..7e2d7d6f8f4 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetCurrentThreadCpuTime/curthrcputime001/curthrcputime001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetCurrentThreadCpuTime/curthrcputime001/curthrcputime001.cpp
        @@ -24,9 +24,9 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "jni_tools.h"
        -#include "jvmti_tools.h"
        +#include "agent_common.hpp"
        +#include "jni_tools.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetCurrentThreadCpuTimerInfo/curthrtimerinfo001/curthrtimerinfo001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetCurrentThreadCpuTimerInfo/curthrtimerinfo001/curthrtimerinfo001.cpp
        index 2efa96fb584..cbb40a0df06 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetCurrentThreadCpuTimerInfo/curthrtimerinfo001/curthrtimerinfo001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetCurrentThreadCpuTimerInfo/curthrtimerinfo001/curthrtimerinfo001.cpp
        @@ -24,9 +24,9 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "jni_tools.h"
        -#include "jvmti_tools.h"
        +#include "agent_common.hpp"
        +#include "jni_tools.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetEnv/GetEnv001/GetEnv001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetEnv/GetEnv001/GetEnv001.cpp
        index 3959c846492..cad70dfbd13 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetEnv/GetEnv001/GetEnv001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetEnv/GetEnv001/GetEnv001.cpp
        @@ -25,9 +25,9 @@
         #include 
         #include 
         #include 
        -#include "agent_common.h"
        -#include 
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include 
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetEnvironmentLocalStorage/getenvstor001/getenvstor001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetEnvironmentLocalStorage/getenvstor001/getenvstor001.cpp
        index 34b26debe67..b4735fe338c 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetEnvironmentLocalStorage/getenvstor001/getenvstor001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetEnvironmentLocalStorage/getenvstor001/getenvstor001.cpp
        @@ -24,9 +24,9 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "jni_tools.h"
        -#include "jvmti_tools.h"
        +#include "agent_common.hpp"
        +#include "jni_tools.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetErrorName/geterrname001/geterrname001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetErrorName/geterrname001/geterrname001.cpp
        index 6f8bcb17b3a..d06c4a05339 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetErrorName/geterrname001/geterrname001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetErrorName/geterrname001/geterrname001.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include 
        -#include "jni_tools.h"
        -#include "agent_common.h"
        -#include "jvmti_tools.h"
        +#include "jni_tools.hpp"
        +#include "agent_common.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetErrorName/geterrname002/geterrname002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetErrorName/geterrname002/geterrname002.cpp
        index 9dcf87e7be1..6b52d237e76 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetErrorName/geterrname002/geterrname002.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetErrorName/geterrname002/geterrname002.cpp
        @@ -22,9 +22,9 @@
          */
         
         #include 
        -#include "jni_tools.h"
        -#include "agent_common.h"
        -#include "jvmti_tools.h"
        +#include "jni_tools.hpp"
        +#include "agent_common.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetExtensionEvents/extevents001/extevents001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetExtensionEvents/extevents001/extevents001.cpp
        index bdc033f35cb..e071724a97b 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetExtensionEvents/extevents001/extevents001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetExtensionEvents/extevents001/extevents001.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "jni_tools.h"
        -#include "jvmti_tools.h"
        +#include "agent_common.hpp"
        +#include "jni_tools.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetExtensionFunctions/extfuncs001/extfuncs001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetExtensionFunctions/extfuncs001/extfuncs001.cpp
        index 015313e7b2b..b6fc95128d6 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetExtensionFunctions/extfuncs001/extfuncs001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetExtensionFunctions/extfuncs001/extfuncs001.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "jni_tools.h"
        -#include "jvmti_tools.h"
        +#include "agent_common.hpp"
        +#include "jni_tools.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetFieldDeclaringClass/getfldecl001/getfldecl001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetFieldDeclaringClass/getfldecl001/getfldecl001.cpp
        index 695d6758f24..385dbd23354 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetFieldDeclaringClass/getfldecl001/getfldecl001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetFieldDeclaringClass/getfldecl001/getfldecl001.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetFieldDeclaringClass/getfldecl002/getfldecl002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetFieldDeclaringClass/getfldecl002/getfldecl002.cpp
        index aac0cbe4d66..77b926f1383 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetFieldDeclaringClass/getfldecl002/getfldecl002.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetFieldDeclaringClass/getfldecl002/getfldecl002.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetFieldDeclaringClass/getfldecl004/getfldecl004.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetFieldDeclaringClass/getfldecl004/getfldecl004.cpp
        index 66bfdd8ce2f..cc967123c5c 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetFieldDeclaringClass/getfldecl004/getfldecl004.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetFieldDeclaringClass/getfldecl004/getfldecl004.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetFieldModifiers/getfldmdf003/getfldmdf003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetFieldModifiers/getfldmdf003/getfldmdf003.cpp
        index f763138923d..2ef792ba9a1 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetFieldModifiers/getfldmdf003/getfldmdf003.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetFieldModifiers/getfldmdf003/getfldmdf003.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetFieldModifiers/getfldmdf004/getfldmdf004.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetFieldModifiers/getfldmdf004/getfldmdf004.cpp
        index 72fc33280e5..672a62b8946 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetFieldModifiers/getfldmdf004/getfldmdf004.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetFieldModifiers/getfldmdf004/getfldmdf004.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetFieldName/getfldnm003/getfldnm003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetFieldName/getfldnm003/getfldnm003.cpp
        index c1121a55259..9a6fcf21e65 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetFieldName/getfldnm003/getfldnm003.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetFieldName/getfldnm003/getfldnm003.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetFieldName/getfldnm004/getfldnm004.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetFieldName/getfldnm004/getfldnm004.cpp
        index f748f6600c0..0f035f3a84c 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetFieldName/getfldnm004/getfldnm004.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetFieldName/getfldnm004/getfldnm004.cpp
        @@ -25,8 +25,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetFieldName/getfldnm005/getfldnm005.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetFieldName/getfldnm005/getfldnm005.cpp
        index 65508b38baf..66945b246f8 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetFieldName/getfldnm005/getfldnm005.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetFieldName/getfldnm005/getfldnm005.cpp
        @@ -24,12 +24,12 @@
         #include 
         #include 
         #include 
        -#include "agent_common.h"
        +#include "agent_common.hpp"
         
        -#include "nsk_tools.h"
        -#include "jni_tools.h"
        -#include "JVMTITools.h"
        -#include "jvmti_tools.h"
        +#include "nsk_tools.hpp"
        +#include "jni_tools.hpp"
        +#include "JVMTITools.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetImplementedInterfaces/getintrf005/getintrf005.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetImplementedInterfaces/getintrf005/getintrf005.cpp
        index 89e743f1b9f..e778581353c 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetImplementedInterfaces/getintrf005/getintrf005.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetImplementedInterfaces/getintrf005/getintrf005.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetImplementedInterfaces/getintrf006/getintrf006.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetImplementedInterfaces/getintrf006/getintrf006.cpp
        index 6c6b4e060fb..37e286d4493 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetImplementedInterfaces/getintrf006/getintrf006.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetImplementedInterfaces/getintrf006/getintrf006.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetImplementedInterfaces/getintrf007/getintrf007.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetImplementedInterfaces/getintrf007/getintrf007.cpp
        index 5b855f85b9d..2193e5dc972 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetImplementedInterfaces/getintrf007/getintrf007.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetImplementedInterfaces/getintrf007/getintrf007.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetJLocationFormat/getjlocfmt001/getjlocfmt001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetJLocationFormat/getjlocfmt001/getjlocfmt001.cpp
        index 2725d43068f..3502af000ab 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetJLocationFormat/getjlocfmt001/getjlocfmt001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetJLocationFormat/getjlocfmt001/getjlocfmt001.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include 
        -#include "jni_tools.h"
        -#include "agent_common.h"
        -#include "jvmti_tools.h"
        +#include "jni_tools.hpp"
        +#include "agent_common.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetJLocationFormat/getjlocfmt002/getjlocfmt002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetJLocationFormat/getjlocfmt002/getjlocfmt002.cpp
        index f13d7f1cf10..54612f3cb73 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetJLocationFormat/getjlocfmt002/getjlocfmt002.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetJLocationFormat/getjlocfmt002/getjlocfmt002.cpp
        @@ -22,9 +22,9 @@
          */
         
         #include 
        -#include "jni_tools.h"
        -#include "agent_common.h"
        -#include "jvmti_tools.h"
        +#include "jni_tools.hpp"
        +#include "agent_common.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetJNIFunctionTable/getjniftab001/getjniftab001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetJNIFunctionTable/getjniftab001/getjniftab001.cpp
        index 3491ef2bdd2..cc320129a98 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetJNIFunctionTable/getjniftab001/getjniftab001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetJNIFunctionTable/getjniftab001/getjniftab001.cpp
        @@ -27,9 +27,9 @@
         #include 
         
         #include 
        -#include "agent_common.h"
        +#include "agent_common.hpp"
         
        -#include "JVMTITools.h"
        +#include "JVMTITools.hpp"
         #include "native_thread.hpp"
         
         extern "C" {
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetJNIFunctionTable/getjniftab002/getjniftab002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetJNIFunctionTable/getjniftab002/getjniftab002.cpp
        index 7c564bfa28c..3d06018f556 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetJNIFunctionTable/getjniftab002/getjniftab002.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetJNIFunctionTable/getjniftab002/getjniftab002.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetLineNumberTable/linetab001/linetab001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetLineNumberTable/linetab001/linetab001.cpp
        index 669374789ec..b2a03a4a629 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetLineNumberTable/linetab001/linetab001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetLineNumberTable/linetab001/linetab001.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetLineNumberTable/linetab002/linetab002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetLineNumberTable/linetab002/linetab002.cpp
        index ad5984a64d9..9592167e1cd 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetLineNumberTable/linetab002/linetab002.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetLineNumberTable/linetab002/linetab002.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetLineNumberTable/linetab003/linetab003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetLineNumberTable/linetab003/linetab003.cpp
        index 00468064849..340d206a62c 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetLineNumberTable/linetab003/linetab003.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetLineNumberTable/linetab003/linetab003.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetLoadedClasses/loadedclss001/loadedclss001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetLoadedClasses/loadedclss001/loadedclss001.cpp
        index 23bd64d6284..43804aaffd5 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetLoadedClasses/loadedclss001/loadedclss001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetLoadedClasses/loadedclss001/loadedclss001.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetLoadedClasses/loadedclss002/loadedclss002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetLoadedClasses/loadedclss002/loadedclss002.cpp
        index 73e8472c3c4..813f15e4c3a 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetLoadedClasses/loadedclss002/loadedclss002.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetLoadedClasses/loadedclss002/loadedclss002.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include 
        -#include "jni_tools.h"
        -#include "agent_common.h"
        -#include "jvmti_tools.h"
        +#include "jni_tools.hpp"
        +#include "agent_common.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetLocalVariable/getlocal001/getlocal001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetLocalVariable/getlocal001/getlocal001.cpp
        index 9095312a5b6..c5ec07035f8 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetLocalVariable/getlocal001/getlocal001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetLocalVariable/getlocal001/getlocal001.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetLocalVariable/getlocal002/getlocal002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetLocalVariable/getlocal002/getlocal002.cpp
        index 48fac6fc75f..672404c23b1 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetLocalVariable/getlocal002/getlocal002.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetLocalVariable/getlocal002/getlocal002.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetLocalVariableTable/localtab001/localtab001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetLocalVariableTable/localtab001/localtab001.cpp
        index bca81f0d9fe..8f4750437bd 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetLocalVariableTable/localtab001/localtab001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetLocalVariableTable/localtab001/localtab001.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetLocalVariableTable/localtab002/localtab002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetLocalVariableTable/localtab002/localtab002.cpp
        index 877ed5fe517..649f065ffa5 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetLocalVariableTable/localtab002/localtab002.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetLocalVariableTable/localtab002/localtab002.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetLocalVariableTable/localtab003/localtab003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetLocalVariableTable/localtab003/localtab003.cpp
        index 00f3498d4d8..74d54ad0b5b 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetLocalVariableTable/localtab003/localtab003.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetLocalVariableTable/localtab003/localtab003.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetLocalVariableTable/localtab004/localtab004.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetLocalVariableTable/localtab004/localtab004.cpp
        index 2bd35a65392..5b45b23b808 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetLocalVariableTable/localtab004/localtab004.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetLocalVariableTable/localtab004/localtab004.cpp
        @@ -24,11 +24,11 @@
         #include 
         #include 
         #include 
        -#include "agent_common.h"
        +#include "agent_common.hpp"
         
        -#include "nsk_tools.h"
        -#include "JVMTITools.h"
        -#include "jvmti_tools.h"
        +#include "nsk_tools.hpp"
        +#include "JVMTITools.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetLocalVariableTable/localtab005/localtab005.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetLocalVariableTable/localtab005/localtab005.cpp
        index 0436b7f1d49..5c1de0b9b0e 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetLocalVariableTable/localtab005/localtab005.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetLocalVariableTable/localtab005/localtab005.cpp
        @@ -24,11 +24,11 @@
         #include 
         #include 
         #include 
        -#include "agent_common.h"
        +#include "agent_common.hpp"
         
        -#include "nsk_tools.h"
        -#include "JVMTITools.h"
        -#include "jvmti_tools.h"
        +#include "nsk_tools.hpp"
        +#include "JVMTITools.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetMaxLocals/maxloc001/maxloc001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetMaxLocals/maxloc001/maxloc001.cpp
        index aa6b4dcb99c..a716af1a686 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetMaxLocals/maxloc001/maxloc001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetMaxLocals/maxloc001/maxloc001.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetMaxLocals/maxloc002/maxloc002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetMaxLocals/maxloc002/maxloc002.cpp
        index 81851e1e282..6d8aa8baccf 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetMaxLocals/maxloc002/maxloc002.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetMaxLocals/maxloc002/maxloc002.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetMethodDeclaringClass/declcls001/declcls001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetMethodDeclaringClass/declcls001/declcls001.cpp
        index bfb2441f7dc..490d63ce6dc 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetMethodDeclaringClass/declcls001/declcls001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetMethodDeclaringClass/declcls001/declcls001.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetMethodDeclaringClass/declcls002/declcls002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetMethodDeclaringClass/declcls002/declcls002.cpp
        index 8edd98ab96e..837ef437bb8 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetMethodDeclaringClass/declcls002/declcls002.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetMethodDeclaringClass/declcls002/declcls002.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetMethodDeclaringClass/declcls003/declcls003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetMethodDeclaringClass/declcls003/declcls003.cpp
        index ca7bce9eb81..833edd6e75a 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetMethodDeclaringClass/declcls003/declcls003.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetMethodDeclaringClass/declcls003/declcls003.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetMethodLocation/methloc001/methloc001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetMethodLocation/methloc001/methloc001.cpp
        index 53978f36efe..a250b1178ca 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetMethodLocation/methloc001/methloc001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetMethodLocation/methloc001/methloc001.cpp
        @@ -23,7 +23,7 @@
         
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        +#include "agent_common.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetMethodLocation/methloc002/methloc002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetMethodLocation/methloc002/methloc002.cpp
        index 2e596dd7861..2dbb504ed12 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetMethodLocation/methloc002/methloc002.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetMethodLocation/methloc002/methloc002.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetMethodModifiers/methmod001/methmod001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetMethodModifiers/methmod001/methmod001.cpp
        index 3b44d8daf4c..8572908762b 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetMethodModifiers/methmod001/methmod001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetMethodModifiers/methmod001/methmod001.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetMethodModifiers/methmod002/methmod002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetMethodModifiers/methmod002/methmod002.cpp
        index 02fc2a5ba77..c5545532e44 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetMethodModifiers/methmod002/methmod002.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetMethodModifiers/methmod002/methmod002.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetMethodName/methname001/methname001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetMethodName/methname001/methname001.cpp
        index 6c4dcbb889e..08191498d93 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetMethodName/methname001/methname001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetMethodName/methname001/methname001.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetMethodName/methname002/methname002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetMethodName/methname002/methname002.cpp
        index bd503a6ae8c..5d28fd33a86 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetMethodName/methname002/methname002.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetMethodName/methname002/methname002.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetMethodName/methname003/methname003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetMethodName/methname003/methname003.cpp
        index a7a3a44022f..e64e7a8007b 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetMethodName/methname003/methname003.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetMethodName/methname003/methname003.cpp
        @@ -24,12 +24,12 @@
         #include 
         #include 
         #include 
        -#include "agent_common.h"
        +#include "agent_common.hpp"
         
        -#include "nsk_tools.h"
        -#include "jni_tools.h"
        -#include "JVMTITools.h"
        -#include "jvmti_tools.h"
        +#include "nsk_tools.hpp"
        +#include "jni_tools.hpp"
        +#include "JVMTITools.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetObjectHashCode/objhashcode001/objhashcode001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetObjectHashCode/objhashcode001/objhashcode001.cpp
        index 2931d0b0319..885b354ce25 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetObjectHashCode/objhashcode001/objhashcode001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetObjectHashCode/objhashcode001/objhashcode001.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "jni_tools.h"
        -#include "jvmti_tools.h"
        +#include "agent_common.hpp"
        +#include "jni_tools.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetObjectMonitorUsage/objmonusage001/objmonusage001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetObjectMonitorUsage/objmonusage001/objmonusage001.cpp
        index a02179847f6..bb9111d897f 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetObjectMonitorUsage/objmonusage001/objmonusage001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetObjectMonitorUsage/objmonusage001/objmonusage001.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetObjectMonitorUsage/objmonusage002/objmonusage002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetObjectMonitorUsage/objmonusage002/objmonusage002.cpp
        index 2dd0eaa24f0..c92d2802296 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetObjectMonitorUsage/objmonusage002/objmonusage002.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetObjectMonitorUsage/objmonusage002/objmonusage002.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetObjectMonitorUsage/objmonusage003/objmonusage003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetObjectMonitorUsage/objmonusage003/objmonusage003.cpp
        index d696fa08c4f..6e0a7d3b155 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetObjectMonitorUsage/objmonusage003/objmonusage003.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetObjectMonitorUsage/objmonusage003/objmonusage003.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetObjectMonitorUsage/objmonusage004/objmonusage004.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetObjectMonitorUsage/objmonusage004/objmonusage004.cpp
        index 47be3771376..6375403aa95 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetObjectMonitorUsage/objmonusage004/objmonusage004.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetObjectMonitorUsage/objmonusage004/objmonusage004.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetObjectMonitorUsage/objmonusage005/objmonusage005.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetObjectMonitorUsage/objmonusage005/objmonusage005.cpp
        index 36aed3377ca..eaf5c9668dc 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetObjectMonitorUsage/objmonusage005/objmonusage005.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetObjectMonitorUsage/objmonusage005/objmonusage005.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetObjectMonitorUsage/objmonusage006/objmonusage006.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetObjectMonitorUsage/objmonusage006/objmonusage006.cpp
        index 2be448e7342..252e3e9a934 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetObjectMonitorUsage/objmonusage006/objmonusage006.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetObjectMonitorUsage/objmonusage006/objmonusage006.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetObjectMonitorUsage/objmonusage007/objmonusage007.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetObjectMonitorUsage/objmonusage007/objmonusage007.cpp
        index 4f99a4b8918..b92f37218bf 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetObjectMonitorUsage/objmonusage007/objmonusage007.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetObjectMonitorUsage/objmonusage007/objmonusage007.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetObjectSize/objsize001/objsize001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetObjectSize/objsize001/objsize001.cpp
        index 87dfb9c40f7..a18c3d8a76e 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetObjectSize/objsize001/objsize001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetObjectSize/objsize001/objsize001.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "jni_tools.h"
        -#include "jvmti_tools.h"
        +#include "agent_common.hpp"
        +#include "jni_tools.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetObjectsWithTags/objwithtags001/objwithtags001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetObjectsWithTags/objwithtags001/objwithtags001.cpp
        index c2f4d92e318..d1cd1129430 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetObjectsWithTags/objwithtags001/objwithtags001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetObjectsWithTags/objwithtags001/objwithtags001.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "jni_tools.h"
        -#include "jvmti_tools.h"
        +#include "agent_common.hpp"
        +#include "jni_tools.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetOwnedMonitorInfo/ownmoninf001/ownmoninf001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetOwnedMonitorInfo/ownmoninf001/ownmoninf001.cpp
        index e86bf820b34..c01b9d69438 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetOwnedMonitorInfo/ownmoninf001/ownmoninf001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetOwnedMonitorInfo/ownmoninf001/ownmoninf001.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetOwnedMonitorInfo/ownmoninf002/ownmoninf002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetOwnedMonitorInfo/ownmoninf002/ownmoninf002.cpp
        index f5c13cfe71d..3837e255809 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetOwnedMonitorInfo/ownmoninf002/ownmoninf002.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetOwnedMonitorInfo/ownmoninf002/ownmoninf002.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetOwnedMonitorInfo/ownmoninf003/ownmoninf003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetOwnedMonitorInfo/ownmoninf003/ownmoninf003.cpp
        index 975be49082b..5f7ada614e8 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetOwnedMonitorInfo/ownmoninf003/ownmoninf003.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetOwnedMonitorInfo/ownmoninf003/ownmoninf003.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetPhase/getphase001/getphase001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetPhase/getphase001/getphase001.cpp
        index 70228ae0274..d1c7566b6af 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetPhase/getphase001/getphase001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetPhase/getphase001/getphase001.cpp
        @@ -22,9 +22,9 @@
          */
         #include 
         #include 
        -#include "jni_tools.h"
        -#include "agent_common.h"
        -#include "jvmti_tools.h"
        +#include "jni_tools.hpp"
        +#include "agent_common.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetPhase/getphase002/getphase002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetPhase/getphase002/getphase002.cpp
        index ec67d08a9f6..d1d8443b921 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetPhase/getphase002/getphase002.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetPhase/getphase002/getphase002.cpp
        @@ -22,9 +22,9 @@
          */
         
         #include 
        -#include "jni_tools.h"
        -#include "agent_common.h"
        -#include "jvmti_tools.h"
        +#include "jni_tools.hpp"
        +#include "agent_common.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetPotentialCapabilities/getpotcaps001/getpotcaps001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetPotentialCapabilities/getpotcaps001/getpotcaps001.cpp
        index f69b88176f1..daddc8a20a4 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetPotentialCapabilities/getpotcaps001/getpotcaps001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetPotentialCapabilities/getpotcaps001/getpotcaps001.cpp
        @@ -24,9 +24,9 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "jni_tools.h"
        -#include "jvmti_tools.h"
        +#include "agent_common.hpp"
        +#include "jni_tools.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetSourceDebugExtension/srcdebugex001/srcdebugex001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetSourceDebugExtension/srcdebugex001/srcdebugex001.cpp
        index ab1125b0037..58b8a0195ef 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetSourceDebugExtension/srcdebugex001/srcdebugex001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetSourceDebugExtension/srcdebugex001/srcdebugex001.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetSourceDebugExtension/srcdebugex002/srcdebugex002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetSourceDebugExtension/srcdebugex002/srcdebugex002.cpp
        index 420f38f84c6..033313e17eb 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetSourceDebugExtension/srcdebugex002/srcdebugex002.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetSourceDebugExtension/srcdebugex002/srcdebugex002.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetSourceDebugExtension/srcdebugex003/srcdebugex003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetSourceDebugExtension/srcdebugex003/srcdebugex003.cpp
        index 37fc8742807..5763103ac18 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetSourceDebugExtension/srcdebugex003/srcdebugex003.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetSourceDebugExtension/srcdebugex003/srcdebugex003.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetSourceFileName/getsrcfn004/getsrcfn004.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetSourceFileName/getsrcfn004/getsrcfn004.cpp
        index e9a2aff2a52..bdaeed82f6d 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetSourceFileName/getsrcfn004/getsrcfn004.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetSourceFileName/getsrcfn004/getsrcfn004.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetSourceFileName/getsrcfn005/getsrcfn005.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetSourceFileName/getsrcfn005/getsrcfn005.cpp
        index 16bf11e65f1..b5c387546ea 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetSourceFileName/getsrcfn005/getsrcfn005.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetSourceFileName/getsrcfn005/getsrcfn005.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetSourceFileName/getsrcfn006/getsrcfn006.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetSourceFileName/getsrcfn006/getsrcfn006.cpp
        index 390c9c1e124..2f7cbe7a56d 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetSourceFileName/getsrcfn006/getsrcfn006.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetSourceFileName/getsrcfn006/getsrcfn006.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetSystemProperties/getsysprops001/getsysprops001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetSystemProperties/getsysprops001/getsysprops001.cpp
        index 13a391227cb..da45f7748d2 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetSystemProperties/getsysprops001/getsysprops001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetSystemProperties/getsysprops001/getsysprops001.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "jni_tools.h"
        -#include "jvmti_tools.h"
        +#include "agent_common.hpp"
        +#include "jni_tools.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetSystemProperties/getsysprops002/getsysprops002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetSystemProperties/getsysprops002/getsysprops002.cpp
        index 81bd1819948..fa51345a148 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetSystemProperties/getsysprops002/getsysprops002.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetSystemProperties/getsysprops002/getsysprops002.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "jni_tools.h"
        -#include "jvmti_tools.h"
        +#include "agent_common.hpp"
        +#include "jni_tools.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetSystemProperty/getsysprop001/getsysprop001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetSystemProperty/getsysprop001/getsysprop001.cpp
        index 0540d756238..652e04171ff 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetSystemProperty/getsysprop001/getsysprop001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetSystemProperty/getsysprop001/getsysprop001.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "jni_tools.h"
        -#include "jvmti_tools.h"
        +#include "agent_common.hpp"
        +#include "jni_tools.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetSystemProperty/getsysprop002/getsysprop002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetSystemProperty/getsysprop002/getsysprop002.cpp
        index 38687ba8e9a..885bb264551 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetSystemProperty/getsysprop002/getsysprop002.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetSystemProperty/getsysprop002/getsysprop002.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "jni_tools.h"
        -#include "jvmti_tools.h"
        +#include "agent_common.hpp"
        +#include "jni_tools.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetTag/gettag001/gettag001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetTag/gettag001/gettag001.cpp
        index 926ef71ddab..e74f57b3b46 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetTag/gettag001/gettag001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetTag/gettag001/gettag001.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "jni_tools.h"
        -#include "jvmti_tools.h"
        +#include "agent_common.hpp"
        +#include "jni_tools.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetThreadCpuTime/thrcputime001/thrcputime001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetThreadCpuTime/thrcputime001/thrcputime001.cpp
        index 127ae04a0f9..aa1757f0e3e 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetThreadCpuTime/thrcputime001/thrcputime001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetThreadCpuTime/thrcputime001/thrcputime001.cpp
        @@ -24,9 +24,9 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "jni_tools.h"
        -#include "jvmti_tools.h"
        +#include "agent_common.hpp"
        +#include "jni_tools.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetThreadCpuTime/thrcputime002/thrcputime002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetThreadCpuTime/thrcputime002/thrcputime002.cpp
        index e69f2de6286..938ae04ceb1 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetThreadCpuTime/thrcputime002/thrcputime002.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetThreadCpuTime/thrcputime002/thrcputime002.cpp
        @@ -24,9 +24,9 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "jni_tools.h"
        -#include "jvmti_tools.h"
        +#include "agent_common.hpp"
        +#include "jni_tools.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetThreadCpuTimerInfo/thrtimerinfo001/thrtimerinfo001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetThreadCpuTimerInfo/thrtimerinfo001/thrtimerinfo001.cpp
        index 5d7ee5fb8a5..a7d741c4263 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetThreadCpuTimerInfo/thrtimerinfo001/thrtimerinfo001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetThreadCpuTimerInfo/thrtimerinfo001/thrtimerinfo001.cpp
        @@ -24,9 +24,9 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "jni_tools.h"
        -#include "jvmti_tools.h"
        +#include "agent_common.hpp"
        +#include "jni_tools.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetThreadGroupChildren/getthrdgrpchld001/getthrdgrpchld001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetThreadGroupChildren/getthrdgrpchld001/getthrdgrpchld001.cpp
        index e81cf933140..6e823d230aa 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetThreadGroupChildren/getthrdgrpchld001/getthrdgrpchld001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetThreadGroupChildren/getthrdgrpchld001/getthrdgrpchld001.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "jni_tools.h"
        -#include "jvmti_tools.h"
        +#include "agent_common.hpp"
        +#include "jni_tools.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetThreadGroupInfo/thrgrpinfo001/thrgrpinfo001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetThreadGroupInfo/thrgrpinfo001/thrgrpinfo001.cpp
        index 1d8bf4c02d2..c578a8df9cd 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetThreadGroupInfo/thrgrpinfo001/thrgrpinfo001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetThreadGroupInfo/thrgrpinfo001/thrgrpinfo001.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetThreadGroupInfo/thrgrpinfo002/thrgrpinfo002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetThreadGroupInfo/thrgrpinfo002/thrgrpinfo002.cpp
        index 02a4161f64e..7ea27fdee6f 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetThreadGroupInfo/thrgrpinfo002/thrgrpinfo002.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetThreadGroupInfo/thrgrpinfo002/thrgrpinfo002.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetThreadLocalStorage/getthrdstor001/getthrdstor001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetThreadLocalStorage/getthrdstor001/getthrdstor001.cpp
        index aa962164c15..79254fcfe54 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetThreadLocalStorage/getthrdstor001/getthrdstor001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetThreadLocalStorage/getthrdstor001/getthrdstor001.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "jni_tools.h"
        -#include "jvmti_tools.h"
        +#include "agent_common.hpp"
        +#include "jni_tools.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetTime/gettime001/gettime001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetTime/gettime001/gettime001.cpp
        index df8312be312..3f50ec721cc 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetTime/gettime001/gettime001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetTime/gettime001/gettime001.cpp
        @@ -24,9 +24,9 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "jni_tools.h"
        -#include "jvmti_tools.h"
        +#include "agent_common.hpp"
        +#include "jni_tools.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetTimerInfo/timerinfo001/timerinfo001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetTimerInfo/timerinfo001/timerinfo001.cpp
        index eebbfa837b6..9d53767b3ac 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetTimerInfo/timerinfo001/timerinfo001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetTimerInfo/timerinfo001/timerinfo001.cpp
        @@ -24,9 +24,9 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "jni_tools.h"
        -#include "jvmti_tools.h"
        +#include "agent_common.hpp"
        +#include "jni_tools.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetTopThreadGroups/topthrgrp001/topthrgrp001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetTopThreadGroups/topthrgrp001/topthrgrp001.cpp
        index 69baf58e6a7..624fbdd0791 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetTopThreadGroups/topthrgrp001/topthrgrp001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetTopThreadGroups/topthrgrp001/topthrgrp001.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetTopThreadGroups/topthrgrp002/topthrgrp002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetTopThreadGroups/topthrgrp002/topthrgrp002.cpp
        index b8817fcc1be..2a0ab2e71f5 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetTopThreadGroups/topthrgrp002/topthrgrp002.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetTopThreadGroups/topthrgrp002/topthrgrp002.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetVersionNumber/getvern001/getvern001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetVersionNumber/getvern001/getvern001.cpp
        index 80ba1ffe5c7..78ac1fa445a 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetVersionNumber/getvern001/getvern001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetVersionNumber/getvern001/getvern001.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/InterruptThread/intrpthrd001/intrpthrd001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/InterruptThread/intrpthrd001/intrpthrd001.cpp
        index e89a4ea7b4f..f413d63bd76 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/InterruptThread/intrpthrd001/intrpthrd001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/InterruptThread/intrpthrd001/intrpthrd001.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include 
        -#include "jni_tools.h"
        -#include "agent_common.h"
        -#include "jvmti_tools.h"
        +#include "jni_tools.hpp"
        +#include "agent_common.hpp"
        +#include "jvmti_tools.hpp"
         
         #define PASSED 0
         #define STATUS_FAILED 2
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/InterruptThread/intrpthrd002/intrpthrd002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/InterruptThread/intrpthrd002/intrpthrd002.cpp
        index 9411e9365d4..9f9affc6722 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/InterruptThread/intrpthrd002/intrpthrd002.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/InterruptThread/intrpthrd002/intrpthrd002.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/InterruptThread/intrpthrd003/intrpthrd003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/InterruptThread/intrpthrd003/intrpthrd003.cpp
        index dd81a65cb21..c29d495c1f8 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/InterruptThread/intrpthrd003/intrpthrd003.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/InterruptThread/intrpthrd003/intrpthrd003.cpp
        @@ -24,9 +24,9 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "jni_tools.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "jni_tools.hpp"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsArrayClass/isarray004/isarray004.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsArrayClass/isarray004/isarray004.cpp
        index ac14708af83..7976427a24a 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsArrayClass/isarray004/isarray004.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsArrayClass/isarray004/isarray004.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsArrayClass/isarray005/isarray005.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsArrayClass/isarray005/isarray005.cpp
        index 774ec0574be..8cee41638d2 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsArrayClass/isarray005/isarray005.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsArrayClass/isarray005/isarray005.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsFieldSynthetic/isfldsin002/isfldsin002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsFieldSynthetic/isfldsin002/isfldsin002.cpp
        index 1d4a737551d..5babeef5787 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsFieldSynthetic/isfldsin002/isfldsin002.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsFieldSynthetic/isfldsin002/isfldsin002.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsFieldSynthetic/isfldsin003/isfldsin003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsFieldSynthetic/isfldsin003/isfldsin003.cpp
        index 0089b0e6f70..2ffd6ca0e9a 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsFieldSynthetic/isfldsin003/isfldsin003.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsFieldSynthetic/isfldsin003/isfldsin003.cpp
        @@ -25,8 +25,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsInterface/isintrf004/isintrf004.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsInterface/isintrf004/isintrf004.cpp
        index fdc8da2bc78..6287e5846a2 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsInterface/isintrf004/isintrf004.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsInterface/isintrf004/isintrf004.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsInterface/isintrf005/isintrf005.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsInterface/isintrf005/isintrf005.cpp
        index 57f0386f2a9..c014249ed4d 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsInterface/isintrf005/isintrf005.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsInterface/isintrf005/isintrf005.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsMethodNative/isnative001/isnative001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsMethodNative/isnative001/isnative001.cpp
        index 4e2b49fa0a3..500d16405e6 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsMethodNative/isnative001/isnative001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsMethodNative/isnative001/isnative001.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsMethodNative/isnative002/isnative002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsMethodNative/isnative002/isnative002.cpp
        index 3160237fb47..6c8dd65b0d1 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsMethodNative/isnative002/isnative002.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsMethodNative/isnative002/isnative002.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsMethodObsolete/isobsolete001/isobsolete001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsMethodObsolete/isobsolete001/isobsolete001.cpp
        index fcc857134bf..0d7aeb1f4c3 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsMethodObsolete/isobsolete001/isobsolete001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsMethodObsolete/isobsolete001/isobsolete001.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "jni_tools.h"
        -#include "jvmti_tools.h"
        +#include "agent_common.hpp"
        +#include "jni_tools.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsMethodSynthetic/issynth001/issynth001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsMethodSynthetic/issynth001/issynth001.cpp
        index a10f3b8e0ee..e30eb3a0ab3 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsMethodSynthetic/issynth001/issynth001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsMethodSynthetic/issynth001/issynth001.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsMethodSynthetic/issynth002/issynth002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsMethodSynthetic/issynth002/issynth002.cpp
        index ab344596ab7..ae2c3106344 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsMethodSynthetic/issynth002/issynth002.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsMethodSynthetic/issynth002/issynth002.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverHeap/iterheap001/iterheap001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverHeap/iterheap001/iterheap001.cpp
        index fbfaac26708..dc2a5c3a0ba 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverHeap/iterheap001/iterheap001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverHeap/iterheap001/iterheap001.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "jni_tools.h"
        -#include "jvmti_tools.h"
        +#include "agent_common.hpp"
        +#include "jni_tools.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverHeap/iterheap002/iterheap002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverHeap/iterheap002/iterheap002.cpp
        index e1d5a366266..975e677bd1d 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverHeap/iterheap002/iterheap002.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverHeap/iterheap002/iterheap002.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "jni_tools.h"
        -#include "jvmti_tools.h"
        +#include "agent_common.hpp"
        +#include "jni_tools.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverHeap/iterheap003/iterheap003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverHeap/iterheap003/iterheap003.cpp
        index 488ce612a1b..6e92cfc8a22 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverHeap/iterheap003/iterheap003.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverHeap/iterheap003/iterheap003.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "jni_tools.h"
        -#include "jvmti_tools.h"
        +#include "agent_common.hpp"
        +#include "jni_tools.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverHeap/iterheap004/iterheap004.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverHeap/iterheap004/iterheap004.cpp
        index 8e30927f00b..d3858cece51 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverHeap/iterheap004/iterheap004.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverHeap/iterheap004/iterheap004.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "jni_tools.h"
        -#include "jvmti_tools.h"
        +#include "agent_common.hpp"
        +#include "jni_tools.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverHeap/iterheap005/iterheap005.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverHeap/iterheap005/iterheap005.cpp
        index 86b1c537a2c..d0fda690c14 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverHeap/iterheap005/iterheap005.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverHeap/iterheap005/iterheap005.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "jni_tools.h"
        -#include "jvmti_tools.h"
        +#include "agent_common.hpp"
        +#include "jni_tools.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverHeap/iterheap006/iterheap006.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverHeap/iterheap006/iterheap006.cpp
        index cc8da20efcc..5655bca5ffc 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverHeap/iterheap006/iterheap006.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverHeap/iterheap006/iterheap006.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "jni_tools.h"
        -#include "jvmti_tools.h"
        +#include "agent_common.hpp"
        +#include "jni_tools.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverHeap/iterheap007/iterheap007.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverHeap/iterheap007/iterheap007.cpp
        index 7075025ec09..3639386f737 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverHeap/iterheap007/iterheap007.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverHeap/iterheap007/iterheap007.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "jni_tools.h"
        -#include "jvmti_tools.h"
        +#include "agent_common.hpp"
        +#include "jni_tools.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverInstancesOfClass/iterinstcls001/iterinstcls001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverInstancesOfClass/iterinstcls001/iterinstcls001.cpp
        index 32b7adc30de..9f0600104ce 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverInstancesOfClass/iterinstcls001/iterinstcls001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverInstancesOfClass/iterinstcls001/iterinstcls001.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "jni_tools.h"
        -#include "jvmti_tools.h"
        +#include "agent_common.hpp"
        +#include "jni_tools.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverInstancesOfClass/iterinstcls002/iterinstcls002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverInstancesOfClass/iterinstcls002/iterinstcls002.cpp
        index b048103203b..1ab2a4c3ba7 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverInstancesOfClass/iterinstcls002/iterinstcls002.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverInstancesOfClass/iterinstcls002/iterinstcls002.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "jni_tools.h"
        -#include "jvmti_tools.h"
        +#include "agent_common.hpp"
        +#include "jni_tools.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverInstancesOfClass/iterinstcls003/iterinstcls003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverInstancesOfClass/iterinstcls003/iterinstcls003.cpp
        index 147003ff77f..5c77f2f52db 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverInstancesOfClass/iterinstcls003/iterinstcls003.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverInstancesOfClass/iterinstcls003/iterinstcls003.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "jni_tools.h"
        -#include "jvmti_tools.h"
        +#include "agent_common.hpp"
        +#include "jni_tools.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverInstancesOfClass/iterinstcls004/iterinstcls004.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverInstancesOfClass/iterinstcls004/iterinstcls004.cpp
        index 6790635654c..b77258c773a 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverInstancesOfClass/iterinstcls004/iterinstcls004.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverInstancesOfClass/iterinstcls004/iterinstcls004.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "jni_tools.h"
        -#include "jvmti_tools.h"
        +#include "agent_common.hpp"
        +#include "jni_tools.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverInstancesOfClass/iterinstcls005/iterinstcls005.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverInstancesOfClass/iterinstcls005/iterinstcls005.cpp
        index 7e7d6ff85be..23da29f1867 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverInstancesOfClass/iterinstcls005/iterinstcls005.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverInstancesOfClass/iterinstcls005/iterinstcls005.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "jni_tools.h"
        -#include "jvmti_tools.h"
        +#include "agent_common.hpp"
        +#include "jni_tools.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverInstancesOfClass/iterinstcls006/iterinstcls006.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverInstancesOfClass/iterinstcls006/iterinstcls006.cpp
        index 9129af82476..c025d8cbb80 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverInstancesOfClass/iterinstcls006/iterinstcls006.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverInstancesOfClass/iterinstcls006/iterinstcls006.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "jni_tools.h"
        -#include "jvmti_tools.h"
        +#include "agent_common.hpp"
        +#include "jni_tools.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverInstancesOfClass/iterinstcls007/iterinstcls007.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverInstancesOfClass/iterinstcls007/iterinstcls007.cpp
        index 01026bad68e..935b64104cb 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverInstancesOfClass/iterinstcls007/iterinstcls007.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverInstancesOfClass/iterinstcls007/iterinstcls007.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "jni_tools.h"
        -#include "jvmti_tools.h"
        +#include "agent_common.hpp"
        +#include "jni_tools.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverObjectsReachableFromObject/iterobjreachobj001/iterobjreachobj001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverObjectsReachableFromObject/iterobjreachobj001/iterobjreachobj001.cpp
        index ba158a475ae..7ed00c2580f 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverObjectsReachableFromObject/iterobjreachobj001/iterobjreachobj001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverObjectsReachableFromObject/iterobjreachobj001/iterobjreachobj001.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "jni_tools.h"
        -#include "jvmti_tools.h"
        +#include "agent_common.hpp"
        +#include "jni_tools.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverObjectsReachableFromObject/iterobjreachobj002/iterobjreachobj002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverObjectsReachableFromObject/iterobjreachobj002/iterobjreachobj002.cpp
        index 9f5e130341d..3b759579147 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverObjectsReachableFromObject/iterobjreachobj002/iterobjreachobj002.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverObjectsReachableFromObject/iterobjreachobj002/iterobjreachobj002.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "jni_tools.h"
        -#include "jvmti_tools.h"
        +#include "agent_common.hpp"
        +#include "jni_tools.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverObjectsReachableFromObject/iterobjreachobj003/iterobjreachobj003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverObjectsReachableFromObject/iterobjreachobj003/iterobjreachobj003.cpp
        index 0681864d99a..ccdd97a431a 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverObjectsReachableFromObject/iterobjreachobj003/iterobjreachobj003.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverObjectsReachableFromObject/iterobjreachobj003/iterobjreachobj003.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "jni_tools.h"
        -#include "jvmti_tools.h"
        +#include "agent_common.hpp"
        +#include "jni_tools.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverObjectsReachableFromObject/iterobjreachobj004/iterobjreachobj004.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverObjectsReachableFromObject/iterobjreachobj004/iterobjreachobj004.cpp
        index 44ae2c3e327..ff90ec1b0ba 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverObjectsReachableFromObject/iterobjreachobj004/iterobjreachobj004.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverObjectsReachableFromObject/iterobjreachobj004/iterobjreachobj004.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "jni_tools.h"
        -#include "jvmti_tools.h"
        +#include "agent_common.hpp"
        +#include "jni_tools.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverObjectsReachableFromObject/iterobjreachobj005/iterobjreachobj005.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverObjectsReachableFromObject/iterobjreachobj005/iterobjreachobj005.cpp
        index 5da3d9fa52c..5e74b8b607f 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverObjectsReachableFromObject/iterobjreachobj005/iterobjreachobj005.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverObjectsReachableFromObject/iterobjreachobj005/iterobjreachobj005.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "jni_tools.h"
        -#include "jvmti_tools.h"
        +#include "agent_common.hpp"
        +#include "jni_tools.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverReachableObjects/iterreachobj001/iterreachobj001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverReachableObjects/iterreachobj001/iterreachobj001.cpp
        index a30d854ee0d..727b1046245 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverReachableObjects/iterreachobj001/iterreachobj001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverReachableObjects/iterreachobj001/iterreachobj001.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "jni_tools.h"
        -#include "jvmti_tools.h"
        +#include "agent_common.hpp"
        +#include "jni_tools.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverReachableObjects/iterreachobj002/iterreachobj002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverReachableObjects/iterreachobj002/iterreachobj002.cpp
        index 549a1f3370f..236094b5015 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverReachableObjects/iterreachobj002/iterreachobj002.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverReachableObjects/iterreachobj002/iterreachobj002.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "jni_tools.h"
        -#include "jvmti_tools.h"
        +#include "agent_common.hpp"
        +#include "jni_tools.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverReachableObjects/iterreachobj003/iterreachobj003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverReachableObjects/iterreachobj003/iterreachobj003.cpp
        index 296fddccb97..d091687f492 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverReachableObjects/iterreachobj003/iterreachobj003.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverReachableObjects/iterreachobj003/iterreachobj003.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "jni_tools.h"
        -#include "jvmti_tools.h"
        +#include "agent_common.hpp"
        +#include "jni_tools.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverReachableObjects/iterreachobj004/iterreachobj004.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverReachableObjects/iterreachobj004/iterreachobj004.cpp
        index b6299fc09cb..9b9d14603a7 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverReachableObjects/iterreachobj004/iterreachobj004.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverReachableObjects/iterreachobj004/iterreachobj004.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "jni_tools.h"
        -#include "jvmti_tools.h"
        +#include "agent_common.hpp"
        +#include "jni_tools.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverReachableObjects/iterreachobj005/iterreachobj005.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverReachableObjects/iterreachobj005/iterreachobj005.cpp
        index b3a3a6fc288..30956305257 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverReachableObjects/iterreachobj005/iterreachobj005.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverReachableObjects/iterreachobj005/iterreachobj005.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "jni_tools.h"
        -#include "jvmti_tools.h"
        +#include "agent_common.hpp"
        +#include "jni_tools.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateThroughHeap/abort/Abort.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateThroughHeap/abort/Abort.cpp
        index b019be65f49..7df6157b375 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateThroughHeap/abort/Abort.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateThroughHeap/abort/Abort.cpp
        @@ -25,9 +25,9 @@
         #include 
         
         #include "jvmti.h"
        -#include "jni_tools.h"
        -#include "jvmti_tools.h"
        -#include "agent_common.h"
        +#include "jni_tools.hpp"
        +#include "jvmti_tools.hpp"
        +#include "agent_common.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateThroughHeap/callbacks/Callbacks.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateThroughHeap/callbacks/Callbacks.cpp
        index b1438acceb0..334937d3d04 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateThroughHeap/callbacks/Callbacks.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateThroughHeap/callbacks/Callbacks.cpp
        @@ -25,9 +25,9 @@
         #include 
         
         #include "jvmti.h"
        -#include "jni_tools.h"
        -#include "jvmti_tools.h"
        -#include "agent_common.h"
        +#include "jni_tools.hpp"
        +#include "jvmti_tools.hpp"
        +#include "agent_common.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateThroughHeap/concrete-klass-filter/ConcreteKlassFilter.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateThroughHeap/concrete-klass-filter/ConcreteKlassFilter.cpp
        index 1886e1cc3d6..3ab2c751187 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateThroughHeap/concrete-klass-filter/ConcreteKlassFilter.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateThroughHeap/concrete-klass-filter/ConcreteKlassFilter.cpp
        @@ -25,9 +25,9 @@
         #include 
         
         #include "jvmti.h"
        -#include "jni_tools.h"
        -#include "jvmti_tools.h"
        -#include "agent_common.h"
        +#include "jni_tools.hpp"
        +#include "jvmti_tools.hpp"
        +#include "agent_common.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateThroughHeap/filter-tagged/HeapFilter.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateThroughHeap/filter-tagged/HeapFilter.cpp
        index ea3ad39b92a..4115c60d228 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateThroughHeap/filter-tagged/HeapFilter.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateThroughHeap/filter-tagged/HeapFilter.cpp
        @@ -25,9 +25,9 @@
         #include 
         
         #include "jvmti.h"
        -#include "jni_tools.h"
        -#include "jvmti_tools.h"
        -#include "agent_common.h"
        +#include "jni_tools.hpp"
        +#include "jvmti_tools.hpp"
        +#include "agent_common.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateThroughHeap/non-concrete-klass-filter/NonConcreteKlassFilter.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateThroughHeap/non-concrete-klass-filter/NonConcreteKlassFilter.cpp
        index 20515df1b86..37e3af0c689 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateThroughHeap/non-concrete-klass-filter/NonConcreteKlassFilter.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateThroughHeap/non-concrete-klass-filter/NonConcreteKlassFilter.cpp
        @@ -25,9 +25,9 @@
         #include 
         
         #include "jvmti.h"
        -#include "jni_tools.h"
        -#include "jvmti_tools.h"
        -#include "agent_common.h"
        +#include "jni_tools.hpp"
        +#include "jvmti_tools.hpp"
        +#include "agent_common.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/NotifyFramePop/nframepop001/nframepop001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/NotifyFramePop/nframepop001/nframepop001.cpp
        index 50f52d7c0cf..eec81b91cb1 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/NotifyFramePop/nframepop001/nframepop001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/NotifyFramePop/nframepop001/nframepop001.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/NotifyFramePop/nframepop002/nframepop002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/NotifyFramePop/nframepop002/nframepop002.cpp
        index 09f6da40b33..333cd0298c4 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/NotifyFramePop/nframepop002/nframepop002.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/NotifyFramePop/nframepop002/nframepop002.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/NotifyFramePop/nframepop003/nframepop003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/NotifyFramePop/nframepop003/nframepop003.cpp
        index 325eb23f3b9..d389b123987 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/NotifyFramePop/nframepop003/nframepop003.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/NotifyFramePop/nframepop003/nframepop003.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ObjectFree/objfree001/objfree001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ObjectFree/objfree001/objfree001.cpp
        index b81c2c9a43e..22a1a227377 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ObjectFree/objfree001/objfree001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ObjectFree/objfree001/objfree001.cpp
        @@ -25,12 +25,12 @@
         #include 
         #include 
         #include 
        -#include "agent_common.h"
        +#include "agent_common.hpp"
         
        -#include "nsk_tools.h"
        -#include "JVMTITools.h"
        -#include "jvmti_tools.h"
        -#include "jni_tools.h"
        +#include "nsk_tools.hpp"
        +#include "JVMTITools.hpp"
        +#include "jvmti_tools.hpp"
        +#include "jni_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ObjectFree/objfree002/objfree002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ObjectFree/objfree002/objfree002.cpp
        index c3fc8621feb..462feb7b416 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ObjectFree/objfree002/objfree002.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ObjectFree/objfree002/objfree002.cpp
        @@ -25,12 +25,12 @@
         #include 
         #include 
         #include 
        -#include "agent_common.h"
        +#include "agent_common.hpp"
         
        -#include "nsk_tools.h"
        -#include "JVMTITools.h"
        -#include "jvmti_tools.h"
        -#include "jni_tools.h"
        +#include "nsk_tools.hpp"
        +#include "JVMTITools.hpp"
        +#include "jvmti_tools.hpp"
        +#include "jni_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe001/popframe001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe001/popframe001.cpp
        index 661219e3174..9b8381e9dcb 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe001/popframe001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe001/popframe001.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe002/popframe002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe002/popframe002.cpp
        index 6be72a9ee18..401a53d8026 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe002/popframe002.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe002/popframe002.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe003/popframe003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe003/popframe003.cpp
        index 958d14a52c2..7d9726a2dbf 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe003/popframe003.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe003/popframe003.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe004/popframe004.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe004/popframe004.cpp
        index 46457aced4d..642324f87b4 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe004/popframe004.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe004/popframe004.cpp
        @@ -24,9 +24,9 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        -#include "jvmti_common.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
        +#include "jvmti_common.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe005/popframe005.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe005/popframe005.cpp
        index 089c4dd5514..a4143f14e2a 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe005/popframe005.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe005/popframe005.cpp
        @@ -24,9 +24,9 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include 
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include 
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe006/popframe006.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe006/popframe006.cpp
        index 324160b40d7..154e70e3c16 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe006/popframe006.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe006/popframe006.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe007/popframe007.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe007/popframe007.cpp
        index db699216695..a2e9716a513 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe007/popframe007.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe007/popframe007.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe008/popframe008.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe008/popframe008.cpp
        index 430f19624d0..209cd2be05e 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe008/popframe008.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe008/popframe008.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe009/popframe009.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe009/popframe009.cpp
        index c15146e660f..faa4318f140 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe009/popframe009.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe009/popframe009.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe010/popframe010.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe010/popframe010.cpp
        index 68e0aa7c7bd..b9a8b431037 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe010/popframe010.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe010/popframe010.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe011/popframe011.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe011/popframe011.cpp
        index 32bf69ea853..0a61c485a65 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe011/popframe011.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe011/popframe011.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorEnter/rawmonenter001/rawmonenter001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorEnter/rawmonenter001/rawmonenter001.cpp
        index aeb2f3c4cd7..4f02bc3fa58 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorEnter/rawmonenter001/rawmonenter001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorEnter/rawmonenter001/rawmonenter001.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorEnter/rawmonenter002/rawmonenter002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorEnter/rawmonenter002/rawmonenter002.cpp
        index 790cafb1cfc..3744dd9d436 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorEnter/rawmonenter002/rawmonenter002.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorEnter/rawmonenter002/rawmonenter002.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorEnter/rawmonenter003/rawmonenter003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorEnter/rawmonenter003/rawmonenter003.cpp
        index 36aaa1cdbfb..4ebdbf2eb92 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorEnter/rawmonenter003/rawmonenter003.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorEnter/rawmonenter003/rawmonenter003.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorEnter/rawmonenter004/rawmonenter004.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorEnter/rawmonenter004/rawmonenter004.cpp
        index b2c5b8a929f..8fd60c13121 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorEnter/rawmonenter004/rawmonenter004.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorEnter/rawmonenter004/rawmonenter004.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorExit/rawmonexit001/rawmonexit001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorExit/rawmonexit001/rawmonexit001.cpp
        index fd1a2c47f6a..50f4eeb4477 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorExit/rawmonexit001/rawmonexit001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorExit/rawmonexit001/rawmonexit001.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorExit/rawmonexit002/rawmonexit002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorExit/rawmonexit002/rawmonexit002.cpp
        index 50fed1c7f1a..12da226126f 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorExit/rawmonexit002/rawmonexit002.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorExit/rawmonexit002/rawmonexit002.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorExit/rawmonexit003/rawmonexit003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorExit/rawmonexit003/rawmonexit003.cpp
        index 31221547a08..70f1f8f2db1 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorExit/rawmonexit003/rawmonexit003.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorExit/rawmonexit003/rawmonexit003.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorExit/rawmonexit005/rawmonexit005.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorExit/rawmonexit005/rawmonexit005.cpp
        index 11b8a83e03b..fd056d74efa 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorExit/rawmonexit005/rawmonexit005.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorExit/rawmonexit005/rawmonexit005.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorNotify/rawmnntfy001/rawmnntfy001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorNotify/rawmnntfy001/rawmnntfy001.cpp
        index d7070469880..e727177607e 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorNotify/rawmnntfy001/rawmnntfy001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorNotify/rawmnntfy001/rawmnntfy001.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorNotify/rawmnntfy002/rawmnntfy002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorNotify/rawmnntfy002/rawmnntfy002.cpp
        index 5900fa46ac8..f5a5ff41f05 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorNotify/rawmnntfy002/rawmnntfy002.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorNotify/rawmnntfy002/rawmnntfy002.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorNotify/rawmnntfy003/rawmnntfy003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorNotify/rawmnntfy003/rawmnntfy003.cpp
        index 2ab8362bd13..65258a6811b 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorNotify/rawmnntfy003/rawmnntfy003.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorNotify/rawmnntfy003/rawmnntfy003.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorNotify/rawmnntfy004/rawmnntfy004.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorNotify/rawmnntfy004/rawmnntfy004.cpp
        index 259f0b526b3..822fd63dfb6 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorNotify/rawmnntfy004/rawmnntfy004.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorNotify/rawmnntfy004/rawmnntfy004.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorNotifyAll/rawmnntfyall001/rawmnntfyall001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorNotifyAll/rawmnntfyall001/rawmnntfyall001.cpp
        index 42da7b3606c..0415de825f9 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorNotifyAll/rawmnntfyall001/rawmnntfyall001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorNotifyAll/rawmnntfyall001/rawmnntfyall001.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorNotifyAll/rawmnntfyall002/rawmnntfyall002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorNotifyAll/rawmnntfyall002/rawmnntfyall002.cpp
        index 74559aefd80..7da2cd42545 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorNotifyAll/rawmnntfyall002/rawmnntfyall002.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorNotifyAll/rawmnntfyall002/rawmnntfyall002.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorNotifyAll/rawmnntfyall003/rawmnntfyall003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorNotifyAll/rawmnntfyall003/rawmnntfyall003.cpp
        index 71aaa848a74..01f5810b3a7 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorNotifyAll/rawmnntfyall003/rawmnntfyall003.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorNotifyAll/rawmnntfyall003/rawmnntfyall003.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorNotifyAll/rawmnntfyall004/rawmnntfyall004.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorNotifyAll/rawmnntfyall004/rawmnntfyall004.cpp
        index 163d46e9e54..4cce57edcf8 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorNotifyAll/rawmnntfyall004/rawmnntfyall004.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorNotifyAll/rawmnntfyall004/rawmnntfyall004.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorWait/rawmnwait001/rawmnwait001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorWait/rawmnwait001/rawmnwait001.cpp
        index 589090ba211..05237468940 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorWait/rawmnwait001/rawmnwait001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorWait/rawmnwait001/rawmnwait001.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorWait/rawmnwait002/rawmnwait002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorWait/rawmnwait002/rawmnwait002.cpp
        index f0efca275f3..37a206965e1 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorWait/rawmnwait002/rawmnwait002.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorWait/rawmnwait002/rawmnwait002.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorWait/rawmnwait003/rawmnwait003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorWait/rawmnwait003/rawmnwait003.cpp
        index 74778ffcadf..e81e7266d23 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorWait/rawmnwait003/rawmnwait003.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorWait/rawmnwait003/rawmnwait003.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorWait/rawmnwait004/rawmnwait004.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorWait/rawmnwait004/rawmnwait004.cpp
        index c356e9007e6..76f27382123 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorWait/rawmnwait004/rawmnwait004.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorWait/rawmnwait004/rawmnwait004.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorWait/rawmnwait005/rawmnwait005.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorWait/rawmnwait005/rawmnwait005.cpp
        index 4df5817fcb5..b09490f3fa6 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorWait/rawmnwait005/rawmnwait005.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorWait/rawmnwait005/rawmnwait005.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/StressRedefine/stressRedefine.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/StressRedefine/stressRedefine.cpp
        index 56f5e5af1fe..0d407dee86c 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/StressRedefine/stressRedefine.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/StressRedefine/stressRedefine.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include 
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass001/redefclass001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass001/redefclass001.cpp
        index 8b1992d011c..54f3d456784 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass001/redefclass001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass001/redefclass001.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include 
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass002/redefclass002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass002/redefclass002.cpp
        index 31732b1566f..e709de40e0d 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass002/redefclass002.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass002/redefclass002.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include 
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass003/redefclass003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass003/redefclass003.cpp
        index 44654ac13ef..d45bea4d043 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass003/redefclass003.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass003/redefclass003.cpp
        @@ -24,9 +24,9 @@
         #include 
         #include 
         #include 
        -#include "jni_tools.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "jni_tools.hpp"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass004/redefclass004.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass004/redefclass004.cpp
        index 68ca36f6959..c19fd9113eb 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass004/redefclass004.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass004/redefclass004.cpp
        @@ -24,9 +24,9 @@
         #include 
         #include 
         #include 
        -#include "jni_tools.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "jni_tools.hpp"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass005/redefclass005.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass005/redefclass005.cpp
        index 0e7d2703eb3..86af7ae9a58 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass005/redefclass005.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass005/redefclass005.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include 
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass006/redefclass006.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass006/redefclass006.cpp
        index 9eea0a6e2d7..57f12dc83fc 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass006/redefclass006.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass006/redefclass006.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include 
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass008/redefclass008.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass008/redefclass008.cpp
        index 92094c887bd..565b3a02f00 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass008/redefclass008.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass008/redefclass008.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include 
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass009/redefclass009.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass009/redefclass009.cpp
        index e91f9f5e895..8c03608f480 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass009/redefclass009.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass009/redefclass009.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include 
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass010/redefclass010.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass010/redefclass010.cpp
        index 8d0831dfcb3..a8abe779bba 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass010/redefclass010.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass010/redefclass010.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include 
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass011/redefclass011.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass011/redefclass011.cpp
        index af4ca7ec417..ed6a20429f5 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass011/redefclass011.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass011/redefclass011.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass012/redefclass012.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass012/redefclass012.cpp
        index 1fe8077d6b7..45d6bb234af 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass012/redefclass012.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass012/redefclass012.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass013/redefclass013.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass013/redefclass013.cpp
        index c3612a7aab1..36396b4c2cf 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass013/redefclass013.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass013/redefclass013.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass014/redefclass014.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass014/redefclass014.cpp
        index 90080ef43d8..e38de4903f3 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass014/redefclass014.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass014/redefclass014.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass015/redefclass015.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass015/redefclass015.cpp
        index 5e18751e53a..7a47e55699c 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass015/redefclass015.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass015/redefclass015.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass016/redefclass016.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass016/redefclass016.cpp
        index 82e72f8befa..0682eaea6c5 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass016/redefclass016.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass016/redefclass016.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass017/redefclass017.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass017/redefclass017.cpp
        index 65fe8b5572c..77908ed1499 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass017/redefclass017.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass017/redefclass017.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass018/redefclass018.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass018/redefclass018.cpp
        index 37fc8d71108..044f23c6235 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass018/redefclass018.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass018/redefclass018.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass019/redefclass019.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass019/redefclass019.cpp
        index ee650ff1914..d8ca1cbf4ea 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass019/redefclass019.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass019/redefclass019.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass020/redefclass020.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass020/redefclass020.cpp
        index c8eee73de4d..5f431995812 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass020/redefclass020.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass020/redefclass020.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass021/redefclass021.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass021/redefclass021.cpp
        index 8e8f75e344f..233818a21da 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass021/redefclass021.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass021/redefclass021.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass022/redefclass022.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass022/redefclass022.cpp
        index dfda41c4b84..93aa706a9cd 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass022/redefclass022.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass022/redefclass022.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass023/redefclass023.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass023/redefclass023.cpp
        index 7a10b9dc5ee..d9bb42e8756 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass023/redefclass023.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass023/redefclass023.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass024/redefclass024.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass024/redefclass024.cpp
        index bd877d2e0b3..becd61705c6 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass024/redefclass024.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass024/redefclass024.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass025/redefclass025.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass025/redefclass025.cpp
        index d992762d4ca..a008e284bfd 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass025/redefclass025.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass025/redefclass025.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass026/redefclass026.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass026/redefclass026.cpp
        index efa2b86fa10..91a61032a77 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass026/redefclass026.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass026/redefclass026.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass027/redefclass027.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass027/redefclass027.cpp
        index badd984de77..451480cb7f0 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass027/redefclass027.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass027/redefclass027.cpp
        @@ -24,9 +24,9 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        -#include "jni_tools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
        +#include "jni_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass028/redefclass028.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass028/redefclass028.cpp
        index b626b71cec8..934e483da1d 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass028/redefclass028.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass028/redefclass028.cpp
        @@ -26,12 +26,12 @@
         #include 
         
         #include 
        -#include "agent_common.h"
        +#include "agent_common.hpp"
         
        -#include "nsk_tools.h"
        +#include "nsk_tools.hpp"
         #include "native_thread.hpp"
        -#include "JVMTITools.h"
        -#include "jvmti_tools.h"
        +#include "JVMTITools.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass029/redefclass029.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass029/redefclass029.cpp
        index 537bcfe2951..d2b4b720c55 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass029/redefclass029.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass029/redefclass029.cpp
        @@ -26,12 +26,12 @@
         #include 
         
         #include 
        -#include "agent_common.h"
        +#include "agent_common.hpp"
         
        -#include "nsk_tools.h"
        +#include "nsk_tools.hpp"
         #include "native_thread.hpp"
        -#include "JVMTITools.h"
        -#include "jvmti_tools.h"
        +#include "JVMTITools.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass030/redefclass030.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass030/redefclass030.cpp
        index 8ff30629c56..35505044ef1 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass030/redefclass030.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass030/redefclass030.cpp
        @@ -26,12 +26,12 @@
         #include 
         
         #include 
        -#include "agent_common.h"
        +#include "agent_common.hpp"
         
        -#include "nsk_tools.h"
        +#include "nsk_tools.hpp"
         #include "native_thread.hpp"
        -#include "JVMTITools.h"
        -#include "jvmti_tools.h"
        +#include "JVMTITools.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass031/redefclass031.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass031/redefclass031.cpp
        index 34a98b5f875..af250e1e40a 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass031/redefclass031.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass031/redefclass031.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include 
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RelinquishCapabilities/relcaps001/relcaps001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RelinquishCapabilities/relcaps001/relcaps001.cpp
        index 52e076741a3..34cb1e8615c 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RelinquishCapabilities/relcaps001/relcaps001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RelinquishCapabilities/relcaps001/relcaps001.cpp
        @@ -24,9 +24,9 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "jni_tools.h"
        -#include "jvmti_tools.h"
        +#include "agent_common.hpp"
        +#include "jni_tools.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RelinquishCapabilities/relcaps002/relcaps002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RelinquishCapabilities/relcaps002/relcaps002.cpp
        index c5ad887f7f3..8ed84ee549e 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RelinquishCapabilities/relcaps002/relcaps002.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RelinquishCapabilities/relcaps002/relcaps002.cpp
        @@ -24,9 +24,9 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "jni_tools.h"
        -#include "jvmti_tools.h"
        +#include "agent_common.hpp"
        +#include "jni_tools.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ResourceExhausted/resexhausted.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ResourceExhausted/resexhausted.cpp
        index f5a68c17ec7..43cfad13c64 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ResourceExhausted/resexhausted.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ResourceExhausted/resexhausted.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include 
        -#include "jvmti_tools.h"
        -#include "agent_common.h"
        +#include "jvmti_tools.hpp"
        +#include "agent_common.hpp"
         
         #define PASSED 0
         #define STATUS_FAILED 2
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ResumeThread/resumethrd001/resumethrd001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ResumeThread/resumethrd001/resumethrd001.cpp
        index a3e0ee7e80d..435232d367c 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ResumeThread/resumethrd001/resumethrd001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ResumeThread/resumethrd001/resumethrd001.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "jni_tools.h"
        -#include "jvmti_tools.h"
        +#include "agent_common.hpp"
        +#include "jni_tools.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ResumeThread/resumethrd002/resumethrd002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ResumeThread/resumethrd002/resumethrd002.cpp
        index 9afbc2a22d9..7bc34d71bdc 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ResumeThread/resumethrd002/resumethrd002.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ResumeThread/resumethrd002/resumethrd002.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "jni_tools.h"
        -#include "jvmti_tools.h"
        +#include "agent_common.hpp"
        +#include "jni_tools.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ResumeThreadList/resumethrdlst001/resumethrdlst001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ResumeThreadList/resumethrdlst001/resumethrdlst001.cpp
        index f0c21a7643d..3a2374199d9 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ResumeThreadList/resumethrdlst001/resumethrdlst001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ResumeThreadList/resumethrdlst001/resumethrdlst001.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "jni_tools.h"
        -#include "jvmti_tools.h"
        +#include "agent_common.hpp"
        +#include "jni_tools.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ResumeThreadList/resumethrdlst002/resumethrdlst002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ResumeThreadList/resumethrdlst002/resumethrdlst002.cpp
        index f1508b152ce..0461cc52f85 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ResumeThreadList/resumethrdlst002/resumethrdlst002.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ResumeThreadList/resumethrdlst002/resumethrdlst002.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "jni_tools.h"
        -#include "jvmti_tools.h"
        +#include "agent_common.hpp"
        +#include "jni_tools.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RetransformClasses/retransform002/retransform002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RetransformClasses/retransform002/retransform002.cpp
        index e3bb7f6d611..c5801d24e79 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RetransformClasses/retransform002/retransform002.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RetransformClasses/retransform002/retransform002.cpp
        @@ -24,9 +24,9 @@
         #include 
         #include 
         #include 
        -#include "agent_common.h"
        -#include 
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include 
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RetransformClasses/retransform003/retransform003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RetransformClasses/retransform003/retransform003.cpp
        index 69800c848e8..cda8481533d 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RetransformClasses/retransform003/retransform003.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RetransformClasses/retransform003/retransform003.cpp
        @@ -25,9 +25,9 @@
         #include 
         #include 
         #include 
        -#include "agent_common.h"
        -#include 
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include 
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RetransformClasses/retransform004/retransform004.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RetransformClasses/retransform004/retransform004.cpp
        index f6f6b9136f4..6d400b7df29 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RetransformClasses/retransform004/retransform004.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RetransformClasses/retransform004/retransform004.cpp
        @@ -25,9 +25,9 @@
         #include 
         #include 
         #include 
        -#include "agent_common.h"
        -#include 
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include 
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RunAgentThread/agentthr001/agentthr001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RunAgentThread/agentthr001/agentthr001.cpp
        index bf19ddb4903..60248189773 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RunAgentThread/agentthr001/agentthr001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RunAgentThread/agentthr001/agentthr001.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RunAgentThread/agentthr002/agentthr002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RunAgentThread/agentthr002/agentthr002.cpp
        index f155561f129..8c0ea9be4a0 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RunAgentThread/agentthr002/agentthr002.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RunAgentThread/agentthr002/agentthr002.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RunAgentThread/agentthr003/agentthr003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RunAgentThread/agentthr003/agentthr003.cpp
        index 95bb3e30fa1..61d1729e542 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RunAgentThread/agentthr003/agentthr003.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RunAgentThread/agentthr003/agentthr003.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetBreakpoint/setbrk002/setbrk002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetBreakpoint/setbrk002/setbrk002.cpp
        index 51a2c0ca72c..835ae6d9ec0 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetBreakpoint/setbrk002/setbrk002.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetBreakpoint/setbrk002/setbrk002.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetBreakpoint/setbrk003/setbrk003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetBreakpoint/setbrk003/setbrk003.cpp
        index 3f61346a1ea..117bc4f12e5 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetBreakpoint/setbrk003/setbrk003.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetBreakpoint/setbrk003/setbrk003.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetBreakpoint/setbrk005/setbrk005.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetBreakpoint/setbrk005/setbrk005.cpp
        index 8c6d5051420..ece5a09fea4 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetBreakpoint/setbrk005/setbrk005.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetBreakpoint/setbrk005/setbrk005.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetBreakpoint/setbrk007/setbrk007.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetBreakpoint/setbrk007/setbrk007.cpp
        index 60d56f40aae..1cd65eee9cd 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetBreakpoint/setbrk007/setbrk007.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetBreakpoint/setbrk007/setbrk007.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetBreakpoint/setbrk008/setbrk008.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetBreakpoint/setbrk008/setbrk008.cpp
        index b002b2ce371..db43f5675ff 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetBreakpoint/setbrk008/setbrk008.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetBreakpoint/setbrk008/setbrk008.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetEnvironmentLocalStorage/setenvstor001/setenvstor001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetEnvironmentLocalStorage/setenvstor001/setenvstor001.cpp
        index 265b10c1083..6244dec42e5 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetEnvironmentLocalStorage/setenvstor001/setenvstor001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetEnvironmentLocalStorage/setenvstor001/setenvstor001.cpp
        @@ -24,9 +24,9 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "jni_tools.h"
        -#include "jvmti_tools.h"
        +#include "agent_common.hpp"
        +#include "jni_tools.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetEnvironmentLocalStorage/setenvstor002/setenvstor002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetEnvironmentLocalStorage/setenvstor002/setenvstor002.cpp
        index 7194016b9aa..f870c0a0deb 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetEnvironmentLocalStorage/setenvstor002/setenvstor002.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetEnvironmentLocalStorage/setenvstor002/setenvstor002.cpp
        @@ -24,9 +24,9 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "jni_tools.h"
        -#include "jvmti_tools.h"
        +#include "agent_common.hpp"
        +#include "jni_tools.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetEnvironmentLocalStorage/setenvstor003/setenvstor003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetEnvironmentLocalStorage/setenvstor003/setenvstor003.cpp
        index 89ee7cc2887..e907967a2fa 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetEnvironmentLocalStorage/setenvstor003/setenvstor003.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetEnvironmentLocalStorage/setenvstor003/setenvstor003.cpp
        @@ -24,9 +24,9 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "jni_tools.h"
        -#include "jvmti_tools.h"
        +#include "agent_common.hpp"
        +#include "jni_tools.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetEventCallbacks/setevntcallb001/setevntcallb001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetEventCallbacks/setevntcallb001/setevntcallb001.cpp
        index 06fe61853f5..1f7e06b04a7 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetEventCallbacks/setevntcallb001/setevntcallb001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetEventCallbacks/setevntcallb001/setevntcallb001.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "jni_tools.h"
        -#include "jvmti_tools.h"
        +#include "agent_common.hpp"
        +#include "jni_tools.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetEventCallbacks/setevntcallb002/setevntcallb002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetEventCallbacks/setevntcallb002/setevntcallb002.cpp
        index 44535b30c11..f35f623e66b 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetEventCallbacks/setevntcallb002/setevntcallb002.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetEventCallbacks/setevntcallb002/setevntcallb002.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "jni_tools.h"
        -#include "jvmti_tools.h"
        +#include "agent_common.hpp"
        +#include "jni_tools.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetEventCallbacks/setevntcallb003/setevntcallb003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetEventCallbacks/setevntcallb003/setevntcallb003.cpp
        index 2b4d9aa05c5..daf2ffdc6fb 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetEventCallbacks/setevntcallb003/setevntcallb003.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetEventCallbacks/setevntcallb003/setevntcallb003.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "jni_tools.h"
        -#include "jvmti_tools.h"
        +#include "agent_common.hpp"
        +#include "jni_tools.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetEventNotificationMode/setnotif001/setnotif001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetEventNotificationMode/setnotif001/setnotif001.cpp
        index bd2c5ab397e..fd54a60fe5a 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetEventNotificationMode/setnotif001/setnotif001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetEventNotificationMode/setnotif001/setnotif001.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetExtensionEventCallback/setextevent001/setextevent001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetExtensionEventCallback/setextevent001/setextevent001.cpp
        index fc32a11a0ad..ec1e3d21276 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetExtensionEventCallback/setextevent001/setextevent001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetExtensionEventCallback/setextevent001/setextevent001.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "jni_tools.h"
        -#include "jvmti_tools.h"
        +#include "agent_common.hpp"
        +#include "jni_tools.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldAccessWatch/setfldw001/setfldw001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldAccessWatch/setfldw001/setfldw001.cpp
        index e28cffa3bc0..57286ce78a0 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldAccessWatch/setfldw001/setfldw001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldAccessWatch/setfldw001/setfldw001.cpp
        @@ -25,8 +25,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldAccessWatch/setfldw002/setfldw002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldAccessWatch/setfldw002/setfldw002.cpp
        index db4b0c401e3..557412d7051 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldAccessWatch/setfldw002/setfldw002.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldAccessWatch/setfldw002/setfldw002.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldAccessWatch/setfldw003/setfldw003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldAccessWatch/setfldw003/setfldw003.cpp
        index 058cc381622..f77a95c81d0 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldAccessWatch/setfldw003/setfldw003.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldAccessWatch/setfldw003/setfldw003.cpp
        @@ -25,8 +25,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldAccessWatch/setfldw004/setfldw004.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldAccessWatch/setfldw004/setfldw004.cpp
        index 7474fd97c1a..c6f7bc9ddb1 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldAccessWatch/setfldw004/setfldw004.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldAccessWatch/setfldw004/setfldw004.cpp
        @@ -25,8 +25,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldAccessWatch/setfldw005/setfldw005.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldAccessWatch/setfldw005/setfldw005.cpp
        index 910cc4ec9dd..7222d2a73c6 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldAccessWatch/setfldw005/setfldw005.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldAccessWatch/setfldw005/setfldw005.cpp
        @@ -25,8 +25,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldAccessWatch/setfldw006/setfldw006.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldAccessWatch/setfldw006/setfldw006.cpp
        index ac838cd5c5a..defe0959f16 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldAccessWatch/setfldw006/setfldw006.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldAccessWatch/setfldw006/setfldw006.cpp
        @@ -25,8 +25,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldModificationWatch/setfmodw001/setfmodw001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldModificationWatch/setfmodw001/setfmodw001.cpp
        index 42317001d0c..28851bc6838 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldModificationWatch/setfmodw001/setfmodw001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldModificationWatch/setfmodw001/setfmodw001.cpp
        @@ -25,8 +25,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldModificationWatch/setfmodw002/setfmodw002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldModificationWatch/setfmodw002/setfmodw002.cpp
        index 230d02d14f1..02ed16ce347 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldModificationWatch/setfmodw002/setfmodw002.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldModificationWatch/setfmodw002/setfmodw002.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldModificationWatch/setfmodw003/setfmodw003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldModificationWatch/setfmodw003/setfmodw003.cpp
        index c105b647d32..5bfcbe73a4e 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldModificationWatch/setfmodw003/setfmodw003.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldModificationWatch/setfmodw003/setfmodw003.cpp
        @@ -25,8 +25,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldModificationWatch/setfmodw004/setfmodw004.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldModificationWatch/setfmodw004/setfmodw004.cpp
        index 54759a984df..af545b823b4 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldModificationWatch/setfmodw004/setfmodw004.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldModificationWatch/setfmodw004/setfmodw004.cpp
        @@ -25,8 +25,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldModificationWatch/setfmodw005/setfmodw005.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldModificationWatch/setfmodw005/setfmodw005.cpp
        index 34cfdf628b4..8a18391a713 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldModificationWatch/setfmodw005/setfmodw005.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldModificationWatch/setfmodw005/setfmodw005.cpp
        @@ -25,8 +25,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldModificationWatch/setfmodw006/setfmodw006.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldModificationWatch/setfmodw006/setfmodw006.cpp
        index d4f78706563..18191588a47 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldModificationWatch/setfmodw006/setfmodw006.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldModificationWatch/setfmodw006/setfmodw006.cpp
        @@ -25,8 +25,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetJNIFunctionTable/setjniftab001/setjniftab001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetJNIFunctionTable/setjniftab001/setjniftab001.cpp
        index 2b1071db4bc..2fdb6e3193f 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetJNIFunctionTable/setjniftab001/setjniftab001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetJNIFunctionTable/setjniftab001/setjniftab001.cpp
        @@ -27,9 +27,9 @@
         #include 
         
         #include 
        -#include "agent_common.h"
        +#include "agent_common.hpp"
         
        -#include "JVMTITools.h"
        +#include "JVMTITools.hpp"
         #include "native_thread.hpp"
         
         extern "C" {
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetJNIFunctionTable/setjniftab002/setjniftab002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetJNIFunctionTable/setjniftab002/setjniftab002.cpp
        index 4e3df55cbc8..6d296ec531f 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetJNIFunctionTable/setjniftab002/setjniftab002.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetJNIFunctionTable/setjniftab002/setjniftab002.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetLocalVariable/setlocal001/setlocal001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetLocalVariable/setlocal001/setlocal001.cpp
        index 52a6e89f175..8193058eba7 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetLocalVariable/setlocal001/setlocal001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetLocalVariable/setlocal001/setlocal001.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetLocalVariable/setlocal002/setlocal002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetLocalVariable/setlocal002/setlocal002.cpp
        index 9ff5b3601f3..1a7b412061c 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetLocalVariable/setlocal002/setlocal002.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetLocalVariable/setlocal002/setlocal002.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetLocalVariable/setlocal003/setlocal003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetLocalVariable/setlocal003/setlocal003.cpp
        index fa0324b1563..793f22ec40f 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetLocalVariable/setlocal003/setlocal003.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetLocalVariable/setlocal003/setlocal003.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetLocalVariable/setlocal004/setlocal004.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetLocalVariable/setlocal004/setlocal004.cpp
        index 5ed6e9c5588..37598107c45 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetLocalVariable/setlocal004/setlocal004.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetLocalVariable/setlocal004/setlocal004.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetNativeMethodPrefix/SetNativeMethodPrefix001/SetNativeMethodPrefix001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetNativeMethodPrefix/SetNativeMethodPrefix001/SetNativeMethodPrefix001.cpp
        index c18485d4115..61420296b65 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetNativeMethodPrefix/SetNativeMethodPrefix001/SetNativeMethodPrefix001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetNativeMethodPrefix/SetNativeMethodPrefix001/SetNativeMethodPrefix001.cpp
        @@ -23,12 +23,12 @@
         #include 
         #include 
         #include 
        -#include "agent_common.h"
        +#include "agent_common.hpp"
         
        -#include "nsk_tools.h"
        -#include "JVMTITools.h"
        -#include "jvmti_tools.h"
        -#include "jni_tools.h"
        +#include "nsk_tools.hpp"
        +#include "JVMTITools.hpp"
        +#include "jvmti_tools.hpp"
        +#include "jni_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetNativeMethodPrefix/SetNativeMethodPrefix002/SetNativeMethodPrefix002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetNativeMethodPrefix/SetNativeMethodPrefix002/SetNativeMethodPrefix002.cpp
        index d4f6e157e64..2749d15d070 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetNativeMethodPrefix/SetNativeMethodPrefix002/SetNativeMethodPrefix002.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetNativeMethodPrefix/SetNativeMethodPrefix002/SetNativeMethodPrefix002.cpp
        @@ -23,12 +23,12 @@
         #include 
         #include 
         #include 
        -#include "agent_common.h"
        +#include "agent_common.hpp"
         
        -#include "nsk_tools.h"
        -#include "JVMTITools.h"
        -#include "jvmti_tools.h"
        -#include "jni_tools.h"
        +#include "nsk_tools.hpp"
        +#include "JVMTITools.hpp"
        +#include "jvmti_tools.hpp"
        +#include "jni_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetNativeMethodPrefix/SetNativeMethodPrefix002/SetNativeMethodPrefix002Main.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetNativeMethodPrefix/SetNativeMethodPrefix002/SetNativeMethodPrefix002Main.cpp
        index e491f439367..75b4fe2affd 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetNativeMethodPrefix/SetNativeMethodPrefix002/SetNativeMethodPrefix002Main.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetNativeMethodPrefix/SetNativeMethodPrefix002/SetNativeMethodPrefix002Main.cpp
        @@ -1,5 +1,5 @@
         /*
        - * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved.
        + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved.
          * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
          *
          * This code is free software; you can redistribute it and/or modify it
        @@ -24,10 +24,10 @@
         #include 
         #include 
         
        -#include "nsk_tools.h"
        -#include "JVMTITools.h"
        -#include "jvmti_tools.h"
        -#include "jni_tools.h"
        +#include "nsk_tools.hpp"
        +#include "JVMTITools.hpp"
        +#include "jvmti_tools.hpp"
        +#include "jni_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetSystemProperty/setsysprop002/setsysprop002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetSystemProperty/setsysprop002/setsysprop002.cpp
        index fc622764303..eef3388696e 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetSystemProperty/setsysprop002/setsysprop002.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetSystemProperty/setsysprop002/setsysprop002.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "jni_tools.h"
        -#include "jvmti_tools.h"
        +#include "agent_common.hpp"
        +#include "jni_tools.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetSystemProperty/setsysprop003/setsysprop003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetSystemProperty/setsysprop003/setsysprop003.cpp
        index 8d6f9ab12c1..856e4208ee1 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetSystemProperty/setsysprop003/setsysprop003.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetSystemProperty/setsysprop003/setsysprop003.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "jni_tools.h"
        -#include "jvmti_tools.h"
        +#include "agent_common.hpp"
        +#include "jni_tools.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetTag/settag001/settag001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetTag/settag001/settag001.cpp
        index f6f700d7004..e5929d5152a 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetTag/settag001/settag001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetTag/settag001/settag001.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "jni_tools.h"
        -#include "jvmti_tools.h"
        +#include "agent_common.hpp"
        +#include "jni_tools.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetThreadLocalStorage/setthrdstor001/setthrdstor001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetThreadLocalStorage/setthrdstor001/setthrdstor001.cpp
        index 10b0ab40792..83e28a9b1ba 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetThreadLocalStorage/setthrdstor001/setthrdstor001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetThreadLocalStorage/setthrdstor001/setthrdstor001.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "jni_tools.h"
        -#include "jvmti_tools.h"
        +#include "agent_common.hpp"
        +#include "jni_tools.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetThreadLocalStorage/setthrdstor002/setthrdstor002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetThreadLocalStorage/setthrdstor002/setthrdstor002.cpp
        index baf6a2a33c7..c59b256bb1a 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetThreadLocalStorage/setthrdstor002/setthrdstor002.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetThreadLocalStorage/setthrdstor002/setthrdstor002.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "jni_tools.h"
        -#include "jvmti_tools.h"
        +#include "agent_common.hpp"
        +#include "jni_tools.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetThreadLocalStorage/setthrdstor003/setthrdstor003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetThreadLocalStorage/setthrdstor003/setthrdstor003.cpp
        index 74514d40d8d..375378687e3 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetThreadLocalStorage/setthrdstor003/setthrdstor003.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetThreadLocalStorage/setthrdstor003/setthrdstor003.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "jni_tools.h"
        -#include "jvmti_tools.h"
        +#include "agent_common.hpp"
        +#include "jni_tools.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetVerboseFlag/setvrbflag001/setvrbflag001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetVerboseFlag/setvrbflag001/setvrbflag001.cpp
        index 075cdf9a5d4..5582151a257 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetVerboseFlag/setvrbflag001/setvrbflag001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetVerboseFlag/setvrbflag001/setvrbflag001.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include 
        -#include "jni_tools.h"
        -#include "agent_common.h"
        -#include "jvmti_tools.h"
        +#include "jni_tools.hpp"
        +#include "agent_common.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetVerboseFlag/setvrbflag002/setvrbflag002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetVerboseFlag/setvrbflag002/setvrbflag002.cpp
        index a00da5d1226..9d134e0a3c3 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetVerboseFlag/setvrbflag002/setvrbflag002.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetVerboseFlag/setvrbflag002/setvrbflag002.cpp
        @@ -22,9 +22,9 @@
          */
         
         #include 
        -#include "jni_tools.h"
        -#include "agent_common.h"
        -#include "jvmti_tools.h"
        +#include "jni_tools.hpp"
        +#include "agent_common.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/StopThread/stopthrd006/stopthrd006.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/StopThread/stopthrd006/stopthrd006.cpp
        index f479cc966a6..16d88f7b891 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/StopThread/stopthrd006/stopthrd006.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/StopThread/stopthrd006/stopthrd006.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/StopThread/stopthrd007/stopthrd007.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/StopThread/stopthrd007/stopthrd007.cpp
        index bf5d20fc8fd..487b1b2f012 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/StopThread/stopthrd007/stopthrd007.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/StopThread/stopthrd007/stopthrd007.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include 
        -#include "jni_tools.h"
        -#include "agent_common.h"
        -#include "jvmti_tools.h"
        +#include "jni_tools.hpp"
        +#include "agent_common.hpp"
        +#include "jvmti_tools.hpp"
         
         #define PASSED 0
         #define STATUS_FAILED 2
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SuspendThread/suspendthrd001/suspendthrd001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SuspendThread/suspendthrd001/suspendthrd001.cpp
        index 97da3e1dec1..e340c488d62 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SuspendThread/suspendthrd001/suspendthrd001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SuspendThread/suspendthrd001/suspendthrd001.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "jni_tools.h"
        -#include "jvmti_tools.h"
        +#include "agent_common.hpp"
        +#include "jni_tools.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SuspendThread/suspendthrd002/suspendthrd002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SuspendThread/suspendthrd002/suspendthrd002.cpp
        index d9eff84b63f..01145556a95 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SuspendThread/suspendthrd002/suspendthrd002.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SuspendThread/suspendthrd002/suspendthrd002.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "jni_tools.h"
        -#include "jvmti_tools.h"
        +#include "agent_common.hpp"
        +#include "jni_tools.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SuspendThread/suspendthrd003/suspendthrd003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SuspendThread/suspendthrd003/suspendthrd003.cpp
        index e172af654c8..bd3226739f7 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SuspendThread/suspendthrd003/suspendthrd003.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SuspendThread/suspendthrd003/suspendthrd003.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "jni_tools.h"
        -#include "jvmti_tools.h"
        +#include "agent_common.hpp"
        +#include "jni_tools.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SuspendThreadList/suspendthrdlst001/suspendthrdlst001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SuspendThreadList/suspendthrdlst001/suspendthrdlst001.cpp
        index 514dcbd43e9..4a5817c25de 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SuspendThreadList/suspendthrdlst001/suspendthrdlst001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SuspendThreadList/suspendthrdlst001/suspendthrdlst001.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "jni_tools.h"
        -#include "jvmti_tools.h"
        +#include "agent_common.hpp"
        +#include "jni_tools.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SuspendThreadList/suspendthrdlst002/suspendthrdlst002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SuspendThreadList/suspendthrdlst002/suspendthrdlst002.cpp
        index 31406434c49..2868fbf5439 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SuspendThreadList/suspendthrdlst002/suspendthrdlst002.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SuspendThreadList/suspendthrdlst002/suspendthrdlst002.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "jni_tools.h"
        -#include "jvmti_tools.h"
        +#include "agent_common.hpp"
        +#include "jni_tools.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/VMDeath/vmdeath001/vmdeath001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/VMDeath/vmdeath001/vmdeath001.cpp
        index 4eabc000abf..9f692a799ac 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/VMDeath/vmdeath001/vmdeath001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/VMDeath/vmdeath001/vmdeath001.cpp
        @@ -27,11 +27,11 @@
         #include 
         
         #include 
        -#include "agent_common.h"
        +#include "agent_common.hpp"
         
        -#include "nsk_tools.h"
        -#include "JVMTITools.h"
        -#include "jvmti_tools.h"
        +#include "nsk_tools.hpp"
        +#include "JVMTITools.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/VMInit/vminit001/vminit001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/VMInit/vminit001/vminit001.cpp
        index 5346f1b41fa..4e22da84a5d 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/VMInit/vminit001/vminit001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/VMInit/vminit001/vminit001.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP01/ap01t001/ap01t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP01/ap01t001/ap01t001.cpp
        index e2210d23b64..b0795077bd2 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP01/ap01t001/ap01t001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP01/ap01t001/ap01t001.cpp
        @@ -25,12 +25,12 @@
         #include 
         #include 
         #include 
        -#include "agent_common.h"
        +#include "agent_common.hpp"
         
        -#include "nsk_tools.h"
        -#include "jni_tools.h"
        -#include "JVMTITools.h"
        -#include "jvmti_tools.h"
        +#include "nsk_tools.hpp"
        +#include "jni_tools.hpp"
        +#include "JVMTITools.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP02/ap02t001/ap02t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP02/ap02t001/ap02t001.cpp
        index 9697e1d1ef6..11f3f63751e 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP02/ap02t001/ap02t001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP02/ap02t001/ap02t001.cpp
        @@ -24,12 +24,12 @@
         #include 
         #include 
         #include 
        -#include "agent_common.h"
        +#include "agent_common.hpp"
         
        -#include "nsk_tools.h"
        -#include "jni_tools.h"
        -#include "JVMTITools.h"
        -#include "jvmti_tools.h"
        +#include "nsk_tools.hpp"
        +#include "jni_tools.hpp"
        +#include "JVMTITools.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP03/ap03t001/ap03t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP03/ap03t001/ap03t001.cpp
        index 4e7473be5b6..e50e1ff537b 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP03/ap03t001/ap03t001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP03/ap03t001/ap03t001.cpp
        @@ -24,12 +24,12 @@
         #include 
         #include 
         #include 
        -#include "agent_common.h"
        +#include "agent_common.hpp"
         
        -#include "nsk_tools.h"
        -#include "jni_tools.h"
        -#include "JVMTITools.h"
        -#include "jvmti_tools.h"
        +#include "nsk_tools.hpp"
        +#include "jni_tools.hpp"
        +#include "JVMTITools.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP04/ap04t001/ap04t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP04/ap04t001/ap04t001.cpp
        index eea3e881ccd..e9eaf32a6bc 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP04/ap04t001/ap04t001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP04/ap04t001/ap04t001.cpp
        @@ -24,12 +24,12 @@
         #include 
         #include 
         #include 
        -#include "agent_common.h"
        +#include "agent_common.hpp"
         
        -#include "nsk_tools.h"
        -#include "jni_tools.h"
        -#include "JVMTITools.h"
        -#include "jvmti_tools.h"
        +#include "nsk_tools.hpp"
        +#include "jni_tools.hpp"
        +#include "JVMTITools.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP04/ap04t002/ap04t002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP04/ap04t002/ap04t002.cpp
        index e9f43a1cbaf..dd983b0e918 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP04/ap04t002/ap04t002.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP04/ap04t002/ap04t002.cpp
        @@ -24,12 +24,12 @@
         #include 
         #include 
         #include 
        -#include "agent_common.h"
        +#include "agent_common.hpp"
         
        -#include "nsk_tools.h"
        -#include "jni_tools.h"
        -#include "JVMTITools.h"
        -#include "jvmti_tools.h"
        +#include "nsk_tools.hpp"
        +#include "jni_tools.hpp"
        +#include "JVMTITools.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP04/ap04t003/ap04t003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP04/ap04t003/ap04t003.cpp
        index 4e0673b608d..b596cdda2d3 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP04/ap04t003/ap04t003.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP04/ap04t003/ap04t003.cpp
        @@ -24,12 +24,12 @@
         #include 
         #include 
         #include 
        -#include "agent_common.h"
        +#include "agent_common.hpp"
         #include "ExceptionCheckingJniEnv.hpp"
        -#include "nsk_tools.h"
        -#include "jni_tools.h"
        -#include "JVMTITools.h"
        -#include "jvmti_tools.h"
        +#include "nsk_tools.hpp"
        +#include "jni_tools.hpp"
        +#include "JVMTITools.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP05/ap05t001/ap05t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP05/ap05t001/ap05t001.cpp
        index 64cd66bac55..4d233dcab4f 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP05/ap05t001/ap05t001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP05/ap05t001/ap05t001.cpp
        @@ -24,12 +24,12 @@
         #include 
         #include 
         #include 
        -#include "agent_common.h"
        +#include "agent_common.hpp"
         
        -#include "nsk_tools.h"
        -#include "jni_tools.h"
        -#include "JVMTITools.h"
        -#include "jvmti_tools.h"
        +#include "nsk_tools.hpp"
        +#include "jni_tools.hpp"
        +#include "JVMTITools.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP05/ap05t002/ap05t002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP05/ap05t002/ap05t002.cpp
        index b3e5fe567f6..3378d836886 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP05/ap05t002/ap05t002.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP05/ap05t002/ap05t002.cpp
        @@ -24,12 +24,12 @@
         #include 
         #include 
         #include 
        -#include "agent_common.h"
        +#include "agent_common.hpp"
         
        -#include "nsk_tools.h"
        -#include "jni_tools.h"
        -#include "JVMTITools.h"
        -#include "jvmti_tools.h"
        +#include "nsk_tools.hpp"
        +#include "jni_tools.hpp"
        +#include "JVMTITools.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP06/ap06t001/ap06t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP06/ap06t001/ap06t001.cpp
        index dafd0a59b1e..d720267675c 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP06/ap06t001/ap06t001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP06/ap06t001/ap06t001.cpp
        @@ -24,12 +24,12 @@
         #include 
         #include 
         #include 
        -#include "agent_common.h"
        +#include "agent_common.hpp"
         
        -#include "nsk_tools.h"
        -#include "jni_tools.h"
        -#include "JVMTITools.h"
        -#include "jvmti_tools.h"
        +#include "nsk_tools.hpp"
        +#include "jni_tools.hpp"
        +#include "JVMTITools.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP07/ap07t001/ap07t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP07/ap07t001/ap07t001.cpp
        index 16831e35524..d44092febdd 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP07/ap07t001/ap07t001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP07/ap07t001/ap07t001.cpp
        @@ -24,12 +24,12 @@
         #include 
         #include 
         #include 
        -#include "agent_common.h"
        +#include "agent_common.hpp"
         
        -#include "nsk_tools.h"
        -#include "jni_tools.h"
        -#include "JVMTITools.h"
        -#include "jvmti_tools.h"
        +#include "nsk_tools.hpp"
        +#include "jni_tools.hpp"
        +#include "JVMTITools.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP07/ap07t002/ap07t002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP07/ap07t002/ap07t002.cpp
        index 01fbb9471ac..9986c6b191a 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP07/ap07t002/ap07t002.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP07/ap07t002/ap07t002.cpp
        @@ -24,12 +24,12 @@
         #include 
         #include 
         #include 
        -#include "agent_common.h"
        +#include "agent_common.hpp"
         
        -#include "nsk_tools.h"
        -#include "jni_tools.h"
        -#include "JVMTITools.h"
        -#include "jvmti_tools.h"
        +#include "nsk_tools.hpp"
        +#include "jni_tools.hpp"
        +#include "JVMTITools.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP09/ap09t001/ap09t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP09/ap09t001/ap09t001.cpp
        index 229f7dba9b7..aa429f46baf 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP09/ap09t001/ap09t001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP09/ap09t001/ap09t001.cpp
        @@ -24,12 +24,12 @@
         #include 
         #include 
         #include 
        -#include "agent_common.h"
        +#include "agent_common.hpp"
         
        -#include "nsk_tools.h"
        -#include "jni_tools.h"
        -#include "JVMTITools.h"
        -#include "jvmti_tools.h"
        +#include "nsk_tools.hpp"
        +#include "jni_tools.hpp"
        +#include "JVMTITools.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP10/ap10t001/ap10t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP10/ap10t001/ap10t001.cpp
        index fdc0e50273c..cfa75bb2f3d 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP10/ap10t001/ap10t001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP10/ap10t001/ap10t001.cpp
        @@ -24,11 +24,11 @@
         #include 
         #include 
         #include 
        -#include "agent_common.h"
        +#include "agent_common.hpp"
         
        -#include "nsk_tools.h"
        -#include "JVMTITools.h"
        -#include "jvmti_tools.h"
        +#include "nsk_tools.hpp"
        +#include "JVMTITools.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP11/ap11t001/ap11t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP11/ap11t001/ap11t001.cpp
        index 59b35902bad..b47b4c6a76e 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP11/ap11t001/ap11t001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP11/ap11t001/ap11t001.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "jni_tools.h"
        -#include "jvmti_tools.h"
        +#include "agent_common.hpp"
        +#include "jni_tools.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP12/ap12t001/ap12t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP12/ap12t001/ap12t001.cpp
        index c34bb8891f6..2f5e46f7ec7 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP12/ap12t001/ap12t001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP12/ap12t001/ap12t001.cpp
        @@ -25,12 +25,12 @@
         #include 
         #include 
         #include 
        -#include "agent_common.h"
        +#include "agent_common.hpp"
         
        -#include "nsk_tools.h"
        -#include "jni_tools.h"
        -#include "JVMTITools.h"
        -#include "jvmti_tools.h"
        +#include "nsk_tools.hpp"
        +#include "jni_tools.hpp"
        +#include "JVMTITools.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/bcinstr/BI01/bi01t001/bi01t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/bcinstr/BI01/bi01t001/bi01t001.cpp
        index 951d0c6c7c9..6b3df432d5e 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/bcinstr/BI01/bi01t001/bi01t001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/bcinstr/BI01/bi01t001/bi01t001.cpp
        @@ -23,10 +23,10 @@
         
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        +#include "agent_common.hpp"
         #include "ExceptionCheckingJniEnv.hpp"
        -#include "jni_tools.h"
        -#include "jvmti_tools.h"
        +#include "jni_tools.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/bcinstr/BI01/bi01t002/bi01t002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/bcinstr/BI01/bi01t002/bi01t002.cpp
        index 2a3aab3a08d..71b8b62e9da 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/bcinstr/BI01/bi01t002/bi01t002.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/bcinstr/BI01/bi01t002/bi01t002.cpp
        @@ -23,10 +23,10 @@
         
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        +#include "agent_common.hpp"
         #include "ExceptionCheckingJniEnv.hpp"
        -#include "jni_tools.h"
        -#include "jvmti_tools.h"
        +#include "jni_tools.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/bcinstr/BI02/bi02t001/bi02t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/bcinstr/BI02/bi02t001/bi02t001.cpp
        index 6e732377021..ea558bc0cd4 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/bcinstr/BI02/bi02t001/bi02t001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/bcinstr/BI02/bi02t001/bi02t001.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include 
        -#include "jni_tools.h"
        -#include "agent_common.h"
        -#include "jvmti_tools.h"
        +#include "jni_tools.hpp"
        +#include "agent_common.hpp"
        +#include "jvmti_tools.hpp"
         
         #define PASSED 0
         #define STATUS_FAILED 2
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/bcinstr/BI02/bi02t002/bi02t002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/bcinstr/BI02/bi02t002/bi02t002.cpp
        index 197d776cb45..403c199c8d5 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/bcinstr/BI02/bi02t002/bi02t002.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/bcinstr/BI02/bi02t002/bi02t002.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include 
        -#include "jni_tools.h"
        -#include "agent_common.h"
        -#include "jvmti_tools.h"
        +#include "jni_tools.hpp"
        +#include "agent_common.hpp"
        +#include "jvmti_tools.hpp"
         
         #define PASSED 0
         #define STATUS_FAILED 2
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/bcinstr/BI03/bi03t001/bi03t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/bcinstr/BI03/bi03t001/bi03t001.cpp
        index b302186df58..dddc47377ca 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/bcinstr/BI03/bi03t001/bi03t001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/bcinstr/BI03/bi03t001/bi03t001.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include 
        -#include "jni_tools.h"
        -#include "agent_common.h"
        -#include "jvmti_tools.h"
        +#include "jni_tools.hpp"
        +#include "agent_common.hpp"
        +#include "jvmti_tools.hpp"
         
         #define PASSED 0
         #define STATUS_FAILED 2
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/bcinstr/BI03/bi03t002/bi03t002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/bcinstr/BI03/bi03t002/bi03t002.cpp
        index 575ebead06e..e681eeaab9b 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/bcinstr/BI03/bi03t002/bi03t002.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/bcinstr/BI03/bi03t002/bi03t002.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include 
        -#include "jni_tools.h"
        -#include "agent_common.h"
        -#include "jvmti_tools.h"
        +#include "jni_tools.hpp"
        +#include "agent_common.hpp"
        +#include "jvmti_tools.hpp"
         
         #define PASSED 0
         #define STATUS_FAILED 2
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/bcinstr/BI04/bi04t002/bi04t002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/bcinstr/BI04/bi04t002/bi04t002.cpp
        index 6bb7ba83406..17733d4ba54 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/bcinstr/BI04/bi04t002/bi04t002.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/bcinstr/BI04/bi04t002/bi04t002.cpp
        @@ -23,10 +23,10 @@
         
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        +#include "agent_common.hpp"
         #include "ExceptionCheckingJniEnv.hpp"
        -#include "jni_tools.h"
        -#include "jvmti_tools.h"
        +#include "jni_tools.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t001/cm01t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t001/cm01t001.cpp
        index 2d6978c2a0e..7845cac2086 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t001/cm01t001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t001/cm01t001.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include 
        -#include "jni_tools.h"
        -#include "agent_common.h"
        -#include "jvmti_tools.h"
        +#include "jni_tools.hpp"
        +#include "agent_common.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t002/cm01t002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t002/cm01t002.cpp
        index 45761319f04..c45392500e5 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t002/cm01t002.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t002/cm01t002.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include 
        -#include "jni_tools.h"
        -#include "agent_common.h"
        -#include "jvmti_tools.h"
        +#include "jni_tools.hpp"
        +#include "agent_common.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t003/cm01t003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t003/cm01t003.cpp
        index 7580d3f6a93..02d50b4819c 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t003/cm01t003.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t003/cm01t003.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include 
        -#include "jni_tools.h"
        -#include "agent_common.h"
        -#include "jvmti_tools.h"
        +#include "jni_tools.hpp"
        +#include "agent_common.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t004/cm01t004.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t004/cm01t004.cpp
        index a5b7072692a..570c12f7073 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t004/cm01t004.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t004/cm01t004.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include 
        -#include "jni_tools.h"
        -#include "agent_common.h"
        -#include "jvmti_tools.h"
        +#include "jni_tools.hpp"
        +#include "agent_common.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t005/cm01t005.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t005/cm01t005.cpp
        index b91e949a8c1..ae806ed9cb7 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t005/cm01t005.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t005/cm01t005.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include 
        -#include "jni_tools.h"
        -#include "agent_common.h"
        -#include "jvmti_tools.h"
        +#include "jni_tools.hpp"
        +#include "agent_common.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t006/cm01t006.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t006/cm01t006.cpp
        index 325d6d725dd..2bd74172902 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t006/cm01t006.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t006/cm01t006.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include 
        -#include "jni_tools.h"
        -#include "agent_common.h"
        -#include "jvmti_tools.h"
        +#include "jni_tools.hpp"
        +#include "agent_common.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t007/cm01t007.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t007/cm01t007.cpp
        index 4576bcd2f68..6c6e1b9d7e2 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t007/cm01t007.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t007/cm01t007.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include 
        -#include "jni_tools.h"
        -#include "agent_common.h"
        -#include "jvmti_tools.h"
        +#include "jni_tools.hpp"
        +#include "agent_common.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t008/cm01t008.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t008/cm01t008.cpp
        index 6783905f6b8..8348698b2bb 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t008/cm01t008.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t008/cm01t008.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include 
        -#include "jni_tools.h"
        -#include "agent_common.h"
        -#include "jvmti_tools.h"
        +#include "jni_tools.hpp"
        +#include "agent_common.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t009/cm01t009.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t009/cm01t009.cpp
        index 307d1045bf6..eb843879ceb 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t009/cm01t009.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t009/cm01t009.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include 
        -#include "jni_tools.h"
        -#include "agent_common.h"
        -#include "jvmti_tools.h"
        +#include "jni_tools.hpp"
        +#include "agent_common.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t010/cm01t010.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t010/cm01t010.cpp
        index 143cc6127e9..507012417c5 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t010/cm01t010.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t010/cm01t010.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include 
        -#include "jni_tools.h"
        -#include "agent_common.h"
        -#include "jvmti_tools.h"
        +#include "jni_tools.hpp"
        +#include "agent_common.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t011/cm01t011.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t011/cm01t011.cpp
        index 075c7e1bb27..d3843d9fbfa 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t011/cm01t011.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t011/cm01t011.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include 
        -#include "jni_tools.h"
        -#include "agent_common.h"
        -#include "jvmti_tools.h"
        +#include "jni_tools.hpp"
        +#include "agent_common.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t012/cm01t012.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t012/cm01t012.cpp
        index b8a18cf6179..c72f4ecacd3 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t012/cm01t012.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t012/cm01t012.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include 
        -#include "jni_tools.h"
        -#include "agent_common.h"
        -#include "jvmti_tools.h"
        +#include "jni_tools.hpp"
        +#include "agent_common.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t013/cm01t013.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t013/cm01t013.cpp
        index aebd93910f6..7edbd56f444 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t013/cm01t013.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t013/cm01t013.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include 
        -#include "jni_tools.h"
        -#include "agent_common.h"
        -#include "jvmti_tools.h"
        +#include "jni_tools.hpp"
        +#include "agent_common.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t014/cm01t014.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t014/cm01t014.cpp
        index 7875901b8aa..5abbc391dbb 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t014/cm01t014.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t014/cm01t014.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include 
        -#include "jni_tools.h"
        -#include "agent_common.h"
        -#include "jvmti_tools.h"
        +#include "jni_tools.hpp"
        +#include "agent_common.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t015/cm01t015.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t015/cm01t015.cpp
        index aab9c8f47a1..a1c2d712892 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t015/cm01t015.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t015/cm01t015.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include 
        -#include "jni_tools.h"
        -#include "agent_common.h"
        -#include "jvmti_tools.h"
        +#include "jni_tools.hpp"
        +#include "agent_common.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t016/cm01t016.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t016/cm01t016.cpp
        index 59d23a8e373..40728346f18 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t016/cm01t016.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t016/cm01t016.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include 
        -#include "jni_tools.h"
        -#include "agent_common.h"
        -#include "jvmti_tools.h"
        +#include "jni_tools.hpp"
        +#include "agent_common.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t017/cm01t017.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t017/cm01t017.cpp
        index dc7ad64d8d5..f43dae8772f 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t017/cm01t017.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t017/cm01t017.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include 
        -#include "jni_tools.h"
        -#include "agent_common.h"
        -#include "jvmti_tools.h"
        +#include "jni_tools.hpp"
        +#include "agent_common.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t018/cm01t018.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t018/cm01t018.cpp
        index bd22d800877..380a5516243 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t018/cm01t018.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t018/cm01t018.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include 
        -#include "jni_tools.h"
        -#include "agent_common.h"
        -#include "jvmti_tools.h"
        +#include "jni_tools.hpp"
        +#include "agent_common.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t019/cm01t019.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t019/cm01t019.cpp
        index 89475b798f5..5e55adfa63d 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t019/cm01t019.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t019/cm01t019.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include 
        -#include "jni_tools.h"
        -#include "agent_common.h"
        -#include "jvmti_tools.h"
        +#include "jni_tools.hpp"
        +#include "agent_common.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t020/cm01t020.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t020/cm01t020.cpp
        index ccb3a84ea32..0eea0f25f8f 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t020/cm01t020.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t020/cm01t020.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include 
        -#include "jni_tools.h"
        -#include "agent_common.h"
        -#include "jvmti_tools.h"
        +#include "jni_tools.hpp"
        +#include "agent_common.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t021/cm01t021.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t021/cm01t021.cpp
        index 3f6bf3fd92b..72148eafcc0 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t021/cm01t021.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t021/cm01t021.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include 
        -#include "jni_tools.h"
        -#include "agent_common.h"
        -#include "jvmti_tools.h"
        +#include "jni_tools.hpp"
        +#include "agent_common.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM02/cm02t001/cm02t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM02/cm02t001/cm02t001.cpp
        index 94e16b7e98d..f9f5516fd96 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM02/cm02t001/cm02t001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM02/cm02t001/cm02t001.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include 
        -#include "jni_tools.h"
        -#include "agent_common.h"
        -#include "jvmti_tools.h"
        +#include "jni_tools.hpp"
        +#include "agent_common.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM03/cm03t001/cm03t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM03/cm03t001/cm03t001.cpp
        index 2c70abc9cb4..67cd9ddd976 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM03/cm03t001/cm03t001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM03/cm03t001/cm03t001.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include 
        -#include "jni_tools.h"
        -#include "agent_common.h"
        -#include "jvmti_tools.h"
        +#include "jni_tools.hpp"
        +#include "agent_common.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/contention/TC01/tc01t001/tc01t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/contention/TC01/tc01t001/tc01t001.cpp
        index c744347213e..a720b90c1f2 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/contention/TC01/tc01t001/tc01t001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/contention/TC01/tc01t001/tc01t001.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include 
        -#include "jni_tools.h"
        -#include "agent_common.h"
        -#include "jvmti_tools.h"
        +#include "jni_tools.hpp"
        +#include "agent_common.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/contention/TC02/tc02t001/tc02t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/contention/TC02/tc02t001/tc02t001.cpp
        index e3e4a244ba8..39779183c04 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/contention/TC02/tc02t001/tc02t001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/contention/TC02/tc02t001/tc02t001.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include 
        -#include "jni_tools.h"
        -#include "agent_common.h"
        -#include "jvmti_tools.h"
        +#include "jni_tools.hpp"
        +#include "agent_common.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/contention/TC03/tc03t001/tc03t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/contention/TC03/tc03t001/tc03t001.cpp
        index 73d8ef539a6..ff7d346d237 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/contention/TC03/tc03t001/tc03t001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/contention/TC03/tc03t001/tc03t001.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include 
        -#include "jni_tools.h"
        -#include "agent_common.h"
        -#include "jvmti_tools.h"
        +#include "jni_tools.hpp"
        +#include "agent_common.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/contention/TC03/tc03t002/tc03t002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/contention/TC03/tc03t002/tc03t002.cpp
        index 9740919cdcd..11c74e3a9e2 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/contention/TC03/tc03t002/tc03t002.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/contention/TC03/tc03t002/tc03t002.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include 
        -#include "jni_tools.h"
        -#include "agent_common.h"
        -#include "jvmti_tools.h"
        +#include "jni_tools.hpp"
        +#include "agent_common.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/contention/TC04/tc04t001/tc04t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/contention/TC04/tc04t001/tc04t001.cpp
        index f850b0d89f4..80117ea70fd 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/contention/TC04/tc04t001/tc04t001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/contention/TC04/tc04t001/tc04t001.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include 
        -#include "jni_tools.h"
        -#include "agent_common.h"
        -#include "jvmti_tools.h"
        +#include "jni_tools.hpp"
        +#include "agent_common.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/contention/TC05/tc05t001/tc05t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/contention/TC05/tc05t001/tc05t001.cpp
        index 3c3c0e37703..9680d01847a 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/contention/TC05/tc05t001/tc05t001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/contention/TC05/tc05t001/tc05t001.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include 
        -#include "jni_tools.h"
        -#include "agent_common.h"
        -#include "jvmti_tools.h"
        +#include "jni_tools.hpp"
        +#include "agent_common.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM01/em01t001/em01t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM01/em01t001/em01t001.cpp
        index 55a97693008..cfc70e44e96 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM01/em01t001/em01t001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM01/em01t001/em01t001.cpp
        @@ -23,11 +23,11 @@
         
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        +#include "agent_common.hpp"
         #include "ExceptionCheckingJniEnv.hpp"
        -#include "jni_tools.h"
        -#include "jvmti_tools.h"
        -#include "JVMTITools.h"
        +#include "jni_tools.hpp"
        +#include "jvmti_tools.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM01/em01t002/em01t002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM01/em01t002/em01t002.cpp
        index 7a3700c0863..7a65d9f0453 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM01/em01t002/em01t002.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM01/em01t002/em01t002.cpp
        @@ -23,11 +23,11 @@
         
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        +#include "agent_common.hpp"
         #include "ExceptionCheckingJniEnv.hpp"
        -#include "jni_tools.h"
        -#include "jvmti_tools.h"
        -#include "JVMTITools.h"
        +#include "jni_tools.hpp"
        +#include "jvmti_tools.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t001/em02t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t001/em02t001.cpp
        index 5bc4a5c7b2f..06bdd4c66b0 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t001/em02t001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t001/em02t001.cpp
        @@ -23,11 +23,11 @@
         
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        +#include "agent_common.hpp"
         #include "ExceptionCheckingJniEnv.hpp"
        -#include "jni_tools.h"
        -#include "jvmti_tools.h"
        -#include "JVMTITools.h"
        +#include "jni_tools.hpp"
        +#include "jvmti_tools.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t002/em02t002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t002/em02t002.cpp
        index 1c6f88ea41a..947d6b9b178 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t002/em02t002.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t002/em02t002.cpp
        @@ -23,10 +23,10 @@
         
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "jni_tools.h"
        -#include "jvmti_tools.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "jni_tools.hpp"
        +#include "jvmti_tools.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t003/em02t003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t003/em02t003.cpp
        index a1c1aa85a10..88fb29e9c17 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t003/em02t003.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t003/em02t003.cpp
        @@ -23,10 +23,10 @@
         
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "jni_tools.h"
        -#include "jvmti_tools.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "jni_tools.hpp"
        +#include "jvmti_tools.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t004/em02t004.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t004/em02t004.cpp
        index b00713b7fe8..d852ec2df2c 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t004/em02t004.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t004/em02t004.cpp
        @@ -23,10 +23,10 @@
         
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "jni_tools.h"
        -#include "jvmti_tools.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "jni_tools.hpp"
        +#include "jvmti_tools.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t005/em02t005.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t005/em02t005.cpp
        index a1b74a56a76..1a502487fba 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t005/em02t005.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t005/em02t005.cpp
        @@ -23,10 +23,10 @@
         
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "jni_tools.h"
        -#include "jvmti_tools.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "jni_tools.hpp"
        +#include "jvmti_tools.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t006/em02t006.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t006/em02t006.cpp
        index c4b65118b1a..1c6ccd98520 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t006/em02t006.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t006/em02t006.cpp
        @@ -23,10 +23,10 @@
         
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "jni_tools.h"
        -#include "jvmti_tools.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "jni_tools.hpp"
        +#include "jvmti_tools.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t007/em02t007.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t007/em02t007.cpp
        index b344a6f438e..a288a75a5ed 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t007/em02t007.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t007/em02t007.cpp
        @@ -23,10 +23,10 @@
         
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "jni_tools.h"
        -#include "jvmti_tools.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "jni_tools.hpp"
        +#include "jvmti_tools.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t008/em02t008.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t008/em02t008.cpp
        index 89434116744..4d4b73b12a6 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t008/em02t008.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t008/em02t008.cpp
        @@ -23,10 +23,10 @@
         
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "jni_tools.h"
        -#include "jvmti_tools.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "jni_tools.hpp"
        +#include "jvmti_tools.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t009/em02t009.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t009/em02t009.cpp
        index f50cb3388da..1e52bd762c5 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t009/em02t009.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t009/em02t009.cpp
        @@ -23,10 +23,10 @@
         
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "jni_tools.h"
        -#include "jvmti_tools.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "jni_tools.hpp"
        +#include "jvmti_tools.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t010/em02t010.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t010/em02t010.cpp
        index a3257281f0d..a1cb6acec4f 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t010/em02t010.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t010/em02t010.cpp
        @@ -23,11 +23,11 @@
         
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        +#include "agent_common.hpp"
         #include "ExceptionCheckingJniEnv.hpp"
        -#include "jni_tools.h"
        -#include "jvmti_tools.h"
        -#include "JVMTITools.h"
        +#include "jni_tools.hpp"
        +#include "jvmti_tools.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t011/em02t011.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t011/em02t011.cpp
        index 1e0f043d087..24873548a07 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t011/em02t011.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t011/em02t011.cpp
        @@ -23,11 +23,11 @@
         
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        +#include "agent_common.hpp"
         #include "ExceptionCheckingJniEnv.hpp"
        -#include "jni_tools.h"
        -#include "jvmti_tools.h"
        -#include "JVMTITools.h"
        +#include "jni_tools.hpp"
        +#include "jvmti_tools.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t012/em02t012.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t012/em02t012.cpp
        index eb83f542853..402ffd638ef 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t012/em02t012.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t012/em02t012.cpp
        @@ -23,11 +23,11 @@
         
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        +#include "agent_common.hpp"
         #include "ExceptionCheckingJniEnv.hpp"
        -#include "jni_tools.h"
        -#include "jvmti_tools.h"
        -#include "JVMTITools.h"
        +#include "jni_tools.hpp"
        +#include "jvmti_tools.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM04/em04t001/em04t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM04/em04t001/em04t001.cpp
        index c60b7b68ccb..a7244db3441 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM04/em04t001/em04t001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM04/em04t001/em04t001.cpp
        @@ -24,10 +24,10 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "jni_tools.h"
        -#include "jvmti_tools.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "jni_tools.hpp"
        +#include "jvmti_tools.hpp"
        +#include "JVMTITools.hpp"
         #include "nsk_list.hpp"
         
         extern "C" {
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM05/em05t001/em05t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM05/em05t001/em05t001.cpp
        index 8cd0f4c957f..191bdcde960 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM05/em05t001/em05t001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM05/em05t001/em05t001.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "jni_tools.h"
        -#include "jvmti_tools.h"
        +#include "agent_common.hpp"
        +#include "jni_tools.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM05/em05t002/em05t002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM05/em05t002/em05t002.cpp
        index 01eaf82f214..aa4563349c0 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM05/em05t002/em05t002.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM05/em05t002/em05t002.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "jni_tools.h"
        -#include "jvmti_tools.h"
        +#include "agent_common.hpp"
        +#include "jni_tools.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM06/em06t001/em06t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM06/em06t001/em06t001.cpp
        index ccd0b42a8a6..c1616e864ed 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM06/em06t001/em06t001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM06/em06t001/em06t001.cpp
        @@ -23,10 +23,10 @@
         
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "jni_tools.h"
        -#include "jvmti_tools.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "jni_tools.hpp"
        +#include "jvmti_tools.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM07/em07t001/em07t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM07/em07t001/em07t001.cpp
        index b3236df4208..d2f3a2fde3c 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM07/em07t001/em07t001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM07/em07t001/em07t001.cpp
        @@ -23,10 +23,10 @@
         
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "jni_tools.h"
        -#include "jvmti_tools.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "jni_tools.hpp"
        +#include "jvmti_tools.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM07/em07t002/em07t002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM07/em07t002/em07t002.cpp
        index c9579abc4b8..86d5f5de9f7 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM07/em07t002/em07t002.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM07/em07t002/em07t002.cpp
        @@ -24,10 +24,10 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "jni_tools.h"
        -#include "jvmti_tools.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "jni_tools.hpp"
        +#include "jvmti_tools.hpp"
        +#include "JVMTITools.hpp"
         #include "nsk_list.hpp"
         
         extern "C" {
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/extension/EX03/ex03t001/ex03t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/extension/EX03/ex03t001/ex03t001.cpp
        index a2855dc742a..e9325b6342c 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/extension/EX03/ex03t001/ex03t001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/extension/EX03/ex03t001/ex03t001.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "jni_tools.h"
        -#include "jvmti_tools.h"
        +#include "agent_common.hpp"
        +#include "jni_tools.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/general_functions/GF01/gf01t001/gf01t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/general_functions/GF01/gf01t001/gf01t001.cpp
        index 252cd19b7ac..f8549ba4c87 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/general_functions/GF01/gf01t001/gf01t001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/general_functions/GF01/gf01t001/gf01t001.cpp
        @@ -27,11 +27,11 @@
         #include 
         
         #include 
        -#include "agent_common.h"
        +#include "agent_common.hpp"
         
        -#include "nsk_tools.h"
        -#include "JVMTITools.h"
        -#include "jvmti_tools.h"
        +#include "nsk_tools.hpp"
        +#include "JVMTITools.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/general_functions/GF04/gf04t001/gf04t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/general_functions/GF04/gf04t001/gf04t001.cpp
        index bdd20e8951b..2a0116d3e55 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/general_functions/GF04/gf04t001/gf04t001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/general_functions/GF04/gf04t001/gf04t001.cpp
        @@ -24,9 +24,9 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "jni_tools.h"
        -#include "jvmti_tools.h"
        +#include "agent_common.hpp"
        +#include "jni_tools.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/general_functions/GF06/gf06t001/gf06t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/general_functions/GF06/gf06t001/gf06t001.cpp
        index 876b3a8464c..55c5fb89816 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/general_functions/GF06/gf06t001/gf06t001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/general_functions/GF06/gf06t001/gf06t001.cpp
        @@ -24,9 +24,9 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "jni_tools.h"
        -#include "jvmti_tools.h"
        +#include "agent_common.hpp"
        +#include "jni_tools.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/general_functions/GF08/gf08t001/gf08t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/general_functions/GF08/gf08t001/gf08t001.cpp
        index 7dd894afb8d..3d84b69adca 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/general_functions/GF08/gf08t001/gf08t001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/general_functions/GF08/gf08t001/gf08t001.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include 
        -#include "jni_tools.h"
        -#include "agent_common.h"
        -#include "jvmti_tools.h"
        +#include "jni_tools.hpp"
        +#include "agent_common.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/general_functions/GF08/gf08t002/gf08t002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/general_functions/GF08/gf08t002/gf08t002.cpp
        index ae930eb0805..db242bd7122 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/general_functions/GF08/gf08t002/gf08t002.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/general_functions/GF08/gf08t002/gf08t002.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include 
        -#include "jni_tools.h"
        -#include "agent_common.h"
        -#include "jvmti_tools.h"
        +#include "jni_tools.hpp"
        +#include "agent_common.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/general_functions/GF08/gf08t003/gf08t003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/general_functions/GF08/gf08t003/gf08t003.cpp
        index 5c792635968..54b73e891b0 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/general_functions/GF08/gf08t003/gf08t003.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/general_functions/GF08/gf08t003/gf08t003.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include 
        -#include "jni_tools.h"
        -#include "agent_common.h"
        -#include "jvmti_tools.h"
        +#include "jni_tools.hpp"
        +#include "agent_common.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS103/hs103t002/hs103t002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS103/hs103t002/hs103t002.cpp
        index a903074cd01..4a5de9ea92e 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS103/hs103t002/hs103t002.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS103/hs103t002/hs103t002.cpp
        @@ -27,11 +27,11 @@
         */
         #include 
         #include 
        -#include "agent_common.h"
        +#include "agent_common.hpp"
         #include 
        -#include "jni_tools.h"
        -#include "jvmti_tools.h"
        -#include "JVMTITools.h"
        +#include "jni_tools.hpp"
        +#include "jvmti_tools.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS104/hs104t001/hs104t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS104/hs104t001/hs104t001.cpp
        index 0044aec284e..1dc0396299a 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS104/hs104t001/hs104t001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS104/hs104t001/hs104t001.cpp
        @@ -22,10 +22,10 @@
          */
         #include 
         #include 
        -#include "agent_common.h"
        +#include "agent_common.hpp"
         #include 
        -#include "jvmti_tools.h"
        -#include "JVMTITools.h"
        +#include "jvmti_tools.hpp"
        +#include "JVMTITools.hpp"
         
         
         extern "C" {
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS104/hs104t002/hs104t002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS104/hs104t002/hs104t002.cpp
        index 670b48bfeab..f83a51fa33f 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS104/hs104t002/hs104t002.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS104/hs104t002/hs104t002.cpp
        @@ -22,11 +22,11 @@
          */
         #include 
         #include 
        -#include "agent_common.h"
        +#include "agent_common.hpp"
         #include 
        -#include "jvmti_tools.h"
        -#include "JVMTITools.h"
        -#include "jni_tools.h"
        +#include "jvmti_tools.hpp"
        +#include "JVMTITools.hpp"
        +#include "jni_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS201/hs201t001/hs201t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS201/hs201t001/hs201t001.cpp
        index 200df590244..ee511063826 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS201/hs201t001/hs201t001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS201/hs201t001/hs201t001.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "jni_tools.h"
        -#include "jvmti_tools.h"
        +#include "agent_common.hpp"
        +#include "jni_tools.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS201/hs201t002/hs201t002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS201/hs201t002/hs201t002.cpp
        index 8c369dd1d55..62033fde30b 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS201/hs201t002/hs201t002.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS201/hs201t002/hs201t002.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "jni_tools.h"
        -#include "jvmti_tools.h"
        +#include "agent_common.hpp"
        +#include "jni_tools.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS201/hs201t003/hs201t003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS201/hs201t003/hs201t003.cpp
        index 626bd8ac5a0..6c6caa033c3 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS201/hs201t003/hs201t003.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS201/hs201t003/hs201t003.cpp
        @@ -25,12 +25,12 @@
         #include 
         
         #include 
        -#include "agent_common.h"
        +#include "agent_common.hpp"
         
        -#include "nsk_tools.h"
        +#include "nsk_tools.hpp"
         #include "native_thread.hpp"
        -#include "JVMTITools.h"
        -#include "jvmti_tools.h"
        +#include "JVMTITools.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS202/hs202t001/hs202t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS202/hs202t001/hs202t001.cpp
        index e7936fda8c5..e3f15e233fb 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS202/hs202t001/hs202t001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS202/hs202t001/hs202t001.cpp
        @@ -22,10 +22,10 @@
          */
         #include 
         #include 
        -#include "agent_common.h"
        +#include "agent_common.hpp"
         #include 
        -#include "jvmti_tools.h"
        -#include "JVMTITools.h"
        +#include "jvmti_tools.hpp"
        +#include "JVMTITools.hpp"
         /*
             hs202t001:
                 1. Set breakpoints in several methods when Object.wait(),
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS202/hs202t002/hs202t002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS202/hs202t002/hs202t002.cpp
        index 493e23da000..f081ff0f030 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS202/hs202t002/hs202t002.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS202/hs202t002/hs202t002.cpp
        @@ -22,11 +22,11 @@
          */
         #include 
         #include 
        -#include "agent_common.h"
        +#include "agent_common.hpp"
         #include 
         #include 
        -#include "jvmti_tools.h"
        -#include "JVMTITools.h"
        +#include "jvmti_tools.hpp"
        +#include "JVMTITools.hpp"
         
         /*
         hs202t002:
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS203/hs203t001/hs203t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS203/hs203t001/hs203t001.cpp
        index 4104656aa25..467d6cf01cb 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS203/hs203t001/hs203t001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS203/hs203t001/hs203t001.cpp
        @@ -23,10 +23,10 @@
         #include 
         #include 
         #include 
        -#include "agent_common.h"
        +#include "agent_common.hpp"
         #include 
        -#include "jvmti_tools.h"
        -#include "JVMTITools.h"
        +#include "jvmti_tools.hpp"
        +#include "JVMTITools.hpp"
         /*
             README
                 ******
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS203/hs203t002/hs203t002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS203/hs203t002/hs203t002.cpp
        index 3328e730f08..d263186114e 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS203/hs203t002/hs203t002.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS203/hs203t002/hs203t002.cpp
        @@ -22,11 +22,11 @@
          */
         #include 
         #include 
        -#include "agent_common.h"
        +#include "agent_common.hpp"
         #include 
         #include 
        -#include "jvmti_tools.h"
        -#include "JVMTITools.h"
        +#include "jvmti_tools.hpp"
        +#include "JVMTITools.hpp"
         
         /*
            T002:
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS203/hs203t003/hs203t003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS203/hs203t003/hs203t003.cpp
        index 3f067dd4e9a..7c59a16a535 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS203/hs203t003/hs203t003.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS203/hs203t003/hs203t003.cpp
        @@ -23,12 +23,12 @@
         #include 
         #include 
         #include 
        -#include "agent_common.h"
        +#include "agent_common.hpp"
         #include 
         #include 
        -#include "jvmti_tools.h"
        -#include "jni_tools.h"
        -#include "JVMTITools.h"
        +#include "jvmti_tools.hpp"
        +#include "jni_tools.hpp"
        +#include "JVMTITools.hpp"
         /*
            hs203T003:
            1. Set FieldAccessWatch, FieldModificatoinWatch for a field.
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS203/hs203t004/hs203t004.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS203/hs203t004/hs203t004.cpp
        index 7a0e59b7206..a2023f7f546 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS203/hs203t004/hs203t004.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS203/hs203t004/hs203t004.cpp
        @@ -23,12 +23,12 @@
         #include 
         #include 
         #include 
        -#include "agent_common.h"
        +#include "agent_common.hpp"
         #include 
         #include 
        -#include "jvmti_tools.h"
        -#include "JVMTITools.h"
        -#include "jni_tools.h"
        +#include "jvmti_tools.hpp"
        +#include "JVMTITools.hpp"
        +#include "jni_tools.hpp"
         
         extern "C" {
         #define FILE_NAME "nsk/jvmti/scenarios/hotswap/HS203/hs203t004/MyThread"
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS204/hs204t002/hs204t002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS204/hs204t002/hs204t002.cpp
        index bc080f2d882..3b8be254638 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS204/hs204t002/hs204t002.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS204/hs204t002/hs204t002.cpp
        @@ -22,11 +22,11 @@
          */
         #include 
         #include 
        -#include "agent_common.h"
        +#include "agent_common.hpp"
         #include 
         #include 
        -#include "jvmti_tools.h"
        -#include "JVMTITools.h"
        +#include "jvmti_tools.hpp"
        +#include "JVMTITools.hpp"
         /*
          *1. Enable event ClassPrepare.
          *2. Upon occurrence of ClassPrepare, set a breakpoint in class static
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS204/hs204t003/hs204t003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS204/hs204t003/hs204t003.cpp
        index 3b182cb616d..46f5f784bdd 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS204/hs204t003/hs204t003.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS204/hs204t003/hs204t003.cpp
        @@ -24,11 +24,11 @@
         #include 
         #include 
         #include 
        -#include "agent_common.h"
        +#include "agent_common.hpp"
         #include 
        -#include "jvmti_tools.h"
        -#include "jni_tools.h"
        -#include "JVMTITools.h"
        +#include "jvmti_tools.hpp"
        +#include "jni_tools.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS204/hs204t004/hs204t004.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS204/hs204t004/hs204t004.cpp
        index e8141386cb0..1db6093dde7 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS204/hs204t004/hs204t004.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS204/hs204t004/hs204t004.cpp
        @@ -22,11 +22,11 @@
          */
         #include 
         #include 
        -#include "agent_common.h"
        +#include "agent_common.hpp"
         #include 
         #include 
        -#include "jvmti_tools.h"
        -#include "JVMTITools.h"
        +#include "jvmti_tools.hpp"
        +#include "JVMTITools.hpp"
         
         /*
         1. Enable event ClassPrepare.
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS301/hs301t001/hs301t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS301/hs301t001/hs301t001.cpp
        index d94ce73a3cf..3a93a57f224 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS301/hs301t001/hs301t001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS301/hs301t001/hs301t001.cpp
        @@ -23,10 +23,10 @@
         
         #include 
         #include 
        -#include "agent_common.h"
        +#include "agent_common.hpp"
         #include 
        -#include "jvmti_tools.h"
        -#include "jni_tools.h"
        +#include "jvmti_tools.hpp"
        +#include "jni_tools.hpp"
         extern "C" {
         
         #define FILE_NAME "nsk/jvmti/scenarios/hotswap/HS301/hs301t001/MyClass"
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS301/hs301t002/hs301t002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS301/hs301t002/hs301t002.cpp
        index 6f84921286a..135993fa0cf 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS301/hs301t002/hs301t002.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS301/hs301t002/hs301t002.cpp
        @@ -26,10 +26,10 @@
          */
         #include 
         #include 
        -#include "agent_common.h"
        +#include "agent_common.hpp"
         #include 
        -#include "jvmti_tools.h"
        -#include "jni_tools.h"
        +#include "jvmti_tools.hpp"
        +#include "jni_tools.hpp"
         
         extern "C" {
         #define FILE_NAME "nsk/jvmti/scenarios/hotswap/HS301/hs301t002/MyClass"
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS301/hs301t003/hs301t003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS301/hs301t003/hs301t003.cpp
        index 076c885b622..785b53157d7 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS301/hs301t003/hs301t003.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS301/hs301t003/hs301t003.cpp
        @@ -22,9 +22,9 @@
          */
         #include 
         #include 
        -#include "agent_common.h"
        +#include "agent_common.hpp"
         #include 
        -#include "jvmti_tools.h"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         #define FILE_NAME "nsk/jvmti/scenarios/hotswap/HS301/hs301t003/MyClass"
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS301/hs301t004/hs301t004.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS301/hs301t004/hs301t004.cpp
        index 7c8c6af414c..59c27c244b0 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS301/hs301t004/hs301t004.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS301/hs301t004/hs301t004.cpp
        @@ -22,9 +22,9 @@
          */
         #include 
         #include 
        -#include "agent_common.h"
        +#include "agent_common.hpp"
         #include 
        -#include "jvmti_tools.h"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         #define FILE_NAME "nsk/jvmti/scenarios/hotswap/HS301/hs301t004/MyClass"
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS301/hs301t005/hs301t005.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS301/hs301t005/hs301t005.cpp
        index 7a04fa7c333..ff3bbce6a15 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS301/hs301t005/hs301t005.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS301/hs301t005/hs301t005.cpp
        @@ -22,9 +22,9 @@
          */
         #include 
         #include 
        -#include "agent_common.h"
        +#include "agent_common.hpp"
         #include 
        -#include "jvmti_tools.h"
        +#include "jvmti_tools.hpp"
         
         
         extern "C" {
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t001/hs302t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t001/hs302t001.cpp
        index 883c197533b..67a37e4b27f 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t001/hs302t001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t001/hs302t001.cpp
        @@ -22,9 +22,9 @@
          */
         #include 
         #include 
        -#include "agent_common.h"
        +#include "agent_common.hpp"
         #include 
        -#include "jvmti_tools.h"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t002/hs302t002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t002/hs302t002.cpp
        index 9cd0e4006cc..173f97cd410 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t002/hs302t002.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t002/hs302t002.cpp
        @@ -22,9 +22,9 @@
          */
         #include 
         #include 
        -#include "agent_common.h"
        +#include "agent_common.hpp"
         #include 
        -#include "jvmti_tools.h"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t003/hs302t003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t003/hs302t003.cpp
        index 217a27bb5b5..3f9f8cc5c8f 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t003/hs302t003.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t003/hs302t003.cpp
        @@ -22,9 +22,9 @@
          */
         #include 
         #include 
        -#include "agent_common.h"
        +#include "agent_common.hpp"
         #include 
        -#include "jvmti_tools.h"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t004/hs302t004.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t004/hs302t004.cpp
        index 5cf83fbd4a7..e9ab190b9f9 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t004/hs302t004.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t004/hs302t004.cpp
        @@ -22,9 +22,9 @@
          */
         #include 
         #include 
        -#include "agent_common.h"
        +#include "agent_common.hpp"
         #include 
        -#include "jvmti_tools.h"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         #define FILE_NAME "nsk/jvmti/scenarios/hotswap/HS302/hs302t004r/MyClass"
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t005/hs302t005.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t005/hs302t005.cpp
        index c6b9a3d0833..2e794561cb7 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t005/hs302t005.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t005/hs302t005.cpp
        @@ -22,9 +22,9 @@
          */
         #include 
         #include 
        -#include "agent_common.h"
        +#include "agent_common.hpp"
         #include 
        -#include "jvmti_tools.h"
        +#include "jvmti_tools.hpp"
         
         
         extern "C" {
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t006/hs302t006.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t006/hs302t006.cpp
        index ef5d37e6659..885c2bf2910 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t006/hs302t006.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t006/hs302t006.cpp
        @@ -22,9 +22,9 @@
          */
         #include 
         #include 
        -#include "agent_common.h"
        +#include "agent_common.hpp"
         #include 
        -#include "jvmti_tools.h"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t007/hs302t007.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t007/hs302t007.cpp
        index 81d83405929..036bedcf9ee 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t007/hs302t007.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t007/hs302t007.cpp
        @@ -22,9 +22,9 @@
          */
         #include 
         #include 
        -#include "agent_common.h"
        +#include "agent_common.hpp"
         #include 
        -#include "jvmti_tools.h"
        +#include "jvmti_tools.hpp"
         extern "C" {
         #define FILE_NAME "nsk/jvmti/scenarios/hotswap/HS302/hs302t007r/MyClass"
         #define CLASS_NAME "Lnsk/jvmti/scenarios/hotswap/HS302/hs302t007r/MyClass;"
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t008/hs302t008.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t008/hs302t008.cpp
        index 54506880d09..d30b767cddc 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t008/hs302t008.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t008/hs302t008.cpp
        @@ -22,9 +22,9 @@
          */
         #include 
         #include 
        -#include "agent_common.h"
        +#include "agent_common.hpp"
         #include 
        -#include "jvmti_tools.h"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t009/hs302t009.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t009/hs302t009.cpp
        index 95fce3ff410..18c51111f42 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t009/hs302t009.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t009/hs302t009.cpp
        @@ -22,9 +22,9 @@
          */
         #include 
         #include 
        -#include "agent_common.h"
        +#include "agent_common.hpp"
         #include 
        -#include "jvmti_tools.h"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         #define FILE_NAME "nsk/jvmti/scenarios/hotswap/HS302/hs302t009r/MyClass"
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t010/hs302t010.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t010/hs302t010.cpp
        index 0d8525c8f6e..cab1f02215e 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t010/hs302t010.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t010/hs302t010.cpp
        @@ -22,9 +22,9 @@
          */
         #include 
         #include 
        -#include "agent_common.h"
        +#include "agent_common.hpp"
         #include 
        -#include "jvmti_tools.h"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t011/hs302t011.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t011/hs302t011.cpp
        index b48aae2a391..bd3756b1493 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t011/hs302t011.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t011/hs302t011.cpp
        @@ -22,9 +22,9 @@
          */
         #include 
         #include 
        -#include "agent_common.h"
        +#include "agent_common.hpp"
         #include 
        -#include "jvmti_tools.h"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t012/hs302t012.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t012/hs302t012.cpp
        index 2bcc8da5020..b384834f022 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t012/hs302t012.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t012/hs302t012.cpp
        @@ -22,9 +22,9 @@
          */
         #include 
         #include 
        -#include "agent_common.h"
        +#include "agent_common.hpp"
         #include 
        -#include "jvmti_tools.h"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI01/ji01t001/ji01t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI01/ji01t001/ji01t001.cpp
        index 2c9f095737c..018b1c7d753 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI01/ji01t001/ji01t001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI01/ji01t001/ji01t001.cpp
        @@ -27,11 +27,11 @@
         #include 
         
         #include 
        -#include "agent_common.h"
        +#include "agent_common.hpp"
         
        -#include "JVMTITools.h"
        -#include "jvmti_tools.h"
        -#include "nsk_tools.h"
        +#include "JVMTITools.hpp"
        +#include "jvmti_tools.hpp"
        +#include "nsk_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI03/ji03t001/ji03t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI03/ji03t001/ji03t001.cpp
        index f55c48c218f..927aa19974b 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI03/ji03t001/ji03t001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI03/ji03t001/ji03t001.cpp
        @@ -26,9 +26,9 @@
         #include 
         
         #include 
        -#include "agent_common.h"
        +#include "agent_common.hpp"
         
        -#include "JVMTITools.h"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI03/ji03t002/ji03t002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI03/ji03t002/ji03t002.cpp
        index e7350dac3af..297a94aca8e 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI03/ji03t002/ji03t002.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI03/ji03t002/ji03t002.cpp
        @@ -27,9 +27,9 @@
         #include 
         
         #include 
        -#include "agent_common.h"
        +#include "agent_common.hpp"
         
        -#include "JVMTITools.h"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI03/ji03t003/ji03t003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI03/ji03t003/ji03t003.cpp
        index 9b6f70525ea..bab6880c5c0 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI03/ji03t003/ji03t003.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI03/ji03t003/ji03t003.cpp
        @@ -27,9 +27,9 @@
         #include 
         
         #include 
        -#include "agent_common.h"
        +#include "agent_common.hpp"
         
        -#include "JVMTITools.h"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI03/ji03t004/ji03t004.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI03/ji03t004/ji03t004.cpp
        index d25d2c9fcc1..94cf69dab51 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI03/ji03t004/ji03t004.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI03/ji03t004/ji03t004.cpp
        @@ -27,9 +27,9 @@
         #include 
         
         #include 
        -#include "agent_common.h"
        +#include "agent_common.hpp"
         
        -#include "JVMTITools.h"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI05/ji05t001/ji05t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI05/ji05t001/ji05t001.cpp
        index c4a8adda165..550a29158bf 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI05/ji05t001/ji05t001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI05/ji05t001/ji05t001.cpp
        @@ -27,11 +27,11 @@
         #include 
         
         #include 
        -#include "agent_common.h"
        +#include "agent_common.hpp"
         
        -#include "nsk_tools.h"
        -#include "JVMTITools.h"
        -#include "jvmti_tools.h"
        +#include "nsk_tools.hpp"
        +#include "JVMTITools.hpp"
        +#include "jvmti_tools.hpp"
         #include "native_thread.hpp"
         
         extern "C" {
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI06/ji06t001/ji06t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI06/ji06t001/ji06t001.cpp
        index 51067986887..83a32bb2e4c 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI06/ji06t001/ji06t001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI06/ji06t001/ji06t001.cpp
        @@ -27,11 +27,11 @@
         #include 
         
         #include 
        -#include "agent_common.h"
        +#include "agent_common.hpp"
         
        -#include "nsk_tools.h"
        -#include "JVMTITools.h"
        -#include "jvmti_tools.h"
        +#include "nsk_tools.hpp"
        +#include "JVMTITools.hpp"
        +#include "jvmti_tools.hpp"
         #include "native_thread.hpp"
         
         extern "C" {
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA01/ma01t001/ma01t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA01/ma01t001/ma01t001.cpp
        index f0771daa56a..01fd4b40564 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA01/ma01t001/ma01t001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA01/ma01t001/ma01t001.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include 
        -#include "jni_tools.h"
        -#include "agent_common.h"
        -#include "jvmti_tools.h"
        +#include "jni_tools.hpp"
        +#include "agent_common.hpp"
        +#include "jvmti_tools.hpp"
         
         #define PASSED 0
         #define STATUS_FAILED 2
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA01/ma01t001/ma01t001a.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA01/ma01t001/ma01t001a.cpp
        index 959a26465e5..cc77d601568 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA01/ma01t001/ma01t001a.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA01/ma01t001/ma01t001a.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include 
        -#include "jni_tools.h"
        -#include "agent_common.h"
        -#include "jvmti_tools.h"
        +#include "jni_tools.hpp"
        +#include "agent_common.hpp"
        +#include "jvmti_tools.hpp"
         
         #define PASSED 0
         #define STATUS_FAILED 2
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA02/ma02t001/ma02t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA02/ma02t001/ma02t001.cpp
        index 0d7a1f5fe1a..b4c638460f5 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA02/ma02t001/ma02t001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA02/ma02t001/ma02t001.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include 
        -#include "jni_tools.h"
        -#include "agent_common.h"
        -#include "jvmti_tools.h"
        +#include "jni_tools.hpp"
        +#include "agent_common.hpp"
        +#include "jvmti_tools.hpp"
         
         #define PASSED 0
         #define STATUS_FAILED 2
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA02/ma02t001/ma02t001a.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA02/ma02t001/ma02t001a.cpp
        index 77e0ff05f50..fbe59eb4ba7 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA02/ma02t001/ma02t001a.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA02/ma02t001/ma02t001a.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include 
        -#include "jni_tools.h"
        -#include "agent_common.h"
        -#include "jvmti_tools.h"
        +#include "jni_tools.hpp"
        +#include "agent_common.hpp"
        +#include "jvmti_tools.hpp"
         
         #define PASSED 0
         #define STATUS_FAILED 2
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA03/ma03t001/ma03t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA03/ma03t001/ma03t001.cpp
        index 6b1d29f4991..a09722b7b40 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA03/ma03t001/ma03t001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA03/ma03t001/ma03t001.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include 
        -#include "jni_tools.h"
        -#include "agent_common.h"
        -#include "jvmti_tools.h"
        +#include "jni_tools.hpp"
        +#include "agent_common.hpp"
        +#include "jvmti_tools.hpp"
         
         #define PASSED 0
         #define STATUS_FAILED 2
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA03/ma03t001/ma03t001a.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA03/ma03t001/ma03t001a.cpp
        index 38fa0bb8e1f..d75b0da0f0c 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA03/ma03t001/ma03t001a.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA03/ma03t001/ma03t001a.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include 
        -#include "jni_tools.h"
        -#include "agent_common.h"
        -#include "jvmti_tools.h"
        +#include "jni_tools.hpp"
        +#include "agent_common.hpp"
        +#include "jvmti_tools.hpp"
         
         #define PASSED 0
         #define STATUS_FAILED 2
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA04/ma04t001/ma04t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA04/ma04t001/ma04t001.cpp
        index a3f28659bae..d9cedfaa4fd 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA04/ma04t001/ma04t001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA04/ma04t001/ma04t001.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include 
        -#include "jni_tools.h"
        -#include "agent_common.h"
        -#include "jvmti_tools.h"
        +#include "jni_tools.hpp"
        +#include "agent_common.hpp"
        +#include "jvmti_tools.hpp"
         
         #define PASSED 0
         #define STATUS_FAILED 2
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA04/ma04t001/ma04t001a.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA04/ma04t001/ma04t001a.cpp
        index 1f07af5da4e..9b60f2a1258 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA04/ma04t001/ma04t001a.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA04/ma04t001/ma04t001a.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include 
        -#include "jni_tools.h"
        -#include "agent_common.h"
        -#include "jvmti_tools.h"
        +#include "jni_tools.hpp"
        +#include "agent_common.hpp"
        +#include "jvmti_tools.hpp"
         
         #define PASSED 0
         #define STATUS_FAILED 2
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA04/ma04t002/ma04t002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA04/ma04t002/ma04t002.cpp
        index c4bff40748c..52459a7994f 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA04/ma04t002/ma04t002.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA04/ma04t002/ma04t002.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include 
        -#include "jni_tools.h"
        -#include "agent_common.h"
        -#include "jvmti_tools.h"
        +#include "jni_tools.hpp"
        +#include "agent_common.hpp"
        +#include "jvmti_tools.hpp"
         
         #define PASSED 0
         #define STATUS_FAILED 2
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA04/ma04t002/ma04t002a.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA04/ma04t002/ma04t002a.cpp
        index 0834d306a1c..7f716d009ce 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA04/ma04t002/ma04t002a.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA04/ma04t002/ma04t002a.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include 
        -#include "jni_tools.h"
        -#include "agent_common.h"
        -#include "jvmti_tools.h"
        +#include "jni_tools.hpp"
        +#include "agent_common.hpp"
        +#include "jvmti_tools.hpp"
         
         #define PASSED 0
         #define STATUS_FAILED 2
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA04/ma04t003/ma04t003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA04/ma04t003/ma04t003.cpp
        index d6eb01b18b8..cf4a492372d 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA04/ma04t003/ma04t003.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA04/ma04t003/ma04t003.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include 
        -#include "jni_tools.h"
        -#include "agent_common.h"
        -#include "jvmti_tools.h"
        +#include "jni_tools.hpp"
        +#include "agent_common.hpp"
        +#include "jvmti_tools.hpp"
         
         #define PASSED 0
         #define STATUS_FAILED 2
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA04/ma04t003/ma04t003a.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA04/ma04t003/ma04t003a.cpp
        index 5a42cd21e95..5345b56cba5 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA04/ma04t003/ma04t003a.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA04/ma04t003/ma04t003a.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include 
        -#include "jni_tools.h"
        -#include "agent_common.h"
        -#include "jvmti_tools.h"
        +#include "jni_tools.hpp"
        +#include "agent_common.hpp"
        +#include "jvmti_tools.hpp"
         
         #define PASSED 0
         #define STATUS_FAILED 2
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA05/ma05t001/ma05t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA05/ma05t001/ma05t001.cpp
        index c57c7cebb4d..45d968d4c7e 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA05/ma05t001/ma05t001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA05/ma05t001/ma05t001.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include 
        -#include "jni_tools.h"
        -#include "agent_common.h"
        -#include "jvmti_tools.h"
        +#include "jni_tools.hpp"
        +#include "agent_common.hpp"
        +#include "jvmti_tools.hpp"
         
         #define PASSED 0
         #define STATUS_FAILED 2
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA05/ma05t001/ma05t001a.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA05/ma05t001/ma05t001a.cpp
        index 19f6e52837e..1f4d927eff5 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA05/ma05t001/ma05t001a.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA05/ma05t001/ma05t001a.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include 
        -#include "jni_tools.h"
        -#include "agent_common.h"
        -#include "jvmti_tools.h"
        +#include "jni_tools.hpp"
        +#include "agent_common.hpp"
        +#include "jvmti_tools.hpp"
         
         #define PASSED 0
         #define STATUS_FAILED 2
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA06/ma06t001/ma06t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA06/ma06t001/ma06t001.cpp
        index 6d6be2d9b8a..75edd25bcbd 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA06/ma06t001/ma06t001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA06/ma06t001/ma06t001.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include 
        -#include "jni_tools.h"
        -#include "agent_common.h"
        -#include "jvmti_tools.h"
        +#include "jni_tools.hpp"
        +#include "agent_common.hpp"
        +#include "jvmti_tools.hpp"
         
         #define PASSED 0
         #define STATUS_FAILED 2
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA06/ma06t001/ma06t001a.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA06/ma06t001/ma06t001a.cpp
        index daf92c53ac4..a58f6b41422 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA06/ma06t001/ma06t001a.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA06/ma06t001/ma06t001a.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include 
        -#include "jni_tools.h"
        -#include "agent_common.h"
        -#include "jvmti_tools.h"
        +#include "jni_tools.hpp"
        +#include "agent_common.hpp"
        +#include "jvmti_tools.hpp"
         
         #define PASSED 0
         #define STATUS_FAILED 2
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA07/ma07t001/ma07t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA07/ma07t001/ma07t001.cpp
        index cb21bce2ee7..1d64b011f6c 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA07/ma07t001/ma07t001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA07/ma07t001/ma07t001.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include 
        -#include "jni_tools.h"
        -#include "agent_common.h"
        -#include "jvmti_tools.h"
        +#include "jni_tools.hpp"
        +#include "agent_common.hpp"
        +#include "jvmti_tools.hpp"
         
         #define PASSED 0
         #define STATUS_FAILED 2
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA07/ma07t001/ma07t001a.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA07/ma07t001/ma07t001a.cpp
        index e5410c9394c..0f8a27bd50e 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA07/ma07t001/ma07t001a.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA07/ma07t001/ma07t001a.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include 
        -#include "jni_tools.h"
        -#include "agent_common.h"
        -#include "jvmti_tools.h"
        +#include "jni_tools.hpp"
        +#include "agent_common.hpp"
        +#include "jvmti_tools.hpp"
         
         #define PASSED 0
         #define STATUS_FAILED 2
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA08/ma08t001/ma08t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA08/ma08t001/ma08t001.cpp
        index 375a1c944b2..97a71e18c40 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA08/ma08t001/ma08t001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA08/ma08t001/ma08t001.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include 
        -#include "jni_tools.h"
        -#include "agent_common.h"
        -#include "jvmti_tools.h"
        +#include "jni_tools.hpp"
        +#include "agent_common.hpp"
        +#include "jvmti_tools.hpp"
         
         #define PASSED 0
         #define STATUS_FAILED 2
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA08/ma08t001/ma08t001a.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA08/ma08t001/ma08t001a.cpp
        index c77b118941a..b2b75ec12db 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA08/ma08t001/ma08t001a.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA08/ma08t001/ma08t001a.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include 
        -#include "jni_tools.h"
        -#include "agent_common.h"
        -#include "jvmti_tools.h"
        +#include "jni_tools.hpp"
        +#include "agent_common.hpp"
        +#include "jvmti_tools.hpp"
         
         #define PASSED 0
         #define STATUS_FAILED 2
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t001/ma10t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t001/ma10t001.cpp
        index 5c45e75a167..d20b710a942 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t001/ma10t001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t001/ma10t001.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include 
        -#include "jni_tools.h"
        -#include "agent_common.h"
        -#include "jvmti_tools.h"
        +#include "jni_tools.hpp"
        +#include "agent_common.hpp"
        +#include "jvmti_tools.hpp"
         
         #define PASSED 0
         #define STATUS_FAILED 2
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t001/ma10t001a.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t001/ma10t001a.cpp
        index 8ce327c18a0..8b0b1d7da03 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t001/ma10t001a.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t001/ma10t001a.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include 
        -#include "jni_tools.h"
        -#include "agent_common.h"
        -#include "jvmti_tools.h"
        +#include "jni_tools.hpp"
        +#include "agent_common.hpp"
        +#include "jvmti_tools.hpp"
         
         #define PASSED 0
         #define STATUS_FAILED 2
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t002/ma10t002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t002/ma10t002.cpp
        index 3e9e15d92f1..d5e3316b846 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t002/ma10t002.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t002/ma10t002.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include 
        -#include "jni_tools.h"
        -#include "agent_common.h"
        -#include "jvmti_tools.h"
        +#include "jni_tools.hpp"
        +#include "agent_common.hpp"
        +#include "jvmti_tools.hpp"
         
         #define PASSED 0
         #define STATUS_FAILED 2
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t002/ma10t002a.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t002/ma10t002a.cpp
        index 9bf090dbbc4..0ac0b4f3ec0 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t002/ma10t002a.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t002/ma10t002a.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include 
        -#include "jni_tools.h"
        -#include "agent_common.h"
        -#include "jvmti_tools.h"
        +#include "jni_tools.hpp"
        +#include "agent_common.hpp"
        +#include "jvmti_tools.hpp"
         
         #define PASSED 0
         #define STATUS_FAILED 2
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t003/ma10t003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t003/ma10t003.cpp
        index 78857457350..cd1ac4209e6 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t003/ma10t003.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t003/ma10t003.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include 
        -#include "jni_tools.h"
        -#include "agent_common.h"
        -#include "jvmti_tools.h"
        +#include "jni_tools.hpp"
        +#include "agent_common.hpp"
        +#include "jvmti_tools.hpp"
         
         #define PASSED 0
         #define STATUS_FAILED 2
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t003/ma10t003a.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t003/ma10t003a.cpp
        index 356d71c7202..2bb125adb1b 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t003/ma10t003a.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t003/ma10t003a.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include 
        -#include "jni_tools.h"
        -#include "agent_common.h"
        -#include "jvmti_tools.h"
        +#include "jni_tools.hpp"
        +#include "agent_common.hpp"
        +#include "jvmti_tools.hpp"
         
         #define PASSED 0
         #define STATUS_FAILED 2
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t004/ma10t004.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t004/ma10t004.cpp
        index 578d167a15c..8db5995868e 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t004/ma10t004.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t004/ma10t004.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include 
        -#include "jni_tools.h"
        -#include "agent_common.h"
        -#include "jvmti_tools.h"
        +#include "jni_tools.hpp"
        +#include "agent_common.hpp"
        +#include "jvmti_tools.hpp"
         
         #define PASSED 0
         #define STATUS_FAILED 2
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t004/ma10t004a.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t004/ma10t004a.cpp
        index 15819c71e54..66d16ceeb47 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t004/ma10t004a.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t004/ma10t004a.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include 
        -#include "jni_tools.h"
        -#include "agent_common.h"
        -#include "jvmti_tools.h"
        +#include "jni_tools.hpp"
        +#include "agent_common.hpp"
        +#include "jvmti_tools.hpp"
         
         #define PASSED 0
         #define STATUS_FAILED 2
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t005/ma10t005.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t005/ma10t005.cpp
        index c736ec86063..ace612850aa 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t005/ma10t005.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t005/ma10t005.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include 
        -#include "jni_tools.h"
        -#include "agent_common.h"
        -#include "jvmti_tools.h"
        +#include "jni_tools.hpp"
        +#include "agent_common.hpp"
        +#include "jvmti_tools.hpp"
         
         #define PASSED 0
         #define STATUS_FAILED 2
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t005/ma10t005a.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t005/ma10t005a.cpp
        index 592f9d6af07..1573873a9ff 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t005/ma10t005a.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t005/ma10t005a.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include 
        -#include "jni_tools.h"
        -#include "agent_common.h"
        -#include "jvmti_tools.h"
        +#include "jni_tools.hpp"
        +#include "agent_common.hpp"
        +#include "jvmti_tools.hpp"
         
         #define PASSED 0
         #define STATUS_FAILED 2
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t006/ma10t006.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t006/ma10t006.cpp
        index 886675712c0..2c6a186656e 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t006/ma10t006.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t006/ma10t006.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include 
        -#include "jni_tools.h"
        -#include "agent_common.h"
        -#include "jvmti_tools.h"
        +#include "jni_tools.hpp"
        +#include "agent_common.hpp"
        +#include "jvmti_tools.hpp"
         
         #define PASSED 0
         #define STATUS_FAILED 2
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t006/ma10t006a.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t006/ma10t006a.cpp
        index 96993ef79cc..3fca05a0c90 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t006/ma10t006a.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t006/ma10t006a.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include 
        -#include "jni_tools.h"
        -#include "agent_common.h"
        -#include "jvmti_tools.h"
        +#include "jni_tools.hpp"
        +#include "agent_common.hpp"
        +#include "jvmti_tools.hpp"
         
         #define PASSED 0
         #define STATUS_FAILED 2
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t007/ma10t007.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t007/ma10t007.cpp
        index 4f94aa4c430..6df71ba2da9 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t007/ma10t007.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t007/ma10t007.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include 
        -#include "jni_tools.h"
        -#include "agent_common.h"
        -#include "jvmti_tools.h"
        +#include "jni_tools.hpp"
        +#include "agent_common.hpp"
        +#include "jvmti_tools.hpp"
         
         #define PASSED 0
         #define STATUS_FAILED 2
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t007/ma10t007a.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t007/ma10t007a.cpp
        index ebd5a6569d9..02945011bed 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t007/ma10t007a.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t007/ma10t007a.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include 
        -#include "jni_tools.h"
        -#include "agent_common.h"
        -#include "jvmti_tools.h"
        +#include "jni_tools.hpp"
        +#include "agent_common.hpp"
        +#include "jvmti_tools.hpp"
         
         #define PASSED 0
         #define STATUS_FAILED 2
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t008/ma10t008.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t008/ma10t008.cpp
        index ebf76643958..9479471a95a 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t008/ma10t008.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t008/ma10t008.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include 
        -#include "jni_tools.h"
        -#include "agent_common.h"
        -#include "jvmti_tools.h"
        +#include "jni_tools.hpp"
        +#include "agent_common.hpp"
        +#include "jvmti_tools.hpp"
         
         #define PASSED 0
         #define STATUS_FAILED 2
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t008/ma10t008a.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t008/ma10t008a.cpp
        index 9638dfdd48b..45f156675fb 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t008/ma10t008a.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t008/ma10t008a.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include 
        -#include "jni_tools.h"
        -#include "agent_common.h"
        -#include "jvmti_tools.h"
        +#include "jni_tools.hpp"
        +#include "agent_common.hpp"
        +#include "jvmti_tools.hpp"
         
         #define PASSED 0
         #define STATUS_FAILED 2
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP01/sp01t001/sp01t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP01/sp01t001/sp01t001.cpp
        index d3779929295..40db16504b6 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP01/sp01t001/sp01t001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP01/sp01t001/sp01t001.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "jni_tools.h"
        -#include "jvmti_tools.h"
        +#include "agent_common.hpp"
        +#include "jni_tools.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP01/sp01t002/sp01t002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP01/sp01t002/sp01t002.cpp
        index 4fe02129060..cb98f699891 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP01/sp01t002/sp01t002.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP01/sp01t002/sp01t002.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "jni_tools.h"
        -#include "jvmti_tools.h"
        +#include "agent_common.hpp"
        +#include "jni_tools.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP01/sp01t003/sp01t003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP01/sp01t003/sp01t003.cpp
        index 504f965adca..5bc99822347 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP01/sp01t003/sp01t003.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP01/sp01t003/sp01t003.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "jni_tools.h"
        -#include "jvmti_tools.h"
        +#include "agent_common.hpp"
        +#include "jni_tools.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP02/sp02t001/sp02t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP02/sp02t001/sp02t001.cpp
        index 9dc696c7d88..e727438b67a 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP02/sp02t001/sp02t001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP02/sp02t001/sp02t001.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "jni_tools.h"
        -#include "jvmti_tools.h"
        +#include "agent_common.hpp"
        +#include "jni_tools.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP02/sp02t002/sp02t002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP02/sp02t002/sp02t002.cpp
        index eadc3fa3cc6..25648754de4 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP02/sp02t002/sp02t002.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP02/sp02t002/sp02t002.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "jni_tools.h"
        -#include "jvmti_tools.h"
        +#include "agent_common.hpp"
        +#include "jni_tools.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP02/sp02t003/sp02t003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP02/sp02t003/sp02t003.cpp
        index 0916f392a8b..7068025eef0 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP02/sp02t003/sp02t003.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP02/sp02t003/sp02t003.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "jni_tools.h"
        -#include "jvmti_tools.h"
        +#include "agent_common.hpp"
        +#include "jni_tools.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP03/sp03t001/sp03t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP03/sp03t001/sp03t001.cpp
        index 8ce99cf73a1..d9f1e6faf27 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP03/sp03t001/sp03t001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP03/sp03t001/sp03t001.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "jni_tools.h"
        -#include "jvmti_tools.h"
        +#include "agent_common.hpp"
        +#include "jni_tools.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP03/sp03t002/sp03t002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP03/sp03t002/sp03t002.cpp
        index 3001cb25902..0445c199298 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP03/sp03t002/sp03t002.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP03/sp03t002/sp03t002.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "jni_tools.h"
        -#include "jvmti_tools.h"
        +#include "agent_common.hpp"
        +#include "jni_tools.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP04/sp04t001/sp04t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP04/sp04t001/sp04t001.cpp
        index f05ae7e81f8..0f7298ff7df 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP04/sp04t001/sp04t001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP04/sp04t001/sp04t001.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "jni_tools.h"
        -#include "jvmti_tools.h"
        +#include "agent_common.hpp"
        +#include "jni_tools.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP04/sp04t002/sp04t002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP04/sp04t002/sp04t002.cpp
        index dcd2cdfb176..410c77ebd26 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP04/sp04t002/sp04t002.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP04/sp04t002/sp04t002.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "jni_tools.h"
        -#include "jvmti_tools.h"
        +#include "agent_common.hpp"
        +#include "jni_tools.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP05/sp05t002/sp05t002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP05/sp05t002/sp05t002.cpp
        index 94dfb9ead45..caadaf29460 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP05/sp05t002/sp05t002.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP05/sp05t002/sp05t002.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "jni_tools.h"
        -#include "jvmti_tools.h"
        +#include "agent_common.hpp"
        +#include "jni_tools.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP05/sp05t003/sp05t003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP05/sp05t003/sp05t003.cpp
        index 392ff86cb21..3c297299f6a 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP05/sp05t003/sp05t003.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP05/sp05t003/sp05t003.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "jni_tools.h"
        -#include "jvmti_tools.h"
        +#include "agent_common.hpp"
        +#include "jni_tools.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP06/sp06t001/sp06t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP06/sp06t001/sp06t001.cpp
        index cde5a717c8c..b4a0f2e924c 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP06/sp06t001/sp06t001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP06/sp06t001/sp06t001.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "jni_tools.h"
        -#include "jvmti_tools.h"
        +#include "agent_common.hpp"
        +#include "jni_tools.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP06/sp06t002/sp06t002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP06/sp06t002/sp06t002.cpp
        index 43e55d53988..a84073a595b 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP06/sp06t002/sp06t002.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP06/sp06t002/sp06t002.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "jni_tools.h"
        -#include "jvmti_tools.h"
        +#include "agent_common.hpp"
        +#include "jni_tools.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP06/sp06t003/sp06t003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP06/sp06t003/sp06t003.cpp
        index c396f623610..cc2811d520d 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP06/sp06t003/sp06t003.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP06/sp06t003/sp06t003.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "jni_tools.h"
        -#include "jvmti_tools.h"
        +#include "agent_common.hpp"
        +#include "jni_tools.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP07/sp07t001/sp07t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP07/sp07t001/sp07t001.cpp
        index eaf871eb405..7210f4aef2e 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP07/sp07t001/sp07t001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP07/sp07t001/sp07t001.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include 
        -#include "jni_tools.h"
        -#include "agent_common.h"
        -#include "jvmti_tools.h"
        +#include "jni_tools.hpp"
        +#include "agent_common.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP07/sp07t002/sp07t002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP07/sp07t002/sp07t002.cpp
        index d256d87bdff..0f92263796c 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP07/sp07t002/sp07t002.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP07/sp07t002/sp07t002.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include 
        -#include "jni_tools.h"
        -#include "agent_common.h"
        -#include "jvmti_tools.h"
        +#include "jni_tools.hpp"
        +#include "agent_common.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/FollowReferences/followref001/followref001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/FollowReferences/followref001/followref001.cpp
        index e09e0040823..ff431aa2203 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/FollowReferences/followref001/followref001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/FollowReferences/followref001/followref001.cpp
        @@ -24,9 +24,9 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "jni_tools.h"
        -#include "jvmti_tools.h"
        +#include "agent_common.hpp"
        +#include "jni_tools.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/FollowReferences/followref002/followref002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/FollowReferences/followref002/followref002.cpp
        index d84b3b37624..6366b430776 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/FollowReferences/followref002/followref002.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/FollowReferences/followref002/followref002.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "jni_tools.h"
        -#include "jvmti_tools.h"
        +#include "agent_common.hpp"
        +#include "jni_tools.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/FollowReferences/followref003/followref003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/FollowReferences/followref003/followref003.cpp
        index 197a50cea1f..cb0385ee653 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/FollowReferences/followref003/followref003.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/FollowReferences/followref003/followref003.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "jni_tools.h"
        -#include "jvmti_tools.h"
        +#include "agent_common.hpp"
        +#include "jni_tools.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/FollowReferences/followref004/followref004.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/FollowReferences/followref004/followref004.cpp
        index fb1a080f766..e73534de8b6 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/FollowReferences/followref004/followref004.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/FollowReferences/followref004/followref004.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include 
        -#include "agent_common.h"
        -#include "jni_tools.h"
        -#include "jvmti_tools.h"
        +#include "agent_common.hpp"
        +#include "jni_tools.hpp"
        +#include "jvmti_tools.hpp"
         #include "jvmti_FollowRefObjects.hpp"
         
         extern "C" {
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/FollowReferences/followref005/followref005.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/FollowReferences/followref005/followref005.cpp
        index 2ba2c653820..333ddcccf83 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/FollowReferences/followref005/followref005.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/FollowReferences/followref005/followref005.cpp
        @@ -22,9 +22,9 @@
          */
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "jni_tools.h"
        -#include "jvmti_tools.h"
        +#include "agent_common.hpp"
        +#include "jni_tools.hpp"
        +#include "jvmti_tools.hpp"
         #include "jvmti_FollowRefObjects.hpp"
         
         extern "C" {
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/FollowReferences/followref006/followref006.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/FollowReferences/followref006/followref006.cpp
        index 40829005f2e..54485fb809a 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/FollowReferences/followref006/followref006.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/FollowReferences/followref006/followref006.cpp
        @@ -23,9 +23,9 @@
         
         #include 
         #include 
        -#include "agent_common.h"
        -#include "jni_tools.h"
        -#include "jvmti_tools.h"
        +#include "agent_common.hpp"
        +#include "jni_tools.hpp"
        +#include "jvmti_tools.hpp"
         #include "jvmti_FollowRefObjects.hpp"
         
         extern "C" {
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/ForceEarlyReturn/earlyretbase/earlyretbase.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/ForceEarlyReturn/earlyretbase/earlyretbase.cpp
        index faa370694b4..47b9618d19c 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/ForceEarlyReturn/earlyretbase/earlyretbase.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/ForceEarlyReturn/earlyretbase/earlyretbase.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/ForceEarlyReturn/earlyretfp/earlyretfp.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/ForceEarlyReturn/earlyretfp/earlyretfp.cpp
        index d4353eb9dce..9a0ce3d8550 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/ForceEarlyReturn/earlyretfp/earlyretfp.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/ForceEarlyReturn/earlyretfp/earlyretfp.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/ForceEarlyReturn/earlyretint/earlyretint.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/ForceEarlyReturn/earlyretint/earlyretint.cpp
        index 81c0a1e5ec8..feb51d5fc40 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/ForceEarlyReturn/earlyretint/earlyretint.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/ForceEarlyReturn/earlyretint/earlyretint.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/ForceEarlyReturn/earlyretlong/earlyretlong.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/ForceEarlyReturn/earlyretlong/earlyretlong.cpp
        index 7261fe3f621..170d6839bef 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/ForceEarlyReturn/earlyretlong/earlyretlong.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/ForceEarlyReturn/earlyretlong/earlyretlong.cpp
        @@ -24,9 +24,9 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "jni_tools.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "jni_tools.hpp"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/ForceEarlyReturn/earlyretobj/earlyretobj.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/ForceEarlyReturn/earlyretobj/earlyretobj.cpp
        index b5f6a60f4c3..6faf82f9ed9 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/ForceEarlyReturn/earlyretobj/earlyretobj.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/ForceEarlyReturn/earlyretobj/earlyretobj.cpp
        @@ -25,8 +25,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/ForceEarlyReturn/earlyretstr/earlyretstr.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/ForceEarlyReturn/earlyretstr/earlyretstr.cpp
        index 9629ebf46dc..6ebb50026a3 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/ForceEarlyReturn/earlyretstr/earlyretstr.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/ForceEarlyReturn/earlyretstr/earlyretstr.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/ForceEarlyReturn/earlyretvoid/earlyretvoid.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/ForceEarlyReturn/earlyretvoid/earlyretvoid.cpp
        index 567ed23a543..4919d27e9e7 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/ForceEarlyReturn/earlyretvoid/earlyretvoid.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/ForceEarlyReturn/earlyretvoid/earlyretvoid.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/GetAllStackTraces/getallstktr001/getallstktr001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/GetAllStackTraces/getallstktr001/getallstktr001.cpp
        index a6d2804ba76..c1f0443186f 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/GetAllStackTraces/getallstktr001/getallstktr001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/GetAllStackTraces/getallstktr001/getallstktr001.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "jni_tools.h"
        -#include "agent_common.h"
        +#include "jni_tools.hpp"
        +#include "agent_common.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/GetConstantPool/getcpool001/getcpool001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/GetConstantPool/getcpool001/getcpool001.cpp
        index 0514a46224d..997e6c667e6 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/GetConstantPool/getcpool001/getcpool001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/GetConstantPool/getcpool001/getcpool001.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/GetLineNumberTable/linetab004/linetab004.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/GetLineNumberTable/linetab004/linetab004.cpp
        index 9f40468f433..d54f2d838d6 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/GetLineNumberTable/linetab004/linetab004.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/GetLineNumberTable/linetab004/linetab004.cpp
        @@ -27,8 +27,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/GetLocalVariable/getlocal003/getlocal003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/GetLocalVariable/getlocal003/getlocal003.cpp
        index 4361f6df756..684444de335 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/GetLocalVariable/getlocal003/getlocal003.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/GetLocalVariable/getlocal003/getlocal003.cpp
        @@ -24,9 +24,9 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "jni_tools.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "jni_tools.hpp"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/GetLocalVariable/getlocal004/getlocal004.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/GetLocalVariable/getlocal004/getlocal004.cpp
        index a74ca32f27b..b2d92e6a444 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/GetLocalVariable/getlocal004/getlocal004.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/GetLocalVariable/getlocal004/getlocal004.cpp
        @@ -24,9 +24,9 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "jni_tools.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "jni_tools.hpp"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/IsSynthetic/issynth001/issynth001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/IsSynthetic/issynth001/issynth001.cpp
        index 8ebe8508577..f0a3ae3739c 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/IsSynthetic/issynth001/issynth001.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/IsSynthetic/issynth001/issynth001.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/MethodBind/JvmtiTest/JvmtiTest.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/MethodBind/JvmtiTest/JvmtiTest.cpp
        index b68e220470b..e194c32ad5b 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/MethodBind/JvmtiTest/JvmtiTest.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/MethodBind/JvmtiTest/JvmtiTest.cpp
        @@ -24,7 +24,7 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        +#include "agent_common.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/OnUnload/JvmtiTest/JvmtiTest.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/OnUnload/JvmtiTest/JvmtiTest.cpp
        index 6e871d2f763..09e7687a613 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/OnUnload/JvmtiTest/JvmtiTest.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/OnUnload/JvmtiTest/JvmtiTest.cpp
        @@ -1,5 +1,5 @@
         /*
        - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
        + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved.
          * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
          *
          * This code is free software; you can redistribute it and/or modify it
        @@ -24,7 +24,7 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        +#include "agent_common.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/StackTrace/JvmtiTest/JvmtiTest.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/StackTrace/JvmtiTest/JvmtiTest.cpp
        index fbaf0fa1816..5f8cbc532c8 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/StackTrace/JvmtiTest/JvmtiTest.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/StackTrace/JvmtiTest/JvmtiTest.cpp
        @@ -28,7 +28,7 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        +#include "agent_common.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/agentthr/agentthr.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/agentthr/agentthr.cpp
        index 17e7f517923..3fb998ebade 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/agentthr/agentthr.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/agentthr/agentthr.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/clsldrclss00x/clsldrclss00x.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/clsldrclss00x/clsldrclss00x.cpp
        index c1adeb386ff..1dc9202a731 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/clsldrclss00x/clsldrclss00x.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/clsldrclss00x/clsldrclss00x.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/events/redefineCFLH/JvmtiTest/JvmtiTest.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/events/redefineCFLH/JvmtiTest/JvmtiTest.cpp
        index 59ed1561bb2..a0b807e7d1d 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/events/redefineCFLH/JvmtiTest/JvmtiTest.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/events/redefineCFLH/JvmtiTest/JvmtiTest.cpp
        @@ -24,8 +24,8 @@
         #include 
         #include 
         #include 
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/extmech/extmech.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/extmech/extmech.cpp
        index 3dfa394efc5..7f3c629f5bb 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/extmech/extmech.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/extmech/extmech.cpp
        @@ -24,7 +24,7 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        +#include "agent_common.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/functions/AddToBootstrapClassLoaderSearch/JvmtiTest/JvmtiTest.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/functions/AddToBootstrapClassLoaderSearch/JvmtiTest/JvmtiTest.cpp
        index 1ef592cd959..6e56e1a18f5 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/functions/AddToBootstrapClassLoaderSearch/JvmtiTest/JvmtiTest.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/functions/AddToBootstrapClassLoaderSearch/JvmtiTest/JvmtiTest.cpp
        @@ -25,7 +25,7 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        +#include "agent_common.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/functions/Dispose/JvmtiTest/JvmtiTest.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/functions/Dispose/JvmtiTest/JvmtiTest.cpp
        index 24066525e63..61e5a32ad5b 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/functions/Dispose/JvmtiTest/JvmtiTest.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/functions/Dispose/JvmtiTest/JvmtiTest.cpp
        @@ -24,7 +24,7 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        +#include "agent_common.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/functions/ForceGarbageCollection/gc/gc.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/functions/ForceGarbageCollection/gc/gc.cpp
        index e1c57fa08d2..8545445cdb9 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/functions/ForceGarbageCollection/gc/gc.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/functions/ForceGarbageCollection/gc/gc.cpp
        @@ -24,7 +24,7 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        +#include "agent_common.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/functions/environment/JvmtiTest/JvmtiTest.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/functions/environment/JvmtiTest/JvmtiTest.cpp
        index 9358ce599a2..6177f448c6c 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/functions/environment/JvmtiTest/JvmtiTest.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/functions/environment/JvmtiTest/JvmtiTest.cpp
        @@ -1,5 +1,5 @@
         /*
        - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
        + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved.
          * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
          *
          * This code is free software; you can redistribute it and/or modify it
        @@ -24,7 +24,7 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        +#include "agent_common.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/functions/nosuspendMonitorInfo/JvmtiTest/JvmtiTest.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/functions/nosuspendMonitorInfo/JvmtiTest/JvmtiTest.cpp
        index 66799c3d004..64f09edbaa4 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/functions/nosuspendMonitorInfo/JvmtiTest/JvmtiTest.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/functions/nosuspendMonitorInfo/JvmtiTest/JvmtiTest.cpp
        @@ -24,7 +24,7 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        +#include "agent_common.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/functions/nosuspendStackTrace/JvmtiTest/JvmtiTest.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/functions/nosuspendStackTrace/JvmtiTest/JvmtiTest.cpp
        index 432045f98e2..b64184ed55c 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/functions/nosuspendStackTrace/JvmtiTest/JvmtiTest.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/functions/nosuspendStackTrace/JvmtiTest/JvmtiTest.cpp
        @@ -24,7 +24,7 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        +#include "agent_common.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/functions/rawmonitor/rawmonitor.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/functions/rawmonitor/rawmonitor.cpp
        index 55267f99ead..11ef7e18d7b 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/functions/rawmonitor/rawmonitor.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/functions/rawmonitor/rawmonitor.cpp
        @@ -47,7 +47,7 @@ s
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        +#include "agent_common.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/heapref/heapref.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/heapref/heapref.cpp
        index bab6bfbbfca..0772a387a32 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/heapref/heapref.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/heapref/heapref.cpp
        @@ -25,9 +25,9 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "jni_tools.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "jni_tools.hpp"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/refignore/refignore.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/refignore/refignore.cpp
        index eb840e39061..b850edd75b0 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/refignore/refignore.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/refignore/refignore.cpp
        @@ -25,9 +25,9 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "jni_tools.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        +#include "jni_tools.hpp"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/setNullVMInit/JvmtiTest/JvmtiTest.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/setNullVMInit/JvmtiTest/JvmtiTest.cpp
        index 1ce5facd4eb..8743b6c0ec5 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/setNullVMInit/JvmtiTest/JvmtiTest.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/setNullVMInit/JvmtiTest/JvmtiTest.cpp
        @@ -33,8 +33,8 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "jni_tools.h"
        -#include "agent_common.h"
        +#include "jni_tools.hpp"
        +#include "agent_common.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/timers/JvmtiTest/JvmtiTest.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/timers/JvmtiTest/JvmtiTest.cpp
        index b903de9b7ec..6491f3e6686 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/timers/JvmtiTest/JvmtiTest.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/timers/JvmtiTest/JvmtiTest.cpp
        @@ -35,9 +35,9 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        +#include "agent_common.hpp"
         
        -#include "jni_tools.h"
        +#include "jni_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/StackTraceController.cpp b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/StackTraceController.cpp
        index 3e46cc25368..1f3f3a019bf 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/StackTraceController.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/StackTraceController.cpp
        @@ -23,7 +23,7 @@
         
         #include 
         #include 
        -#include "jni_tools.h"
        +#include "jni_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/ThreadController.cpp b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/ThreadController.cpp
        index e5fbc02b46d..90fd4df97e6 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/ThreadController.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/ThreadController.cpp
        @@ -25,7 +25,7 @@
         #include 
         #include 
         #include 
        -#include "jni_tools.h"
        +#include "jni_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/thread/Deadlock.cpp b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/thread/Deadlock.cpp
        index 5c9a22e2464..c45fee989f7 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/thread/Deadlock.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/thread/Deadlock.cpp
        @@ -21,7 +21,7 @@
          * questions.
          */
         #include 
        -#include "jni_tools.h"
        +#include "jni_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/thread/LockingThreads.cpp b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/thread/LockingThreads.cpp
        index 604b0620c5b..0b208187d97 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/thread/LockingThreads.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/thread/LockingThreads.cpp
        @@ -21,7 +21,7 @@
          * questions.
          */
         #include 
        -#include "jni_tools.h"
        +#include "jni_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/thread/RecursiveMonitoringThread.cpp b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/thread/RecursiveMonitoringThread.cpp
        index 6926c8f712e..5c7a3351943 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/thread/RecursiveMonitoringThread.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/thread/RecursiveMonitoringThread.cpp
        @@ -23,7 +23,7 @@
         
         #include 
         #include 
        -#include "jni_tools.h"
        +#include "jni_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/JVMTIagent.cpp b/test/hotspot/jtreg/vmTestbase/nsk/share/JVMTIagent.cpp
        index 59395c6fcf6..9c33f5c7797 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/share/JVMTIagent.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/JVMTIagent.cpp
        @@ -34,10 +34,10 @@
         #include 
         #include 
         
        -#include "nsk_tools.h"
        -#include "jni_tools.h"
        -#include "JVMTITools.h"
        -#include "jvmti_tools.h"
        +#include "nsk_tools.hpp"
        +#include "jni_tools.hpp"
        +#include "JVMTITools.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/aod/aod.cpp b/test/hotspot/jtreg/vmTestbase/nsk/share/aod/aod.cpp
        index b3b076b2ef7..7f622c24f75 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/share/aod/aod.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/aod/aod.cpp
        @@ -23,9 +23,9 @@
         #include 
         #include 
         #include 
        -#include 
        -#include 
        -#include 
        +#include 
        +#include 
        +#include 
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/aod/aod.h b/test/hotspot/jtreg/vmTestbase/nsk/share/aod/aod.hpp
        similarity index 91%
        rename from test/hotspot/jtreg/vmTestbase/nsk/share/aod/aod.h
        rename to test/hotspot/jtreg/vmTestbase/nsk/share/aod/aod.hpp
        index 335720c01b6..f56b0eba757 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/share/aod/aod.h
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/aod/aod.hpp
        @@ -1,5 +1,5 @@
         /*
        - * Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved.
        + * Copyright (c) 2008, 2024, Oracle and/or its affiliates. All rights reserved.
          * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
          *
          * This code is free software; you can redistribute it and/or modify it
        @@ -20,12 +20,12 @@
          * or visit www.oracle.com if you need additional information or have any
          * questions.
          */
        -#ifndef NSK_SHARE_AOD_H
        -#define NSK_SHARE_AOD_H
        +#ifndef NSK_SHARE_AOD_HPP
        +#define NSK_SHARE_AOD_HPP
         
         #include 
        -#include 
        -#include 
        +#include 
        +#include 
         
         extern "C" {
         
        @@ -76,4 +76,4 @@ JNIEnv* nsk_aod_createJNIEnv(JavaVM* vm);
         
         }
         
        -#endif /* END OF NSK_SHARE_AOD_H */
        +#endif /* END OF NSK_SHARE_AOD_HPP */
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/BooleanArrayCriticalLocker.cpp b/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/BooleanArrayCriticalLocker.cpp
        index 2ad70dfe076..5b3978fe768 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/BooleanArrayCriticalLocker.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/BooleanArrayCriticalLocker.cpp
        @@ -24,7 +24,7 @@
         #include 
         #include 
         #include "ExceptionCheckingJniEnv.hpp"
        -#include "jni_tools.h"
        +#include "jni_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/ByteArrayCriticalLocker.cpp b/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/ByteArrayCriticalLocker.cpp
        index 1feb98d9ef5..fa11c9e79c9 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/ByteArrayCriticalLocker.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/ByteArrayCriticalLocker.cpp
        @@ -24,7 +24,7 @@
         #include 
         #include 
         #include "ExceptionCheckingJniEnv.hpp"
        -#include "jni_tools.h"
        +#include "jni_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/CharArrayCriticalLocker.cpp b/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/CharArrayCriticalLocker.cpp
        index 9c6231a0a16..28967200f94 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/CharArrayCriticalLocker.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/CharArrayCriticalLocker.cpp
        @@ -24,7 +24,7 @@
         #include 
         #include 
         #include "ExceptionCheckingJniEnv.hpp"
        -#include "jni_tools.h"
        +#include "jni_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/DoubleArrayCriticalLocker.cpp b/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/DoubleArrayCriticalLocker.cpp
        index 773ffc533a1..2c42700e27e 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/DoubleArrayCriticalLocker.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/DoubleArrayCriticalLocker.cpp
        @@ -24,7 +24,7 @@
         #include 
         #include 
         #include "ExceptionCheckingJniEnv.hpp"
        -#include "jni_tools.h"
        +#include "jni_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/FloatArrayCriticalLocker.cpp b/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/FloatArrayCriticalLocker.cpp
        index e24138792fb..1ee47059d61 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/FloatArrayCriticalLocker.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/FloatArrayCriticalLocker.cpp
        @@ -24,7 +24,7 @@
         #include 
         #include 
         #include "ExceptionCheckingJniEnv.hpp"
        -#include "jni_tools.h"
        +#include "jni_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/IntArrayCriticalLocker.cpp b/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/IntArrayCriticalLocker.cpp
        index b863984f9ac..e0efd81f840 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/IntArrayCriticalLocker.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/IntArrayCriticalLocker.cpp
        @@ -24,7 +24,7 @@
         #include 
         #include 
         #include "ExceptionCheckingJniEnv.hpp"
        -#include "jni_tools.h"
        +#include "jni_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/LongArrayCriticalLocker.cpp b/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/LongArrayCriticalLocker.cpp
        index dae07c708db..265a7333ae3 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/LongArrayCriticalLocker.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/LongArrayCriticalLocker.cpp
        @@ -24,7 +24,7 @@
         #include 
         #include 
         #include "ExceptionCheckingJniEnv.hpp"
        -#include "jni_tools.h"
        +#include "jni_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/ShortArrayCriticalLocker.cpp b/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/ShortArrayCriticalLocker.cpp
        index 2b03591a709..bbc4cb24064 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/ShortArrayCriticalLocker.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/ShortArrayCriticalLocker.cpp
        @@ -24,7 +24,7 @@
         #include 
         #include 
         #include "ExceptionCheckingJniEnv.hpp"
        -#include "jni_tools.h"
        +#include "jni_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/StringCriticalLocker.cpp b/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/StringCriticalLocker.cpp
        index a8049b2bea9..df3c98f7e31 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/StringCriticalLocker.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/StringCriticalLocker.cpp
        @@ -24,7 +24,7 @@
         #include 
         #include 
         #include "ExceptionCheckingJniEnv.hpp"
        -#include "jni_tools.h"
        +#include "jni_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jniref/JNIGlobalRefLocker.cpp b/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jniref/JNIGlobalRefLocker.cpp
        index 4bbbef6e204..d141f6d8544 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jniref/JNIGlobalRefLocker.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jniref/JNIGlobalRefLocker.cpp
        @@ -25,7 +25,7 @@
         #include 
         #include 
         #include "ExceptionCheckingJniEnv.hpp"
        -#include "jni_tools.h"
        +#include "jni_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jniref/JNILocalRefLocker.cpp b/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jniref/JNILocalRefLocker.cpp
        index 127322728a5..005954d0fbc 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jniref/JNILocalRefLocker.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jniref/JNILocalRefLocker.cpp
        @@ -24,7 +24,7 @@
         #include 
         #include 
         #include "ExceptionCheckingJniEnv.hpp"
        -#include "jni_tools.h"
        +#include "jni_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jniref/JNIRefLocker.cpp b/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jniref/JNIRefLocker.cpp
        index 0fb552a8b03..9478e72eb43 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jniref/JNIRefLocker.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jniref/JNIRefLocker.cpp
        @@ -24,7 +24,7 @@
         #include 
         #include 
         #include "ExceptionCheckingJniEnv.hpp"
        -#include "jni_tools.h"
        +#include "jni_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jniref/JNIWeakGlobalRefLocker.cpp b/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jniref/JNIWeakGlobalRefLocker.cpp
        index f4c35b20d90..6d1986f533e 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jniref/JNIWeakGlobalRefLocker.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jniref/JNIWeakGlobalRefLocker.cpp
        @@ -24,7 +24,7 @@
         #include 
         #include 
         #include "ExceptionCheckingJniEnv.hpp"
        -#include "jni_tools.h"
        +#include "jni_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/jdi/MonitorEnterExecutor.cpp b/test/hotspot/jtreg/vmTestbase/nsk/share/jdi/MonitorEnterExecutor.cpp
        index f85bbeeda18..5988e55ad79 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/share/jdi/MonitorEnterExecutor.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/jdi/MonitorEnterExecutor.cpp
        @@ -1,5 +1,5 @@
         /*
        - * Copyright (c) 2006, 2018, Oracle and/or its affiliates. All rights reserved.
        + * Copyright (c) 2006, 2024, Oracle and/or its affiliates. All rights reserved.
          * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
          *
          * This code is free software; you can redistribute it and/or modify it
        @@ -21,7 +21,7 @@
          * questions.
          */
         #include "jni.h"
        -#include "nsk_tools.h"
        +#include "nsk_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/jni/ExceptionCheckingJniEnv.cpp b/test/hotspot/jtreg/vmTestbase/nsk/share/jni/ExceptionCheckingJniEnv.cpp
        index ca3e5dfff74..65f087dbcd6 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/share/jni/ExceptionCheckingJniEnv.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/jni/ExceptionCheckingJniEnv.cpp
        @@ -27,7 +27,7 @@
         #include 
         
         #include "ExceptionCheckingJniEnv.hpp"
        -#include "nsk_tools.h"
        +#include "nsk_tools.hpp"
         
         namespace {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/jni/JNIreferences.cpp b/test/hotspot/jtreg/vmTestbase/nsk/share/jni/JNIreferences.cpp
        index 50b59a157e9..21285d32825 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/share/jni/JNIreferences.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/jni/JNIreferences.cpp
        @@ -22,7 +22,7 @@
          */
         #include "jni.h"
         #include 
        -#include "nsk_tools.h"
        +#include "nsk_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/jni/README b/test/hotspot/jtreg/vmTestbase/nsk/share/jni/README
        index 0da5b570439..ab76d94ab92 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/share/jni/README
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/jni/README
        @@ -1,4 +1,4 @@
        -Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
        +Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved.
         DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
         
         This code is free software; you can redistribute it and/or modify it
        @@ -25,8 +25,8 @@ This directory contains source files of testbase_nsk JNI framework,
         which provides support for JNI tests and accessing JNI environment.
         
             Source files:
        -        jni_tools.h
        -        jni_tools.c
        +        jni_tools.hpp
        +        jni_tools.cpp
         
             Naming conventions:
                 macroses:  NSK_JNI_*
        @@ -34,7 +34,7 @@ which provides support for JNI tests and accessing JNI environment.
         
         ---------------------------------------------------------------------------------
         
        -jni_tools.h
        +jni_tools.hpp
         
         Provides functions and macroses for invocation of JNI functions
         and checking JNI errors and pending exceptions:
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/jni/jni_tools.cpp b/test/hotspot/jtreg/vmTestbase/nsk/share/jni/jni_tools.cpp
        index 2f5a5ff3bc0..c6059e18a49 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/share/jni/jni_tools.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/jni/jni_tools.cpp
        @@ -40,8 +40,8 @@
         
         /*************************************************************/
         
        -#include "nsk_tools.h"
        -#include "jni_tools.h"
        +#include "nsk_tools.hpp"
        +#include "jni_tools.hpp"
         
         
         /*************************************************************/
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/jni/jni_tools.h b/test/hotspot/jtreg/vmTestbase/nsk/share/jni/jni_tools.hpp
        similarity index 97%
        rename from test/hotspot/jtreg/vmTestbase/nsk/share/jni/jni_tools.h
        rename to test/hotspot/jtreg/vmTestbase/nsk/share/jni/jni_tools.hpp
        index 07153e9cdd4..f8f74d152ad 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/share/jni/jni_tools.h
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/jni/jni_tools.hpp
        @@ -1,5 +1,5 @@
         /*
        - * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved.
        + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved.
          * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
          *
          * This code is free software; you can redistribute it and/or modify it
        @@ -30,11 +30,11 @@
         
         /*************************************************************/
         
        -#include "nsk_tools.h"
        +#include "nsk_tools.hpp"
         
         /*************************************************************/
         
        -#include "jvmti_common.h"
        +#include "jvmti_common.hpp"
         
         /* printf format specifier for jlong */
         #ifdef _WIN32
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/AddToBootstrapClassLoaderSearch/bootclssearch_agent.cpp b/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/AddToBootstrapClassLoaderSearch/bootclssearch_agent.cpp
        index 4340391d413..bc20d23041a 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/AddToBootstrapClassLoaderSearch/bootclssearch_agent.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/AddToBootstrapClassLoaderSearch/bootclssearch_agent.cpp
        @@ -24,9 +24,9 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "jni_tools.h"
        -#include "jvmti_tools.h"
        -#include "agent_common.h"
        +#include "jni_tools.hpp"
        +#include "jvmti_tools.hpp"
        +#include "agent_common.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/AddToSystemClassLoaderSearch/systemclssearch_agent.cpp b/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/AddToSystemClassLoaderSearch/systemclssearch_agent.cpp
        index 1d123242d49..2cf7d1f44ca 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/AddToSystemClassLoaderSearch/systemclssearch_agent.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/AddToSystemClassLoaderSearch/systemclssearch_agent.cpp
        @@ -24,9 +24,9 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "jni_tools.h"
        -#include "jvmti_tools.h"
        -#include "agent_common.h"
        +#include "jni_tools.hpp"
        +#include "jvmti_tools.hpp"
        +#include "agent_common.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/Injector.cpp b/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/Injector.cpp
        index cbf680175e7..ee61ed71232 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/Injector.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/Injector.cpp
        @@ -23,8 +23,8 @@
         
         #include 
         #include 
        -#include "jni_tools.h"
        -#include "jvmti_tools.h"
        +#include "jni_tools.hpp"
        +#include "jvmti_tools.hpp"
         #include "Injector.hpp"
         
         /* ========================================================================== */
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/JVMTITools.cpp b/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/JVMTITools.cpp
        index 16a02dfc2a4..e80d70d4f23 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/JVMTITools.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/JVMTITools.cpp
        @@ -1,5 +1,5 @@
         /*
        - * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved.
        + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved.
          * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
          *
          * This code is free software; you can redistribute it and/or modify it
        @@ -23,5 +23,5 @@
         
         #include 
         #include 
        -#include "JVMTITools.h"
        +#include "JVMTITools.hpp"
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/JVMTITools.h b/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/JVMTITools.hpp
        similarity index 82%
        rename from test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/JVMTITools.h
        rename to test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/JVMTITools.hpp
        index e51d9ab91c1..b38cb64a36e 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/JVMTITools.h
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/JVMTITools.hpp
        @@ -1,5 +1,5 @@
         /*
        - * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved.
        + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved.
          * 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,11 +21,11 @@
          * questions.
          */
         
        -#ifndef _NSK_SHARE_JVMTI_JVMTITOOLS_H_
        -#define _NSK_SHARE_JVMTI_JVMTITOOLS_H_
        +#ifndef _NSK_SHARE_JVMTI_JVMTITOOLS_HPP_
        +#define _NSK_SHARE_JVMTI_JVMTITOOLS_HPP_
         
         #include "jvmti.h"
         
        -#include "jvmti_common.h"
        +#include "jvmti_common.hpp"
         
        -#endif /* _NSK_SHARE_JVMTI_JVMTITOOLS_H_ */
        +#endif /* _NSK_SHARE_JVMTI_JVMTITOOLS_HPP_ */
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/README b/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/README
        index 52e7ca3d31c..bc8a50afea6 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/README
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/README
        @@ -25,13 +25,13 @@ This directory contains source files of testbase_nsk JVMTI framework,
         which provides support for JVMTI tests and accessing JVMTI environment.
         
             Source files:
        -        jvmti_tools.h
        -        jvmti_tools.c
        -        agent_tools.c
        +        jvmti_tools.hpp
        +        jvmti_tools.cpp
        +        agent_tools.cpp
                 Injector.hpp
                 Injector.cpp
        -        JVMTITools.h
        -        JVMTITools.c
        +        JVMTITools.hpp
        +        JVMTITools.cpp
         
             Naming conventions:
                 macroses:  NSK_JVMTI_*
        @@ -39,7 +39,7 @@ which provides support for JVMTI tests and accessing JVMTI environment.
         
         ---------------------------------------------------------------------------------
         
        -jvmti_tools.h
        +jvmti_tools.hpp
         
         Provides functions and macroses for invocation of JVMTI functions
         and checking JVMTI errors:
        @@ -135,7 +135,7 @@ or with saving error code:
         
         ---------------------------------------------------------------------------------
         
        -JVMTITools.h
        +JVMTITools.hpp
         
         Provides set of functions which convert JVMTI binary data to
         a null-terminated character string:
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/agent_common/agent_common.cpp b/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/agent_common/agent_common.cpp
        index 8ff7895c2aa..659ac5313a5 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/agent_common/agent_common.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/agent_common/agent_common.cpp
        @@ -1,5 +1,5 @@
         /*
        - * Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved.
        + * Copyright (c) 2008, 2024, Oracle and/or its affiliates. All rights reserved.
          * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
          *
          * This code is free software; you can redistribute it and/or modify it
        @@ -21,7 +21,7 @@
          * questions.
          */
         #include "jvmti.h"
        -#include "agent_common.h"
        +#include "agent_common.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/agent_common/agent_common.h b/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/agent_common/agent_common.hpp
        similarity index 93%
        rename from test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/agent_common/agent_common.h
        rename to test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/agent_common/agent_common.hpp
        index bc55b9eda17..f313b6450de 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/agent_common/agent_common.h
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/agent_common/agent_common.hpp
        @@ -1,5 +1,5 @@
         /*
        - * Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved.
        + * Copyright (c) 2008, 2024, Oracle and/or its affiliates. All rights reserved.
          * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
          *
          * This code is free software; you can redistribute it and/or modify it
        @@ -24,7 +24,7 @@
         #define NSK_JVMTI_AGENT_COMMON_DEFINED
         
         #include "jvmti.h"
        -#include "../jvmti_tools.h"
        +#include "../jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/agent_tools.cpp b/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/agent_tools.cpp
        index 0f4dc828d8b..0b43e5ac782 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/agent_tools.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/agent_tools.cpp
        @@ -25,8 +25,8 @@
         #include 
         
         #include "native_thread.hpp"
        -#include "jni_tools.h"
        -#include "jvmti_tools.h"
        +#include "jni_tools.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/aod/jvmti_aod.hpp b/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/aod/jvmti_aod.hpp
        index 9e34051da34..d6d090d01b3 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/aod/jvmti_aod.hpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/aod/jvmti_aod.hpp
        @@ -23,9 +23,9 @@
         #ifndef NSK_SHARE_JVMTI_AOD_HPP
         #define NSK_SHARE_JVMTI_AOD_HPP
         
        -#include 
        +#include 
         #include 
        -#include 
        +#include 
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/hotswap/HotSwap.cpp b/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/hotswap/HotSwap.cpp
        index c444f304738..b47be9bb74a 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/hotswap/HotSwap.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/hotswap/HotSwap.cpp
        @@ -24,10 +24,10 @@
         #include 
         #include 
         #include 
        -#include "jni_tools.h"
        -#include "jvmti_tools.h"
        +#include "jni_tools.hpp"
        +#include "jvmti_tools.hpp"
         #include "Injector.hpp"
        -#include "agent_common.h"
        +#include "agent_common.hpp"
         
         #define PASSED 0
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/jvmti_FollowRefObjects.cpp b/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/jvmti_FollowRefObjects.cpp
        index d9e5c494474..497fd4f9132 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/jvmti_FollowRefObjects.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/jvmti_FollowRefObjects.cpp
        @@ -23,8 +23,8 @@
         
         #include 
         #include 
        -#include "jni_tools.h"
        -#include "jvmti_tools.h"
        +#include "jni_tools.hpp"
        +#include "jvmti_tools.hpp"
         #include "jvmti_FollowRefObjects.hpp"
         
         extern "C" {
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/jvmti_tools.cpp b/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/jvmti_tools.cpp
        index e07c453fd0e..83ac3855b45 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/jvmti_tools.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/jvmti_tools.cpp
        @@ -33,10 +33,10 @@
         
         /*************************************************************/
         
        -#include "nsk_tools.h"
        -#include "jni_tools.h"
        -#include "jvmti_tools.h"
        -#include "JVMTITools.h"
        +#include "nsk_tools.hpp"
        +#include "jni_tools.hpp"
        +#include "jvmti_tools.hpp"
        +#include "JVMTITools.hpp"
         
         /*************************************************************/
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/jvmti_tools.h b/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/jvmti_tools.hpp
        similarity index 94%
        rename from test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/jvmti_tools.h
        rename to test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/jvmti_tools.hpp
        index 31eac286158..4a3d3e7bf4f 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/jvmti_tools.h
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/jvmti_tools.hpp
        @@ -1,5 +1,5 @@
         /*
        - * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved.
        + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved.
          * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
          *
          * This code is free software; you can redistribute it and/or modify it
        @@ -30,9 +30,9 @@
         
         /*************************************************************/
         
        -#include "nsk_tools.h"
        -#include "jni_tools.h"
        -#include "JVMTITools.h"
        +#include "nsk_tools.hpp"
        +#include "jni_tools.hpp"
        +#include "JVMTITools.hpp"
         
         
         extern "C" {
        @@ -81,7 +81,7 @@ int nsk_jvmti_parseOptions(const char options[]);
         
         /**
          * Creates JVMTI environment for the JVMTI test.
        - * If something fails, complains an error and returns NULL.
        + * If something fails, complains an error and returns null.
          */
         jvmtiEnv* nsk_jvmti_createJVMTIEnv(JavaVM* jvm, void* reserved);
         
        @@ -102,19 +102,19 @@ int nsk_jvmti_init_MA(jvmtiEventCallbacks* callbacks);
         
         /**
          * Returns thread object associated with agent thread..
        - * If something fails, complains an error and returns NULL.
        + * If something fails, complains an error and returns null.
          */
         jthread nsk_jvmti_getAgentThread();
         
         /**
          * Returns JNI environment constructed for agent thread.
        - * If something fails, complains an error and returns NULL.
        + * If something fails, complains an error and returns null.
          */
         JNIEnv* nsk_jvmti_getAgentJNIEnv();
         
         /**
          * Returns JVMTI environment constructed for agent.
        - * If something fails, complains an error and returns NULL.
        + * If something fails, complains an error and returns null.
          */
         jvmtiEnv* nsk_jvmti_getAgentJVMTIEnv();
         
        @@ -170,14 +170,14 @@ jint nsk_jvmti_getStatus();
         
         /**
          * Finds first class with given signatire among loaded classes.
        - * If no class found or something fails, complains an error and returns NULL.
        + * If no class found or something fails, complains an error and returns null.
          * On success creates and returns global reference to the found class.
          */
         jclass nsk_jvmti_classBySignature(const char signature[]);
         
         /**
          * Finds first thread with given name among alive threads.
        - * If no thread found or something fails, complains an error and returns NULL.
        + * If no thread found or something fails, complains an error and returns null.
          * On success creates and returns global reference to the found thread.
          */
         jthread nsk_jvmti_threadByName(const char name[]);
        @@ -223,7 +223,7 @@ jlocation nsk_jvmti_clearLineBreakpoint(jclass cls, jmethodID method, int line);
         /********************* Events management *********************/
         
         /**
        - * Enables or disables all events of given list for given thread or NULL.
        + * Enables or disables all events of given list for given thread or null.
          * If something fails, complains an error and returns 0 (NSK_FALSE).
          */
         int nsk_jvmti_enableEvents(jvmtiEventMode enable, int size,
        @@ -258,14 +258,14 @@ int nsk_jvmti_disableNotification(jvmtiEnv *jvmti, jvmtiEvent event, jthread thr
         /******************** Access test options ********************/
         
         /**
        - * Returns value of given option name; or NULL if no such option found.
        - * If search name is NULL then complains an error and returns NULL.
        + * Returns value of given option name; or null if no such option found.
        + * If search name is null then complains an error and returns null.
          */
         const char* nsk_jvmti_findOptionValue(const char name[]);
         
         /**
          * Returns string value of given option; or defaultValue if no such option found.
        - * If options is specified but has empty value then complains an error and returns NULL.
        + * If options is specified but has empty value then complains an error and returns null.
          */
         const char* nsk_jvmti_findOptionStringValue(const char name[], const char* defaultValue);
         
        @@ -282,13 +282,13 @@ int nsk_jvmti_getOptionsCount();
         
         /**
          * Returns name of i-th parsed option.
        - * If no such option then complains an error and returns NULL.
        + * If no such option then complains an error and returns null.
          */
         const char* nsk_jvmti_getOptionName(int i);
         
         /**
          * Returns value of i-th parsed option.
        - * If no such option then complains an error and returns NULL.
        + * If no such option then complains an error and returns null.
          */
         const char* nsk_jvmti_getOptionValue(int i);
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/unit/Heap.cpp b/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/unit/Heap.cpp
        index 8306fd07c5e..0c0ebc485dc 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/unit/Heap.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/unit/Heap.cpp
        @@ -27,7 +27,7 @@
         
         #include "jni.h"
         #include "jvmti.h"
        -#include "agent_common.h"
        +#include "agent_common.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/locks/JNIMonitorLocker.cpp b/test/hotspot/jtreg/vmTestbase/nsk/share/locks/JNIMonitorLocker.cpp
        index a82f4cca5fa..f54e15ff6cf 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/share/locks/JNIMonitorLocker.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/locks/JNIMonitorLocker.cpp
        @@ -1,5 +1,5 @@
         /*
        - * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved.
        + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved.
          * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
          *
          * This code is free software; you can redistribute it and/or modify it
        @@ -21,7 +21,7 @@
          * questions.
          */
         #include "jni.h"
        -#include "nsk_tools.h"
        +#include "nsk_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/locks/LockingThread.cpp b/test/hotspot/jtreg/vmTestbase/nsk/share/locks/LockingThread.cpp
        index 4bb08c1aad3..908a5cc56c7 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/share/locks/LockingThread.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/locks/LockingThread.cpp
        @@ -1,5 +1,5 @@
         /*
        - * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved.
        + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved.
          * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
          *
          * This code is free software; you can redistribute it and/or modify it
        @@ -21,7 +21,7 @@
          * questions.
          */
         #include "jni.h"
        -#include "nsk_tools.h"
        +#include "nsk_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/native/README b/test/hotspot/jtreg/vmTestbase/nsk/share/native/README
        index f6c18e86e8f..42467aa009d 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/share/native/README
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/native/README
        @@ -25,8 +25,8 @@ This directory contains source files of testbase_nsk native
         framework, which provides support for native tests.
         
             Source files:
        -        nsk_tools.h
        -        nsk_tools.c
        +        nsk_tools.hpp
        +        nsk_tools.cpp
         
             Naming conventions:
                 macroses:  NSK_*
        @@ -54,7 +54,7 @@ provides support for lists of various objects
         
         ---------------------------------------------------------------------------------
         
        -nsk_tools.h
        +nsk_tools.hpp
         
         Provides functions and macroses for the most usefull actions:
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/native/nsk_list.cpp b/test/hotspot/jtreg/vmTestbase/nsk/share/native/nsk_list.cpp
        index 068c92bf807..736ddafdfaf 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/share/native/nsk_list.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/native/nsk_list.cpp
        @@ -25,7 +25,7 @@
         #include 
         #include 
         #include "nsk_list.hpp"
        -#include "nsk_tools.h"
        +#include "nsk_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/native/nsk_tools.cpp b/test/hotspot/jtreg/vmTestbase/nsk/share/native/nsk_tools.cpp
        index 3ba69427fd6..5d41ac31131 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/share/native/nsk_tools.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/native/nsk_tools.cpp
        @@ -31,7 +31,7 @@
         
         /*************************************************************/
         
        -#include "nsk_tools.h"
        +#include "nsk_tools.hpp"
         
         /*************************************************************/
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/native/nsk_tools.h b/test/hotspot/jtreg/vmTestbase/nsk/share/native/nsk_tools.hpp
        similarity index 98%
        rename from test/hotspot/jtreg/vmTestbase/nsk/share/native/nsk_tools.h
        rename to test/hotspot/jtreg/vmTestbase/nsk/share/native/nsk_tools.hpp
        index 12760fd458c..6b262617c5c 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/share/native/nsk_tools.h
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/native/nsk_tools.hpp
        @@ -1,5 +1,5 @@
         /*
        - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
        + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved.
          * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
          *
          * This code is free software; you can redistribute it and/or modify it
        @@ -160,7 +160,7 @@ void nsk_printHexBytes(const char indent[], int columns,
         /*************************************************************/
         
         /**
        - * Returns str or "" if str is NULL; useful for printing strings.
        + * Returns str or "" if str is null; useful for printing strings.
          */
         const char* nsk_null_string(const char* str);
         
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/stress/strace/nsk_strace.hpp b/test/hotspot/jtreg/vmTestbase/nsk/stress/strace/nsk_strace.hpp
        index 9a03b990df7..5cc6efdb7a8 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/stress/strace/nsk_strace.hpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/stress/strace/nsk_strace.hpp
        @@ -22,7 +22,7 @@
          */
         
         #include 
        -#include "jni_tools.h"
        +#include "jni_tools.hpp"
         
         #ifndef _IS_NSK_STRACE_DEFINED_
         #define _IS_NSK_STRACE_DEFINED_
        diff --git a/test/hotspot/jtreg/vmTestbase/nsk/stress/strace/strace005.cpp b/test/hotspot/jtreg/vmTestbase/nsk/stress/strace/strace005.cpp
        index 96cde50ce74..1539727d8fd 100644
        --- a/test/hotspot/jtreg/vmTestbase/nsk/stress/strace/strace005.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/stress/strace/strace005.cpp
        @@ -23,7 +23,7 @@
         
         #include 
         #include "nsk_strace.hpp"
        -#include "nsk_tools.h"
        +#include "nsk_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/vm/mlvm/indy/func/jvmti/share/IndyRedefineClass.cpp b/test/hotspot/jtreg/vmTestbase/vm/mlvm/indy/func/jvmti/share/IndyRedefineClass.cpp
        index d9fea1005fd..60c0111d2d4 100644
        --- a/test/hotspot/jtreg/vmTestbase/vm/mlvm/indy/func/jvmti/share/IndyRedefineClass.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/vm/mlvm/indy/func/jvmti/share/IndyRedefineClass.cpp
        @@ -25,9 +25,9 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        -#include "jvmti_tools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
        +#include "jvmti_tools.hpp"
         #include "mlvmJvmtiUtils.hpp"
         
         extern "C" {
        diff --git a/test/hotspot/jtreg/vmTestbase/vm/mlvm/indy/func/jvmti/stepBreakPopReturn/stepBreakPopReturn.cpp b/test/hotspot/jtreg/vmTestbase/vm/mlvm/indy/func/jvmti/stepBreakPopReturn/stepBreakPopReturn.cpp
        index 2358fdd0623..413450892a5 100644
        --- a/test/hotspot/jtreg/vmTestbase/vm/mlvm/indy/func/jvmti/stepBreakPopReturn/stepBreakPopReturn.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/vm/mlvm/indy/func/jvmti/stepBreakPopReturn/stepBreakPopReturn.cpp
        @@ -25,9 +25,9 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        -#include "jvmti_tools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
        +#include "jvmti_tools.hpp"
         #include "mlvmJvmtiUtils.hpp"
         
         extern "C" {
        diff --git a/test/hotspot/jtreg/vmTestbase/vm/mlvm/meth/stress/jni/nativeAndMH/nativeAndMH.cpp b/test/hotspot/jtreg/vmTestbase/vm/mlvm/meth/stress/jni/nativeAndMH/nativeAndMH.cpp
        index 27dfa84dead..7c1f8622e44 100644
        --- a/test/hotspot/jtreg/vmTestbase/vm/mlvm/meth/stress/jni/nativeAndMH/nativeAndMH.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/vm/mlvm/meth/stress/jni/nativeAndMH/nativeAndMH.cpp
        @@ -25,7 +25,7 @@
         #include 
         #include 
         #include "jni.h"
        -#include "jni_tools.h"
        +#include "jni_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/vm/mlvm/share/mlvmJvmtiUtils.cpp b/test/hotspot/jtreg/vmTestbase/vm/mlvm/share/mlvmJvmtiUtils.cpp
        index 5707b40d21f..7f3b149df72 100644
        --- a/test/hotspot/jtreg/vmTestbase/vm/mlvm/share/mlvmJvmtiUtils.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/vm/mlvm/share/mlvmJvmtiUtils.cpp
        @@ -25,9 +25,9 @@
         #include 
         #include 
         #include "jvmti.h"
        -#include "agent_common.h"
        -#include "JVMTITools.h"
        -#include "jvmti_tools.h"
        +#include "agent_common.hpp"
        +#include "JVMTITools.hpp"
        +#include "jvmti_tools.hpp"
         #include "mlvmJvmtiUtils.hpp"
         
         extern "C" {
        diff --git a/test/hotspot/jtreg/vmTestbase/vm/runtime/defmeth/shared/redefineClasses.cpp b/test/hotspot/jtreg/vmTestbase/vm/runtime/defmeth/shared/redefineClasses.cpp
        index eac0d3fe601..530de16c2d4 100644
        --- a/test/hotspot/jtreg/vmTestbase/vm/runtime/defmeth/shared/redefineClasses.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/vm/runtime/defmeth/shared/redefineClasses.cpp
        @@ -25,10 +25,10 @@
         #include 
         #include 
         
        -#include "jni_tools.h"
        -#include "nsk_tools.h"
        -#include "JVMTITools.h"
        -#include "jvmti_tools.h"
        +#include "jni_tools.hpp"
        +#include "nsk_tools.hpp"
        +#include "JVMTITools.hpp"
        +#include "jvmti_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/hotspot/jtreg/vmTestbase/vm/share/ProcessUtils.cpp b/test/hotspot/jtreg/vmTestbase/vm/share/ProcessUtils.cpp
        index c97e7017f4c..c69025fe4c2 100644
        --- a/test/hotspot/jtreg/vmTestbase/vm/share/ProcessUtils.cpp
        +++ b/test/hotspot/jtreg/vmTestbase/vm/share/ProcessUtils.cpp
        @@ -31,7 +31,7 @@
         #include 
         #include 
         #endif /* _WIN32 */
        -#include "jni_tools.h"
        +#include "jni_tools.hpp"
         
         extern "C" {
         
        diff --git a/test/jdk/ProblemList.txt b/test/jdk/ProblemList.txt
        index cd989a0b1a9..c7514d56171 100644
        --- a/test/jdk/ProblemList.txt
        +++ b/test/jdk/ProblemList.txt
        @@ -626,6 +626,7 @@ com/sun/security/sasl/gsskerb/ConfSecurityLayer.java            8039280 generic-
         com/sun/security/sasl/gsskerb/NoSecurityLayer.java              8039280 generic-all
         sun/security/provider/PolicyFile/GrantAllPermToExtWhenNoPolicy.java 8039280 generic-all
         sun/security/provider/PolicyParser/PrincipalExpansionError.java 8039280 generic-all
        +javax/net/ssl/SSLSession/CertMsgCheck.java                      8326705 generic-all
         
         sun/security/pkcs11/sslecc/ClientJSSEServerJSSE.java            8316183 linux-ppc64le
         
        diff --git a/test/jdk/com/sun/tools/attach/FailedLoadAgentTest.java b/test/jdk/com/sun/tools/attach/FailedLoadAgentTest.java
        new file mode 100644
        index 00000000000..d4e15ef6e52
        --- /dev/null
        +++ b/test/jdk/com/sun/tools/attach/FailedLoadAgentTest.java
        @@ -0,0 +1,90 @@
        +/*
        + * Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved.
        + * 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 8325530
        + * @summary Test that failed VirtualMachine.loadAgentPath/loadAgentLibrary reports detailed reason
        + * @requires vm.jvmti
        + * @modules jdk.attach
        + * @library /test/lib
        + * @run driver FailedLoadAgentTest
        + */
        +
        +import java.nio.file.Path;
        +import com.sun.tools.attach.AgentLoadException;
        +import com.sun.tools.attach.VirtualMachine;
        +
        +import jdk.test.lib.Platform;
        +import jdk.test.lib.Utils;
        +import jdk.test.lib.apps.LingeredApp;
        +
        +public class FailedLoadAgentTest {
        +    private static final String jvmtiAgentLib = "FailedLoadAgentTestNotExists";
        +    private static final String jvmtiAgentPath = getLibPath(jvmtiAgentLib);
        +
        +    private static String getLibPath(String libName) {
        +        String fullName = Platform.buildSharedLibraryName(libName);
        +        return Path.of(Utils.TEST_NATIVE_PATH, fullName).toAbsolutePath().toString();
        +    }
        +
        +    private interface TestAction {
        +        void test() throws Exception;
        +    }
        +
        +    private static void test(TestAction action) throws Exception {
        +        try {
        +            action.test();
        +            throw new RuntimeException("AgentLoadException not thrown");
        +        } catch (AgentLoadException ex) {
        +            System.out.println("AgentLoadException thrown as expected:");
        +            ex.printStackTrace(System.out);
        +            String msg = ex.getMessage();
        +            // Attach agent prints general " was not loaded." message on error.
        +            // But additionally we expect detailed message with the reason.
        +            String parts[] = msg.split("was not loaded.");
        +            if (parts.length < 2 || parts[1].isEmpty()) {
        +                throw new RuntimeException("AgentLoadException message is vague");
        +            }
        +        }
        +    }
        +
        +    public static void main(String[] args) throws Exception {
        +        LingeredApp theApp = null;
        +        try {
        +            theApp = new LingeredApp();
        +            LingeredApp.startApp(theApp, "-XX:+EnableDynamicAgentLoading");
        +
        +            VirtualMachine vm = VirtualMachine.attach(Long.toString(theApp.getPid()));
        +
        +            // absolute path
        +            test(() -> vm.loadAgentPath(jvmtiAgentPath));
        +            // relative path
        +            test(() -> vm.loadAgentLibrary(jvmtiAgentLib));
        +
        +        } finally {
        +            LingeredApp.stopApp(theApp);
        +        }
        +    }
        +
        +}
        diff --git a/test/jdk/java/awt/PrintJob/ImageTest/ImageTest.java b/test/jdk/java/awt/PrintJob/ImageTest/ImageTest.java
        new file mode 100644
        index 00000000000..603623819de
        --- /dev/null
        +++ b/test/jdk/java/awt/PrintJob/ImageTest/ImageTest.java
        @@ -0,0 +1,164 @@
        +/*
        + * Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved.
        + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
        + *
        + * This code is free software; you can redistribute it and/or modify it
        + * under the terms of the GNU General Public License version 2 only, as
        + * published by the Free Software Foundation.
        + *
        + * This code is distributed in the hope that it will be useful, but WITHOUT
        + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
        + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
        + * version 2 for more details (a copy is included in the LICENSE file that
        + * accompanied this code).
        + *
        + * You should have received a copy of the GNU General Public License version
        + * 2 along with this work; if not, write to the Free Software Foundation,
        + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
        + *
        + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
        + * or visit www.oracle.com if you need additional information or have any
        + * questions.
        + */
        +
        +import java.awt.Button;
        +import java.awt.Color;
        +import java.awt.Dimension;
        +import java.awt.FlowLayout;
        +import java.awt.Frame;
        +import java.awt.Graphics;
        +import java.awt.Graphics2D;
        +import java.awt.Image;
        +import java.awt.PrintJob;
        +import java.awt.Toolkit;
        +import java.awt.image.BufferedImage;
        +import java.awt.print.PrinterJob;
        +import java.io.File;
        +import java.io.IOException;
        +import javax.imageio.ImageIO;
        +
        +/*
        + * @test
        + * @bug 4242308 4255603
        + * @key printer
        + * @library /java/awt/regtesthelpers
        + * @build PassFailJFrame
        + * @summary Tests printing of images
        + * @run main/manual ImageTest
        + */
        +public final class ImageTest {
        +
        +    private static final class ImageFrame extends Frame {
        +        final Image img;
        +        PrintJob pjob;
        +
        +        private ImageFrame() {
        +            super("ImageFrame");
        +            img = getToolkit().getImage("image.gif");
        +        }
        +
        +        @Override
        +        public void paint(Graphics g) {
        +            int width = img.getWidth(this);
        +            int height = img.getHeight(this);
        +            if (pjob != null) {
        +                System.out.println("Size " + pjob.getPageDimension());
        +                Dimension dim = pjob.getPageDimension();
        +                if (width > dim.width) {
        +                    width = dim.width - 30; // take care of paper margin
        +                }
        +                if (height > dim.height) {
        +                    height = dim.height - 30;
        +                }
        +            }
        +            g.drawImage(img, 10, 75, width, height, this);
        +        }
        +
        +        private void setPrintJob(PrintJob pj) {
        +            pjob = pj;
        +        }
        +
        +        @Override
        +        public boolean imageUpdate(Image img, int infoflags,
        +                                   int x, int y, int w, int h) {
        +            if ((infoflags & ALLBITS) != 0) {
        +                repaint();
        +                return false;
        +            }
        +            return true;
        +        }
        +    }
        +
        +    private static Frame init() {
        +        ImageFrame f = new ImageFrame();
        +        f.setLayout(new FlowLayout());
        +        Button b = new Button("Print");
        +        b.addActionListener(e -> {
        +            PrintJob pj = Toolkit.getDefaultToolkit()
        +                    .getPrintJob(f, "ImageTest", null);
        +            if (pj != null) {
        +                f.setPrintJob(pj);
        +                Graphics pg = pj.getGraphics();
        +                f.paint(pg);
        +                pg.dispose();
        +                pj.end();
        +            }
        +        });
        +        f.add(b);
        +        f.setSize(700, 350);
        +
        +        return f;
        +    }
        +
        +    private static void createImage() throws IOException {
        +        final BufferedImage bufferedImage =
        +                new BufferedImage(600, 230, BufferedImage.TYPE_INT_RGB);
        +        Graphics2D g2d = bufferedImage.createGraphics();
        +
        +        g2d.setColor(new Color(0xE7E7E7));
        +        g2d.fillRect(0, 0, bufferedImage.getWidth(), bufferedImage.getHeight());
        +
        +        g2d.setColor(Color.YELLOW);
        +        g2d.fillRect(0, 6, 336, 40);
        +        g2d.setColor(Color.BLACK);
        +        g2d.drawString("Yellow rectangle", 10, 30);
        +
        +        g2d.setColor(Color.CYAN);
        +        g2d.fillRect(132, 85, 141, 138);
        +        g2d.setColor(Color.BLACK);
        +        g2d.drawString("Cyan rectangle", 142, 148);
        +
        +        g2d.setColor(Color.MAGENTA);
        +        g2d.fillRect(432, 85, 141, 138);
        +        g2d.setColor(Color.BLACK);
        +        g2d.drawString("Magenta rectangle", 442, 148);
        +
        +        g2d.dispose();
        +
        +        ImageIO.write(bufferedImage, "gif", new File("image.gif"));
        +    }
        +
        +    private static final String INSTRUCTIONS = """
        +             Click the Print button on the Frame. Select a printer from the
        +             print dialog and click 'OK'. Verify that the image displayed
        +             in the Frame is correctly printed. Test printing in both Color
        +             and Monochrome.
        +            """;
        +
        +    public static void main(String[] args) throws Exception {
        +
        +        if (PrinterJob.lookupPrintServices().length == 0) {
        +            throw new RuntimeException("Printer not configured or available.");
        +        }
        +
        +        createImage();
        +
        +        PassFailJFrame.builder()
        +                .instructions(INSTRUCTIONS)
        +                .rows((int) INSTRUCTIONS.lines().count() + 1)
        +                .columns(45)
        +                .testUI(ImageTest::init)
        +                .build()
        +                .awaitAndCheck();
        +    }
        +}
        diff --git a/test/jdk/java/awt/print/PrinterJob/PrintLatinCJKTest.java b/test/jdk/java/awt/print/PrinterJob/PrintLatinCJKTest.java
        index 5ffb34540ce..8ffe5fc9310 100644
        --- a/test/jdk/java/awt/print/PrinterJob/PrintLatinCJKTest.java
        +++ b/test/jdk/java/awt/print/PrinterJob/PrintLatinCJKTest.java
        @@ -1,5 +1,5 @@
         /*
        - * Copyright (c) 2013, 2023, Oracle and/or its affiliates. All rights reserved.
        + * Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved.
          * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
          *
          * This code is free software; you can redistribute it and/or modify it
        @@ -31,7 +31,6 @@
          * @run main/manual PrintLatinCJKTest
          */
         
        -import java.awt.BorderLayout;
         import java.awt.Font;
         import java.awt.Graphics;
         import java.awt.print.PageFormat;
        @@ -39,51 +38,57 @@
         import java.awt.print.PrinterException;
         import java.awt.print.PrinterJob;
         import java.lang.reflect.InvocationTargetException;
        -import javax.swing.JButton;
        -import javax.swing.JFrame;
         
        -import static javax.swing.SwingUtilities.invokeAndWait;
        +import javax.swing.BorderFactory;
        +import javax.swing.Box;
        +import javax.swing.JButton;
        +import javax.swing.JComponent;
        +import javax.swing.JOptionPane;
         
         public class PrintLatinCJKTest implements Printable {
         
        -    private static PrintLatinCJKTest testInstance = new PrintLatinCJKTest();
        -    private static JFrame frame;
        -    private static final String info = """
        -            You need a printer for this test. If you have none, let
        -            the test pass. If there is a printer, press Print, send
        -            the output to the printer, and examine it. It should have
        -            text looking like this : \u4e00\u4e01\u4e02\u4e03\u4e04English
        +    private static final String TEXT = "\u4e00\u4e01\u4e02\u4e03\u4e04English";
        +
        +    private static final String INFO = """
        +            Press Print, send the output to the printer and examine it.
        +            The printout should have text looking like this:
        +
        +            """
        +            + TEXT + """
        +
        +
        +            Press Pass if the text is printed correctly.
        +            If Japanese and English text overlap, press Fail.
        +
         
                     To test 8022536, if a remote printer is the system default,
                     it should show in the dialog as the selected printer.
                     """;
         
        -    public static void showFrame() throws InterruptedException, InvocationTargetException {
        -        invokeAndWait( () -> {
        -            frame = new JFrame("Test Frame");
        -            JButton b = new JButton("Print");
        -            b.addActionListener((ae) -> {
        -                try {
        -                    PrinterJob job = PrinterJob.getPrinterJob();
        -                    job.setPrintable(testInstance);
        -                    if (job.printDialog()) {
        -                        job.print();
        -                    }
        -                } catch (PrinterException ex) {
        -                    ex.printStackTrace();
        +    private static JComponent createTestUI() {
        +        JButton b = new JButton("Print");
        +        b.addActionListener((ae) -> {
        +            try {
        +                PrinterJob job = PrinterJob.getPrinterJob();
        +                job.setPrintable(new PrintLatinCJKTest());
        +                if (job.printDialog()) {
        +                    job.print();
                         }
        -            });
        -            frame.getContentPane().add(b, BorderLayout.SOUTH);
        -            frame.pack();
        -
        -            // add the test frame to dispose
        -            PassFailJFrame.addTestWindow(frame);
        -
        -            // Arrange the test instruction frame and test frame side by side
        -            PassFailJFrame.positionTestWindow(frame,
        -                    PassFailJFrame.Position.HORIZONTAL);
        -            frame.setVisible(true);
        +            } catch (PrinterException ex) {
        +                ex.printStackTrace();
        +                String msg = "PrinterException: " + ex.getMessage();
        +                JOptionPane.showMessageDialog(b, msg, "Error occurred",
        +                                              JOptionPane.ERROR_MESSAGE);
        +                PassFailJFrame.forceFail(msg);
        +            }
                 });
        +
        +        Box main = Box.createHorizontalBox();
        +        main.setBorder(BorderFactory.createEmptyBorder(8, 8, 8, 8));
        +        main.add(Box.createHorizontalGlue());
        +        main.add(b);
        +        main.add(Box.createHorizontalGlue());
        +        return main;
             }
         
             @Override
        @@ -93,22 +98,24 @@ public int print(Graphics g, PageFormat pf, int pageIndex)
                     return Printable.NO_SUCH_PAGE;
                 }
                 g.translate((int) pf.getImageableX(), (int) pf.getImageableY());
        -        g.setFont(new Font("Dialog", Font.PLAIN, 36));
        -        g.drawString("\u4e00\u4e01\u4e02\u4e03\u4e04English", 20, 100);
        +        g.setFont(new Font(Font.DIALOG, Font.PLAIN, 36));
        +        g.drawString(TEXT, 20, 100);
                 return Printable.PAGE_EXISTS;
             }
         
             public static void main(String[] args) throws InterruptedException, InvocationTargetException {
        -        PassFailJFrame passFailJFrame = new PassFailJFrame.Builder()
        -                .title("Test Instructions Frame")
        -                .instructions(info)
        -                .testTimeOut(10)
        -                .rows(10)
        -                .columns(45)
        -                .build();
        -        showFrame();
        -        passFailJFrame.awaitAndCheck();
        +        if (PrinterJob.lookupPrintServices().length == 0) {
        +            throw new RuntimeException("Printer not configured or available.");
        +        }
        +
        +        PassFailJFrame.builder()
        +                      .title("Print Latin CJK Test")
        +                      .instructions(INFO)
        +                      .testTimeOut(10)
        +                      .rows(12)
        +                      .columns(30)
        +                      .splitUI(PrintLatinCJKTest::createTestUI)
        +                      .build()
        +                      .awaitAndCheck();
             }
         }
        -
        -
        diff --git a/test/jdk/java/foreign/enablenativeaccess/org/openjdk/foreigntest/unnamed/libLinkerInvokerUnnamed.cpp b/test/jdk/java/foreign/enablenativeaccess/org/openjdk/foreigntest/unnamed/libLinkerInvokerUnnamed.cpp
        index cc8469cc68f..0bead404098 100644
        --- a/test/jdk/java/foreign/enablenativeaccess/org/openjdk/foreigntest/unnamed/libLinkerInvokerUnnamed.cpp
        +++ b/test/jdk/java/foreign/enablenativeaccess/org/openjdk/foreigntest/unnamed/libLinkerInvokerUnnamed.cpp
        @@ -22,7 +22,7 @@
          */
         
         #include "jni.h"
        -#include "testlib_threads.h"
        +#include "testlib_threads.hpp"
         
         void call(void* ctxt) {
             JavaVM* jvm = (JavaVM*) ctxt;
        diff --git a/test/jdk/java/foreign/enablenativeaccess/panama_module/org/openjdk/foreigntest/libLinkerInvokerModule.cpp b/test/jdk/java/foreign/enablenativeaccess/panama_module/org/openjdk/foreigntest/libLinkerInvokerModule.cpp
        index 7056d702209..4591d7a506a 100644
        --- a/test/jdk/java/foreign/enablenativeaccess/panama_module/org/openjdk/foreigntest/libLinkerInvokerModule.cpp
        +++ b/test/jdk/java/foreign/enablenativeaccess/panama_module/org/openjdk/foreigntest/libLinkerInvokerModule.cpp
        @@ -22,7 +22,7 @@
          */
         
         #include "jni.h"
        -#include "testlib_threads.h"
        +#include "testlib_threads.hpp"
         
         typedef struct {
            JavaVM* jvm;
        diff --git a/test/jdk/java/foreign/libAsyncInvokers.cpp b/test/jdk/java/foreign/libAsyncInvokers.cpp
        index e7d48cbfbca..a2ac3b07a58 100644
        --- a/test/jdk/java/foreign/libAsyncInvokers.cpp
        +++ b/test/jdk/java/foreign/libAsyncInvokers.cpp
        @@ -1,5 +1,5 @@
         /*
        - * Copyright (c) 2021, 2022, Oracle and/or its affiliates. All rights reserved.
        + * Copyright (c) 2021, 2024, Oracle and/or its affiliates. All rights reserved.
          * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
          *
          * This code is free software; you can redistribute it and/or modify it
        @@ -21,7 +21,7 @@
          * questions.
          */
         
        -#include "testlib_threads.h"
        +#include "testlib_threads.hpp"
         
         #include "shared.h"
         
        diff --git a/test/jdk/java/foreign/loaderLookup/libLoaderLookupInvoker.cpp b/test/jdk/java/foreign/loaderLookup/libLoaderLookupInvoker.cpp
        index 607588cd56c..fff6f80239d 100644
        --- a/test/jdk/java/foreign/loaderLookup/libLoaderLookupInvoker.cpp
        +++ b/test/jdk/java/foreign/loaderLookup/libLoaderLookupInvoker.cpp
        @@ -22,7 +22,7 @@
          */
         
         #include "jni.h"
        -#include "testlib_threads.h"
        +#include "testlib_threads.hpp"
         
         struct Context {
             JavaVM* jvm;
        diff --git a/test/jdk/java/foreign/stackwalk/libAsyncStackWalk.cpp b/test/jdk/java/foreign/stackwalk/libAsyncStackWalk.cpp
        index 568cd8402d7..5461966d055 100644
        --- a/test/jdk/java/foreign/stackwalk/libAsyncStackWalk.cpp
        +++ b/test/jdk/java/foreign/stackwalk/libAsyncStackWalk.cpp
        @@ -1,5 +1,5 @@
         /*
        - * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved.
        + * Copyright (c) 2021, 2024, Oracle and/or its affiliates. All rights reserved.
          * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
          *
          * This code is free software; you can redistribute it and/or modify it
        @@ -21,7 +21,7 @@
          * questions.
          */
         
        -#include "testlib_threads.h"
        +#include "testlib_threads.hpp"
         
         #ifdef _WIN64
         #define EXPORT __declspec(dllexport)
        diff --git a/test/jdk/java/lang/Thread/virtual/stress/GetStackTraceALotWhenPinned.java b/test/jdk/java/lang/Thread/virtual/stress/GetStackTraceALotWhenPinned.java
        index e00cf89fb8c..35986718a38 100644
        --- a/test/jdk/java/lang/Thread/virtual/stress/GetStackTraceALotWhenPinned.java
        +++ b/test/jdk/java/lang/Thread/virtual/stress/GetStackTraceALotWhenPinned.java
        @@ -43,6 +43,7 @@
         import java.util.concurrent.atomic.AtomicInteger;
         import java.util.concurrent.locks.LockSupport;
         import jdk.test.lib.thread.VThreadRunner;
        +import jdk.test.lib.thread.VThreadPinner;
         
         public class GetStackTraceALotWhenPinned {
         
        @@ -65,13 +66,14 @@ public static void main(String[] args) throws Exception {
                         barrier.await();
         
                         Thread.yield();
        -                synchronized (GetStackTraceALotWhenPinned.class) {
        -                    if (timed) {
        +                boolean b = timed;
        +                VThreadPinner.runPinned(() -> {
        +                    if (b) {
                                 LockSupport.parkNanos(Long.MAX_VALUE);
                             } else {
                                 LockSupport.park();
                             }
        -                }
        +                });
                         timed = !timed;
                     }
                 });
        diff --git a/test/jdk/java/lang/instrument/GetObjectSizeIntrinsicsTest.java b/test/jdk/java/lang/instrument/GetObjectSizeIntrinsicsTest.java
        index fc3b1a66d2a..22c5069f3e7 100644
        --- a/test/jdk/java/lang/instrument/GetObjectSizeIntrinsicsTest.java
        +++ b/test/jdk/java/lang/instrument/GetObjectSizeIntrinsicsTest.java
        @@ -1,5 +1,5 @@
         /*
        - * Copyright (c) 2020, 2022, Red Hat, Inc. All rights reserved.
        + * Copyright (c) 2020, 2024, 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
        @@ -313,6 +313,9 @@ public class GetObjectSizeIntrinsicsTest extends ASimpleInstrumentationTestCase
             static final int LARGE_INT_ARRAY_SIZE = 1024*1024*1024 + 1024;
             static final int LARGE_OBJ_ARRAY_SIZE = (4096/(int)REF_SIZE)*1024*1024 + 1024;
         
        +    static final boolean CCP = WhiteBox.getWhiteBox().getBooleanVMFlag("UseCompressedClassPointers");
        +    static final int ARRAY_HEADER_SIZE = CCP ? 16 : (Platform.is64bit() ? 20 : 16);
        +
             final String mode;
         
             public GetObjectSizeIntrinsicsTest(String name, String mode) {
        @@ -396,7 +399,7 @@ private void testSize_fieldObject() {
             }
         
             private void testSize_newSmallIntArray() {
        -        long expected = roundUp(4L*SMALL_ARRAY_SIZE + 16, OBJ_ALIGN);
        +        long expected = roundUp(4L*SMALL_ARRAY_SIZE + ARRAY_HEADER_SIZE, OBJ_ALIGN);
                 for (int c = 0; c < ITERS; c++) {
                     assertEquals(expected, fInst.getObjectSize(new int[SMALL_ARRAY_SIZE]));
                 }
        @@ -404,7 +407,7 @@ private void testSize_newSmallIntArray() {
         
             private void testSize_localSmallIntArray() {
                 int[] arr = new int[SMALL_ARRAY_SIZE];
        -        long expected = roundUp(4L*SMALL_ARRAY_SIZE + 16, OBJ_ALIGN);
        +        long expected = roundUp(4L*SMALL_ARRAY_SIZE + ARRAY_HEADER_SIZE, OBJ_ALIGN);
                 for (int c = 0; c < ITERS; c++) {
                     assertEquals(expected, fInst.getObjectSize(arr));
                 }
        @@ -413,14 +416,14 @@ private void testSize_localSmallIntArray() {
             static int[] smallArr = new int[SMALL_ARRAY_SIZE];
         
             private void testSize_fieldSmallIntArray() {
        -        long expected = roundUp(4L*SMALL_ARRAY_SIZE + 16, OBJ_ALIGN);
        +        long expected = roundUp(4L*SMALL_ARRAY_SIZE + ARRAY_HEADER_SIZE, OBJ_ALIGN);
                 for (int c = 0; c < ITERS; c++) {
                     assertEquals(expected, fInst.getObjectSize(smallArr));
                 }
             }
         
             private void testSize_newSmallObjArray() {
        -        long expected = roundUp(REF_SIZE*SMALL_ARRAY_SIZE + 16, OBJ_ALIGN);
        +        long expected = roundUp(REF_SIZE*SMALL_ARRAY_SIZE + ARRAY_HEADER_SIZE, OBJ_ALIGN);
                 for (int c = 0; c < ITERS; c++) {
                     assertEquals(expected, fInst.getObjectSize(new Object[SMALL_ARRAY_SIZE]));
                 }
        @@ -428,7 +431,7 @@ private void testSize_newSmallObjArray() {
         
             private void testSize_localSmallObjArray() {
                 Object[] arr = new Object[SMALL_ARRAY_SIZE];
        -        long expected = roundUp(REF_SIZE*SMALL_ARRAY_SIZE + 16, OBJ_ALIGN);
        +        long expected = roundUp(REF_SIZE*SMALL_ARRAY_SIZE + ARRAY_HEADER_SIZE, OBJ_ALIGN);
                 for (int c = 0; c < ITERS; c++) {
                     assertEquals(expected, fInst.getObjectSize(arr));
                 }
        @@ -437,7 +440,7 @@ private void testSize_localSmallObjArray() {
             static Object[] smallObjArr = new Object[SMALL_ARRAY_SIZE];
         
             private void testSize_fieldSmallObjArray() {
        -        long expected = roundUp(REF_SIZE*SMALL_ARRAY_SIZE + 16, OBJ_ALIGN);
        +        long expected = roundUp(REF_SIZE*SMALL_ARRAY_SIZE + ARRAY_HEADER_SIZE, OBJ_ALIGN);
                 for (int c = 0; c < ITERS; c++) {
                     assertEquals(expected, fInst.getObjectSize(smallObjArr));
                 }
        @@ -445,7 +448,7 @@ private void testSize_fieldSmallObjArray() {
         
             private void testSize_localLargeIntArray() {
                 int[] arr = new int[LARGE_INT_ARRAY_SIZE];
        -        long expected = roundUp(4L*LARGE_INT_ARRAY_SIZE + 16, OBJ_ALIGN);
        +        long expected = roundUp(4L*LARGE_INT_ARRAY_SIZE + ARRAY_HEADER_SIZE, OBJ_ALIGN);
                 for (int c = 0; c < ITERS; c++) {
                     assertEquals(expected, fInst.getObjectSize(arr));
                 }
        @@ -453,7 +456,7 @@ private void testSize_localLargeIntArray() {
         
             private void testSize_localLargeObjArray() {
                 Object[] arr = new Object[LARGE_OBJ_ARRAY_SIZE];
        -        long expected = roundUp(REF_SIZE*LARGE_OBJ_ARRAY_SIZE + 16, OBJ_ALIGN);
        +        long expected = roundUp(REF_SIZE*LARGE_OBJ_ARRAY_SIZE + ARRAY_HEADER_SIZE, OBJ_ALIGN);
                 for (int c = 0; c < ITERS; c++) {
                     assertEquals(expected, fInst.getObjectSize(arr));
                 }
        diff --git a/test/jdk/java/nio/file/Files/CopyMoveVariations.java b/test/jdk/java/nio/file/Files/CopyMoveVariations.java
        index b55c1e508fb..e206448adbc 100644
        --- a/test/jdk/java/nio/file/Files/CopyMoveVariations.java
        +++ b/test/jdk/java/nio/file/Files/CopyMoveVariations.java
        @@ -1,5 +1,5 @@
         /*
        - * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved.
        + * Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved.
          * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
          *
          * This code is free software; you can redistribute it and/or modify it
        @@ -70,17 +70,17 @@ enum PathType {
             private static final boolean SUPPORTS_POSIX_PERMISSIONS;
         
             static {
        -        Path tmp = null;
        +        Path currentDir = null;
                 try {
        -            tmp = Files.createTempFile("this", "that");
        +            currentDir = Files.createTempFile(Path.of("."), "this", "that");
                     SUPPORTS_POSIX_PERMISSIONS =
        -                Files.getFileStore(tmp).supportsFileAttributeView("posix");
        +                Files.getFileStore(currentDir).supportsFileAttributeView("posix");
                 } catch (IOException cause) {
                     throw new UncheckedIOException(cause);
                 } finally {
        -            if (tmp != null) {
        +            if (currentDir != null) {
                         try {
        -                    Files.delete(tmp);
        +                    Files.delete(currentDir);
                         } catch (IOException ignore)  {
                         }
                     }
        @@ -142,14 +142,15 @@ void op(OpType op, PathType type, String mode, boolean replaceExisting,
                 Path source = null;
                 Path target = null;
                 Path linkTarget = null;
        +        Path currentDir = Path.of(".");
                 try {
                     switch (type) {
                         case FILE ->
        -                    source = Files.createTempFile("file", "dat");
        +                    source = Files.createTempFile(currentDir, "file", "dat");
                         case DIR ->
        -                    source = Files.createTempDirectory("dir");
        +                    source = Files.createTempDirectory(currentDir, "dir");
                         case LINK -> {
        -                    linkTarget = Files.createTempFile("link", "target");
        +                    linkTarget = Files.createTempFile(currentDir, "link", "target");
                             Path link = Path.of("link");
                             source = Files.createSymbolicLink(link, linkTarget);
                         }
        @@ -163,7 +164,7 @@ void op(OpType op, PathType type, String mode, boolean replaceExisting,
                         Files.setPosixFilePermissions(source, perms);
         
                     if (targetExists)
        -                target = Files.createTempFile("file", "target");
        +                target = Files.createTempFile(currentDir, "file", "target");
                     else
                         target = Path.of("target");
         
        diff --git a/test/jdk/java/text/Format/ChoiceFormat/PatternsTest.java b/test/jdk/java/text/Format/ChoiceFormat/PatternsTest.java
        index 82cf256b70b..8fd8d42ef51 100644
        --- a/test/jdk/java/text/Format/ChoiceFormat/PatternsTest.java
        +++ b/test/jdk/java/text/Format/ChoiceFormat/PatternsTest.java
        @@ -23,7 +23,7 @@
         
         /*
          * @test
        - * @bug 6285888 6801704
        + * @bug 6285888 6801704 8325898
          * @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
        @@ -31,14 +31,13 @@
          * @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 java.text.ChoiceFormat;
        +
         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;
        @@ -97,6 +96,7 @@ public void invalidPatternsThrowsTest(String pattern, String errMsg) {
             // an exception.
             private static Arguments[] invalidPatternsThrowsTest() {
                 return new Arguments[] {
        +                arguments("#", ERR1), // Only relation
                         arguments("#foo", ERR1), // No Limit
                         arguments("0#foo|#|1#bar", ERR1), // Missing Relation in SubPattern
                         arguments("#|", ERR1), // Missing Limit
        @@ -127,11 +127,20 @@ public void invalidPatternsDiscardedTest(String brokenPattern, String actualPatt
             // after discarding occurs.
             private static Arguments[] invalidPatternsDiscardedTest() {
                 return new Arguments[] {
        +                // Incomplete SubPattern (limit only) at end of Pattern
        +                arguments("1#bar|2", "1#bar"),
                         // Incomplete SubPattern at the end of the Pattern
                         arguments("0#foo|1#bar|baz", "0#foo|1#bar"),
        +                // Incomplete SubPattern with trailing | at the end of the Pattern
        +                // Prior to 6801704, it created the broken "0#foo|1#bar|1#"
        +                // which caused formatting 1 to return an empty string
        +                arguments("0#foo|1#bar|baz|", "0#foo|1#bar"),
        +                // Same as previous, with additional incomplete subPatterns
        +                arguments("0#foo|1#bar|baz|quux", "0#foo|1#bar"),
         
                         // --- These throw an ArrayIndexOutOfBoundsException
        -                // when attempting to format with them ---
        +                // when attempting to format with them as the incomplete patterns
        +                // are discarded, initializing the cFmt with empty limits and formats ---
                         // SubPattern with only a Limit (which is interpreted as a Format)
                         arguments("0", ""),
                         // SubPattern with only a Format
        diff --git a/test/jdk/java/text/Format/MessageFormat/CompactSubFormats.java b/test/jdk/java/text/Format/MessageFormat/CompactSubFormats.java
        new file mode 100644
        index 00000000000..f4b12a14fcc
        --- /dev/null
        +++ b/test/jdk/java/text/Format/MessageFormat/CompactSubFormats.java
        @@ -0,0 +1,91 @@
        +/*
        + * Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved.
        + * 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 8318761
        + * @summary Test MessageFormatPattern ability to recognize and produce
        + *          appropriate FormatType and FormatStyle for CompactNumberFormat.
        + * @run junit CompactSubFormats
        + */
        +
        +import java.text.CompactNumberFormat;
        +import java.text.DecimalFormat;
        +import java.text.DecimalFormatSymbols;
        +import java.text.MessageFormat;
        +import java.text.NumberFormat;
        +import java.util.Locale;
        +
        +import org.junit.jupiter.api.Test;
        +
        +import static org.junit.jupiter.api.Assertions.assertEquals;
        +
        +public class CompactSubFormats {
        +
        +    // Ensure the built-in FormatType and FormatStyles for cnFmt are as expected
        +    @Test
        +    public void applyPatternTest() {
        +        var mFmt = new MessageFormat(
        +                "{0,number,compact_short}{1,number,compact_long}");
        +        var compactShort = NumberFormat.getCompactNumberInstance(
        +                mFmt.getLocale(), NumberFormat.Style.SHORT);
        +        var compactLong = NumberFormat.getCompactNumberInstance(
        +                mFmt.getLocale(), NumberFormat.Style.LONG);
        +        assertEquals(mFmt.getFormatsByArgumentIndex()[0], compactShort);
        +        assertEquals(mFmt.getFormatsByArgumentIndex()[1], compactLong);
        +    }
        +
        +    // Ensure that only 'compact_short' and 'compact_long' are recognized as
        +    // compact number modifiers. All other compact_XX should be interpreted as
        +    // a subformatPattern for a DecimalFormat
        +    @Test
        +    public void recognizedCompactStylesTest() {
        +        // An exception won't be thrown since 'compact_regular' will be interpreted as a
        +        // subformatPattern.
        +        assertEquals(new DecimalFormat("compact_regular"),
        +                new MessageFormat("{0,number,compact_regular}").getFormatsByArgumentIndex()[0]);
        +    }
        +
        +    // SHORT and LONG CompactNumberFormats should produce correct patterns
        +    @Test
        +    public void toPatternTest() {
        +        var mFmt = new MessageFormat("{0}{1}");
        +        mFmt.setFormatByArgumentIndex(0, NumberFormat.getCompactNumberInstance(
        +                mFmt.getLocale(), NumberFormat.Style.SHORT));
        +        mFmt.setFormatByArgumentIndex(1, NumberFormat.getCompactNumberInstance(
        +                mFmt.getLocale(), NumberFormat.Style.LONG));
        +        assertEquals("{0,number,compact_short}{1,number,compact_long}", mFmt.toPattern());
        +    }
        +
        +    // A custom cnFmt cannot be recognized, thus does not produce any built-in pattern
        +    @Test
        +    public void badToPatternTest() {
        +        var mFmt = new MessageFormat("{0}");
        +        // Non-recognizable compactNumberFormat
        +        mFmt.setFormatByArgumentIndex(0, new CompactNumberFormat("",
        +                        DecimalFormatSymbols.getInstance(Locale.US), new String[]{""}));
        +        // Default behavior of unrecognizable Formats is a FormatElement
        +        // in the form of { ArgumentIndex }
        +        assertEquals("{0}", mFmt.toPattern());
        +    }
        +}
        diff --git a/test/jdk/java/text/Format/MessageFormat/ListSubFormats.java b/test/jdk/java/text/Format/MessageFormat/ListSubFormats.java
        new file mode 100644
        index 00000000000..598239ef5ef
        --- /dev/null
        +++ b/test/jdk/java/text/Format/MessageFormat/ListSubFormats.java
        @@ -0,0 +1,98 @@
        +/*
        + * Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved.
        + * 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 8318761
        + * @summary Test MessageFormatPattern ability to recognize and produce the
        + *          appropriate FormatType and FormatStyle for ListFormat. ListFormat's
        + *          STANDARD, OR, and UNIT types are supported as built-in patterns for
        + *          MessageFormat. All types use the FULL style.
        + * @run junit ListSubFormats
        + */
        +
        +import java.text.ListFormat;
        +import java.text.MessageFormat;
        +
        +import org.junit.jupiter.api.Test;
        +
        +import static org.junit.jupiter.api.Assertions.assertEquals;
        +import static org.junit.jupiter.api.Assertions.assertThrows;
        +
        +public class ListSubFormats {
        +
        +    // Recognize the 'list' FormatType as well as '', 'or', and
        +    // 'unit' associated FormatStyles
        +    @Test
        +    public void applyPatternTest() {
        +        var mFmt = new MessageFormat("{0,list}{1,list,or}{2,list,unit}");
        +        var listStandard = ListFormat.getInstance(mFmt.getLocale(),
        +                ListFormat.Type.STANDARD, ListFormat.Style.FULL);
        +        var listOr = ListFormat.getInstance(mFmt.getLocale(),
        +                ListFormat.Type.OR, ListFormat.Style.FULL);
        +        var listUnit = ListFormat.getInstance(mFmt.getLocale(),
        +                ListFormat.Type.UNIT, ListFormat.Style.FULL);
        +        assertEquals(mFmt.getFormatsByArgumentIndex()[0], listStandard);
        +        assertEquals(mFmt.getFormatsByArgumentIndex()[1], listOr);
        +        assertEquals(mFmt.getFormatsByArgumentIndex()[2], listUnit);
        +    }
        +
        +    // Ensure incorrect FormatElement pattern throws IAE
        +    // java.text.ListFormat does not support String subformatPatterns
        +    @Test
        +    public void badApplyPatternTest() {
        +        // Wrong FormatStyle
        +        IllegalArgumentException exc = assertThrows(IllegalArgumentException.class, () ->
        +                new MessageFormat("{0,list,standard}"));
        +        assertEquals("Unexpected modifier for List: standard", exc.getMessage());
        +
        +        // Wrong FormatType
        +        exc = assertThrows(IllegalArgumentException.class, () ->
        +                new MessageFormat("{0,listt,or}"));
        +        assertEquals("unknown format type: listt", exc.getMessage());
        +
        +    }
        +
        +    // STANDARD, OR, UNIT ListFormats (with FULL style) should
        +    // produce correct patterns.
        +    @Test
        +    public void toPatternTest() {
        +        var mFmt = new MessageFormat("{0}{1}{2}");
        +        mFmt.setFormatByArgumentIndex(0,
        +                ListFormat.getInstance(mFmt.getLocale(), ListFormat.Type.STANDARD, ListFormat.Style.FULL));
        +        mFmt.setFormatByArgumentIndex(1,
        +                ListFormat.getInstance(mFmt.getLocale(), ListFormat.Type.OR, ListFormat.Style.FULL));
        +        mFmt.setFormatByArgumentIndex(2,
        +                ListFormat.getInstance(mFmt.getLocale(), ListFormat.Type.UNIT, ListFormat.Style.FULL));
        +        assertEquals("{0,list}{1,list,or}{2,list,unit}", mFmt.toPattern());
        +    }
        +
        +    // A custom ListFormat cannot be recognized, thus does not produce any built-in pattern
        +    @Test
        +    public void badToPatternTest() {
        +        var mFmt = new MessageFormat("{0}");
        +        mFmt.setFormatByArgumentIndex(0,
        +                ListFormat.getInstance(mFmt.getLocale(), ListFormat.Type.UNIT, ListFormat.Style.NARROW));
        +        assertEquals("{0}", mFmt.toPattern());
        +    }
        +}
        diff --git a/test/jdk/java/text/Format/MessageFormat/MessageFormatExceptions.java b/test/jdk/java/text/Format/MessageFormat/MessageFormatExceptions.java
        index f28c3170e71..276f49a07d7 100644
        --- a/test/jdk/java/text/Format/MessageFormat/MessageFormatExceptions.java
        +++ b/test/jdk/java/text/Format/MessageFormat/MessageFormatExceptions.java
        @@ -24,7 +24,7 @@
         /*
          * @test
          * @summary Validate some exceptions in MessageFormat
        - * @bug 6481179 8039165
        + * @bug 6481179 8039165 8318761
          * @run junit MessageFormatExceptions
          */
         
        @@ -39,6 +39,15 @@
         
         public class MessageFormatExceptions {
         
        +    // Any exception for a Subformat should be re-thrown as propagated as an IAE
        +    // to the MessageFormat
        +    @Test
        +    public void rethrowAsIAE() {
        +        // Same Subformat pattern for ChoiceFormat throws NumberFormatException
        +        assertThrows(IllegalArgumentException.class,
        +                () -> new MessageFormat("{0,choice,0foo#foo}"));
        +    }
        +
             // MessageFormat should throw NPE when constructed with a null pattern
             @Test
             public void nullPatternTest() {
        @@ -57,6 +66,9 @@ public void nullLocaleTest() {
                 // Fails when constructor invokes applyPattern()
                 assertThrows(NullPointerException.class,
                         () -> new MessageFormat("{0, date}", null));
        +        // Same as above, but with Subformat pattern
        +        assertThrows(NullPointerException.class,
        +                () -> new MessageFormat("{0, date,dd}", null));
                 // Fail when constructor invokes applyPattern()
                 assertThrows(NullPointerException.class,
                         () -> new MessageFormat("{0, number}", null));
        diff --git a/test/jdk/java/text/Format/MessageFormat/TemporalSubFormats.java b/test/jdk/java/text/Format/MessageFormat/TemporalSubFormats.java
        new file mode 100644
        index 00000000000..c8572551a8d
        --- /dev/null
        +++ b/test/jdk/java/text/Format/MessageFormat/TemporalSubFormats.java
        @@ -0,0 +1,204 @@
        +/*
        + * Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved.
        + * 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 8318761
        + * @summary Test MessageFormatPattern ability to recognize the appropriate
        + *          FormatType and FormatStyle for DateTimeFormatter(ClassicFormat).
        + *          This includes the types dtf_time, dtf_date, dtf_datetime,
        + *          and the DateTimeFormatter predefined formatters.
        + * @run junit TemporalSubFormats
        + */
        +
        +import java.text.Format;
        +import java.text.MessageFormat;
        +import java.time.Instant;
        +import java.time.LocalDate;
        +import java.time.LocalDateTime;
        +import java.time.LocalTime;
        +import java.time.OffsetDateTime;
        +import java.time.ZonedDateTime;
        +import java.time.format.DateTimeFormatter;
        +import java.time.format.FormatStyle;
        +import java.util.stream.Stream;
        +
        +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;
        +
        +public class TemporalSubFormats {
        +
        +    // Check that applying the built-in DateTimeFormatter types returns the
        +    // correct Format and formats properly. Patterns are case-insensitive
        +    @ParameterizedTest
        +    @MethodSource("preDefinedTypes")
        +    public void preDefinedPatternsTest(String pattern, Format fmt) {
        +        var mFmt = new MessageFormat("quux{0,"+pattern+"}quux");
        +        Object[] temporals = new Object[]{LocalDate.now(), LocalTime.now(),
        +                ZonedDateTime.now(), LocalDateTime.now(), OffsetDateTime.now(), Instant.now()};
        +        for (Object val : temporals) {
        +            // Wrap in Object array for MessageFormat
        +            Object[] wrappedVal = new Object[]{val};
        +
        +            try {
        +                String mFmtted = mFmt.format(wrappedVal);
        +                // If current format can support the time object. Check equality of result
        +                assertEquals(mFmtted, "quux"+fmt.format(val)+"quux");
        +            } catch (IllegalArgumentException ignored) {
        +                // Otherwise, ensure both throw IAE on unsupported field
        +                assertThrows(IllegalArgumentException.class, () -> fmt.format(val));
        +            }
        +        }
        +    }
        +
        +    // Provides String patterns and the associated (standalone) FormatType
        +    // Values should be case-insensitive
        +    private static Stream preDefinedTypes() {
        +        return Stream.of(
        +            Arguments.of("BASIC_ISO_DATE", DateTimeFormatter.BASIC_ISO_DATE.toFormat()),
        +            Arguments.of("ISO_LOCAL_DATE", DateTimeFormatter.ISO_LOCAL_DATE.toFormat()),
        +            Arguments.of("ISO_OFFSET_DATE", DateTimeFormatter.ISO_OFFSET_DATE.toFormat()),
        +            Arguments.of("ISO_DATE", DateTimeFormatter.ISO_DATE.toFormat()),
        +            Arguments.of("iso_local_time", DateTimeFormatter.ISO_LOCAL_TIME.toFormat()),
        +            Arguments.of("ISO_OFFSET_TIME", DateTimeFormatter.ISO_OFFSET_TIME.toFormat()),
        +            Arguments.of("iso_time", DateTimeFormatter.ISO_TIME.toFormat()),
        +            Arguments.of("ISO_LOCAL_DATE_TIME", DateTimeFormatter.ISO_LOCAL_DATE_TIME.toFormat()),
        +            Arguments.of("ISO_OFFSET_DATE_TIME", DateTimeFormatter.ISO_OFFSET_DATE_TIME.toFormat()),
        +            Arguments.of("ISO_ZONED_DATE_TIME", DateTimeFormatter.ISO_ZONED_DATE_TIME.toFormat()),
        +            Arguments.of("ISO_DATE_TIME", DateTimeFormatter.ISO_DATE_TIME.toFormat()),
        +            Arguments.of("ISO_ORDINAL_DATE", DateTimeFormatter.ISO_ORDINAL_DATE.toFormat()),
        +            Arguments.of("iso_week_date", DateTimeFormatter.ISO_WEEK_DATE.toFormat()),
        +            Arguments.of("ISO_INSTANT", DateTimeFormatter.ISO_INSTANT.toFormat()),
        +            Arguments.of("RFC_1123_DATE_TIME", DateTimeFormatter.RFC_1123_DATE_TIME.toFormat())
        +        );
        +    }
        +
        +    // Check that the appropriate FormatType/Style combo returns correct Format
        +    // Unlike the other pattern tests, the formatted output is used to check
        +    // equality, as DateTimeFormatter does not implement equals()
        +    @ParameterizedTest
        +    @MethodSource("styles")
        +    public void applyPatternTest(String style, FormatStyle fStyle) {
        +        var time = ZonedDateTime.now();
        +        var date = LocalDate.now();
        +
        +        // Test dtf_date
        +        var dFmt = new MessageFormat("{0,dtf_date"+style+"}");
        +        assertEquals(DateTimeFormatter.ofLocalizedDate(fStyle).withLocale(
        +                dFmt.getLocale()).toFormat().format(date),
        +                dFmt.getFormatsByArgumentIndex()[0].format(date));
        +
        +        // Test dtf_time
        +        var tFmt = new MessageFormat("{0,dtf_time"+style+"}");
        +        assertEquals(DateTimeFormatter.ofLocalizedTime(fStyle).withLocale(
        +                tFmt.getLocale()).toFormat().format(time),
        +                tFmt.getFormatsByArgumentIndex()[0].format(time));
        +
        +        // Test dtf_datetime
        +        var dtFmt = new MessageFormat("{0,dtf_datetime"+style+"}");
        +        assertEquals(DateTimeFormatter.ofLocalizedDateTime(fStyle).withLocale(
        +                        dtFmt.getLocale()).toFormat().format(time),
        +                dtFmt.getFormatsByArgumentIndex()[0].format(time));
        +    }
        +
        +    // Provides String patterns and the associated FormatStyle
        +    private static Stream styles() {
        +        return Stream.of(
        +                Arguments.of("", FormatStyle.MEDIUM),
        +                Arguments.of(",short", FormatStyle.SHORT),
        +                Arguments.of(",medium", FormatStyle.MEDIUM),
        +                Arguments.of(",long", FormatStyle.LONG),
        +                Arguments.of(",full", FormatStyle.FULL)
        +        );
        +    }
        +
        +    // Test that a proper Format from a SubformatPattern can be reproduced
        +    @Test
        +    public void subformatPatternTest() {
        +        // SubformatPattern invokes the same method for both dtf_date,
        +        // dtf_time, and dtf_datetime
        +        var pattern = "d MMM uuuu";
        +        var date = LocalDate.now();
        +
        +        // Test dtf_date
        +        var dFmt = new MessageFormat("{0,dtf_date,"+pattern+"}");
        +        assertEquals(DateTimeFormatter.ofPattern(pattern,dFmt.getLocale()).toFormat().format(date),
        +                dFmt.getFormatsByArgumentIndex()[0].format(date));
        +
        +        // Test dtf_time
        +        var tFmt = new MessageFormat("{0,dtf_time,"+pattern+"}");
        +        assertEquals(DateTimeFormatter.ofPattern(pattern,tFmt.getLocale()).toFormat().format(date),
        +                tFmt.getFormatsByArgumentIndex()[0].format(date));
        +
        +        // Test dtf_datetime
        +        var dtFmt = new MessageFormat("{0,dtf_datetime,"+pattern+"}");
        +        assertEquals(DateTimeFormatter.ofPattern(pattern,dtFmt.getLocale()).toFormat().format(date),
        +                dtFmt.getFormatsByArgumentIndex()[0].format(date));
        +    }
        +
        +    // Ensure that only the supported built-in FormatStyles or a
        +    // valid SubformatPattern are recognized
        +    @Test
        +    public void badApplyPatternTest() {
        +        // Not a supported FormatStyle: throws the underlying IAE from DTF
        +        // as it is interpreted as a subformatPattern
        +        IllegalArgumentException exc = assertThrows(IllegalArgumentException.class, () ->
        +                new MessageFormat("{0,dtf_date,longer}"));
        +        assertEquals("Unknown pattern letter: l", exc.getMessage());
        +
        +        // Not a legal SubformatPattern: throws the underlying IAE from DTF
        +        exc = assertThrows(IllegalArgumentException.class, () ->
        +                new MessageFormat("{0,dtf_date,VVV}"));
        +        assertEquals("Pattern letter count must be 2: V", exc.getMessage());
        +
        +        // Pre-defined ISO style does not exist and should be ignored
        +        assertDoesNotThrow(() -> new MessageFormat("{0,BASIC_ISO_DATE,foo}"),
        +                "Style on a pre-defined DTF should be ignored, instead of throwing an exception");
        +    }
        +
        +    // DateTimeFormatters cannot be recognized when toPattern() is invoked
        +    // Default behavior of unrecognizable Formats is a FormatElement
        +    // in the form of { ArgumentIndex }
        +    @Test
        +    public void nonRecognizableToPatternTest() {
        +        // Check SubformatPattern
        +        var validPattern = "yy";
        +        var mFmt = new MessageFormat("{0}");
        +        mFmt.setFormatByArgumentIndex(0, DateTimeFormatter.ofPattern(validPattern).toFormat());
        +        assertEquals("{0}", mFmt.toPattern());
        +
        +        // Check pre-defined styles
        +        var dFmt = new MessageFormat("{0,dtf_date,long}");
        +        assertEquals("{0}", dFmt.toPattern());
        +        var tFmt = new MessageFormat("{0,dtf_time,long}");
        +        assertEquals("{0}", tFmt.toPattern());
        +        var dtFmt = new MessageFormat("{0,dtf_datetime,long}");
        +        assertEquals("{0}", dtFmt.toPattern());
        +    }
        +}
        diff --git a/test/jdk/java/util/concurrent/tck/JSR166TestCase.java b/test/jdk/java/util/concurrent/tck/JSR166TestCase.java
        index 76ab189e553..cb1c4ec4ed3 100644
        --- a/test/jdk/java/util/concurrent/tck/JSR166TestCase.java
        +++ b/test/jdk/java/util/concurrent/tck/JSR166TestCase.java
        @@ -603,7 +603,6 @@ public static Test suite() {
                     ScheduledExecutorSubclassTest.suite(),
                     SemaphoreTest.suite(),
                     SynchronousQueueTest.suite(),
        -            SystemTest.suite(),
                     ThreadLocalTest.suite(),
                     ThreadPoolExecutorTest.suite(),
                     ThreadPoolExecutorSubclassTest.suite(),
        diff --git a/test/jdk/java/util/concurrent/tck/SystemTest.java b/test/jdk/java/util/concurrent/tck/SystemTest.java
        deleted file mode 100644
        index c34bdabea31..00000000000
        --- a/test/jdk/java/util/concurrent/tck/SystemTest.java
        +++ /dev/null
        @@ -1,75 +0,0 @@
        -/*
        - * 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.
        - */
        -
        -/*
        - * This file is available under and governed by the GNU General Public
        - * License version 2 only, as published by the Free Software Foundation.
        - * However, the following notice accompanied the original version of this
        - * file:
        - *
        - * Written by Doug Lea with assistance from members of JCP JSR-166
        - * Expert Group and released to the public domain, as explained at
        - * http://creativecommons.org/publicdomain/zero/1.0/
        - * Other contributors include Andrew Wright, Jeffrey Hayes,
        - * Pat Fisher, Mike Judd.
        - */
        -
        -import junit.framework.Test;
        -import junit.framework.TestSuite;
        -
        -public class SystemTest extends JSR166TestCase {
        -    public static void main(String[] args) {
        -        main(suite(), args);
        -    }
        -
        -    public static Test suite() {
        -        return new TestSuite(SystemTest.class);
        -    }
        -
        -    /**
        -     * Worst case rounding for millisecs; set for 60 cycle millis clock.
        -     * This value might need to be changed on JVMs with coarser
        -     * System.currentTimeMillis clocks.
        -     */
        -    static final long MILLIS_ROUND = 17;
        -
        -    /**
        -     * Nanos between readings of millis is no longer than millis (plus
        -     * possible rounding), and vice versa.
        -     * This shows only that nano timing not (much) worse than milli.
        -     */
        -    public void testNanoTime() throws InterruptedException {
        -        long m0 = System.currentTimeMillis();
        -        long n0 = System.nanoTime();
        -        Thread.sleep(1);
        -        long m1 = System.currentTimeMillis();
        -        long n1 = System.nanoTime();
        -        Thread.sleep(50);       // avoid possibly scaled SHORT_DELAY_MS
        -        long m2 = System.currentTimeMillis();
        -        long n2 = System.nanoTime();
        -        Thread.sleep(1);
        -        long m3 = System.currentTimeMillis();
        -        long n3 = System.nanoTime();
        -        assertTrue((n2 - n1) / 1_000_000 <= m3 - m0 + MILLIS_ROUND);
        -        assertTrue(m2 - m1 <= (n3 - n0) / 1_000_000 + MILLIS_ROUND);
        -    }
        -}
        diff --git a/test/jdk/java/util/zip/ZipFile/InvalidBytesInEntryNameOrComment.java b/test/jdk/java/util/zip/ZipFile/InvalidBytesInEntryNameOrComment.java
        index abe69b69374..c43157248f4 100644
        --- a/test/jdk/java/util/zip/ZipFile/InvalidBytesInEntryNameOrComment.java
        +++ b/test/jdk/java/util/zip/ZipFile/InvalidBytesInEntryNameOrComment.java
        @@ -1,5 +1,5 @@
         /*
        - * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved.
        + * Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved.
          * 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,163 +21,308 @@
          * questions.
          *
          */
        +import org.junit.jupiter.api.BeforeEach;
        +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 org.testng.annotations.BeforeTest;
        -import org.testng.annotations.Test;
        -
        -import java.io.ByteArrayOutputStream;
        +import java.io.FileInputStream;
         import java.io.FileOutputStream;
         import java.io.IOException;
         import java.nio.ByteBuffer;
         import java.nio.ByteOrder;
        -import java.nio.channels.FileChannel;
        +import java.nio.file.Files;
         import java.nio.file.Path;
         import java.util.Arrays;
        -import java.util.zip.ZipEntry;
        -import java.util.zip.ZipException;
        -import java.util.zip.ZipFile;
        -import java.util.zip.ZipOutputStream;
        +import java.util.Formatter;
        +import java.util.stream.Stream;
        +import java.util.zip.*;
         
        -import static org.testng.Assert.assertEquals;
        -import static org.testng.Assert.expectThrows;
        +import static org.junit.jupiter.api.Assertions.*;
         
         /**
          * @test
        - * @summary Validate that opening ZIP files files with invalid UTF-8
        - * byte sequences in the name or comment fields fails with ZipException
        - * @run testng/othervm InvalidBytesInEntryNameOrComment
        + * @bug 8301873 8321156
        + * @summary Validate that a ZipException is thrown when a ZIP file with
        + * invalid UTF-8 byte sequences in the name or comment fields is opened via
        + * ZipFile or traversed via ZipInputStream.
        + * Also validate that ZipFile::getComment will return null with invalid UTF-8
        + * byte sequences in the ZIP file comment
        + * @run junit InvalidBytesInEntryNameOrComment
          */
         public class InvalidBytesInEntryNameOrComment {
        -
        -    // Offsets for navigating the CEN fields
        -    private static final int EOC_OFF = 6;   // Offset from EOF to find CEN offset
        -    private static final int CEN_HDR = 45;  // Size of a CEN header
        -    private static final int NLEN = 28;     // Name length
        -    private static final int ELEN = 30;     // Extra length
        -    private static final int CLEN = 32;     // Comment length
        -
        +    // Zip file that is created and used by the test
        +    public static final Path ZIP_FILE = Path.of("BadName.zip");
             // Example invalid UTF-8 byte sequence
             private static final byte[] INVALID_UTF8_BYTE_SEQUENCE = {(byte) 0xF0, (byte) 0xA4, (byte) 0xAD};
        +    // Expected error message when an invalid entry name or entry comment is
        +    // encountered when accessing a CEN Header
        +    private static final String CEN_BAD_ENTRY_NAME_OR_COMMENT = "invalid CEN header (bad entry name or comment)";
         
        -    // Expected ZipException regex
        -    private static final String BAD_ENTRY_NAME_OR_COMMENT = "invalid CEN header (bad entry name or comment)";
        -
        -    // ZIP file with invalid name field
        -    private Path invalidName;
        +    // Expected error message when an invalid entry name is encountered when
        +    // accessing a LOC Header
        +    private static final String LOC_HEADER_BAD_ENTRY_NAME = "invalid LOC header (bad entry name)";
        +    // Zip file comment starting offset
        +    private static final int ZIP_FILE_COMMENT_OFFSET = 0x93;
        +    // CEN Header offset for the entry comment to be modified
        +    private static final int CEN_FILE_HEADER_FILE_COMMENT_STARTING_OFFSET = 0x6D;
        +    // CEN Header offset for the entry name to be modified
        +    private static final int CEN_FILE_HEADER_FILENAME_STARTING_OFFSET = 0x66;
        +    // LOC Header offset for the entry name to be modified
        +    private static final int LOC_FILE_HEADER_FILENAME_STARTING_OFFSET = 0x1e;
        +    // CEN Entry comment
        +    public static final String ENTRY_COMMENT = "entryComment";
        +    // Entry name to be modified/validated
        +    public static final String ENTRY_NAME = "entryName";
        +    // Zip file comment to be modified/validated
        +    public static final String ZIP_FILE_COMMENT = "ZipFileComment";
        +    // Buffer used to massage the byte array containing the Zip File
        +    private ByteBuffer buffer;
        +    // Array used to copy VALID_ZIP into prior to each test run
        +    private byte[] zipArray;
         
        -    // ZIP file with invalid comment field
        -    private Path invalidComment;
        -
        -    @BeforeTest
        -    public void setup() throws IOException {
        -        // Create a ZIP file with valid name and comment fields
        -        byte[] templateZip = templateZIP();
        -
        -        // Create a ZIP with a CEN name field containing an invalid byte sequence
        -        invalidName = invalidName("invalid-name.zip", templateZip);
        +    /**
        +     * Byte array representing a valid Zip file prior modifying the CEN/LOC
        +     * entry name, CEN entry comment or Zip file comment with an invalid
        +     * UTF-8 byte sequence.
        +     * See the createZipByteArray method which was used to create the original
        +     * Zip file
        +     * ----------------#1--------------------
        +     * [Central Directory Header]
        +     * 0x3a: Signature        : 0x02014b50
        +     * 0x3e: Created Zip Spec :       0x14 [2.0]
        +     * 0x3f: Created OS       :        0x0 [MS-DOS]
        +     * 0x40: VerMadeby        :       0x14 [0, 2.0]
        +     * 0x41: VerExtract       :       0x14 [2.0]
        +     * 0x42: Flag             :      0x808
        +     * 0x44: Method           :        0x8 [DEFLATED]
        +     * 0x46: Last Mod Time    : 0x58506664 [Fri Feb 16 12:51:08 EST 2024]
        +     * 0x4a: CRC              : 0xd202ef8d
        +     * 0x4e: Compressed Size  :        0x3
        +     * 0x52: Uncompressed Size:        0x1
        +     * 0x56: Name Length      :        0x9
        +     * 0x58: Extra Length     :        0x0
        +     * 0x5a: Comment Length   :        0xc
        +     * 0x5c: Disk Start       :        0x0
        +     * 0x5e: Attrs            :        0x0
        +     * 0x60: AttrsEx          :        0x0
        +     * 0x64: Loc Header Offset:        0x0
        +     * 0x68: File Name        :  entryName
        +     * 0x71: Comment          : [entryComment]
        +     * [Local File Header]
        +     * 0x0: Signature   :   0x04034b50
        +     * 0x4: Version     :         0x14    [2.0]
        +     * 0x6: Flag        :        0x808
        +     * 0x8: Method      :          0x8    [DEFLATED]
        +     * 0xa: LastMTime   :   0x58506664    [Fri Feb 16 12:51:08 EST 2024]
        +     * 0xe: CRC         :          0x0
        +     * 0x12: CSize       :          0x0
        +     * 0x16: Size        :          0x0
        +     * 0x1a: Name Length :          0x9    [entryName]
        +     * 0x1c: ExtraLength :          0x0
        +     * 0x1e: File Name   : [entryName]
        +     * [End Central Directory Header]
        +     * 0x7d: Signature   :   0x06054b50
        +     * 0x85: Disk Entries:          0x1
        +     * 0x87: Total Entries:         0x1
        +     * 0x89: CEN Size    :         0x43
        +     * 0x8d: Offset CEN  :         0x3a
        +     * 0x91: Comment Len :          0xe
        +     * 0x93: Comment     :   [ZipFileComment]
        +     */
        +    public static byte[] VALID_ZIP = {
        +            (byte) 0x50, (byte) 0x4b, (byte) 0x3, (byte) 0x4, (byte) 0x14, (byte) 0x0, (byte) 0x8, (byte) 0x8,
        +            (byte) 0x8, (byte) 0x0, (byte) 0x7d, (byte) 0x6f, (byte) 0x50, (byte) 0x58, (byte) 0x0, (byte) 0x0,
        +            (byte) 0x0, (byte) 0x0, (byte) 0x0, (byte) 0x0, (byte) 0x0, (byte) 0x0, (byte) 0x0, (byte) 0x0,
        +            (byte) 0x0, (byte) 0x0, (byte) 0x9, (byte) 0x0, (byte) 0x0, (byte) 0x0, (byte) 0x65, (byte) 0x6e,
        +            (byte) 0x74, (byte) 0x72, (byte) 0x79, (byte) 0x4e, (byte) 0x61, (byte) 0x6d, (byte) 0x65, (byte) 0x63,
        +            (byte) 0x0, (byte) 0x0, (byte) 0x50, (byte) 0x4b, (byte) 0x7, (byte) 0x8, (byte) 0x8d, (byte) 0xef,
        +            (byte) 0x2, (byte) 0xd2, (byte) 0x3, (byte) 0x0, (byte) 0x0, (byte) 0x0, (byte) 0x1, (byte) 0x0,
        +            (byte) 0x0, (byte) 0x0, (byte) 0x50, (byte) 0x4b, (byte) 0x1, (byte) 0x2, (byte) 0x14, (byte) 0x0,
        +            (byte) 0x14, (byte) 0x0, (byte) 0x8, (byte) 0x8, (byte) 0x8, (byte) 0x0, (byte) 0x7d, (byte) 0x6f,
        +            (byte) 0x50, (byte) 0x58, (byte) 0x8d, (byte) 0xef, (byte) 0x2, (byte) 0xd2, (byte) 0x3, (byte) 0x0,
        +            (byte) 0x0, (byte) 0x0, (byte) 0x1, (byte) 0x0, (byte) 0x0, (byte) 0x0, (byte) 0x9, (byte) 0x0,
        +            (byte) 0x0, (byte) 0x0, (byte) 0xc, (byte) 0x0, (byte) 0x0, (byte) 0x0, (byte) 0x0, (byte) 0x0,
        +            (byte) 0x0, (byte) 0x0, (byte) 0x0, (byte) 0x0, (byte) 0x0, (byte) 0x0, (byte) 0x0, (byte) 0x0,
        +            (byte) 0x65, (byte) 0x6e, (byte) 0x74, (byte) 0x72, (byte) 0x79, (byte) 0x4e, (byte) 0x61, (byte) 0x6d,
        +            (byte) 0x65, (byte) 0x65, (byte) 0x6e, (byte) 0x74, (byte) 0x72, (byte) 0x79, (byte) 0x43, (byte) 0x6f,
        +            (byte) 0x6d, (byte) 0x6d, (byte) 0x65, (byte) 0x6e, (byte) 0x74, (byte) 0x50, (byte) 0x4b, (byte) 0x5,
        +            (byte) 0x6, (byte) 0x0, (byte) 0x0, (byte) 0x0, (byte) 0x0, (byte) 0x1, (byte) 0x0, (byte) 0x1,
        +            (byte) 0x0, (byte) 0x43, (byte) 0x0, (byte) 0x0, (byte) 0x0, (byte) 0x3a, (byte) 0x0, (byte) 0x0,
        +            (byte) 0x0, (byte) 0xe, (byte) 0x0, (byte) 0x5a, (byte) 0x69, (byte) 0x70, (byte) 0x46, (byte) 0x69,
        +            (byte) 0x6c, (byte) 0x65, (byte) 0x43, (byte) 0x6f, (byte) 0x6d, (byte) 0x6d, (byte) 0x65, (byte) 0x6e,
        +            (byte) 0x74,
        +    };
         
        -        // Create a ZIP with a CEN comment field containing an invalid byte sequence
        -        invalidComment = invalidComment("invalid-comment.zip", templateZip);
        +    /**
        +     * Delete the Zip file if it exists prior to each run and create a copy
        +     * of the byte array representing a valid ZIP file to be used by each test run
        +     *
        +     * @throws IOException if an error occurs
        +     */
        +    @BeforeEach
        +    public void setupTest() throws IOException {
        +        Files.deleteIfExists(ZIP_FILE);
        +        zipArray = Arrays.copyOf(VALID_ZIP, VALID_ZIP.length);
        +        buffer = ByteBuffer.wrap(zipArray).order(ByteOrder.LITTLE_ENDIAN);
             }
         
             /**
        -     * Opening a ZipFile with an invalid UTF-8 byte sequence in
        -     * the name field of a CEN file header should throw a
        -     * ZipException with "bad entry name or comment"
        +     * The DataProvider of CEN offsets to modify with an invalid UTF-8 byte
        +     * sequence
        +     *
        +     * @return Arguments used in each test run
              */
        -    @Test
        -    public void shouldRejectInvalidName() throws IOException {
        -        ZipException ex = expectThrows(ZipException.class, () -> {
        -            new ZipFile(invalidName.toFile());
        -        });
        -        assertEquals(ex.getMessage(), BAD_ENTRY_NAME_OR_COMMENT);
        +    private static Stream CENCommentOffsets() {
        +        return Stream.of(
        +                // Entry's name starting offset
        +                Arguments.of(CEN_FILE_HEADER_FILENAME_STARTING_OFFSET),
        +                // Entry's comment starting offset
        +                Arguments.of(CEN_FILE_HEADER_FILE_COMMENT_STARTING_OFFSET)
        +        );
             }
         
             /**
        -     * Opening a ZipFile with an invalid UTF-8 byte sequence in
        -     * the comment field of a CEN file header should throw a
        -     * ZipException with "bad entry name or comment"
        +     * Validate that the original Zip file can be opened via ZipFile.
        +     * @throws IOException if an error occurs
              */
             @Test
        -    public void shouldRejectInvalidComment() throws IOException {
        -        ZipException ex = expectThrows(ZipException.class, () -> {
        -            new ZipFile(invalidComment.toFile());
        -        });
        -        assertEquals(ex.getMessage(), BAD_ENTRY_NAME_OR_COMMENT);
        +    public void testValidEntryNameAndComment() throws IOException {
        +        Files.write(ZIP_FILE, zipArray);
        +        try (ZipFile zf = new ZipFile(ZIP_FILE.toFile())) {
        +            var comment = zf.getComment();
        +            assertEquals(ZIP_FILE_COMMENT, comment);
        +        }
             }
         
             /**
        -     * Make a valid ZIP file used as a template for invalid files
        +     * Validate that the original Zip file can be opened and traversed via
        +     * ZipinputStream::getNextEntry.
        +     * @throws IOException if an error occurs
              */
        -    private byte[] templateZIP() throws IOException {
        -        ByteArrayOutputStream bout = new ByteArrayOutputStream();
        -        try (ZipOutputStream zo = new ZipOutputStream(bout)) {
        -            ZipEntry commentEntry = new ZipEntry("file");
        -            commentEntry.setComment("Comment");
        -            zo.putNextEntry(commentEntry);
        +    @Test
        +    public void traverseZipWithZipInputStreamTest() throws IOException {
        +        Files.write(ZIP_FILE, zipArray);
        +        try (ZipInputStream zis = new ZipInputStream(new FileInputStream(ZIP_FILE.toFile()))) {
        +            ZipEntry ze;
        +            while ((ze = zis.getNextEntry()) != null) {
        +                assertEquals(ENTRY_NAME, ze.getName());
        +            }
                 }
        -        return bout.toByteArray();
             }
         
             /**
        -     * Make a ZIP with invalid bytes in the CEN name field
        +     * Validate that a ZipException is thrown when an entry name or entry comment
        +     * within a CEN file header contains an invalid UTF-8 byte sequence.
        +     *
        +     * @param offset the offset to the file name or file comment within the CEN
        +     *               file header
        +     * @throws IOException if an error occurs
              */
        -    private Path invalidName(String name, byte[] template) throws IOException {
        -        ByteBuffer buffer = copyTemplate(template);
        -        int off = cenStart(buffer);
        -        // Name field starts here
        -        int noff = off + CEN_HDR;
        -
        -        // Write invalid bytes
        -        buffer.put(noff, INVALID_UTF8_BYTE_SEQUENCE, 0, INVALID_UTF8_BYTE_SEQUENCE.length);
        -        return writeFile(name, buffer);
        -
        +    @ParameterizedTest
        +    @MethodSource("CENCommentOffsets")
        +    public void testInValidEntryNameOrComment(int offset)
        +            throws IOException {
        +        createInvalidUTFEntryInZipFile(offset);
        +        Throwable ex = assertThrows(ZipException.class, () ->
        +                {
        +                    try (ZipFile zf = new ZipFile(ZIP_FILE.toFile())) {};
        +                }
        +        );
        +        assertEquals(CEN_BAD_ENTRY_NAME_OR_COMMENT, ex.getMessage());
             }
        -
             /**
        -     * Make a copy of the ZIP template and wrap it in a little-endian
        -     * ByteBuffer
        +     * Validate that a null is returned from ZipFile::getComment when the
        +     * comment contains an invalid UTF-8 byte sequence.
        +     * @throws IOException if an error occurs
              */
        -    private ByteBuffer copyTemplate(byte[] template) {
        -        return ByteBuffer.wrap(Arrays.copyOf(template, template.length))
        -                .order(ByteOrder.LITTLE_ENDIAN);
        +    @Test
        +    public void testInValidZipFileComment() throws IOException {
        +        createInvalidUTFEntryInZipFile(ZIP_FILE_COMMENT_OFFSET);
        +        try (ZipFile zf = new ZipFile(ZIP_FILE.toFile())) {
        +            assertNull(zf.getComment());
        +        }
             }
         
             /**
        -     * Make a ZIP with invalid bytes in the CEN comment field
        +     * Validate that a ZipException is thrown when an entry name
        +     * within a LOC file header contains an invalid UTF-8 byte sequence.
        +     * @throws IOException if an error occurs
              */
        -    private Path invalidComment(String name, byte[] template) throws IOException {
        -        ByteBuffer buffer = copyTemplate(template);
        -        int off = cenStart(buffer);
        -        // Need to skip past the length of the name and extra fields
        -        int nlen = buffer.getShort(off + NLEN);
        -        int elen = buffer.getShort(off + ELEN);
        -
        -        // Comment field starts here
        -        int coff = off + CEN_HDR + nlen + elen;
        -
        -        // Write invalid bytes
        -        buffer.put(coff, INVALID_UTF8_BYTE_SEQUENCE, 0, INVALID_UTF8_BYTE_SEQUENCE.length);
        -        return writeFile(name, buffer);
        +    @Test
        +    public void invalidZipInputStreamTest() throws IOException {
        +        createInvalidUTFEntryInZipFile(LOC_FILE_HEADER_FILENAME_STARTING_OFFSET);
        +        Throwable ex = assertThrows(ZipException.class, () ->
        +                {
        +                    try (ZipInputStream zis =
        +                                 new ZipInputStream(new FileInputStream(ZIP_FILE.toFile()))) {
        +                        zis.getNextEntry();
        +                    };
        +                });
        +        assertEquals(LOC_HEADER_BAD_ENTRY_NAME, ex.getMessage());
             }
         
        +    /**
        +     * Utility method which modifies a Zip file starting at the specified
        +     * offset to include an invalid UTF-8 byte sequence.
        +     *
        +     * @param offset starting offset within the Zip file to modify
        +     * @throws IOException if an error occurs
        +     */
        +    private void createInvalidUTFEntryInZipFile(int offset) throws IOException {
        +        buffer.put(offset, INVALID_UTF8_BYTE_SEQUENCE, 0,
        +                INVALID_UTF8_BYTE_SEQUENCE.length);
        +        Files.write(ZIP_FILE, zipArray);
        +    }
         
             /**
        -     * Finds the offset of the start of the CEN directory
        -      */
        -    private int cenStart(ByteBuffer buffer) {
        -        return buffer.getInt(buffer.capacity() - EOC_OFF);
        +     * Utility method which creates the Zip file used by the tests and
        +     * converts Zip file to byte array declaration.
        +     *
        +     * @throws IOException if an error occurs
        +     */
        +    private void createZipByteArray() throws IOException {
        +        ZipOutputStream zos = new ZipOutputStream(
        +                new FileOutputStream(ZIP_FILE.toFile()));
        +        zos.setComment(ZIP_FILE_COMMENT);
        +        ZipEntry entry = new ZipEntry(ENTRY_NAME);
        +        entry.setComment(ENTRY_COMMENT);
        +        zos.putNextEntry(entry);
        +        zos.write(new byte[1]);
        +        zos.closeEntry();
        +        zos.close();
        +        // Now create the byte array entry declaration
        +        var fooJar = Files.readAllBytes(ZIP_FILE);
        +        var result = createByteArray(fooJar, "VALID_ZIP");
        +        System.out.println(result);
             }
         
             /**
        -     * Utility to write a ByteBuffer to disk
        +     * Utility method which takes a byte array and converts to byte array
        +     * declaration.  For example:
        +     * {@snippet :
        +     * var fooJar = Files.readAllBytes(Path.of("foo.jar"));
        +     * var result = createByteArray(fooJar,"FOOBYTES");
        +     * System.out.println(result);
        +     * }
        +     *
        +     * @param bytes A byte array used to create a byte array declaration
        +     * @param name  Name to be used in the byte array declaration
        +     * @return The formatted byte array declaration
              */
        -    private Path writeFile(String name, ByteBuffer buffer) throws IOException {
        -        Path zip = Path.of(name);
        -        try (FileChannel ch = new FileOutputStream(zip.toFile()).getChannel()) {
        -            buffer.rewind();
        -            ch.write(buffer);
        +    public static String createByteArray(byte[] bytes, String name) {
        +        StringBuilder sb = new StringBuilder(bytes.length * 5);
        +        Formatter fmt = new Formatter(sb);
        +        fmt.format("    public static byte[] %s = {", name);
        +        final int linelen = 8;
        +        for (int i = 0; i < bytes.length; i++) {
        +            if (i % linelen == 0) {
        +                fmt.format("%n        ");
        +            }
        +            fmt.format(" (byte) 0x%x,", bytes[i] & 0xff);
                 }
        -        return zip;
        +        fmt.format("%n    };%n");
        +        return sb.toString();
             }
         }
        diff --git a/test/jdk/javax/net/ssl/SSLSession/CertMsgCheck.java b/test/jdk/javax/net/ssl/SSLSession/CertMsgCheck.java
        new file mode 100644
        index 00000000000..37c252bc6f0
        --- /dev/null
        +++ b/test/jdk/javax/net/ssl/SSLSession/CertMsgCheck.java
        @@ -0,0 +1,59 @@
        +/*
        + * Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved.
        + * 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
        + * @library /javax/net/ssl/templates
        + * @bug 8311644
        + * @summary Verify CertificateMessage alerts are correct to the TLS specs
        + * @run main/othervm -Djdk.tls.client.protocols=TLSv1.2 CertMsgCheck handshake_failure
        + * @run main/othervm -Djdk.tls.client.protocols=TLSv1.3 CertMsgCheck certificate_required
        + *
        + */
        +
        +public class CertMsgCheck {
        +
        +    public static void main(String[] args) throws Exception {
        +        // Start server
        +        TLSBase.Server server = new TLSBase.ServerBuilder().setClientAuth(true).
        +            build();
        +
        +        // Initial client session
        +        TLSBase.Client client1 = new TLSBase.Client(true, false);
        +        if (server.getSession(client1).getSessionContext() == null) {
        +            for (Exception e : server.getExceptionList()) {
        +                System.out.println("Looking at " + e.getClass() + " " +
        +                    e.getMessage());
        +                if (e.getMessage().contains(args[0])) {
        +                    System.out.println("Found correct exception: " + args[0] +
        +                    " in " + e.getMessage());
        +                    return;
        +                } else {
        +                    System.out.println("No \"" + args[0] + "\" found.");
        +                }
        +            }
        +
        +            throw new Exception("Failed to find expected alert: " + args[0]);
        +        }
        +    }
        +}
        diff --git a/test/jdk/javax/net/ssl/SSLSession/CheckSessionContext.java b/test/jdk/javax/net/ssl/SSLSession/CheckSessionContext.java
        index 98c7afb2738..183354ed9db 100644
        --- a/test/jdk/javax/net/ssl/SSLSession/CheckSessionContext.java
        +++ b/test/jdk/javax/net/ssl/SSLSession/CheckSessionContext.java
        @@ -1,5 +1,5 @@
         /*
        - * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
        + * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved.
          * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
          *
          * This code is free software; you can redistribute it and/or modify it
        @@ -36,15 +36,11 @@
          */
         
         import javax.net.ssl.SSLSession;
        +import java.util.HexFormat;
         
         public class CheckSessionContext {
         
        -    static void toHex(byte[] id) {
        -        for (byte b : id) {
        -            System.out.printf("%02X ", b);
        -        }
        -        System.out.println();
        -    }
        +    static HexFormat hex = HexFormat.of();
         
             public static void main(String[] args) throws Exception {
                 TLSBase.Server server = new TLSBase.Server();
        @@ -52,20 +48,18 @@ public static void main(String[] args) throws Exception {
                 // Initial client session
                 TLSBase.Client client1 = new TLSBase.Client();
                 if (server.getSession(client1).getSessionContext() == null) {
        -            throw new Exception("Context was null");
        +            throw new Exception("Context was null.  Handshake failure.");
                 } else {
                     System.out.println("Context was found");
                 }
                 SSLSession ss = server.getSession(client1);
                 System.out.println(ss);
                 byte[] id = ss.getId();
        -        System.out.print("id = ");
        -        toHex(id);
        +        System.out.println("id = " + hex.formatHex(id));
                 System.out.println("ss.getSessionContext().getSession(id) = " + ss.getSessionContext().getSession(id));
                 if (ss.getSessionContext().getSession(id) != null) {
                     id = ss.getSessionContext().getSession(id).getId();
        -            System.out.print("id = ");
        -            toHex(id);
        +            System.out.println("id = " + hex.formatHex(id));
                 }
                 server.close(client1);
                 client1.close();
        diff --git a/test/jdk/javax/net/ssl/templates/TLSBase.java b/test/jdk/javax/net/ssl/templates/TLSBase.java
        index bcddb1147c8..414e7e106b3 100644
        --- a/test/jdk/javax/net/ssl/templates/TLSBase.java
        +++ b/test/jdk/javax/net/ssl/templates/TLSBase.java
        @@ -1,5 +1,5 @@
         /*
        - * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
        + * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved.
          * 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,18 +21,15 @@
          * questions.
          */
         
        -import javax.net.ssl.SSLContext;
        -import javax.net.ssl.SSLServerSocket;
        -import javax.net.ssl.SSLServerSocketFactory;
        -import javax.net.ssl.SSLSession;
        -import javax.net.ssl.SSLSocket;
        -import java.io.BufferedReader;
        -import java.io.IOException;
        -import java.io.InputStreamReader;
        -import java.io.OutputStreamWriter;
        -import java.io.PrintWriter;
        +import javax.net.ssl.*;
        +import java.io.*;
         import java.net.InetSocketAddress;
        +import java.security.KeyStore;
        +import java.security.cert.PKIXBuilderParameters;
        +import java.security.cert.X509CertSelector;
        +import java.util.ArrayList;
         import java.util.Arrays;
        +import java.util.List;
         import java.util.concurrent.ConcurrentHashMap;
         
         /**
        @@ -67,11 +64,11 @@ abstract public class TLSBase {
         
             TLSBase() {
                 String keyFilename =
        -                System.getProperty("test.src", "./") + "/" + pathToStores +
        -                        "/" + keyStoreFile;
        +            System.getProperty("test.src", "./") + "/" + pathToStores +
        +                "/" + keyStoreFile;
                 String trustFilename =
        -                System.getProperty("test.src", "./") + "/" + pathToStores +
        -                        "/" + trustStoreFile;
        +            System.getProperty("test.src", "./") + "/" + pathToStores +
        +                "/" + trustStoreFile;
                 System.setProperty("javax.net.ssl.keyStore", keyFilename);
                 System.setProperty("javax.net.ssl.keyStorePassword", passwd);
                 System.setProperty("javax.net.ssl.trustStore", trustFilename);
        @@ -79,30 +76,65 @@ abstract public class TLSBase {
             }
         
             // Base read operation
        -    byte[] read(SSLSocket sock) {
        -        try {
        -            BufferedReader reader = new BufferedReader(
        -                    new InputStreamReader(sock.getInputStream()));
        -            String s = reader.readLine();
        -            System.err.println("(read) " + name + ": " + s);
        -            return s.getBytes();
        -        } catch (Exception e) {
        -            e.printStackTrace();
        -        }
        -        return null;
        +    byte[] read(SSLSocket sock) throws Exception {
        +        BufferedReader reader = new BufferedReader(
        +            new InputStreamReader(sock.getInputStream()));
        +        String s = reader.readLine();
        +        System.err.println("(read) " + name + ": " + s);
        +        return s.getBytes();
             }
         
             // Base write operation
        -    public void write(SSLSocket sock, byte[] data) {
        -        try {
        -            PrintWriter out = new PrintWriter(
        -                    new OutputStreamWriter(sock.getOutputStream()));
        -            out.println(new String(data));
        -            out.flush();
        -            System.err.println("(write)" + name + ": " + new String(data));
        -        } catch (Exception e) {
        -            e.printStackTrace();
        +    public void write(SSLSocket sock, byte[] data) throws Exception {
        +        PrintWriter out = new PrintWriter(
        +            new OutputStreamWriter(sock.getOutputStream()));
        +        out.println(new String(data));
        +        out.flush();
        +        System.err.println("(write)" + name + ": " + new String(data));
        +    }
        +
        +    private static KeyManager[] getKeyManager(boolean empty) throws Exception {
        +        FileInputStream fis = null;
        +        if (!empty) {
        +            fis = new FileInputStream(System.getProperty("test.src", "./") + "/" + pathToStores +
        +                "/" + keyStoreFile);
                 }
        +        // Load the keystore
        +        char[] pwd = passwd.toCharArray();
        +        KeyStore ks = KeyStore.getInstance(KeyStore.getDefaultType());
        +        ks.load(fis, pwd);
        +
        +        KeyManagerFactory kmf = KeyManagerFactory.getInstance("PKIX");
        +        kmf.init(ks, pwd);
        +        return kmf.getKeyManagers();
        +    }
        +
        +    private static TrustManager[] getTrustManager(boolean empty) throws Exception {
        +        FileInputStream fis = null;
        +        if (!empty) {
        +            fis = new FileInputStream(System.getProperty("test.src", "./") + "/" + pathToStores +
        +                "/" + trustStoreFile);
        +        }
        +        // Load the keystore
        +        KeyStore ks = KeyStore.getInstance(KeyStore.getDefaultType());
        +        ks.load(fis, passwd.toCharArray());
        +
        +        PKIXBuilderParameters pkixParams =
        +            new PKIXBuilderParameters(ks, new X509CertSelector());
        +
        +        // Explicitly set revocation based on the command-line
        +        // parameters, default false
        +        pkixParams.setRevocationEnabled(false);
        +
        +        // Register the PKIXParameters with the trust manager factory
        +        ManagerFactoryParameters trustParams =
        +            new CertPathTrustManagerParameters(pkixParams);
        +
        +        // Create the Trust Manager Factory using the PKIX variant
        +        // and initialize it with the parameters configured above
        +        TrustManagerFactory tmf = TrustManagerFactory.getInstance("PKIX");
        +        tmf.init(trustParams);
        +        return tmf.getTrustManagers();
             }
         
             /**
        @@ -117,14 +149,17 @@ static class Server extends TLSBase {
                         new ConcurrentHashMap<>();
                 boolean exit = false;
                 Thread t;
        +        List exceptionList = new ArrayList<>();
         
        -        Server() {
        +        Server(ServerBuilder builder) {
                     super();
                     name = "server";
                     try {
        -                sslContext = SSLContext.getDefault();
        +                sslContext = SSLContext.getInstance("TLS");
        +                sslContext.init(TLSBase.getKeyManager(builder.km), TLSBase.getTrustManager(builder.tm), null);
                         fac = sslContext.getServerSocketFactory();
                         ssock = (SSLServerSocket) fac.createServerSocket(0);
        +                ssock.setNeedClientAuth(builder.clientauth);
                         serverPort = ssock.getLocalPort();
                     } catch (Exception e) {
                         System.err.println(e.getMessage());
        @@ -136,13 +171,14 @@ static class Server extends TLSBase {
                         try {
                             while (true) {
                                 System.err.println("Server ready on port " +
        -                                serverPort);
        +                            serverPort);
                                 SSLSocket c = (SSLSocket)ssock.accept();
                                 clientMap.put(c.getPort(), c);
                                 try {
                                     write(c, read(c));
                                 } catch (Exception e) {
                                     e.printStackTrace();
        +                            exceptionList.add(e);
                                 }
                             }
                         } catch (Exception ex) {
        @@ -153,6 +189,51 @@ static class Server extends TLSBase {
                     t.start();
                 }
         
        +        Server() {
        +            this(new ServerBuilder());
        +        }
        +
        +        /**
        +         * @param km - true for an empty key manager
        +         * @param tm - true for an empty trust manager
        +         */
        +        Server(boolean km, boolean tm) {
        +            super();
        +            name = "server";
        +            try {
        +                sslContext = SSLContext.getInstance("TLS");
        +                sslContext.init(TLSBase.getKeyManager(km), TLSBase.getTrustManager(tm), null);
        +                fac = sslContext.getServerSocketFactory();
        +                ssock = (SSLServerSocket) fac.createServerSocket(0);
        +                ssock.setNeedClientAuth(true);
        +                serverPort = ssock.getLocalPort();
        +            } catch (Exception e) {
        +                System.err.println(e.getMessage());
        +                e.printStackTrace();
        +            }
        +
        +                // Thread to allow multiple clients to connect
        +                t = new Thread(() -> {
        +                    try {
        +                        while (true) {
        +                            System.err.println("Server ready on port " +
        +                                serverPort);
        +                            SSLSocket c = (SSLSocket)ssock.accept();
        +                            clientMap.put(c.getPort(), c);
        +                            try {
        +                                write(c, read(c));
        +                            } catch (Exception e) {
        +                                e.printStackTrace();
        +                            }
        +                        }
        +                    } catch (Exception ex) {
        +                        System.err.println("Server Down");
        +                        ex.printStackTrace();
        +                    }
        +                });
        +                t.start();
        +            }
        +
                 // Exit test to quit the test.  This must be called at the end of the
                 // test or the test will never end.
                 void done() {
        @@ -166,7 +247,7 @@ void done() {
                 }
         
                 // Read from the client
        -        byte[] read(Client client) {
        +        byte[] read(Client client) throws Exception {
                     SSLSocket s = clientMap.get(Integer.valueOf(client.getPort()));
                     if (s == null) {
                         System.err.println("No socket found, port " + client.getPort());
        @@ -175,13 +256,13 @@ byte[] read(Client client) {
                 }
         
                 // Write to the client
        -        void write(Client client, byte[] data) {
        +        void write(Client client, byte[] data) throws Exception {
                     write(clientMap.get(client.getPort()), data);
                 }
         
                 // Server writes to the client, then reads from the client.
                 // Return true if the read & write data match, false if not.
        -        boolean writeRead(Client client, String s) {
        +        boolean writeRead(Client client, String s) throws Exception{
                     write(client, s.getBytes());
                     return (Arrays.compare(s.getBytes(), client.read()) == 0);
                 }
        @@ -197,30 +278,61 @@ void close(Client c) throws IOException {
                     SSLSocket s = clientMap.get(Integer.valueOf(c.getPort()));
                     s.close();
                 }
        +
        +        List getExceptionList() {
        +            return exceptionList;
        +        }
             }
         
        +    static class ServerBuilder {
        +        boolean km = false, tm = false, clientauth = false;
        +
        +        ServerBuilder setKM(boolean b) {
        +            km = b;
        +            return this;
        +        }
        +
        +        ServerBuilder setTM(boolean b) {
        +            tm = b;
        +            return this;
        +        }
        +
        +        ServerBuilder setClientAuth(boolean b) {
        +            clientauth = b;
        +            return this;
        +        }
        +
        +        Server build() {
        +            return new Server(this);
        +        }
        +    }
             /**
              * Client side will establish a connection from the constructor and wait.
              * It must be run after the Server constructor is called.
              */
             static class Client extends TLSBase {
                 SSLSocket sock;
        -
        +        boolean km, tm;
                 Client() {
        +            this(false, false);
        +        }
        +
        +        /**
        +         * @param km - true sets an empty key manager
        +         * @param tm - true sets an empty trust manager
        +         */
        +        Client(boolean km, boolean tm) {
                     super();
        -            try {
        -                sslContext = SSLContext.getDefault();
        -            } catch (Exception e) {
        -                System.err.println(e.getMessage());
        -                e.printStackTrace();
        -            }
        +            this.km = km;
        +            this.tm = tm;
                     connect();
                 }
         
                 // Connect to server.  Maybe runnable in the future
                 public SSLSocket connect() {
                     try {
        -                sslContext = SSLContext.getDefault();
        +                sslContext = SSLContext.getInstance("TLS");
        +                sslContext.init(TLSBase.getKeyManager(km), TLSBase.getTrustManager(tm), null);
                         sock = (SSLSocket)sslContext.getSocketFactory().createSocket();
                         sock.connect(new InetSocketAddress("localhost", serverPort));
                         System.err.println("Client connected using port " +
        @@ -235,21 +347,21 @@ public SSLSocket connect() {
                 }
         
                 // Read from the client socket
        -        byte[] read() {
        +        byte[] read() throws Exception {
                     return read(sock);
                 }
         
                 // Write to the client socket
        -        void write(byte[] data) {
        +        void write(byte[] data) throws Exception {
                     write(sock, data);
                 }
        -        void write(String s) {
        +        void write(String s) throws Exception {
                     write(sock, s.getBytes());
                 }
         
                 // Client writes to the server, then reads from the server.
                 // Return true if the read & write data match, false if not.
        -        boolean writeRead(Server server, String s) {
        +        boolean writeRead(Server server, String s) throws Exception {
                     write(s.getBytes());
                     return (Arrays.compare(s.getBytes(), server.read(this)) == 0);
                 }
        diff --git a/test/jdk/jdk/jfr/event/compiler/TestCompilerCompile.java b/test/jdk/jdk/jfr/event/compiler/TestCompilerCompile.java
        index 77352ba26e9..775d7789bee 100644
        --- a/test/jdk/jdk/jfr/event/compiler/TestCompilerCompile.java
        +++ b/test/jdk/jdk/jfr/event/compiler/TestCompilerCompile.java
        @@ -47,6 +47,7 @@
          * @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox
          * @run main/othervm -Xbootclasspath/a:.
          *     -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
        + *     -XX:CompileOnly=jdk.jfr.event.compiler.TestCompilerCompile::dummyMethod,jdk.jfr.event.compiler.TestCompilerCompile::doTest
          *     jdk.jfr.event.compiler.TestCompilerCompile
          */
         public class TestCompilerCompile {
        diff --git a/test/jdk/sun/security/provider/all/Deterministic.java b/test/jdk/sun/security/provider/all/Deterministic.java
        new file mode 100644
        index 00000000000..66d674da9bf
        --- /dev/null
        +++ b/test/jdk/sun/security/provider/all/Deterministic.java
        @@ -0,0 +1,290 @@
        +/*
        + * Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved.
        + * 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 8325506
        + * @library /test/lib
        + * @modules java.base/sun.security.util
        + * @run main/othervm Deterministic
        + * @summary confirm the output of random calculations are determined
        + *          by the SecureRandom parameters
        + */
        +
        +import jdk.test.lib.Asserts;
        +import jdk.test.lib.security.SeededSecureRandom;
        +import sun.security.util.SignatureUtil;
        +
        +import javax.crypto.Cipher;
        +import javax.crypto.KEM;
        +import javax.crypto.KeyAgreement;
        +import javax.crypto.KeyGenerator;
        +import javax.crypto.spec.ChaCha20ParameterSpec;
        +import javax.crypto.spec.DHParameterSpec;
        +import javax.crypto.spec.GCMParameterSpec;
        +import javax.crypto.spec.IvParameterSpec;
        +import javax.crypto.spec.PBEParameterSpec;
        +import javax.crypto.spec.SecretKeySpec;
        +import java.nio.charset.StandardCharsets;
        +import java.security.*;
        +import java.security.spec.AlgorithmParameterSpec;
        +import java.security.spec.DSAParameterSpec;
        +import java.security.spec.PSSParameterSpec;
        +import java.util.Arrays;
        +import java.util.Objects;
        +
        +public class Deterministic {
        +
        +    private static final long SEED = SeededSecureRandom.seed();
        +    private static int hash = 0;
        +
        +    public static void main(String[] args) throws Exception {
        +
        +        for (var p : Security.getProviders()) {
        +            var name = p.getName();
        +            if (name.equals("SunMSCAPI") || name.startsWith("SunPKCS11")) {
        +                System.out.println("Skipped native provider " + name);
        +                continue;
        +            }
        +            for (var s : p.getServices()) {
        +                switch (s.getType()) {
        +                    case "KeyPairGenerator" -> testKeyPairGenerator(s);
        +                    case "KeyGenerator" -> testKeyGenerator(s);
        +                    case "Signature" -> testSignature(s);
        +                    case "KEM" -> testKEM(s);
        +                    case "KeyAgreement" -> testKeyAgreement(s);
        +                    case "Cipher" -> testCipher(s);
        +                    case "AlgorithmParameterGenerator" -> testAlgorithmParameterGenerator(s);
        +                }
        +            }
        +        }
        +        // Run twice and this value should be the same for the same SEED
        +        System.out.println("Final hash: " + hash);
        +    }
        +
        +    static void testCipher(Provider.Service s) throws Exception {
        +        var alg = s.getAlgorithm();
        +        System.out.println(s.getProvider().getName()
        +                + " " + s.getType() + "." + alg);
        +        if (alg.contains("Wrap") || alg.contains("KW")) {
        +            System.out.println("    Ignored");
        +            return;
        +        }
        +        Key key;
        +        AlgorithmParameterSpec spec;
        +        if (alg.startsWith("PBE")) {
        +            key = new SecretKeySpec("isthisakey".getBytes(StandardCharsets.UTF_8), "PBE");
        +            // Some cipher requires salt to be 8 byte long
        +            spec = new PBEParameterSpec("saltsalt".getBytes(StandardCharsets.UTF_8), 100);
        +        } else {
        +            key = generateKey(alg.split("/")[0], s.getProvider());
        +            if (!alg.contains("/") || alg.contains("/ECB/")) {
        +                spec = null;
        +            } else {
        +                if (alg.contains("/GCM/")) {
        +                    spec = new GCMParameterSpec(128, new SeededSecureRandom(SEED + 1).generateSeed(16));
        +                } else if (alg.equals("ChaCha20")) {
        +                    spec = new ChaCha20ParameterSpec(new SeededSecureRandom(SEED + 2).generateSeed(12), 128);
        +                } else if (alg.contains("ChaCha20")) {
        +                    spec = new IvParameterSpec(new SeededSecureRandom(SEED + 3).generateSeed(12));
        +                } else {
        +                    spec = new IvParameterSpec(new SeededSecureRandom(SEED + 4).generateSeed(16));
        +                }
        +            }
        +        }
        +        var c = Cipher.getInstance(alg, s.getProvider());
        +        c.init(Cipher.ENCRYPT_MODE, key, spec, new SeededSecureRandom(SEED));
        +        // Some cipher requires plaintext to be 16 byte long
        +        var ct1 = c.doFinal("asimpleplaintext".getBytes(StandardCharsets.UTF_8));
        +        // Some cipher requires IV to be different, so re-instantiate a cipher
        +        c = Cipher.getInstance(alg, s.getProvider());
        +        c.init(Cipher.ENCRYPT_MODE, key, spec, new SeededSecureRandom(SEED));
        +        var ct2 = c.doFinal("asimpleplaintext".getBytes(StandardCharsets.UTF_8));
        +        Asserts.assertEqualsByteArray(ct1, ct2);
        +        hash = Objects.hash(hash, Arrays.hashCode(ct1));
        +        System.out.println("    Passed");
        +    }
        +
        +    static void testAlgorithmParameterGenerator(Provider.Service s) throws Exception {
        +        System.out.println(s.getProvider().getName()
        +                + " " + s.getType() + "." + s.getAlgorithm());
        +        var apg = AlgorithmParameterGenerator.getInstance(s.getAlgorithm(), s.getProvider());
        +        apg.init(1024, new SeededSecureRandom(SEED));
        +        var p1 = apg.generateParameters().getParameterSpec(AlgorithmParameterSpec.class);
        +        apg.init(1024, new SeededSecureRandom(SEED));
        +        var p2 = apg.generateParameters().getParameterSpec(AlgorithmParameterSpec.class);
        +        if (p1 instanceof DSAParameterSpec d1 && p2 instanceof DSAParameterSpec d2) {
        +            Asserts.assertEQ(d1.getG(), d2.getG());
        +            Asserts.assertEQ(d1.getP(), d2.getP());
        +            Asserts.assertEQ(d1.getQ(), d2.getQ());
        +            hash = Objects.hash(hash, d1.getG(), d1.getP(), d1.getQ());
        +        } else if (p1 instanceof DHParameterSpec d1 && p2 instanceof DHParameterSpec d2){
        +            Asserts.assertEQ(d1.getG(), d2.getG());
        +            Asserts.assertEQ(d1.getP(), d2.getP());
        +            Asserts.assertEQ(d1.getL(), d2.getL());
        +            hash = Objects.hash(hash, d1.getG(), d1.getP(), d1.getL());
        +        } else {
        +            Asserts.assertEQ(p1, p2);
        +            hash = Objects.hash(hash, p1);
        +        }
        +        System.out.println("    Passed");
        +    }
        +
        +    private static void testSignature(Provider.Service s) throws Exception {
        +        System.out.println(s.getProvider().getName()
        +                + " " + s.getType() + "." + s.getAlgorithm());
        +        String keyAlg = SignatureUtil.extractKeyAlgFromDwithE(s.getAlgorithm());
        +        if (keyAlg == null) {
        +            if (s.getAlgorithm().equals("HSS/LMS")) {
        +                // We don't support HSS/LMS key generation and signing
        +                System.out.println("    Ignored: HSS/LMS");
        +                return;
        +            } else {
        +                keyAlg = s.getAlgorithm(); // EdDSA etc
        +            }
        +        }
        +        var sk = generateKeyPair(keyAlg, 0).getPrivate();
        +        var sig = Signature.getInstance(s.getAlgorithm(), s.getProvider());
        +        try {
        +            if (keyAlg.equals("RSASSA-PSS")) {
        +                sig.setParameter(PSSParameterSpec.DEFAULT);
        +            }
        +            sig.initSign(sk, new SeededSecureRandom(SEED));
        +            sig.update(new byte[20]);
        +            var s1 = sig.sign();
        +            sig.initSign(sk, new SeededSecureRandom(SEED));
        +            sig.update(new byte[20]);
        +            var s2 = sig.sign();
        +            Asserts.assertEqualsByteArray(s1, s2);
        +            hash = Objects.hash(hash, Arrays.hashCode(s1));
        +            System.out.println("    Passed");
        +        } catch (InvalidKeyException ike) {
        +            System.out.println("    Ignored: " + ike.getMessage());
        +        }
        +    }
        +
        +    static void testKeyPairGenerator(Provider.Service s) throws Exception {
        +        System.out.println(s.getProvider().getName()
        +                + " " + s.getType() + "." + s.getAlgorithm());
        +        var kp1 = generateKeyPair(s.getAlgorithm(), 0);
        +        var kp2 = generateKeyPair(s.getAlgorithm(), 0);
        +        Asserts.assertEqualsByteArray(
        +                kp1.getPrivate().getEncoded(), kp2.getPrivate().getEncoded());
        +        Asserts.assertEqualsByteArray(
        +                kp1.getPublic().getEncoded(), kp2.getPublic().getEncoded());
        +        hash = Objects.hash(hash,
        +                Arrays.hashCode(kp1.getPrivate().getEncoded()),
        +                Arrays.hashCode(kp1.getPublic().getEncoded()));
        +        System.out.println("    Passed");
        +    }
        +
        +    static KeyPair generateKeyPair(String alg, int offset) throws Exception {
        +        var g = KeyPairGenerator.getInstance(alg);
        +        var size = switch (g.getAlgorithm()) {
        +            case "RSA", "RSASSA-PSS", "DSA", "DiffieHellman" -> 1024;
        +            case "EC" -> 256;
        +            case "EdDSA", "Ed25519", "XDH", "X25519" -> 255;
        +            case "Ed448", "X448" -> 448;
        +            default -> throw new UnsupportedOperationException(alg);
        +        };
        +        g.initialize(size, new SeededSecureRandom(SEED + offset));
        +        return g.generateKeyPair();
        +    }
        +
        +    static void testKeyGenerator(Provider.Service s) throws Exception {
        +        System.out.println(s.getProvider().getName()
        +                + " " + s.getType() + "." + s.getAlgorithm());
        +        if (s.getAlgorithm().startsWith("SunTls")) {
        +            System.out.println("    Ignored");
        +            return;
        +        }
        +        var k1 = generateKey(s.getAlgorithm(), s.getProvider());
        +        var k2 = generateKey(s.getAlgorithm(), s.getProvider());
        +        Asserts.assertEqualsByteArray(k1.getEncoded(), k2.getEncoded());
        +        hash = Objects.hash(hash,
        +                Arrays.hashCode(k1.getEncoded()));
        +        System.out.println("    Passed");
        +    }
        +
        +    static Key generateKey(String s, Provider p) throws Exception {
        +        if (s.startsWith("AES_")) {
        +            var g = KeyGenerator.getInstance("AES", p);
        +            g.init(Integer.parseInt(s.substring(4)), new SeededSecureRandom(SEED + 1));
        +            return g.generateKey();
        +        } if (s.startsWith("ChaCha")) {
        +            var g = KeyGenerator.getInstance("ChaCha20", p);
        +            g.init(new SeededSecureRandom(SEED + 2));
        +            return g.generateKey();
        +        } if (s.equals("RSA")) {
        +            return generateKeyPair("RSA", 3).getPublic();
        +        } else {
        +            var g = KeyGenerator.getInstance(s, p);
        +            g.init(new SeededSecureRandom(SEED + 4));
        +            return g.generateKey();
        +        }
        +    }
        +
        +    static void testKEM(Provider.Service s) throws Exception {
        +        System.out.println(s.getProvider().getName()
        +                + " " + s.getType() + "." + s.getAlgorithm());
        +        String keyAlg = getKeyAlgFromKEM(s.getAlgorithm());
        +        var kp = generateKeyPair(keyAlg, 10);
        +        var kem = KEM.getInstance(s.getAlgorithm(), s.getProvider());
        +        var e1 = kem.newEncapsulator(kp.getPublic(), null, new SeededSecureRandom(SEED));
        +        var enc1 = e1.encapsulate();
        +        var e2 = kem.newEncapsulator(kp.getPublic(), null, new SeededSecureRandom(SEED));
        +        var enc2 = e2.encapsulate();
        +        Asserts.assertEqualsByteArray(enc1.encapsulation(), enc2.encapsulation());
        +        Asserts.assertEqualsByteArray(enc1.key().getEncoded(), enc2.key().getEncoded());
        +        hash = Objects.hash(hash, Arrays.hashCode(enc1.encapsulation()),
        +                Arrays.hashCode(enc1.key().getEncoded()));
        +        System.out.println("    Passed");
        +    }
        +
        +    static void testKeyAgreement(Provider.Service s) throws Exception {
        +        System.out.println(s.getProvider().getName()
        +                + " " + s.getType() + "." + s.getAlgorithm());
        +        String keyAlg = getKeyAlgFromKEM(s.getAlgorithm());
        +        var kpS = generateKeyPair(keyAlg, 11);
        +        var kpR = generateKeyPair(keyAlg, 12);
        +        var ka = KeyAgreement.getInstance(s.getAlgorithm(), s.getProvider());
        +        ka.init(kpS.getPrivate(), new SeededSecureRandom(SEED));
        +        ka.doPhase(kpR.getPublic(), true);
        +        var sc1 = ka.generateSecret();
        +        ka.init(kpS.getPrivate(), new SeededSecureRandom(SEED));
        +        ka.doPhase(kpR.getPublic(), true);
        +        var sc2 = ka.generateSecret();
        +
        +        Asserts.assertEqualsByteArray(sc1, sc2);
        +        hash = Objects.hash(hash, Arrays.hashCode(sc1));
        +        System.out.println("    Passed");
        +    }
        +
        +    static String getKeyAlgFromKEM(String algorithm) {
        +        return switch (algorithm) {
        +            case "DHKEM" -> "X25519";
        +            case "ECDH" -> "EC";
        +            default -> algorithm;
        +        };
        +    }
        +}
        diff --git a/test/jdk/sun/security/ssl/DHKeyExchange/LegacyDHEKeyExchange.java b/test/jdk/sun/security/ssl/DHKeyExchange/LegacyDHEKeyExchange.java
        index 206761025c4..cac7c832402 100644
        --- a/test/jdk/sun/security/ssl/DHKeyExchange/LegacyDHEKeyExchange.java
        +++ b/test/jdk/sun/security/ssl/DHKeyExchange/LegacyDHEKeyExchange.java
        @@ -1,5 +1,5 @@
         /*
        - * Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved.
        + * Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved.
          * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
          *
          * This code is free software; you can redistribute it and/or modify it
        @@ -51,7 +51,7 @@ protected void runServerApplication(SSLSocket socket) throws Exception {
                     throw new Exception("Legacy DH keys (< 1024) should be restricted");
                 } catch (SSLHandshakeException she) {
                     String expectedExMsg = "Received fatal alert: insufficient_security";
        -            if (!expectedExMsg.equals(she.getMessage())) {
        +            if (!she.getMessage().endsWith(expectedExMsg)) {
                         throw she;
                     }
                     System.out.println("Expected exception thrown in server");
        @@ -77,7 +77,7 @@ protected void runClientApplication(SSLSocket socket) throws Exception {
                 } catch (SSLHandshakeException she) {
                     String expectedExMsg = "DH ServerKeyExchange does not comply to" +
                             " algorithm constraints";
        -            if (!expectedExMsg.equals(she.getMessage())) {
        +            if (!she.getMessage().endsWith(expectedExMsg)) {
                         throw she;
                     }
                     System.out.println("Expected exception thrown in client");
        diff --git a/test/jdk/sun/security/ssl/SignatureScheme/SigAlgosExtTestWithTLS12.java b/test/jdk/sun/security/ssl/SignatureScheme/SigAlgosExtTestWithTLS12.java
        index 30a01552b30..598c0fe62af 100644
        --- a/test/jdk/sun/security/ssl/SignatureScheme/SigAlgosExtTestWithTLS12.java
        +++ b/test/jdk/sun/security/ssl/SignatureScheme/SigAlgosExtTestWithTLS12.java
        @@ -1,5 +1,6 @@
         /*
        - * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
        + * Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved.
        + * Copyright (C) 2021, 2024 THL A29 Limited, a Tencent company. All rights reserved.
          * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
          *
          * This code is free software; you can redistribute it and/or modify it
        @@ -122,7 +123,7 @@ public static void main(String[] args) throws Exception {
                                 "Expected SSLHandshakeException wasn't thrown");
                     }
                 } catch (SSLHandshakeException e) {
        -            if (EXPECT_FAIL && e.getMessage().equals(
        +            if (EXPECT_FAIL && e.getMessage().endsWith(
                             "No supported signature algorithm")) {
                         System.out.println("Expected SSLHandshakeException");
                     } else {
        diff --git a/test/jdk/sun/security/ssl/SignatureScheme/SigAlgosExtTestWithTLS13.java b/test/jdk/sun/security/ssl/SignatureScheme/SigAlgosExtTestWithTLS13.java
        index 49e8da8af78..2ad48f59e83 100644
        --- a/test/jdk/sun/security/ssl/SignatureScheme/SigAlgosExtTestWithTLS13.java
        +++ b/test/jdk/sun/security/ssl/SignatureScheme/SigAlgosExtTestWithTLS13.java
        @@ -1,4 +1,5 @@
         /*
        + * Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved.
          * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
          * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
          *
        @@ -78,7 +79,7 @@ public static void main(String[] args) throws Exception {
                                 "Expected SSLHandshakeException wasn't thrown");
                     }
                 } catch (SSLHandshakeException e) {
        -            if (expectFail && e.getMessage().equals(
        +            if (expectFail && e.getMessage().endsWith(
                             "No supported signature algorithm")) {
                         System.out.println("Expected SSLHandshakeException");
                     } else {
        diff --git a/test/jtreg-ext/requires/VMProps.java b/test/jtreg-ext/requires/VMProps.java
        index f4c1b60f4e3..a52f0081e5a 100644
        --- a/test/jtreg-ext/requires/VMProps.java
        +++ b/test/jtreg-ext/requires/VMProps.java
        @@ -653,14 +653,15 @@ private String jdkContainerized() {
              * Checks if we are in almost out-of-box configuration, i.e. the flags
              * which JVM is started with don't affect its behavior "significantly".
              * {@code TEST_VM_FLAGLESS} enviroment variable can be used to force this
        -     * method to return true and allow any flags.
        +     * method to return true or false and allow or reject any flags.
              *
              * @return true if there are no JVM flags
              */
             private String isFlagless() {
                 boolean result = true;
        -        if (System.getenv("TEST_VM_FLAGLESS") != null) {
        -            return "" + result;
        +        String flagless = System.getenv("TEST_VM_FLAGLESS");
        +        if (flagless != null) {
        +            return "" + "true".equalsIgnoreCase(flagless);
                 }
         
                 List allFlags = allFlags().toList();
        diff --git a/test/langtools/ProblemList.txt b/test/langtools/ProblemList.txt
        index 7e0d788809a..ab067034f10 100644
        --- a/test/langtools/ProblemList.txt
        +++ b/test/langtools/ProblemList.txt
        @@ -66,6 +66,7 @@ tools/javac/annotations/typeAnnotations/referenceinfos/Lambda.java
         tools/javac/annotations/typeAnnotations/referenceinfos/NestedTypes.java         8057687    generic-all    emit correct byte code an attributes for type annotations
         tools/javac/warnings/suppress/TypeAnnotations.java                              8057683    generic-all    improve ordering of errors with type annotations
         tools/javac/modules/SourceInSymlinkTest.java                                    8180263    windows-all    fails when run on a subst drive
        +tools/javac/patterns/Exhaustiveness.java 					8326616    generic-all    intermittently timeout
         
         ###########################################################################
         #
        diff --git a/test/langtools/jdk/javadoc/doclet/testSearch/TestSearch.java b/test/langtools/jdk/javadoc/doclet/testSearch/TestSearch.java
        index 1201eb52160..a7f1ad91ced 100644
        --- a/test/langtools/jdk/javadoc/doclet/testSearch/TestSearch.java
        +++ b/test/langtools/jdk/javadoc/doclet/testSearch/TestSearch.java
        @@ -434,7 +434,7 @@ void checkSearchOutput(String fileName, boolean expectedOutput) {
                         """
                             """);
             }
        diff --git a/test/langtools/jdk/javadoc/doclet/testSpecTag/TestSpecTag.java b/test/langtools/jdk/javadoc/doclet/testSpecTag/TestSpecTag.java
        index 095e8b4a344..265dfcb8600 100644
        --- a/test/langtools/jdk/javadoc/doclet/testSpecTag/TestSpecTag.java
        +++ b/test/langtools/jdk/javadoc/doclet/testSpecTag/TestSpecTag.java
        @@ -134,7 +134,7 @@ public void testNavigation(Path base) throws IOException {
                             
                             
                             
        diff --git a/test/langtools/jdk/javadoc/doclet/testUseOption/TestUseOption.java b/test/langtools/jdk/javadoc/doclet/testUseOption/TestUseOption.java
        index ed96377c7e3..f5f6ff213a0 100644
        --- a/test/langtools/jdk/javadoc/doclet/testUseOption/TestUseOption.java
        +++ b/test/langtools/jdk/javadoc/doclet/testUseOption/TestUseOption.java
        @@ -1,5 +1,5 @@
         /*
        - * Copyright (c) 2002, 2022, Oracle and/or its affiliates. All rights reserved.
        + * Copyright (c) 2002, 2024, Oracle and/or its affiliates. All rights reserved.
          * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
          *
          * This code is free software; you can redistribute it and/or modify it
        @@ -24,15 +24,20 @@
         /*
          * @test
          * @bug 4496290 4985072 7006178 7068595 8016328 8050031 8048351 8081854 8071982 8162363 8175200 8186332
        - *      8182765 8196202 8202626 8261976
        + *      8182765 8196202 8202626 8261976 8323698
          * @summary A simple test to ensure class-use files are correct.
        - * @library ../../lib
        + * @library /tools/lib ../../lib
          * @modules jdk.javadoc/jdk.javadoc.internal.tool
          * @build javadoc.tester.*
          * @run main TestUseOption
          */
         
         import javadoc.tester.JavadocTester;
        +import toolbox.ToolBox;
        +
        +import java.io.IOException;
        +import java.nio.file.Files;
        +import java.nio.file.Path;
         
         public class TestUseOption extends JavadocTester {
         
        @@ -41,6 +46,8 @@ public static void main(String... args) throws Exception {
                 tester.runTests();
             }
         
        +    private final ToolBox tb = new ToolBox();
        +
             @Test
             public void test1() {
                 javadoc("-d", "out-1",
        @@ -191,4 +198,83 @@ public void test3() {
                         """
                             """);
             }
        +
        +    @Test
        +    public void testSuperclassAndInterfaceTypeArgument(Path base) throws IOException {
        +        Path src = base.resolve("src");
        +
        +        Files.createDirectories(src);
        +        tb.writeJavaFiles(src,
        +                """
        +                    public class One {}
        +                    """,
        +                """
        +                    import java.util.*;
        +                    public class Two extends ArrayList implements Comparator {
        +                    }
        +                    """,
        +                """
        +                    import java.util.*;
        +                    public interface Three extends Comparator {
        +                    }
        +                    """);
        +
        +        javadoc(
        +                "-use",
        +                "-d", base.resolve("out").toString(),
        +                src.resolve("One.java").toString(),
        +                src.resolve("Two.java").toString(),
        +                src.resolve("Three.java").toString()
        +        );
        +        checkExit(Exit.OK);
        +
        +        checkOrder("class-use/One.html",
        +                """
        +                    
        +                    """,
        +                """
        +                    
        +
        Modifier and Type
        +
        Class
        +
        Description
        +
        class 
        + +
         
        +
        + """, + """ +
        Subinterfaces with type arguments of \ + type One \ + in Unnamed Package
        + """, + """ +
        +
        Modifier and Type
        +
        Interface
        +
        Description
        +
        interface 
        + +
         
        +
        + """, + """ +
        Classes in \ + Unnamed Package that implement interfaces with type arguments of type \ + One
        + """, + """ +
        +
        Modifier and Type
        +
        Class
        +
        Description
        +
        class 
        + +
         
        +
        + """); + } } diff --git a/test/langtools/tools/javac/patterns/Exhaustiveness.java b/test/langtools/tools/javac/patterns/Exhaustiveness.java index dad1a0c86f8..726bd1d9a2e 100644 --- a/test/langtools/tools/javac/patterns/Exhaustiveness.java +++ b/test/langtools/tools/javac/patterns/Exhaustiveness.java @@ -23,7 +23,7 @@ /** * @test - * @bug 8262891 8268871 8274363 8281100 8294670 8311038 8311815 + * @bug 8262891 8268871 8274363 8281100 8294670 8311038 8311815 8325215 * @summary Check exhaustiveness of switches over sealed types. * @library /tools/lib * @modules jdk.compiler/com.sun.tools.javac.api @@ -1996,6 +1996,86 @@ case Pair(D fst, D snd) -> { """); } + @Test //JDK-8325215: + public void testTooGenericPatternInRecord(Path base) throws Exception { + doTest(base, + new String[0], + """ + package test; + public class Test { + sealed interface A permits T, U {} + sealed interface B permits V, W {} + + static final class T implements A { public T() {} } + static final class U implements A { public U() {} } + + static final class V implements B { public V() {} } + static final class W implements B { public W() {} } + + final static record R(A a, B b) { } + + static int r(R r) { + return switch (r) { + case R(A a, V b) -> 1; // Any A with specific B + case R(T a, B b) -> 2; // Specific A with any B + case R(U a, W b) -> 3; // Specific A with specific B + }; + } + } + """); + doTest(base, + new String[0], + """ + package test; + public class Test { + sealed interface A permits T, U {} + sealed interface B permits V, W {} + + static final class T implements A { public T() {} } + static final class U implements A { public U() {} } + + static final class V implements B { public V() {} } + static final class W implements B { public W() {} } + + final static record R(B b, A a) { } + + static int r(R r) { + return switch (r) { + case R(V b, A a) -> 1; // Any A with specific B + case R(B b, T a) -> 2; // Specific A with any B + case R(W b, U a) -> 3; // Specific A with specific B + }; + } + } + """); + doTest(base, + new String[0], + """ + package test; + public class Test { + sealed interface A permits T, U {} + sealed interface B permits V, W {} + + static final class T implements A { public T() {} } + static final class U implements A { public U() {} } + + static final class V implements B { public V() {} } + static final class W implements B { public W() {} } + + final static record X(B b) { } + final static record R(A a, X x) { } + + static int r(R r) { + return switch (r) { + case R(A a, X(V b)) -> 1; // Any A with specific B + case R(T a, X(B b)) -> 2; // Specific A with any B + case R(U a, X(W b)) -> 3; // Specific A with specific B + }; + } + } + """); + } + private void doTest(Path base, String[] libraryCode, String testCode, String... expectedErrors) throws IOException { doTest(base, libraryCode, testCode, false, expectedErrors); } diff --git a/test/langtools/tools/javac/patterns/TranslationTest.java b/test/langtools/tools/javac/patterns/TranslationTest.java index b509b2be3f9..f69783f6b85 100644 --- a/test/langtools/tools/javac/patterns/TranslationTest.java +++ b/test/langtools/tools/javac/patterns/TranslationTest.java @@ -23,7 +23,7 @@ /** * @test - * @bug 8291769 + * @bug 8291769 8326129 * @summary Check expected translation of various pattern related constructs * @library /tools/lib * @modules jdk.compiler/com.sun.tools.javac.api @@ -31,7 +31,7 @@ * jdk.compiler/com.sun.tools.javac.main * jdk.compiler/com.sun.tools.javac.tree * jdk.compiler/com.sun.tools.javac.util - * @build toolbox.ToolBox toolbox.JavacTask + * @build toolbox.ToolBox toolbox.JavacTask toolbox.JavaTask * @run main TranslationTest */ @@ -48,6 +48,7 @@ import com.sun.tools.javac.tree.TreeScanner; import com.sun.tools.javac.util.Context; import com.sun.tools.javac.util.Context.Factory; +import java.io.File; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; @@ -56,6 +57,7 @@ import java.util.List; import toolbox.TestRunner; +import toolbox.JavaTask; import toolbox.JavacTask; import toolbox.Task; import toolbox.ToolBox; @@ -188,6 +190,38 @@ private int test(Object obj) { """); } + @Test //JDK-8326129 + public void testRunWithNull(Path base) throws Exception { + doRunTest(base, + new String[]{""" + package lib; + public record Box(Object o) {} + """}, + """ + import lib.*; + public class Test { + public static void main(String... args) { + System.err.println(new Test().test(new Box(null))); + } + private int test(Box b) { + return switch (b) { + case Box(Integer i) -> 0; + case Box(Object o) when check(o) -> 1; + case Box(Object o) -> 2; + }; + } + private static int c; + private boolean check(Object o) { + System.err.println("check: " + o); + if (c++ > 10) throw new IllegalStateException(); + return o != null; + } + } + """, + "check: null", + "2"); + } + private void doTest(Path base, String[] libraryCode, String testCode, Callback callback, String expectedOutput) throws IOException { Path current = base.resolve("."); @@ -322,4 +356,51 @@ public JCTree translateTopLevelClass(Env env, JCTree cdef, TreeMake } } + + private void doRunTest(Path base, String[] libraryCode, String testCode, + String... expectedOutput) throws IOException { + Path current = base.resolve("."); + Path libClasses = current.resolve("libClasses"); + + Files.createDirectories(libClasses); + + if (libraryCode.length != 0) { + Path libSrc = current.resolve("lib-src"); + + for (String code : libraryCode) { + tb.writeJavaFiles(libSrc, code); + } + + new JavacTask(tb) + .outdir(libClasses) + .files(tb.findJavaFiles(libSrc)) + .run(); + } + + Path src = current.resolve("src"); + tb.writeJavaFiles(src, testCode); + + Path classes = current.resolve("classes"); + + Files.createDirectories(classes); + + new JavacTask(tb) + .options("-Xlint:-preview", + "--class-path", libClasses.toString()) + .outdir(classes) + .files(tb.findJavaFiles(src)) + .run() + .writeAll(); + + List log = new JavaTask(tb) + .classpath(libClasses.toString() + File.pathSeparatorChar + classes.toString()) + .classArgs("Test") + .run() + .getOutputLines(Task.OutputKind.STDERR); + + if (!List.of(expectedOutput).equals(log)) { + throw new AssertionError("Expected: " + expectedOutput + + "but got: " + log); + } + } } diff --git a/test/lib-test/jdk/test/lib/AssertsTest.java b/test/lib-test/jdk/test/lib/AssertsTest.java index a4c739d64ba..9acb6be98c5 100644 --- a/test/lib-test/jdk/test/lib/AssertsTest.java +++ b/test/lib-test/jdk/test/lib/AssertsTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,7 +21,11 @@ * questions. */ +import jdk.test.lib.Asserts; + import java.lang.SuppressWarnings; +import java.util.Arrays; +import java.util.HexFormat; import static jdk.test.lib.Asserts.*; @@ -49,6 +53,7 @@ public static void main(String[] args) throws Exception { testLessThan(); testLessThanOrEqual(); testEquals(); + testEqualsByteArray(); testGreaterThanOrEqual(); testGreaterThan(); testNotEquals(); @@ -90,6 +95,26 @@ private static void testEquals() throws Exception { expectFail(Assertion.LTE, 2, null); } + private static void testEqualsByteArray() throws Exception { + byte[] b1 = new byte[1]; + byte[] b11 = new byte[1]; + byte[] b2 = new byte[2]; + + expectPass(Assertion.EQBA, b1, b1); + expectPass(Assertion.EQBA, b1, b11); + expectPass(Assertion.EQBA, (byte[])null, (byte[])null); + expectPass(Assertion.NEQBA, b1, b2); + expectPass(Assertion.NEQBA, b1, (byte[])null); + expectPass(Assertion.NEQBA, (byte[])null, b1); + + expectFail(Assertion.EQBA, b1, b2); + expectFail(Assertion.EQBA, (byte[])null, b1); + expectFail(Assertion.EQBA, b1, (byte[])null); + expectFail(Assertion.NEQBA, b1, b1); + expectFail(Assertion.NEQBA, b1, b11); + expectFail(Assertion.NEQBA, (byte[])null, (byte[])null); + } + private static void testGreaterThanOrEqual() throws Exception { expectPass(Assertion.GTE, 1, 1); expectPass(Assertion.GTE, 2, 1); @@ -191,10 +216,47 @@ private static > void expectFail(Assertion assertion, T " to throw a RuntimeException"); } + private static void expectPass(Assertion assertion, byte[] b1, byte[] b2) + throws Exception { + if (assertion == Assertion.EQBA) { + String msg = "Expected " + Assertion.asString("assertEqualsByteArray", + Arrays.toString(b1), Arrays.toString(b2)) + " to pass"; + Asserts.assertEqualsByteArray(b1, b2, msg); + } else { + String msg = "Expected " + Assertion.asString("assertNotEqualsByteArray", + Arrays.toString(b1), Arrays.toString(b2)) + " to pass"; + Asserts.assertNotEqualsByteArray(b1, b2, msg); + } + } + + private static void expectFail(Assertion assertion, byte[] b1, byte[] b2) + throws Exception { + if (assertion == Assertion.EQBA) { + try { + Asserts.assertEqualsByteArray(b1, b2); + } catch (RuntimeException e) { + return; + } + throw new Exception("Expected " + + Assertion.asString("assertEqualsByteArray", + Arrays.toString(b1), Arrays.toString(b2)) + + " to throw a RuntimeException"); + } else { + try { + Asserts.assertNotEqualsByteArray(b1, b2); + } catch (RuntimeException e) { + return; + } + throw new Exception("Expected " + + Assertion.asString("assertNotEqualsByteArray", + Arrays.toString(b1), Arrays.toString(b2)) + + " to throw a RuntimeException"); + } + } } enum Assertion { - LT, LTE, EQ, GTE, GT, NE, NULL, NOTNULL, FALSE, TRUE; + LT, LTE, EQ, EQBA, NEQBA, GTE, GT, NE, NULL, NOTNULL, FALSE, TRUE; @SuppressWarnings("unchecked") public static > void run(Assertion assertion, T ... args) { @@ -262,7 +324,7 @@ public static String format(Assertion assertion, Object ... args) { } } - private static String asString(String assertion, Object ... args) { + public static String asString(String assertion, Object ... args) { if (args == null) { return String.format("%s(null)", assertion); } diff --git a/test/lib-test/jdk/test/lib/security/SeededSecureRandomTest.java b/test/lib-test/jdk/test/lib/security/SeededSecureRandomTest.java new file mode 100644 index 00000000000..f5f74a16f72 --- /dev/null +++ b/test/lib-test/jdk/test/lib/security/SeededSecureRandomTest.java @@ -0,0 +1,63 @@ +/* + * Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package jdk.test.lib.security; + +import jdk.test.lib.Asserts; + +/* + * @test + * @library /test/lib + * @run main/othervm jdk.test.lib.security.SeededSecureRandomTest + */ +public class SeededSecureRandomTest { + + private static final String PROP = "secure.random.seed"; + + public static void main(String[] args) throws Exception { + try { + System.clearProperty(PROP); + Asserts.assertNE(get(), get()); // random seed (different) + Asserts.assertEQ(get(1L), get(1L)); // same seed + Asserts.assertEQ(get(10L), get(10L)); // same seed + Asserts.assertNE(get(1L), get(10L)); // different seed + + System.setProperty(PROP, "10"); + Asserts.assertEQ(get(), get()); // seed set by system property + Asserts.assertNE(get(), get(1L)); // seed set not system property + Asserts.assertEQ(get(), get(10L)); // seed set same as system property + Asserts.assertEQ(get(1L), get(1L)); // same seed + Asserts.assertEQ(get(10L), get(10L)); // same seed + Asserts.assertNE(get(1L), get(10L)); // different seed + } finally { + System.clearProperty(PROP); + } + } + + static int get() { + return new SeededSecureRandom(SeededSecureRandom.seed()).nextInt(); + } + + static int get(long seed) { + return new SeededSecureRandom(seed).nextInt(); + } +} diff --git a/test/lib/jdk/test/lib/Asserts.java b/test/lib/jdk/test/lib/Asserts.java index d503ea8e544..893f1a1a737 100644 --- a/test/lib/jdk/test/lib/Asserts.java +++ b/test/lib/jdk/test/lib/Asserts.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,6 +23,8 @@ package jdk.test.lib; +import java.util.Arrays; +import java.util.HexFormat; import java.util.Objects; /** @@ -199,10 +201,7 @@ public static void assertEquals(Object lhs, Object rhs) { */ public static void assertEquals(Object lhs, Object rhs, String msg) { if ((lhs != rhs) && ((lhs == null) || !(lhs.equals(rhs)))) { - msg = Objects.toString(msg, "assertEquals") - + ": expected " + Objects.toString(lhs) - + " to equal " + Objects.toString(rhs); - fail(msg); + fail((msg == null ? "assertEquals" : msg) + " expected: " + lhs + " but was: " + rhs); } } @@ -234,6 +233,64 @@ public static void assertSame(Object lhs, Object rhs, String msg) { } } + /** + * Asserts that {@code lhs} is the same byte array as {@code rhs}. + * + * @param lhs The left hand side of the comparison. + * @param rhs The right hand side of the comparison. + * @throws RuntimeException if the assertion is not true. + * @see #assertEqualsByteArray(byte[], byte[], String) + */ + public static void assertEqualsByteArray(byte[] lhs, byte[] rhs) { + assertEqualsByteArray(lhs, rhs, null); + } + + /** + * Asserts that {@code lhs} is not the same byte array as {@code rhs}. + * + * @param lhs The left hand side of the comparison. + * @param rhs The right hand side of the comparison. + * @throws RuntimeException if the assertion is not true. + * @see #assertNotEqualsByteArray(byte[], byte[], String) + */ + public static void assertNotEqualsByteArray(byte[] lhs, byte[] rhs) { + assertNotEqualsByteArray(lhs, rhs, null); + } + + /** + * Asserts that {@code lhs} is the same byte array as {@code rhs}. + * + * @param lhs The left hand side of the comparison. + * @param rhs The right hand side of the comparison. + * @param msg A description of the assumption; {@code null} for a default message. + * @throws RuntimeException if the assertion is not true. + */ + public static void assertEqualsByteArray(byte[] lhs, byte[] rhs, String msg) { + if (!Arrays.equals(lhs, rhs)) { + msg = Objects.toString(msg, "assertEqualsByteArray") + + ": expected " + HexFormat.of().formatHex(lhs) + + " to equal " + HexFormat.of().formatHex(rhs); + fail(msg); + } + } + + /** + * Asserts that {@code lhs} is not the same byte array as {@code rhs}. + * + * @param lhs The left hand side of the comparison. + * @param rhs The right hand side of the comparison. + * @param msg A description of the assumption; {@code null} for a default message. + * @throws RuntimeException if the assertion is not true. + */ + public static void assertNotEqualsByteArray(byte[] lhs, byte[] rhs, String msg) { + if (Arrays.equals(lhs, rhs)) { + msg = Objects.toString(msg, "assertNotEqualsByteArray") + + ": expected " + HexFormat.of().formatHex(lhs) + + " to not equal " + HexFormat.of().formatHex(rhs); + fail(msg); + } + } + /** * Shorthand for {@link #assertGreaterThanOrEqual(Comparable, Comparable)}. * diff --git a/test/lib/jdk/test/lib/jvmti/jvmti_common.h b/test/lib/jdk/test/lib/jvmti/jvmti_common.hpp similarity index 94% rename from test/lib/jdk/test/lib/jvmti/jvmti_common.h rename to test/lib/jdk/test/lib/jvmti/jvmti_common.hpp index 6a0bcf25331..9fdd4cf4cb8 100644 --- a/test/lib/jdk/test/lib/jvmti/jvmti_common.h +++ b/test/lib/jdk/test/lib/jvmti/jvmti_common.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * 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,8 +21,8 @@ * questions. */ -#ifndef JVMTI_COMMON_H -#define JVMTI_COMMON_H +#ifndef JVMTI_COMMON_HPP +#define JVMTI_COMMON_HPP #include #include @@ -60,8 +60,8 @@ const char* TranslateState(jint flags); const char* TranslateError(jvmtiError err); -static jvmtiExtensionFunction GetVirtualThread_func = NULL; -static jvmtiExtensionFunction GetCarrierThread_func = NULL; +static jvmtiExtensionFunction GetVirtualThread_func = nullptr; +static jvmtiExtensionFunction GetCarrierThread_func = nullptr; /** * Convert the digits of the given value argument to a null-terminated @@ -203,15 +203,15 @@ deallocate(jvmtiEnv *jvmti, JNIEnv* jni, void* ptr) { static char* get_method_class_name(jvmtiEnv *jvmti, JNIEnv* jni, jmethodID method) { - jclass klass = NULL; - char* cname = NULL; - char* result = NULL; + jclass klass = nullptr; + char* cname = nullptr; + char* result = nullptr; jvmtiError err; err = jvmti->GetMethodDeclaringClass(method, &klass); check_jvmti_status(jni, err, "get_method_class_name: error in JVMTI GetMethodDeclaringClass"); - err = jvmti->GetClassSignature(klass, &cname, NULL); + err = jvmti->GetClassSignature(klass, &cname, nullptr); check_jvmti_status(jni, err, "get_method_class_name: error in JVMTI GetClassSignature"); size_t len = strlen(cname) - 2; // get rid of leading 'L' and trailing ';' @@ -228,14 +228,14 @@ get_method_class_name(jvmtiEnv *jvmti, JNIEnv* jni, jmethodID method) { static void print_method(jvmtiEnv *jvmti, JNIEnv* jni, jmethodID method, jint depth) { - char* cname = NULL; - char* mname = NULL; - char* msign = NULL; + char* cname = nullptr; + char* mname = nullptr; + char* msign = nullptr; jvmtiError err; cname = get_method_class_name(jvmti, jni, method); - err = jvmti->GetMethodName(method, &mname, &msign, NULL); + err = jvmti->GetMethodName(method, &mname, &msign, nullptr); check_jvmti_status(jni, err, "print_method: error in JVMTI GetMethodName"); LOG("%2d: %s: %s%s\n", depth, cname, mname, msign); @@ -297,14 +297,14 @@ get_thread_name(jvmtiEnv *jvmti, JNIEnv* jni, jthread thread) { memset(&thr_info, 0, sizeof(thr_info)); err = jvmti->GetThreadInfo(thread, &thr_info); if (err == JVMTI_ERROR_WRONG_PHASE || err == JVMTI_ERROR_THREAD_NOT_ALIVE) { - return NULL; // VM or target thread completed its work + return nullptr; // VM or target thread completed its work } check_jvmti_status(jni, err, "get_thread_name: error in JVMTI GetThreadInfo call"); static const char* UNNAMED_STR = ""; static size_t UNNAMED_LEN = strlen(UNNAMED_STR); char* tname = thr_info.name; - if (tname == NULL) { + if (tname == nullptr) { err = jvmti->Allocate((jlong)(UNNAMED_LEN + 1), (unsigned char**)&tname); check_jvmti_status(jni, err, "get_method_class_name: error in JVMTI Allocate"); strncpy(tname, UNNAMED_STR, UNNAMED_LEN); @@ -315,10 +315,10 @@ get_thread_name(jvmtiEnv *jvmti, JNIEnv* jni, jthread thread) { static char* get_method_name(jvmtiEnv *jvmti, JNIEnv* jni, jmethodID method) { - char* mname = NULL; + char* mname = nullptr; jvmtiError err; - err = jvmti->GetMethodName(method, &mname, NULL, NULL); + err = jvmti->GetMethodName(method, &mname, nullptr, nullptr); check_jvmti_status(jni, err, "get_method_name: error in JVMTI GetMethodName call"); return mname; @@ -326,7 +326,7 @@ get_method_name(jvmtiEnv *jvmti, JNIEnv* jni, jmethodID method) { static jclass find_class(jvmtiEnv *jvmti, JNIEnv *jni, jobject loader, const char* cname) { - jclass *classes = NULL; + jclass *classes = nullptr; jint count = 0; jvmtiError err; @@ -335,10 +335,10 @@ find_class(jvmtiEnv *jvmti, JNIEnv *jni, jobject loader, const char* cname) { // Find the jmethodID of the specified method while (--count >= 0) { - char* name = NULL; + char* name = nullptr; jclass klass = classes[count]; - err = jvmti->GetClassSignature(klass, &name, NULL); + err = jvmti->GetClassSignature(klass, &name, nullptr); check_jvmti_status(jni, err, "find_class: error in JVMTI GetClassSignature call"); bool found = (strcmp(name, cname) == 0); @@ -347,13 +347,13 @@ find_class(jvmtiEnv *jvmti, JNIEnv *jni, jobject loader, const char* cname) { return klass; } } - return NULL; + return nullptr; } static jmethodID find_method(jvmtiEnv *jvmti, JNIEnv *jni, jclass klass, const char* mname) { - jmethodID *methods = NULL; - jmethodID method = NULL; + jmethodID *methods = nullptr; + jmethodID method = nullptr; jint count = 0; jvmtiError err; @@ -362,11 +362,11 @@ find_method(jvmtiEnv *jvmti, JNIEnv *jni, jclass klass, const char* mname) { // Find the jmethodID of the specified method while (--count >= 0) { - char* name = NULL; + char* name = nullptr; jmethodID meth = methods[count]; - err = jvmti->GetMethodName(meth, &name, NULL, NULL); + err = jvmti->GetMethodName(meth, &name, nullptr, nullptr); check_jvmti_status(jni, err, "find_method: error in JVMTI GetMethodName call"); bool found = (strcmp(name, mname) == 0); @@ -387,7 +387,7 @@ print_current_stack_trace(jvmtiEnv *jvmti, JNIEnv* jni) { jvmtiFrameInfo frames[MAX_FRAME_COUNT_PRINT_STACK_TRACE]; jint count = 0; - jvmtiError err = jvmti->GetStackTrace(NULL, 0, MAX_FRAME_COUNT_PRINT_STACK_TRACE, frames, &count); + jvmtiError err = jvmti->GetStackTrace(nullptr, 0, MAX_FRAME_COUNT_PRINT_STACK_TRACE, frames, &count); check_jvmti_status(jni, err, "print_stack_trace: error in JVMTI GetStackTrace"); LOG("JVMTI Stack Trace for current thread: frame count: %d\n", count); @@ -759,19 +759,19 @@ isThreadExpected(jvmtiEnv *jvmti, jthread thread) { } jthread find_thread_by_name(jvmtiEnv* jvmti, JNIEnv* jni, const char name[]) { - jthread* threads = NULL; + jthread* threads = nullptr; jint count = 0; - jthread found_thread = NULL; + jthread found_thread = nullptr; - if (name == NULL) { - return NULL; + if (name == nullptr) { + return nullptr; } check_jvmti_status(jni, jvmti->GetAllThreads(&count, &threads), ""); for (int i = 0; i < count; i++) { jvmtiThreadInfo info = get_thread_info(jvmti, jni, threads[i]); - if (info.name != NULL && strcmp(name, info.name) == 0) { + if (info.name != nullptr && strcmp(name, info.name) == 0) { found_thread = threads[i]; break; } @@ -793,22 +793,22 @@ static const jvmtiEvent static jvmtiExtensionFunction find_ext_function(jvmtiEnv* jvmti, JNIEnv* jni, const char* fname) { jint extCount = 0; - jvmtiExtensionFunctionInfo* extList = NULL; + jvmtiExtensionFunctionInfo* extList = nullptr; jvmtiError err = jvmti->GetExtensionFunctions(&extCount, &extList); check_jvmti_status(jni, err, "jvmti_common find_ext_function: Error in JVMTI GetExtensionFunctions"); for (int i = 0; i < extCount; i++) { - if (strstr(extList[i].id, (char*)fname) != NULL) { + if (strstr(extList[i].id, (char*)fname) != nullptr) { return extList[i].func; } } - return NULL; + return nullptr; } static jvmtiError GetVirtualThread(jvmtiEnv* jvmti, JNIEnv* jni, jthread cthread, jthread* vthread_ptr) { - if (GetVirtualThread_func == NULL) { // lazily initialize function pointer + if (GetVirtualThread_func == nullptr) { // lazily initialize function pointer GetVirtualThread_func = find_ext_function(jvmti, jni, "GetVirtualThread"); } jvmtiError err = (*GetVirtualThread_func)(jvmti, cthread, vthread_ptr); @@ -818,7 +818,7 @@ GetVirtualThread(jvmtiEnv* jvmti, JNIEnv* jni, jthread cthread, jthread* vthread static jvmtiError GetCarrierThread(jvmtiEnv* jvmti, JNIEnv* jni, jthread vthread, jthread* cthread_ptr) { - if (GetCarrierThread_func == NULL) { // lazily initialize function pointer + if (GetCarrierThread_func == nullptr) { // lazily initialize function pointer GetCarrierThread_func = find_ext_function(jvmti, jni, "GetCarrierThread"); } jvmtiError err = (*GetCarrierThread_func)(jvmti, vthread, cthread_ptr); @@ -828,7 +828,7 @@ GetCarrierThread(jvmtiEnv* jvmti, JNIEnv* jni, jthread vthread, jthread* cthread static jthread get_virtual_thread(jvmtiEnv* jvmti, JNIEnv* jni, jthread cthread) { - jthread vthread = NULL; + jthread vthread = nullptr; jvmtiError err = GetVirtualThread(jvmti, jni, cthread, &vthread); check_jvmti_status(jni, err, "jvmti_common get_virtual_thread: Error in JVMTI extension GetVirtualThread"); return vthread; @@ -836,7 +836,7 @@ get_virtual_thread(jvmtiEnv* jvmti, JNIEnv* jni, jthread cthread) { static jthread get_carrier_thread(jvmtiEnv* jvmti, JNIEnv* jni, jthread vthread) { - jthread cthread = NULL; + jthread cthread = nullptr; jvmtiError err = GetCarrierThread(jvmti, jni, vthread, &cthread); check_jvmti_status(jni, err, "jvmti_common get_carrier_thread: Error in JVMTI extension GetCarrierThread"); @@ -846,26 +846,26 @@ get_carrier_thread(jvmtiEnv* jvmti, JNIEnv* jni, jthread vthread) { static jvmtiExtensionEventInfo* find_ext_event(jvmtiEnv* jvmti, const char* ename) { jint extCount = 0; - jvmtiExtensionEventInfo* extList = NULL; + jvmtiExtensionEventInfo* extList = nullptr; jvmtiError err = jvmti->GetExtensionEvents(&extCount, &extList); if (err != JVMTI_ERROR_NONE) { LOG("jvmti_common find_ext_event: Error in JVMTI GetExtensionFunctions: %s(%d)\n",TranslateError(err), err); - return NULL; + return nullptr; } for (int i = 0; i < extCount; i++) { - if (strstr(extList[i].id, (char*)ename) != NULL) { + if (strstr(extList[i].id, (char*)ename) != nullptr) { return &extList[i]; } } - return NULL; + return nullptr; } static jvmtiError set_ext_event_callback(jvmtiEnv* jvmti, const char* ename, jvmtiExtensionEvent callback) { jvmtiExtensionEventInfo* info = find_ext_event(jvmti, ename); - if (info == NULL) { + if (info == nullptr) { LOG("jvmti_common set_ext_event_callback: Extension event was not found: %s\n", ename); return JVMTI_ERROR_NOT_AVAILABLE; } diff --git a/test/lib/jdk/test/lib/jvmti/jvmti_thread.h b/test/lib/jdk/test/lib/jvmti/jvmti_thread.hpp similarity index 90% rename from test/lib/jdk/test/lib/jvmti/jvmti_thread.h rename to test/lib/jdk/test/lib/jvmti/jvmti_thread.hpp index ed27eb521d4..9d1c612bed4 100644 --- a/test/lib/jdk/test/lib/jvmti/jvmti_thread.h +++ b/test/lib/jdk/test/lib/jvmti/jvmti_thread.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * 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,8 +21,8 @@ * questions. */ -#ifndef JVMTI_THREAD_H -#define JVMTI_THREAD_H +#ifndef JVMTI_THREAD_HPP +#define JVMTI_THREAD_HPP #include #include @@ -55,14 +55,14 @@ extern "C" { #define STATUS_PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv* agent_jvmti_env = NULL; -static JNIEnv* agent_jni_env = NULL; +static jvmtiEnv* agent_jvmti_env = nullptr; +static JNIEnv* agent_jni_env = nullptr; static volatile int current_agent_status = STATUS_PASSED; -static jthread jvmti_agent_thread = NULL; -static jvmtiStartFunction agent_thread_proc = NULL; -static void* agent_thread_arg = NULL; +static jthread jvmti_agent_thread = nullptr; +static jvmtiStartFunction agent_thread_proc = nullptr; +static void* agent_thread_arg = nullptr; void set_agent_fail_status() { current_agent_status = STATUS_FAILED; @@ -185,7 +185,7 @@ static void JNICALL agent_thread_wrapper(jvmtiEnv* jvmti_env, JNIEnv* agentJNI, { /* gelete global ref for agent thread */ agentJNI->DeleteGlobalRef(jvmti_agent_thread); - jvmti_agent_thread = NULL; + jvmti_agent_thread = nullptr; } } @@ -198,37 +198,37 @@ static jthread start_agent_thread_wrapper(JNIEnv *jni_env, jvmtiEnv* jvmti_env) const char* THREAD_CTOR_NAME = ""; const char* THREAD_CTOR_SIGNATURE = "(Ljava/lang/String;)V"; - jobject threadName = NULL; - jclass threadClass = NULL; - jmethodID threadCtor = NULL; - jobject threadObject = NULL; - jobject threadGlobalRef = NULL; + jobject threadName = nullptr; + jclass threadClass = nullptr; + jmethodID threadCtor = nullptr; + jobject threadObject = nullptr; + jobject threadGlobalRef = nullptr; jvmtiError err; threadClass = jni_env->FindClass(THREAD_CLASS_NAME); - if (threadClass == NULL) { - return NULL; + if (threadClass == nullptr) { + return nullptr; } threadCtor = jni_env->GetMethodID(threadClass, THREAD_CTOR_NAME, THREAD_CTOR_SIGNATURE); - if (threadCtor == NULL) { - return NULL; + if (threadCtor == nullptr) { + return nullptr; } threadName = jni_env->NewStringUTF(THREAD_NAME); - if (threadName == NULL) { - return NULL; + if (threadName == nullptr) { + return nullptr; } threadObject = jni_env->NewObject(threadClass, threadCtor, threadName); - if (threadObject == NULL) { - return NULL; + if (threadObject == nullptr) { + return nullptr; } threadGlobalRef = jni_env->NewGlobalRef(threadObject); - if (threadGlobalRef == NULL) { + if (threadGlobalRef == nullptr) { jni_env->DeleteLocalRef(threadObject); - return NULL; + return nullptr; } jvmti_agent_thread = (jthread)threadGlobalRef; @@ -236,7 +236,7 @@ static jthread start_agent_thread_wrapper(JNIEnv *jni_env, jvmtiEnv* jvmti_env) if (err != JVMTI_ERROR_NONE) { jni_env->DeleteGlobalRef(threadGlobalRef); jni_env->DeleteLocalRef(threadObject); - return NULL; + return nullptr; } return jvmti_agent_thread; } @@ -245,9 +245,9 @@ static jthread start_agent_thread_wrapper(JNIEnv *jni_env, jvmtiEnv* jvmti_env) static jthread run_agent_thread(JNIEnv *jni_env, jvmtiEnv* jvmti_env) { /* start agent thread wrapper */ jthread thread = start_agent_thread_wrapper(jni_env, jvmti_env); - if (thread == NULL) { + if (thread == nullptr) { set_agent_fail_status(); - return NULL; + return nullptr; } return thread; @@ -265,7 +265,7 @@ static jint sync_debuggee_status(JNIEnv* jni_env, jvmtiEnv* jvmti_env, jint debu /* we don't enter if-stmt in second call */ if (agent_data.thread_state == NEW) { - if (run_agent_thread(jni_env, jvmti_env) == NULL) { + if (run_agent_thread(jni_env, jvmti_env) == nullptr) { return result; } diff --git a/test/lib/jdk/test/lib/security/SeededSecureRandom.java b/test/lib/jdk/test/lib/security/SeededSecureRandom.java new file mode 100644 index 00000000000..f897677390e --- /dev/null +++ b/test/lib/jdk/test/lib/security/SeededSecureRandom.java @@ -0,0 +1,68 @@ +/* + * Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package jdk.test.lib.security; + +import java.security.SecureRandom; +import java.util.Random; + +/** + * A deterministic SecureRandom with a seed. + *

        + * Users can provide the seed with the system property "secure.random.seed". + * Otherwise, it's a random value. Usually, a test runs without this system + * property and the random seed is printed out. When it fails, set the + * system property to this recorded seed to reproduce the failure. + */ +public class SeededSecureRandom extends SecureRandom { + + private final Random rnd; + + public static long seed() { + String value = System.getProperty("secure.random.seed"); + long seed = value != null + ? Long.parseLong(value) + : new Random().nextLong(); + System.out.println("SeededSecureRandom: seed = " + seed); + return seed; + } + + public SeededSecureRandom(long seed) { + rnd = new Random(seed); + } + + public static SeededSecureRandom one() { + return new SeededSecureRandom(seed()); + } + + @Override + public void nextBytes(byte[] bytes) { + rnd.nextBytes(bytes); + } + + @Override + public byte[] generateSeed(int numBytes) { + var out = new byte[numBytes]; + rnd.nextBytes(out); + return out; + } +} diff --git a/test/lib/native/testlib_threads.h b/test/lib/native/testlib_threads.hpp similarity index 88% rename from test/lib/native/testlib_threads.h rename to test/lib/native/testlib_threads.hpp index 575a5a3c15f..3a7b18eccf6 100644 --- a/test/lib/native/testlib_threads.h +++ b/test/lib/native/testlib_threads.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved. * 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,8 +21,8 @@ * questions. */ -#ifndef TEST_LIB_NATIVE_THREAD_H -#define TEST_LIB_NATIVE_THREAD_H +#ifndef TEST_LIB_NATIVE_THREAD_HPP +#define TEST_LIB_NATIVE_THREAD_HPP // Header only library for using threads in tests @@ -70,8 +70,8 @@ void run_in_new_thread_and_join(PROCEDURE proc, void* context) { helper.proc = proc; helper.context = context; #ifdef _WIN32 - HANDLE thread = CreateThread(NULL, 0, procedure, &helper, 0, NULL); - if (thread == NULL) { + HANDLE thread = CreateThread(nullptr, 0, procedure, &helper, 0, nullptr); + if (thread == nullptr) { fatal("failed to create thread", GetLastError()); } if (WaitForSingleObject(thread, INFINITE) != WAIT_OBJECT_0) { @@ -90,7 +90,7 @@ void run_in_new_thread_and_join(PROCEDURE proc, void* context) { fatal("failed to create thread", result); } pthread_attr_destroy(&attr); - result = pthread_join(thread, NULL); + result = pthread_join(thread, nullptr); if (result != 0) { fatal("failed to join thread", result); } @@ -99,4 +99,4 @@ void run_in_new_thread_and_join(PROCEDURE proc, void* context) { } -#endif // TEST_LIB_NATIVE_THREAD_H +#endif // TEST_LIB_NATIVE_THREAD_HPP diff --git a/test/micro/org/openjdk/bench/java/io/DataInputStreamTest.java b/test/micro/org/openjdk/bench/java/io/DataInputStreamTest.java index 3856cea22ef..287a6a88967 100644 --- a/test/micro/org/openjdk/bench/java/io/DataInputStreamTest.java +++ b/test/micro/org/openjdk/bench/java/io/DataInputStreamTest.java @@ -1,5 +1,6 @@ /* - * Copyright (c) 2020, 2022, Red Hat Inc. All rights reserved. + * Copyright (c) 2020, Red Hat Inc. All rights reserved. + * Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,7 +28,10 @@ import org.openjdk.jmh.infra.Blackhole; import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.io.IOException; import java.util.concurrent.ThreadLocalRandom; import java.util.concurrent.TimeUnit; @@ -38,22 +42,85 @@ @Warmup(iterations = 2, time = 2) @State(Scope.Thread) public class DataInputStreamTest { - private final int size = 1024; + private static final int SIZE = 1024; private ByteArrayInputStream bais; + private ByteArrayInputStream utfDataAsciiMixed; + private ByteArrayInputStream utfDataMixed; + + private ByteArrayInputStream utfDataAsciiSmall; + private ByteArrayInputStream utfDataSmall; + + private ByteArrayInputStream utfDataAsciiLarge; + private ByteArrayInputStream utfDataLarge; + + private static final int REPEATS = 20; @Setup(Level.Iteration) - public void setup() { - byte[] bytes = new byte[size]; + public void setup() throws IOException, ClassNotFoundException, NoSuchMethodException, IllegalAccessException { + byte[] bytes = new byte[SIZE]; ThreadLocalRandom.current().nextBytes(bytes); bais = new ByteArrayInputStream(bytes); + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + DataOutputStream dataOut = new DataOutputStream(baos); + for (int i = 0; i < REPEATS; i++) { + dataOut.writeUTF("small"); + dataOut.writeUTF("slightly longer string that is more likely to trigger use of simd intrinsics"); + } + dataOut.flush(); + utfDataAsciiMixed = new ByteArrayInputStream(baos.toByteArray()); + + baos = new ByteArrayOutputStream(); + dataOut = new DataOutputStream(baos); + for (int i = 0; i < REPEATS; i++) { + dataOut.writeUTF("slightly longer string that is more likely to trigger use of simd intrinsics"); + dataOut.writeUTF("slightly longer string that is more likely to trigger use of simd intrinsics"); + } + dataOut.flush(); + utfDataAsciiLarge = new ByteArrayInputStream(baos.toByteArray()); + + baos = new ByteArrayOutputStream(); + dataOut = new DataOutputStream(baos); + for (int i = 0; i < REPEATS; i++) { + dataOut.writeUTF("smol"); + dataOut.writeUTF("smally"); + } + dataOut.flush(); + utfDataAsciiSmall = new ByteArrayInputStream(baos.toByteArray()); + + baos = new ByteArrayOutputStream(); + dataOut = new DataOutputStream(baos); + for (int i = 0; i < REPEATS; i++) { + dataOut.writeUTF("sm\u00FFll"); + dataOut.writeUTF("slightly longer string th\u01F3t is more likely to trigger use of simd intrinsics"); + } + dataOut.flush(); + utfDataMixed = new ByteArrayInputStream(baos.toByteArray()); + + baos = new ByteArrayOutputStream(); + dataOut = new DataOutputStream(baos); + for (int i = 0; i < REPEATS; i++) { + dataOut.writeUTF("sm\u00F3l"); + dataOut.writeUTF("small\u0132"); + } + dataOut.flush(); + utfDataSmall = new ByteArrayInputStream(baos.toByteArray()); + + baos = new ByteArrayOutputStream(); + dataOut = new DataOutputStream(baos); + for (int i = 0; i < REPEATS; i++) { + dataOut.writeUTF("slightly longer string that is more likely to trigg\u0131r use of simd intrinsics"); + dataOut.writeUTF("slightly longer string th\u0131t is more likely to trigger use of simd intrinsics"); + } + dataOut.flush(); + utfDataLarge = new ByteArrayInputStream(baos.toByteArray()); } @Benchmark public void readChar(Blackhole bh) throws Exception { bais.reset(); DataInputStream dis = new DataInputStream(bais); - for (int i = 0; i < size / 2; i++) { + for (int i = 0; i < SIZE / 2; i++) { bh.consume(dis.readChar()); } } @@ -62,8 +129,68 @@ public void readChar(Blackhole bh) throws Exception { public void readInt(Blackhole bh) throws Exception { bais.reset(); DataInputStream dis = new DataInputStream(bais); - for (int i = 0; i < size / 4; i++) { + for (int i = 0; i < SIZE / 4; i++) { bh.consume(dis.readInt()); } } + + @Benchmark + public void readUTFAsciiMixed(Blackhole bh) throws Exception { + utfDataAsciiMixed.reset(); + DataInputStream dis = new DataInputStream(utfDataAsciiMixed); + for (int i = 0; i < REPEATS; i++) { + bh.consume(dis.readUTF()); + bh.consume(dis.readUTF()); + } + } + + @Benchmark + public void readUTFAsciiSmall(Blackhole bh) throws Exception { + utfDataAsciiSmall.reset(); + DataInputStream dis = new DataInputStream(utfDataAsciiSmall); + for (int i = 0; i < REPEATS; i++) { + bh.consume(dis.readUTF()); + bh.consume(dis.readUTF()); + } + } + + @Benchmark + public void readUTFAsciiLarge(Blackhole bh) throws Exception { + utfDataAsciiLarge.reset(); + DataInputStream dis = new DataInputStream(utfDataAsciiLarge); + for (int i = 0; i < REPEATS; i++) { + bh.consume(dis.readUTF()); + bh.consume(dis.readUTF()); + } + } + + @Benchmark + public void readUTFMixed(Blackhole bh) throws Exception { + utfDataMixed.reset(); + DataInputStream dis = new DataInputStream(utfDataMixed); + for (int i = 0; i < REPEATS; i++) { + bh.consume(dis.readUTF()); + bh.consume(dis.readUTF()); + } + } + + @Benchmark + public void readUTFSmall(Blackhole bh) throws Exception { + utfDataSmall.reset(); + DataInputStream dis = new DataInputStream(utfDataSmall); + for (int i = 0; i < REPEATS; i++) { + bh.consume(dis.readUTF()); + bh.consume(dis.readUTF()); + } + } + + @Benchmark + public void readUTFLarge(Blackhole bh) throws Exception { + utfDataLarge.reset(); + DataInputStream dis = new DataInputStream(utfDataLarge); + for (int i = 0; i < REPEATS; i++) { + bh.consume(dis.readUTF()); + bh.consume(dis.readUTF()); + } + } } diff --git a/test/micro/org/openjdk/bench/java/io/ObjectInputStreamTest.java b/test/micro/org/openjdk/bench/java/io/ObjectInputStreamTest.java new file mode 100644 index 00000000000..76f4cd62efe --- /dev/null +++ b/test/micro/org/openjdk/bench/java/io/ObjectInputStreamTest.java @@ -0,0 +1,186 @@ +/* + * Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package org.openjdk.bench.java.io; + +import org.openjdk.jmh.annotations.Benchmark; +import org.openjdk.jmh.annotations.BenchmarkMode; +import org.openjdk.jmh.annotations.Fork; +import org.openjdk.jmh.annotations.Level; +import org.openjdk.jmh.annotations.Measurement; +import org.openjdk.jmh.annotations.Mode; +import org.openjdk.jmh.annotations.OutputTimeUnit; +import org.openjdk.jmh.annotations.Scope; +import org.openjdk.jmh.annotations.Setup; +import org.openjdk.jmh.annotations.State; +import org.openjdk.jmh.annotations.Warmup; +import org.openjdk.jmh.infra.Blackhole; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.io.IOException; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; +import java.util.concurrent.ThreadLocalRandom; +import java.util.concurrent.TimeUnit; + +@BenchmarkMode(Mode.AverageTime) +@OutputTimeUnit(TimeUnit.MICROSECONDS) +@Fork(value = 3, warmups = 0) +@Measurement(iterations = 5, time = 1) +@Warmup(iterations = 2, time = 2) +@State(Scope.Thread) +public class ObjectInputStreamTest { + private ByteArrayInputStream utfDataAsciiMixed; + private ByteArrayInputStream utfDataMixed; + + private ByteArrayInputStream utfDataAsciiSmall; + private ByteArrayInputStream utfDataSmall; + + private ByteArrayInputStream utfDataAsciiLarge; + private ByteArrayInputStream utfDataLarge; + + // Overhead of creating an ObjectInputStream is significant, need to increase the number of data elements + // to balance work + private static final int REPEATS = 20; + + + @Setup(Level.Iteration) + public void setup() throws IOException, ClassNotFoundException, NoSuchMethodException, IllegalAccessException { + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + ObjectOutputStream dataOut = new ObjectOutputStream(baos); + for (int i = 0; i < REPEATS; i++) { + dataOut.writeUTF("small"); + dataOut.writeUTF("slightly longer string that is more likely to trigger use of simd intrinsics"); + } + dataOut.flush(); + utfDataAsciiMixed = new ByteArrayInputStream(baos.toByteArray()); + + baos = new ByteArrayOutputStream(); + dataOut = new ObjectOutputStream(baos); + for (int i = 0; i < REPEATS; i++) { + dataOut.writeUTF("slightly longer string that is more likely to trigger use of simd intrinsics"); + dataOut.writeUTF("slightly longer string that is more likely to trigger use of simd intrinsics"); + } + dataOut.flush(); + utfDataAsciiLarge = new ByteArrayInputStream(baos.toByteArray()); + + baos = new ByteArrayOutputStream(); + dataOut = new ObjectOutputStream(baos); + for (int i = 0; i < REPEATS; i++) { + dataOut.writeUTF("smol"); + dataOut.writeUTF("smally"); + } + dataOut.flush(); + utfDataAsciiSmall = new ByteArrayInputStream(baos.toByteArray()); + + baos = new ByteArrayOutputStream(); + dataOut = new ObjectOutputStream(baos); + for (int i = 0; i < REPEATS; i++) { + dataOut.writeUTF("sm\u00FFll"); + dataOut.writeUTF("slightly longer string th\u01F3t is more likely to trigger use of simd intrinsics"); + } + dataOut.flush(); + utfDataMixed = new ByteArrayInputStream(baos.toByteArray()); + + baos = new ByteArrayOutputStream(); + dataOut = new ObjectOutputStream(baos); + for (int i = 0; i < REPEATS; i++) { + dataOut.writeUTF("sm\u00F3l"); + dataOut.writeUTF("small\u0132"); + } + dataOut.flush(); + utfDataSmall = new ByteArrayInputStream(baos.toByteArray()); + + baos = new ByteArrayOutputStream(); + dataOut = new ObjectOutputStream(baos); + for (int i = 0; i < REPEATS; i++) { + dataOut.writeUTF("slightly longer string that is more likely to trigg\u0131r use of simd intrinsics"); + dataOut.writeUTF("slightly longer string th\u0131t is more likely to trigger use of simd intrinsics"); + } + dataOut.flush(); + utfDataLarge = new ByteArrayInputStream(baos.toByteArray()); + } + + @Benchmark + public void readUTFAsciiMixed(Blackhole bh) throws Exception { + utfDataAsciiMixed.reset(); + ObjectInputStream ois = new ObjectInputStream(utfDataAsciiMixed); + for (int i = 0; i < REPEATS; i++) { + bh.consume(ois.readUTF()); + bh.consume(ois.readUTF()); + } + } + + @Benchmark + public void readUTFAsciiSmall(Blackhole bh) throws Exception { + utfDataAsciiSmall.reset(); + ObjectInputStream ois = new ObjectInputStream(utfDataAsciiSmall); + for (int i = 0; i < REPEATS; i++) { + bh.consume(ois.readUTF()); + bh.consume(ois.readUTF()); + } + } + + @Benchmark + public void readUTFAsciiLarge(Blackhole bh) throws Exception { + utfDataAsciiLarge.reset(); + ObjectInputStream ois = new ObjectInputStream(utfDataAsciiLarge); + for (int i = 0; i < REPEATS; i++) { + bh.consume(ois.readUTF()); + bh.consume(ois.readUTF()); + } + } + + @Benchmark + public void readUTFMixed(Blackhole bh) throws Exception { + utfDataMixed.reset(); + ObjectInputStream ois = new ObjectInputStream(utfDataMixed); + for (int i = 0; i < REPEATS; i++) { + bh.consume(ois.readUTF()); + bh.consume(ois.readUTF()); + } + } + + @Benchmark + public void readUTFSmall(Blackhole bh) throws Exception { + utfDataSmall.reset(); + ObjectInputStream ois = new ObjectInputStream(utfDataSmall); + for (int i = 0; i < REPEATS; i++) { + bh.consume(ois.readUTF()); + bh.consume(ois.readUTF()); + } + } + + @Benchmark + public void readUTFLarge(Blackhole bh) throws Exception { + utfDataLarge.reset(); + ObjectInputStream ois = new ObjectInputStream(utfDataLarge); + for (int i = 0; i < REPEATS; i++) { + bh.consume(ois.readUTF()); + bh.consume(ois.readUTF()); + } + } +}